Skip to content

Commit

Permalink
Corrected Cocoa API, and simplified screen API implementations.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed May 13, 2023
1 parent 12204f5 commit ad9b8cd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
3 changes: 1 addition & 2 deletions cocoa/src/toga_cocoa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ def main_loop(self):
self.loop.run_forever(lifecycle=CocoaLifecycle(self.native))

def get_screens(self):
for screen in NSScreen.screens:
yield ScreenImpl(native=screen)
return [ScreenImpl(native=screen) for screen in NSScreen.screens]

def set_main_window(self, window):
pass
Expand Down
2 changes: 1 addition & 1 deletion cocoa/src/toga_cocoa/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,4 @@ def get_current_screen(self):
return screen._impl

def set_current_screen(self, app_screen):
self.native.setFrameOrigin(app_screen._impl.native.visibleFrame().origin)
self.native.setFrameOrigin(app_screen._impl.native.visibleFrame.origin)
5 changes: 1 addition & 4 deletions core/src/toga/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,7 @@ def _create_impl(self):

@property
def screens(self):
screens = []
for screen in self._impl.get_screens():
screens.append(screen.interface)
return screens
return [screen.interface for screen in self._impl.get_screens()]

@property
def paths(self):
Expand Down
3 changes: 1 addition & 2 deletions gtk/src/toga_gtk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ def main_loop(self):
def get_screens(self):
display = Gdk.Display.get_default()
n_monitors = display.get_n_monitors()
for i in range(n_monitors):
yield ScreenImpl(native=display.get_monitor(i))
return [ScreenImpl(native=display.get_monitor(i)) for i in range(n_monitors)]

def set_main_window(self, window):
pass
Expand Down
3 changes: 1 addition & 2 deletions winforms/src/toga_winforms/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ def exit(self):
self.native.Exit()

def get_screens(self):
for screen in WinForms.Screen.AllScreens:
yield ScreenImpl(native=screen)
return [ScreenImpl(native=screen) for screen in WinForms.Screen.AllScreens]

def set_main_window(self, window):
self.app_context.MainForm = window._impl.native
Expand Down

0 comments on commit ad9b8cd

Please sign in to comment.