From 02b399dd01faf9d184888b4439f52c276c5b9852 Mon Sep 17 00:00:00 2001 From: cuu Date: Mon, 28 Jan 2019 23:40:35 +0800 Subject: [PATCH] pygame limits 9 userevent --- sys.py/UI/constants.py | 6 ++---- sys.py/run.py | 9 ++------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/sys.py/UI/constants.py b/sys.py/UI/constants.py index a9b1c1e..fe17632 100644 --- a/sys.py/UI/constants.py +++ b/sys.py/UI/constants.py @@ -34,13 +34,11 @@ ALIGN = {"HLeft":0,"HCenter":1,"HRight":2,"VMiddle":3,"SLeft":4,"VCenter":5,"SCe DT = pygame.time.Clock().tick(30) # fps in ms,eg:50 -GMEVT = pygame.USEREVENT+1 -update_titlebar_event = pygame.event.Event(GMEVT, message="titlebar") - +RUNSH = pygame.USEREVENT+1 +#update_titlebar_event = pygame.event.Event(GMEVT, message="titlebar") RUNEVT = pygame.USEREVENT+2 RUNSYS = pygame.USEREVENT+3 LOWLIGHT = pygame.USEREVENT+4 ## when dim screen backlight FOOTMSG = pygame.USEREVENT+5 ## POWEROPT = pygame.USEREVENT+6 RESTARTUI = pygame.USEREVENT+7 ##restart launcher -RUNSH = pygame.USEREVENT+8 diff --git a/sys.py/run.py b/sys.py/run.py index f0c13b1..f2143a8 100644 --- a/sys.py/run.py +++ b/sys.py/run.py @@ -31,7 +31,7 @@ else: #local UI import -from UI.constants import Width,Height,bg_color,icon_width,icon_height,DT,GMEVT,RUNEVT,RUNSYS,ICON_TYPES,POWEROPT,RESTARTUI,RUNSH +from UI.constants import Width,Height,bg_color,icon_width,icon_height,DT,RUNEVT,RUNSYS,ICON_TYPES,POWEROPT,RESTARTUI,RUNSH from UI.util_funcs import ReplaceSuffix,FileExists, ReadTheFileContent,midRect,color_surface,SwapAndShow,GetExePath,X_center_mouse from UI.page import PageStack,PageSelector,Page from UI.label import Label @@ -299,11 +299,6 @@ def event_process(event,main_screen): return if event.type == pygame.QUIT: exit() - if event.type == GMEVT: - main_screen.Draw() - main_screen.SwapAndShow() - pygame.event.clear(GMEVT) - return if event.type == RUNEVT: if config.DontLeave==True: os.chdir(GetExePath()) @@ -575,7 +570,7 @@ if __name__ == '__main__': screen = pygame.display.set_mode(SCREEN_SIZE, 0, 32) pygame.event.set_allowed(None) - pygame.event.set_allowed([pygame.KEYDOWN,pygame.KEYUP,GMEVT,RUNEVT,RUNSYS,POWEROPT,RESTARTUI,RUNSH]) + pygame.event.set_allowed([pygame.KEYDOWN,pygame.KEYUP,RUNEVT,RUNSYS,POWEROPT,RESTARTUI,RUNSH]) pygame.key.set_repeat(DT+DT*6+DT/2, DT+DT*3+DT/2)