Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.6, 0.7, and 0.7.1

cmenu: don't add TortoiseHg menu if no applicable actions

Changeset 969788b53534

Parent 4cd25ead626c

by TK Soh

Changes to one file · Browse files at 969788b53534 Showing diff from parent 4cd25ead626c Diff from another changeset...

 
241
242
243
244
245
246
247
248
 
 
 
 
 
249
250
251
252
253
254
 
 
 
 
 
 
 
 
255
256
257
 
 
 
 
 
258
259
260
 
241
242
243
 
 
 
 
 
244
245
246
247
248
249
 
 
 
 
 
250
251
252
253
254
255
256
257
258
 
 
259
260
261
262
263
264
265
266
@@ -241,20 +241,26 @@
  # get other menus for hg submenu   commands = self._get_commands()   - # add common menu items - commands.append(TortoiseMenuSep()) - commands.append(TortoiseMenu(_("About"), - _("About TortoiseHg"), - self._about, icon="menuabout.ico")) + # add common menu items + commands.append(TortoiseMenuSep()) + commands.append(TortoiseMenu(_("About"), + _("About TortoiseHg"), + self._about, icon="menuabout.ico"))   - # create submenus with Hg commands - thgmenu.append(TortoiseSubmenu("TortoiseHG", commands, icon="hg.ico")) - thgmenu.append(TortoiseMenuSep()) - - idCmd = self._create_menu(hMenu, thgmenu, indexMenu, 0, idCmdFirst) + if commands: + # create submenus with Hg commands + thgmenu.append(TortoiseSubmenu("TortoiseHG", commands, + icon="hg.ico")) + thgmenu.append(TortoiseMenuSep()) + + idCmd = self._create_menu(hMenu, thgmenu, indexMenu, 0, + idCmdFirst)   - # Return total number of menus & submenus we've added - return idCmd + # Return total number of menus & submenus we've added + return idCmd + else: + # no applicable Hg actions + return 0     def _get_commands_dragdrop(self):   """