Skip to content

Commit

Permalink
Merge pull request #2222 from HalfWhitt/correct-menu-command-arg-name
Browse files Browse the repository at this point in the history
Fixed argument name for Command handlers
  • Loading branch information
freakboy3742 authored Nov 12, 2023
2 parents d6c5b03 + 111ab60 commit cb2a27a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions changes/2222.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Corrected "command" argument name in command handler definitions.
12 changes: 6 additions & 6 deletions cocoa/src/toga_cocoa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,26 +298,26 @@ def _create_app_commands(self):
),
)

def _menu_about(self, app, **kwargs):
def _menu_about(self, command, **kwargs):
self.interface.about()

def _menu_quit(self, app, **kwargs):
def _menu_quit(self, command, **kwargs):
self.interface.on_exit()

def _menu_close_window(self, app, **kwargs):
def _menu_close_window(self, command, **kwargs):
if self.interface.current_window:
self.interface.current_window._impl.native.performClose(None)

def _menu_close_all_windows(self, app, **kwargs):
def _menu_close_all_windows(self, command, **kwargs):
# Convert to a list to so that we're not altering a set while iterating
for window in list(self.interface.windows):
window._impl.native.performClose(None)

def _menu_minimize(self, app, **kwargs):
def _menu_minimize(self, command, **kwargs):
if self.interface.current_window:
self.interface.current_window._impl.native.miniaturize(None)

def _menu_visit_homepage(self, app, **kwargs):
def _menu_visit_homepage(self, command, **kwargs):
self.interface.visit_homepage()

def create_menus(self):
Expand Down
4 changes: 2 additions & 2 deletions gtk/src/toga_gtk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def _create_app_commands(self):
def gtk_activate(self, data=None):
pass

def _menu_about(self, app, **kwargs):
def _menu_about(self, command, **kwargs):
self.interface.about()

def _menu_quit(self, app, **kwargs):
def _menu_quit(self, command, **kwargs):
self.interface.on_exit()

def create_menus(self):
Expand Down
2 changes: 1 addition & 1 deletion web/src/toga_web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def create_menus(self):
else:
self.native.append(self.menubar)

def _menu_about(self, widget, **kwargs):
def _menu_about(self, command, **kwargs):
self.interface.about()

def main_loop(self):
Expand Down

0 comments on commit cb2a27a

Please sign in to comment.