2015-01-31_00-19-59_r2353 .diff

Kosta A., 01/31/2015 12:40 am

Download (16.4 kB)

b/chirpui/mainapp.py Sat Jan 31 00:19:59 2015 -0800
112 112
        
113 113
        for i in ["export", "close", "columns", "irbook", "irfinder",
114 114
                  "move_up", "move_dn", "exchange", "iradioreference",
115
                  "cut", "copy", "paste", "delete", "viewdeveloper"]:
115
                  "cut", "copy", "paste", "delete", "viewdeveloper",
116
                  "all", "properties"]:
116 117
            set_action_sensitive(i, eset is not None)
117 118

  
118 119
    def ev_status(self, editorset, msg):
......
1219 1220
        radio_name = "%s %s %s" % (eset.rthread.radio.VENDOR,
1220 1221
                                   eset.rthread.radio.MODEL,
1221 1222
                                   eset.rthread.radio.VARIANT)
1222
        d = gtk.Dialog(title=_("Select Columns"),
1223
        d = gtk.Dialog(title=_("Choose Columns"),
1223 1224
                       parent=self,
1224 1225
                       buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
1225 1226
                                gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
......
1418 1419
            self.do_toggle_no_smart_tmode(_action)
1419 1420
        elif action == "developer":
1420 1421
            self.do_toggle_developer(_action)
1421
        elif action in ["cut", "copy", "paste", "delete",
1422
                        "move_up", "move_dn", "exchange",
1422
        elif action in ["cut", "copy", "paste", "delete", "all",
1423
                        "move_up", "move_dn", "exchange", "properties",
1423 1424
                        "devshowraw", "devdiffraw"]:
1424 1425
            self.get_current_editorset().get_current_editor().hotkey(_action)
1425 1426
        elif action == "devdifftab":
......
1458 1459
      <menuitem action="paste"/>
1459 1460
      <menuitem action="delete"/>
1460 1461
      <separator/>
1462
      <menuitem action="all"/>
1463
      <separator/>
1461 1464
      <menuitem action="move_up"/>
1462 1465
      <menuitem action="move_dn"/>
1463 1466
      <menuitem action="exchange"/>
1467
      <separator/>
1468
      <menuitem action="properties"/>
1464 1469
    </menu>
1465 1470
    <menu action="view">
1466 1471
      <menuitem action="columns"/>
1472
      <separator/>
1467 1473
      <menuitem action="hide_unused"/>
1468 1474
      <menuitem action="no_smart_tmode"/>
1469 1475
      <menu action="viewdeveloper">
......
1471 1477
        <menuitem action="devdiffraw"/>
1472 1478
        <menuitem action="devdifftab"/>
1473 1479
      </menu>
1480
      <separator/>
1474 1481
      <menuitem action="language"/>
1475 1482
    </menu>
1476 1483
    <menu action="radio" name="radio">
1477 1484
      <menuitem action="download"/>
1478 1485
      <menuitem action="upload"/>
1486
      <separator/>
1479 1487
      <menu action="importsrc" name="importsrc">
1480 1488
        <menuitem action="iradioreference"/>
1481 1489
        <menuitem action="irbook"/>
......
1509 1517
            ('file', None, _("_File"), None, None, self.mh),
1510 1518
            ('new', gtk.STOCK_NEW, None, None, None, self.mh),
1511 1519
            ('open', gtk.STOCK_OPEN, None, None, None, self.mh),
1512
            ('openstock', None, _("Open stock config"), None, None, self.mh),
1520
            ('openstock', None, _("Open Stock Config"), None, None, self.mh),
1513 1521
            ('recent', None, _("_Recent"), None, None, self.mh),
1514 1522
            ('save', gtk.STOCK_SAVE, None, None, None, self.mh),
1515 1523
            ('saveas', gtk.STOCK_SAVE_AS, None, None, None, self.mh),
1516
            ('loadmod', None, _("Load Module"), None, None, self.mh),
1524
            ('loadmod', None, _("Load Module..."), None, None, self.mh),
1517 1525
            ('close', gtk.STOCK_CLOSE, None, None, None, self.mh),
1518 1526
            ('quit', gtk.STOCK_QUIT, None, None, None, self.mh),
1519 1527
            ('edit', None, _("_Edit"), None, None, self.mh),
......
1521 1529
            ('copy', None, _("_Copy"), "<Ctrl>c", None, self.mh),
1522 1530
            ('paste', None, _("_Paste"), "<Ctrl>v", None, self.mh),
1523 1531
            ('delete', None, _("_Delete"), "Delete", None, self.mh),
1532
            ('all', None, _("Select _All"), None, None, self.mh),
1524 1533
            ('move_up', None, _("Move _Up"), "<Control>Up", None, self.mh),
1525 1534
            ('move_dn', None, _("Move Dow_n"), "<Control>Down", None, self.mh),
1526 1535
            ('exchange', None, _("E_xchange"), "<Control><Shift>x", None, self.mh),
1536
            ('properties', None, _("P_roperties"), None, None, self.mh),
1527 1537
            ('view', None, _("_View"), None, None, self.mh),
1528
            ('columns', None, _("Columns"), None, None, self.mh),
1538
            ('columns', None, _("C_hoose Columns..."), None, None, self.mh),
1529 1539
            ('viewdeveloper', None, _("Developer"), None, None, self.mh),
1530 1540
            ('devshowraw', None, _('Show raw memory'), "<Control><Shift>r", None, self.mh),
1531 1541
            ('devdiffraw', None, _("Diff raw memories"), "<Control><Shift>d", None, self.mh),
1532 1542
            ('devdifftab', None, _("Diff tabs"), "<Control><Shift>t", None, self.mh),
1533
            ('language', None, _("Change language"), None, None, self.mh),
1543
            ('language', None, _("Change Language..."), None, None, self.mh),
1534 1544
            ('radio', None, _("_Radio"), None, None, self.mh),
1535 1545
            ('download', None, _("Download From Radio"), "<Alt>d", None, self.mh),
1536 1546
            ('upload', None, _("Upload To Radio"), "<Alt>u", None, self.mh),
1537
            ('import', None, _("Import"), "<Alt>i", None, self.mh),
1538
            ('export', None, _("Export"), "<Alt>x", None, self.mh),
1539
            ('importsrc', None, _("Import from data source"), None, None, self.mh),
1547
            ('import', None, _("Import..."), "<Alt>i", None, self.mh),
1548
            ('export', None, _("Export..."), "<Alt>x", None, self.mh),
1549
            ('importsrc', None, _("Import Data Source"), None, None, self.mh),
1540 1550
            ('iradioreference', None, _("RadioReference.com"), None, None, self.mh),
1541 1551
            ('irfinder', None, _("RFinder"), None, None, self.mh),
1542 1552
            ('irbook', None, _("RepeaterBook"), None, None, self.mh),
1543 1553
            ('ipr', None, _("przemienniki.net"), None, None, self.mh),
1544
            ('querysrc', None, _("Query data source"), None, None, self.mh),
1554
            ('querysrc', None, _("Query Data Source"), None, None, self.mh),
1545 1555
            ('qradioreference', None, _("RadioReference.com"), None, None, self.mh),
1546 1556
            ('qrfinder', None, _("RFinder"), None, None, self.mh),
1547 1557
            ('qpr', None, _("przemienniki.net"), None, None, self.mh),
......
1549 1559
            ('export_chirp', None, _("CHIRP Native File"), None, None, self.mh),
1550 1560
            ('export_csv', None, _("CSV File"), None, None, self.mh),
1551 1561
            ('stock', None, _("Import from stock config"), None, None, self.mh),
1552
            ('channel_defaults', None, _("Channel defaults"), None, None, self.mh),
1562
            ('channel_defaults', None, _("Reset Channel Defaults"), None, None, self.mh),
1553 1563
            ('cancelq', gtk.STOCK_STOP, None, "Escape", None, self.mh),
1554 1564
            ('help', None, _('Help'), None, None, self.mh),
1555 1565
            ('about', gtk.STOCK_ABOUT, None, None, None, self.mh),
b/chirpui/memdetail.py Sat Jan 31 00:19:59 2015 -0800
193 193
        self.vbox.pack_start(sw, 1, 1, 1)
194 194
        tab.show()
195 195

  
196
        row = 0
197

  
198 196
        def _err(name, msg):
199 197
            try:
200 198
                _img = self._editors[name][2]
......
210 208
            self.set_response_sensitive(gtk.RESPONSE_OK,
211 209
                                        True not in self._errors)
212 210

  
211
        row = 0
213 212
        for name in self._order:
214 213
            labeltxt, editorcls, data = self._elements[name]
215 214

  
......
235 234
            row += 1
236 235
            self._order.append(name)
237 236

  
238
    def _title(self):
239
        return _("Edit Memory #{num}").format(num=self._memory.number)
240

  
241 237
    def __init__(self, features, memory, parent=None):
242 238
        self._memory = memory
243 239
        gtk.Dialog.__init__(self,
244
                            title=self._title(),
240
                            title="Memory Properties",
245 241
                            flags=gtk.DIALOG_MODAL,
246 242
                            parent=parent,
247 243
                            buttons=(gtk.STOCK_OK, gtk.RESPONSE_OK,
......
327 323
                if isinstance(msg, chirp_common.ValidationError):
328 324
                    errors.append(msg)
329 325
            if errors:
330
                common.show_error_text(_("Memory validation failed:"),
326
                common.show_error_text(_("Memory Validation Failed:"),
331 327
                                       os.linesep +
332 328
                                       os.linesep.join(errors))
333 329
                self.emit_stop_by_name('response')
......
337 333
        return self._memory
338 334

  
339 335
class MultiMemoryDetailEditor(MemoryDetailEditor):
340
    def _title(self):
341
        return _("Edit Multiple Memories")
342

  
343 336
    def __init__(self, features, memory, parent=None):
344 337
        self._selections = dict()
345 338
        super(MultiMemoryDetailEditor, self).__init__(features, memory, parent)
b/chirpui/memedit.py Sat Jan 31 00:19:59 2015 -0800
524 524

  
525 525
        return True # We changed memories
526 526

  
527
    def _delete_rows_and_shift(self, paths, all=False):
527
    def _remove_rows_and_shift(self, paths, all=False):
528 528
        iter = self.store.get_iter(paths[0])
529 529
        starting_loc, = self.store.get(iter, self.col(_("Loc")))
530 530
        for i in range(0, len(paths)):
......
780 780
        elif action == "delete":
781 781
            changed = self._delete_rows(paths)
782 782
        elif action == "delete_s":
783
            changed = self._delete_rows_and_shift(paths)
783
            changed = self._remove_rows_and_shift(paths)
784 784
        elif action == "delete_sall":
785
            changed = self._delete_rows_and_shift(paths, all=True)
785
            changed = self._remove_rows_and_shift(paths, all=True)
786 786
        elif action in ["move_up", "move_dn"]:
787 787
            changed = self._move_up_down(paths, action)
788 788
        elif action == "exchange":
......
791 791
            changed = self.copy_selection(action=="cut")
792 792
        elif action == "paste":
793 793
            changed = self.paste_selection()
794
        elif action == "all":
795
            self._select_all()
794 796
        elif action == "devshowraw":
795 797
            self._show_raw(cur_pos)
796 798
        elif action == "devdiffraw":
797 799
            self._diff_raw(paths)
798
        elif action == "edit":
800
        elif action == "properties":
799 801
            job = common.RadioJob(self.edit_memory, "get_memory", cur_pos)
800 802
            job.set_cb_args(selected)
801 803
            self.rthread.submit(job)
......
828 830
        menu_xml = """
829 831
<ui>
830 832
  <popup name="Menu"> 
831
    <menuitem action="edit"/>
832
    <menuitem action="insert_prev"/>
833
    <menuitem action="insert_next"/>
834
    <menu action="deletes">
835
      <menuitem action="delete"/>
833
    <menuitem action="cut"/>
834
    <menuitem action="copy"/>
835
    <menuitem action="paste"/>
836
    <menuitem action="delete"/>
837
    <separator/>
838
    <menuitem action="all"/>
839
    <separator/>
840
    <menu action="insert">
841
        <menuitem action="insert_prev"/>
842
        <menuitem action="insert_next"/>
843
    </menu>
844
    <menu action="remove">
836 845
      <menuitem action="delete_s"/>
837 846
      <menuitem action="delete_sall"/>
838 847
    </menu>
......
840 849
    <menuitem action="move_dn"/>
841 850
    <menuitem action="exchange"/>
842 851
    <separator/>
843
    <menuitem action="cut"/>
844
    <menuitem action="copy"/>
845
    <menuitem action="paste"/>
852
    <menuitem action="properties"/>
846 853
    %s
847 854
  </popup>
848 855
</ui>
......
854 861
        istwo = len(paths) == 2
855 862

  
856 863
        actions = [
857
            ("edit", _("Edit")),
858
            ("insert_prev", _("Insert row above")),
859
            ("insert_next", _("Insert row below")),
860
            ("deletes", _("Delete")),
861
            ("delete", issingle and _("this memory") or _("these memories")),
864
            ("properties", _("P_roperties")),
865
            ("insert", _("Insert")),
866
            ("insert_prev", _("Row Above")),
867
            ("insert_next", _("Row Below")),
868
            ("remove", _("Remove")),
862 869
            ("delete_s", _("...and shift block up")),
863 870
            ("delete_sall", _("...and shift all memories up")),
864
            ("move_up", _("Move up")),
865
            ("move_dn", _("Move down")),
866
            ("exchange", _("Exchange memories")),
871
            ("move_up", _("Move Up")),
872
            ("move_dn", _("Move Down")),
873
            ("exchange", _("Exchange Memories")),
867 874
            ("cut", _("Cut")),
868 875
            ("copy", _("Copy")),
869 876
            ("paste", _("Paste")),
877
            ("delete", _("Delete")),
878
            ("all", _("Select All")),
870 879
            ("devshowraw", _("Show Raw Memory")),
871 880
            ("devdiffraw", _("Diff Raw Memories")),
872 881
            ]
......
1153 1162
    def make_controls(self, min, max):
1154 1163
        hbox = gtk.HBox(False, 2)
1155 1164

  
1156
        lab = gtk.Label(_("Memory range:"))
1165
        lab = gtk.Label(_("Memory Range:"))
1157 1166
        lab.show()
1158 1167
        hbox.pack_start(lab, 0, 0, 0)
1159 1168

  
......
1180 1189
        hi.show()
1181 1190
        hbox.pack_start(hi, 0, 0, 0)
1182 1191

  
1183
        refresh = gtk.Button(_("Go"))
1192
        refresh = gtk.Button()
1193
        refresh.set_relief(gtk.RELIEF_NONE)
1194
        image = gtk.Image()
1195
        image.set_from_stock(gtk.STOCK_REFRESH, gtk.ICON_SIZE_MENU)
1196
        image.show()
1197
        label = gtk.Label(_("Refresh"))
1198
        label.show()
1199
        box = gtk.HBox(False, 2)
1200
        box.pack_start(image, 0, 0, 0)
1201
        box.pack_start(label, 0, 0, 0)
1202
        box.show()
1203
        refresh.add(box)
1204
        refresh.connect("clicked", lambda x: self.prefill())
1184 1205
        refresh.show()
1185
        refresh.connect("clicked", lambda x: self.prefill())
1186 1206
        hbox.pack_start(refresh, 0, 0, 0)
1187

  
1207
        
1188 1208
        def activate_go(widget):
1189 1209
            refresh.clicked()
1190 1210

  
......
1200 1220

  
1201 1221
        sep = gtk.VSeparator()
1202 1222
        sep.show()
1203
        sep.set_size_request(20, -1)
1204
        hbox.pack_start(sep, 0, 0, 0)
1223
        hbox.pack_start(sep, 0, 0, 2)
1205 1224

  
1206
        showspecial = gtk.CheckButton(_("Special Channels"))
1225
        showspecial = gtk.ToggleButton(_("Special Channels"))
1226
        showspecial.set_relief(gtk.RELIEF_NONE)
1207 1227
        showspecial.set_active(self.show_special)
1208 1228
        showspecial.connect("toggled",
1209 1229
                            lambda x: self.set_show_special(x.get_active()))
1210 1230
        showspecial.show()
1211 1231
        hbox.pack_start(showspecial, 0, 0, 0)
1212

  
1213
        showempty = gtk.CheckButton(_("Show Empty"))
1232
        
1233
        showempty = gtk.ToggleButton(_("Show Empty"))
1234
        showempty.set_relief(gtk.RELIEF_NONE)
1214 1235
        showempty.set_active(self.show_empty);
1215 1236
        showempty.connect("toggled",
1216 1237
                          lambda x: self.set_show_empty(x.get_active()))
1217 1238
        showempty.show()
1218 1239
        hbox.pack_start(showempty, 0, 0, 0)
1219 1240

  
1241
        sep = gtk.VSeparator()
1242
        sep.show()
1243
        hbox.pack_start(sep, 0, 0, 2)
1244

  
1245
        edit = gtk.Button()
1246
        edit.set_relief(gtk.RELIEF_NONE)
1247
        image = gtk.Image()
1248
        image.set_from_stock(gtk.STOCK_EXECUTE, gtk.ICON_SIZE_MENU)
1249
        image.show()
1250
        label = gtk.Label(_("Properties"))
1251
        label.show()
1252
        box = gtk.HBox(False, 2)
1253
        box.pack_start(image, 0, 0, 0)
1254
        box.pack_start(label, 0, 0, 0)
1255
        box.show()
1256
        edit.add(box)
1257
        edit.connect("clicked", lambda x: self.hotkey(gtk.Action("properties", "", "", 0)))
1258
        edit.show()
1259
        hbox.pack_start(edit, 0, 0, 0)
1260

  
1220 1261
        hbox.show()
1221 1262

  
1222 1263
        return hbox
......
1485 1526
        clipboard = gtk.Clipboard(selection="PRIMARY")
1486 1527
        clipboard.request_text(self._paste_selection)
1487 1528

  
1529
    def _select_all(self):
1530
        self.view.get_selection().select_all()
1531

  
1488 1532
    def prepare_close(self):
1489 1533
        cols = self.view.get_columns()
1490 1534
        self._config.set("column_order_%s" % self.__class__.__name__,