From 5bcc26dab7103ab0a128c02d11e95f6aa16817cd Mon Sep 17 00:00:00 2001 From: cuu Date: Tue, 29 May 2018 05:53:19 +0800 Subject: [PATCH] add uname info --- Menu/GameShell/10_Settings/About/__init__.py | 19 +++++++++++++++++-- sys.py/UI/Emulator/fav_list_page.py | 9 ++++----- sys.py/UI/Emulator/rom_list_page.py | 8 +++----- sys.py/UI/main_screen.py | 15 +++++++++++---- sys.py/UI/multilabel.py | 3 +-- 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/Menu/GameShell/10_Settings/About/__init__.py b/Menu/GameShell/10_Settings/About/__init__.py index 08212bf..8a77a0a 100644 --- a/Menu/GameShell/10_Settings/About/__init__.py +++ b/Menu/GameShell/10_Settings/About/__init__.py @@ -2,6 +2,7 @@ import pygame #import math +import subprocess #from beeprint import pp from libs.roundrects import aa_round_rect @@ -94,6 +95,19 @@ class AboutPage(Page): Page.__init__(self) self._Icons = {} + def Uname(self): + + out = {} + out["key"]="uname" + out["label"]= "Kernel:" + st = subprocess.check_output(["uname","-srmpo"]) + st = st.strip("\n") + st = st.strip("\t") + out["value"] = st + self._AList["uname"] = out + + return + def CpuMhz(self): try: @@ -202,8 +216,8 @@ class AboutPage(Page): start_y = 10 last_height = 0 - for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory"] ): - #for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory"] ): + for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname"] ): + #for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ): if u not in self._AList: continue @@ -251,6 +265,7 @@ class AboutPage(Page): self.CpuInfo() self.MemInfo() self.CpuMhz() + self.Uname() self.GenList() diff --git a/sys.py/UI/Emulator/fav_list_page.py b/sys.py/UI/Emulator/fav_list_page.py index 09890c6..3729eba 100644 --- a/sys.py/UI/Emulator/fav_list_page.py +++ b/sys.py/UI/Emulator/fav_list_page.py @@ -118,7 +118,6 @@ class FavListPage(Page): files_path = glob.glob(path+"/*") - print(files_path) ret = [] for i ,v in enumerate(files_path): @@ -144,8 +143,8 @@ class FavListPage(Page): dirmap["file"] = v ret.append(dirmap) - else: - print("not file or dir") +# else: +# print("not file or dir") return ret @@ -157,8 +156,8 @@ class FavListPage(Page): if alist == False: print("listfiles return false") return - print("fav list alist: ") - print(alist) +# print("fav list alist: ") +# print(alist) self._MyList = [] start_x = 0 diff --git a/sys.py/UI/Emulator/rom_list_page.py b/sys.py/UI/Emulator/rom_list_page.py index d27412a..7077efc 100644 --- a/sys.py/UI/Emulator/rom_list_page.py +++ b/sys.py/UI/Emulator/rom_list_page.py @@ -152,8 +152,8 @@ class RomListPage(Page): if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]: dirmap["file"] = v ret.append(dirmap) - else: - print("not file or dir") +# else: +# print("not file or dir") return ret @@ -165,9 +165,7 @@ class RomListPage(Page): if alist == False: print("listfiles return false") return - print("rom list alist: ") - print(alist) - + self._MyList = [] start_x = 0 start_y = 0 diff --git a/sys.py/UI/main_screen.py b/sys.py/UI/main_screen.py index cea7074..66ae691 100644 --- a/sys.py/UI/main_screen.py +++ b/sys.py/UI/main_screen.py @@ -46,7 +46,8 @@ class MessageBox(Label): self._Text = text def Draw(self): - + self._Width = 0 + self._Height = 0 self._CanvasHWND.fill( (255,255,255)) words = self._Text.split(' ') @@ -55,7 +56,7 @@ class MessageBox(Label): x ,y = (0,0) row_total_width = 0 lines = 0 - + for word in words: word_surface = self._FontObj.render(word, True, self._Color) word_width = word_surface.get_width() @@ -71,7 +72,12 @@ class MessageBox(Label): lines += word_height self._CanvasHWND.blit(word_surface, (x, y)) - x += word_width + space + + if len(words) == 1: # single line + x += word_width + else: + x += word_width + space + if x > self._Width: self._Width = x @@ -83,13 +89,14 @@ class MessageBox(Label): padding = 5 x = (self._Parent._Width - self._Width)/2 y = (self._Parent._Height - self._Height)/2 -# print("x %d y %d w %d h %d" %(x,y,self._Width,self._Height )) + # print("x %d y %d w %d h %d" %(x,y,self._Width,self._Height )) pygame.draw.rect(self._HWND,(255,255,255),(x-padding,y-padding, self._Width+padding*2,self._Height+padding*2)) if self._HWND != None: rect = midRect(self._Parent._Width/2,self._Parent._Height/2,self._Width,self._Height,Width,Height) self._HWND.blit(self._CanvasHWND,rect,(0,0,self._Width,self._Height)) + #self._HWND.blit(self._CanvasHWND,rect) pygame.draw.rect(self._HWND,(0,0,0),(x-padding,y-padding, self._Width+padding*2,self._Height+padding*2),1) diff --git a/sys.py/UI/multilabel.py b/sys.py/UI/multilabel.py index e63f927..2d19362 100644 --- a/sys.py/UI/multilabel.py +++ b/sys.py/UI/multilabel.py @@ -56,7 +56,6 @@ class MultiLabel: ##Multi Line Label lines = 0 for i,line in enumerate(words[:4]): for word in line[:12]: - #print(word) word_surface = font.render(word, True, color) word_width = word_surface.get_width() word_height = word_surface.get_height() @@ -64,7 +63,7 @@ class MultiLabel: ##Multi Line Label if row_total_width+space >= max_width: x = pos[0] # Reset the x. y += word_height # Start on new row. - row_total_width = 0 + row_total_width = word_width if lines == 0: lines += word_height