<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'># HG changeset patch<br># User K. Arvanitis <<a href="mailto:kosta@alumni.uvic.ca">kosta@alumni.uvic.ca</a>><br># Date 1422776304 28800<br># Parent 511bcfb8df4f6ab9d182ad58d7cdf32a3193a0d8<br>[PATCH] Updated Memory Edit View #3<BR>Updated column picker dialog to utilize treeview. Updated spacing on<br>generic yesno dialogs. Provides overall better readability.<BR><br>Feature #2273<BR>diff -r 511bcfb8df4f -r 692c2f783c89 chirpui/mainapp.py<br>--- a/chirpui/mainapp.py Sat Jan 31 12:27:19 2015 -0800<br>+++ b/chirpui/mainapp.py Sat Jan 31 23:38:24 2015 -0800<br>@@ -725,12 +725,13 @@<br> return False<br> <br> if eset.is_modified():<br>- dlg = miscwidgets.YesNoDialog(title=_("Save Changes?"),<br>+ dlg = miscwidgets.YesNoDialog(title=_("Save Changes"),<br> parent=self,<br> buttons=(gtk.STOCK_YES, gtk.RESPONSE_YES,<br> gtk.STOCK_NO, gtk.RESPONSE_NO,<br> gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))<br>- dlg.set_text(_("File is modified, save changes before closing?"))<br>+ dlg.set_text(_("Save changes to %s?") % eset.filename)<br>+ <br> res = dlg.run()<br> dlg.destroy()<br> <br>@@ -1220,27 +1221,38 @@<br> radio_name = "%s %s %s" % (eset.rthread.radio.VENDOR,<br> eset.rthread.radio.MODEL,<br> eset.rthread.radio.VARIANT)<br>- d = gtk.Dialog(title=_("Select Columns"),<br>- parent=self,<br>- buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,<br>- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))<br>+ dlg = gtk.Dialog(title=_("Choose Columns"),<br>+ parent=self,<br>+ buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,<br>+ gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))<br>+ dlg.set_size_request(-1, 300)<br>+ dlg.set_resizable(False)<br> <br>- vbox = gtk.VBox()<br>- vbox.show()<br>+ store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, gobject.TYPE_INT)<br>+ view = gtk.TreeView(store)<br>+ view.set_headers_visible(False)<br>+ rend = gtk.CellRendererToggle()<br>+ def toggle(render, path, column):<br>+ store[path][column] = not store[path][column]<br>+ rend.connect("toggled", toggle, 1)<br>+ col = gtk.TreeViewColumn(None, rend, active=1)<br>+ view.append_column(col)<br>+ rend = gtk.CellRendererText()<br>+ col = gtk.TreeViewColumn(None, rend, text=0)<br>+ view.append_column(col)<br>+ view.show()<br>+<br> sw = gtk.ScrolledWindow()<br> sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)<br>- sw.add_with_viewport(vbox)<br>+ sw.add_with_viewport(view)<br> sw.show()<br>- d.vbox.pack_start(sw, 1, 1, 1)<br>- d.set_size_request(-1, 300)<br>- d.set_resizable(False)<br>+ dlg.vbox.pack_start(sw, 1, 1, 1)<br> <br>- label = gtk.Label(_("Visible columns for {radio}").format(radio=radio_name))<br>+ label = gtk.Label(_("Select the visible columns for {radio}").format(radio=radio_name))<br> label.show()<br>- vbox.pack_start(label)<br>+ dlg.vbox.pack_start(label, 0, 0, 6)<br> <br>- fields = []<br>- memedit = eset.get_current_editor() #.editors["memedit"]<br>+ memedit = eset.get_current_editor()<br> unsupported = memedit.get_unsupported_columns()<br> for colspec in memedit.cols:<br> if colspec[0].startswith("_"):<br>@@ -1248,25 +1260,25 @@<br> elif colspec[0] in unsupported:<br> continue<br> label = colspec[0]<br>- visible = memedit.get_column_visible(memedit.col(label))<br>- widget = gtk.CheckButton(label)<br>- widget.set_active(visible)<br>- fields.append(widget)<br>- vbox.pack_start(widget, 1, 1, 1)<br>- widget.show()<br>+ colnum = memedit.col(label)<br>+ visible = memedit.get_column_visible(colnum)<br>+ iter = store.append()<br>+ store.set(iter, 0, label, 1, visible, 2, colnum)<br> <br>- res = d.run()<br>- selected_columns = []<br>+ res = dlg.run()<br>+<br>+ lst = []<br> if res == gtk.RESPONSE_OK:<br>- for widget in fields:<br>- colnum = memedit.col(widget.get_label())<br>- memedit.set_column_visible(colnum, widget.get_active())<br>- if widget.get_active():<br>- selected_columns.append(widget.get_label())<br>+ def func(_store, path, iter):<br>+ label, visible, colnum = _store.get(iter, 0, 1, 2)<br>+ memedit.set_column_visible(colnum, visible)<br>+ if visible:<br>+ lst.append(label)<br>+ store.foreach(func)<br> <br>- d.destroy()<br>+ dlg.destroy()<br> <br>- CONF.set(driver, ",".join(selected_columns), "memedit_columns")<br>+ CONF.set(driver, ",".join(lst), "memedit_columns")<br> <br> def do_hide_unused(self, action):<br> eset = self.get_current_editorset()<br>@@ -1469,6 +1481,7 @@<br> </menu><br> <menu action="view"><br> <menuitem action="columns"/><br>+ <separator/><br> <menuitem action="hide_unused"/><br> <menuitem action="no_smart_tmode"/><br> <menu action="viewdeveloper"><br>@@ -1476,6 +1489,7 @@<br> <menuitem action="devdiffraw"/><br> <menuitem action="devdifftab"/><br> </menu><br>+ <separator/><br> <menuitem action="language"/><br> </menu><br> <menu action="radio" name="radio"><br>@@ -1532,7 +1546,7 @@<br> ('exchange', None, _("E_xchange"), "<Control><Shift>x", None, self.mh),<br> ('properties', None, _("P_roperties"), None, None, self.mh),<br> ('view', None, _("_View"), None, None, self.mh),<br>- ('columns', None, _("Columns"), None, None, self.mh),<br>+ ('columns', None, _("C_hoose Columns..."), None, None, self.mh),<br> ('viewdeveloper', None, _("Developer"), None, None, self.mh),<br> ('devshowraw', None, _('Show raw memory'), "<Control><Shift>r", None, self.mh),<br> ('devdiffraw', None, _("Diff raw memories"), "<Control><Shift>d", None, self.mh),<br>diff -r 511bcfb8df4f -r 692c2f783c89 chirpui/memedit.py<br>--- a/chirpui/memedit.py Sat Jan 31 12:27:19 2015 -0800<br>+++ b/chirpui/memedit.py Sat Jan 31 23:38:24 2015 -0800<br>@@ -1448,7 +1448,7 @@<br> loc, filled = store.get(iter,<br> self.col(_("Loc")), self.col("_filled"))<br> if filled and not always:<br>- d = miscwidgets.YesNoDialog(title=_("Overwrite?"),<br>+ d = miscwidgets.YesNoDialog(title=_("Overwrite"),<br> buttons=(gtk.STOCK_YES, 1,<br> gtk.STOCK_NO, 2,<br> gtk.STOCK_CANCEL, 3,<br>diff -r 511bcfb8df4f -r 692c2f783c89 chirpui/miscwidgets.py<br>--- a/chirpui/miscwidgets.py Sat Jan 31 12:27:19 2015 -0800<br>+++ b/chirpui/miscwidgets.py Sat Jan 31 23:38:24 2015 -0800<br>@@ -599,7 +599,7 @@<br> self._label.show()<br> <br> # pylint: disable-msg=E1101<br>- self.vbox.pack_start(self._label, 1, 1, 1)<br>+ self.vbox.pack_start(self._label, 1, 1, 6)<br> <br> def set_text(self, text):<br> self._label.set_text(text)<br><BR>                                            </div></body>
</html>