Skip to content

Commit 1b9ea90

Browse files
committed
https://github.com/hasii2011/albow-python-3/issues/38
1 parent 36a740c commit 1b9ea90

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

albow/core/ui/AlbowEventLoop.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030

3131
class AlbowEventLoop:
3232

33+
MUSIC_END_EVENT = USEREVENT + 1
34+
"""
35+
API consumer user events **MUST** start there events after this one
36+
"""
37+
38+
DOUBLE_CLICK_TIME = 300
39+
"""
40+
Time is in milliseconds
41+
"""
42+
3343
def __init__(self, containingWidget: Widget, modalWidget: Widget):
3444

3545
self.logger = logging.getLogger(__name__)
@@ -58,7 +68,7 @@ def processEvents(self, eventList: List[Event], relativeMode: bool, deferDrawing
5868
elif eventType == MOUSEBUTTONDOWN:
5969
# print "RootWidget: MOUSEBUTTONDOWN: setting do_draw" ###
6070
do_draw = True
61-
if t - last_click_time <= RootWidget.DOUBLE_CLICK_TIME:
71+
if t - last_click_time <= AlbowEventLoop.DOUBLE_CLICK_TIME:
6272
num_clicks += 1
6373
else:
6474
num_clicks = 1
@@ -155,7 +165,7 @@ def processEvents(self, eventList: List[Event], relativeMode: bool, deferDrawing
155165
event.dict['pos'] = RootWidget.last_mouse_event.pos
156166
event.dict['local'] = RootWidget.last_mouse_event.local
157167
RootWidget.last_mouse_event_handler.setup_cursor(event)
158-
elif eventType == RootWidget.MUSIC_END_EVENT:
168+
elif eventType == AlbowEventLoop.MUSIC_END_EVENT:
159169
self.music_end()
160170
elif eventType == USEREVENT:
161171
if deferDrawing and not use_sleep:

albow/core/ui/RootWidget.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636

3737
class RootWidget(Widget):
3838

39-
DOUBLE_CLICK_TIME = 300
40-
"""
41-
Time is in milliseconds
42-
"""
4339

4440
"""
4541
For the GUI to function, there must be exactly one instance of RootWidget. It implements the main event loop
@@ -48,11 +44,6 @@ class RootWidget(Widget):
4844
The root widget can be found using the `RootWidget.get_root()`
4945
5046
"""
51-
MUSIC_END_EVENT = USEREVENT + 1
52-
"""
53-
API consumer user events **MUST** start there events after this one
54-
"""
55-
5647
root_widget = None
5748
"""
5849
Root of the containment hierarchy
@@ -66,12 +57,12 @@ class RootWidget(Widget):
6657
Target of mouse_drag and mouse_up events
6758
"""
6859

69-
redraw_every_frame = False
70-
"""
71-
If true, all widgets will be redrawn on every animation frame (i.e. after every call to begin_frame()). If false,
72-
redrawing only occurs after user input events, such as mouse clicks and keystrokes, or if a widget calls
73-
its invalidate() method. The default is false.
74-
"""
60+
# redraw_every_frame = False
61+
# """
62+
# If true, all widgets will be redrawn on every animation frame (i.e. after every call to begin_frame()). If false,
63+
# redrawing only occurs after user input events, such as mouse clicks and keystrokes, or if a widget calls
64+
# its invalidate() method. The default is false.
65+
# """
7566
last_mouse_event_handler = None
7667

7768
ourTimerEvent = None

0 commit comments

Comments
 (0)