Browse Source

add launcher and os version in About

cuu 5 years ago
parent
commit
055ee12867
1 changed files with 33 additions and 3 deletions
  1. 33 3
      Menu/GameShell/10_Settings/About/__init__.py

+ 33 - 3
Menu/GameShell/10_Settings/About/__init__.py

@@ -12,7 +12,7 @@ from libs.roundrects import aa_round_rect
 from UI.constants import Width,Height,ICON_TYPES
 from UI.page   import Page,PageSelector
 from UI.label  import Label
-from UI.util_funcs import midRect
+from UI.util_funcs import midRect,FileExists
 from UI.keys_def   import CurKeys, IsKeyMenuOrB
 from UI.scroller   import ListScroller
 from UI.icon_pool  import MyIconPool
@@ -21,6 +21,8 @@ from UI.multilabel import MultiLabel
 from UI.lang_manager import MyLangManager
 from UI.skin_manager import MySkinManager
 
+from config import VERSION
+
 class InfoPageListItem(object):
     _PosX = 0
     _PosY = 0
@@ -206,7 +208,32 @@ class AboutPage(Page):
                     memory["value"] = str( int(parts[1].strip())/1000.0) +" MB"
                     self._AList["memory"] = memory                    
                     break
-        
+                    
+    def LauncherVersion(self):
+        launcher_version = {}
+        launcher_version["key"] = "launcher_ver"
+        launcher_version["label"] = "Launcher:"
+        launcher_version["value"] = VERSION
+        self._AList["launcher_ver"] = launcher_version
+    
+    def OsImageVersion(self):
+        if FileExists("/etc/clockworkpi_os_image_version"):
+            try:
+                with open("/etc/clockworkpi_os_image_version") as f:
+                    content = f.readlines()
+                content = [x.strip() for x in content]
+            
+            except:
+                print("open %s failed" % "/etc/clockworkpi_os_image_version")
+                content = None
+            
+            if content != None and len(content) > 0:
+                os_image_ver = {}
+                os_image_ver["key"] = "os_image_ver"
+                os_image_ver["label"] = "OS Image:"
+                os_image_ver["value"] = content[0][:12]
+                self._AList["os_image_ver"] = os_image_ver
+    
     def GenList(self):
         
         self._MyList = []
@@ -215,7 +242,7 @@ class AboutPage(Page):
         start_y  = 10
         last_height = 0
 
-        for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname"] ):
+        for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname","launcher_ver","os_image_ver"] ):
         #for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
             if u not in self._AList:
                 continue
@@ -266,6 +293,9 @@ class AboutPage(Page):
         self.CpuMhz()
         self.Uname()
         
+        self.LauncherVersion()
+        self.OsImageVersion()
+        
         self.GenList()
 
         self._Scroller = ListScroller()