Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorent <florent.pigout@gmail.com>2011-04-16 18:49:05 (GMT)
committer florent <florent.pigout@gmail.com>2011-04-16 18:49:05 (GMT)
commit78c999c0c5052fd73f1957db125d288b7c03456e (patch)
tree9d5ae3ec75ce4e2dafb3aa3dfe262337e5c6d7e1
parentf18a18153ec1b4806e69d7879f3a387f7ea5f4de (diff)
prepare project export to listed media root path
-rw-r--r--activity.py7
-rw-r--r--atoidejouer/tools/storage.py27
-rw-r--r--atoidejouer/tools/ui.py7
-rw-r--r--atoidejouer/ui/screens.py31
4 files changed, 52 insertions, 20 deletions
diff --git a/activity.py b/activity.py
index ac325dd..d2921d6 100644
--- a/activity.py
+++ b/activity.py
@@ -120,13 +120,10 @@ def _toolbar_changed(toolbox, page, activity_):
"""
# is the activity tab?
if page == 0:
+ # remove first if exist
+ activity_.remove_screen('activity')
# show the activity screen
activity_._change_screen(toolbar=None, name='activity')
- # ..
- _screen = activity_.get_current_screen()
- # ..
- _screen.msg_label_import.hide()
- _screen.msg_label_export.hide()
else:
pass
# propagate it
diff --git a/atoidejouer/tools/storage.py b/atoidejouer/tools/storage.py
index 584559f..0184528 100644
--- a/atoidejouer/tools/storage.py
+++ b/atoidejouer/tools/storage.py
@@ -228,14 +228,27 @@ def init_activity_folder():
__check_dir_files('stories')
-def import_project(file_path, msg_label):
+def __show_in_out_result_message(label, message):
# ..
- msg_label.set_markup(_('<span size="large" style="italic">IMPORT</span>'))
- msg_label.show()
-
+ label.set_markup('<span size="large" style="italic">%s</span>' % message)
+ label.show()
-def export_project(msg_label):
+def import_project(file_path, msg_label):
+ # tmp message
+ __show_in_out_result_message(msg_label, _('IMPORT'))
+
+
+def export_project(msg_label, media):
+ # TODO - create a tmp stucture
+ # TODO - copy keys
+ # TODO - copy sequences
+ # TODO - list and copy required graphics
+ # TODO - list and copy required sounds
+ # TODO - zip all
+ # TODO - check media size
+ # TODO - copy zip to media
+ # TODO - remove tmp structure
# ..
- msg_label.set_markup(_('<span size="large" style="italic">EXPORT</span>'))
- msg_label.show()
+ # tmp message
+ __show_in_out_result_message(msg_label, _('EXPORT'))
diff --git a/atoidejouer/tools/ui.py b/atoidejouer/tools/ui.py
index aec01b2..3568480 100644
--- a/atoidejouer/tools/ui.py
+++ b/atoidejouer/tools/ui.py
@@ -22,7 +22,7 @@ def get_color(red, green, blue):
return gtk.gdk.Color(red, green, blue)
-def get_button(label=None, stock_id=None, width=-1):
+def get_button(label=None, stock_id=None, width=-1, padding=None):
# little check:
if label is None and stock_id is None:
return None
@@ -45,6 +45,11 @@ def get_button(label=None, stock_id=None, width=-1):
_img.show()
# get img path
_img.set_from_file(storage.get_icon_path(stock_id))
+ # manage padding
+ if padding is None:
+ pass
+ else:
+ _img.set_padding(*padding)
# do add
_box.pack_start(_img, expand=_expand, fill=True)
# use label?
diff --git a/atoidejouer/ui/screens.py b/atoidejouer/ui/screens.py
index 8fcde91..05501ea 100644
--- a/atoidejouer/ui/screens.py
+++ b/atoidejouer/ui/screens.py
@@ -577,7 +577,7 @@ def _on_toggle_click(radio, screen, option, value):
pass
-def _on_button_click(button, screen, name, msg_label):
+def _on_button_click(button, screen, name, msg_label, value):
if name == 'import':
try:
# int file chooser
@@ -599,7 +599,7 @@ def _on_button_click(button, screen, name, msg_label):
# DEBUG
elif name == 'export':
# do export
- storage.export_project(msg_label)
+ storage.export_project(msg_label, value)
else:
pass
@@ -655,6 +655,7 @@ class ScreenActivity(gtk.HBox):
else:
self._group_mode[EASY].set_active(True)
+
def _get_title(self, text):
# init
_label = gtk.Label()
@@ -678,12 +679,14 @@ class ScreenActivity(gtk.HBox):
# return it
return _toggle
- def _get_button(self, name, text, stock_id, msg_label=None):
+ def _get_button(self, name, text, stock_id, msg_label=None, value=None):
# init button
- _button = ui.get_button(label=text, stock_id=stock_id)
+ _button = ui.get_button(label=text, stock_id=stock_id, width=48,
+ padding=(10, 0))
_button.show()
# set cb
- _button.connect('clicked', _on_button_click, self, name, msg_label)
+ _button.connect('clicked', _on_button_click, self, name, msg_label,
+ value)
# return it
return _button
@@ -754,8 +757,22 @@ class ScreenActivity(gtk.HBox):
_vbox.pack_start(self._get_title(_('EXPORT')),
expand=False, fill=True)
self.msg_label_export = self._get_hidden_text()
- _vbox.pack_start(self._get_button('export', _('Choose a Destination'),
- 'export', msg_label=self.msg_label_export), expand=False, fill=True)
+ # TODO list the possible medias
+ for _media in os.listdir('/media'):
+ # current path
+ _path = os.path.join('/media', _media)
+ # should be a dir
+ if os.path.isdir(_path):
+ # set export button text
+ _button_text = _('Export to media \'%s\'' % _media)
+ # init button
+ _button = self._get_button('export', _button_text, 'export',
+ msg_label=self.msg_label_export)
+ # add button
+ _vbox.pack_start(_button, expand=False, fill=True)
+ else:
+ continue
+ # add label
_vbox.pack_start(self.msg_label_export, expand=False, fill=True)
# ..
return _vbox