Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/atoidejouer/ui/notebook.py
diff options
context:
space:
mode:
Diffstat (limited to 'atoidejouer/ui/notebook.py')
-rw-r--r--atoidejouer/ui/notebook.py53
1 files changed, 29 insertions, 24 deletions
diff --git a/atoidejouer/ui/notebook.py b/atoidejouer/ui/notebook.py
index 5f47872..7f80670 100644
--- a/atoidejouer/ui/notebook.py
+++ b/atoidejouer/ui/notebook.py
@@ -220,6 +220,7 @@ class ResourceNotebook(gtk.Frame):
self.current_sequence = None
# ..
self.library_treeview = None
+ self.sequence_treeview = None
# keep stores
self._store_sequence = None
self._store_graphic = None
@@ -256,6 +257,25 @@ class ResourceNotebook(gtk.Frame):
# return it
return _button, _label
+ def focus_current_seq(self, name=None):
+ # get seq names
+ _seq_names = [_n for _n, _p in storage.list_sequence_names(self._type)]
+ _seq_names.sort()
+ # ..
+ self.current_sequence = name\
+ if len(_seq_names) == 0 or name is not None\
+ else _seq_names[0]
+ if len(_seq_names) == 0:
+ return
+ else:
+ # ..
+ _index = 0 if self.current_sequence is None\
+ or self.current_sequence not in _seq_names\
+ else _seq_names.index(self.current_sequence)
+ # get the current cursor and path
+ self.sequence_treeview.set_cursor(_index)
+
+
def remove_current_row(self):
# get the current cursor and path
_path, _column = self.library_treeview.get_cursor()
@@ -292,31 +312,14 @@ class ResourceNotebook(gtk.Frame):
)
else:
self._store_sequence.clear()
- # prepare dir path
- _seq_dir = os.path.join(activity.get_activity_root(), 'data',
- 'sequences', self._type)
+ # liste seq names
+ _seq_names = storage.list_sequence_names(self._type)
# ..
- for _filename in os.listdir(_seq_dir):
- # ..
- _path = os.path.join(_seq_dir, _filename)
- # little check
- if os.path.isfile(_path):
- # check name
- try:
- _filename, _ext = os.path.splitext(_filename)
- # check ext
- if _ext == '.seq':
- pass
- else:
- continue
- except Exception, e:
- # TODO log something
- continue
- # ...
- _pixbuf = image.get_sequence_first_graphic(self._type,
- _filename)
- # do update
- self._store_sequence.append([_pixbuf, _filename, _path])
+ for _name, _path in _seq_names:
+ # ...
+ _pixbuf = image.get_sequence_first_graphic(self._type, _name)
+ # do update
+ self._store_sequence.append([_pixbuf, _name, _path])
# return the store
return self._store_sequence
@@ -524,6 +527,8 @@ class ResourceNotebook(gtk.Frame):
def _get_notebook(self):
# get list 1
_list1 = self._get_treeview(type_='sequence')
+ # keep sequence treeview
+ self.sequence_treeview = _list1.get_children()[0]
# create a label for the button
_label1 = gtk.Label(_('Sequences'))
# ...