Commit e1d76c79dc374f18646065e7fa5fdde0608a44b9
1 parent
5f0b9064
Exists in
master
and in
6 other branches
ENH: Only binding in the submenu if it is running in Linux
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
invesalius/gui/widgets/slice_menu.py
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais |
20 | 20 | # detalhes. |
21 | 21 | #-------------------------------------------------------------------------- |
22 | +import sys | |
22 | 23 | |
23 | 24 | import wx |
24 | 25 | import wx.lib.pubsub as ps |
... | ... | @@ -36,8 +37,11 @@ class SliceMenu(wx.Menu): |
36 | 37 | submenu_wl.AppendItem(wl_item) |
37 | 38 | self.ID_TO_TOOL_ITEM[new_id] = name |
38 | 39 | self.AppendMenu(-1, "Window Width & Level", submenu_wl) |
39 | - submenu_wl.Bind(wx.EVT_MENU, self.OnPopupWindowLevel) | |
40 | - | |
40 | + # It doesn't work in Linux | |
41 | + self.Bind(wx.EVT_MENU, self.OnPopupWindowLevel) | |
42 | + # In Linux the bind must be putted in the submenu | |
43 | + if sys.platform == 'linux2': | |
44 | + submenu_wl.Bind(wx.EVT_MENU, self.OnPopupWindowLevel) | |
41 | 45 | |
42 | 46 | def OnPopupWindowLevel(self, evt): |
43 | 47 | key = self.ID_TO_TOOL_ITEM[evt.GetId()] |
... | ... | @@ -46,4 +50,3 @@ class SliceMenu(wx.Menu): |
46 | 50 | (window, level)) |
47 | 51 | ps.Publisher().sendMessage('Update slice viewer') |
48 | 52 | evt.Skip() |
49 | - | ... | ... |