summaryrefslogtreecommitdiff
path: root/gui.py
diff options
context:
space:
mode:
authorjvoisin2011-07-12 00:46:43 +0200
committerjvoisin2011-07-12 00:46:43 +0200
commit10522c1d3e87151ba9d0c8d42d1b047eb2142971 (patch)
treea5292297b20d5e20cc868a268cb975d975f44c1d /gui.py
parentea52ce793f23215699cb0434e831eb6b2283675b (diff)
Add the statusbar, and clarifications
Diffstat (limited to 'gui.py')
-rw-r--r--gui.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/gui.py b/gui.py
index d9fb7ad..6d07e95 100644
--- a/gui.py
+++ b/gui.py
@@ -41,31 +41,48 @@ class ListStoreApp:
41 self.window.add(vbox) 41 self.window.add(vbox)
42 42
43 sw = Gtk.ScrolledWindow() 43 sw = Gtk.ScrolledWindow()
44 sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
45 sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
46 vbox.pack_start(sw, True, True, 0) 44 vbox.pack_start(sw, True, True, 0)
47 45
48 self.create_model() 46 self.create_model()
47
49 treeview = Gtk.TreeView(model=self.model) 48 treeview = Gtk.TreeView(model=self.model)
50 treeview.set_rules_hint(True) 49 treeview.set_rules_hint(True)
51 sw.add(treeview) 50 sw.add(treeview)
52
53 self.add_columns(treeview) 51 self.add_columns(treeview)
52
53 self.statusbar = Gtk.Statusbar()
54 self.statusbar.push(1, 'Ready')
55 vbox.pack_start(self.statusbar, False, False, 0)
56
54 self.window.show_all() 57 self.window.show_all()
55 58
56 def create_toolbar(self): 59 def create_toolbar(self):
60 '''
61 Returns a bbox object, which contains a toolbar with buttons
62 '''
57 toolbar = Gtk.Toolbar() 63 toolbar = Gtk.Toolbar()
64
65 toolbutton = Gtk.ToolButton(label = 'Add', stock_id=Gtk.STOCK_ADD)
66 toolbar.add(toolbutton)
67
58 toolbutton = Gtk.ToolButton(label = 'Clean', stock_id=Gtk.STOCK_CLEAR) 68 toolbutton = Gtk.ToolButton(label = 'Clean', stock_id=Gtk.STOCK_CLEAR)
59 toolbar.add(toolbutton) 69 toolbar.add(toolbutton)
70
60 toolbutton = Gtk.ToolButton(label='Check', stock_id=Gtk.STOCK_FIND) 71 toolbutton = Gtk.ToolButton(label='Check', stock_id=Gtk.STOCK_FIND)
61 toolbar.add(toolbutton) 72 toolbar.add(toolbutton)
73
62 toolbutton = Gtk.ToolButton(stock_id=Gtk.STOCK_QUIT) 74 toolbutton = Gtk.ToolButton(stock_id=Gtk.STOCK_QUIT)
75 toolbutton.connect('clicked', Gtk.main_quit)
63 toolbar.add(toolbutton) 76 toolbar.add(toolbutton)
64 vbox = Gtk.VBox() 77
78 vbox = Gtk.VBox(spacing=3)
65 vbox.pack_start(toolbar, False, False, 0) 79 vbox.pack_start(toolbar, False, False, 0)
66 return vbox 80 return vbox
67 81
68 def create_model(self): 82 def create_model(self):
83 '''
84 Populate the sheet
85 '''
69 self.model = Gtk.ListStore(str, str, str) #name - type - cleaned 86 self.model = Gtk.ListStore(str, str, str) #name - type - cleaned
70 for item in DATA: 87 for item in DATA:
71 if item.cleaned is 0: 88 if item.cleaned is 0:
@@ -77,6 +94,9 @@ class ListStoreApp:
77 self.model.append( [item.name, item.fileformat, state] ) 94 self.model.append( [item.name, item.fileformat, state] )
78 95
79 def add_columns(self, treeview): 96 def add_columns(self, treeview):
97 '''
98 Crete the columns
99 '''
80 model = treeview.get_model() 100 model = treeview.get_model()
81 renderer = Gtk.CellRendererText() 101 renderer = Gtk.CellRendererText()
82 102
@@ -98,7 +118,7 @@ class ListStoreApp:
98 column.set_sort_column_id(self.COLUMN_CLEANED) 118 column.set_sort_column_id(self.COLUMN_CLEANED)
99 treeview.append_column(column) 119 treeview.append_column(column)
100 120
101def main(demoapp=None): 121def main():
102 app = ListStoreApp() 122 app = ListStoreApp()
103 Gtk.main() 123 Gtk.main()
104 124