Browse Source

pygame limits 9 userevent

cuu 5 years ago
parent
commit
02b399dd01
2 changed files with 4 additions and 11 deletions
  1. 2 4
      sys.py/UI/constants.py
  2. 2 7
      sys.py/run.py

+ 2 - 4
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

+ 2 - 7
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)