mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
IconPool
This commit is contained in:
parent
5aa744cb6b
commit
baae2545f1
@ -33,7 +33,20 @@ class IconPool(object):
|
|||||||
def Height(self,keyname):
|
def Height(self,keyname):
|
||||||
if keyname in self._Sizes:
|
if keyname in self._Sizes:
|
||||||
return self._Sizes[keyname][1]
|
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
|
##global Handler
|
||||||
MyIconPool = None
|
MyIconPool = None
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,7 @@ class SkinManager(object):
|
|||||||
else:
|
else:
|
||||||
return pygame.Color(255,0,0)
|
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/*
|
#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"):
|
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/")
|
orig_file_or_dir = orig_file_or_dir.replace("/home/cpi/apps/Menu/","../Menu/GameShell/")
|
||||||
|
|||||||
@ -377,6 +377,7 @@ def event_process(event,main_screen):
|
|||||||
os.chdir(GetExePath())
|
os.chdir(GetExePath())
|
||||||
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
|
exec_app_cmd = " sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||||
print(exec_app_cmd)
|
print(exec_app_cmd)
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
os.chdir( GetExePath())
|
os.chdir( GetExePath())
|
||||||
os.exelp("python","python"," "+myscriptname)
|
os.exelp("python","python"," "+myscriptname)
|
||||||
@ -385,6 +386,7 @@ def event_process(event,main_screen):
|
|||||||
pygame.quit()
|
pygame.quit()
|
||||||
gobject_main_loop.quit()
|
gobject_main_loop.quit()
|
||||||
exec_app_cmd = event.message +";"
|
exec_app_cmd = event.message +";"
|
||||||
|
release_self_fds()
|
||||||
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
os.execlp("/bin/sh","/bin/sh","-c", exec_app_cmd)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user