From 6baa67a6bdade77c6580affae7490e45008e47d5 Mon Sep 17 00:00:00 2001 From: florent Date: Thu, 19 Jan 2012 01:06:42 +0000 Subject: load edit screen if no included story --- diff --git a/activity.py b/activity.py index e34067f..5058215 100644 --- a/activity.py +++ b/activity.py @@ -92,7 +92,8 @@ def _toolbar_changed(toolbox, page, activity_): """Catch toolbox activity tab focus to display settings screen. """ # is the activity tab? - if page == 0 and activity_._updating is False: + if page == 0\ + and activity_._updating is False: # show the activity screen activity_.change_screen('activity') else: @@ -132,8 +133,21 @@ class AToiDeJouerActivity(activity.Activity): self._toolbox.connect('current-toolbar-changed', _toolbar_changed, self) # do anim self._thread = ThreadAnim(self) + # get bundle path + _path = os.path.join(storage.BUND, 'static', 'ext', 'db') + # file by file + has_included_stories = False + for _f in os.listdir(_path): + if _f == 'blank': + continue + has_included_story = True + break # show the activity screen - self.change_screen('activity') + if has_included_stories: + self.change_screen('activity') + # show edit screen if nothing to work on + else: + self.change_screen('edit') def update_max_time(self): self.max_time = story.DB().get_max('time') @@ -233,7 +247,6 @@ class AToiDeJouerActivity(activity.Activity): self._screens[self._current] = _scr # show _scr._show() - # .. self._updating = False def read_file(self, file_path): -- cgit v0.9.1