Added click handler for projects table
This commit is contained in:
parent
9496c3c72d
commit
fd473958c2
24
Window.py
24
Window.py
@ -90,7 +90,11 @@ class Window:
|
|||||||
pnum = self.getProjectNum(pname)
|
pnum = self.getProjectNum(pname)
|
||||||
l = gtk.Label(pname)
|
l = gtk.Label(pname)
|
||||||
l.set_alignment(0.0, 0.0)
|
l.set_alignment(0.0, 0.0)
|
||||||
self.projects_table.attach(l, 0, 1, row, row + 1)
|
e = gtk.EventBox()
|
||||||
|
e.add(l)
|
||||||
|
e.add_events(gtk.gdk.BUTTON_PRESS_MASK)
|
||||||
|
e.connect("button-press-event", self.project_click_event)
|
||||||
|
self.projects_table.attach(e, 0, 1, row, row + 1)
|
||||||
self.project_hour_labels[pnum] = {}
|
self.project_hour_labels[pnum] = {}
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
l = gtk.Label()
|
l = gtk.Label()
|
||||||
@ -120,6 +124,7 @@ class Window:
|
|||||||
hbox.pack_start(self.add_project_button, expand = False)
|
hbox.pack_start(self.add_project_button, expand = False)
|
||||||
self.projects_table.attach(hbox, 0, columns, rows - 1, rows)
|
self.projects_table.attach(hbox, 0, columns, rows - 1, rows)
|
||||||
self.projects_table.set_row_spacings(3)
|
self.projects_table.set_row_spacings(3)
|
||||||
|
self.projects_table.connect("button-press-event", self.project_click_event)
|
||||||
|
|
||||||
self.projects_container.pack_start(self.projects_table)
|
self.projects_container.pack_start(self.projects_table)
|
||||||
self.projects_present = True
|
self.projects_present = True
|
||||||
@ -184,6 +189,23 @@ class Window:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def project_click_event(self, ebox, event, data=None):
|
||||||
|
lbl = ebox.get_child()
|
||||||
|
if lbl:
|
||||||
|
if event.button == 1:
|
||||||
|
return self.project_select_event(lbl.get_text())
|
||||||
|
elif event.button == 3:
|
||||||
|
print "Right Click"
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def project_select_event(self, projectName):
|
||||||
|
pnum = self.getProjectNum(projectName)
|
||||||
|
if pnum:
|
||||||
|
print "Selected project '%s' (%d)" % (projectName, pnum)
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def delete_event(self, widget, event, data=None):
|
def delete_event(self, widget, event, data=None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user