Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/atoidejouer/ui/screen/activity.py
diff options
context:
space:
mode:
Diffstat (limited to 'atoidejouer/ui/screen/activity.py')
-rw-r--r--atoidejouer/ui/screen/activity.py44
1 files changed, 39 insertions, 5 deletions
diff --git a/atoidejouer/ui/screen/activity.py b/atoidejouer/ui/screen/activity.py
index b44f604..423d7cd 100644
--- a/atoidejouer/ui/screen/activity.py
+++ b/atoidejouer/ui/screen/activity.py
@@ -56,13 +56,27 @@ def _on_button_click(button, screen, name, msg_label, value):
else:
pass
+
+def __load_story(screen, path):
+ # little check
+ if os.path.exists(path):
+ # read db
+ screen._activity.read_file(path)
+ # switch to story
+ screen._activity.change_screen('story')
+
+
+def _on_included_click(button, screen, file_):
+ # get bundle path
+ bund = os.path.join(storage.BUND, 'static', 'ext', 'db')
+ path = os.path.join(bund, file_)
+ __load_story(screen, path)
+
+
def _on_recent_click(button, screen, timestamp):
# db path
- _path = storage.get_path_from_journal(timestamp, 'atoidejouer/db')
- # read db
- screen._activity.read_file(_path)
- # switch to story
- screen._activity.change_screen('story')
+ path = storage.get_path_from_journal(timestamp, 'atoidejouer/db')
+ __load_story(screen, path)
[
@@ -154,6 +168,17 @@ class ScreenActivity(gtk.ScrolledWindow):
# return it
return _label
+ def _get_included_button(self, file_):
+ # prepare label
+ _img_name = file_.replace('.db', '')
+ _label = _img_name.replace('_', ' ')
+ # ..
+ _button = ui.get_button(label=_label, img_name=_img_name,
+ width=100, padding=(10, 0), img_size=(100, 100))
+ _button.connect('clicked', _on_included_click, self, file_)
+ _button.show()
+ return _button
+
def _get_included_part(self):
_vbox = gtk.VBox(homogeneous=False, spacing=5)
_vbox.set_border_width(5)
@@ -161,6 +186,15 @@ class ScreenActivity(gtk.ScrolledWindow):
# add first part title
_vbox.pack_start(self._get_title(_('INCLUDED STORIES')),
expand=False, fill=True)
+ # get bundle path
+ _path = os.path.join(storage.BUND, 'static', 'ext', 'db')
+ # file by file
+ for _f in os.listdir(_path):
+ if _f == 'blank':
+ continue
+ _vbox.pack_start(self._get_included_button(_f), expand=False,
+ fill=True)
+ # return part
return _vbox
def _add_left_part(self):