diff options
author | florent <florent.pigout@gmail.com> | 2011-05-26 14:51:47 (GMT) |
---|---|---|
committer | florent <florent.pigout@gmail.com> | 2011-05-26 14:51:47 (GMT) |
commit | 54f969df1469f61ba460675221244bec4080152b (patch) | |
tree | 7ee0b0b6318d4ce93a634146c6659f2fbf09b5d9 | |
parent | dc226d38ce89372d89d95fa0589ba2b592dbf979 (diff) |
add dnd flag to config and activity screen
-rw-r--r-- | atoidejouer/tools/config.py | 14 | ||||
-rw-r--r-- | atoidejouer/ui/screens.py | 50 | ||||
-rw-r--r-- | static/data/config/config.ini | 1 |
3 files changed, 65 insertions, 0 deletions
diff --git a/atoidejouer/tools/config.py b/atoidejouer/tools/config.py index d4d8700..5ea415c 100644 --- a/atoidejouer/tools/config.py +++ b/atoidejouer/tools/config.py @@ -67,6 +67,20 @@ class Config(object): else: return 1.0 + def get_dnd(self): + # get dnd value + _dnd = self.get('activity>dnd') + # ensure dnd + if _dnd in ['yes', 'no']: + pass + else: + # is no by default + _dnd = 'no' + # ensure config for further use + self.set('activity>dnd', _dnd) + # return it + return _dnd + def set(self, path, value, type_=str): # set value self.set_value(*path.split(">"), value=value, type_=type_) diff --git a/atoidejouer/ui/screens.py b/atoidejouer/ui/screens.py index ee410ef..94ccebf 100644 --- a/atoidejouer/ui/screens.py +++ b/atoidejouer/ui/screens.py @@ -661,6 +661,12 @@ def _on_button_click(button, screen, name, msg_label, value): ] = range(3) +[ + YES, + NO, +] = range(2) + + class ScreenActivity(gtk.ScrolledWindow): def __init__(self, activity_): @@ -679,6 +685,7 @@ class ScreenActivity(gtk.ScrolledWindow): # add left menu self._group_mode = None self._group_rate = None + self._group_dnd = None self._add_left_part() # .. self.__main_box.pack_start(gtk.EventBox(), expand=False, fill=True) @@ -719,11 +726,28 @@ class ScreenActivity(gtk.ScrolledWindow): else: self._group_rate[NORMAL].set_active(True) + def __refresh_dnd_part(self): + # get dnd value + _dnd = config.Config().get_dnd() + # update ui + for _i, _b in enumerate(self._group_dnd): + _b.set_active(False) + # update radio boxes + if _dnd == 'no': + self._group_dnd[NO].set_active(True) + elif _dnd == 'yes': + self._group_dnd[YES].set_active(True) + # default no + else: + self._group_dnd[NO].set_active(True) + def refresh(self): # mode self.__refresh_mode_part() # rate self.__refresh_rate_part() + # dnd + self.__refresh_dnd_part() def _get_title(self, text): # init @@ -819,6 +843,29 @@ class ScreenActivity(gtk.ScrolledWindow): # .. return _vbox + def _get_dnd_part(self): + # .. + _vbox = gtk.VBox(homogeneous=False, spacing=5) + # border + _vbox.set_border_width(5) + # show + _vbox.show() + # add first part title + _vbox.pack_start(self._get_title(_('DRAG\'N\'DROP')), + expand=False, fill=True) + # TODO - add some explanation text + # init normal option and use it as group + _no = self._get_toggle_box(None, 'dnd', 'no', _('Don\'t Use Drag\'n\'Drop')) + # add options + _vbox.pack_start(_no, expand=False, fill=True) + # with easy as group + _vbox.pack_start(self._get_toggle_box(_no, 'dnd', 'yes', + _('Use Drag\'n\'Drop')), expand=False, fill=True) + # init group + self._group_dnd = _no.get_group() + # .. + return _vbox + def _add_left_part(self): # .. _vbox = gtk.VBox(homogeneous=False, spacing=5) @@ -834,6 +881,9 @@ class ScreenActivity(gtk.ScrolledWindow): # add rate choices _vbox.pack_start(self._get_rate_part(), expand=False, fill=True) + # add dnd choices + _vbox.pack_start(self._get_dnd_part(), + expand=False, fill=True) def _get_export_part(self): # .. diff --git a/static/data/config/config.ini b/static/data/config/config.ini index 5668210..081641b 100644 --- a/static/data/config/config.ini +++ b/static/data/config/config.ini @@ -1,6 +1,7 @@ [activity] mode = easy rate = normal +dnd = no [mode] easy = image position sound |