mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
Added popup menu for discs treeview, added separated glade files with interface and controllers
This commit is contained in:
18
pygtktalog/controllers/details.py
Normal file
18
pygtktalog/controllers/details.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""
|
||||
Project: pyGTKtalog
|
||||
Description: Controller for Details NoteBook
|
||||
Type: core
|
||||
Author: Roman 'gryf' Dobosz, gryf73@gmail.com
|
||||
Created: 2009-08-30
|
||||
"""
|
||||
from gtkmvc import Controller
|
||||
|
||||
|
||||
class DetailsController(Controller):
|
||||
"""
|
||||
Controller for details NoteBook.
|
||||
"""
|
||||
|
||||
def register_view(self, view):
|
||||
"""Default view registration stuff"""
|
||||
pass
|
||||
@@ -9,7 +9,9 @@ import gtk
|
||||
|
||||
from gtkmvc import Controller
|
||||
|
||||
from pygtktalog.dialogs import info
|
||||
from pygtktalog.logger import get_logger
|
||||
|
||||
LOG = get_logger("discs ctrl")
|
||||
|
||||
|
||||
class DiscsController(Controller):
|
||||
@@ -21,8 +23,22 @@ class DiscsController(Controller):
|
||||
Controller.__init__(self, model, view)
|
||||
|
||||
def register_view(self, view):
|
||||
"""Default view registration stuff"""
|
||||
self.view['discs'].set_model(self.model.discs)
|
||||
"""
|
||||
Do DiscTree registration
|
||||
"""
|
||||
view['discs'].set_model(self.model.discs)
|
||||
|
||||
# connect signals to popup menu - framework somehow omits automatic
|
||||
# signal connection for subviews which are not under included to
|
||||
# widgets tree
|
||||
sigs = {'expand_all': ('activate', self.on_expand_all_activate),
|
||||
'collapse_all': ('activate', self.on_collapse_all_activate),
|
||||
'update': ('activate', self.on_update_activate),
|
||||
'rename': ('activate', self.on_rename_activate),
|
||||
'delete': ('activate', self.on_delete_activate),
|
||||
'statistics': ('activate', self.on_statistics_activate)}
|
||||
for signal in sigs:
|
||||
view.menu[signal].connect(sigs[signal][0], sigs[signal][1])
|
||||
|
||||
col = gtk.TreeViewColumn('kolumna')
|
||||
|
||||
@@ -35,50 +51,34 @@ class DiscsController(Controller):
|
||||
col.set_attributes(cellpb, stock_id=0)
|
||||
col.set_attributes(cell, text=1)
|
||||
|
||||
self.view['discs'].append_column(col)
|
||||
self.view['discs'].show()
|
||||
view['discs'].append_column(col)
|
||||
view['discs'].show()
|
||||
|
||||
|
||||
|
||||
# signals
|
||||
def on_discs_button_press_event(self, treeview, event):
|
||||
"""
|
||||
Handle right click on discs treeview. Show popup menu.
|
||||
Handle right click on discs treeview - show popup menu.
|
||||
"""
|
||||
LOG.debug('on_discs_button_press_event')
|
||||
pathinfo = treeview.get_path_at_pos(int(event.x), int(event.y))
|
||||
|
||||
time = event.time
|
||||
try:
|
||||
path, column, x, y = treeview.get_path_at_pos(int(event.x),
|
||||
int(event.y))
|
||||
except TypeError:
|
||||
treeview.get_selection().unselect_all()
|
||||
return False
|
||||
if event.button == 3 and pathinfo:
|
||||
path, column, x, y = pathinfo
|
||||
|
||||
if event.button == 3:
|
||||
"""Right mouse button. Show context menu."""
|
||||
try:
|
||||
selection = treeview.get_selection()
|
||||
model, list_of_paths = selection.get_selected_rows()
|
||||
except TypeError:
|
||||
list_of_paths = []
|
||||
# Make sure, that there is selected row
|
||||
sel = treeview.get_selection()
|
||||
sel.unselect_all()
|
||||
sel.select_path(path)
|
||||
|
||||
if path not in list_of_paths:
|
||||
treeview.get_selection().unselect_all()
|
||||
treeview.get_selection().select_path(path)
|
||||
# setup menu
|
||||
ids = self.__get_tv_selection_ids(treeview)
|
||||
for menu_item in ['update1','rename1','delete2', 'statistics1']:
|
||||
self.view.popup_menu[menu_item].set_sensitive(not not ids)
|
||||
|
||||
# checkout, if we dealing with disc or directory
|
||||
# if ancestor is 'root', then activate "update" menu item
|
||||
treeiter = self.model.discs.get_iter(path)
|
||||
#ancestor = self.model.discs.get_value(treeiter, 3) == 1
|
||||
#self.view['update1'].set_sensitive(ancestor)
|
||||
|
||||
self.view.popup_menu['discs_popup'].popup(None, None, None, event.button, time)
|
||||
self._popup_menu(sel, event, event.button)
|
||||
return True
|
||||
|
||||
def on_discs_cursor_changed(self, widget):
|
||||
"""Show files on right treeview, after clicking the left disc
|
||||
treeview."""
|
||||
LOG.debug('on_discs_cursor_changed')
|
||||
model = self.view['discs'].get_model()
|
||||
path, column = self.view['discs'].get_cursor()
|
||||
if path:
|
||||
@@ -90,53 +90,59 @@ class DiscsController(Controller):
|
||||
return
|
||||
|
||||
def on_discs_key_release_event(self, treeview, event):
|
||||
"""
|
||||
Trigger popup menu by pressing 'menu' key
|
||||
"""
|
||||
LOG.debug('on_discs_key_release_event')
|
||||
if gtk.gdk.keyval_name(event.keyval) == 'Menu':
|
||||
ids = self.__get_tv_selection_ids(treeview)
|
||||
menu_items = ['update1','rename1','delete2', 'statistics1']
|
||||
for menu_item in menu_items:
|
||||
self.view[menu_item].set_sensitive(not not ids)
|
||||
self.__popup_menu(event, 'discs_popup')
|
||||
self._popup_menu(treeview.get_selection(), event, 0)
|
||||
return True
|
||||
return False
|
||||
|
||||
def on_discs_row_activated(self, treeview, path, treecolumn):
|
||||
"""If possible, expand or collapse branch of discs tree"""
|
||||
"""
|
||||
If possible, expand or collapse branch of discs tree
|
||||
"""
|
||||
if treeview.row_expanded(path):
|
||||
treeview.collapse_row(path)
|
||||
else:
|
||||
treeview.expand_row(path, False)
|
||||
return
|
||||
|
||||
|
||||
# private class functions
|
||||
def __set_files_hiden_columns_visible(self, boolean):
|
||||
"""switch visibility of default hidden columns in files treeview"""
|
||||
info("switch visibility of default hidden columns in files treeview")
|
||||
#self.view['files'].get_column(0).set_visible(boolean)
|
||||
#self.view['files'].get_column(2).set_visible(boolean)
|
||||
def on_expand_all_activate(self, menu_item):
|
||||
"""
|
||||
Expand all
|
||||
"""
|
||||
self.view['discs'].expand_all()
|
||||
|
||||
def __get_tv_selection_ids(self, treeview):
|
||||
"""get selection from treeview and return coresponding ids' from
|
||||
connected model or None"""
|
||||
ids = []
|
||||
try:
|
||||
selection = treeview.get_selection()
|
||||
model, list_of_paths = selection.get_selected_rows()
|
||||
for path in list_of_paths:
|
||||
ids.append(model.get_value(model.get_iter(path), 0))
|
||||
return ids
|
||||
except:
|
||||
# DEBUG: treeview have no selection or smth is broken
|
||||
if __debug__:
|
||||
print "c_main.py: __get_tv_selection_ids(): error on",
|
||||
print "getting selected items"
|
||||
return
|
||||
return None
|
||||
def on_collapse_all_activate(self, menu_item):
|
||||
self.view['discs'].collapse_all()
|
||||
|
||||
def __popup_menu(self, event, menu='discs_popup'):
|
||||
"""Popoup desired menu"""
|
||||
self.view.discs_popup['discs_popup'].popup(None, None, None, 0, 0)
|
||||
#self.view[menu].popup(None, None, None, event.button,
|
||||
# event.time)
|
||||
self.view.discs_popup['discs_popup'].show_all()
|
||||
return
|
||||
def on_update_activate(self, menu_item):
|
||||
raise NotImplementedError
|
||||
|
||||
def on_rename_activate(self, menu_item):
|
||||
raise NotImplementedError
|
||||
|
||||
def on_delete_activate(self, menu_item):
|
||||
raise NotImplementedError
|
||||
|
||||
def on_statistics_activate(self, menu_item):
|
||||
raise NotImplementedError
|
||||
|
||||
def _popup_menu(self, selection, event, button):
|
||||
"""
|
||||
Popup menu for discs treeview. Gather information from discs model,
|
||||
and trigger menu popup.
|
||||
"""
|
||||
LOG.debug('_popup_menu')
|
||||
model, list_of_paths = selection.get_selected_rows()
|
||||
|
||||
#for path in list_of_paths:
|
||||
# if model.get_value(model.get_iter(path), 4).parent_id == 1:
|
||||
# self.view.popup_menu.disable_update(False)
|
||||
# else:
|
||||
# self.view.popup_menu.disable_update(True)
|
||||
|
||||
self.view.menu['discs_popup'].popup(None, None, None,
|
||||
button, event.time)
|
||||
|
||||
33
pygtktalog/controllers/files.py
Normal file
33
pygtktalog/controllers/files.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""
|
||||
Project: pyGTKtalog
|
||||
Description: Controller for Files TreeView
|
||||
Type: core
|
||||
Author: Roman 'gryf' Dobosz, gryf73@gmail.com
|
||||
Created: 2009-08-30
|
||||
"""
|
||||
import gtk
|
||||
|
||||
from gtkmvc import Controller
|
||||
|
||||
|
||||
class FilesController(Controller):
|
||||
"""
|
||||
Controller for files TreeView list.
|
||||
"""
|
||||
|
||||
def register_view(self, view):
|
||||
"""Default view registration stuff"""
|
||||
self.view['files'].set_model(self.model.discs)
|
||||
|
||||
col = gtk.TreeViewColumn('kolumna2')
|
||||
|
||||
cellpb = gtk.CellRendererPixbuf()
|
||||
cell = gtk.CellRendererText()
|
||||
|
||||
col.pack_start(cellpb, False)
|
||||
col.pack_start(cell, True)
|
||||
|
||||
col.set_attributes(cellpb, stock_id=0)
|
||||
col.set_attributes(cell, text=1)
|
||||
self.view['files'].append_column(col)
|
||||
|
||||
23
pygtktalog/controllers/tags.py
Normal file
23
pygtktalog/controllers/tags.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
Project: pyGTKtalog
|
||||
Description: Controller for Tagcloud TextView
|
||||
Type: core
|
||||
Author: Roman 'gryf' Dobosz, gryf73@gmail.com
|
||||
Created: 2009-08-30
|
||||
"""
|
||||
from gtkmvc import Controller
|
||||
|
||||
|
||||
class TagcloudController(Controller):
|
||||
"""
|
||||
Controller for Tagcloud TextView
|
||||
"""
|
||||
|
||||
#def __init__(self, model, view):
|
||||
# """Initialize main controller"""
|
||||
# Controller.__init__(self, model, view)
|
||||
# return
|
||||
|
||||
def register_view(self, view):
|
||||
"""Default view registration stuff"""
|
||||
pass
|
||||
@@ -54,7 +54,8 @@ class MainModel(ModelMT):
|
||||
self.discs = gtk.TreeStore(gobject.TYPE_INT,
|
||||
gobject.TYPE_STRING,
|
||||
str,
|
||||
gobject.TYPE_INT)
|
||||
gobject.TYPE_INT,
|
||||
gobject.TYPE_PYOBJECT)
|
||||
|
||||
if self.cat_fname:
|
||||
self.open(self.cat_fname)
|
||||
@@ -195,7 +196,8 @@ class MainModel(ModelMT):
|
||||
"""
|
||||
"""
|
||||
session = Session()
|
||||
dirs = session.query(File).filter(File.type == 1).all()
|
||||
dirs = session.query(File).filter(File.type == 1)
|
||||
dirs = dirs.order_by(File.filename).all()
|
||||
|
||||
def get_children(parent_id=1, iterator=None):
|
||||
"""
|
||||
@@ -214,6 +216,7 @@ class MainModel(ModelMT):
|
||||
else:
|
||||
self.discs.set_value(myiter, 2, gtk.STOCK_DIRECTORY)
|
||||
self.discs.set_value(myiter, 3, fileob.parent_id)
|
||||
self.discs.set_value(myiter, 4, fileob)
|
||||
get_children(fileob.id, myiter)
|
||||
return
|
||||
get_children()
|
||||
@@ -223,4 +226,4 @@ class MainModel(ModelMT):
|
||||
|
||||
# TODO: get this thing right
|
||||
def get_root_entries(self, id):
|
||||
LOG.debug("id: %s", str(id))
|
||||
LOG.debug("get_root_entries, id: %s", str(id))
|
||||
|
||||
138
pygtktalog/views/glade/details.glade
Normal file
138
pygtktalog/views/glade/details.glade
Normal file
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Sat Aug 29 15:13:44 2009 -->
|
||||
<glade-interface>
|
||||
<widget class="GtkWindow" id="top_details">
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook_details">
|
||||
<property name="visible">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>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="fileinfo">
|
||||
<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="GtkScrolledWindow" id="scrolledwindow4">
|
||||
<property name="visible">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="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTextView" id="description">
|
||||
<property name="visible">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="editable">False</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="left_margin">2</property>
|
||||
<property name="right_margin">2</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkViewport" id="thumb_box">
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="resize_mode">GTK_RESIZE_QUEUE</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="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="xpad">3</property>
|
||||
<property name="ypad">3</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon_size">6</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="nb_fileinfo">
|
||||
<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">File info</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="img_container">
|
||||
<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="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<child>
|
||||
<widget class="GtkIconView" id="images">
|
||||
<property name="visible">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="tooltip" translatable="yes">Double click to open image</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<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">Images</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
<property name="position">1</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="exifinfo">
|
||||
<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="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="exif_tree">
|
||||
<property name="visible">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="rules_hint">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<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">EXIF</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
<property name="position">2</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Mon Aug 31 09:03:55 2009 -->
|
||||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.6 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkWindow" id="top_discs">
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="discs">
|
||||
@@ -10,66 +10,66 @@
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">True</property>
|
||||
<signal name="button_press_event" handler="on_discs_button_press_event"/>
|
||||
<signal name="row_activated" handler="on_discs_row_activated"/>
|
||||
<signal name="cursor_changed" handler="on_discs_cursor_changed"/>
|
||||
<signal name="row_activated" handler="on_discs_row_activated"/>
|
||||
<signal name="key_release_event" handler="on_discs_key_release_event"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<widget class="GtkMenu" id="discs_popup">
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="expand_all1">
|
||||
<widget class="GtkMenuItem" id="expand_all">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Expand all nodes</property>
|
||||
<property name="label" translatable="yes">_Expand all</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_expand_all1_activate"/>
|
||||
<signal name="activate" handler="on_expand_all_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="collapse_all1">
|
||||
<widget class="GtkMenuItem" id="collapse_all">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Collapse all nodes</property>
|
||||
<property name="label" translatable="yes">_Collapse all</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_collapse_all1_activate"/>
|
||||
<signal name="activate" handler="on_collapse_all_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separator4">
|
||||
<widget class="GtkSeparatorMenuItem" id="separator">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="update1">
|
||||
<widget class="GtkMenuItem" id="update">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Update</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_update1_activate"/>
|
||||
<signal name="activate" handler="on_update_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="rename1">
|
||||
<widget class="GtkMenuItem" id="rename">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Rename</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_rename1_activate"/>
|
||||
<signal name="activate" handler="on_rename_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="delete2">
|
||||
<widget class="GtkMenuItem" id="delete">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Delete</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_delete2_activate"/>
|
||||
<signal name="activate" handler="on_delete_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="statistics1">
|
||||
<widget class="GtkMenuItem" id="statistics">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Statistics</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_statistics1_activate"/>
|
||||
<signal name="activate" handler="on_statistics_activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
19
pygtktalog/views/glade/files.glade
Normal file
19
pygtktalog/views/glade/files.glade
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Sat Aug 29 15:22:37 2009 -->
|
||||
<glade-interface>
|
||||
<widget class="GtkWindow" id="top_files">
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="files">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">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="row_activated" handler="on_files_row_activated"/>
|
||||
<signal name="cursor_changed" handler="on_files_cursor_changed"/>
|
||||
<signal name="key_release_event" handler="on_files_key_release_event"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
22
pygtktalog/views/glade/tagcloud.glade
Normal file
22
pygtktalog/views/glade/tagcloud.glade
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<glade-interface>
|
||||
<!-- interface-requires gtk+ 2.6 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<widget class="GtkWindow" id="top_tags">
|
||||
<child>
|
||||
<widget class="GtkTextView" id="tag_cloud_textview">
|
||||
<property name="visible">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="wrap_mode">word</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
<signal name="visibility_notify_event" handler="on_tag_cloud_textview_visibility_notify_event"/>
|
||||
<signal name="drag_motion" handler="on_tag_cloud_textview_drag_motion"/>
|
||||
<signal name="event_after" handler="on_tag_cloud_textview_event_after"/>
|
||||
<signal name="drag_drop" handler="on_tag_cloud_textview_drag_drop"/>
|
||||
<signal name="drag_leave" handler="on_tag_cloud_textview_drag_leave"/>
|
||||
<signal name="drag_data_received" handler="on_tag_cloud_textview_drag_data_received"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
210
pygtktalog/views/glade/test.glade
Normal file
210
pygtktalog/views/glade/test.glade
Normal file
@@ -0,0 +1,210 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Fri Oct 23 18:28:53 2009 -->
|
||||
<glade-interface>
|
||||
<widget class="GtkWindow" id="window1">
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
|
||||
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
|
||||
<child>
|
||||
<widget class="GtkMenuBar" id="menubar1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menuitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_File</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-new</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-open</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-save</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-save-as</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-quit</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menuitem2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Edit</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-cut</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-copy</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-paste</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem9">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-delete</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menuitem3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_View</property>
|
||||
<property name="use_underline">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menuitem4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use_underline">True</property>
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menu3">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="imagemenuitem10">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">gtk-about</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHPaned" id="hpaned1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<widget class="GtkViewport" id="viewport1">
|
||||
<property name="visible">True</property>
|
||||
<property name="resize_mode">GTK_RESIZE_QUEUE</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="resize">False</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkTextView" id="textview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkStatusbar" id="statusbar1">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">2</property>
|
||||
<property name="has_resize_grip">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkProgressBar" id="progressbar1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
@@ -7,6 +7,8 @@
|
||||
"""
|
||||
import os.path
|
||||
|
||||
import gtk
|
||||
|
||||
from gtkmvc import View
|
||||
|
||||
|
||||
@@ -53,8 +55,7 @@ class DiscsView(View):
|
||||
Initialize view
|
||||
"""
|
||||
View.__init__(self)
|
||||
self.popup_menu = DiscsPopupView()
|
||||
|
||||
self.menu = DiscsPopupView()
|
||||
|
||||
class DiscsPopupView(View):
|
||||
"""
|
||||
@@ -69,47 +70,51 @@ class DiscsPopupView(View):
|
||||
"""
|
||||
View.__init__(self)
|
||||
|
||||
def disable_update(self, state):
|
||||
"""
|
||||
"""
|
||||
self['update1'].set_sensitive(not state)
|
||||
|
||||
#class FilesView(View):
|
||||
# """
|
||||
# Separate subview of Files TreeView as a table.
|
||||
# """
|
||||
# glade = get_glade("files.glade")
|
||||
# top = 'files'
|
||||
class FilesView(View):
|
||||
"""
|
||||
Separate subview of Files TreeView as a table.
|
||||
"""
|
||||
glade = get_glade("files.glade")
|
||||
top = 'files'
|
||||
|
||||
# def __init__(self):
|
||||
# """
|
||||
# Initialize view
|
||||
# """
|
||||
# View.__init__(self)
|
||||
def __init__(self):
|
||||
"""
|
||||
Initialize view
|
||||
"""
|
||||
View.__init__(self)
|
||||
|
||||
|
||||
#class TagcloudView(View):
|
||||
# """
|
||||
# Textview subview with clickable tags.
|
||||
# """
|
||||
# glade = get_glade("tagcloud.glade")
|
||||
# top = 'tag_cloud_textview'
|
||||
class TagcloudView(View):
|
||||
"""
|
||||
Textview subview with clickable tags.
|
||||
"""
|
||||
glade = get_glade("tagcloud.glade")
|
||||
top = 'tag_cloud_textview'
|
||||
|
||||
# def __init__(self):
|
||||
# """
|
||||
# Initialize view
|
||||
# """
|
||||
# View.__init__(self)
|
||||
def __init__(self):
|
||||
"""
|
||||
Initialize view
|
||||
"""
|
||||
View.__init__(self)
|
||||
|
||||
|
||||
#class DetailsView(View):
|
||||
# """
|
||||
# Notebook subview containing tabs with details and possibly Exif, images
|
||||
# assocated with object and alternatively thumbnail.
|
||||
# """
|
||||
# glade = get_glade("details.glade")
|
||||
# top = 'notebook_details'
|
||||
class DetailsView(View):
|
||||
"""
|
||||
Notebook subview containing tabs with details and possibly Exif, images
|
||||
assocated with object and alternatively thumbnail.
|
||||
"""
|
||||
glade = get_glade("details.glade")
|
||||
top = 'notebook_details'
|
||||
|
||||
# def __init__(self):
|
||||
# """
|
||||
# Initialize view
|
||||
# """
|
||||
# View.__init__(self)
|
||||
def __init__(self):
|
||||
"""
|
||||
Initialize view
|
||||
"""
|
||||
View.__init__(self)
|
||||
|
||||
|
||||
|
||||
36
pygtktalog/views/main_menu.py
Normal file
36
pygtktalog/views/main_menu.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""
|
||||
Project: pyGTKtalog
|
||||
Description: Menu for the main window
|
||||
Type: interface
|
||||
Author: Roman 'gryf' Dobosz, gryf73@gmail.com
|
||||
Created: 2010-03-14 21:31:57
|
||||
"""
|
||||
|
||||
import gtk
|
||||
|
||||
from gtkmvc import View
|
||||
|
||||
|
||||
class MainMenu(View):
|
||||
def __init__(self):
|
||||
View.__init__(self)
|
||||
self['mainMenu'] = gtk.MenuBar()
|
||||
|
||||
self['file_menu'] = gtk.MenuItem(_("_File"))
|
||||
|
||||
accel_group = gtk.AccelGroup()
|
||||
menu_items = (("/_File", None, None, 0, "<Branch>"),
|
||||
("/File/_New", "<control>N", None, 0, None),
|
||||
("/File/_Open", "<control>O", None, 0, None),
|
||||
("/File/_Save", "<control>S", None, 0, None),
|
||||
("/File/Save _As", None, None, 0, None),
|
||||
("/File/sep1", None, None, 0, "<Separator>"),
|
||||
("/File/Quit", "<control>Q", gtk.main_quit, 0, None),
|
||||
("/_Options", None, None, 0, "<Branch>"),
|
||||
("/Options/Test", None, None, 0, None),
|
||||
("/_Help", None, None, 0, "<LastBranch>"),
|
||||
("/_Help/About", None, None, 0, None),)
|
||||
item_factory = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group)
|
||||
item_factory.create_items(menu_items)
|
||||
|
||||
|
||||
18
pygtktalog/views/main_toolbar.py
Normal file
18
pygtktalog/views/main_toolbar.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""
|
||||
Project: pyGTKtalog
|
||||
Description: Toolbar for the main window
|
||||
Type: interface
|
||||
Author: Roman 'gryf' Dobosz, gryf73@gmail.com
|
||||
Created: 2010-04-20 18:47:49
|
||||
"""
|
||||
|
||||
import gtk
|
||||
|
||||
from gtkmvc import View
|
||||
|
||||
|
||||
class ToolBar(View):
|
||||
def __init__(self):
|
||||
View.__init__(self)
|
||||
self['maintoolbar'] = gtk.Toolbar()
|
||||
|
||||
@@ -862,10 +862,6 @@ class MainController(Controller):
|
||||
|
||||
self.__popup_menu(event)
|
||||
|
||||
def on_expand_all1_activate(self, menu_item):
|
||||
self.view['discs'].expand_all()
|
||||
return
|
||||
|
||||
def on_export_activate(self, menu_item):
|
||||
"""export db file and coressponding images to tar.bz2 archive"""
|
||||
dialog = Dialogs.ChooseFilename(None, _("Choose export file"))
|
||||
|
||||
Reference in New Issue
Block a user