from database import db
-class HelloWorld:
-
- def hello(self, widget, data=None):
- print "Hello World"
+class List:
def delete_event(self, widget, event, data=None):
- # If you return FALSE in the "delete_event" signal handler,
- # GTK will emit the "destroy" signal. Returning TRUE means
- # you don't want the window to be destroyed.
- # This is useful for popping up 'are you sure you want to quit?'
- # type dialogs.
- print "delete event occurred"
- # Change FALSE to TRUE and the main window will not be destroyed
- # with a "delete_event".
+ print "delete event occurred"
return False
def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()
+
def __init__(self):
gtk.rc_parse_string("style 'scroll' {\n"
- " engine 'sapwood'{\n"
- " GtkRange::slider-width = 40\n"
- " }\n"
+ " GtkRange::slider-width = 40\n"
"}\n"
"class 'GtkRange' style 'scroll'")
+ #gtk.rc_parse_string("style 'scroll' {\n"
+ # " GtkRange::slider-width = 40\n"
+ # "}\n"
+ # "class 'GtkRange' style 'scroll'")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+
+ self.window.set_size_request(800, 480)
- self.window.set_size_request(600, 360)
-
-
+ #self.window.fullscreen();
- # When the window is given the "delete_event" signal (this is given
- # by the window manager, usually by the "close" option, or on the
- # titlebar), we ask it to call the delete_event () function
- # as defined above. The data passed to the callback
- # function is NULL and is ignored in the callback function.
self.window.connect("delete_event", self.delete_event)
- # Here we connect the "destroy" event to a signal handler.
- # This event occurs when we call gtk_widget_destroy() on the window,
- # or if we return FALSE in the "delete_event" callback.
self.window.connect("destroy", self.destroy)
+ #self.window.connect("window-state-event", self.window_state_cb)
- # Sets the border width of the window.
self.window.set_border_width(10)
vbox = gtk.VBox(False, 8)
sw = gtk.ScrolledWindow()
sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- #a = gtk.Adjustment(0, 100, 100, 0, 10, 10)
- #sw.set_vadjustment()
-
vbox.pack_start(sw, True, True, 0)
column.set_sort_column_id(0)
tree.append_column(column)
-
sw.add(tree)
-
-
self.window.add(vbox)
self.window.show_all()
self.window.show()
def select_item(self, widget, path, column):
- print "select_item path:%s" % path
+
+ #print "select_item path:%s" % path
self.dialog = gtk.Dialog("Item descrition",
self.window,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
model = widget.get_model()
id = model[path][0]
rec = self.dbo.get_record(id)
- print rec
+ #print rec
text = ""
tb = gtk.TextBuffer()
for r in rec:
- print "%s -> %s" % (r, rec[r])
+ #print "%s -> %s" % (r, rec[r])
text += "%s: %s\n" % (r, rec[r])
- tb.insert_at_cursor(text)
+
+ tb.insert_at_cursor(text)
sw = gtk.ScrolledWindow()
sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
tv = gtk.TextView(tb)
sw.add(tv)
- #label = gtk.Label(text)
- #sw.add(label)
- #label.set_markup(text)
self.dialog.vbox.pack_start(sw)
- self.dialog.set_size_request(800, 480)
- #label.show()
+ self.dialog.set_size_request(600, 360)
tv.show()
- #tb.show()
sw.show()
response = self.dialog.run()
self.dialog.destroy()
def main(self):
- # All PyGTK applications must have a gtk.main(). Control ends here
- # and waits for an event to occur (like a key press or mouse event).
gtk.main()
if __name__ == "__main__":
- hello = HelloWorld()
- hello.main()
+ app = List()
+ app.main()