mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
commit
bf97f79a04
@ -14,7 +14,7 @@ from UI.icon_item import IconItem
|
|||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
from UI.fonts import fonts
|
||||||
from UI.util_funcs import midRect,CmdClean
|
from UI.util_funcs import midRect,CmdClean,get_git_revision_short_hash
|
||||||
from UI.keys_def import CurKeys
|
from UI.keys_def import CurKeys
|
||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
from UI.download import Download
|
from UI.download import Download
|
||||||
@ -110,7 +110,7 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if event.key == CurKeys["B"]:
|
||||||
if self._GIT == True:
|
if self._GIT == True:
|
||||||
cmdpath = "cd /home/cpi/apps/launcher ;git pull "
|
cmdpath = "cd /home/cpi/apps/launcher ;git pull; git reset --hard %s " % self._Version
|
||||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||||
self._GIT = False
|
self._GIT = False
|
||||||
return
|
return
|
||||||
@ -282,20 +282,31 @@ class UpdatePage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
elif "gitversion" in json_: ### just use git to run update
|
elif "gitversion" in json_: ### just use git to run update
|
||||||
if confirm.VERSION != json_["gitversion"]:
|
cur_dir = os.getcwd()
|
||||||
|
os.chdir("/home/cpi/apps/launcher")
|
||||||
|
current_git_version = get_git_revision_short_hash()
|
||||||
|
os.chdir(cur_dir)
|
||||||
|
if current_git_version != json_["gitversion"]:
|
||||||
self._ConfirmPage._URL = None
|
self._ConfirmPage._URL = None
|
||||||
self._ConfirmPage._MD5 = None
|
self._ConfirmPage._MD5 = None
|
||||||
self._ConfirmPage._GIT = True
|
self._ConfirmPage._GIT = True
|
||||||
|
self._ConfirmPage._Version = json_["gitversion"]
|
||||||
|
|
||||||
self._Screen.PushPage(self._ConfirmPage)
|
self._Screen.PushPage(self._ConfirmPage)
|
||||||
|
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._ConfirmPage.SnapMsg("Update to %s ?" % json_["gitversion"] )
|
self._ConfirmPage.SnapMsg("Update to %s ?" % json_["gitversion"] )
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
else:
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen._MsgBox.SetText("Out of update")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
pygame.time.delay(600)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except:
|
except Exception, e:
|
||||||
print("r.json error")
|
print("r.json() error %s" % str(e))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(" requests get error %d ", r.status_code)
|
print(" requests get error %d ", r.status_code)
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
#from libs import easing
|
#from libs import easing
|
||||||
#from datetime import datetime
|
#from datetime import datetime
|
||||||
@ -11,6 +12,14 @@ import os
|
|||||||
import string
|
import string
|
||||||
from Xlib import X,display
|
from Xlib import X,display
|
||||||
|
|
||||||
|
|
||||||
|
def get_git_revision_hash():
|
||||||
|
return subprocess.check_output(['git', 'rev-parse', 'HEAD'])
|
||||||
|
|
||||||
|
def get_git_revision_short_hash():
|
||||||
|
return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
|
||||||
|
|
||||||
|
|
||||||
def X_center_mouse():
|
def X_center_mouse():
|
||||||
d = display.Display()
|
d = display.Display()
|
||||||
s = d.screen()
|
s = d.screen()
|
||||||
|
|||||||
@ -10,7 +10,6 @@ Battery = "/sys/class/power_supply/axp20x-battery/uevent"
|
|||||||
|
|
||||||
MPD_socket = "/tmp/mpd.socket"
|
MPD_socket = "/tmp/mpd.socket"
|
||||||
|
|
||||||
UPDATE_URL="http://192.168.31.236:81/version.php"
|
UPDATE_URL="https://raw.githubusercontent.com/clockworkpi/CPI/master/launcher_ver.json"
|
||||||
|
|
||||||
|
|
||||||
VERSION="1.0"
|
VERSION="1.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user