This commit is contained in:
cuu 2019-06-13 16:17:51 +08:00
parent 5aa744cb6b
commit baae2545f1
3 changed files with 17 additions and 2 deletions

View File

@ -34,6 +34,19 @@ class IconPool(object):
if keyname in self._Sizes:
return self._Sizes[keyname][1]
def GiveIconSurface(self,imgname): ## imgname is the png file name without .png
if imgname in self._Icons:
return self._Icons[imgname]
else:
icon_file = MySkinManager.GiveIcon("gameshell/icons/"+imgname+".png")
if os.path.isfile(icon_file):
keyname = imgname
self._Icons[keyname] = pygame.image.load(icon_file).convert_alpha()
self._Sizes[keyname] = self._Icons[keyname].get_size()
return self._Icons[keyname]
return None # this will cause panic,if not found both in theme and default skin folder
##global Handler
MyIconPool = None

View File

@ -117,7 +117,7 @@ class SkinManager(object):
else:
return pygame.Color(255,0,0)
def GiveIcon(self,orig_file_or_dir):
def GiveIcon(self,orig_file_or_dir): ## return is string,not Surface
#doing a wrapper for items under /home/cpi/apps/Menu/*, to be like Menu/GameShell/*
if orig_file_or_dir.startswith("/home/cpi/apps/Menu"):
orig_file_or_dir = orig_file_or_dir.replace("/home/cpi/apps/Menu/","../Menu/GameShell/")

View File

@ -377,6 +377,7 @@ def event_process(event,main_screen):
os.chdir(GetExePath())
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
print(exec_app_cmd)
release_self_fds()
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
os.chdir( GetExePath())
os.exelp("python","python"," "+myscriptname)
@ -385,6 +386,7 @@ def event_process(event,main_screen):
pygame.quit()
gobject_main_loop.quit()
exec_app_cmd = event.message +";"
release_self_fds()
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
sys.exit(-1)
return