mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
Introduced files treeview, refactor code for discs view, struggle with files model
This commit is contained in:
@@ -96,7 +96,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
for id, date in dst_c.execute(sql).fetchall():
|
for id, date in dst_c.execute(sql).fetchall():
|
||||||
sql = "update files set date=? where id=?"
|
sql = "update files set date=? where id=?"
|
||||||
if int(date) > 0:
|
if date and int(date) > 0:
|
||||||
dst_c.execute(sql, (datetime.fromtimestamp(int(date)), id))
|
dst_c.execute(sql, (datetime.fromtimestamp(int(date)), id))
|
||||||
else:
|
else:
|
||||||
dst_c.execute(sql, (None, id))
|
dst_c.execute(sql, (None, id))
|
||||||
@@ -105,10 +105,13 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
for id, date in dst_c.execute(sql).fetchall():
|
for id, date in dst_c.execute(sql).fetchall():
|
||||||
sql = "update gthumb set date=? where id=?"
|
sql = "update gthumb set date=? where id=?"
|
||||||
if int(date) > 0:
|
try:
|
||||||
dst_c.execute(sql, (datetime.fromtimestamp(int(date)), id))
|
if int(date) > 0:
|
||||||
else:
|
dst_c.execute(sql, (datetime.fromtimestamp(int(date)), id))
|
||||||
dst_c.execute(sql, (None, id))
|
else:
|
||||||
|
dst_c.execute(sql, (None, id))
|
||||||
|
except:
|
||||||
|
print id, date
|
||||||
|
|
||||||
dst_con.commit()
|
dst_con.commit()
|
||||||
dst_c.close()
|
dst_c.close()
|
||||||
|
|||||||
@@ -13,6 +13,16 @@ import __builtin__
|
|||||||
import gtk.glade
|
import gtk.glade
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ['controllers',
|
||||||
|
'models',
|
||||||
|
'views',
|
||||||
|
'EXIF',
|
||||||
|
'dbcommon',
|
||||||
|
'dbobjects',
|
||||||
|
'dialogs',
|
||||||
|
'logger',
|
||||||
|
'misc']
|
||||||
|
|
||||||
GETTEXT_DOMAIN = 'pygtktalog'
|
GETTEXT_DOMAIN = 'pygtktalog'
|
||||||
# There should be message catalogs in "locale" directory placed by setup.py
|
# There should be message catalogs in "locale" directory placed by setup.py
|
||||||
# script. If there is no such directory, let's assume that message catalogs are
|
# script. If there is no such directory, let's assume that message catalogs are
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ class DiscsController(Controller):
|
|||||||
# make cell text editabe
|
# make cell text editabe
|
||||||
cell.set_property('editable', True)
|
cell.set_property('editable', True)
|
||||||
cell.connect('edited', self.on_editing_done, self.model.discs)
|
cell.connect('edited', self.on_editing_done, self.model.discs)
|
||||||
|
# TODO: find a way how to disable default return keypress on editable
|
||||||
|
# fields
|
||||||
|
|
||||||
col.pack_start(cellpb, False)
|
col.pack_start(cellpb, False)
|
||||||
col.pack_start(cell, True)
|
col.pack_start(cell, True)
|
||||||
@@ -70,30 +72,37 @@ class DiscsController(Controller):
|
|||||||
LOG.debug(self.on_discs_button_press_event.__doc__.strip())
|
LOG.debug(self.on_discs_button_press_event.__doc__.strip())
|
||||||
pathinfo = treeview.get_path_at_pos(int(event.x), int(event.y))
|
pathinfo = treeview.get_path_at_pos(int(event.x), int(event.y))
|
||||||
|
|
||||||
if event.button == 3 and pathinfo:
|
if event.button == 3:
|
||||||
path = pathinfo[0]
|
if pathinfo:
|
||||||
|
path = pathinfo[0]
|
||||||
|
|
||||||
# Make sure, that there is selected row
|
# Make sure, that there is selected row
|
||||||
sel = treeview.get_selection()
|
sel = treeview.get_selection()
|
||||||
sel.unselect_all()
|
sel.unselect_all()
|
||||||
sel.select_path(path)
|
sel.select_path(path)
|
||||||
|
|
||||||
self._popup_menu(sel, event, event.button)
|
self._popup_menu(sel, event, event.button)
|
||||||
|
else:
|
||||||
|
self._popup_menu(None, event, event.button)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_discs_cursor_changed(self, widget):
|
def on_discs_cursor_changed(self, treeview):
|
||||||
"""
|
"""
|
||||||
Show files on right treeview, after clicking the left disc treeview.
|
Show files on right treeview, after clicking the left disc treeview.
|
||||||
"""
|
"""
|
||||||
LOG.debug(self.on_discs_cursor_changed.__doc__.strip())
|
LOG.debug(self.on_discs_cursor_changed.__doc__.strip())
|
||||||
raise NotImplementedError
|
selection = treeview.get_selection()
|
||||||
|
path = selection.get_selected_rows()[1][0]
|
||||||
|
self.model.update_files(self.model.discs.get_value(\
|
||||||
|
self.model.discs.get_iter(path), 0))
|
||||||
|
|
||||||
def on_discs_key_release_event(self, treeview, event):
|
def on_discs_key_release_event(self, treeview, event):
|
||||||
"""
|
"""
|
||||||
Trigger popup menu by pressing 'menu' key
|
Watch for specific keys
|
||||||
"""
|
"""
|
||||||
LOG.debug(self.on_discs_key_release_event.__doc__.strip())
|
LOG.debug(self.on_discs_key_release_event.__doc__.strip())
|
||||||
if gtk.gdk.keyval_name(event.keyval) == 'Menu':
|
if gtk.gdk.keyval_name(event.keyval) == 'Menu':
|
||||||
|
LOG.debug('Menu key pressed')
|
||||||
self._popup_menu(treeview.get_selection(), event, 0)
|
self._popup_menu(treeview.get_selection(), event, 0)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@@ -170,11 +179,15 @@ class DiscsController(Controller):
|
|||||||
and trigger menu popup.
|
and trigger menu popup.
|
||||||
"""
|
"""
|
||||||
LOG.debug(self._popup_menu.__doc__.strip())
|
LOG.debug(self._popup_menu.__doc__.strip())
|
||||||
model, list_of_paths = selection.get_selected_rows()
|
if selection is None:
|
||||||
|
self.view.menu.set_menu_items_sensitivity(False)
|
||||||
|
else:
|
||||||
|
model, list_of_paths = selection.get_selected_rows()
|
||||||
|
|
||||||
for path in list_of_paths:
|
for path in list_of_paths:
|
||||||
self.view.menu.set_update_sensitivity(not model.get_value(\
|
self.view.menu.set_menu_items_sensitivity(True)
|
||||||
model.get_iter(path), 0).parent_id == 1)
|
self.view.menu.set_update_sensitivity(model.get_value(\
|
||||||
|
model.get_iter(path), 0).parent_id == 1)
|
||||||
|
|
||||||
self.view.menu['discs_popup'].popup(None, None, None,
|
self.view.menu['discs_popup'].popup(None, None, None,
|
||||||
button, event.time)
|
button, event.time)
|
||||||
|
|||||||
@@ -15,19 +15,57 @@ class FilesController(Controller):
|
|||||||
Controller for files TreeView list.
|
Controller for files TreeView list.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def __init__(self, model, view):
|
||||||
|
"""
|
||||||
|
FilesController initialization
|
||||||
|
"""
|
||||||
|
Controller.__init__(self, model, view)
|
||||||
|
self.DND_TARGETS = [('files_tags', 0, 69)]
|
||||||
|
|
||||||
|
|
||||||
def register_view(self, view):
|
def register_view(self, view):
|
||||||
"""Default view registration stuff"""
|
"""
|
||||||
self.view['files'].set_model(self.model.discs)
|
Register view, and setup columns for files treeview
|
||||||
|
"""
|
||||||
|
view['files'].set_model(self.model.files)
|
||||||
|
view['files'].get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn('kolumna2')
|
col = gtk.TreeViewColumn(_('Disc'), gtk.CellRendererText(), text=1)
|
||||||
|
col.set_sort_column_id(1)
|
||||||
|
col.set_resizable(True)
|
||||||
|
col.set_visible(False)
|
||||||
|
view['files'].append_column(col)
|
||||||
|
|
||||||
|
col = gtk.TreeViewColumn(_('Filename'))
|
||||||
cellpb = gtk.CellRendererPixbuf()
|
cellpb = gtk.CellRendererPixbuf()
|
||||||
cell = gtk.CellRendererText()
|
cell = gtk.CellRendererText()
|
||||||
|
|
||||||
col.pack_start(cellpb, False)
|
col.pack_start(cellpb, False)
|
||||||
col.pack_start(cell, True)
|
col.pack_start(cell, True)
|
||||||
|
col.set_attributes(cellpb, stock_id=7)
|
||||||
col.set_attributes(cellpb, stock_id=0)
|
col.set_attributes(cell, text=2)
|
||||||
col.set_attributes(cell, text=1)
|
col.set_sort_column_id(2)
|
||||||
|
col.set_resizable(True)
|
||||||
self.view['files'].append_column(col)
|
self.view['files'].append_column(col)
|
||||||
|
|
||||||
|
col = gtk.TreeViewColumn(_('Path'), gtk.CellRendererText(), text=3)
|
||||||
|
col.set_sort_column_id(3)
|
||||||
|
col.set_resizable(True)
|
||||||
|
col.set_visible(False)
|
||||||
|
self.view['files'].append_column(col)
|
||||||
|
|
||||||
|
col = gtk.TreeViewColumn(_('Size'), gtk.CellRendererText(), text=4)
|
||||||
|
col.set_sort_column_id(4)
|
||||||
|
col.set_resizable(True)
|
||||||
|
self.view['files'].append_column(col)
|
||||||
|
|
||||||
|
col = gtk.TreeViewColumn(_('Date'), gtk.CellRendererText(), text=5)
|
||||||
|
col.set_sort_column_id(5)
|
||||||
|
col.set_resizable(True)
|
||||||
|
self.view['files'].append_column(col)
|
||||||
|
self.view['files'].set_search_column(2)
|
||||||
|
|
||||||
|
# setup d'n'd support
|
||||||
|
view['files'].drag_source_set(gtk.gdk.BUTTON1_MASK,
|
||||||
|
self.DND_TARGETS,
|
||||||
|
gtk.gdk.ACTION_COPY)
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from gtkmvc import Controller
|
|||||||
|
|
||||||
#from pygtktalog.dialogs import yesno
|
#from pygtktalog.dialogs import yesno
|
||||||
from pygtktalog.controllers.discs import DiscsController
|
from pygtktalog.controllers.discs import DiscsController
|
||||||
#from pygtktalog.controllers.files import FilesController
|
from pygtktalog.controllers.files import FilesController
|
||||||
#from pygtktalog.controllers.details import DetailsController
|
#from pygtktalog.controllers.details import DetailsController
|
||||||
#from pygtktalog.controllers.tags import TagcloudController
|
#from pygtktalog.controllers.tags import TagcloudController
|
||||||
#from pygtktalog.dialogs import yesno, okcancel, info, warn, error
|
#from pygtktalog.dialogs import yesno, okcancel, info, warn, error
|
||||||
@@ -25,36 +25,50 @@ class MainController(Controller):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, model, view):
|
def __init__(self, model, view):
|
||||||
"""Initialize main controller"""
|
"""
|
||||||
|
Initialize MainController, add controllers for trees and details.
|
||||||
|
"""
|
||||||
|
LOG.debug(self.__init__.__doc__.strip())
|
||||||
Controller.__init__(self, model, view)
|
Controller.__init__(self, model, view)
|
||||||
|
|
||||||
# add controllers for files/tags components
|
# add controllers for files/tags/details components
|
||||||
self.discs = DiscsController(model, view.discs)
|
self.discs = DiscsController(model, view.discs)
|
||||||
#self.files = FilesController(model, view.files)
|
self.files = FilesController(model, view.files)
|
||||||
#self.details = DetailsController(model, view.details)
|
#self.details = DetailsController(model, view.details)
|
||||||
#self.tags = TagcloudController(model, view.tags)
|
#self.tags = TagcloudController(model, view.tags)
|
||||||
|
|
||||||
|
|
||||||
def register_view(self, view):
|
def register_view(self, view):
|
||||||
"""Default view registration stuff"""
|
"""
|
||||||
# one row contains image and text
|
Registration view for MainController class
|
||||||
|
"""
|
||||||
|
LOG.debug(self.register_view.__doc__.strip())
|
||||||
|
LOG.debug("replace hardcoded defaults with configured!")
|
||||||
|
view['main'].set_default_size(800, 600)
|
||||||
|
view['hpaned1'].set_position(200)
|
||||||
view['main'].show()
|
view['main'].show()
|
||||||
|
|
||||||
def register_adapters(self):
|
def register_adapters(self):
|
||||||
"""
|
"""
|
||||||
progress bar/status bar adapters goes here
|
progress bar/status bar adapters goes here
|
||||||
"""
|
"""
|
||||||
|
LOG.debug(self.register_adapters.__doc__.strip())
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# signals
|
# signals
|
||||||
def on_main_destroy_event(self, widget, event):
|
def on_main_destroy_event(self, widget, event):
|
||||||
"""Quit"""
|
"""
|
||||||
|
Window destroyed. Cleanup before quit.
|
||||||
|
"""
|
||||||
|
LOG.debug(self.on_main_destroy_event.__doc__.strip())
|
||||||
self.on_quit_activate(widget)
|
self.on_quit_activate(widget)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_quit_activate(self, widget):
|
def on_quit_activate(self, widget):
|
||||||
"""Quit and save window parameters to config file"""
|
"""
|
||||||
|
Quit and save window parameters to config file
|
||||||
|
"""
|
||||||
|
LOG.debug(self.on_quit_activate.__doc__.strip())
|
||||||
#if yesno(_("Do you really want to quit?"),
|
#if yesno(_("Do you really want to quit?"),
|
||||||
# _("Current database is not saved, any changes will be "
|
# _("Current database is not saved, any changes will be "
|
||||||
# "lost."), _("Quit application") + " - pyGTKtalog", 0):
|
# "lost."), _("Quit application") + " - pyGTKtalog", 0):
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ class MainModel(ModelMT):
|
|||||||
self.cat_fname = filename
|
self.cat_fname = filename
|
||||||
# Temporary (usually in /tmp) working database.
|
# Temporary (usually in /tmp) working database.
|
||||||
self.tmp_filename = None
|
self.tmp_filename = None
|
||||||
|
# SQLAlchemy session object for internal use
|
||||||
|
self._session = None
|
||||||
# Flag indicates, that db was compressed
|
# Flag indicates, that db was compressed
|
||||||
# TODO: make it depend on configuration
|
# TODO: make it depend on configuration
|
||||||
self.compressed = False
|
self.compressed = False
|
||||||
@@ -54,7 +56,14 @@ class MainModel(ModelMT):
|
|||||||
self.discs = gtk.TreeStore(gobject.TYPE_PYOBJECT,
|
self.discs = gtk.TreeStore(gobject.TYPE_PYOBJECT,
|
||||||
gobject.TYPE_STRING,
|
gobject.TYPE_STRING,
|
||||||
str)
|
str)
|
||||||
|
self.files = gtk.ListStore(gobject.TYPE_PYOBJECT,
|
||||||
|
gobject.TYPE_STRING,
|
||||||
|
gobject.TYPE_STRING,
|
||||||
|
gobject.TYPE_STRING,
|
||||||
|
gobject.TYPE_UINT64,
|
||||||
|
gobject.TYPE_STRING,
|
||||||
|
gobject.TYPE_INT,
|
||||||
|
str)
|
||||||
if self.cat_fname:
|
if self.cat_fname:
|
||||||
self.open(self.cat_fname)
|
self.open(self.cat_fname)
|
||||||
|
|
||||||
@@ -82,12 +91,18 @@ class MainModel(ModelMT):
|
|||||||
"""
|
"""
|
||||||
Create new catalog
|
Create new catalog
|
||||||
"""
|
"""
|
||||||
self._cleanup_and_create_temp_db_file()
|
self.cleanup()
|
||||||
|
self._create_temp_db_file()
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
"""
|
"""
|
||||||
Remove temporary directory tree from filesystem
|
Remove temporary directory tree from filesystem
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if self._session:
|
||||||
|
self._session.close()
|
||||||
|
self._session = None
|
||||||
|
|
||||||
if self.tmp_filename is None:
|
if self.tmp_filename is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -105,7 +120,8 @@ class MainModel(ModelMT):
|
|||||||
"""
|
"""
|
||||||
Create new DB
|
Create new DB
|
||||||
"""
|
"""
|
||||||
self._cleanup_and_create_temp_db_file()
|
self.cleanup()
|
||||||
|
self._create_temp_db_file()
|
||||||
|
|
||||||
def _examine_file(self, filename):
|
def _examine_file(self, filename):
|
||||||
"""
|
"""
|
||||||
@@ -143,7 +159,10 @@ class MainModel(ModelMT):
|
|||||||
filename = os.path.abspath(self.cat_fname)
|
filename = os.path.abspath(self.cat_fname)
|
||||||
LOG.info("catalog file: %s", filename)
|
LOG.info("catalog file: %s", filename)
|
||||||
|
|
||||||
self._cleanup_and_create_temp_db_file()
|
if self._session:
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
|
self._create_temp_db_file()
|
||||||
LOG.debug("tmp database file: %s", str(self.tmp_filename))
|
LOG.debug("tmp database file: %s", str(self.tmp_filename))
|
||||||
|
|
||||||
examine = self._examine_file(filename)
|
examine = self._examine_file(filename)
|
||||||
@@ -181,10 +200,10 @@ class MainModel(ModelMT):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
connect(os.path.abspath(self.tmp_filename))
|
connect(os.path.abspath(self.tmp_filename))
|
||||||
|
self._session = Session()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _cleanup_and_create_temp_db_file(self):
|
def _create_temp_db_file(self):
|
||||||
self.cleanup()
|
|
||||||
fd, self.tmp_filename = mkstemp()
|
fd, self.tmp_filename = mkstemp()
|
||||||
# close file descriptor, otherwise it can be source of app crash!
|
# close file descriptor, otherwise it can be source of app crash!
|
||||||
# http://www.logilab.org/blogentry/17873
|
# http://www.logilab.org/blogentry/17873
|
||||||
@@ -195,8 +214,7 @@ class MainModel(ModelMT):
|
|||||||
Read objects from database, fill TreeStore model with discs
|
Read objects from database, fill TreeStore model with discs
|
||||||
information
|
information
|
||||||
"""
|
"""
|
||||||
session = Session()
|
dirs = self._session.query(File).filter(File.type == 1)
|
||||||
dirs = session.query(File).filter(File.type == 1)
|
|
||||||
dirs = dirs.order_by(File.filename).all()
|
dirs = dirs.order_by(File.filename).all()
|
||||||
|
|
||||||
def get_children(parent_id=1, iterator=None):
|
def get_children(parent_id=1, iterator=None):
|
||||||
@@ -218,9 +236,33 @@ class MainModel(ModelMT):
|
|||||||
get_children(fileob.id, myiter)
|
get_children(fileob.id, myiter)
|
||||||
return
|
return
|
||||||
get_children()
|
get_children()
|
||||||
session.close()
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_root_entries(self, id):
|
def update_files(self, fileob):
|
||||||
LOG.debug("not implemented!, get_root_entries, id: %s", str(id))
|
"""
|
||||||
|
Update files ListStore
|
||||||
|
Arguments:
|
||||||
|
fileob - File object
|
||||||
|
"""
|
||||||
|
files = self._session.query(File).filter(File.parent_id==fileob.id)\
|
||||||
|
.order_by(File.type, File.filename).all()
|
||||||
|
files = []
|
||||||
|
LOG.info("found %d files for root id %s" %(len(files), str(fileob)))
|
||||||
|
|
||||||
|
self.files.clear()
|
||||||
|
|
||||||
|
for fob in files:
|
||||||
|
myiter = self.files.insert_before(None, None)
|
||||||
|
self.files.set_value(myiter, 0, fob.id)
|
||||||
|
self.files.set_value(myiter, 1, fob.parent_id if fob.parent_id!=1 else None)
|
||||||
|
self.files.set_value(myiter, 2, fob.filename)
|
||||||
|
self.files.set_value(myiter, 3, fob.filepath)
|
||||||
|
self.files.set_value(myiter, 4, fob.size)
|
||||||
|
self.files.set_value(myiter, 5, fob.date)
|
||||||
|
self.files.set_value(myiter, 6, 1)
|
||||||
|
self.files.set_value(myiter, 7, gtk.STOCK_DIRECTORY \
|
||||||
|
if fob.type==1 else gtk.STOCK_FILE)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,122 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
|
||||||
<!--Generated with glade3 3.4.5 on Sat Aug 29 15:22:37 2009 -->
|
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
|
<!-- interface-requires gtk+ 2.6 -->
|
||||||
|
<!-- interface-naming-policy toplevel-contextual -->
|
||||||
<widget class="GtkWindow" id="top_files">
|
<widget class="GtkWindow" id="top_files">
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="files">
|
<widget class="GtkTreeView" id="files">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="rules_hint">True</property>
|
<property name="rules_hint">True</property>
|
||||||
<signal name="drag_data_get" handler="on_files_drag_data_get"/>
|
|
||||||
<signal name="button_press_event" handler="on_files_button_press_event"/>
|
<signal name="button_press_event" handler="on_files_button_press_event"/>
|
||||||
<signal name="row_activated" handler="on_files_row_activated"/>
|
|
||||||
<signal name="cursor_changed" handler="on_files_cursor_changed"/>
|
<signal name="cursor_changed" handler="on_files_cursor_changed"/>
|
||||||
|
<signal name="row_activated" handler="on_files_row_activated"/>
|
||||||
|
<signal name="drag_data_get" handler="on_files_drag_data_get"/>
|
||||||
<signal name="key_release_event" handler="on_files_key_release_event"/>
|
<signal name="key_release_event" handler="on_files_key_release_event"/>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="GtkMenu" id="files_popup">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="add_tag">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">_Add tag</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_add_tag1_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="delete_tag">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">Remo_ve tag</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_delete_tag_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSeparatorMenuItem" id="separator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="add_thumb">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">Add _Thumbnail</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_add_thumb1_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="remove_thumb">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">Re_move Thumbnail</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_remove_thumb1_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSeparatorMenuItem" id="separator1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="add_image">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="has_tooltip">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Add images to file. If file have no thumbnail,
|
||||||
|
thumbnail from first image will be generated.</property>
|
||||||
|
<property name="label" translatable="yes">Add _Images</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_add_image1_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="remove_image">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">Rem_ove All Images</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_remove_image1_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkSeparatorMenuItem" id="separator2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="edit">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">_Edit</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_edit2_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="delete">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">_Delete</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_delete3_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkMenuItem" id="rename">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="label" translatable="yes">_Rename</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_rename2_activate"/>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
</glade-interface>
|
</glade-interface>
|
||||||
|
|||||||
@@ -495,7 +495,7 @@
|
|||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
<widget class="GtkScrolledWindow" id="scrolledwindow_discs">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
@@ -556,7 +556,7 @@
|
|||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
<widget class="GtkScrolledWindow" id="scrolledwindow_files">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hscrollbar_policy">automatic</property>
|
<property name="hscrollbar_policy">automatic</property>
|
||||||
@@ -639,108 +639,6 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="GtkMenu" id="files_popup">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="add_tag1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Add tag</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_add_tag1_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="delete_tag">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Remo_ve tag</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_delete_tag_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separator11">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="add_thumb1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Add _Thumbnail</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_add_thumb1_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="remove_thumb1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Re_move Thumbnail</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_remove_thumb1_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separator7">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="add_image1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="tooltip" translatable="yes">Add images to file. If file have no thumbnail,
|
|
||||||
thumbnail from first image will be generated.</property>
|
|
||||||
<property name="label" translatable="yes">Add _Images</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_add_image1_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="remove_image1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">Rem_ove All Images</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_remove_image1_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkSeparatorMenuItem" id="separator8">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="edit2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Edit</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_edit2_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="delete3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Delete</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_delete3_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<widget class="GtkMenuItem" id="rename2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
|
||||||
<property name="label" translatable="yes">_Rename</property>
|
|
||||||
<property name="use_underline">True</property>
|
|
||||||
<signal name="activate" handler="on_rename2_activate"/>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
<widget class="GtkWindow" id="image_show">
|
<widget class="GtkWindow" id="image_show">
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="title" translatable="yes">pyGTKtalog - Image</property>
|
<property name="title" translatable="yes">pyGTKtalog - Image</property>
|
||||||
|
|||||||
@@ -31,8 +31,13 @@ class MainView(View):
|
|||||||
"""
|
"""
|
||||||
View.__init__(self)
|
View.__init__(self)
|
||||||
self['tag_path_box'].hide()
|
self['tag_path_box'].hide()
|
||||||
|
|
||||||
self.discs = DiscsView()
|
self.discs = DiscsView()
|
||||||
self['scrolledwindow1'].add_with_viewport(self.discs.get_top_widget())
|
#self['scrolledwindow_discs'].add_with_viewport(self.discs.get_top_widget())
|
||||||
|
self['scrolledwindow_discs'].add(self.discs.get_top_widget())
|
||||||
|
|
||||||
|
self.files = FilesView()
|
||||||
|
self['scrolledwindow_files'].add_with_viewport(self.files.get_top_widget())
|
||||||
|
|
||||||
def set_widgets_scan_sensitivity(self, sensitive=True):
|
def set_widgets_scan_sensitivity(self, sensitive=True):
|
||||||
"""
|
"""
|
||||||
@@ -71,11 +76,23 @@ class DiscsPopupView(View):
|
|||||||
|
|
||||||
def set_update_sensitivity(self, state):
|
def set_update_sensitivity(self, state):
|
||||||
"""
|
"""
|
||||||
Update sensitivity for 'update' popup menu item
|
Set sensitivity for 'update' popup menu item
|
||||||
|
Arguments:
|
||||||
|
@state - Bool, if True update menu item will be sensitive,
|
||||||
|
otherwise not
|
||||||
"""
|
"""
|
||||||
self['update'].set_sensitive(not state)
|
self['update'].set_sensitive(state)
|
||||||
|
|
||||||
|
def set_menu_items_sensitivity(self, state):
|
||||||
|
"""
|
||||||
|
Set sensitivity for couple of popup menu items, which should be
|
||||||
|
disabled if user right-clicks on no item in treeview.
|
||||||
|
Arguments:
|
||||||
|
@state - Bool, if True update menu item will be sensitive,
|
||||||
|
otherwise not
|
||||||
|
"""
|
||||||
|
for item in ['update', 'rename', 'delete', 'statistics']:
|
||||||
|
self[item].set_sensitive(state)
|
||||||
|
|
||||||
class FilesView(View):
|
class FilesView(View):
|
||||||
"""
|
"""
|
||||||
@@ -90,6 +107,18 @@ class FilesView(View):
|
|||||||
"""
|
"""
|
||||||
View.__init__(self)
|
View.__init__(self)
|
||||||
|
|
||||||
|
class FilesPopupView(View):
|
||||||
|
"""
|
||||||
|
Separate Files PopUp subview.
|
||||||
|
"""
|
||||||
|
glade = get_glade("files.glade")
|
||||||
|
top = 'files_popup'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
Initialize view
|
||||||
|
"""
|
||||||
|
View.__init__(self)
|
||||||
|
|
||||||
class TagcloudView(View):
|
class TagcloudView(View):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user