Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 37e4d655b1 | |||
| e7dc439869 | |||
| d3777d460d | |||
| 81119eba34 | |||
| 514b08e1d6 | |||
| 7b5eba3ed7 | |||
| 97e9aa76d5 | |||
| c317ba5d35 | |||
| 555cfd0c6d | |||
| 0d0964eefe | |||
| bd6a30d35f | |||
| 7f5b30d5b3 | |||
| 175ce6744a | |||
| dce2cfa43f | |||
| 2f92f62dae | |||
| ca72939743 | |||
| 33de507580 | |||
| 544aafa959 | |||
| 039e362b6d | |||
| 07e707a983 | |||
| 9039646303 | |||
| 84e21b9f38 | |||
| f9a6a74359 | |||
| f2e5858bd0 | |||
| 07e7e2a5dc | |||
| 0b7f83dc62 | |||
| 47570323d8 | |||
| e6d2b43c25 | |||
| 6966fba1b4 | |||
| cdd7caebff | |||
| d09af8a674 | |||
| 9c3286ad03 | |||
| c0d314f9ef | |||
| dac49f9df9 | |||
| d528510bca | |||
| d8be9845e4 | |||
| b0c11b5cc7 | |||
| 90d7a545d6 | |||
| 2276f9c1b2 | |||
| 5cd64c1b83 | |||
| fa5e474d3b | |||
| 1c3d598ffa | |||
| d1238a3176 | |||
| c19e8bee59 |
@@ -5,3 +5,6 @@ retroarch-core-options.cfg
|
||||
*.pyc
|
||||
sys.py/.powerlevel
|
||||
sys.py/.buttonslayout
|
||||
*.cfg
|
||||
**/Jobs/*
|
||||
!**/Jobs/.gitkeep
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import pygame
|
||||
#import math
|
||||
#mport subprocess
|
||||
@@ -19,11 +19,12 @@ from UI.scroller import ListScroller
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.icon_item import IconItem
|
||||
from UI.multilabel import MultiLabel
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
import config
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -102,7 +103,7 @@ class PageListItem(object):
|
||||
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
|
||||
self._Labels["Small"].Draw()
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
class InfoPage(Page):
|
||||
@@ -443,6 +444,11 @@ class PowerOptionsPage(Page):
|
||||
|
||||
config.PowerLevel = cur_li._Value
|
||||
|
||||
if config.PowerLevel!= "supersaving":
|
||||
os.system("sudo iw wlan0 set power_save off")
|
||||
else:
|
||||
os.system("sudo iw wlan0 set power_save on")
|
||||
|
||||
self._Screen._MsgBox.SetText("Applying...")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
@@ -6,6 +6,7 @@ import os
|
||||
|
||||
## local UI import
|
||||
from UI.page import Page
|
||||
from UI.skin_manager import SkinManager
|
||||
from UI.constants import ICON_TYPES,Width,Height
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
@@ -27,7 +28,7 @@ class StoragePage(Page):
|
||||
_BGmsg = "%.1fGB of %.1fGB Used"
|
||||
_DskUsg = None
|
||||
|
||||
_HighColor = pygame.Color(51,166,255)
|
||||
_HighColor = SkinManager().GiveColor('High')
|
||||
_FootMsg = ["Nav.","","","Back",""]
|
||||
|
||||
def __init__(self):
|
||||
@@ -98,7 +99,7 @@ class StoragePage(Page):
|
||||
|
||||
rect_ = midRect(self._Width/2,self._Height-30,170,17, Width,Height)
|
||||
|
||||
aa_round_rect(self._CanvasHWND,rect_, (193,193,193),5,0,(193,193,193))
|
||||
aa_round_rect(self._CanvasHWND, rect_, SkinManager().GiveColor('Line'), 5, 0, SkinManager().GiveColor('Line'))
|
||||
|
||||
|
||||
rect2 = midRect(self._Width/2,self._Height-30,int(170*(1.0-usage_percent)),17, Width,Height)
|
||||
@@ -106,7 +107,7 @@ class StoragePage(Page):
|
||||
rect2.left = rect_.left
|
||||
rect2.top = rect_.top
|
||||
|
||||
aa_round_rect(self._CanvasHWND,rect2, (126,206,244),5,0,(126,206,244))
|
||||
aa_round_rect(self._CanvasHWND,rect2, SkinManager().GiveColor('Front'),5,0,SkinManager().GiveColor('Front'))
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
# a item for List
|
||||
# - - - - - - - - - - - --
|
||||
@@ -31,7 +32,7 @@ class ListItemIcon(IconItem):
|
||||
|
||||
class ListItemLabel(Label):
|
||||
|
||||
_ActiveColor = pygame.Color(175,90,0)
|
||||
_ActiveColor = SkinManager().GiveColor('Active')
|
||||
_Active = False
|
||||
def Draw(self):
|
||||
|
||||
@@ -106,7 +107,7 @@ class ListItem(object):
|
||||
|
||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
self._Labels["Text"].Draw()
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ from UI.keys_def import CurKeys
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.scroller import ListScroller
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from list_item import ListItem
|
||||
|
||||
@@ -50,7 +51,7 @@ class TimeLibStack:
|
||||
return len(self.stack)
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -189,7 +190,7 @@ class TimezoneListPage(Page):
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel("No timezones found on system!", fonts["varela22"])
|
||||
self._BGpng.SetLableColor(pygame.Color(204,204,204))
|
||||
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from UI.keys_def import CurKeys
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.download import Download
|
||||
from UI.download_process_page import DownloadProcessPage
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
from libs.DBUS import is_wifi_connected_now
|
||||
@@ -194,7 +195,7 @@ class InfoPageListItem(object):
|
||||
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
|
||||
self._Labels["Small"].Draw()
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
class UpdatePage(Page):
|
||||
|
||||
@@ -13,6 +13,7 @@ from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
@@ -26,7 +27,7 @@ class KeyboardIcon(IconItem):
|
||||
_PosY = 0
|
||||
_Width = 0
|
||||
_Height = 0
|
||||
_Color = pygame.Color(83,83,83)
|
||||
_Color = SkinManager().GiveColor('Text')
|
||||
_MyType = ICON_TYPES["NAV"]
|
||||
_Parent = None
|
||||
_Str = ""
|
||||
@@ -304,14 +305,9 @@ class Keyboard(Page):
|
||||
self._LeftOrRight = -1
|
||||
if self._SectionIndex >= (self._SectionNumbers -1):
|
||||
self._LeftOrRight = 1
|
||||
self.KeyboardShift()
|
||||
|
||||
self._SectionIndex -= self._LeftOrRight
|
||||
self.ShiftKeyboardPage()
|
||||
|
||||
#print(self._SectionIndex) # on which keyboard section now
|
||||
self.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Menu"]: # we assume keyboard always be child page
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
@@ -329,6 +325,16 @@ class Keyboard(Page):
|
||||
self._Textarea.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["LK1"]:
|
||||
if self._SectionIndex < self._SectionNumbers -1:
|
||||
self._LeftOrRight = -1
|
||||
self.ShiftKeyboardPage()
|
||||
|
||||
if event.key == CurKeys["LK5"]:
|
||||
if self._SectionIndex > 0:
|
||||
self._LeftOrRight = 1
|
||||
self.ShiftKeyboardPage()
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
self._Ps.Draw()
|
||||
@@ -340,4 +346,9 @@ class Keyboard(Page):
|
||||
|
||||
self._Textarea.Draw()
|
||||
|
||||
def ShiftKeyboardPage(self):
|
||||
self.KeyboardShift()
|
||||
self._SectionIndex -= self._LeftOrRight
|
||||
self.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
|
||||
class NetItemMultiIcon(MultiIconItem):
|
||||
@@ -194,6 +195,6 @@ class NetItem(object):
|
||||
self._Icons["wifistatus"].NewCoord(self._Width-23,self._PosY)
|
||||
self._Icons["wifistatus"].Draw()
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from UI.constants import Width,Height,ICON_TYPES
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
class TextItem(IconItem):
|
||||
_PosX = 0
|
||||
@@ -10,7 +11,7 @@ class TextItem(IconItem):
|
||||
_Width = 0
|
||||
_Height = 0
|
||||
_Str = ""
|
||||
_Color = (83,83,83)
|
||||
_Color = SkinManager().GiveColor('Text')
|
||||
_FontObj = None
|
||||
_Bold = False
|
||||
_MyType = ICON_TYPES["LETTER"]
|
||||
|
||||
@@ -10,19 +10,23 @@ from libs.roundrects import aa_round_rect
|
||||
from UI.page import Page,PageStack,PageSelector
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
class Textarea:
|
||||
_PosX =0
|
||||
_PosY = 0
|
||||
_Width = 0
|
||||
_Height = 0
|
||||
_BackgroundColor = pygame.Color(229,229,229)
|
||||
_BackgroundColor = SkinManager().GiveColor('TitleBg')
|
||||
_CanvasHWND = None
|
||||
_MyWords = []
|
||||
_BlitWords = []
|
||||
_FontObj = None
|
||||
_LineNumber = 0
|
||||
_TextLimit = 63
|
||||
_TextFull = False
|
||||
_TextIndex = 0
|
||||
_BlitIndex = 0
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
@@ -68,32 +72,71 @@ class Textarea:
|
||||
else:
|
||||
print("is Full %s" % "".join(self._MyWords))
|
||||
|
||||
def BuildBlitText(self):
|
||||
blit_rows = [[]]
|
||||
w = 0
|
||||
xmargin = 5
|
||||
endmargin = 15
|
||||
x = self._PosX+xmargin
|
||||
linenumber = 0
|
||||
cursor_row = 0
|
||||
|
||||
for i, v in enumerate(self._MyWords):
|
||||
t = self._FontObj.render(v, True, (8, 135, 174))
|
||||
t_width = t.get_width()
|
||||
w += t_width
|
||||
del(t)
|
||||
|
||||
blit_rows[linenumber].append(v)
|
||||
|
||||
if i == self._TextIndex - 1:
|
||||
cursor_row = linenumber
|
||||
|
||||
if w + t_width >= self._Width-endmargin:
|
||||
x = self._PosX+xmargin
|
||||
w = 0
|
||||
linenumber += 1
|
||||
blit_rows.append([])
|
||||
|
||||
# only paint 2 rows
|
||||
if len(blit_rows) == 1:
|
||||
self._BlitWords = blit_rows[0]
|
||||
self._BlitIndex = self._TextIndex
|
||||
elif len(blit_rows) == 2 or cursor_row < 2:
|
||||
self._BlitWords = blit_rows[0] + blit_rows[1]
|
||||
self._BlitIndex = self._TextIndex
|
||||
else:
|
||||
self._BlitWords = blit_rows[cursor_row - 1] + blit_rows[cursor_row]
|
||||
self._BlitIndex = self._TextIndex
|
||||
for i,v in enumerate(blit_rows):
|
||||
if i == cursor_row - 1:
|
||||
break
|
||||
self._BlitIndex -= len(v)
|
||||
|
||||
def BlitText(self):
|
||||
"""
|
||||
blit every single word into surface and calc the width ,check multi line
|
||||
"""
|
||||
# build up blitwords
|
||||
self.BuildBlitText()
|
||||
|
||||
w = 0
|
||||
xmargin = 5
|
||||
endmargin = 15
|
||||
x = self._PosX+xmargin
|
||||
y = self._PosY
|
||||
linenumber = 0
|
||||
self._TextFull = False
|
||||
for i,v in enumerate(self._MyWords):
|
||||
self._TextFull = len(self._MyWords) > self._TextLimit
|
||||
for i, v in enumerate(self._BlitWords):
|
||||
t = self._FontObj.render(v,True,(8,135,174))
|
||||
w += t.get_width()
|
||||
|
||||
if w >= self._Width-endmargin and linenumber == 0:
|
||||
x = self._PosX+xmargin
|
||||
y = self._PosY+ t.get_height()
|
||||
w = 0
|
||||
linenumber +=1
|
||||
x = self._PosX+xmargin
|
||||
y = self._PosY + t.get_height() * linenumber
|
||||
w = 0
|
||||
|
||||
if w >= self._Width-endmargin*4 and linenumber > 0:
|
||||
self._TextFull = True
|
||||
self._CanvasHWND.blit(t, (x,y))
|
||||
break
|
||||
self._CanvasHWND.blit(t, (x,y))
|
||||
x += t.get_width()
|
||||
|
||||
@@ -104,7 +147,7 @@ class Textarea:
|
||||
x = self._PosX+xmargin
|
||||
y = self._PosY
|
||||
linenumber = 0
|
||||
for i,v in enumerate(self._MyWords[:self._TextIndex]):
|
||||
for i,v in enumerate(self._BlitWords[:self._BlitIndex]):
|
||||
t = self._FontObj.render(v,True,(8,135,174))
|
||||
w += t.get_width()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ from UI.util_funcs import midRect,SwapAndShow
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.scroller import ListScroller
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from net_item import NetItem
|
||||
|
||||
@@ -68,7 +69,7 @@ class InfoPageListItem(object):
|
||||
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
|
||||
self._Labels["Small"].Draw()
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
|
||||
@@ -105,7 +106,7 @@ class WifiDisconnectConfirmPage(ConfirmPage):
|
||||
self.Reset()
|
||||
|
||||
class WifiInfoPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -297,7 +298,7 @@ class WifiInfoPage(Page):
|
||||
|
||||
|
||||
class WifiListSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -333,9 +334,9 @@ class WifiListMessageBox(Label):
|
||||
x = (self._Parent._Width - w)/2
|
||||
y = (self._Parent._Height - h)/2
|
||||
padding = 10
|
||||
pygame.draw.rect(self._CanvasHWND,(255,255,255),(x-padding,y-padding, w+padding*2,h+padding*2))
|
||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('White'),(x-padding,y-padding, w+padding*2,h+padding*2))
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,(0,0,0),(x-padding,y-padding, w+padding*2,h+padding*2),1)
|
||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('Black'),(x-padding,y-padding, w+padding*2,h+padding*2),1)
|
||||
|
||||
self._CanvasHWND.blit(my_text,(x,y,w,h))
|
||||
|
||||
@@ -485,6 +486,7 @@ class WifiList(Page):
|
||||
"""
|
||||
|
||||
if wireless_connecting:
|
||||
|
||||
if not fast:
|
||||
iwconfig = self._Wireless.GetIwconfig()
|
||||
else:
|
||||
@@ -498,7 +500,6 @@ class WifiList(Page):
|
||||
|
||||
self._Screen._FootBar.UpdateNavText(self._LastStatusMsg)
|
||||
SwapAndShow()
|
||||
|
||||
#self._ConnectTry+=1
|
||||
|
||||
return True
|
||||
@@ -536,7 +537,7 @@ class WifiList(Page):
|
||||
dbus.UInt32(2L)
|
||||
['192.168.31.141', 'TP-LINK4G', '88', '0', '72.2 Mb/s']
|
||||
"""
|
||||
pp(info)
|
||||
# pp(info)
|
||||
self.UpdateNetList(state,info)
|
||||
if info != None:
|
||||
self._Screen.Draw()
|
||||
@@ -610,6 +611,7 @@ class WifiList(Page):
|
||||
self._Wireless.SetWirelessProperty(netid,"apsk",password)
|
||||
self._Wireless.SetWirelessProperty(netid,"automatic",1)
|
||||
|
||||
self.ShowBox("Connecting...")
|
||||
|
||||
self._WirelessList[netid].Connect()
|
||||
print("after Connect")
|
||||
@@ -679,9 +681,9 @@ class WifiList(Page):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if self._BlockingUI == True:
|
||||
print("UI blocking ...")
|
||||
return
|
||||
# if self._BlockingUI == True:
|
||||
# print("UI blocking ...")
|
||||
# return
|
||||
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if self._Wireless != None:
|
||||
|
||||
@@ -13,13 +13,14 @@ from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.scroller import ListScroller
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from list_item import ListItem
|
||||
|
||||
import myvars
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
ROM=/home/cpi/games/MGBA
|
||||
ROM_SO=/home/cpi/apps/emulators/mgba_libretro.so
|
||||
EXT=gba,gbx
|
||||
EXT=gb,gbc,gba,gbx
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=MGBA Roms
|
||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mgba_libretro.so.zip
|
||||
|
||||
@@ -10,6 +10,7 @@ from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
# a item for List
|
||||
# - - - - - - - - - - - --
|
||||
@@ -31,7 +32,7 @@ class ListItemIcon(IconItem):
|
||||
|
||||
class ListItemLabel(Label):
|
||||
|
||||
_ActiveColor = pygame.Color(175,90,0)
|
||||
_ActiveColor = SkinManager().GiveColor('Active')
|
||||
_Active = False
|
||||
def Draw(self):
|
||||
|
||||
@@ -116,7 +117,7 @@ class ListItem(object):
|
||||
|
||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
if self._Playing == True:
|
||||
self._Labels["Text"]._Active =True
|
||||
@@ -127,7 +128,7 @@ class ListItem(object):
|
||||
|
||||
if self._PlayingProcess > 0:
|
||||
seek_posx = int(self._Width * self._PlayingProcess/100.0)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(255,169,169),(self._PosX,self._PosY+self._Height-2),(self._PosX+seek_posx,self._PosY+self._Height-2),2)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Active'),(self._PosX,self._PosY+self._Height-2),(self._PosX+seek_posx,self._PosY+self._Height-2),2)
|
||||
|
||||
else:
|
||||
self._Labels["Text"].Draw()
|
||||
|
||||
@@ -20,6 +20,7 @@ from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from threading import Thread
|
||||
|
||||
@@ -82,7 +83,7 @@ class MPDSpectrumPage(Page):
|
||||
_SongFont = fonts["notosanscjk12"]
|
||||
_PIFI = None
|
||||
_FIFO = None
|
||||
_Color = pygame.Color(126,206,244)
|
||||
_Color = SkinManager().GiveColor('Front')
|
||||
_GobjectIntervalId = -1
|
||||
_Queue = None
|
||||
_KeepReading = True
|
||||
@@ -162,21 +163,22 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
self._song_title = Label()
|
||||
self._song_title.SetCanvasHWND(self._RollCanvas)
|
||||
self._song_title.Init("Untitled",self._SongFont,(255,255,255))
|
||||
self._song_title.Init("Untitled",self._SongFont,SkinManager().GiveColor('White'))
|
||||
|
||||
|
||||
self._title = Label()
|
||||
self._title.SetCanvasHWND(self._CanvasHWND)
|
||||
self._title.Init("Title:",self._ListFont,(255,255,255))
|
||||
self._title.Init("Title:",self._ListFont,SkinManager().GiveColor('White'))
|
||||
|
||||
self._time = Label()
|
||||
self._time.SetCanvasHWND(self._CanvasHWND)
|
||||
self._time.Init("Time:",self._ListFont,(255,255,255))
|
||||
self._time.Init("Time:",self._ListFont,SkinManager().GiveColor('White'))
|
||||
|
||||
|
||||
self._time2 = Label()
|
||||
self._time2.SetCanvasHWND(self._CanvasHWND)
|
||||
self._time2.Init("00:00-00:00",self._ListFont,(255,255,255))
|
||||
self._time2.Init("00:00-00:00", self._ListFont,
|
||||
SkinManager().GiveColor('White'))
|
||||
|
||||
|
||||
self.Start()
|
||||
@@ -227,7 +229,7 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
|
||||
def ClearCanvas(self):
|
||||
self._CanvasHWND.fill((0,0,0))
|
||||
self._CanvasHWND.fill(SkinManager().GiveColor('Black'))
|
||||
|
||||
def SgsSmooth(self):
|
||||
passes = 1
|
||||
@@ -341,7 +343,7 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
if self._RollCanvas != None:
|
||||
# self._RollCanvas.fill((111,22,33))
|
||||
self._RollCanvas.fill((0,0,0))
|
||||
self._RollCanvas.fill(SkinManager().GiveColor('Black'))
|
||||
if self._song_title._Width > self._RollW:
|
||||
if (self._song_title._PosX + self._song_title._Width) > self._RollW and self._frames % 30 == 0:
|
||||
self._song_title._PosX -= 1
|
||||
@@ -415,9 +417,9 @@ class MPDSpectrumPage(Page):
|
||||
else:
|
||||
self._capYPositionArray[i] = value
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,(255,255,255),(i*(bw+gap)+margin_left,self._Height-gap-self._capYPositionArray[i]-margin_bottom,bw,gap),0)
|
||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('White'),(i*(bw+gap)+margin_left,self._Height-gap-self._capYPositionArray[i]-margin_bottom,bw,gap),0)
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,(255,255,255),(i*(bw+gap)+margin_left,self._Height-value-gap-margin_bottom,bw,value+gap),0)
|
||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('White'),(i*(bw+gap)+margin_left,self._Height-value-gap-margin_bottom,bw,value+gap),0)
|
||||
|
||||
self._vis_values[i] -= 2
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ from UI.keys_def import CurKeys
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.scroller import ListScroller
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from list_item import ListItem
|
||||
|
||||
@@ -48,7 +49,7 @@ class MusicLibStack:
|
||||
return len(self.stack)
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -184,7 +185,7 @@ class MusicLibListPage(Page):
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel("Please upload data over Wi-Fi", fonts["varela22"])
|
||||
self._BGpng.SetLableColor(pygame.Color(204,204,204))
|
||||
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ from UI.fonts import fonts
|
||||
from UI.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from UI.scroller import ListScroller
|
||||
|
||||
@@ -22,7 +23,7 @@ from list_item import ListItem
|
||||
import myvars
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -97,7 +98,11 @@ class PlayListPage(Page):
|
||||
li._Fonts["normal"] = self._ListFont
|
||||
|
||||
if "title" in v:
|
||||
li.Init( v["title"])
|
||||
if isinstance(v["title"], (list,)):
|
||||
li.Init(" | ".join(v["title"]))
|
||||
else:
|
||||
li.Init( v["title"])
|
||||
|
||||
if "file" in v:
|
||||
li._Path = v["file"]
|
||||
|
||||
@@ -179,7 +184,7 @@ class PlayListPage(Page):
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel("my favourites", fonts["varela18"])
|
||||
self._BGpng.SetLableColor(pygame.Color(204,204,204))
|
||||
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
|
||||
@@ -10,6 +10,7 @@ from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from libs.DBUS import is_wifi_connected_now,get_wifi_ip
|
||||
|
||||
@@ -24,8 +25,8 @@ class TinyCloudPage(Page):
|
||||
|
||||
_Coords = {}
|
||||
|
||||
_URLColor = pygame.Color(51,166,255)
|
||||
_TextColor = pygame.Color(83,83,83)
|
||||
_URLColor = SkinManager().GiveColor('URL')
|
||||
_TextColor = SkinManager().GiveColor('Text')
|
||||
_Scrolled = 0
|
||||
|
||||
_PngSize = {}
|
||||
@@ -197,7 +198,7 @@ class TinyCloudPage(Page):
|
||||
self._DrawOnce = True
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(SkinManager().GiveColor('White'))
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ from UI.keys_def import CurKeys
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.scroller import ListScroller
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from rom_so_confirm_page import RomSoConfirmPage
|
||||
|
||||
@@ -51,7 +52,7 @@ class FavStack:
|
||||
return len(self.stack)
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -140,7 +141,7 @@ class FavListPage(Page):
|
||||
pieces = bname.split(".")
|
||||
if len(pieces) > 1:
|
||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
||||
dirmap["file"] = v
|
||||
dirmap["file"] = v.decode("utf8")
|
||||
ret.append(dirmap)
|
||||
|
||||
# else:
|
||||
@@ -230,7 +231,7 @@ class FavListPage(Page):
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.AddLabel("my favourites games", fonts["varela18"])
|
||||
bgpng.SetLableColor(pygame.Color(204,204,204))
|
||||
bgpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
@@ -11,6 +11,7 @@ from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
# a item for List
|
||||
# - - - - - - - - - - - --
|
||||
@@ -72,6 +73,12 @@ class ListItem(object):
|
||||
self._Path = text
|
||||
|
||||
label_text = os.path.basename(text)
|
||||
alias_file = os.path.splitext(text)[0] + ".alias"
|
||||
if os.path.isfile(alias_file):
|
||||
fp = open(alias_file, "r")
|
||||
alias = fp.read()
|
||||
fp.close()
|
||||
label_text = alias
|
||||
|
||||
if self._MyType == ICON_TYPES["DIR"]:
|
||||
l.Init(label_text,self._Fonts["normal"])
|
||||
@@ -106,6 +113,6 @@ class ListItem(object):
|
||||
self._Parent._Icons["sys"].NewCoord(self._PosX+12,self._PosY+ (self._Height - self._Parent._Icons["sys"]._Height)/2+self._Parent._Icons["sys"]._Height/2)
|
||||
self._Parent._Icons["sys"].Draw()
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import os
|
||||
import pygame
|
||||
|
||||
import glob
|
||||
import re
|
||||
import shutil
|
||||
import gobject
|
||||
import validators
|
||||
@@ -23,6 +24,7 @@ from UI.keys_def import CurKeys
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.scroller import ListScroller
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from rom_so_confirm_page import RomSoConfirmPage
|
||||
|
||||
@@ -57,7 +59,7 @@ class RomStack:
|
||||
return len(self.stack)
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -150,11 +152,18 @@ class RomListPage(Page):
|
||||
|
||||
bname = os.path.basename(v) ### filter extension
|
||||
if len(bname)> 1:
|
||||
pieces = bname.split(".")
|
||||
if len(pieces) > 1:
|
||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
||||
dirmap["file"] = v
|
||||
ret.append(dirmap)
|
||||
is_excluded = False
|
||||
for exclude_pattern in self._Emulator["EXCLUDE"]:
|
||||
if re.match(exclude_pattern, bname):
|
||||
is_excluded = True
|
||||
break
|
||||
|
||||
if not is_excluded:
|
||||
pieces = bname.split(".")
|
||||
if len(pieces) > 1:
|
||||
if pieces[ len(pieces)-1 ].lower() in self._Emulator["EXT"]:
|
||||
dirmap["file"] = v.decode("utf8")
|
||||
ret.append(dirmap)
|
||||
# else:
|
||||
# print("not file or dir")
|
||||
|
||||
@@ -256,7 +265,7 @@ class RomListPage(Page):
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.AddLabel("Please upload data over Wi-Fi", fonts["varela22"])
|
||||
bgpng.SetLableColor(pygame.Color(204,204,204))
|
||||
bgpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
@@ -17,7 +17,7 @@ from util_funcs import midRect
|
||||
from fonts import fonts
|
||||
from keys_def import CurKeys
|
||||
from label import Label
|
||||
|
||||
from skin_manager import SkinManager
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ class AboveAllPatch(object):
|
||||
_Text =""
|
||||
_FontObj=fonts["veramono20"]
|
||||
_Parent =None
|
||||
_Color = pygame.Color(83,83,83)
|
||||
_ValColor= pygame.Color(0,0,255)
|
||||
_Color = SkinManager().GiveColor('Text')
|
||||
_ValColor = SkinManager().GiveColor('URL')
|
||||
_CanvasHWND = None
|
||||
_TextSurf = None
|
||||
_Icons = {}
|
||||
@@ -130,5 +130,5 @@ class SoundPatch(AboveAllPatch):
|
||||
#w = 10,h = 40
|
||||
vol_rect = pygame.Rect(80+i*20, self._Height/2+20,10, 40)
|
||||
|
||||
aa_round_rect(self._CanvasHWND,vol_rect, self._Parent._SkinManager.GiveColor("Front"),3,0, self._Parent._SkinManager.GiveColor("Front"))
|
||||
aa_round_rect(self._CanvasHWND,vol_rect,SkinManager().GiveColor("Front"),3,0,SkinManager().GiveColor("Front"))
|
||||
|
||||
|
||||
@@ -12,11 +12,12 @@ from label import Label
|
||||
from fonts import fonts
|
||||
from util_funcs import midRect
|
||||
from keys_def import CurKeys
|
||||
from skin_manager import SkinManager
|
||||
|
||||
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -129,8 +130,8 @@ class ConfirmPage(Page):
|
||||
def DrawBG(self):
|
||||
_rect = pygame.Rect(self._BGPosX,self._BGPosY,self._BGWidth,self._BGHeight)
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,(255,255,255),_rect,0)
|
||||
pygame.draw.rect(self._CanvasHWND,(83,83,83),_rect,1)
|
||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('White'),_rect,0)
|
||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('Text'),_rect,1)
|
||||
|
||||
def Draw(self):
|
||||
#self.ClearCanvas()
|
||||
|
||||
@@ -11,10 +11,13 @@ from datetime import datetime
|
||||
import base64
|
||||
from beeprint import pp
|
||||
|
||||
#UI lib
|
||||
from skin_manager import SkinManager
|
||||
|
||||
|
||||
Width = 320
|
||||
Height = 240
|
||||
bg_color = pygame.Color(255,255,255)
|
||||
bg_color = SkinManager().GiveColor('White')
|
||||
|
||||
icon_width = 80
|
||||
icon_height = 80
|
||||
|
||||
@@ -8,6 +8,7 @@ from constants import Width,Height,RUNSYS
|
||||
from label import Label
|
||||
from fonts import fonts
|
||||
from full_screen import FullScreen
|
||||
from skin_manager import SkinManager
|
||||
|
||||
import config
|
||||
|
||||
@@ -21,8 +22,8 @@ class CounterScreen(FullScreen):
|
||||
_BottomLabel = None
|
||||
_NumberLabel = None
|
||||
|
||||
_BGColor = pygame.Color(0,0,0)
|
||||
_FGColor = pygame.Color(255,255,255)
|
||||
_BGColor = SkinManager().GiveColor('Black')
|
||||
_FGColor = SkinManager().GiveColor('White')
|
||||
|
||||
_Counting = False
|
||||
_Number = 10
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
import os
|
||||
@@ -19,25 +19,25 @@ class DeleteConfirmPage(ConfirmPage):
|
||||
_FileName = ""
|
||||
_TrashDir = ""
|
||||
_ConfirmText = "Confirm delete?"
|
||||
|
||||
|
||||
def SetTrashDir(self,d):
|
||||
self._TrashDir = d
|
||||
|
||||
|
||||
if os.path.isdir(self._TrashDir) == False:
|
||||
raise IOError("Trash not existed")
|
||||
|
||||
|
||||
def SetFileName(self,fn):
|
||||
self._FileName = fn
|
||||
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
|
||||
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
|
||||
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
try:
|
||||
os.remove(self._TrashDir+"/"+os.path.basename(self._FileName))
|
||||
@@ -50,19 +50,16 @@ class DeleteConfirmPage(ConfirmPage):
|
||||
if "already exists" in str(e):
|
||||
self._Screen._MsgBox.SetText("Already existed")
|
||||
else:
|
||||
self._Screen._MsgBox.SetText("Error ")
|
||||
|
||||
self._Screen._MsgBox.SetText("Error")
|
||||
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
else:
|
||||
#self._Screen._MsgBox.SetText("Deleteing..")
|
||||
#self._Screen._MsgBox.Draw()
|
||||
#self._Screen.SwapAndShow()
|
||||
self.SnapMsg("Deleteing....")
|
||||
else:
|
||||
self.SnapMsg("Deleting....")
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
self.Reset()
|
||||
|
||||
|
||||
pygame.time.delay(300)
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
@@ -70,4 +67,4 @@ class DeleteConfirmPage(ConfirmPage):
|
||||
|
||||
print(self._FileName)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from UI.keys_def import CurKeys
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.download import Download
|
||||
from UI.skin_manager import SkinManager
|
||||
|
||||
from libs.DBUS import is_wifi_connected_now
|
||||
|
||||
@@ -38,8 +39,8 @@ class DownloadProcessPage(Page):
|
||||
_FileNameLabel = None
|
||||
_SizeLabel = None
|
||||
|
||||
_URLColor = pygame.Color(51,166,255)
|
||||
_TextColor = pygame.Color(83,83,83)
|
||||
_URLColor = SkinManager().GiveColor('URL')
|
||||
_TextColor = SkinManager().GiveColor('Text')
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
@@ -205,12 +206,12 @@ class DownloadProcessPage(Page):
|
||||
|
||||
|
||||
rect_ = midRect(self._Width/2,self._Height/2+33,170,17, Width,Height)
|
||||
aa_round_rect(self._CanvasHWND,rect_, (238,238,238),5,0,(238,238,238))
|
||||
aa_round_rect(self._CanvasHWND,rect_,SkinManager().GiveColor('TitleBg'),5,0,SkinManager().GiveColor('TitleBg'))
|
||||
|
||||
rect2 = midRect(self._Width/2,self._Height/2+33,int(170*(percent/100.0)),17, Width,Height)
|
||||
rect2.left = rect_.left
|
||||
rect2.top = rect_.top
|
||||
aa_round_rect(self._CanvasHWND,rect2, (126,206,244),5,0,(126,206,244))
|
||||
aa_round_rect(self._CanvasHWND,rect2,SkinManager().GiveColor('Front'),5,0,SkinManager().GiveColor('Front'))
|
||||
|
||||
rect3 = midRect(self._Width/2,self._Height/2+53,self._FileNameLabel._Width, self._FileNameLabel._Height,Width,Height)
|
||||
|
||||
|
||||
@@ -10,12 +10,6 @@ import sys
|
||||
from config import CurKeySet
|
||||
|
||||
GameShell = {}
|
||||
"""
|
||||
GameShell["Up"] = pygame.K_w
|
||||
GameShell["Down"] = pygame.K_s
|
||||
GameShell["Left"] = pygame.K_a
|
||||
GameShell["Right"]= pygame.K_d
|
||||
"""
|
||||
GameShell["Up"] = pygame.K_UP
|
||||
GameShell["Down"] = pygame.K_DOWN
|
||||
GameShell["Left"] = pygame.K_LEFT
|
||||
@@ -34,6 +28,8 @@ GameShell["Space"] = pygame.K_SPACE
|
||||
GameShell["Enter"] = pygame.K_k
|
||||
GameShell["Start"] = pygame.K_RETURN
|
||||
|
||||
GameShell["LK1"] = pygame.K_h
|
||||
GameShell["LK5"] = pygame.K_l
|
||||
|
||||
PC = {}
|
||||
|
||||
@@ -52,6 +48,9 @@ PC["Enter"] = pygame.K_RETURN
|
||||
PC["Space"] = pygame.K_SPACE
|
||||
PC["Start"] = pygame.K_s
|
||||
|
||||
PC["LK1"] = pygame.K_h
|
||||
PC["LK5"] = pygame.K_l
|
||||
|
||||
if CurKeySet == "PC":
|
||||
CurKeys = PC
|
||||
else:
|
||||
|
||||
+5
-2
@@ -7,6 +7,9 @@ import pygame
|
||||
from constants import Width,Height
|
||||
from util_funcs import midRect
|
||||
|
||||
#UI lib
|
||||
from skin_manager import SkinManager
|
||||
|
||||
class Label:
|
||||
_PosX=0
|
||||
_PosY=0
|
||||
@@ -14,13 +17,13 @@ class Label:
|
||||
_Height=0
|
||||
_Text=""
|
||||
_FontObj=None
|
||||
_Color = pygame.Color(83,83,83)
|
||||
_Color = SkinManager().GiveColor('Text')
|
||||
_CanvasHWND = None
|
||||
_TextSurf = None
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def Init(self,text,font_obj,color=pygame.Color(83,83,83)):
|
||||
def Init(self, text, font_obj, color=SkinManager().GiveColor('Text')):
|
||||
self._Color = color
|
||||
self._FontObj = font_obj
|
||||
self._Text = text
|
||||
|
||||
@@ -34,7 +34,7 @@ class MessageBox(Label):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def Init(self,text,font_obj,color=pygame.Color(83,83,83)):
|
||||
def Init(self,text,font_obj,color=SkinManager().GiveColor('Text')):
|
||||
self._Color = color
|
||||
self._FontObj = font_obj
|
||||
self._Text = text
|
||||
@@ -50,7 +50,7 @@ class MessageBox(Label):
|
||||
def PreDraw(self):
|
||||
self._Width = 0
|
||||
self._Height = 0
|
||||
self._CanvasHWND.fill( (255,255,255))
|
||||
self._CanvasHWND.fill(SkinManager().GiveColor('White'))
|
||||
|
||||
words = self._Text.split(' ')
|
||||
space = self._FontObj.size(' ')[0]
|
||||
@@ -97,7 +97,7 @@ class MessageBox(Label):
|
||||
|
||||
padding = 5
|
||||
|
||||
pygame.draw.rect(self._HWND,(255,255,255),(x_-padding,y_-padding, self._Width+padding*2,self._Height+padding*2))
|
||||
pygame.draw.rect(self._HWND,SkinManager().GiveColor('White'),(x_-padding,y_-padding, self._Width+padding*2,self._Height+padding*2))
|
||||
|
||||
if self._HWND != None:
|
||||
rect = pygame.Rect(x_,y_,self._Width,self._Height)
|
||||
@@ -105,7 +105,7 @@ class MessageBox(Label):
|
||||
#self._HWND.blit(self._CanvasHWND,rect)
|
||||
|
||||
if withborder == True:
|
||||
pygame.draw.rect(self._HWND,(0,0,0),(x_-padding,y_-padding, self._Width+padding*2,self._Height+padding*2),1)
|
||||
pygame.draw.rect(self._HWND,SkinManager().GiveColor('Black'),(x_-padding,y_-padding, self._Width+padding*2,self._Height+padding*2),1)
|
||||
|
||||
def Draw(self):
|
||||
x = (self._Parent._Width)/2
|
||||
@@ -347,7 +347,7 @@ class MainScreen(object):
|
||||
self._Pages.append(Page)
|
||||
|
||||
def ClearCanvas(self):
|
||||
self._CanvasHWND.fill((255,255,255))
|
||||
self._CanvasHWND.fill(SkinManager().GiveColor('White'))
|
||||
|
||||
def SwapAndShow(self):
|
||||
if self._Closed == True:
|
||||
@@ -440,6 +440,7 @@ class MainScreen(object):
|
||||
obj["ROM"] = ""
|
||||
obj["ROM_SO"] =""
|
||||
obj["EXT"] = []
|
||||
obj["EXCLUDE"] = []
|
||||
obj["FILETYPE"] = "file"
|
||||
obj["LAUNCHER"] = ""
|
||||
obj["TITLE"] = "Game"
|
||||
@@ -454,14 +455,20 @@ class MainScreen(object):
|
||||
with f:
|
||||
content = f.readlines()
|
||||
content = [x.strip() for x in content]
|
||||
for i in content:
|
||||
pis = i.split("=")
|
||||
for c in content:
|
||||
pis = c.split("=")
|
||||
if len(pis) > 1:
|
||||
if "EXT" in pis[0]:
|
||||
obj[pis[0]] = pis[1].split(",")
|
||||
elif "EXCLUDE" in pis[0]:
|
||||
obj[pis[0]] = pis[1].split(",")
|
||||
else:
|
||||
obj[pis[0]] = pis[1]
|
||||
|
||||
|
||||
if FileExists(_dir+"/"+i+"/retroarch-local.cfg"):
|
||||
obj["RETRO_CONFIG"] = CmdClean(os.path.abspath( _dir+"/"+i+"/retroarch-local.cfg" ))
|
||||
print("a local retroarch cfg:", obj["RETRO_CONFIG"])
|
||||
|
||||
em = MyEmulator()
|
||||
em._Emulator = obj
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import pygame
|
||||
|
||||
from skin_manager import SkinManager
|
||||
|
||||
|
||||
class MultiLabel: ##Multi Line Label
|
||||
_PosX=0
|
||||
@@ -10,7 +12,7 @@ class MultiLabel: ##Multi Line Label
|
||||
_Height=100
|
||||
_Text=""
|
||||
_FontObj=None
|
||||
_Color = pygame.Color(83,83,83)
|
||||
_Color = SkinManager().GiveColor('Text')
|
||||
_CanvasHWND = None
|
||||
_TextSurf = None
|
||||
_MaxWidth = 0
|
||||
@@ -18,7 +20,7 @@ class MultiLabel: ##Multi Line Label
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def Init(self,text,font_obj,color=pygame.Color(83,83,83)):
|
||||
def Init(self,text,font_obj,color=SkinManager().GiveColor('Text')):
|
||||
self._Color = color
|
||||
self._FontObj = font_obj
|
||||
self._Text = text
|
||||
|
||||
@@ -5,6 +5,8 @@ from util_funcs import midRect
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
from skin_manager import SkinManager
|
||||
|
||||
class ListScroller(object):
|
||||
_PosX = 0
|
||||
_PosY = 0
|
||||
@@ -12,7 +14,7 @@ class ListScroller(object):
|
||||
_Height = 0
|
||||
_MinHeight = 6 ## tested
|
||||
_Parent = None
|
||||
_Color = pygame.Color(131,199,219)
|
||||
_Color = SkinManager().GiveColor('Front')
|
||||
|
||||
_StartX = 0
|
||||
_StartY = 0
|
||||
|
||||
+27
-22
@@ -23,7 +23,7 @@ class SkinManager(object):
|
||||
_Config = None
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
self.Init()
|
||||
|
||||
def ConvertToRGB(self,hexstr):
|
||||
|
||||
@@ -31,44 +31,49 @@ class SkinManager(object):
|
||||
return tuple(int(h[i:i+2], 16) for i in (0, 2 ,4))
|
||||
|
||||
def Init(self):
|
||||
|
||||
if not SkinManager._Colors:
|
||||
self.SetColors()
|
||||
|
||||
def SetColors(self):
|
||||
Colors = {}
|
||||
Colors["High"] = pygame.Color(51,166,255)
|
||||
Colors["Text"] = pygame.Color(83,83,83)
|
||||
Colors["Front"] = pygame.Color(131,199,219)
|
||||
Colors["URL"] = pygame.Color(51,166,255)
|
||||
Colors["Line"] = pygame.Color(169,169,169)
|
||||
Colors["TitleBg"] = pygame.Color(228,228,228)
|
||||
Colors["Active"] = pygame.Color(175,90,0)
|
||||
Colors["White"] = pygame.Color(255,255,255)
|
||||
|
||||
self._Colors = Colors
|
||||
|
||||
Colors["High"] = pygame.Color(51, 166, 255)
|
||||
Colors["Text"] = pygame.Color(83, 83, 83)
|
||||
Colors["Front"] = pygame.Color(131, 199, 219)
|
||||
Colors["URL"] = pygame.Color(51, 166, 255)
|
||||
Colors["Line"] = pygame.Color(169, 169, 169)
|
||||
Colors["TitleBg"] = pygame.Color(228, 228, 228)
|
||||
Colors["Active"] = pygame.Color(175, 90, 0)
|
||||
Colors["Disabled"] = pygame.Color(204, 204, 204)
|
||||
Colors["White"] = pygame.Color(255, 255, 255)
|
||||
Colors["Black"] = pygame.Color(0, 0, 0)
|
||||
|
||||
SkinManager._Colors = Colors
|
||||
|
||||
self._Config = CaseConfigParser()
|
||||
|
||||
|
||||
fname = "../skin/"+config.SKIN+"/config.cfg"
|
||||
|
||||
|
||||
try:
|
||||
self._Config.read(fname)
|
||||
except Exception,e:
|
||||
except Exception, e:
|
||||
print("read skin config.cfg error %s" % str(e))
|
||||
return
|
||||
else:
|
||||
if "Colors" in self._Config.sections():
|
||||
colour_opts = self._Config.options("Colors")
|
||||
# print(colour_opts)
|
||||
for i in self._Colors:
|
||||
for i in SkinManager._Colors:
|
||||
if i in colour_opts:
|
||||
try:
|
||||
self._Colors[i] = self.ConvertToRGB(self._Config.get("Colors",i))
|
||||
except Exception,e:
|
||||
SkinManager._Colors[i] = self.ConvertToRGB(
|
||||
self._Config.get("Colors", i))
|
||||
except Exception, e:
|
||||
print("error in ConvertToRGB %s" % str(e))
|
||||
continue
|
||||
|
||||
|
||||
def GiveColor(self,name):
|
||||
if name in self._Colors:
|
||||
return self._Colors[name]
|
||||
if name in SkinManager._Colors:
|
||||
return SkinManager._Colors[name]
|
||||
else:
|
||||
return pygame.Color(255,0,0)
|
||||
|
||||
|
||||
+16
-14
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
from pygame.locals import *
|
||||
@@ -11,34 +11,36 @@ from datetime import datetime
|
||||
import base64
|
||||
from beeprint import pp
|
||||
|
||||
from util_funcs import midRect,SkinMap
|
||||
from fonts import fonts
|
||||
from util_funcs import midRect, SkinMap
|
||||
from fonts import fonts
|
||||
|
||||
BlankPng = SkinMap("gameshell/blank.png") ## 80x80
|
||||
from skin_manager import SkinManager
|
||||
|
||||
BlankPng = SkinMap("gameshell/blank.png") # 80x80
|
||||
## use blank circle as bg, Two alpha As Icon Label
|
||||
#Upper and Lower
|
||||
|
||||
|
||||
class UntitledIcon(object):
|
||||
_PosX = 0
|
||||
_PosY = 0
|
||||
_Width = 80
|
||||
_Height = 80
|
||||
|
||||
_Words = ["G","s"]
|
||||
_FontObj= fonts["varela40"]
|
||||
|
||||
_BG = None ## initial surface
|
||||
|
||||
_Color = pygame.Color(83,83,83)
|
||||
_Words = ["G", "s"]
|
||||
_FontObj = fonts["varela40"]
|
||||
|
||||
_BG = None # initial surface
|
||||
|
||||
_Color = SkinManager().GiveColor('Text')
|
||||
|
||||
|
||||
def __init__(self):
|
||||
self._Words = ["G","s"]
|
||||
self._Words = ["G", "s"]
|
||||
|
||||
def Init(self):
|
||||
self._BG = pygame.image.load(BlankPng).convert_alpha()
|
||||
|
||||
|
||||
def SetWords(self,TwoWords):
|
||||
def SetWords(self, TwoWords):
|
||||
if len(TwoWords) == 1:
|
||||
self._Words[0] = TwoWords[0].upper()
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ MPD_socket = "/tmp/mpd.socket"
|
||||
|
||||
UPDATE_URL="https://raw.githubusercontent.com/clockworkpi/CPI/master/launcher_ver.json"
|
||||
|
||||
VERSION="stable 1.21"
|
||||
VERSION="stable 1.22"
|
||||
|
||||
SKIN="default"
|
||||
|
||||
|
||||
Executable
BIN
Binary file not shown.
+8
-2
@@ -296,7 +296,7 @@ def event_process(event,main_screen):
|
||||
pygame.quit()
|
||||
gobject_main_loop.quit()
|
||||
os.chdir( GetExePath())
|
||||
exec_app_cmd = "cd "+os.path.dirname(event.message)+";"
|
||||
exec_app_cmd = "./gsnotify/gsnotify-arm& cd "+os.path.dirname(event.message)+";"
|
||||
exec_app_cmd += event.message
|
||||
exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname
|
||||
print(exec_app_cmd)
|
||||
@@ -535,6 +535,12 @@ if __name__ == '__main__':
|
||||
powerlevel = powerlevel.strip()
|
||||
if powerlevel != "":
|
||||
config.PowerLevel = powerlevel
|
||||
|
||||
if powerlevel != "supersaving":
|
||||
os.system("sudo iw wlan0 set power_save off")
|
||||
else:
|
||||
os.system("sudo iw wlan0 set power_save on")
|
||||
|
||||
os.spawnlp(os.P_NOWAIT,"./gsnotify/gsnotify-arm", "./gsnotify/gsnotify-arm")
|
||||
|
||||
big_loop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user