From 5cbe03a5b903a35ea8daada15e8301feb7d81321 Mon Sep 17 00:00:00 2001 From: Aneesh Dogra Date: Fri, 04 Jan 2013 06:24:49 +0000 Subject: Add brand new icons for Add, Import_Audio and Import_Image buttons. Add a new button to import audio. Add my copyright info. --- diff --git a/LetterMatch.py b/LetterMatch.py index 0cb3e98..c9de5d8 100644 --- a/LetterMatch.py +++ b/LetterMatch.py @@ -1,4 +1,5 @@ -#Copyright (c) 2012 Walter Bender +# Copyright (c) 2012 Walter Bender +# Copyright (c) 2013 Aneesh Dogra # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -155,9 +156,13 @@ class LetterMatch(activity.Activity): journal_toolbar = ToolbarBox() - button_factory('letter', journal_toolbar.toolbar, - self._choose_from_journal_cb, - tooltip=_("Import from journal")) + button_factory('load_image_from_journal', journal_toolbar.toolbar, + self._choose_image_from_journal_cb, + tooltip=_("Import Image")) + + button_factory('load_audio_from_journal', journal_toolbar.toolbar, + self._choose_audio_from_journal_cb, + tooltip=_("Import Audio")) container = gtk.ToolItem() self.letter_entry = gtk.Entry() @@ -168,7 +173,7 @@ class LetterMatch(activity.Activity): container.show_all() journal_toolbar.toolbar.insert(container, -1) - self.add_button = button_factory('image', journal_toolbar.toolbar, + self.add_button = button_factory('add', journal_toolbar.toolbar, self._copy_to_journal, tooltip=_("Add")) self.add_button.set_sensitive(False) @@ -207,21 +212,27 @@ class LetterMatch(activity.Activity): def _copy_to_journal(self, event): self.metadata['data_from_journal'] = json.dumps(self.data_from_journal) - def _choose_from_journal_cb(self, event): + def _choose_audio_from_journal_cb(self, event): self.add_button.set_sensitive(False) self.letter_entry.set_sensitive(False) - self.image_id = None self.audio_id = None + chooser = ObjectChooser(what_filter=mime.GENERIC_TYPE_AUDIO) + result = chooser.run() + if result == gtk.RESPONSE_ACCEPT: + jobject = chooser.get_selected_object() + self.audio_id = str(jobject._object_id) + if self.image_id and self.audio_id: + self.letter_entry.set_sensitive(True) + + def _choose_image_from_journal_cb(self, event): + self.add_button.set_sensitive(False) + self.letter_entry.set_sensitive(False) + self.image_id = None chooser = ObjectChooser(what_filter=mime.GENERIC_TYPE_IMAGE) result = chooser.run() if result == gtk.RESPONSE_ACCEPT: jobject = chooser.get_selected_object() self.image_id = str(jobject._object_id) - chooser = ObjectChooser(what_filter=mime.GENERIC_TYPE_AUDIO) - result = chooser.run() - if result == gtk.RESPONSE_ACCEPT: - jobject = chooser.get_selected_object() - self.audio_id = str(jobject._object_id) if self.image_id and self.audio_id: self.letter_entry.set_sensitive(True) diff --git a/icons/add.svg b/icons/add.svg new file mode 100644 index 0000000..1be20c8 --- /dev/null +++ b/icons/add.svg @@ -0,0 +1,6 @@ + + +]> + + \ No newline at end of file diff --git a/icons/load_audio_from_journal.svg b/icons/load_audio_from_journal.svg new file mode 100644 index 0000000..e888165 --- /dev/null +++ b/icons/load_audio_from_journal.svg @@ -0,0 +1,199 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/icons/load_image_from_journal.svg b/icons/load_image_from_journal.svg new file mode 100644 index 0000000..03980b5 --- /dev/null +++ b/icons/load_image_from_journal.svg @@ -0,0 +1,150 @@ + + + +image/svg+xml + + + + + + + + + \ No newline at end of file diff --git a/page.py b/page.py index 77e140c..86e294e 100644 --- a/page.py +++ b/page.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -#Copyright (c) 2012 Walter Bender - +# Copyright (c) 2012 Walter Bender +# Copyright (c) 2013 Aneesh Dogra # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or -- cgit v0.9.1