diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-01-18 16:16:07 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-01-18 16:16:07 (GMT) |
commit | fc59448ec74aef5d590386e858bb4f0393423ab6 (patch) | |
tree | 94c7923aac8cf9ed268ee8a5cb3735f8ecf4a879 | |
parent | fae0e3171a2b09bb16e9fafd014092f5823f7204 (diff) |
save changes to metadata to Journal
-rw-r--r-- | PortfolioActivity.py | 31 | ||||
-rw-r--r-- | icons/save-descriptions.svg | 128 |
2 files changed, 158 insertions, 1 deletions
diff --git a/PortfolioActivity.py b/PortfolioActivity.py index bc16dea..3ffaf27 100644 --- a/PortfolioActivity.py +++ b/PortfolioActivity.py @@ -139,7 +139,7 @@ class PortfolioActivity(activity.Activity): self._height = gtk.gdk.screen_height() self._scale = gtk.gdk.screen_height() / 900. - if self._hw[0:2] == 'xo': + if not HAVE_TOOLBOX and self._hw[0:2] == 'xo': titlef = 18 descriptionf = 12 else: @@ -347,6 +347,12 @@ class PortfolioActivity(activity.Activity): self._save_pdf = button_factory( 'save-as-pdf', activity_button_toolbar, self._save_as_pdf_cb, tooltip=_('Save as PDF')) + + separator_factory(activity_button_toolbar) + + self._save_to_journal = button_factory( + 'save-descriptions', activity_button_toolbar, + self._save_descriptions_cb, tooltip=_('Save descriptions')) else: separator_factory(self.toolbar) @@ -357,6 +363,12 @@ class PortfolioActivity(activity.Activity): 'save-as-pdf', self.toolbar, self._save_as_pdf_cb, tooltip=_('Save as PDF')) + separator_factory(self.toolbar) + + self._save_to_journal = button_factory( + 'save-descriptions', self.toolbar, + self._save_descriptions_cb, tooltip=_('Save descriptions')) + if HAVE_TOOLBOX: separator_factory(toolbox.toolbar, True, False) @@ -905,3 +917,20 @@ class PortfolioActivity(activity.Activity): obj_id in dsobject.metadata['tags']: return dsobject return None + + def _save_descriptions_cb(self, button): + ''' Find the object in the datastore and write out the changes + to the decriptions. ''' + for i in self.dsobjects: + jobject = datastore.get(i.object_id) + jobject.metadata['description'] = i.metadata['description'] + jobject.metadata['keep'] = i.metadata['keep'] + datastore.write(jobject, update_mtime=False, + reply_handler=self.datastore_write_cb, + error_handler=self.datastore_write_error_cb) + + def datastore_write_cb(self): + pass + + def datastore_write_error_cb(self, error): + _logger.error('datastore_write_error_cb: %r' % error) diff --git a/icons/save-descriptions.svg b/icons/save-descriptions.svg new file mode 100644 index 0000000..8f1e1a9 --- /dev/null +++ b/icons/save-descriptions.svg @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="55" + height="55" + viewBox="0 0 55 55" + id="svg2" + xml:space="preserve"><metadata + id="metadata25"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs + id="defs33"> + + + + + + + + + + + + + + + + + + + + + + + + + </defs> +<g + transform="translate(-0.84693255,-0.49999965)" + id="g3136"><g + transform="matrix(0.55205508,0,0,0.55205508,75.618464,18.235971)" + id="g4382"><g + transform="translate(-80.093659,12.220029)" + id="g4308" + style="fill:none;stroke:#ffffff;stroke-opacity:1"><g + id="g4310" + style="fill:none;stroke:#ffffff;stroke-opacity:1"><path + d="m 6.736,49.002 h 24.52 c 2.225,0 3.439,-1.447 3.439,-3.441 v -27.28 c 0,-1.73 -1.732,-3.441 -3.439,-3.441 h -4.389" + id="path4312" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><g + transform="translate(-80.093659,12.220029)" + id="g4314" + style="fill:none;stroke:#ffffff;stroke-opacity:1"><g + id="g4316" + style="fill:none;stroke:#ffffff;stroke-opacity:1"><path + d="m 26.867,38.592 c 0,1.836 -1.345,3.201 -3.441,4.047 L 6.736,49.002 V 14.84 l 16.69,-8.599 c 2.228,-0.394 3.441,0.84 3.441,2.834 v 29.517 z" + id="path4318" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g></g><path + d="m -70.669659,54.827029 c 0,0 -1.351,-0.543 -2.702,-0.543 -1.351,0 -2.703,0.543 -2.703,0.543" + id="path4320" + style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path + d="m -70.669659,44.226029 c 0,0 -1.239,-0.543 -2.815,-0.543 -1.577,0 -2.59,0.543 -2.59,0.543" + id="path4322" + style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><path + d="m -70.669659,33.898029 c 0,0 -1.125,-0.544 -2.927,-0.544 -1.802,0 -2.478,0.544 -2.478,0.544" + id="path4324" + style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /><line + id="line4326" + y2="23.725029" + y1="58.753029" + x2="-66.884659" + x1="-66.884659" + style="fill:none;stroke:#ffffff;stroke-width:2.25;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /></g><g + transform="matrix(1,0,0,-1,-24.386573,49.171266)" + id="g4770"><g + transform="translate(34.0803,-1006.42)" + id="g4772"><polyline + id="polyline4774" + points="51.562,15.306 41.17,16.188 42.053,5.794" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round" + transform="matrix(-0.469241,0.469241,-0.469241,-0.469241,66.2906,1019.03)" /><path + d="m 39.363241,1033.1291 -0.05636,9.9115 -8.750608,0.067" + id="path4776" + style="fill:none;stroke:#ffffff;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g></g><g + transform="matrix(0.7311828,0,0,0.7311828,0.16582795,-0.1075271)" + id="g3092" + style="fill:none;stroke:#ffffff;stroke-opacity:1"> + <g + transform="translate(-3.1255,0)" + id="write-journal" + style="fill:none;stroke:#ffffff;stroke-opacity:1;display:block"> + <path + d="m 8.9375,6 0,43 29.46875,0 c 2.804,0 4.34375,-1.83275 4.34375,-4.34375 l 0,-19.53125 0.1875,-0.25 8.03125,-10.34375 c 0.022,-0.023 0.125,-0.1875 0.125,-0.1875 0.096,-0.161 0.15625,-0.3515 0.15625,-0.5625 0,-0.061 0.012,-0.1295 0,-0.1875 -0.087,-0.763 -0.73225,-1.67525 -1.65625,-2.40625 -0.923,-0.728 -1.95975,-1.12025 -2.71875,-1.03125 -0.326,0.042 -0.78125,0.375 -0.78125,0.375 l -3.15625,4.15625 -0.1875,0.25 0,-4.59375 C 42.75,8.16775 40.55625,6 38.40625,6 L 8.9375,6 z" + transform="translate(3.1255,0)" + id="path3095" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + <line + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" + x1="21.341" + x2="21.341" + y1="6.1209998" + y2="48.881001" + id="line3097" /> + <path + d="m 7.384,14.464 c 0,0 2.084,0.695 4.17,0.695 2.086,0 4.173,-0.695 4.173,-0.695" + id="path3099" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + <path + d="m 7.384,28.021 c 0,0 1.912,0.695 4.345,0.695 2.433,0 3.999,-0.695 3.999,-0.695" + id="path3101" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + <path + d="m 7.384,41.232 c 0,0 1.736,0.695 4.518,0.695 2.781,0 3.825,-0.695 3.825,-0.695" + id="path3103" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> + </g> + <path + d="m 42.806917,14.85 -11.91627,15.831262 -3.475,8.266 c -0.046,0.104 -0.018,0.223 0.069,0.295 0.089,0.072 0.211,0.084 0.307,0.02 l 7.826,-5.037 7.18927,-9.175262" + id="path3105" + style="fill:none;stroke:#ffffff;stroke-width:3.5;stroke-opacity:1" /> + </g></g></svg>
\ No newline at end of file |