mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-13 02:08:50 +01:00
counter down bug fix
This commit is contained in:
parent
98c95c14ce
commit
7b58c79293
@ -37,14 +37,16 @@ class CounterScreen(FullScreen):
|
|||||||
if self._Number == 0:
|
if self._Number == 0:
|
||||||
self._Counting = False
|
self._Counting = False
|
||||||
print("do the real shutdown")
|
print("do the real shutdown")
|
||||||
|
|
||||||
if config.CurKeySet != "PC":
|
if config.CurKeySet != "PC":
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
cmdpath += "sudo halt -p"
|
cmdpath += "sudo halt -p"
|
||||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))\
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self._inter_counter >= 10:
|
if self._inter_counter >=2:
|
||||||
self._Number -= 1
|
self._Number -= 1
|
||||||
if self._Number < 0:
|
if self._Number < 0:
|
||||||
self._Number = 0
|
self._Number = 0
|
||||||
@ -74,7 +76,7 @@ class CounterScreen(FullScreen):
|
|||||||
self._Number = 10
|
self._Number = 10
|
||||||
self._Counting = True
|
self._Counting = True
|
||||||
|
|
||||||
# self._GobjectIntervalId = gobject.timeout_add(100,self.GObjectInterval)
|
self._GobjectIntervalId = gobject.timeout_add(500,self.GObjectInterval)
|
||||||
|
|
||||||
def StopCounter(self):
|
def StopCounter(self):
|
||||||
if self._Counting == False:
|
if self._Counting == False:
|
||||||
@ -83,11 +85,11 @@ class CounterScreen(FullScreen):
|
|||||||
self._Number = 10
|
self._Number = 10
|
||||||
commands.getstatusoutput("echo 0 > /proc/driver/led1")
|
commands.getstatusoutput("echo 0 > /proc/driver/led1")
|
||||||
|
|
||||||
"""
|
|
||||||
if self._GobjectIntervalId != -1:
|
if self._GobjectIntervalId != -1:
|
||||||
gobject.source_remove(self._GobjectIntervalId)
|
gobject.source_remove(self._GobjectIntervalId)
|
||||||
self._GobjectIntervalId = -1
|
self._GobjectIntervalId = -1
|
||||||
"""
|
|
||||||
def Init(self):
|
def Init(self):
|
||||||
self._CanvasHWND = pygame.Surface((self._Width,self._Height))
|
self._CanvasHWND = pygame.Surface((self._Width,self._Height))
|
||||||
self._TopLabel = Label()
|
self._TopLabel = Label()
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class TitleBar:
|
|||||||
self.SyncSoundVolume()
|
self.SyncSoundVolume()
|
||||||
self.UpdateWifiStrength()
|
self.UpdateWifiStrength()
|
||||||
SwapAndShow()
|
SwapAndShow()
|
||||||
print("TitleBar Gobjectroundrobin")
|
# print("TitleBar Gobjectroundrobin")
|
||||||
elif self._InLowBackLight >= 0:
|
elif self._InLowBackLight >= 0:
|
||||||
self._InLowBackLight+=1
|
self._InLowBackLight+=1
|
||||||
if self._InLowBackLight > 10:
|
if self._InLowBackLight > 10:
|
||||||
@ -122,7 +122,7 @@ class TitleBar:
|
|||||||
f = open(Battery)
|
f = open(Battery)
|
||||||
except IOError:
|
except IOError:
|
||||||
self._Icons["battery"] = self._Icons["battery_unknown"]
|
self._Icons["battery"] = self._Icons["battery_unknown"]
|
||||||
print("CheckBatteryStat open failed")
|
# print("CheckBatteryStat open failed")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
with f:
|
with f:
|
||||||
|
|||||||
@ -78,6 +78,7 @@ def gobject_loop():
|
|||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
def GobjectFlashLed1(main_screen):
|
def GobjectFlashLed1(main_screen):
|
||||||
|
global gobject_flash_led1_counter
|
||||||
gobject_flash_led1_counter+=1
|
gobject_flash_led1_counter+=1
|
||||||
|
|
||||||
if gobject_flash_led1_counter == 2:
|
if gobject_flash_led1_counter == 2:
|
||||||
@ -87,26 +88,30 @@ def GobjectFlashLed1(main_screen):
|
|||||||
elif gobject_flash_led1_counter == 7:
|
elif gobject_flash_led1_counter == 7:
|
||||||
commands.getstatusoutput("echo 1 > /proc/driver/led1")
|
commands.getstatusoutput("echo 1 > /proc/driver/led1")
|
||||||
|
|
||||||
|
if gobject_flash_led1_counter == 10:
|
||||||
|
gobject_flash_led1_counter = 0
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def RestoreLastBackLightBrightness(main_screen):
|
def RestoreLastBackLightBrightness(main_screen):
|
||||||
global last_brt,passout_time_stage
|
global last_brt,passout_time_stage,gobject_flash_led1
|
||||||
|
|
||||||
passout_time_stage = 0
|
passout_time_stage = 0
|
||||||
main_screen._TitleBar._InLowBackLight = -1
|
main_screen._TitleBar._InLowBackLight = -1
|
||||||
|
|
||||||
if last_brt == -1:
|
|
||||||
return
|
|
||||||
|
|
||||||
if gobject_flash_led1 != -1:
|
if gobject_flash_led1 != -1:
|
||||||
gobject.source_remove(GobjectFlashLed1)
|
gobject.source_remove(gobject_flash_led1)
|
||||||
gobject_flash_led1 = -1
|
gobject_flash_led1 = -1
|
||||||
|
|
||||||
main_screen._CounterScreen.StopCounter()
|
if main_screen._CounterScreen._Counting==True:
|
||||||
main_screen.Draw()
|
main_screen._CounterScreen.StopCounter()
|
||||||
main_screen.SwapAndShow()
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
return False
|
||||||
|
|
||||||
|
if last_brt == -1:
|
||||||
|
return True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open(config.BackLight,"r+")
|
f = open(config.BackLight,"r+")
|
||||||
@ -126,7 +131,9 @@ def RestoreLastBackLightBrightness(main_screen):
|
|||||||
last_brt = -1
|
last_brt = -1
|
||||||
else:
|
else:
|
||||||
f.close()
|
f.close()
|
||||||
return
|
return True
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def InspectionTeam(main_screen):
|
def InspectionTeam(main_screen):
|
||||||
global everytime_keydown,last_brt,passout_time_stage,gobject_flash_led1
|
global everytime_keydown,last_brt,passout_time_stage,gobject_flash_led1
|
||||||
@ -230,9 +237,6 @@ def event_process(event,main_screen):
|
|||||||
pygame.event.clear(GMEVT)
|
pygame.event.clear(GMEVT)
|
||||||
return
|
return
|
||||||
if event.type == RUNEVT:
|
if event.type == RUNEVT:
|
||||||
everytime_keydown = time.time()
|
|
||||||
RestoreLastBackLightBrightness(main_screen)
|
|
||||||
|
|
||||||
if config.DontLeave==True:
|
if config.DontLeave==True:
|
||||||
os.chdir(GetExePath())
|
os.chdir(GetExePath())
|
||||||
os.system( "/bin/sh -c "+event.message)
|
os.system( "/bin/sh -c "+event.message)
|
||||||
@ -255,8 +259,6 @@ def event_process(event,main_screen):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if event.type == RUNSYS:
|
if event.type == RUNSYS:
|
||||||
everytime_keydown = time.time()
|
|
||||||
RestoreLastBackLightBrightness(main_screen)
|
|
||||||
if config.DontLeave==True:
|
if config.DontLeave==True:
|
||||||
os.chdir(GetExePath())
|
os.chdir(GetExePath())
|
||||||
os.system( "/bin/sh -c "+event.message)
|
os.system( "/bin/sh -c "+event.message)
|
||||||
@ -282,7 +284,8 @@ def event_process(event,main_screen):
|
|||||||
return
|
return
|
||||||
if event.type == pygame.KEYDOWN:
|
if event.type == pygame.KEYDOWN:
|
||||||
everytime_keydown = time.time()
|
everytime_keydown = time.time()
|
||||||
RestoreLastBackLightBrightness(main_screen)
|
if RestoreLastBackLightBrightness(main_screen) == False:
|
||||||
|
return
|
||||||
###########################################################
|
###########################################################
|
||||||
if event.key == pygame.K_q:
|
if event.key == pygame.K_q:
|
||||||
on_exit_cb = getattr(main_screen,"OnExitCb",None)
|
on_exit_cb = getattr(main_screen,"OnExitCb",None)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user