Skip to content

Commit

Permalink
Added standard menu items to WinForms backend
Browse files Browse the repository at this point in the history
Signed-off-by: obulat <obulat@gmail.com>
  • Loading branch information
obulat authored and freakboy3742 committed Apr 7, 2018
1 parent 673ae5e commit 358788d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/winforms/toga_winforms/app.py
@@ -1,5 +1,7 @@
from .libs import Threading, WinForms
from .window import Window
import toga
import sys


class MainWindow(Window):
Expand All @@ -17,8 +19,16 @@ def __init__(self, interface):
def create(self):
self.native = WinForms.Application

# Set the menu for the app.
# self.native.setMainMenu_(self.menu)
self.interface.commands.add(
toga.Command(None, 'About ' + self.interface.name, group=toga.Group.HELP),

toga.Command(None, 'Preferences', group=toga.Group.FILE),
# Quit should always be the last item, in a section on it's own
toga.Command(lambda s: self.exit(), 'Exit ' + self.interface.name, shortcut='q', group=toga.Group.FILE,
section=sys.maxsize),

toga.Command(None, 'Visit homepage', group=toga.Group.HELP)
)

# Call user code to populate the main window
self.interface.startup()
Expand Down

0 comments on commit 358788d

Please sign in to comment.