diff options
-rw-r--r-- | activity.py | 5 | ||||
-rw-r--r-- | createcardpanel.py | 19 | ||||
-rw-r--r-- | createtoolbar.py | 4 | ||||
-rw-r--r-- | memorizetoolbar.py | 4 |
4 files changed, 23 insertions, 9 deletions
diff --git a/activity.py b/activity.py index 813b837..8f774cd 100644 --- a/activity.py +++ b/activity.py @@ -59,11 +59,16 @@ PATH = '/org/laptop/Memorize' _TOOLBAR_PLAY = 1 _TOOLBAR_CREATE = 2 +this = None + class MemorizeActivity(Activity): def __init__(self, handle): Activity.__init__(self, handle) + global this + this = self + self.create_load = False self.play_mode = None diff --git a/createcardpanel.py b/createcardpanel.py index 5671cd8..c52d2f3 100644 --- a/createcardpanel.py +++ b/createcardpanel.py @@ -43,6 +43,7 @@ import theme import speak.espeak import speak.widgets import speak.face +import activity _logger = logging.getLogger('memorize-activity') @@ -353,7 +354,9 @@ class CardEditor(gtk.EventBox): self.card.set_pixbuf(pixbuf) def _load_image(self, widget): - def load(index): + def load(jobject): + index = jobject.file_path + self.set_speak(None) pixbuf_t = gtk.gdk.pixbuf_new_from_file_at_size( @@ -371,11 +374,14 @@ class CardEditor(gtk.EventBox): del pixbuf_t del pixbuf_z - chooser.pick(what=chooser.IMAGE, - cb=lambda jobject: load(jobject.file_path)) + chooser.pick(parent=activity.this, + what=chooser.IMAGE, + cb=load) def _load_audio(self, widget): - def load(index): + def load(jobject): + index = jobject.file_path + self.set_speak(None) dst = join(self.temp_folder, basename(index)) @@ -388,8 +394,9 @@ class CardEditor(gtk.EventBox): self.emit('has-sound', True) _logger.debug('Audio Loaded: '+dst) - chooser.pick(what=chooser.AUDIO, - cb=lambda jobject: load(jobject.file_path)) + chooser.pick(parent=activity.this, + what=chooser.AUDIO, + cb=load) def _usespeak_cb(self, button): self.card.change_speak(button.props.active) diff --git a/createtoolbar.py b/createtoolbar.py index a849770..b5c72fe 100644 --- a/createtoolbar.py +++ b/createtoolbar.py @@ -111,7 +111,9 @@ class CreateToolbar(gtk.Toolbar): self.emit('create_load_game', game_name) def _load_game(self, button): - chooser = ObjectChooser(_('Choose memorize game'), None, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) + chooser = ObjectChooser(_('Choose memorize game'), + parent=self.activity, + flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) jobject = '' try: result = chooser.run() diff --git a/memorizetoolbar.py b/memorizetoolbar.py index b525b95..1be4743 100644 --- a/memorizetoolbar.py +++ b/memorizetoolbar.py @@ -115,8 +115,8 @@ class MemorizeToolbar(gtk.Toolbar): def _load_game(self, button): chooser = ObjectChooser(_('Choose memorize game'), - None, - gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) + parent=self.activity, + flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT) jobject = '' try: result = chooser.run() |