mirror of
https://github.com/clockworkpi/launcher.git
synced 2025-12-13 02:08:50 +01:00
add widget.py
This commit is contained in:
parent
c641c8d84a
commit
7e75d4856b
@ -177,30 +177,6 @@ class BleInfoPage(Page):
|
|||||||
li._PosX = 2
|
li._PosX = 2
|
||||||
self._MyList.append(li)
|
self._MyList.append(li)
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def TryToForget(self):
|
def TryToForget(self):
|
||||||
global adapter
|
global adapter
|
||||||
proxy_obj = bus.get_object("org.bluez", self._Path)
|
proxy_obj = bus.get_object("org.bluez", self._Path)
|
||||||
@ -336,10 +312,10 @@ class BleListSelector(PageSelector):
|
|||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
idx = self._Parent._PsIndex
|
idx = self._Parent._PsIndex
|
||||||
if idx < len( self._Parent._WirelessList):
|
if idx < len( self._Parent._MyList):
|
||||||
x = self._Parent._WirelessList[idx]._PosX+2
|
x = self._Parent._MyList[idx]._PosX+2
|
||||||
y = self._Parent._WirelessList[idx]._PosY+1
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
h = self._Parent._WirelessList[idx]._Height -3
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
self._PosX = x
|
self._PosX = x
|
||||||
self._PosY = y
|
self._PosY = y
|
||||||
@ -367,7 +343,7 @@ class BleListMessageBox(Label):
|
|||||||
|
|
||||||
|
|
||||||
class BluetoothPage(Page):
|
class BluetoothPage(Page):
|
||||||
_WirelessList = []
|
_MyList = []
|
||||||
#Wicd dbus part
|
#Wicd dbus part
|
||||||
_Adapter = None
|
_Adapter = None
|
||||||
_Dbus = None
|
_Dbus = None
|
||||||
@ -398,7 +374,7 @@ class BluetoothPage(Page):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Page.__init__(self)
|
Page.__init__(self)
|
||||||
self._WirelessList = []
|
self._MyList = []
|
||||||
self._CanvasHWND = None
|
self._CanvasHWND = None
|
||||||
|
|
||||||
def ShowBox(self,msg):
|
def ShowBox(self,msg):
|
||||||
@ -520,10 +496,10 @@ class BluetoothPage(Page):
|
|||||||
def TryConnect(self):
|
def TryConnect(self):
|
||||||
global bus
|
global bus
|
||||||
|
|
||||||
if self._PsIndex >= len(self._WirelessList):
|
if self._PsIndex >= len(self._MyList):
|
||||||
return
|
return
|
||||||
|
|
||||||
cur_li = self._WirelessList[self._PsIndex]
|
cur_li = self._MyList[self._PsIndex]
|
||||||
print(cur_li._Path)
|
print(cur_li._Path)
|
||||||
|
|
||||||
if "Connected" in cur_li._Atts:
|
if "Connected" in cur_li._Atts:
|
||||||
@ -562,7 +538,7 @@ class BluetoothPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
def GenNetworkList(self):
|
def GenNetworkList(self):
|
||||||
self._WirelessList = []
|
self._MyList = []
|
||||||
start_x = 0
|
start_x = 0
|
||||||
start_y = 0
|
start_y = 0
|
||||||
|
|
||||||
@ -586,7 +562,7 @@ class BluetoothPage(Page):
|
|||||||
ni.Init(v,self._Devices[v])
|
ni.Init(v,self._Devices[v])
|
||||||
|
|
||||||
counter += 1
|
counter += 1
|
||||||
self._WirelessList.append(ni)
|
self._MyList.append(ni)
|
||||||
|
|
||||||
self._PsIndex = 0
|
self._PsIndex = 0
|
||||||
|
|
||||||
@ -632,30 +608,6 @@ class BluetoothPage(Page):
|
|||||||
else:
|
else:
|
||||||
self._Offline = True
|
self._Offline = True
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._WirelessList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex-=1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
|
|
||||||
cur_ni = self._WirelessList[self._PsIndex]
|
|
||||||
if cur_ni._PosY < 0:
|
|
||||||
for i in range(0,len(self._WirelessList)):
|
|
||||||
self._WirelessList[i]._PosY += self._WirelessList[i]._Height
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._WirelessList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex+=1
|
|
||||||
if self._PsIndex >= len(self._WirelessList):
|
|
||||||
self._PsIndex = len(self._WirelessList) -1
|
|
||||||
|
|
||||||
cur_ni = self._WirelessList[self._PsIndex]
|
|
||||||
if cur_ni._PosY + cur_ni._Height > self._Height:
|
|
||||||
for i in range(0,len(self._WirelessList)):
|
|
||||||
self._WirelessList[i]._PosY -= self._WirelessList[i]._Height
|
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||||
@ -698,13 +650,13 @@ class BluetoothPage(Page):
|
|||||||
self.Rescan()
|
self.Rescan()
|
||||||
|
|
||||||
if event.key == CurKeys["Y"]:
|
if event.key == CurKeys["Y"]:
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
if self._Offline == True:
|
if self._Offline == True:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._InfoPage._AList = self._WirelessList[self._PsIndex]._Atts
|
self._InfoPage._AList = self._MyList[self._PsIndex]._Atts
|
||||||
self._InfoPage._Path = self._WirelessList[self._PsIndex]._Path
|
self._InfoPage._Path = self._MyList[self._PsIndex]._Path
|
||||||
self._Screen.PushPage(self._InfoPage)
|
self._Screen.PushPage(self._InfoPage)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
@ -715,23 +667,23 @@ class BluetoothPage(Page):
|
|||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(self._WirelessList) * NetItem._Height > self._Height:
|
if len(self._MyList) * NetItem._Height > self._Height:
|
||||||
self._Ps._Width = self._Width - 11
|
self._Ps._Width = self._Width - 11
|
||||||
self._Ps.Draw()
|
self._Ps.Draw()
|
||||||
|
|
||||||
for i in self._WirelessList:
|
for i in self._MyList:
|
||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
self._Scroller.UpdateSize( len(self._WirelessList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
self._Scroller.UpdateSize( len(self._MyList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
||||||
self._Scroller.Draw()
|
self._Scroller.Draw()
|
||||||
else:
|
else:
|
||||||
self._Ps._Width = self._Width
|
self._Ps._Width = self._Width
|
||||||
self._Ps.Draw()
|
self._Ps.Draw()
|
||||||
|
|
||||||
for i in self._WirelessList:
|
for i in self._MyList:
|
||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import os
|
|||||||
import pygame
|
import pygame
|
||||||
#import math
|
#import math
|
||||||
#mport subprocess
|
#mport subprocess
|
||||||
import glob
|
import platform
|
||||||
#from beeprint import pp
|
#from beeprint import pp
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
@ -24,6 +24,7 @@ class APIOBJ(object):
|
|||||||
main_screen._MsgBox.Draw()
|
main_screen._MsgBox.Draw()
|
||||||
main_screen.SwapAndShow()
|
main_screen.SwapAndShow()
|
||||||
pygame.time.delay(300)
|
pygame.time.delay(300)
|
||||||
|
if "arm" in platform.machine():
|
||||||
os.system("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
os.system("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||||
os.system("sudo reboot")
|
os.system("sudo reboot")
|
||||||
|
|
||||||
|
|||||||
@ -168,29 +168,6 @@ class NotificationPage(Page):
|
|||||||
self._Scroller._PosY = 2
|
self._Scroller._PosY = 2
|
||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|||||||
@ -403,30 +403,6 @@ class PowerOptionsPage(Page):
|
|||||||
self._InfoPage._Name = "Power option detail"
|
self._InfoPage._Name = "Power option detail"
|
||||||
self._InfoPage.Init()
|
self._InfoPage.Init()
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|||||||
@ -200,35 +200,6 @@ class TimezoneListPage(Page):
|
|||||||
self._Scroller._PosY = 2
|
self._Scroller._PosY = 2
|
||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
|
|
||||||
|
|
||||||
def ScrollUp(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex -= Step
|
|
||||||
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
dy = tmp-self._PsIndex
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex +=Step
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
dy = self._PsIndex - tmp
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
@ -275,12 +246,12 @@ class TimezoneListPage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Right"]:
|
if event.key == CurKeys["Right"]:
|
||||||
self.ScrollDown(Step=5)
|
self.FScrollDown(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Left"]:
|
if event.key == CurKeys["Left"]:
|
||||||
self.ScrollUp(Step=5)
|
self.FScrollUp(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ from UI.icon_item import IconItem
|
|||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.skin_manager import MySkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.widget import Widget
|
||||||
|
|
||||||
class NetItemMultiIcon(MultiIconItem):
|
class NetItemMultiIcon(MultiIconItem):
|
||||||
_CanvasHWND = None
|
_CanvasHWND = None
|
||||||
@ -33,10 +33,7 @@ class NetItemIcon(IconItem):
|
|||||||
self._CanvasHWND.blit(self._ImgSurf,(self._PosX,self._PosY+(self._Parent._Height-self._Height)/2,self._Width,self._Height))
|
self._CanvasHWND.blit(self._ImgSurf,(self._PosX,self._PosY+(self._Parent._Height-self._Height)/2,self._Width,self._Height))
|
||||||
|
|
||||||
|
|
||||||
class NetItem(object):
|
class NetItem(Widget):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 30
|
_Height = 30
|
||||||
|
|
||||||
_Bssid="" # 50:3A:A0:51:18:3C
|
_Bssid="" # 50:3A:A0:51:18:3C
|
||||||
|
|||||||
@ -143,30 +143,6 @@ class WifiInfoPage(Page):
|
|||||||
self._DisconnectConfirmPage._Parent = self
|
self._DisconnectConfirmPage._Parent = self
|
||||||
self._DisconnectConfirmPage.Init()
|
self._DisconnectConfirmPage.Init()
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
cur_li = self._MyList[self._PsIndex]
|
cur_li = self._MyList[self._PsIndex]
|
||||||
print(cur_li._Flag)
|
print(cur_li._Flag)
|
||||||
@ -230,9 +206,7 @@ class WifiListSelector(PageSelector):
|
|||||||
_BackgroundColor = MySkinManager.GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
pass
|
||||||
self._PosY = 0
|
|
||||||
self._Height = 0
|
|
||||||
|
|
||||||
def AnimateDraw(self,x2,y2):
|
def AnimateDraw(self,x2,y2):
|
||||||
pass
|
pass
|
||||||
@ -240,10 +214,10 @@ class WifiListSelector(PageSelector):
|
|||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
idx = self._Parent._PsIndex
|
idx = self._Parent._PsIndex
|
||||||
if idx < len( self._Parent._WirelessList):
|
if idx < len( self._Parent._MyList):
|
||||||
x = self._Parent._WirelessList[idx]._PosX+11
|
x = self._Parent._MyList[idx]._PosX+11
|
||||||
y = self._Parent._WirelessList[idx]._PosY+1
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
h = self._Parent._WirelessList[idx]._Height -3
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
self._PosX = x
|
self._PosX = x
|
||||||
self._PosY = y
|
self._PosY = y
|
||||||
@ -270,7 +244,7 @@ class WifiListMessageBox(Label):
|
|||||||
self._CanvasHWND.blit(my_text,(x,y,w,h))
|
self._CanvasHWND.blit(my_text,(x,y,w,h))
|
||||||
|
|
||||||
class WifiList(Page):
|
class WifiList(Page):
|
||||||
_WirelessList = []
|
_MyList = []
|
||||||
#Wicd dbus part
|
#Wicd dbus part
|
||||||
_Wireless = None
|
_Wireless = None
|
||||||
_Daemon = None
|
_Daemon = None
|
||||||
@ -300,7 +274,7 @@ class WifiList(Page):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Page.__init__(self)
|
Page.__init__(self)
|
||||||
self._WirelessList = []
|
self._MyList = []
|
||||||
self._CanvasHWND = None
|
self._CanvasHWND = None
|
||||||
|
|
||||||
def ShowBox(self,msg):
|
def ShowBox(self,msg):
|
||||||
@ -317,7 +291,7 @@ class WifiList(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def GenNetworkList(self):
|
def GenNetworkList(self):
|
||||||
self._WirelessList = []
|
self._MyList = []
|
||||||
start_x = 0
|
start_x = 0
|
||||||
start_y = 0
|
start_y = 0
|
||||||
|
|
||||||
@ -336,7 +310,7 @@ class WifiList(Page):
|
|||||||
#ni._Bssid = self._Wireless.GetWirelessProperty(network_id,"bssid")
|
#ni._Bssid = self._Wireless.GetWirelessProperty(network_id,"bssid")
|
||||||
|
|
||||||
ni.Init(network_id,is_active)
|
ni.Init(network_id,is_active)
|
||||||
self._WirelessList.append(ni)
|
self._MyList.append(ni)
|
||||||
|
|
||||||
self._PsIndex = 0
|
self._PsIndex = 0
|
||||||
|
|
||||||
@ -397,8 +371,8 @@ class WifiList(Page):
|
|||||||
if info != None:
|
if info != None:
|
||||||
if len(info) > 3:
|
if len(info) > 3:
|
||||||
_id = int(info[3])
|
_id = int(info[3])
|
||||||
if _id < len(self._WirelessList):
|
if _id < len(self._MyList):
|
||||||
self._WirelessList[_id].UpdateStrenLabel( str(info[2]))
|
self._MyList[_id].UpdateStrenLabel( str(info[2]))
|
||||||
|
|
||||||
self._PrevWicdState = state
|
self._PrevWicdState = state
|
||||||
|
|
||||||
@ -521,7 +495,7 @@ class WifiList(Page):
|
|||||||
|
|
||||||
netid = self._PsIndex
|
netid = self._PsIndex
|
||||||
|
|
||||||
for i,v in enumerate(self._WirelessList):
|
for i,v in enumerate(self._MyList):
|
||||||
if v._Bssid == self._CurBssid:
|
if v._Bssid == self._CurBssid:
|
||||||
netid = i
|
netid = i
|
||||||
break
|
break
|
||||||
@ -550,7 +524,7 @@ class WifiList(Page):
|
|||||||
|
|
||||||
self.ShowBox(MyLangManager.Tr("Connecting"))
|
self.ShowBox(MyLangManager.Tr("Connecting"))
|
||||||
|
|
||||||
self._WirelessList[netid].Connect()
|
self._MyList[netid].Connect()
|
||||||
print("after Connect")
|
print("after Connect")
|
||||||
self.UpdateStatus()
|
self.UpdateStatus()
|
||||||
|
|
||||||
@ -584,31 +558,6 @@ class WifiList(Page):
|
|||||||
"""
|
"""
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._WirelessList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex-=1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
|
|
||||||
cur_ni = self._WirelessList[self._PsIndex]
|
|
||||||
if cur_ni._PosY < 0:
|
|
||||||
for i in range(0,len(self._WirelessList)):
|
|
||||||
self._WirelessList[i]._PosY += self._WirelessList[i]._Height
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._WirelessList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex+=1
|
|
||||||
if self._PsIndex >= len(self._WirelessList):
|
|
||||||
self._PsIndex = len(self._WirelessList) -1
|
|
||||||
|
|
||||||
cur_ni = self._WirelessList[self._PsIndex]
|
|
||||||
if cur_ni._PosY + cur_ni._Height > self._Height:
|
|
||||||
for i in range(0,len(self._WirelessList)):
|
|
||||||
self._WirelessList[i]._PosY -= self._WirelessList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def AbortedAndReturnToUpLevel(self):
|
def AbortedAndReturnToUpLevel(self):
|
||||||
self.HideBox()
|
self.HideBox()
|
||||||
self._Screen._FootBar.ResetNavText()
|
self._Screen._FootBar.ResetNavText()
|
||||||
@ -657,13 +606,13 @@ class WifiList(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]: ## enter to set password,enter is B on GM
|
if event.key == CurKeys["Enter"]: ## enter to set password,enter is B on GM
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._CurBssid = self._WirelessList[self._PsIndex]._Bssid
|
self._CurBssid = self._MyList[self._PsIndex]._Bssid
|
||||||
|
|
||||||
wicd_wirelss_encrypt_pwd = self.GetWirelessEncrypt(self._PsIndex)
|
wicd_wirelss_encrypt_pwd = self.GetWirelessEncrypt(self._PsIndex)
|
||||||
if self._WirelessList[self._PsIndex]._IsActive:
|
if self._MyList[self._PsIndex]._IsActive:
|
||||||
self.ShowBox( self._Wireless.GetWirelessIP('') )
|
self.ShowBox( self._Wireless.GetWirelessIP('') )
|
||||||
else:
|
else:
|
||||||
self._Screen.PushCurPage()
|
self._Screen.PushCurPage()
|
||||||
@ -693,7 +642,7 @@ class WifiList(Page):
|
|||||||
self.Rescan(False)
|
self.Rescan(False)
|
||||||
|
|
||||||
if event.key == CurKeys["Y"]:
|
if event.key == CurKeys["Y"]:
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._InfoPage._NetworkId = self._PsIndex
|
self._InfoPage._NetworkId = self._PsIndex
|
||||||
@ -762,13 +711,13 @@ class WifiList(Page):
|
|||||||
def Draw(self):
|
def Draw(self):
|
||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
|
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._Ps.Draw()
|
self._Ps.Draw()
|
||||||
for i in self._WirelessList:
|
for i in self._MyList:
|
||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
|
|
||||||
self._Scroller.UpdateSize( len(self._WirelessList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
self._Scroller.UpdateSize( len(self._MyList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
||||||
self._Scroller.Draw()
|
self._Scroller.Draw()
|
||||||
|
|||||||
@ -104,30 +104,6 @@ class ListPage(Page):
|
|||||||
self._Scroller._PosY = 2
|
self._Scroller._PosY = 2
|
||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
cur_li = self._MyList[self._PsIndex]
|
cur_li = self._MyList[self._PsIndex]
|
||||||
if cur_li._LinkObj != None:
|
if cur_li._LinkObj != None:
|
||||||
|
|||||||
86
Menu/GameShell/50_PICO-8/__init__.py
Normal file
86
Menu/GameShell/50_PICO-8/__init__.py
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import pygame
|
||||||
|
import validators
|
||||||
|
|
||||||
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
|
from UI.simple_name_space import SimpleNamespace
|
||||||
|
from UI.page import Page
|
||||||
|
from UI.label import Label
|
||||||
|
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 MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.textarea import Textarea
|
||||||
|
|
||||||
|
class Textbulletinboard(Textarea):
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class NOPICOPage(Page):
|
||||||
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
|
_TextColor = MySkinManager.GiveColor('Text')
|
||||||
|
_DrawOnce = False
|
||||||
|
|
||||||
|
|
||||||
|
def KeyDown(self,event):
|
||||||
|
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||||
|
if self._FootMsg[3] == "Back":
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
return
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
if self._DrawOnce == False:
|
||||||
|
self.ClearCanvas()
|
||||||
|
|
||||||
|
self._DrawOnce = True
|
||||||
|
|
||||||
|
class PICO8Page(Page):
|
||||||
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
|
_MyList = []
|
||||||
|
|
||||||
|
_ListFontObj = fonts["varela13"]
|
||||||
|
|
||||||
|
_AList = {}
|
||||||
|
_Labels = {}
|
||||||
|
|
||||||
|
_Coords = {}
|
||||||
|
|
||||||
|
_URLColor = MySkinManager.GiveColor('URL')
|
||||||
|
_TextColor = MySkinManager.GiveColor('Text')
|
||||||
|
_Scrolled = 0
|
||||||
|
|
||||||
|
_PngSize = {}
|
||||||
|
|
||||||
|
_DrawOnce = False
|
||||||
|
_Scroller = None
|
||||||
|
_Scrolled = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
pass
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
|
||||||
|
main_screen._MsgBox.SetText("Starting pico-8")
|
||||||
|
main_screen._MsgBox.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
pygame.time.delay(300)
|
||||||
|
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
2
Menu/GameShell/50_PICO-8/md5sum.log
Normal file
2
Menu/GameShell/50_PICO-8/md5sum.log
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
a3f2995cf117499f880bd964d6a0e1f2 pico-8_0.1.11g_raspi.zip
|
||||||
|
6726141c784afd4a41be6b7414c1b932 pico-8_0.1.11g_amd64.zip
|
||||||
@ -196,35 +196,6 @@ class MusicLibListPage(Page):
|
|||||||
self._Scroller._PosY = 2
|
self._Scroller._PosY = 2
|
||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
|
|
||||||
|
|
||||||
def ScrollUp(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex -= Step
|
|
||||||
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
dy = tmp-self._PsIndex
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex +=Step
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
dy = self._PsIndex - tmp
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
@ -272,12 +243,12 @@ class MusicLibListPage(Page):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if event.key == CurKeys["Right"]:
|
if event.key == CurKeys["Right"]:
|
||||||
self.ScrollDown(Step=5)
|
self.FScrollDown(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Left"]:
|
if event.key == CurKeys["Left"]:
|
||||||
self.ScrollUp(Step=5)
|
self.FScrollUp(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -18,10 +18,10 @@ from fonts import fonts
|
|||||||
from keys_def import CurKeys
|
from keys_def import CurKeys
|
||||||
from label import Label
|
from label import Label
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
|
from widget import Widget
|
||||||
|
|
||||||
|
|
||||||
|
class AboveAllPatch(Widget):
|
||||||
class AboveAllPatch(object):
|
|
||||||
_PosX =Width/2
|
_PosX =Width/2
|
||||||
_PosY =Height/2
|
_PosY =Height/2
|
||||||
_Width =50
|
_Width =50
|
||||||
|
|||||||
@ -20,9 +20,6 @@ class ListPageSelector(PageSelector):
|
|||||||
_BackgroundColor = MySkinManager.GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
|
||||||
self._PosY = 0
|
|
||||||
self._Height = 0
|
|
||||||
self._Width = Width
|
self._Width = Width
|
||||||
|
|
||||||
def AnimateDraw(self,x2,y2):
|
def AnimateDraw(self,x2,y2):
|
||||||
|
|||||||
@ -13,7 +13,7 @@ from multi_icon_item import MultiIconItem
|
|||||||
from icon_pool import MyIconPool
|
from icon_pool import MyIconPool
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
|
from widget import Widget
|
||||||
icon_base_path = SkinMap("gameshell/footbar_icons/")
|
icon_base_path = SkinMap("gameshell/footbar_icons/")
|
||||||
|
|
||||||
class FootBarIcon(MultiIconItem):
|
class FootBarIcon(MultiIconItem):
|
||||||
@ -40,9 +40,7 @@ class FootBarIcon(MultiIconItem):
|
|||||||
self._PosY,
|
self._PosY,
|
||||||
self._Width,self._Height,Width,Height),
|
self._Width,self._Height,Width,Height),
|
||||||
(0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight))
|
(0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight))
|
||||||
class FootBar:
|
class FootBar(Widget):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = Width
|
_Width = Width
|
||||||
_Height = 20
|
_Height = 20
|
||||||
_BarHeight = 20.5
|
_BarHeight = 20.5
|
||||||
|
|||||||
@ -7,12 +7,8 @@ from constants import icon_width,icon_height,ICON_TYPES,ALIGN,icon_ext,Width,He
|
|||||||
from util_funcs import color_surface,midRect
|
from util_funcs import color_surface,midRect
|
||||||
from label import Label
|
from label import Label
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
|
from widget import Widget
|
||||||
class IconItem:
|
class IconItem(Widget):
|
||||||
_PosX=0
|
|
||||||
_PosY=0
|
|
||||||
_Width=0
|
|
||||||
_Height=0
|
|
||||||
_ImageName=""
|
_ImageName=""
|
||||||
_ImgSurf = None
|
_ImgSurf = None
|
||||||
_Parent = None
|
_Parent = None
|
||||||
@ -37,10 +33,6 @@ class IconItem:
|
|||||||
def SetLableColor(self,color):
|
def SetLableColor(self,color):
|
||||||
self._Label.SetColor(color)
|
self._Label.SetColor(color)
|
||||||
|
|
||||||
def NewCoord(self,x,y):
|
|
||||||
self._PosX = x
|
|
||||||
self._PosY = y
|
|
||||||
|
|
||||||
def AddLabel(self,text,fontobj):
|
def AddLabel(self,text,fontobj):
|
||||||
if self._Label == None:
|
if self._Label == None:
|
||||||
self._Label = Label()
|
self._Label = Label()
|
||||||
|
|||||||
@ -3,11 +3,8 @@
|
|||||||
import pygame
|
import pygame
|
||||||
from label import Label
|
from label import Label
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
|
from widget import Widget
|
||||||
class InfoPageListItem(object):
|
class InfoPageListItem(Widget):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 30
|
_Height = 30
|
||||||
|
|
||||||
_Labels = {}
|
_Labels = {}
|
||||||
|
|||||||
@ -11,9 +11,6 @@ class InfoPageSelector(PageSelector):
|
|||||||
_BackgroundColor = MySkinManager.GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
|
||||||
self._PosY = 0
|
|
||||||
self._Height = 0
|
|
||||||
self._Width = Width
|
self._Width = Width
|
||||||
|
|
||||||
def AnimateDraw(self,x2,y2):
|
def AnimateDraw(self,x2,y2):
|
||||||
|
|||||||
@ -23,10 +23,6 @@ from text_item import TextItem
|
|||||||
import myvars
|
import myvars
|
||||||
|
|
||||||
class KeyboardIcon(IconItem):
|
class KeyboardIcon(IconItem):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 0
|
|
||||||
_Color = MySkinManager.GiveColor('Text')
|
_Color = MySkinManager.GiveColor('Text')
|
||||||
_MyType = ICON_TYPES["NAV"]
|
_MyType = ICON_TYPES["NAV"]
|
||||||
_Parent = None
|
_Parent = None
|
||||||
@ -57,10 +53,6 @@ class KeyboardSelector(PageSelector):
|
|||||||
# pygame.draw.rect(self._Parent._CanvasHWND,(0,0,0),rect,1)
|
# pygame.draw.rect(self._Parent._CanvasHWND,(0,0,0),rect,1)
|
||||||
|
|
||||||
class Keyboard(Page):
|
class Keyboard(Page):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 0
|
|
||||||
_SectionNumbers = 3
|
_SectionNumbers = 3
|
||||||
_SectionIndex = 1
|
_SectionIndex = 1
|
||||||
|
|
||||||
|
|||||||
@ -10,12 +10,8 @@ from util_funcs import midRect
|
|||||||
#UI lib
|
#UI lib
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
|
from widget import Widget
|
||||||
class Label:
|
class Label(Widget):
|
||||||
_PosX=0
|
|
||||||
_PosY=0
|
|
||||||
_Width=0
|
|
||||||
_Height=0
|
|
||||||
_Text=""
|
_Text=""
|
||||||
_FontObj=None
|
_FontObj=None
|
||||||
_Color = MySkinManager.GiveColor('Text')
|
_Color = MySkinManager.GiveColor('Text')
|
||||||
@ -33,10 +29,6 @@ class Label:
|
|||||||
self._Width = my_text.get_width()
|
self._Width = my_text.get_width()
|
||||||
self._Height = my_text.get_height()
|
self._Height = my_text.get_height()
|
||||||
|
|
||||||
def NewCoord(self,x,y):
|
|
||||||
self._PosX = x
|
|
||||||
self._PosY = y
|
|
||||||
|
|
||||||
def SetColor(self,color):
|
def SetColor(self,color):
|
||||||
self._Color = color
|
self._Color = color
|
||||||
|
|
||||||
@ -50,8 +42,6 @@ class Label:
|
|||||||
self._Width = my_text.get_width()
|
self._Width = my_text.get_width()
|
||||||
self._Height = my_text.get_height()
|
self._Height = my_text.get_height()
|
||||||
|
|
||||||
def Width(self):
|
|
||||||
return self._Width
|
|
||||||
|
|
||||||
def SetCanvasHWND(self,_canvashwnd):
|
def SetCanvasHWND(self,_canvashwnd):
|
||||||
self._CanvasHWND = _canvashwnd
|
self._CanvasHWND = _canvashwnd
|
||||||
|
|||||||
@ -28,6 +28,7 @@ from Emulator import MyEmulator
|
|||||||
|
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
|
from widget import Widget
|
||||||
|
|
||||||
from counter_screen import CounterScreen
|
from counter_screen import CounterScreen
|
||||||
|
|
||||||
@ -121,11 +122,10 @@ python_package_flag = "__init__.py"
|
|||||||
emulator_flag = "action.config"
|
emulator_flag = "action.config"
|
||||||
|
|
||||||
##Abstract object for manage Pages ,not the pygame's physic screen
|
##Abstract object for manage Pages ,not the pygame's physic screen
|
||||||
class MainScreen(object):
|
class MainScreen(Widget):
|
||||||
_Pages = []
|
_Pages = []
|
||||||
_PageMax = 0
|
_PageMax = 0
|
||||||
_PageIndex = 0
|
_PageIndex = 0
|
||||||
_PosX = 0
|
|
||||||
_PosY = TitleBar._BarHeight+1
|
_PosY = TitleBar._BarHeight+1
|
||||||
_Width = Width
|
_Width = Width
|
||||||
_Height = Height -FootBar._BarHeight -TitleBar._BarHeight
|
_Height = Height -FootBar._BarHeight -TitleBar._BarHeight
|
||||||
|
|||||||
@ -4,11 +4,9 @@ import pygame
|
|||||||
|
|
||||||
from skin_manager import MySkinManager
|
from skin_manager import MySkinManager
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
|
from widget import Widget
|
||||||
|
|
||||||
|
class MultiLabel(Widget): ##Multi Line Label
|
||||||
class MultiLabel: ##Multi Line Label
|
|
||||||
_PosX=0
|
|
||||||
_PosY=0
|
|
||||||
_Width=135
|
_Width=135
|
||||||
_Height=100
|
_Height=100
|
||||||
_Text=""
|
_Text=""
|
||||||
@ -28,9 +26,6 @@ class MultiLabel: ##Multi Line Label
|
|||||||
|
|
||||||
self.blit_text(self._CanvasHWND,self._Text,(self._PosX,self._PosY),self._FontObj)
|
self.blit_text(self._CanvasHWND,self._Text,(self._PosX,self._PosY),self._FontObj)
|
||||||
|
|
||||||
def NewCoord(self,x,y):
|
|
||||||
self._PosX = x
|
|
||||||
self._PosY = y
|
|
||||||
|
|
||||||
def SetColor(self,color):
|
def SetColor(self,color):
|
||||||
self._Color = color
|
self._Color = color
|
||||||
@ -43,9 +38,6 @@ class MultiLabel: ##Multi Line Label
|
|||||||
|
|
||||||
self.blit_text(self._CanvasHWND,self._Text,(self._PosX,self._PosY),self._FontObj)
|
self.blit_text(self._CanvasHWND,self._Text,(self._PosX,self._PosY),self._FontObj)
|
||||||
|
|
||||||
def Width(self):
|
|
||||||
return self._Width
|
|
||||||
|
|
||||||
def SetCanvasHWND(self,_canvashwnd):
|
def SetCanvasHWND(self,_canvashwnd):
|
||||||
self._CanvasHWND = _canvashwnd
|
self._CanvasHWND = _canvashwnd
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,7 @@ from util_funcs import midRect
|
|||||||
from keys_def import CurKeys
|
from keys_def import CurKeys
|
||||||
from icon_pool import MyIconPool
|
from icon_pool import MyIconPool
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
|
from widget import Widget
|
||||||
|
|
||||||
class PageStack:
|
class PageStack:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -37,11 +38,8 @@ class PageStack:
|
|||||||
def Length(self):
|
def Length(self):
|
||||||
return len(self.stack)
|
return len(self.stack)
|
||||||
|
|
||||||
class PageSelector:
|
class PageSelector(Widget):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 0
|
|
||||||
_Parent = None
|
_Parent = None
|
||||||
_Alpha = 0
|
_Alpha = 0
|
||||||
_OnShow = True
|
_OnShow = True
|
||||||
@ -81,11 +79,7 @@ class PageSelector:
|
|||||||
if self._IconSurf != None:
|
if self._IconSurf != None:
|
||||||
self._Parent._CanvasHWND.blit(self._IconSurf,rect)
|
self._Parent._CanvasHWND.blit(self._IconSurf,rect)
|
||||||
|
|
||||||
class Page(object):
|
class Page(Widget):
|
||||||
_PosX=0
|
|
||||||
_PosY=0
|
|
||||||
_Width=0
|
|
||||||
_Height=0
|
|
||||||
_Icons = []
|
_Icons = []
|
||||||
_Ps = None
|
_Ps = None
|
||||||
_PsIndex = 0
|
_PsIndex = 0
|
||||||
@ -580,6 +574,35 @@ class Page(object):
|
|||||||
for i in range(0, len(self._MyList)):
|
for i in range(0, len(self._MyList)):
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
self._MyList[i]._PosY += self._MyList[i]._Height
|
||||||
|
|
||||||
|
def FScrollUp(self,Step=1):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
tmp = self._PsIndex
|
||||||
|
self._PsIndex -= Step
|
||||||
|
|
||||||
|
if self._PsIndex < 0:
|
||||||
|
self._PsIndex = 0
|
||||||
|
dy = tmp-self._PsIndex
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._PosY < 0:
|
||||||
|
for i in range(0, len(self._MyList)):
|
||||||
|
self._MyList[i]._PosY += self._MyList[i]._Height*dy
|
||||||
|
|
||||||
|
|
||||||
|
def FScrollDown(self,Step=1):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
tmp = self._PsIndex
|
||||||
|
self._PsIndex +=Step
|
||||||
|
if self._PsIndex >= len(self._MyList):
|
||||||
|
self._PsIndex = len(self._MyList) -1
|
||||||
|
dy = self._PsIndex - tmp
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._PosY +cur_li._Height > self._Height:
|
||||||
|
for i in range(0,len(self._MyList)):
|
||||||
|
self._MyList[i]._PosY -= self._MyList[i]._Height*dy
|
||||||
|
|
||||||
|
|
||||||
def KeyDown(self,event):##default keydown,every inherited page class should have it's own KeyDown
|
def KeyDown(self,event):##default keydown,every inherited page class should have it's own KeyDown
|
||||||
if event.key == CurKeys["A"]:
|
if event.key == CurKeys["A"]:
|
||||||
if self._FootMsg[3] == "Back":
|
if self._FootMsg[3] == "Back":
|
||||||
|
|||||||
@ -11,12 +11,9 @@ from UI.page import Page,PageStack,PageSelector
|
|||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
from UI.fonts import fonts
|
||||||
from UI.skin_manager import MySkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.widget import Widget
|
||||||
|
|
||||||
class Textarea:
|
class Textarea(Widget):
|
||||||
_PosX =0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 0
|
|
||||||
_BackgroundColor = MySkinManager.GiveColor('TitleBg')
|
_BackgroundColor = MySkinManager.GiveColor('TitleBg')
|
||||||
_CanvasHWND = None
|
_CanvasHWND = None
|
||||||
_MyWords = []
|
_MyWords = []
|
||||||
|
|||||||
@ -19,7 +19,7 @@ from multi_icon_item import MultiIconItem
|
|||||||
from icon_pool import MyIconPool
|
from icon_pool import MyIconPool
|
||||||
from lang_manager import MyLangManager
|
from lang_manager import MyLangManager
|
||||||
from util_funcs import midRect,SwapAndShow,SkinMap
|
from util_funcs import midRect,SwapAndShow,SkinMap
|
||||||
|
from widget import Widget
|
||||||
from config import Battery
|
from config import Battery
|
||||||
|
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
@ -27,9 +27,7 @@ from libs.roundrects import aa_round_rect
|
|||||||
from libs.DBUS import is_wifi_connected_now,wifi_strength
|
from libs.DBUS import is_wifi_connected_now,wifi_strength
|
||||||
|
|
||||||
icon_base_path = SkinMap("gameshell/titlebar_icons/")
|
icon_base_path = SkinMap("gameshell/titlebar_icons/")
|
||||||
class TitleBar:
|
class TitleBar(Widget):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = Width
|
_Width = Width
|
||||||
_Height = 25
|
_Height = 25
|
||||||
_BarHeight = 24.5
|
_BarHeight = 24.5
|
||||||
|
|||||||
26
sys.py/UI/widget.py
Normal file
26
sys.py/UI/widget.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
class Widget:
|
||||||
|
_PosX =0
|
||||||
|
_PosY = 0
|
||||||
|
_Width = 0
|
||||||
|
_Height = 0
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def NewCoord(self,x,y):
|
||||||
|
self._PosX = x
|
||||||
|
self._PosY = y
|
||||||
|
|
||||||
|
def Coord(self):
|
||||||
|
return self._PosX,self._PosY
|
||||||
|
|
||||||
|
def Width(self):
|
||||||
|
return self._Width
|
||||||
|
|
||||||
|
def Height(self):
|
||||||
|
return self._Height
|
||||||
|
|
||||||
|
def Size(self):
|
||||||
|
return self._Width,self._Height
|
||||||
Loading…
x
Reference in New Issue
Block a user