Merge lp:~simon-kersey/bzr-explorer/564811-fix into lp:bzr-explorer

Proposed by Simon Kersey
Status: Merged
Merged at revision: not available
Proposed branch: lp:~simon-kersey/bzr-explorer/564811-fix
Merge into: lp:bzr-explorer
Diff against target: 41 lines (+17/-6)
1 file modified
lib/builders/toolset_builders.py (+17/-6)
To merge this branch: bzr merge lp:~simon-kersey/bzr-explorer/564811-fix
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Review via email: mp+23563@code.launchpad.net

Description of the change

Fixes bug with nested folders in toolbars.xml by adding support for nested folders as menus. Also fixes common error in handling of nested folders as menus in ToolBoxBuilder.

To post a comment you must log in.
Revision history for this message
Ian Clatworthy (ian-clatworthy) wrote :

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/builders/toolset_builders.py'
2--- lib/builders/toolset_builders.py 2010-03-07 05:08:57 +0000
3+++ lib/builders/toolset_builders.py 2010-04-16 16:35:26 +0000
4@@ -176,11 +176,21 @@
5 icon = kinds.icon_for_kind(entry.type)
6 action.setIcon(icon)
7 elif isinstance(entry, tools.ToolFolder):
8- # TODO: turn sub-folders into menus
9- toolbar.addSeparator()
10+ # create menu
11+ item = QtGui.QMenu(entry.title,toolbar)
12+ menu_action = QtGui.QAction(entry.title, toolbar)
13+ menu_action.setMenu(item)
14+ if entry.icon:
15+ icon = kinds.icon_by_resource_path(entry.icon)
16+ menu_action.setIcon(icon)
17+ toolbar.addAction(menu_action)
18+ # change to button behaviour if top of menu
19+ if isinstance(toolbar, QtGui.QToolBar):
20+ button = toolbar.widgetForAction(menu_action)
21+ button.setPopupMode(QtGui.QToolButton.InstantPopup)
22+ # add menu options
23 for child in entry:
24- self._add_tool_entry(child, toolbar, toolbars)
25- toolbar.addSeparator()
26+ self._add_tool_entry(child, item, toolbars, folders)
27 elif isinstance(entry, tools.ToolSet):
28 # Lookup the folder named "toolset:...".
29 # Note: project substitution is not supported here
30@@ -539,8 +549,9 @@
31 if icon is not None:
32 menu_action.setIcon(icon)
33 group.addAction(menu_action)
34- button = group.widgetForAction(menu_action)
35- button.setPopupMode(QtGui.QToolButton.InstantPopup)
36+ if isinstance(group, QtGui.QToolBar):
37+ button = group.widgetForAction(menu_action)
38+ button.setPopupMode(QtGui.QToolButton.InstantPopup)
39 for child in entry:
40 self._add_tool_entry(child, item, groups, default_group_icon)
41 elif isinstance(entry, tools.ToolSeparator):

Subscribers

People subscribed via source and target branches