Skip to content

Commit 4ff0dff

Browse files
Fix missing menu icons in Linux (#2485)
* Fix menu icons in Linux (finally)!
1 parent 7c44592 commit 4ff0dff

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

CHANGELOG.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioni
7272

7373
=== Fixed
7474

75+
- Fixed missing menu icons on Linux (was working on Windows)
7576
- Fixed removal of animation in Project tree when test run is interrupted
7677
- Fixed console log width to fit visible area, depending on font size
7778
- Fixed not possible to use filenames/paths with spaces in TestRunner arguments. Use double quotes for space separated values,

src/robotide/ui/actiontriggers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ def _create_menu_item(self, action):
135135
name_with_accelerator = self._get_name(action, build_new=True)
136136
menu_item = MenuItem(self._frame, self, name_with_accelerator)
137137
pos = action.get_insertion_index(self.wx_menu)
138-
wx_menu_item = self.wx_menu.Insert(pos, menu_item.id,
139-
menu_item.name, action.doc)
138+
wx_menu_item = wx.MenuItem(self.wx_menu, menu_item.id, menu_item.name, action.doc)
140139
if action.icon:
141140
wx_menu_item.SetBitmap(action.icon)
141+
wx_menu_item = self.wx_menu.Insert(pos, wx_menu_item)
142142
menu_item.set_wx_menu_item(wx_menu_item)
143143
return menu_item
144144

src/robotide/ui/treeplugin.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def __init__(self, parent, action_registerer, settings=None):
231231
self._editor = None
232232
self._execution_results = None
233233
self._resources = []
234+
self._right_click = False
234235
"""
235236
self.SetBackgroundColour('white') # TODO get background color from def
236237
"""
@@ -264,12 +265,18 @@ def _bind_tree_events(self):
264265
self.Bind(wx.EVT_LEFT_DCLICK, self.OnDoubleClick)
265266
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged)
266267
self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnTreeItemExpanding)
267-
self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnRightClick)
268+
self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightClick)
269+
self.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelection)
270+
# self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnRightClick)
268271
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)
269272
self.Bind(customtreectrl.EVT_TREE_ITEM_CHECKED, self.OnTreeItemChecked)
270273
self.Bind(wx.EVT_TREE_ITEM_COLLAPSING, self.OnTreeItemCollapsing)
271274
self.Bind(wx.EVT_CLOSE, self.OnClose)
272275

276+
def OnSelection(self, event):
277+
if self._right_click:
278+
event.Skip()
279+
273280
def OnDoubleClick(self, event):
274281
item, pos = self.HitTest(self.ScreenToClient(wx.GetMousePosition()))
275282
if item:
@@ -1031,14 +1038,20 @@ def OnLeftArrow(self, event):
10311038
event.Skip()
10321039

10331040
def OnRightClick(self, event):
1041+
if not self._right_click:
1042+
self._right_click = True
10341043
handler = None
1035-
if hasattr(event, 'GetItem'):
1036-
handler = self._controller.get_handler(event.GetItem())
1037-
1044+
# if hasattr(event, 'GetItem'):
1045+
# handler = self._controller.get_handler(event.GetItem())
1046+
item, pos = self.HitTest(self.ScreenToClient(wx.GetMousePosition()), wx.TREE_HITTEST_ONITEMLABEL)
1047+
if item:
1048+
print(f"DEBUG: tree mouse RightClick pos={pos}")
1049+
handler = self.GetItemData(item)
10381050
if handler:
10391051
# if not self.IsExpanded(handler.node):
10401052
# self.Expand(handler.node)
10411053
handler.show_popup()
1054+
self._right_click = False
10421055

10431056
def OnNewTestCase(self, event):
10441057
handler = self._controller.get_handler()

src/robotide/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# limitations under the License.
1515
#
1616
# Automatically generated by `tasks.py`.
17-
VERSION = 'v2.0b2.dev23'
17+
VERSION = 'v2.0b2.dev24'

0 commit comments

Comments
 (0)