kopia lustrzana https://github.com/ctjacobs/pyqso
Double-clicking on a row now brings up the "Edit Record" dialog.
rodzic
708437d9d2
commit
2f56acfb92
|
@ -84,7 +84,7 @@ class Menu(Gtk.MenuBar):
|
|||
subm_log.append(mitem_addrecord)
|
||||
|
||||
mitem_editrecord = Gtk.MenuItem("Edit Selected Record...")
|
||||
mitem_editrecord.connect("activate", parent.edit_record_callback)
|
||||
mitem_editrecord.connect("activate", parent.edit_record_callback, None, None)
|
||||
key, mod = Gtk.accelerator_parse("<Control>E")
|
||||
mitem_editrecord.add_accelerator("activate", agrp, key, mod, Gtk.AccelFlags.VISIBLE)
|
||||
subm_log.append(mitem_editrecord)
|
||||
|
|
|
@ -55,6 +55,7 @@ class PyQSO(Gtk.Window):
|
|||
# Render the logbook
|
||||
self.treeview = Gtk.TreeView(self.logbook)
|
||||
self.treeview.set_grid_lines(Gtk.TreeViewGridLines.BOTH)
|
||||
self.treeview.connect("row-activated", self.edit_record_callback)
|
||||
self.treeselection = self.treeview.get_selection()
|
||||
self.treeselection.set_mode(Gtk.SelectionMode.SINGLE)
|
||||
# Allow the Logbook to be scrolled up/down
|
||||
|
@ -130,7 +131,9 @@ class PyQSO(Gtk.Window):
|
|||
|
||||
return
|
||||
|
||||
def edit_record_callback(self, widget):
|
||||
def edit_record_callback(self, widget, path, view_column):
|
||||
# Note: the path and view_column arguments need to be passed in
|
||||
# since they associated with the row-activated signal.
|
||||
|
||||
# Get the selected row in the logbook
|
||||
(model, path) = self.treeselection.get_selected_rows()
|
||||
|
|
|
@ -28,7 +28,11 @@ class RecordDialog(Gtk.Dialog):
|
|||
def __init__(self, parent, index=None):
|
||||
logging.debug("New RecordDialog instance created!")
|
||||
|
||||
Gtk.Dialog.__init__(self, title="Add/Edit Record", parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
|
||||
if(index is not None):
|
||||
title = "Edit Record %d" % index
|
||||
else:
|
||||
title = "Add Record"
|
||||
Gtk.Dialog.__init__(self, title=title, parent=parent, flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
|
||||
|
||||
frame = Gtk.Frame()
|
||||
label = Gtk.Label("QSO Data")
|
||||
|
|
|
@ -43,7 +43,7 @@ class Toolbar(Gtk.HBox):
|
|||
button = Gtk.Button()
|
||||
button.add(icon)
|
||||
button.set_tooltip_text('Edit record')
|
||||
button.connect("clicked", parent.edit_record_callback)
|
||||
button.connect("clicked", parent.edit_record_callback, None, None)
|
||||
self.pack_start(button, False, False, 0)
|
||||
|
||||
# Delete record
|
||||
|
|
Ładowanie…
Reference in New Issue