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.py88
1 files changed, 76 insertions, 12 deletions
diff --git a/atoidejouer/ui/notebook.py b/atoidejouer/ui/notebook.py
index 261e4cb..cfeb0f8 100644
--- a/atoidejouer/ui/notebook.py
+++ b/atoidejouer/ui/notebook.py
@@ -41,6 +41,11 @@ def _cb_swicth_page(widget, page, page_num, notebook):
def _cb_cursor_changed(treeview, notebook, type_):
# get the current cursor and path
_path, _column = treeview.get_cursor()
+ # DEBUG
+ if _column is None:
+ return
+ else:
+ pass
# get model
_model = treeview.get_model()
# get resource info
@@ -102,6 +107,22 @@ def _cb_cursor_changed(treeview, notebook, type_):
notebook.update_store_sequence()
else:
pass
+ # .. add action - add column as no title
+ if _column.get_title() is None:
+ # get graphic name
+ _item_name = notebook.current_item
+ _sequence_name = notebook.current_sequence
+ if _sequence_name is None\
+ or _sequence_name.strip() == ''\
+ or _item_name is None:
+ pass
+ else:
+ # udpate sequence preview
+ notebook.screen.sequence_preview.add_item(_item_name)
+ # update sequence file
+ storage.sequence_save(notebook.screen.toolbar, remove=remove)
+ else:
+ pass
def __remove_filename_from_sequence(type_, sequence, filename):
@@ -264,8 +285,11 @@ class ResourceNotebook(gtk.Frame):
def _get_store_sequence(self):
# init store
if self._store_sequence is None:
- self._store_sequence = gtk.ListStore(gtk.gdk.Pixbuf,
- gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+ self._store_sequence = gtk.ListStore(
+ gtk.gdk.Pixbuf,
+ gobject.TYPE_STRING,
+ gobject.TYPE_PYOBJECT
+ )
else:
self._store_sequence.clear()
# prepare dir path
@@ -299,11 +323,17 @@ class ResourceNotebook(gtk.Frame):
def _get_store_graphic(self):
# init/reset store
if self._store_graphic is None:
- self._store_graphic = gtk.ListStore(gtk.gdk.Pixbuf,
- gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+ self._store_graphic = gtk.ListStore(
+ gtk.gdk.Pixbuf,
+ gobject.TYPE_STRING,
+ gtk.gdk.Pixbuf,
+ gobject.TYPE_PYOBJECT
+ )
else:
self._store_graphic.clear()
# ..
+ _add_path = storage.get_icon_path('more_small')
+ # ..
_graphic_dir = os.path.join(activity.get_activity_root(), 'data',
'graphics')
# ..
@@ -325,8 +355,9 @@ class ResourceNotebook(gtk.Frame):
continue
# ..
_pixbuf = image.get_pixbuf(_path, 64, 48)
+ _pix_a = image.get_pixbuf(_add_path, 24, 24)
# do update
- self._store_graphic.append([_pixbuf, _filename, _path])
+ self._store_graphic.append([_pixbuf, _filename, _pix_a, _path])
else:
continue
# return the store
@@ -335,12 +366,17 @@ class ResourceNotebook(gtk.Frame):
def _get_store_sound(self):
# init/reset store
if self._store_sound is None:
- self._store_sound = gtk.ListStore(gtk.gdk.Pixbuf,
- gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+ self._store_sound = gtk.ListStore(
+ gtk.gdk.Pixbuf,
+ gobject.TYPE_STRING,
+ gtk.gdk.Pixbuf,
+ gobject.TYPE_PYOBJECT
+ )
else:
self._store_sound.clear()
# prepare icon path
_pix_path = storage.get_image_path('sound', dir_='data')
+ _add_path = storage.get_icon_path('more_small')
# ..
_sound_dir = os.path.join(activity.get_activity_root(), 'data',
'sounds')
@@ -363,8 +399,9 @@ class ResourceNotebook(gtk.Frame):
continue
# ..
_pixbuf = image.get_pixbuf(_pix_path, 64, 48)
+ _pix_a = image.get_pixbuf(_add_path, 24, 24)
# do update
- self._store_sound.append([_pixbuf, _filename, _path])
+ self._store_sound.append([_pixbuf, _filename, _pix_a, _path])
else:
continue
# return the store
@@ -380,19 +417,27 @@ class ResourceNotebook(gtk.Frame):
# prepare preview
_pixbuf = storage.get_pixbuf_from_data(_i['preview'],
size=(64, 48))
+ # ..
+ _add_path = storage.get_icon_path('more_small')
+ _pix_a = image.get_pixbuf(_add_path, 24, 24)
# store info
_store_info = {
'activity_id':_i['activity_id'],
'timestamp': _i['timestamp']
}
# do update
- self._store_journal.append([_pixbuf, _i['title'], _store_info])
+ _row = [_pixbuf, _i['title'], _pix_a, _store_info]
+ self._store_journal.append(_row)
def _get_store_journal(self):
# init/reset store
if self._store_journal is None:
- self._store_journal = gtk.ListStore(gtk.gdk.Pixbuf,
- gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
+ self._store_journal = gtk.ListStore(
+ gtk.gdk.Pixbuf,
+ gobject.TYPE_STRING,
+ gtk.gdk.Pixbuf,
+ gobject.TYPE_PYOBJECT
+ )
else:
self._store_journal.clear()
# app to get the journal entries
@@ -419,6 +464,7 @@ class ResourceNotebook(gtk.Frame):
# prepare colums
_col_preview = gtk.TreeViewColumn(_('Preview'))
_col_description = gtk.TreeViewColumn(_('Name'))
+ _col_add = gtk.TreeViewColumn()
# set renderers
_cell_pix = gtk.CellRendererPixbuf()
_cell_pix.set_property('height', 50)
@@ -427,8 +473,21 @@ class ResourceNotebook(gtk.Frame):
# ..
_cell_text = gtk.CellRendererText()
_cell_text.set_property('height', 50)
- _col_description.pack_start(_cell_text, expand=True)
+ _col_description.pack_start(_cell_text, expand=False)
_col_description.add_attribute(_cell_text, 'text', 1)
+ _col_description.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+ # ..
+ if type_ == 'sequence':
+ _col_description.set_fixed_width(220)
+ else:
+ _col_description.set_fixed_width(250)
+ # ..
+ _cell_add = gtk.CellRendererPixbuf()
+ _cell_add.set_property('height', 50)
+ _col_add.pack_start(_cell_add, expand=False)
+ _col_add.add_attribute(_cell_add, 'pixbuf', 2)
+ _col_add.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+ _col_add.set_fixed_width(30)
# update store
if type_ == 'sequence':
_store = self._get_store_sequence()
@@ -453,6 +512,11 @@ class ResourceNotebook(gtk.Frame):
_treeview.append_column(_col_preview)
_treeview.append_column(_col_description)
# ..
+ if type_ == 'sequence':
+ pass
+ else:
+ _treeview.append_column(_col_add)
+ # ..
_scrolled_win.add(_treeview)
# return it
return _scrolled_win