Skip to content

Commit 3754ad4

Browse files
committed
Mark most methods private
1 parent f3e80bf commit 3754ad4

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/arcade_screensaver_framework/screensaver_framework.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@
77

88

99
# Event handlers that can be applied to instances of Arcade.Window and Pyglet.window.Window
10-
def on_keyboard_press(self, symbol, modifiers):
11-
close_all_windows()
10+
def _on_keyboard_press(self, symbol, modifiers):
11+
_close_all_windows()
1212

1313

14-
def on_mouse_press(self, x, y, button, modifiers):
15-
close_all_windows()
14+
def _on_mouse_press(self, x, y, button, modifiers):
15+
_close_all_windows()
1616

1717

18-
def on_mouse_motion(self, x, y, dx, dy):
18+
def _on_mouse_motion(self, x, y, dx, dy):
1919
# A Window almost always gets an initial on_mouse_motion event when window opens.
2020
# Ignore the first motion event. I think a motion event is triggered when the
2121
# window is opening and the mouse cursor is already inside the window's boundary.
2222
if self.first_mouse_motion_event:
2323
self.first_mouse_motion_event = False
2424
return
25-
close_all_windows()
25+
_close_all_windows()
2626

2727

28-
def on_close(self):
29-
close_all_windows()
28+
def _on_close(self):
29+
_close_all_windows()
3030

3131

32-
def close_all_windows():
32+
def _close_all_windows():
3333
for win in all_windows:
3434
win.close()
3535

3636

37-
def get_preferred_screen(screens):
37+
def _get_preferred_screen(screens):
3838
"""Choose the screen with the most pixels to show the screensaver on"""
3939
ordered_screens = [(s.width*s.height, idx, s) for idx, s in enumerate(screens)]
4040
ordered_screens.sort() # sort by # of pixels, then screen index, then object
@@ -43,19 +43,19 @@ def get_preferred_screen(screens):
4343

4444
def _make_windows(screensaver_window_class, is_fullscreen, win_kwargs):
4545
# Monkeypatch Arcade and Pyglet window classes (for easier code-reuse)
46-
screensaver_window_class.on_key_press = on_keyboard_press
47-
screensaver_window_class.on_mouse_press = on_mouse_press
48-
screensaver_window_class.on_mouse_motion = on_mouse_motion
49-
screensaver_window_class.on_close = on_close
46+
screensaver_window_class.on_key_press = _on_keyboard_press
47+
screensaver_window_class.on_mouse_press = _on_mouse_press
48+
screensaver_window_class.on_mouse_motion = _on_mouse_motion
49+
screensaver_window_class.on_close = _on_close
5050

51-
pyglet.window.Window.on_key_press = on_keyboard_press
52-
pyglet.window.Window.on_mouse_press = on_mouse_press
53-
pyglet.window.Window.on_mouse_motion = on_mouse_motion
54-
pyglet.window.Window.on_close = on_close
51+
pyglet.window.Window.on_key_press = _on_keyboard_press
52+
pyglet.window.Window.on_mouse_press = _on_mouse_press
53+
pyglet.window.Window.on_mouse_motion = _on_mouse_motion
54+
pyglet.window.Window.on_close = _on_close
5555

5656
display = pyglet.canvas.get_display()
5757
screens = display.get_screens()
58-
preferred_screen = get_preferred_screen(screens)
58+
preferred_screen = _get_preferred_screen(screens)
5959
main_win = None
6060
for screen in screens:
6161
if screen == preferred_screen:

0 commit comments

Comments
 (0)