Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

taskbarui: change to 2-panes style for menu promoting

fixes #337, but not completely

Changeset 95f1091d20ef

Parent 24df8c18d97e

by Yuki KODAMA

Changes to one file · Browse files at 95f1091d20ef Showing diff from parent 24df8c18d97e Diff from another changeset...

 
43
44
45
 
46
47
48
49
 
50
51
52
 
59
60
61
 
62
63
64
65
66
67
68
69
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
72
73
 
83
84
85
 
86
87
88
 
106
107
108
 
109
110
111
 
122
123
124
 
125
126
127
 
199
200
201
 
202
203
204
 
 
 
 
 
 
 
 
 
205
206
 
207
208
209
210
211
212
213
 
 
214
215
216
 
220
221
222
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
224
225
 
43
44
45
46
47
48
49
50
51
52
53
54
 
61
62
63
64
65
66
67
68
 
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
 
140
141
142
143
144
145
146
 
164
165
166
167
168
169
170
 
181
182
183
184
185
186
187
 
259
260
261
262
263
 
 
264
265
266
267
268
269
270
271
272
273
 
274
275
276
277
278
 
 
 
279
280
281
282
283
 
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
@@ -43,10 +43,12 @@
  self.show_tabs = True   self.show_border = True   + # Options page   settingsframe = self.add_page(notebook, _('Options'))   settingsvbox = gtk.VBox()   settingsframe.add(settingsvbox)   + ## Overlays group   ovframe = gtk.Frame(_('Overlays'))   ovframe.set_border_width(2)   settingsvbox.pack_start(ovframe, False, False, 2) @@ -59,15 +61,70 @@
  self.lclonly = gtk.CheckButton(_('Local disks only'))   hbox.pack_start(self.lclonly, False, False, 2)   + ## Context Menu group   cmframe = gtk.Frame(_('Context Menu'))   cmframe.set_border_width(2)   settingsvbox.pack_start(cmframe, False, False, 2)   cmcvbox = gtk.VBox() - cmframe.add(cmcvbox)     lbl = gtk.Label(_('Promote menu items to the top menu'))   cmcvbox.pack_start(lbl, False, False, 2)   + table = gtk.Table(2, 3) + cmframe.add(table) + def setcell(child, row, col): + table.attach(child, col, col + 1, row, row + 1, gtk.FILL|gtk.EXPAND, 0, 4, 2) + def withframe(widget): + scroll = gtk.ScrolledWindow() + scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) + scroll.set_shadow_type(gtk.SHADOW_ETCHED_IN) + scroll.add(widget) + return scroll + + # Sub menus pane + label = gtk.Label(_('Sub menu items:')) + label.set_alignment(0, 0.5) + setcell(label, 0, 0) + + self.submmodel = model = gtk.ListStore(gobject.TYPE_STRING) + self.submlist = list = gtk.TreeView(model) + list.set_size_request(-1, 180) + list.set_headers_visible(False) + column = gtk.TreeViewColumn() + list.append_column(column) + cell = gtk.CellRendererText() + column.pack_start(cell, True) + column.add_attribute(cell, 'text', 0) + setcell(withframe(list), 1, 0) + + # Top menus pane + label = gtk.Label(_('Top menu items:')) + label.set_alignment(0, 0.5) + setcell(label, 0, 2) + + self.topmmodel = model = gtk.ListStore(gobject.TYPE_STRING) + self.topmlist = list = gtk.TreeView(model) + list.set_size_request(-1, 180) + list.set_headers_visible(False) + column = gtk.TreeViewColumn() + list.append_column(column) + cell = gtk.CellRendererText() + column.pack_start(cell, True) + column.add_attribute(cell, 'text', 0) + setcell(withframe(list), 1, 2) + + # move buttons + mbbox = gtk.VBox() + setcell(mbbox, 1, 1) + + topbutton = gtk.Button(_('Top ->')) + topbutton.connect('clicked', self.top_clicked, apply) + mbbox.add(topbutton) + subbutton = gtk.Button(_('<- Sub')) + subbutton.connect('clicked', self.sub_clicked, apply) + mbbox.add(subbutton) + + # Tooltips   tips = gtk.Tooltips()   rows = (len(shellcmds) + 2) / 3   table = gtk.Table(rows, 3, False) @@ -83,6 +140,7 @@
  tips.set_tip(check, tooltip)   check.connect('toggled', lambda x: apply.set_sensitive(True))   + ## Taskbar group   taskbarframe = gtk.Frame(_('Taskbar'))   taskbarframe.set_border_width(2)   settingsvbox.pack_start(taskbarframe, False, False, 2) @@ -106,6 +164,7 @@
    self.load_shell_configs()   + # Event log page   frame = self.add_page(notebook, _('Event Log'))   frame.set_border_width(2)   @@ -122,6 +181,7 @@
  accelgroup = gtk.AccelGroup()   self.add_accel_group(accelgroup)   + # Bottom buttons   bbox = gtk.HBox()   vbox.pack_start(bbox, False, False, 2)   @@ -199,18 +259,25 @@
  self.lclonly.set_active(localdisks)   self.lclonly.set_sensitive(overlayenable)   self.hgighlight_taskbaricon.set_active(hgighlight_taskbaricon) +   promoted = [pi.strip() for pi in promoteditems.split(',')] - for cmd, check in self.cmptoggles.iteritems(): - check.set_active(cmd in promoted) + self.submmodel.clear() + self.topmmodel.clear() + for cmd in shellcmds: + if cmd in promoted: + self.topmmodel.append((cmd,)) + else: + self.submmodel.append((cmd,)) + self.submmodel.set_sort_column_id(0, gtk.SORT_ASCENDING) + self.topmmodel.set_sort_column_id(0, gtk.SORT_ASCENDING)   - def applyclicked(self, button): + def store_shell_configs(self):   overlayenable = self.ovenable.get_active() and '1' or '0'   localdisks = self.lclonly.get_active() and '1' or '0'   hgighlight_taskbaricon = self.hgighlight_taskbaricon.get_active() and '1' or '0'   promoted = [] - for cmd, check in self.cmptoggles.iteritems(): - if check.get_active(): - promoted.append(cmd) + for row in self.topmmodel: + promoted.append(row[0])   try:   from _winreg import HKEY_CURRENT_USER, CreateKey, SetValueEx, REG_SZ   hkey = CreateKey(HKEY_CURRENT_USER, r"Software\TortoiseHg") @@ -220,6 +287,26 @@
  SetValueEx(hkey, 'PromotedItems', 0, REG_SZ, ','.join(promoted))   except ImportError:   pass + def sub_clicked(self, button, apply): + model, paths = self.topmlist.get_selection().get_selected_rows() + for path in paths: + menu = model[path][0] + model.remove(model.get_iter(path)) + self.submmodel.append((menu,)) + self.submmodel.set_sort_column_id(0, gtk.SORT_ASCENDING) + apply.set_sensitive(True) + + def top_clicked(self, button, apply): + model, paths = self.submlist.get_selection().get_selected_rows() + for path in paths: + menu = model[path][0] + model.remove(model.get_iter(path)) + self.topmmodel.append((menu,)) + self.topmmodel.set_sort_column_id(0, gtk.SORT_ASCENDING) + apply.set_sensitive(True) + + def applyclicked(self, button): + self.store_shell_configs()   button.set_sensitive(False)     def ovenable_toggled(self, check, apply):