aboutsummaryrefslogtreecommitdiffstats
path: root/lvc/widgets/osx/contextmenu.py
diff options
context:
space:
mode:
Diffstat (limited to 'lvc/widgets/osx/contextmenu.py')
-rw-r--r--lvc/widgets/osx/contextmenu.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/lvc/widgets/osx/contextmenu.py b/lvc/widgets/osx/contextmenu.py
index 7a8fa55..6fd932c 100644
--- a/lvc/widgets/osx/contextmenu.py
+++ b/lvc/widgets/osx/contextmenu.py
@@ -3,6 +3,7 @@ from objc import nil
from .base import Widget
+
class ContextMenuHandler(NSObject):
def initWithCallback_widget_i_(self, callback, widget, i):
self = super(ContextMenuHandler, self).init()
@@ -41,11 +42,14 @@ class ContextMenu(object):
label, callback = item_info
nsitem = NSMenuItem.alloc().init()
font_size = NSFont.systemFontSize()
- font = NSFont.fontWithName_size_("Lucida Sans Italic", font_size)
+ font = NSFont.fontWithName_size_("Lucida Sans Italic",
+ font_size)
if font is None:
font = NSFont.systemFontOfSize_(font_size)
attributes = {NSFontAttributeName: font}
- attributed_label = NSAttributedString.alloc().initWithString_attributes_(label, attributes)
+ attributed_label = \
+ NSAttributedString.alloc().initWithString_attributes_(
+ label, attributes)
nsitem.setAttributedTitle_(attributed_label)
else:
nsitem.setTitle_(label)
@@ -53,7 +57,9 @@ class ContextMenu(object):
submenu = ContextMenu(callback)
self.menu.setSubmenu_forItem_(submenu.menu, nsitem)
else:
- handler = ContextMenuHandler.alloc().initWithCallback_widget_i_(callback, self, i)
+ handler = \
+ ContextMenuHandler.alloc().initWithCallback_widget_i_(
+ callback, self, i)
nsitem.setTarget_(handler)
nsitem.setAction_('handleMenuItem:')
self.menu.addItem_(nsitem)
@@ -81,4 +87,6 @@ class ContextMenu(object):
0,
0,
0)
- NSMenu.popUpContextMenu_withEvent_forView_(self.menu, event, window.contentView())
+ NSMenu.popUpContextMenu_withEvent_forView_(self.menu,
+ event,
+ window.contentView())