diff options
author | florent <florent@toopy.org> | 2012-01-19 01:06:42 (GMT) |
---|---|---|
committer | florent <florent@toopy.org> | 2012-01-19 01:06:42 (GMT) |
commit | 6baa67a6bdade77c6580affae7490e45008e47d5 (patch) | |
tree | 195f28e8cea7c39eba103c97e9027b80c552d840 | |
parent | acb4b6642e50c901bd498daa5bd48bd910550457 (diff) |
load edit screen if no included story
-rw-r--r-- | activity.py | 19 |
1 files changed, 16 insertions, 3 deletions
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): |