Using the same (context) menu in windows and nautilus would be practically
because
changes happen only in one location. Here is a first draft for this.
The first patch contains the methods _get_commands_dragdrop and _get_commands
from
windows (tortoise/contextmenu.py) in a separate module.
The second patch uses this new module for windows.
The patch for nautilus is not ready yet. There are too much differences in the
two menus. The function for creating the menu could look like this:
def buildMenu(menus, vfsfile):
'''Build menu'''
items = []
pos = 0
for menu_info in menus:
pos += 1
id = 'HgNautilus::%02d' % pos
if menu_info.isSep():
#can not insert a separator till now
pass
elif menu_info.isSubmenu():
item = nautilus.MenuItem(id, menu_info.menutext,
menu_info.helptext)
submenu = nautilus.Menu()
item.set_submenu(submenu)
for subitem in buildMenu(menu_info.get_menus())
submenu.append_item(subitem)
items.append(item)
else:
if menu_info.state:
item = nautilus.MenuItem(id,
menu_info.menutext,
menu_info.helptext,
icon(manu_info.icon))
item.connect('activate', menu_info.handler, vfs_file)
items.append(item)
return items
Any comments?
Warning, the code is not tested!
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop