pygame limits 9 userevent

This commit is contained in:
cuu 2019-01-28 23:40:35 +08:00
parent 10305da9e8
commit 02b399dd01
2 changed files with 4 additions and 11 deletions

View File

@ -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

View File

@ -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)