mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-12 17:58:50 +01:00
ReunionPagesIcons
This commit is contained in:
parent
77215d4172
commit
d3148d1379
@ -6,6 +6,8 @@ from sys import exit
|
||||
import os
|
||||
import sys
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
from libs import easing
|
||||
from datetime import datetime
|
||||
|
||||
@ -388,7 +390,29 @@ class MainScreen(object):
|
||||
if i.endswith(python_package_flag):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def ReunionPagesIcons(self): #This is for combining /home/cpi/apps/Menu and ~/launcher/Menu/GameShell
|
||||
for p in self._Pages:
|
||||
tmp = []
|
||||
for i,x in enumerate(p._Icons):
|
||||
tup = ('',0)
|
||||
if hasattr(x, '_FileName'):
|
||||
if str.find(x._FileName,"_") < 0:
|
||||
tup = ("98_"+x._FileName,i) # prefer to maintain PowerOFF in last position if the filename has no order labels
|
||||
else:
|
||||
tup = (x._FileName, i)
|
||||
else:
|
||||
tup = ("",i)
|
||||
|
||||
tmp.append(tup)
|
||||
tmp = sorted(tmp, key=itemgetter(0))
|
||||
#print(tmp)
|
||||
new_icons = []
|
||||
for x in tmp:
|
||||
new_icons.append( p._Icons[ x[1] ] )
|
||||
p._Icons = new_icons
|
||||
|
||||
|
||||
def ReadTheDirIntoPages(self,_dir,pglevel,cur_page):
|
||||
|
||||
if FileExists(_dir) == False and os.path.isdir(_dir) == False:
|
||||
@ -406,6 +430,7 @@ class MainScreen(object):
|
||||
else: ## On CurPage now
|
||||
i2 = self.ExtraName(i)
|
||||
iconitem = IconItem()
|
||||
iconitem._FileName = i
|
||||
iconitem._CmdPath = ""
|
||||
iconitem.AddLabel(i2,self._IconFont)
|
||||
if FileExists( _dir+"/"+i+"/"+i2+".png"): ### 20_Prog/Prog.png , cut 20_
|
||||
@ -495,6 +520,7 @@ class MainScreen(object):
|
||||
|
||||
#cmd = ReadTheFileContent(_dir+"/"+i)
|
||||
iconitem = IconItem()
|
||||
iconitem._FileName = i
|
||||
iconitem._CmdPath = os.path.realpath(_dir+"/"+i)
|
||||
MakeExecutable(iconitem._CmdPath)
|
||||
iconitem._MyType = ICON_TYPES["EXE"]
|
||||
|
||||
@ -465,7 +465,11 @@ def big_loop():
|
||||
main_screen._TitleBar = title_bar
|
||||
main_screen._FootBar = foot_bar
|
||||
main_screen.Init()
|
||||
|
||||
main_screen.ReadTheDirIntoPages("../Menu",0,None)
|
||||
main_screen.ReadTheDirIntoPages("/home/cpi/apps/Menu",1,main_screen._Pages[ len(main_screen._Pages) -1])
|
||||
main_screen.ReunionPagesIcons()
|
||||
|
||||
main_screen.FartherPages()
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user