Compare commits

..

No commits in common. "master" and "1.22" have entirely different histories.
master ... 1.22

260 changed files with 1492 additions and 12355 deletions

27
.cpirc
View File

@ -1,27 +0,0 @@
SCREEN=`cat /sys/class/graphics/fb0/modes`
XORG_CONF="~/launcher/.xorg.conf"
if [ -f /home/cpi/.lima ]
then
XORG_CONF="~/launcher/.xorg_lima.conf"
fi
if [ -f /tmp/autologin ]
then
rm -f /tmp/autologin
mpd ~/.mpd.conf
if [[ $SCREEN =~ .*320.* ]]
then
while :
do
startx /home/cpi/launcher/.xinitrc -- -xf86config $XORG_CONF -nocursor > /tmp/x.log 2>&1
sleep 1
done
else
while :
do
startx /home/cpi/launcher/.xinitrc hdmi -- -xf86config $XORG_CONF > /tmp/x.log 2>&1
sleep 1
done
fi
fi

15
.gitignore vendored
View File

@ -5,21 +5,6 @@ retroarch-core-options.cfg
*.pyc
sys.py/.powerlevel
sys.py/.buttonslayout
sys.py/.lang
*.cfg
**/Jobs/*
!**/Jobs/.gitkeep
!**/Jobs/00_lowpower.sh
!**/Jobs/00_lowpower.alias
.done
bios
bios/*
screenshots
screenshots/*
.pcsx
.pcsx/*
*.log
.DS_Store
sys.py/.*
sys.py/*.db
launcher.sublime-workspace

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "sys.py/pyaria2_rpc"]
path = sys.py/pyaria2_rpc
url = https://github.com/cuu/pyaria2_rpc.git

View File

@ -1,38 +0,0 @@
#define Bach_width 51
#define Bach_height 60
static unsigned char Bach_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe,
0xf3, 0x07, 0x00, 0xf8, 0x00, 0x80, 0xff, 0xff, 0x1f, 0x00, 0xf8, 0x00,
0xe0, 0xff, 0xff, 0x3f, 0x00, 0xf8, 0x00, 0xf0, 0xff, 0xff, 0x7f, 0x00,
0xf8, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00, 0xf8, 0x00, 0xf8, 0xff, 0xff,
0xff, 0x01, 0xf8, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0xf8, 0x00, 0xfe,
0xff, 0xff, 0xff, 0x03, 0xf8, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x07, 0xf8,
0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf8, 0x80, 0xff, 0xff, 0xff, 0xbf,
0x07, 0xf8, 0x80, 0xff, 0xff, 0xff, 0x7f, 0x0f, 0xf8, 0x80, 0xff, 0xff,
0xff, 0x3f, 0x0f, 0xf8, 0xc0, 0xff, 0xff, 0xff, 0x3f, 0x06, 0xf8, 0xc0,
0xff, 0xff, 0xff, 0x3f, 0x0e, 0xf8, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x1e,
0xf8, 0xc0, 0xff, 0xff, 0xff, 0x7f, 0x1c, 0xf8, 0xc0, 0xff, 0xff, 0xff,
0x7f, 0x3c, 0xf8, 0xc0, 0xff, 0xff, 0xff, 0x1f, 0x3c, 0xf8, 0xc0, 0xff,
0xff, 0xf8, 0x0f, 0x38, 0xf8, 0xc0, 0xff, 0xff, 0xc7, 0x23, 0x38, 0xf8,
0xe0, 0xff, 0xff, 0xc3, 0x01, 0x38, 0xf8, 0xe0, 0xff, 0xff, 0xf9, 0x03,
0x38, 0xf8, 0xe0, 0xff, 0xff, 0xff, 0x3b, 0x18, 0xf8, 0xc0, 0xff, 0xfb,
0xff, 0x33, 0x00, 0xf8, 0xc0, 0xff, 0xff, 0xff, 0xf7, 0x30, 0xf8, 0xe0,
0xff, 0xfd, 0xff, 0xe7, 0x00, 0xf8, 0xe0, 0xff, 0xfd, 0xff, 0x6f, 0x30,
0xf8, 0xc0, 0xff, 0xfc, 0xff, 0x67, 0x00, 0xf8, 0x80, 0xff, 0xfc, 0x7f,
0xc0, 0x00, 0xf8, 0xc0, 0xff, 0xf8, 0xff, 0x41, 0x00, 0xf8, 0xc0, 0xff,
0xf8, 0xff, 0x03, 0x00, 0xf8, 0x80, 0x7c, 0xf8, 0xff, 0x07, 0x00, 0xf8,
0x00, 0x7e, 0xf8, 0xff, 0x43, 0x00, 0xf8, 0x00, 0x7e, 0xf8, 0x0f, 0x00,
0x00, 0xf8, 0x00, 0x37, 0xf0, 0xff, 0x07, 0x00, 0xf8, 0x00, 0x63, 0xf0,
0xff, 0x01, 0x00, 0xf8, 0x00, 0x27, 0xf0, 0xff, 0x07, 0x00, 0xf8, 0x00,
0x06, 0xe0, 0xff, 0x0f, 0x00, 0xf8, 0x00, 0x02, 0x40, 0xff, 0x0f, 0x00,
0xf8, 0x00, 0x00, 0x90, 0xf1, 0x07, 0x00, 0xf8, 0x00, 0x00, 0x30, 0xff,
0x01, 0x00, 0xf8, 0x00, 0x00, 0xf0, 0x7e, 0x00, 0x00, 0xf8, 0x00, 0x00,
0xf0, 0x7b, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf8,
0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xe0, 0xff, 0x01,
0x00, 0xf8, 0x00, 0x00, 0xe0, 0xff, 0x0f, 0x00, 0xf8, 0x00, 0x00, 0xc0,
0xff, 0x0f, 0x00, 0xf8, 0x00, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xf8, 0x00,
0x00, 0x80, 0xff, 0x03, 0x00, 0xf8, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00,
0xf8, 0x00, 0x00, 0x80, 0xff, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x7f,
0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0xf8, 0x00, 0x00,
0x00, 0x1f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0xf8};

View File

@ -1,62 +0,0 @@
#define Escher_width 101
#define Escher_height 54
static unsigned char Escher_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x01, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xc0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x07, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x7f, 0x06, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x06, 0x00, 0x00, 0x00, 0xe0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x02, 0x00, 0x00, 0x00, 0xe0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0x00, 0x00,
0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xbf, 0x80, 0x7f, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0xfe, 0xff, 0x0f,
0x00, 0x00, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xe0, 0xff, 0xff,
0x7f, 0x00, 0x00, 0xe0, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x7f,
0x7f, 0xfc, 0x03, 0x00, 0xe0, 0xf8, 0x07, 0x00, 0x00, 0xc0, 0x87, 0xff,
0x6f, 0x5f, 0xee, 0x0f, 0x00, 0xe0, 0xf8, 0x1f, 0x00, 0x00, 0xf0, 0xf1,
0xff, 0xf9, 0xe9, 0xfc, 0x3e, 0x00, 0xe0, 0xf8, 0x3f, 0x00, 0x00, 0x3c,
0xf8, 0xaf, 0xe8, 0x1d, 0xe0, 0x70, 0x00, 0xe0, 0xf8, 0x7f, 0x00, 0x00,
0x3e, 0xbf, 0xac, 0x88, 0x1f, 0x00, 0x3e, 0x00, 0xe0, 0xf0, 0x0f, 0x00,
0x00, 0x97, 0x3f, 0xac, 0xc2, 0x81, 0x01, 0xbf, 0x03, 0xe0, 0xf0, 0x1f,
0x00, 0xc0, 0xe7, 0xa3, 0x00, 0xca, 0x15, 0x80, 0xc7, 0x07, 0xe0, 0xe0,
0x1f, 0x00, 0x80, 0xf1, 0x02, 0x4a, 0x88, 0x50, 0x80, 0xe3, 0x0c, 0xe0,
0xc0, 0x1f, 0x1c, 0x00, 0x3c, 0x08, 0x28, 0x55, 0x20, 0xc0, 0xf1, 0x3f,
0xe0, 0xc0, 0x1f, 0xf0, 0x80, 0x0f, 0x68, 0x51, 0x50, 0xb4, 0xe0, 0xb1,
0x7e, 0xe0, 0x80, 0x1f, 0xc0, 0xff, 0x03, 0x80, 0x54, 0x29, 0x00, 0xe8,
0xb9, 0xfc, 0xe0, 0x00, 0x3f, 0x82, 0x3f, 0x28, 0x15, 0x00, 0x20, 0x2a,
0xe0, 0xb9, 0xe7, 0xe1, 0x00, 0x3e, 0x0a, 0x20, 0x00, 0x00, 0x00, 0x00,
0xe0, 0xe2, 0x79, 0xb3, 0xe3, 0x00, 0x3e, 0x80, 0x00, 0x40, 0x08, 0x80,
0x40, 0x01, 0xe0, 0xf9, 0xb8, 0xe3, 0x00, 0x3e, 0x01, 0x00, 0x50, 0x08,
0x00, 0x08, 0x40, 0xe0, 0xf9, 0xff, 0xe1, 0x00, 0x3e, 0x01, 0x00, 0x00,
0x00, 0x50, 0x81, 0xf0, 0xc3, 0xf9, 0xee, 0xe0, 0x00, 0x1e, 0x02, 0x08,
0x0a, 0x01, 0x00, 0x20, 0xf0, 0xc7, 0xfb, 0x7f, 0xe2, 0x00, 0x0f, 0x02,
0xbc, 0x03, 0x00, 0x0a, 0x00, 0xf0, 0xc1, 0xfb, 0xbf, 0xe3, 0x80, 0x07,
0xf0, 0xff, 0xc3, 0x02, 0x80, 0x41, 0xf1, 0x81, 0xf7, 0xf7, 0xe1, 0x80,
0x07, 0x3c, 0xc0, 0xbf, 0x5c, 0x09, 0x40, 0xf0, 0x83, 0xff, 0x7f, 0xe0,
0xc0, 0x13, 0x00, 0x00, 0xf8, 0x0f, 0x80, 0x92, 0xf0, 0x0f, 0x0f, 0x3e,
0xe0, 0xe0, 0x1f, 0x00, 0x00, 0xe3, 0x5f, 0x21, 0x16, 0xe0, 0x2f, 0xfe,
0x17, 0xe0, 0xf0, 0x1f, 0x00, 0x80, 0x01, 0xfe, 0x27, 0x0e, 0xe0, 0x27,
0xf8, 0x10, 0xe0, 0xf0, 0x07, 0x00, 0x80, 0x1b, 0xf0, 0x07, 0xe8, 0x8a,
0x15, 0x02, 0x00, 0xe0, 0xf8, 0x03, 0x00, 0x80, 0x1f, 0x80, 0xff, 0x6a,
0x00, 0xc0, 0x01, 0x00, 0xe0, 0xf8, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0xf8,
0x3f, 0xfe, 0x7f, 0x00, 0x00, 0xe0, 0xf8, 0x07, 0x00, 0x00, 0x47, 0x00,
0x00, 0x1c, 0xfc, 0x0f, 0x00, 0x00, 0xe0, 0xf8, 0x01, 0x00, 0x00, 0x3f,
0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf8, 0x00, 0x00, 0x00,
0x3e, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
0x00, 0x1c, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x08, 0x00, 0x00, 0x00, 0xe0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x00, 0x00, 0x00, 0xe0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 0x00,
0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00,
0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00,
0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0};

View File

@ -1,46 +0,0 @@
#define Linux64_width 64
#define Linux64_height 64
static unsigned char Linux64_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x0f, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x1f, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01,
0xc0, 0xff, 0x00, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0xfe, 0x01, 0x00,
0x00, 0xc0, 0x1f, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xc0, 0x1f, 0x00,
0x00, 0xf8, 0x01, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0xfc, 0x01, 0x00,
0x00, 0x80, 0x7f, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7f, 0x00, 0x00,
0x00, 0x00, 0xfe, 0x01, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03,
0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xc0, 0x7f, 0x00, 0x00,
0x00, 0x00, 0xfc, 0x07, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07,
0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0xe0, 0x3f, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x0f, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f,
0xf0, 0x3f, 0x00, 0x00, 0xe0, 0x01, 0xf0, 0x1f, 0xf0, 0x3f, 0xe0, 0x00,
0xf8, 0x01, 0xf0, 0x1f, 0xf0, 0x3f, 0xf0, 0x01, 0xfc, 0x03, 0xf0, 0x1f,
0xf0, 0x3f, 0xf8, 0x03, 0xfe, 0x03, 0xf0, 0x1f, 0xf8, 0x7f, 0x18, 0x07,
0x0f, 0x07, 0xf0, 0x3f, 0xf8, 0x7f, 0x08, 0x07, 0x47, 0x0e, 0xf0, 0x3f,
0xf8, 0x7f, 0x08, 0x06, 0x07, 0x0e, 0xf0, 0x3f, 0xf8, 0x7f, 0x88, 0x06,
0x07, 0x0e, 0xf0, 0x3f, 0xf8, 0x7f, 0x08, 0x06, 0x06, 0x0e, 0xf0, 0x3f,
0xf8, 0x7f, 0x08, 0xfe, 0x04, 0x0e, 0xf0, 0x3f, 0xf8, 0x7f, 0x18, 0x7c,
0x06, 0x0e, 0xf0, 0x3f, 0xf8, 0xff, 0x30, 0xff, 0x9f, 0x07, 0xf0, 0x3f,
0xf8, 0xff, 0x90, 0xff, 0x7f, 0x03, 0xf0, 0x3f, 0xf0, 0xff, 0xc0, 0xff,
0xff, 0x03, 0xe0, 0x1f, 0xf0, 0xff, 0xc0, 0xff, 0xff, 0x07, 0xe0, 0x1f,
0xf0, 0xff, 0xe0, 0xff, 0xff, 0x07, 0xe0, 0x1f, 0xf0, 0xff, 0xe0, 0xff,
0x7f, 0x06, 0xe0, 0x1f, 0xe0, 0xff, 0xe0, 0xff, 0x9f, 0x07, 0xe0, 0x0f,
0xe0, 0xff, 0xe0, 0xff, 0xcf, 0x07, 0xc0, 0x0f, 0xe0, 0xff, 0xc1, 0xff,
0xf3, 0x01, 0xc0, 0x0f, 0xc0, 0xff, 0x01, 0x7f, 0x7c, 0x0c, 0xc0, 0x07,
0xc0, 0xff, 0x19, 0x80, 0x9f, 0x0f, 0x80, 0x07, 0x80, 0xff, 0x39, 0xfc,
0xc7, 0x0f, 0x00, 0x03, 0x80, 0xff, 0x78, 0x78, 0xf0, 0x1f, 0x00, 0x03,
0x00, 0x7f, 0xf8, 0x00, 0xf8, 0x1f, 0x80, 0x01, 0x00, 0x3e, 0xf8, 0x03,
0xfe, 0x3f, 0x80, 0x01, 0x00, 0x3e, 0xf8, 0xff, 0xff, 0x3f, 0xc0, 0x00,
0x00, 0x1c, 0xf8, 0xff, 0xff, 0x7f, 0x60, 0x00, 0x00, 0x18, 0xfc, 0xff,
0xff, 0x7f, 0x30, 0x00, 0x00, 0x30, 0xfc, 0xff, 0xff, 0xff, 0x18, 0x00,
0x00, 0x60, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x00, 0xc0, 0xff, 0xff,
0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff,
0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x0f, 0x00, 0x00,
0x00, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

14
.twm/am
View File

@ -1,14 +0,0 @@
#define am_width 32
#define am_height 32
static unsigned char am_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x7f, 0x1f, 0x00, 0x7c,
0x63, 0x3f, 0x00, 0x7e, 0x63, 0x7f, 0x00, 0x7f, 0x63, 0xff, 0x80, 0x7f,
0x63, 0xff, 0xc1, 0x7f, 0x00, 0xff, 0xe3, 0x7f, 0x00, 0xff, 0xf7, 0x7f,
0x00, 0xef, 0xff, 0x7b, 0x00, 0xcf, 0xff, 0x79, 0x00, 0x8f, 0xff, 0x78,
0x00, 0x0f, 0x7f, 0x78, 0x00, 0x0f, 0x3e, 0x78, 0x00, 0x0f, 0x1c, 0x78,
0x00, 0x0f, 0x08, 0x78, 0x00, 0x0f, 0x00, 0x78, 0x00, 0x0f, 0x00, 0x78,
0x00, 0x0f, 0x00, 0x78, 0x00, 0x0f, 0x00, 0x78, 0x00, 0x0f, 0x00, 0x78,
0x00, 0x0e, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,52 +0,0 @@
#define Untitled_width 57
#define Untitled_height 73
static unsigned char Untitled_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xf0,
0x07, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00,
0x00, 0x1f, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0xf8,
0x03, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00,
0x00, 0xfc, 0x01, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc,
0x03, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x4f, 0xfe, 0x03, 0x00, 0x00, 0x00,
0x00, 0xf8, 0xdf, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x9f, 0xff,
0x01, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff,
0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x9f,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0x1f, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x8e, 0x0f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0f,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x3f, 0x06, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc6, 0x7e, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x3e,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0x1f, 0x0e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0e, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xff,
0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x3f, 0x00, 0x00, 0x00,
0x00, 0x00, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x80, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff,
0xff, 0xff, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0xff, 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff,
0xff, 0xff, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00,
0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff,
0xff, 0xff, 0x01, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x01, 0x00,
0x00, 0x1f, 0xfe, 0xff, 0xff, 0x40, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff,
0xff, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00,
0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xfc, 0xff, 0xff, 0xff,
0xff, 0xff, 0x7f, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00,
0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf8, 0xff, 0xff, 0xff,
0xff, 0xff, 0x7f, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00,
0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0xf8, 0xff, 0x07, 0xff,
0xfb, 0xff, 0x7f, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00,
0xf0, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

View File

@ -1,5 +0,0 @@
#define close_width 11
#define close_height 11
static unsigned char close_bits[] = {
0x00, 0x00, 0x06, 0x03, 0x8e, 0x03, 0xdc, 0x01, 0xf8, 0x00, 0x70, 0x00,
0xf8, 0x00, 0xdc, 0x01, 0x8e, 0x03, 0x06, 0x03, 0x00, 0x00};

14
.twm/ff
View File

@ -1,14 +0,0 @@
#define ff_width 32
#define ff_height 32
static unsigned char ff_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f,
0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x1f,
0xe0, 0xff, 0x3f, 0x1f, 0xf0, 0xff, 0x3f, 0x03, 0xf0, 0xff, 0x3f, 0x1f,
0xf0, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0xf0, 0xff, 0x0f, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0xf0, 0xff, 0x0f, 0x00,
0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
0xf0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,5 +0,0 @@
#define fullsize_width 11
#define fullsize_height 11
static unsigned char fullsize_bits[] = {
0x00, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xfc, 0x01, 0x00, 0x00};

View File

@ -1,5 +0,0 @@
#define icon_width 11
#define icon_height 11
static unsigned char icon_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0x02, 0x02, 0x02, 0x02,
0xfe, 0x03, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,28 +0,0 @@
#define moose_width 45
#define moose_height 49
static unsigned char moose_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00,
0x00, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00,
0x00, 0xfc, 0xff, 0x07, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x00,
0x00, 0x1f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x0f, 0x00, 0x00,
0x00, 0x07, 0xf1, 0x03, 0x00, 0x00, 0x00, 0x87, 0x71, 0x00, 0x00, 0x00,
0x00, 0xb7, 0x70, 0x00, 0x00, 0x00, 0x00, 0x57, 0x70, 0x00, 0x00, 0x00,
0x00, 0xe7, 0x71, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x71, 0x00, 0x00, 0x00,
0x00, 0x3f, 0x78, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00,
0xc0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x7f, 0x00, 0x00, 0x00,
0xf8, 0xff, 0xf1, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0xf0, 0x51, 0x00, 0x00,
0xbe, 0x3f, 0xe0, 0xff, 0x03, 0x00, 0x3e, 0x3f, 0xc0, 0xff, 0x07, 0x00,
0x1e, 0x3d, 0xc0, 0xff, 0x0f, 0x00, 0x9e, 0x3c, 0xc0, 0xff, 0x1f, 0x08,
0x5e, 0x3e, 0xc0, 0xff, 0xff, 0x07, 0x7c, 0x3e, 0xe0, 0xff, 0xff, 0x01,
0xf8, 0x3f, 0xf0, 0xff, 0x7f, 0x00, 0xf0, 0x1f, 0xf8, 0xff, 0x3f, 0x00,
0xe0, 0x0f, 0xff, 0xff, 0x3f, 0x00, 0x80, 0x87, 0xff, 0xff, 0x1f, 0x00,
0x00, 0xc0, 0xe3, 0xff, 0x1f, 0x00, 0x00, 0xc0, 0xfb, 0xff, 0x1f, 0x00,
0x00, 0xc0, 0x7d, 0xf8, 0x0f, 0x00, 0x00, 0xe0, 0x3c, 0xf8, 0x07, 0x00,
0x00, 0xf8, 0x0c, 0xf8, 0x07, 0x00, 0x00, 0xfc, 0x1c, 0x98, 0x03, 0x00,
0x00, 0xdc, 0x1c, 0x98, 0x03, 0x00, 0x00, 0xf8, 0x3c, 0x38, 0x07, 0x00,
0x00, 0x70, 0x3c, 0x78, 0x1f, 0x00, 0x00, 0x00, 0x6c, 0xf8, 0xfe, 0x00,
0x00, 0x00, 0x6e, 0xf0, 0xfd, 0x00, 0x00, 0x00, 0x3e, 0xb0, 0xfb, 0x00,
0x00, 0x00, 0x0c, 0xe0, 0x79, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,14 +0,0 @@
#define mozilla_width 32
#define mozilla_height 32
static unsigned char mozilla_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x3f, 0x02, 0xf0, 0xff, 0x7f,
0x01, 0xe2, 0xff, 0xff, 0xd9, 0xc4, 0xff, 0xff, 0xd9, 0x88, 0xff, 0xff,
0x5b, 0x16, 0xff, 0xff, 0x2f, 0x76, 0xfc, 0xff, 0x4f, 0xe4, 0xe0, 0xff,
0x19, 0xff, 0x87, 0xff, 0x31, 0xf8, 0x1f, 0xfe, 0xe3, 0xff, 0x7f, 0xf8,
0x83, 0xff, 0xff, 0xe1, 0x07, 0xff, 0xff, 0xc7, 0x0d, 0xfe, 0xff, 0x87,
0x0d, 0xfc, 0xff, 0x83, 0x09, 0xf0, 0xff, 0x81, 0x01, 0xe0, 0xff, 0x81,
0x01, 0xc0, 0xff, 0x93, 0x01, 0x00, 0xff, 0xb3, 0x01, 0x00, 0xfc, 0xbf,
0x01, 0x20, 0xe0, 0xbf, 0x03, 0x00, 0x00, 0x9c, 0x07, 0x00, 0x04, 0x80,
0x1f, 0x00, 0x18, 0x80, 0xff, 0x03, 0x40, 0xc1, 0xff, 0x3b, 0x00, 0xc0,
0x3f, 0xe0, 0x03, 0xe0, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x1c, 0xf8,
0x02, 0x80, 0xff, 0x7f, 0xfc, 0xff, 0xff, 0x3f};

View File

@ -1,5 +0,0 @@
#define resize_width 11
#define resize_height 11
static unsigned char resize_bits[] = {
0x00, 0x00, 0xfc, 0x00, 0x02, 0x01, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03,
0x02, 0x03, 0x02, 0x03, 0xfc, 0x03, 0xf8, 0x01, 0x00, 0x00};

View File

@ -1,27 +0,0 @@
#define torrent_width 48
#define torrent_height 48
static unsigned char torrent_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x0f,
0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x0f,
0x80, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01,
0xe0, 0xff, 0xff, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

14
.twm/tv
View File

@ -1,14 +0,0 @@
#define Untitled_width 32
#define Untitled_height 32
static unsigned char Untitled_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1c, 0x00,
0x00, 0x36, 0x3e, 0x00, 0x00, 0x32, 0x33, 0x00, 0x00, 0x26, 0x1b, 0x00,
0x00, 0x6c, 0x19, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00,
0x80, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0x01, 0xe0, 0x07,
0xe0, 0x00, 0xc0, 0x07, 0xe0, 0x0c, 0xc6, 0x07, 0xe0, 0x0c, 0xc6, 0x07,
0xe0, 0x00, 0xc0, 0x07, 0xe0, 0x00, 0xc0, 0x07, 0xe0, 0x00, 0xc0, 0x07,
0xe0, 0xf0, 0xc3, 0x07, 0xe0, 0xe0, 0xc1, 0x07, 0xe0, 0x00, 0x20, 0x06,
0xe0, 0x01, 0x20, 0x06, 0xe0, 0xff, 0x3f, 0x06, 0xe0, 0xff, 0xff, 0x07,
0xc0, 0xff, 0xff, 0x03, 0x80, 0xff, 0xff, 0x00, 0x00, 0x03, 0x20, 0x00,
0x00, 0x03, 0x60, 0x00, 0x80, 0x03, 0x60, 0x00, 0x00, 0x01, 0xc0, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

View File

@ -1,14 +0,0 @@
#define xlogo32_width 32
#define xlogo32_height 32
static unsigned char xlogo32_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfc, 0x03, 0x00, 0x20, 0xf8, 0x07, 0x00, 0x30, 0xf8, 0x07, 0x00, 0x18,
0xf0, 0x0f, 0x00, 0x0c, 0xe0, 0x1f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x06,
0xc0, 0x3f, 0x00, 0x03, 0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00,
0x00, 0xfe, 0x61, 0x00, 0x00, 0xfe, 0x31, 0x00, 0x00, 0xfc, 0x33, 0x00,
0x00, 0xf8, 0x1b, 0x00, 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xf0, 0x0e, 0x00,
0x00, 0x60, 0x1f, 0x00, 0x00, 0xb0, 0x3f, 0x00, 0x00, 0x98, 0x7f, 0x00,
0x00, 0x98, 0x7f, 0x00, 0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01,
0x00, 0x03, 0xfc, 0x03, 0x80, 0x01, 0xfc, 0x03, 0xc0, 0x00, 0xf8, 0x07,
0xc0, 0x00, 0xf0, 0x0f, 0x60, 0x00, 0xe0, 0x1f, 0x30, 0x00, 0xe0, 0x1f,
0x18, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00};

140
.twmrc
View File

@ -1,140 +0,0 @@
#---------------------------------
# CPI # PROJ. : twmrc
# # FILE : .twmrc
# + # VER. : 20170828.0718UTC
# + # EMAIL : hal@clockworkpi.com
# +++ # HOST : clockworkpi.com
#---------------------------------
NoGrabServer
RestartPreviousState
DecorateTransients
RandomPlacement
BorderWidth 1
NoHighlight
OpaqueMove
MenuBorderWidth 1
NoMenuShadows
NoDefaults
LeftTitleButton "~/launcher/.twm/close" = f.delete
RightTitleButton "~/launcher/.twm/iconify" = f.iconify
RightTitleButton "~/launcher/.twm/resize" = f.resize
RightTitleButton "~/launcher/.twm/fullsize" = f.fullzoom
TitleFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
ResizeFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
MenuFont "-misc-fixed-medium-r-semicondensed-*-*-120-*-*-c-*-iso8859-8"
IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
IconManagerFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*"
Color
{
BorderColor "grey30"
DefaultBackground "rgb:5/5/5"
DefaultForeground "gray80"
TitleBackground "rgb:5/5/5"
TitleForeground "gray80"
MenuBackground "rgb:5/5/5"
MenuForeground "gray80"
MenuTitleBackground "gray80"
MenuTitleForeground "rgb:5/5/5"
MenuBorderColor "gray60"
IconBackground "rgb:4/4/4"
IconForeground "gray80"
IconBorderColor "gray70"
IconManagerBackground "rgb:5/5/5"
IconManagerForeground "gray80"
}
Cursors
{
Menu "hand2"
}
ForceIcons
Icons
{
"Chrome" "~/launcher/.twm/chrome.xbm"
"xterm" "~/launcher/.twm/xlogo32"
}
MoveDelta 3
Function "move-or-lower" { f.move f.deltastop f.lower }
Function "move-or-raise" { f.move f.deltastop f.raise }
Function "move-or-iconify" { f.move f.deltastop f.iconify }
Button1 = : root : f.menu "main"
Button3 = : root : f.menu "exec"
Button1 = m : window|icon : f.function "move-or-raise"
Button2 = m : window|icon : f.iconify
Button3 = m : window|icon : f.resize
Button1 = : title : f.function "move-or-raise"
Button2 = : title : f.raiselower
Button1 = : icon : f.function "move-or-iconify"
Button2 = : icon : f.iconify
Button1 = : iconmgr : f.iconify
Button2 = : iconmgr : f.iconify
NoTitle
{
"gkrellm"
}
menu "main"
{
"CLOCKWORKPI" f.title
"Raise" f.raise
"Lower" f.lower
"Focus" f.focus
"Unfocus" f.unfocus
"-------------" f.nop
"Show Iconmgr" f.showiconmgr
"Hide Iconmgr" f.hideiconmgr
"Kill" f.destroy
"-------------" f.nop
"Restart" f.restart
"Exit" ("gray80":"#773333") f.menu "exit"
}
menu "exit"
{
"Are you sure ?" ("gray80":"#773333") f.title
"No" f.nop
"Yes" f.quit
}
menu "exec"
{
":: Applications ::" f.title
"Xterm" ("gray80":"#334455") f.exec "exec /usr/bin/xterm &"
"Xterm Orange" ("gray80":"#aa5522") f.exec "exec /usr/bin/xterm -fg '#dc8700' &"
"Xmag" f.exec "exec /usr/bin/xmag &"
"Gkrellm" f.exec "/usr/bin/gkrellm &"
"XClock" f.exec "exec /usr/bin/xclock &"
"XFig" f.exec "exec /usr/bin/xfig -nosplash &"
"Wicd client" f.exec "exec /usr/bin/wicd-client -n &"
"xpdf" f.exec "exec /usr/bin/xpdf &"
}
WindowRing
{
"xterm"
"xpdf"
}
"r" = m | c: all : f.exec "exec /usr/bin/xterm -fg '#dc8700' &"
"s" = m | c: all : f.exec "exec /usr/bin/alsamixergui &"
"t" = m | c: all : f.exec "exec /usr/bin/xterm +sb &"
"w" = m | c: all : f.exec "exec /usr/bin/wicd-client -n &"
"i" = m | s: all : f.iconify
"x" = m | s: all : f.delete
"F12" = m : all : f.fullzoom
"Tab" = m : all : f.warpring "next"

View File

@ -1,25 +0,0 @@
session=${1:-gameshell}
case $session in
hdmi )
exec aria2c --conf-path=/home/cpi/launcher/aria2.conf &
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/desktopbg.jpg
cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
exec ~/launcher/load.sh &
exec ~/launcher/sys.py/gsnotify/gsnotify-arm daemon &
#exec /usr/bin/twm -f ~/launcher/.twmrc
exec ~/launcher/dwm-mod
;;
gameshell )
exec aria2c --conf-path=/home/cpi/launcher/aria2.conf &
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png
cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
exec ~/launcher/load.sh &
exec ~/launcher/sys.py/gsnotify/gsnotify-arm &
#exec awesome -c ~/launcher/awesome/rc.lua
exec ~/launcher/dwm-mod -w
;;
*)
exec $1;;
esac

View File

@ -1,7 +0,0 @@
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection

View File

@ -1,7 +0,0 @@
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "modesetting"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection

View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -12,16 +12,15 @@ from libs.roundrects import aa_round_rect
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect,FileExists
from UI.keys_def import CurKeys, IsKeyMenuOrB
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys
from UI.scroller import ListScroller
from UI.icon_pool import MyIconPool
from UI.multi_icon_item import MultiIconItem
from UI.icon_item import IconItem
from UI.multilabel import MultiLabel
from UI.lang_manager import MyLangManager
from UI.skin_manager import MySkinManager
from config import VERSION
class InfoPageListItem(object):
_PosX = 0
@ -80,7 +79,7 @@ class InfoPageListItem(object):
class AboutPage(Page):
_FootMsg = ["Nav.","","","Back",""]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela13")
_ListFontObj = fonts["varela13"]
_AList = {}
@ -208,32 +207,7 @@ class AboutPage(Page):
memory["value"] = str( int(parts[1].strip())/1000.0) +" MB"
self._AList["memory"] = memory
break
def LauncherVersion(self):
launcher_version = {}
launcher_version["key"] = "launcher_ver"
launcher_version["label"] = "Launcher:"
launcher_version["value"] = VERSION
self._AList["launcher_ver"] = launcher_version
def OsImageVersion(self):
if FileExists("/etc/clockworkpi_os_image_version"):
try:
with open("/etc/clockworkpi_os_image_version") as f:
content = f.readlines()
content = [x.strip() for x in content]
except:
print("open %s failed" % "/etc/clockworkpi_os_image_version")
content = None
if content != None and len(content) > 0:
os_image_ver = {}
os_image_ver["key"] = "os_image_ver"
os_image_ver["label"] = "OS Image:"
os_image_ver["value"] = content[0][:12]
self._AList["os_image_ver"] = os_image_ver
def GenList(self):
self._MyList = []
@ -242,7 +216,7 @@ class AboutPage(Page):
start_y = 10
last_height = 0
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname","launcher_ver","os_image_ver"] ):
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname"] ):
#for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
if u not in self._AList:
continue
@ -255,7 +229,7 @@ class AboutPage(Page):
li._PosY = start_y + last_height
li._Width = Width
li._Fonts["normal"] = self._ListFontObj
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
li._Fonts["small"] = fonts["varela12"]
if self._AList[u]["label"] != "":
li.Init( self._AList[u]["label"] )
@ -274,14 +248,14 @@ class AboutPage(Page):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._HWND = self._Screen._CanvasHWND
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight+50) )
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
bgpng = MultiIconItem()
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
bgpng = IconItem()
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
bgpng._MyType = ICON_TYPES["STAT"]
bgpng._Parent = self
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
@ -293,9 +267,6 @@ class AboutPage(Page):
self.CpuMhz()
self.Uname()
self.LauncherVersion()
self.OsImageVersion()
self.GenList()
self._Scroller = ListScroller()
@ -307,7 +278,7 @@ class AboutPage(Page):
def ScrollDown(self):
dis = 10
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 100:
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 50:
self._PosY -= dis
self._Scrolled -= dis
@ -329,7 +300,7 @@ class AboutPage(Page):
self._Screen.SwapAndShow()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
@ -350,19 +321,16 @@ class AboutPage(Page):
self.ClearCanvas()
#self._Ps.Draw()
self._Icons["bg"].NewCoord(self._Width/2,self._Height/2 + (self._BGheight - Height)/2 + self._Screen._TitleBar._Height)
self._Icons["bg"].Draw()
for i in self._MyList:
i.Draw()
self._DrawOnce = True
self._Icons["bg"].DrawRect((230,0,82,184),(228,0,82,184))
y = self._MyList[len(self._MyList)-1]._PosY+30
self._Icons["bg"].DrawRect(( (self._Width-191)/2,y,191,68),(65,232,191,68))
if self._HWND != None:
self._HWND.fill(MySkinManager.GiveColor("White"))
self._HWND.fill((255,255,255))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )

View File

@ -12,20 +12,74 @@ from libs.roundrects import aa_round_rect
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.scroller import ListScroller
from UI.icon_pool import MyIconPool
from UI.icon_item import IconItem
from UI.multi_icon_item import MultiIconItem
from UI.lang_manager import MyLangManager
from UI.multilabel import MultiLabel
class InfoPageListItem(object):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 20
_Labels = {}
_Icons = {}
_Fonts = {}
_LinkObj = None
def __init__(self):
self._Labels = {}
self._Icons = {}
self._Fonts = {}
def SetSmallText(self,text):
l = MultiLabel()
l.SetCanvasHWND(self._Parent._CanvasHWND)
l.Init(text,self._Fonts["small"])
self._Labels["Small"] = l
#if self._Labels["Small"]._Width > self._Width:
# self._Width = self._Labels["Small"]._Width
if self._Labels["Small"]._Height >= self._Height:
self._Height = self._Labels["Small"]._Height+10
def Init(self,text):
#self._Fonts["normal"] = fonts["veramono12"]
l = Label()
l._PosX = 10
l.SetCanvasHWND(self._Parent._CanvasHWND)
l.Init(text,self._Fonts["normal"])
self._Labels["Text"] = l
def Draw(self):
self._Labels["Text"]._PosY = self._PosY
self._Labels["Text"].Draw()
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Labels["Text"]._Width + 16
self._Labels["Small"]._PosY = self._PosY
self._Labels["Small"].Draw()
class AirplanePage(Page):
_FootMsg = ["Nav","","Rescue","Back","Toggle"]
_FootMsg = ["Nav.","","","Back","Toggle"]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela13")
_ListFontObj = fonts["varela13"]
_AList = {}
@ -65,21 +119,21 @@ class AirplanePage(Page):
airwire = IconItem()
airwire._ImgSurf = MyIconPool.GiveIconSurface("airwire")
airwire._ImgSurf = MyIconPool._Icons["airwire"]
airwire._MyType = ICON_TYPES["STAT"]
airwire._Parent = self
airwire.Adjust(0,0,5,43,0)
self._Icons["airwire"] = airwire
GS = IconItem()
GS._ImgSurf = MyIconPool.GiveIconSurface("GS")
GS._ImgSurf = MyIconPool._Icons["GS"]
GS._MyType = ICON_TYPES["STAT"]
GS._Parent = self
GS.Adjust(0,0,72,95,0)
self._Icons["GS"] = GS
DialogBoxs = MultiIconItem()
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("DialogBoxs")
DialogBoxs._ImgSurf = MyIconPool._Icons["DialogBoxs"]
DialogBoxs._MyType = ICON_TYPES["STAT"]
DialogBoxs._Parent = self
DialogBoxs._IconWidth = 134
@ -90,7 +144,7 @@ class AirplanePage(Page):
"""
bgpng = MultiIconItem()
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
bgpng._MyType = ICON_TYPES["STAT"]
bgpng._Parent = self
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
@ -107,8 +161,6 @@ class AirplanePage(Page):
self._Scroller.Init()
self._Scroller.SetCanvasHWND(self._HWND)
self.OnLoadCb()
def ScrollDown(self):
dis = 10
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 0:
@ -123,7 +175,7 @@ class AirplanePage(Page):
def ToggleModeAni(self): ## with animation
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
if "yes" in out[1]:
if out[1] == "yes":
data = self.EasingData(0,43)
for _,v in enumerate(data):
self._airwire_y -= v
@ -153,31 +205,25 @@ class AirplanePage(Page):
def ToggleMode(self):
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
print out
if "yes" in out[1]:
self._Screen._MsgBox.SetText("TurningOn")
if out[1] == "yes":
self._Screen._MsgBox.SetText("Turning On")
self._Screen._MsgBox.Draw()
commands.getstatusoutput("sudo rfkill unblock all")
self._Screen._TitleBar._InAirPlaneMode = False
else:
self._Screen._MsgBox.SetText("TurningOff")
self._Screen._MsgBox.SetText("Turning Off")
self._Screen._MsgBox.Draw()
commands.getstatusoutput("sudo rfkill block all")
self._Screen._TitleBar._InAirPlaneMode = True
def UnBlockAll(self):
self._Screen._MsgBox.SetText("TurningOn")
self._Screen._MsgBox.Draw()
commands.getstatusoutput("sudo rfkill unblock all")
self._Screen._TitleBar._InAirPlaneMode = False
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
if "yes" in out[1]:
if out[1] == "yes":
self._Screen._TitleBar._InAirPlaneMode = True
self._airwire_y = 50+43
self._dialog_index = 1
@ -193,12 +239,12 @@ class AirplanePage(Page):
self._Screen.SwapAndShow()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"]:
self.ToggleModeAni()
"""
self.ToggleMode()
@ -219,15 +265,7 @@ class AirplanePage(Page):
self._Screen.Draw()
self._Screen.SwapAndShow()
"""
if event.key == CurKeys["X"]:
self.UnBlockAll()
self._Screen.SwapAndShow()
pygame.time.delay(1000)
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()

View File

@ -1,813 +0,0 @@
# -*- coding: utf-8 -*-
import re
import pygame
#import math
import commands
import dbus
from beeprint import pp
from libs.roundrects import aa_round_rect
from libs.DBUS import bus, adapter,devices
#import gobject
#from wicd import misc
## local UI import
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.scroller import ListScroller
from UI.icon_pool import MyIconPool
from UI.icon_item import IconItem
from UI.multi_icon_item import MultiIconItem
from UI.skin_manager import MySkinManager
from UI.confirm_page import ConfirmPage
from UI.info_page_list_item import InfoPageListItem
from UI.multilabel import MultiLabel
from UI.lang_manager import MyLangManager
from UI.keyboard import Keyboard
from net_item import NetItem
from agent import BleAgent,BleAgentPairPage
class BleForgetConfirmPage(ConfirmPage):
_ConfirmText = MyLangManager.Tr("ConfirmForgetQ")
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self.SnapMsg(MyLangManager.Tr("Deleting"))
self._Screen.Draw()
self._Screen.SwapAndShow()
try:
#self._Parent._Adapter.RemoveDevice()
print("try to RemoveDevice")
except Exception,e:
print(str(e))
pygame.time.delay(400)
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
#self.ClearCanvas()
self.DrawBG()
for i in self._MyList:
i.Draw()
self.Reset()
class BleInfoPageSelector(PageSelector):
_BackgroundColor = MySkinManager.GiveColor('Front')
def __init__(self):
self._PosX = 0
self._PosY = 0
self._Height = 0
def AnimateDraw(self,x2,y2):
pass
def Draw(self):
idx = self._Parent._PsIndex
if idx < len( self._Parent._MyList):
x = self._PosX+2
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class BleInfoPage(Page):
_FootMsg = ["Nav","Forget","Disconnect","Back",""]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela15")
_ListSmFontObj = MySkinManager.GiveFont("varela12") # small font
_ListSm2FontObj= MySkinManager.GiveFont("varela11")
_AList = {}
_Path = ""
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._CanvasHWND = self._Screen._CanvasHWND
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
ps = BleInfoPageSelector()
ps._Parent = self
self._Ps = ps
self._PsIndex = 0
#_AList is an object
self.GenList()
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = 2
self._Scroller._PosY = 2
self._Scroller.Init()
self._ConfirmPage1 = BleForgetConfirmPage()
self._ConfirmPage1._Screen = self._Screen
self._ConfirmPage1._Name = "ConfirmForget"
self._ConfirmPage1._Parent = self
self._ConfirmPage1.Init()
def GenList(self):
if self._AList== None:
return
self._MyList = []
self._PsIndex = 0
start_x = 0
start_y = 0
for i,v in enumerate( self._AList):
#print(i,v) # (0, dbus.String(u'AddressType'))
li = InfoPageListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + i*InfoPageListItem._Height
li._Width = Width
li._Fonts["normal"] = self._ListFontObj
if v == "UUIDs":
li._Fonts["small"] = self._ListSm2FontObj
else:
li._Fonts["small"] = self._ListSmFontObj
li.Init( str(v) )
li._Flag = v
if v =="UUIDs":
if len(self._AList[v]) > 1:
pp(self._AList[v][0])
sm_text = str(self._AList[v][0])
else:
sm_text = "<empty>"
else:
sm_text = str(self._AList[v])
if sm_text == "0":
sm_text="No"
elif sm_text == "1":
sm_text="Yes"
sm_text = sm_text[:20]
li.SetSmallText(sm_text)
li._PosX = 2
self._MyList.append(li)
def TryToForget(self):
global adapter
proxy_obj = bus.get_object("org.bluez", self._Path)
dev = dbus.Interface(proxy_obj, "org.bluez.Device1")
self._Screen._MsgBox.SetText("Forgeting")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
try:
adapter.RemoveDevice(dev)
except Exception,e:
err_name = e.get_dbus_name()
if err_name == "org.freedesktop.DBus.Error.NoReply":
self._Screen._MsgBox.SetText("DBus noreply")
else:
self._Screen._MsgBox.SetText("Forget failed")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(500)
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def TryToDisconnect(self):
global bus
if "Connected" in self._AList:
if self._AList["Connected"] == 0:
return
proxy_obj = bus.get_object("org.bluez", self._Path)
dev = dbus.Interface(proxy_obj, "org.bluez.Device1")
self._Screen._FootBar.UpdateNavText("Disconnecting")
self._Screen._MsgBox.SetText("Disconnecting")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
try:
dev.Disconnect()
except Exception,e:
err_name = e.get_dbus_name()
if err_name == "org.freedesktop.DBus.Error.NoReply":
self._Screen._MsgBox.SetText("DBus noreply")
else:
self._Screen._MsgBox.SetText("Disconnect failed")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(500)
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Screen._FootBar.ResetNavText()
def Click(self):
if self._PsIndex >= len(self._MyList):
return
cur_li = self._MyList[self._PsIndex]
print(cur_li._Flag)
if cur_li._Flag in self._AList:
print(self._AList[ cur_li._Flag ])
def OnLoadCb(self):
if self._AList != None:
if "Connected" in self._AList:
if self._AList["Connected"] == 1:
self._FootMsg[1] = "Disconnect"
else:
self._FootMsg[1] = ""
self.GenList()
def OnReturnBackCb(self):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self.Click()
if event.key == CurKeys["X"]:
self.TryToDisconnect()
if event.key == CurKeys["Y"]:
self.TryToForget()
def Draw(self):
if len(self._MyList) == 0:
return
self.ClearCanvas()
if len(self._MyList) * InfoPageListItem._Height > self._Height:
self._Ps._Width = self._Width - 10
self._Ps._PosX = 9
self._Ps.Draw()
for i in self._MyList:
i.Draw()
self._Scroller.UpdateSize(len(self._MyList)*InfoPageListItem._Height, self._PsIndex*InfoPageListItem._Height)
self._Scroller.Draw()
else:
self._Ps._Width = self._Width
self._Ps.Draw()
for i in self._MyList:
i.Draw()
class BleListSelector(PageSelector):
_BackgroundColor = MySkinManager.GiveColor('Front')
def __init__(self):
self._PosX = 0
self._PosY = 0
self._Height = 0
def AnimateDraw(self,x2,y2):
pass
def Draw(self):
idx = self._Parent._PsIndex
if idx < len( self._Parent._MyList):
x = self._Parent._MyList[idx]._PosX+2
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class BleListMessageBox(Label):
_Parent = None
def Draw(self):
my_text = self._FontObj.render( self._Text,True,self._Color)
w = my_text.get_width()
h = my_text.get_height()
x = (self._Parent._Width - w)/2
y = (self._Parent._Height - h)/2
padding = 10
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(x-padding,y-padding, w+padding*2,h+padding*2))
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Black'),(x-padding,y-padding, w+padding*2,h+padding*2),1)
self._CanvasHWND.blit(my_text,(x,y,w,h))
class BluetoothPage(Page):
_MyList = []
#Wicd dbus part
_Adapter = None
_Dbus = None
_Devices = None
_BlePassword = ""
_Connecting = False
_Scanning = False
_PrevState = None
_Selector = None
_ShowingMessageBox = False
_MsgBox = None
_ConnectTry = 0
_BlockCb = None
_LastStatusMsg = ""
_FootMsg = ["Nav","Info","Scan","Back","TryConnect"]
_Scroller = None
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
_InfoPage = None
_ADAPTER_DEV = "hci0"
_Offline = False
_Leader = None
def __init__(self):
Page.__init__(self)
self._MyList = []
self._CanvasHWND = None
def ShowBox(self,msg):
self._MsgBox._Text = msg
self._ShowingMessageBox = True
self._Screen.Draw()
self._MsgBox.Draw()
self._Screen.SwapAndShow()
def HideBox(self):
self.Draw()
self._ShowingMessageBox = False
self._Screen.SwapAndShow()
def Init(self):
self._PosX = self._Index * self._Screen._Width
self._Width = self._Screen._Width
self._Height = self._Screen._Height
#self._CanvasHWND = pygame.Surface((self._Width,self._Height))
self._CanvasHWND = self._Screen._CanvasHWND
ps = BleListSelector()
ps._Parent = self
ps._Width = Width - 12
self._Ps = ps
self._PsIndex = 0
msgbox = BleListMessageBox()
msgbox._CanvasHWND = self._CanvasHWND
msgbox.Init(" ",MyLangManager.TrFont("veramono12"))
msgbox._Parent = self
self._MsgBox = msgbox
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = 2
self._Scroller._PosY = 2
self._Scroller.Init()
self.GenNetworkList()
self._InfoPage = BleInfoPage()
self._InfoPage._Screen = self._Screen
self._InfoPage._Name = "BluetoothInfo"
self._InfoPage.Init()
def print_normal(self,address, properties):
print("[ " + address + " ]")
for key in properties.keys():
value = properties[key]
if type(value) is dbus.String:
value = unicode(value).encode('ascii', 'replace')
if (key == "Class"):
print(" %s = 0x%06x" % (key, value))
else:
print(" %s = %s" % (key, value))
print()
properties["Logged"] = True
def skip_dev(self,old_dev, new_dev):
if not "Logged" in old_dev:
return False
if "Name" in old_dev:
return True
if not "Name" in new_dev:
return True
return False
def DbusPropertiesChanged(self, interface, changed, invalidated, path):
global devices
print("DbusPropertiesChanged")
if interface != "org.bluez.Device1":
return
if path in devices:
dev = devices[path]
if self.skip_dev(dev, changed):
return
devices[path] = dict(devices[path].items() + changed.items())
else:
devices[path] = changed
if "Address" in devices[path]:
address = devices[path]["Address"]
else:
address = "<unknown>"
self._Devices = devices
self.print_normal(address, devices[path])
self.RefreshDevices()
self.GenNetworkList()
self._Screen.Draw()
self._Screen.SwapAndShow()
def ShutDownConnecting(self):
print("Bluetooth Shutdown connecting...")
def AbortedAndReturnToUpLevel(self):
self.HideBox()
self._Screen._FootBar.ResetNavText()
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def CheckIfBluetoothConnecting(self):
return True
def TryConnect(self):
global bus
if self._PsIndex >= len(self._MyList):
return
cur_li = self._MyList[self._PsIndex]
print(cur_li._Path)
if "Connected" in cur_li._Atts:
if cur_li._Atts["Connected"] == 1:
return
proxy_obj = bus.get_object("org.bluez", cur_li._Path)
dev = dbus.Interface(proxy_obj, "org.bluez.Device1")
self._Screen._FootBar.UpdateNavText("Connecting")
self.ShowBox(MyLangManager.Tr("Connecting"))
self._Leader._MyAgent.device_obj = dev
self._Leader._MyAgent.dev_path = cur_li._Path
try:
dev.Pair(reply_handler=self._Leader._MyAgent.pair_reply,
error_handler=self._Leader._MyAgent.pair_error,timeout=60000)
except Exception,e:
print(str(e))
#self.HideBox()
#self._Screen._FootBar.ResetNavText()
def RefreshDevices(self):
global devices
devices = {}
try:
proxy_obj = bus.get_object("org.bluez", "/")
manager = dbus.Interface(proxy_obj,"org.freedesktop.DBus.ObjectManager")
objects = manager.GetManagedObjects()
for path, interfaces in objects.iteritems():
if "org.bluez.Device1" in interfaces:
devices[path] = interfaces["org.bluez.Device1"] ## like /org/bluez/hci0/dev_xx_xx_xx_yy_yy_yy
except Exception,e:
print(str(e))
devices={}
self._Devices = devices
def GenNetworkList(self):
self._MyList = []
start_x = 0
start_y = 0
counter = 0
for i,v in enumerate(self._Devices):
if "Name" in self._Devices[v]:
if len(self._Devices[v]["Name"]) < 2:
continue
if re.match("[0-9a-f]{2}([-:]?)[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", self._Devices[v]["Name"].lower()): ## skip xx:xx:xx:xx:xx
continue
else:
continue
ni = NetItem()
ni._Parent = self
ni._PosX = start_x
ni._PosY = start_y + counter* NetItem._Height
ni._Width = Width
ni._FontObj = self._ListFontObj
ni.Init(v,self._Devices[v])
counter += 1
self._MyList.append(ni)
self._PsIndex = 0
def Rescan(self):
if self._Screen._CurrentPage != self:
return
self._Scanning = True
self.ShowBox(MyLangManager.Tr("BluetoothScanning"))
self._Screen._FootBar.UpdateNavText("Scanning")
proxy_obj = self._Dbus.get_object("org.bluez", "/org/bluez/" + self._ADAPTER_DEV)
adapter_props = dbus.Interface(proxy_obj,"org.freedesktop.DBus.Properties")
discoverying = adapter_props.Get("org.bluez.Adapter1", "Discovering")
print("discoverying", discoverying)
if self._Adapter!= None:
try:
self._Adapter.StopDiscovery()
except Exception,e:
print(str(e))
try:
self._Adapter.StartDiscovery()
except Exception,e:
err_name = e.get_dbus_name()
if err_name == "org.freedesktop.DBus.Error.NoReply":
print("start discovery timeout")
else:
print("start discovery unknown err: ", str(e))
def OnReturnBackCb(self):
self.RefreshDevices()
self.GenNetworkList()
def OnLoadCb(self):
self._Offline = False
if self._Screen._TitleBar._InAirPlaneMode == False:
out = commands.getstatusoutput("hcitool dev | grep hci0 |cut -f3") ## bluetooth maybe dead after airplane mode
if len(out[1]) < 17:
self._Offline = True
print("Bluetooth OnLoadCb ,can not find hci0 alive,try to reboot")
else:
self.RefreshDevices()
self.GenNetworkList()
else:
self._Offline = True
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if self._Offline == True:
self.AbortedAndReturnToUpLevel()
return
if self._Adapter != None:
try:
self._Adapter.StopDiscovery()
except Exception,e:
print(str(e))
_connecting = self.CheckIfBluetoothConnecting()
if _connecting:
self.ShutDownConnecting()
self.ShowBox(MyLangManager.Tr("ShutDownConnecting"))
self.AbortedAndReturnToUpLevel()
else:
self.AbortedAndReturnToUpLevel()
else:
self.HideBox()
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Screen._FootBar.ResetNavText()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["X"]:
if self._Offline == False:
self.Rescan()
if event.key == CurKeys["Y"]:
if len(self._MyList) == 0:
return
if self._Offline == True:
return
self._InfoPage._AList = self._MyList[self._PsIndex]._Atts
self._InfoPage._Path = self._MyList[self._PsIndex]._Path
self._Screen.PushPage(self._InfoPage)
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if self._Offline == False:
self.TryConnect()
def Draw(self):
self.ClearCanvas()
if len(self._MyList) == 0:
return
if len(self._MyList) * NetItem._Height > self._Height:
self._Ps._Width = self._Width - 11
self._Ps.Draw()
for i in self._MyList:
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*NetItem._Height, self._PsIndex*NetItem._Height)
self._Scroller.Draw()
else:
self._Ps._Width = self._Width
self._Ps.Draw()
for i in self._MyList:
i.Draw()
BUS_NAME = 'org.bluez'
AGENT_INTERFACE = 'org.bluez.Agent1'
AGENT_PATH = "/gameshell/bleagent"
class APIOBJ(object):
_Page = None
_PairPage = None
_Page3 = None
_Prompts = {} # string key,string value
_PromptType = None
_MyAgent = None
def __init__(self):
self._Prompts["PIN"]=""
self._Prompts["PASS"]=""
def OnKbdReturnBackCb(self):
if self._PromptType == None:
return
else:
if self._PromptType in self._Prompts:
inputed = "".join(self._Page3._Textarea._MyWords)
self._Prompts[self._PromptType] = inputed
self._PromptType = None ##clear
def Ask(self,prompt,prompt_type=None):
self._Screen.PushPage(self._Page3)
self._Page3.SetPassword("")
self._Page3._Name = prompt
self._Page3._Caller = self
self._Screen.Draw()
self._Screen.SwapAndShow()
if prompt_type != None:
self._PromptType = prompt_type
def RegisterMyAgent(self):
global AGENT_PATH, bus,devices,adapter
capability = "KeyboardDisplay"
self._MyAgent = BleAgent(bus, AGENT_PATH)
self._MyAgent._Leader = self
obj = bus.get_object(BUS_NAME, "/org/bluez");
manager = dbus.Interface(obj, "org.bluez.AgentManager1")
manager.RegisterAgent(AGENT_PATH, capability)
print("BleAgent %s registered" % AGENT_PATH)
def Init(self,main_screen):
global bus,devices,adapter
self._Page = BluetoothPage()
self._Page._Dbus = bus
self._Page._Devices = devices
self._Page._Adapter = adapter
self._Page._Screen = main_screen
self._Page._Name ="Bluetooth"
self._Page._Leader = self
self._Page.Init()
self._PairPage = BleAgentPairPage()
self._PairPage._Screen = main_screen
self._PairPage._Name = "Bluetooth"
self._PairPage.Init()
self._Page3= Keyboard()
self._Page3._Name = "Enter"
self._Page3._Screen = main_screen
self._Page3.Init()
bus.add_signal_receiver(self._Page.DbusPropertiesChanged,
dbus_interface = "org.freedesktop.DBus.Properties",
signal_name = "PropertiesChanged",
arg0 = "org.bluez.Device1",
path_keyword = "path")
self.RegisterMyAgent()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -1,224 +0,0 @@
# -*- coding: utf-8 -*-
import pygame
#import math
#import commands
import dbus
#from beeprint import pp
from libs.roundrects import aa_round_rect
from UI.page import Page,PageSelector
from UI.keys_def import CurKeys, IsKeyMenuOrB
from libs.DBUS import bus, adapter,devices
BUS_NAME = 'org.bluez'
AGENT_INTERFACE = 'org.bluez.Agent1'
AGENT_PATH = "/gameshell/bleagent"
class Rejected(dbus.DBusException):
_dbus_error_name = "org.bluez.Error.Rejected"
class BleAgent(dbus.service.Object):
device_obj = None
_Leader = None
dev_path = ""
def set_trusted(self,path):
global BUS_NAME
props = dbus.Interface(bus.get_object(BUS_NAME, path),
"org.freedesktop.DBus.Properties")
props.Set("org.bluez.Device1", "Trusted", True)
def dev_connect(self,path):
global BUS_NAME
dev = dbus.Interface(bus.get_object(BUS_NAME, path),
"org.bluez.Device1")
print("dev_connect %s" % path)
try:
dev.Connect()
except Exception,e:
print(str(e))
@dbus.service.method(AGENT_INTERFACE,in_signature="", out_signature="")
def Release(self):
print("Agent release")
@dbus.service.method(AGENT_INTERFACE,in_signature="os", out_signature="")
def AuthorizeService(self, device, uuid):
print("AuthorizeService (%s, %s)" % (device, uuid)) ## directly authrized
return
@dbus.service.method(AGENT_INTERFACE,in_signature="o", out_signature="s")
def RequestPinCode(self, device):
print("RequestPinCode (%s)" % (device))
set_trusted(device)
return "0000"
@dbus.service.method(AGENT_INTERFACE,in_signature="o", out_signature="u")
def RequestPasskey(self, device):
print("RequestPasskey (%s)" % (device))
set_trusted(device)
passkey = "000000"
return dbus.UInt32(passkey)
@dbus.service.method(AGENT_INTERFACE,in_signature="ouq", out_signature="")
def DisplayPasskey(self, device, passkey, entered):
print("DisplayPasskey (%s, %06u entered %u)" % (device, passkey, entered))
self._Leader._PairPage.ShowPassKey(device,passkey,entered)
@dbus.service.method(AGENT_INTERFACE,in_signature="os", out_signature="")
def DisplayPinCode(self, device, pincode):
print("DisplayPinCode (%s, %s)" % (device, pincode))
self._Leader._PairPage.ShowPinCode(device,pincode)
@dbus.service.method(AGENT_INTERFACE,in_signature="ou", out_signature="")
def RequestConfirmation(self, device, passkey):
print("RequestConfirmation (%s, %06d)" % (device, passkey))
set_trusted(device)
return
@dbus.service.method(AGENT_INTERFACE,in_signature="o", out_signature="")
def RequestAuthorization(self, device):
print("RequestAuthorization (%s)" % (device))
return
@dbus.service.method(AGENT_INTERFACE,in_signature="", out_signature="")
def Cancel(self):
print("Cancel")
def pair_reply(self):
print("Device paired under Agent")
self.set_trusted(self.dev_path)
self.dev_connect(self.dev_path)
self._Leader._PairPage._dev_obj = self.device_obj
self._Leader._PairPage.PairReplyCb()
def pair_error(self,error):
global adapter
err_msg = ""
err_name = error.get_dbus_name()
print(err_name)
if err_name == "org.freedesktop.DBus.Error.NoReply" and self.device_obj:
err_msg = "Timed out. Cancelling pairing"
print(err_msg)
self.device_obj.CancelPairing()
elif err_name == "org.bluez.Error.AuthenticationCanceled":
err_msg = "Authentication Canceled"
elif err_name == "org.bluez.Error.ConnectionAttemptFailed":
err_msg = "Page Timeout"
elif err_name == "org.bluez.Error.AlreadyExists":
err_msg ="Already Exists"
try:
adapter.RemoveDevice(self.device_obj)
except Exception,e:
print("pair_error forget err:",str(e))
elif err_name == "org.bluez.Error.AuthenticationFailed":
err_msg = "Authentication Failed"
else:
err_msg = "Pair error"
print( err_name,str(error) )
self.device_obj = None
self._Leader._PairPage.PairErrorCb(err_msg)
class BleAgentPairPage(Page):
##show pin/password
##show prompt
_Pin = ""
_Pass = ""
_dev_obj = None
_FootMsg = ["Nav","","","Back",""]
def Init(self):
self._PosX = self._Index * self._Screen._Width
self._Width = self._Screen._Width
self._Height = self._Screen._Height
#self._CanvasHWND = pygame.Surface((self._Width,self._Height))
self._CanvasHWND = self._Screen._CanvasHWND
def ShowPinCode(self,device,pincode):
print("ShowPinCode %s %s" % (device,pincode))
if self._Screen.CurPage() != self:
self._Screen.PushPage(self)
self.ClearCanvas()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Pin = "%s" % pincode
txt = self.Pin
if len(self._Pin) > 0:
txt = "Pin code: %s" % self._Pin
self._Screen._MsgBox.SetText(txt)
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
def ShowPassKey(self,device,passkey,entered):
print("ShowPassKey %06u %u" % (passkey,entered))
if self._Screen.CurPage() != self:
self._Screen.PushPage(self)
self.ClearCanvas()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Pass = "%06u" % passkey
if len(self._Pass) > 0:
txt = "Pair code: %s" % self._Pass
self._Screen._MsgBox.SetText(txt)
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
def PairReplyCb(self):
self.ClearCanvas()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Screen._MsgBox.SetText("Device paired")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(1500)
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Screen._FootBar.ResetNavText()
def PairErrorCb(self,error=None):
self.ClearCanvas()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Screen._MsgBox.SetText(error)
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(1500)
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
self._Screen._FootBar.ResetNavText()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if self._dev_obj != None:
try:
self._dev_obj.CancelPairing()
except Exception,e:
print(str(e))
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
pass
#self.ClearCanvas()

View File

@ -1,128 +0,0 @@
# -*- coding: utf-8 -*-
import pygame
## local UI import
from UI.page import Page
from UI.label import Label
from UI.icon_item import IconItem
from UI.multi_icon_item import MultiIconItem
from UI.icon_pool import MyIconPool
from UI.skin_manager import MySkinManager
class NetItemMultiIcon(MultiIconItem):
_CanvasHWND = None
_Parent = None
_Width = 18
_Height = 18
def Draw(self):
self._CanvasHWND.blit(self._ImgSurf,(self._PosX,self._PosY+(self._Parent._Height-self._Height)/2,self._Width,self._Height),
(0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight))
class NetItemIcon(IconItem):
_CanvasHWND = None
_Parent = None
_Width = 18
_Height = 18
def Draw(self):
self._CanvasHWND.blit(self._ImgSurf,(self._PosX,self._PosY+(self._Parent._Height-self._Height)/2,self._Width,self._Height))
class NetItem(object):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Atts = {}
_Channel="" # '10'
_Stren = "" ## 19%
_Parent = None
_IsActive = False
_Icons = {} ## wifi strength and security icons
_Labels = {}
_FontObj = None
_RSSI = 0
_MacAddr=""
_Path = "" #/org/bluez/hci0/dev_34_88_5D_97_FF_26
def __init__(self):
self._Labels = {}
self._Icons = {}
def SetActive(self,act):
self._IsActive = act
def Init(self, path, object):
self._Path = path
self._Atts = object
is_active=False
if "Address" in object:
self._MacAddr = object["Address"]
if "Connected" in object:
if object["Connected"] == 1:
is_active=True
if is_active:
self.SetActive(is_active)
name_label = Label()
name_label._PosX = 12
name_label._CanvasHWND = self._Parent._CanvasHWND
mac_addr = self._MacAddr
if "Name" in object:
if len(object["Name"]) > 3:
mac_addr = object["Name"]
if "RSSI" in object:
print(object["RSSI"])
self._RSSI = int(object["RSSI"])
mac_addr = mac_addr[:34]
name_label.Init(mac_addr,self._FontObj)
self._Labels["mac_addr"] = name_label
done_icon = NetItemIcon()
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
done_icon._CanvasHWND = self._Parent._CanvasHWND
done_icon._Parent = self
self._Icons["done"] = done_icon
## reuse the resource from TitleBar
#pp(theString)
def Connect(self,notworkentry=None):
""" Execute connection. """
#dev = dbus.Interface(bus.get_object("org.bluez", "/org/bluez/hci0/dev_"+"34_88_5D_97_FF_26"), "org.bluez.Device1")
proxy_obj = self._Parent._Dbus.get_object("org.bluez",self._Path)
dev = self._Parent._Dbus.Interface(proxy_obj, "org.bluez.Device1")
dev.Connect()
def Draw(self):
#pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY),(self._PosX+self._Width,self._PosY),1)
for i in self._Labels:
self._Labels[i]._PosY = self._PosY + (self._Height - self._Labels[i]._Height)/2
self._Labels[i].Draw()
if self._IsActive:
self._Icons["done"].NewCoord(320-22,self._PosY)
self._Icons["done"].Draw()
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),
(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)

View File

@ -10,8 +10,9 @@ from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.icon_item import IconItem
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.slider import Slider
from UI.icon_pool import MyIconPool
from UI.multi_icon_item import MultiIconItem
@ -39,7 +40,7 @@ class BSlider(Slider):
self._Height = self._Parent._Height
bgpng = IconItem()
bgpng._ImgSurf = MyIconPool.GiveIconSurface("light")
bgpng._ImgSurf = MyIconPool._Icons["light"]
bgpng._MyType = ICON_TYPES["STAT"]
bgpng._Parent = self
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
@ -49,7 +50,7 @@ class BSlider(Slider):
scale = MultiIconItem()
scale._MyType = ICON_TYPES["STAT"]
scale._Parent = self
scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
scale._ImgSurf = MyIconPool._Icons["scale"]
scale._IconWidth = 82
scale._IconHeight = 63
scale.Adjust(0,0,82,63,0)
@ -160,7 +161,7 @@ class BrightnessPage(Page):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()

View File

@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import pygame
import commands
@ -9,8 +9,9 @@ from libs.roundrects import aa_round_rect
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, GetButtonsLayoutMode, SetButtonsLayoutMode, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.scroller import ListScroller
from UI.icon_pool import MyIconPool
from UI.icon_item import IconItem
@ -22,15 +23,15 @@ class UpdateConfirmPage(ConfirmPage):
_ConfirmText = "Apply to RetroArch?"
_RetroArchConf = "/home/cpi/.config/retroarch/retroarch.cfg"
_LayoutMode = "Unknown"
def ModifyRetroArchConf(self,keys):
try:
with open(self._RetroArchConf, mode="r") as f:
confarr = f.readlines()
except:
return "retroarch.cfg cannot open."
bka = bkb = bkx = bky = False
try:
for i, ln in enumerate(confarr):
@ -49,35 +50,35 @@ class UpdateConfirmPage(ConfirmPage):
bky = True
except:
return "retroarch.cfg cannot parse."
if bka and bkb and bkx and bky:
None
else:
return "retroarch.cfg validation error."
try:
with open(self._RetroArchConf, mode="w") as f:
confarr = f.writelines(confarr)
except:
return "retroarch.cfg cannot write."
return "Completed! Your RA keymap: " + self._LayoutMode.upper()
def KeyDown(self,event):
def finalizeWithDialog(msg):
self._Screen._MsgBox.SetText(msg)
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
return
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"]:
if self._LayoutMode == "xbox":
keymap = ["j","k","u","i"]
elif self._LayoutMode == "snes":
@ -86,17 +87,17 @@ class UpdateConfirmPage(ConfirmPage):
finalizeWithDialog("Internal error.")
return
print("mode: " + self._LayoutMode)
if not os.path.isfile(self._RetroArchConf):
finalizeWithDialog("retroarch.cfg was not found.")
return
try:
shutil.copyfile(self._RetroArchConf, self._RetroArchConf + ".blbak")
except:
finalizeWithDialog("Cannot create .blbak")
return
finalizeWithDialog(self.ModifyRetroArchConf(keymap))
return
@ -104,23 +105,24 @@ class UpdateConfirmPage(ConfirmPage):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
self.DrawBG()
for i in self._MyList:
i.Draw()
self.Reset()
class ButtonsLayoutPage(Page):
_FootMsg = ["Nav.","","UpdateRetroArch","Back","Toggle"]
_FootMsg = ["Nav.","UpdateRetroArch","","Back","Toggle"]
_MyList = []
_ListFontObj = fonts["varela13"]
_AList = {}
_Scrolled = 0
_BGwidth = 320
_BGheight = 240-24-20
@ -131,29 +133,29 @@ class ButtonsLayoutPage(Page):
_EasingDur = 30
_dialog_index = 0
def __init__(self):
Page.__init__(self)
self._Icons = {}
def GenList(self):
self._MyList = []
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._HWND = self._Screen._CanvasHWND
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
self._PosX = self._Index*self._Screen._Width
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
DialogBoxs = MultiIconItem()
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("buttonslayout")
DialogBoxs._ImgSurf = MyIconPool._Icons["buttonslayout"]
DialogBoxs._MyType = ICON_TYPES["STAT"]
DialogBoxs._Parent = self
DialogBoxs._IconWidth = 300
@ -170,7 +172,7 @@ class ButtonsLayoutPage(Page):
self._Scroller.SetCanvasHWND(self._HWND)
self._ConfirmPage = UpdateConfirmPage()
self._ConfirmPage._LayoutMode = GetButtonsLayoutMode()
self._ConfirmPage._LayoutMode = self.GetButtonsLayoutMode()
self._ConfirmPage._Screen = self._Screen
self._ConfirmPage._Name = "Overwrite RA conf"
self._ConfirmPage._Parent = self
@ -182,23 +184,38 @@ class ButtonsLayoutPage(Page):
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 0:
self._PosY -= dis
self._Scrolled -= dis
def ScrollUp(self):
dis = 10
if self._PosY < 0:
self._PosY += dis
self._Scrolled += dis
def GetButtonsLayoutMode(self):
lm = "xbox"
try:
with open(".buttonslayout", "r") as f:
lm = f.read()
except:
None
if lm not in ["xbox","snes"]:
lm = "xbox"
return lm
def ToggleMode(self):
if GetButtonsLayoutMode() == "xbox":
SetButtonsLayoutMode("snes")
if self.GetButtonsLayoutMode() == "xbox":
with open(".buttonslayout", "w") as f:
f.write("snes")
self._dialog_index = 1
self._Screen.Draw()
self._Screen.SwapAndShow()
else:
SetButtonsLayoutMode("xbox")
with open(".buttonslayout", "w") as f:
f.write("xbox")
self._dialog_index = 0
self._Screen.Draw()
@ -208,36 +225,39 @@ class ButtonsLayoutPage(Page):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
self._dialog_index = 0 if GetButtonsLayoutMode() == "xbox" else 1
if self.GetButtonsLayoutMode() == "xbox":
self._dialog_index = 0
else:
self._dialog_index = 1
def OnReturnBackCb(self):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"]:
self.ToggleMode()
if event.key == CurKeys["X"]:
self._ConfirmPage._LayoutMode = GetButtonsLayoutMode()
self._ConfirmPage._LayoutMode = self.GetButtonsLayoutMode()
self._Screen.PushPage(self._ConfirmPage)
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
self._Icons["DialogBoxs"].NewCoord(0,30)
self._Icons["DialogBoxs"].NewCoord(0,30)
self._Icons["DialogBoxs"]._IconIndex = self._dialog_index
self._Icons["DialogBoxs"].DrawTopLeft()
if self._HWND != None:
self._HWND.fill((255,255,255))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
@ -252,7 +272,7 @@ class APIOBJ(object):
self._Page._Screen = main_screen
self._Page._Name ="Buttons Layout"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
@ -260,8 +280,8 @@ class APIOBJ(object):
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -1,252 +0,0 @@
# -*- coding: utf-8 -*-
import os
import platform
import pygame
import glob
#import math
import commands
#from beeprint import pp
from libs.roundrects import aa_round_rect
#import gobject
#from wicd import misc
## local UI import
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect,FileExists,IsExecutable,ArmSystem,CmdClean
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.scroller import ListScroller
from UI.icon_pool import MyIconPool
from UI.icon_item import IconItem
from UI.confirm_page import ConfirmPage
from UI.multi_icon_item import MultiIconItem
from UI.lang_manager import MyLangManager
from UI.multilabel import MultiLabel
from UI.info_page_list_item import InfoPageListItem
from UI.info_page_selector import InfoPageSelector
from UI.skin_manager import MySkinManager
class DeleteCoreConfirmPage(ConfirmPage):
_ConfirmText = MyLangManager.Tr("Awaiting Input")
_FootMsg = ["Nav","","","Cancel","OK"]
CallbackA = None
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self._Screen._MsgBox.SetText("Applying")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(638)
self.CallbackA()
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
class CoresPage(Page):
_FootMsg = ["Nav","Del","Scan","Back",""]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela13")
_AList = {}
_Scrolled = 0
_BGwidth = 320
_BGheight = 240-24-20
_DrawOnce = False
_Scroller = None
_EasingDur = 30
_CORES_PATH = "%s/apps/emulators" % os.path.expanduser('~')
_Config =None
_AllowedExts = [".so",".bin"]
_HiddenSos = ["chailove_libretro.so","nxengine_libretro.so"]
def __init__(self):
Page.__init__(self)
self._Icons = {}
if "arm" in platform.machine():
pass
def GenList(self):
self._MyList = []
## map ini to self._AList
files_path = glob.glob(self._CORES_PATH+"/*")
start_x = 10
start_y = 0
counter = 0
for i,v in enumerate( files_path):
if os.path.basename(v) in self._HiddenSos:
continue
filename, file_extension = os.path.splitext(v)
alias_file = filename+file_extension + ".alias"
if file_extension in self._AllowedExts:
li = InfoPageListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + counter*InfoPageListItem._Height
li._Width = Width-10
li._Fonts["normal"] = self._ListFontObj
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
li._ReadOnly = True
if os.path.isfile(alias_file):
fp = open(alias_file, "r")
alias = fp.read()
alias = alias.strip()
label_text = alias.decode("utf8")
li.Init( label_text )
fp.close()
else:
li.Init( os.path.basename(v) )
li._Flag = v
##li.SetSmallText( v )
self._MyList.append(li)
counter += 1
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._CanvasHWND = self._Screen._CanvasHWND
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
ps = InfoPageSelector()
ps._PosX = 11
ps._Parent = self
ps._Width = self._Width-10
self._Ps = ps
self._PsIndex = 0
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = 2
self._Scroller._PosY = 2
self._Scroller.Init()
self._ConfirmBox = DeleteCoreConfirmPage()
self._ConfirmBox._Screen = self._Screen
self._ConfirmBox._Name = "Confirm to Delete?"
self._ConfirmBox._Parent = self
self._ConfirmBox.Init()
def ReScan(self):
self.GenList()
self.RefreshPsIndex()
def ConfirmBoxCallbackA(self):
if len(self._MyList) == 0:
return
cur_li = self._MyList[self._PsIndex]
os.system("rm %s" % CmdClean(cur_li._Flag))
self.GenList()
self.RefreshPsIndex()
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
self.GenList()
def OnReturnBackCb(self):
pass
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["X"]: #Scan current
self.ReScan()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Y"]: #del
if len(self._MyList) == 0:
return
self._ConfirmBox.CallbackA = self.ConfirmBoxCallbackA
self._Screen.PushPage(self._ConfirmBox)
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
if len(self._MyList) > 0:
self._Ps.Draw()
for i in self._MyList:
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*InfoPageListItem._Height,
self._PsIndex*InfoPageListItem._Height)
self._Scroller.Draw()
class APIOBJ(object):
_Page = None
def __init__(self):
pass
def Init(self,main_screen):
self._Page = CoresPage()
self._Page._Screen = main_screen
self._Page._Name ="Retroarch cores manager"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -1,349 +0,0 @@
# -*- coding: utf-8 -*-
import os
import pygame
import platform
import commands
#import glob
#from beeprint import pp
from libs.roundrects import aa_round_rect
## local UI import
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect,FileExists
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.info_page_list_item import InfoPageListItem
from UI.info_page_selector import InfoPageSelector
from libs.DBUS import is_wifi_connected_now
import config
class ListPageSelector(InfoPageSelector):
def Draw(self):
idx = self._Parent._PsIndex
if idx < len(self._Parent._MyList):
x = self._Parent._MyList[idx]._PosX+2 ## ++
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class PageListItem(InfoPageListItem):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Labels = {}
_Icons = {}
_Fonts = {}
_LinkObj = None
_Active = False
_Value = ""
def Draw(self):
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
if self._Active == True:
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
self._Parent._Icons["done"].Draw()
self._Labels["Text"].Draw(self._Active)
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
self._Labels["Small"].Draw()
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
class GateWayPage(Page):
_FootMsg = ["Nav","Clear All","","Back","Select"]
_MyList = []
_ListFont = MyLangManager.TrFont("notosanscjk15")
_AList = {}
_Scrolled = 0
_BGwidth = 320
_BGheight = 240-24-20
_DrawOnce = False
_Scroller = None
_InfoPage = None
def __init__(self):
Page.__init__(self)
self._Icons = {}
def GenList(self):
self._MyList = []
start_x = 0
start_y = 0
last_height = 0
drivers = [["usb0","USB Ethernet"],
["wlan0","Wi-Fi"]]
for i,u in enumerate( drivers ):
#print(i,u)
li = PageListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + last_height
li._Width = Width
li._Fonts["normal"] = self._ListFont
li._Active = False
li._Value = u[0]
li.Init( u[1] )
last_height += li._Height
self._MyList.append(li)
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._HWND = self._Screen._CanvasHWND
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
done = IconItem()
done._ImgSurf = MyIconPool.GiveIconSurface("done")
done._MyType = ICON_TYPES["STAT"]
done._Parent = self
self._Icons["done"] = done
ps = ListPageSelector()
ps._Parent = self
self._Ps = ps
self._PsIndex = 0
self.GenList()
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = self._Width - 10
self._Scroller._PosY = 2
self._Scroller.Init()
self._Scroller.SetCanvasHWND(self._HWND)
def Click(self):
if len(self._MyList) == 0:
return
cur_li = self._MyList[self._PsIndex]
if cur_li._Active == True:
out = commands.getstatusoutput("sudo ip route | grep default | cut -d \" \" -f3")
if len(out[1]) > 7:
self._Screen._MsgBox.SetText(out[1])
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
return
print(cur_li._Value)
if "arm" in platform.machine():
for i in self._MyList:
i._Active = False
self._Screen._MsgBox.SetText("Applying")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
cur_li._Active = self.ApplyGateWay(cur_li._Value)
pygame.time.delay(1000)
self._Screen.Draw()
self._Screen.SwapAndShow()
else:
self._Screen._MsgBox.SetText("Do it in GameShell")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
def ClearAllGateways(self):
self._Screen._MsgBox.SetText("Cleaning up")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
os.system("sudo ip route del 0/0")
pygame.time.delay(800)
for i in self._MyList:
i._Active = False
self._Screen.Draw()
self._Screen.SwapAndShow()
def ApplyGateWay(self,gateway):
os.system("sudo ip route del 0/0")
if gateway== "usb0":
out = commands.getstatusoutput("sudo ifconfig usb0 | grep inet | tr -s \" \"| cut -d \" \" -f3")
if len(out[1]) > 7:
if "error" not in out[1]:
parts = out[1].split(".")
if len(parts) == 4:##IPv4
tp3 = int(parts[3])
tmp = tp3
if tp3 == 0:
tmp = int(parts[3]) + 1
elif tp3 == 1:
tmp = int(parts[3]) + 1
elif tp3 > 1:
tmp = int(parts[3]) - 1
parts[3] = str(tmp)
ipaddress = ".".join(parts)
os.system("sudo route add default gw "+ipaddress)
return True
else:
if is_wifi_connected_now():
os.system("sudo dhclient wlan0")
return True
else:
self._Screen._MsgBox.SetText("Wi-Fi is not connected")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
return False
return False
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
## grep Driver /etc/xorg.conf | tr -s " " | cut -d " " -f3
## "fbturbo"
## "modesetting"
thedrv = ""
if "arm" in platform.machine():
out = commands.getstatusoutput("sudo ip route | grep default")
if len(out[1]) > 7:
if "usb0" in out[1]:
thedrv = "usb0"
elif "wlan0" in out[1]:
thedrv = "wlan0"
for i in self._MyList:
i._Active = False
if thedrv != "":
for i in self._MyList:
if thedrv in i._Value:
i._Active = True
## if usb0 and wlan0 all actived, clear all
def OnReturnBackCb(self):
pass
"""
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
"""
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self.Click()
if event.key == CurKeys["Y"]:
self.ClearAllGateways()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
if len(self._MyList) == 0:
return
else:
if len(self._MyList) * PageListItem._Height > self._Height:
self._Ps._Width = self._Width - 11
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
self._Scroller.Draw()
else:
self._Ps._Width = self._Width
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
if self._HWND != None:
self._HWND.fill(MySkinManager.GiveColor("White"))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
class APIOBJ(object):
_Page = None
def __init__(self):
pass
def Init(self,main_screen):
self._Page = GateWayPage()
self._Page._Screen = main_screen
self._Page._Name ="Gateway switch"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -1,309 +0,0 @@
# -*- coding: utf-8 -*-
import os
import pygame
#import math
#mport subprocess
import glob
#from beeprint import pp
from libs.roundrects import aa_round_rect
## local UI import
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.info_page_list_item import InfoPageListItem
from UI.info_page_selector import InfoPageSelector
import config
class ListPageSelector(InfoPageSelector):
def Draw(self):
idx = self._Parent._PsIndex
if idx < len(self._Parent._MyList):
x = self._Parent._MyList[idx]._PosX+2 ## ++
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class PageListItem(InfoPageListItem):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Labels = {}
_Icons = {}
_Fonts = {}
_LinkObj = None
_Active = False
_Value = ""
def Draw(self):
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
if self._Active == True:
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
self._Parent._Icons["done"].Draw()
self._Labels["Text"].Draw(self._Active)
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
self._Labels["Small"].Draw()
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
class LanguagesPage(Page):
_FootMsg = ["Nav","","","Back","Select"]
_MyList = []
_ListFont = MyLangManager.TrFont("notosanscjk15")
_AList = {}
_Scrolled = 0
_BGwidth = 320
_BGheight = 240-24-20
_DrawOnce = False
_Scroller = None
_InfoPage = None
def __init__(self):
Page.__init__(self)
self._Icons = {}
def GenList(self):
self._MyList = []
start_x = 0
start_y = 0
last_height = 0
files_path = [os.path.basename(x) for x in sorted(glob.glob('langs/*.ini'))]
for i,u in enumerate( files_path ):
#print(i,u)
li = PageListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + last_height
li._Width = Width
li._Fonts["normal"] = self._ListFont
li._Active = False
li._Value = u.decode("utf8")
lang_name = u.split("_")[1]
lang_name = lang_name.split(".")[0]
li.Init( lang_name.decode("utf8") )
last_height += li._Height
self._MyList.append(li)
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._HWND = self._Screen._CanvasHWND
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
done = IconItem()
done._ImgSurf = MyIconPool.GiveIconSurface("done")
done._MyType = ICON_TYPES["STAT"]
done._Parent = self
self._Icons["done"] = done
ps = ListPageSelector()
ps._Parent = self
self._Ps = ps
self._PsIndex = 0
self.GenList()
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = self._Width - 10
self._Scroller._PosY = 2
self._Scroller.Init()
self._Scroller.SetCanvasHWND(self._HWND)
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):
if len(self._MyList) == 0:
return
cur_li = self._MyList[self._PsIndex]
if cur_li._Active == True:
return
for i in self._MyList:
i._Active = False
cur_li._Active = True
print(cur_li._Value)
with open(".lang","w") as f:
f.write(cur_li._Value)
self._Screen._MsgBox.SetText("Applying")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
MyLangManager.UpdateLang()
pygame.event.post( pygame.event.Event(RESTARTUI, message="")) ##Restart Launcher
pygame.time.delay(1000)
self._Screen.Draw()
self._Screen.SwapAndShow()
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
with open(".lang", "r") as f:
thelang = f.read()
thelang = thelang.strip()
if thelang == "":
thelang = "English"
for i in self._MyList:
if thelang in i._Value:
i._Active = True
def OnReturnBackCb(self):
pass
"""
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
"""
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self.Click()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
if len(self._MyList) == 0:
return
else:
if len(self._MyList) * PageListItem._Height > self._Height:
self._Ps._Width = self._Width - 11
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
self._Scroller.Draw()
else:
self._Ps._Width = self._Width
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
if self._HWND != None:
self._HWND.fill(MySkinManager.GiveColor("White"))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
class APIOBJ(object):
_Page = None
def __init__(self):
pass
def Init(self,main_screen):
self._Page = LanguagesPage()
self._Page._Screen = main_screen
self._Page._Name ="Languages"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -1,55 +0,0 @@
# -*- coding: utf-8 -*-
import os
import pygame
#import math
#mport subprocess
#from beeprint import pp
from libs.roundrects import aa_round_rect
## local UI import
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.util_funcs import ArmSystem
from UI.lang_manager import MyLangManager
from UI.confirm_page import ConfirmPage
class SwitchToLauncherGoConfirmPage(ConfirmPage):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self._Screen._MsgBox.SetText("Rebooting to LauncherGo")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(300)
ArmSystem("sed -i s/launcher/launchergo/g ~/.bashrc" )
ArmSystem("sudo reboot")
class APIOBJ(object):
_Page = None
def __init__(self):
pass
def Init(self,main_screen):
self._Page = SwitchToLauncherGoConfirmPage()
self._Page._Screen = main_screen
self._Page._Name ="Switch To LauncherGo"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -1,302 +0,0 @@
# -*- coding: utf-8 -*-
import os
import pygame
import platform
#import commands
import glob
#from beeprint import pp
from libs.roundrects import aa_round_rect
## local UI import
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect,FileExists,ArmSystem
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.info_page_list_item import InfoPageListItem
from UI.info_page_selector import InfoPageSelector
import config
class ListPageSelector(InfoPageSelector):
def Draw(self):
idx = self._Parent._PsIndex
if idx < len(self._Parent._MyList):
x = self._Parent._MyList[idx]._PosX+2 ## ++
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class PageListItem(InfoPageListItem):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Labels = {}
_Icons = {}
_Fonts = {}
_LinkObj = None
_Active = False
_Value = ""
def Draw(self):
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
if self._Active == True:
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
self._Parent._Icons["done"].Draw()
self._Labels["Text"].Draw(self._Active)
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
self._Labels["Small"].Draw()
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
class GPUDriverPage(Page):
_FootMsg = ["Nav","","","Back","Select"]
_MyList = []
_ListFont = MyLangManager.TrFont("notosanscjk12")
_AList = {}
_Scrolled = 0
_BGwidth = 320
_BGheight = 240-24-20
_DrawOnce = False
_Scroller = None
_InfoPage = None
def __init__(self):
Page.__init__(self)
self._Icons = {}
def GenList(self):
self._MyList = []
start_x = 0
start_y = 0
last_height = 0
drivers = [["fbturbo","FBTURBO driver (Software Rendering)"],
["modesetting","LIMA driver (Experimental GPU Rendering)"]]
for i,u in enumerate( drivers ):
#print(i,u)
li = PageListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + last_height
li._Width = Width
li._Fonts["normal"] = self._ListFont
li._Active = False
li._Value = u[0]
li.Init( u[1] )
last_height += li._Height
self._MyList.append(li)
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._HWND = self._Screen._CanvasHWND
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
done = IconItem()
done._ImgSurf = MyIconPool.GiveIconSurface("done")
done._MyType = ICON_TYPES["STAT"]
done._Parent = self
self._Icons["done"] = done
ps = ListPageSelector()
ps._Parent = self
self._Ps = ps
self._PsIndex = 0
self.GenList()
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = self._Width - 10
self._Scroller._PosY = 2
self._Scroller.Init()
self._Scroller.SetCanvasHWND(self._HWND)
def Click(self):
if self._PsIndex > len(self._MyList) -1:
return
cur_li = self._MyList[self._PsIndex]
if cur_li._Active == True:
return
print(cur_li._Value)
if "arm" in platform.machine():
for i in self._MyList:
i._Active = False
cur_li._Active = True
self._Screen._MsgBox.SetText("Applying")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
if "modesetting" in cur_li._Value: ## enable lima
os.system("touch %s/.lima" % os.path.expanduser('~') )
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima /usr/lib/xorg/modules/drivers/modesetting_drv.so")
ArmSystem("sudo sed -i '/^#.*lima/s/^#//' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
ArmSystem("sudo ldconfig")
else: #disable lima
os.system("rm %s/.lima" % os.path.expanduser('~') )
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima")
ArmSystem("sudo sed -i 's/^[^#]*lima/#&/' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
ArmSystem("sudo ldconfig")
pygame.time.delay(800)
os.system("sudo reboot")
else:
self._Screen._MsgBox.SetText("Do it in GameShell")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
## grep Driver /etc/xorg.conf | tr -s " " | cut -d " " -f3
## "fbturbo"
## "modesetting"
thedrv = ""
if "arm" in platform.machine():
if FileExists("%s/.lima" % os.path.expanduser('~')):
thedrv = "modesetting"
else:
thedrv = "fbturbo"
if thedrv == "":
thedrv = "fbturbo"
for i in self._MyList:
i._Active = False
for i in self._MyList:
if thedrv in i._Value:
i._Active = True
def OnReturnBackCb(self):
pass
"""
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
"""
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self.Click()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
if len(self._MyList) == 0:
return
else:
if len(self._MyList) * PageListItem._Height > self._Height:
self._Ps._Width = self._Width - 11
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
self._Scroller.Draw()
else:
self._Ps._Width = self._Width
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
if self._HWND != None:
self._HWND.fill(MySkinManager.GiveColor("White"))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
class APIOBJ(object):
_Page = None
def __init__(self):
pass
def Init(self,main_screen):
self._Page = GPUDriverPage()
self._Page._Screen = main_screen
self._Page._Name ="GPU Driver Switch"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -1,264 +0,0 @@
# -*- coding: utf-8 -*-
import os
import platform
import pygame
import glob
#import math
import commands
#from beeprint import pp
from libs.roundrects import aa_round_rect
#import gobject
#from wicd import misc
## local UI import
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect,FileExists,IsExecutable
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.scroller import ListScroller
from UI.icon_pool import MyIconPool
from UI.icon_item import IconItem
from UI.multi_icon_item import MultiIconItem
from UI.lang_manager import MyLangManager
from UI.multilabel import MultiLabel
from UI.info_page_list_item import InfoPageListItem
from UI.info_page_selector import InfoPageSelector
from UI.skin_manager import MySkinManager
class NotifyJobListItem(InfoPageListItem):
_CanvasHWND = None
def Init(self,text):
#self._Fonts["normal"] = fonts["veramono12"]
self._CanvasHWND = self._Parent._CanvasHWND
l = Label()
l._PosX = 10
l.SetCanvasHWND(self._Parent._CanvasHWND)
l.Init(text,self._Fonts["normal"])
self._Labels["Text"] = l
done_icon = IconItem()
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
done_icon._CanvasHWND = self._Parent._CanvasHWND
done_icon._Parent = self
self._Icons["done"] = done_icon
def Draw(self):
if self._ReadOnly == False:
self._Labels["Text"].SetColor(MySkinManager.GiveColor("ReadOnlyText"))
else:
self._Labels["Text"].SetColor(MySkinManager.GiveColor("Text"))
self._Labels["Text"]._PosX = self._Labels["Text"]._PosX + self._PosX
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
self._Labels["Text"].Draw()
self._Labels["Text"]._PosX = self._Labels["Text"]._PosX - self._PosX
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width-5
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
self._Labels["Small"].Draw()
if self._ReadOnly:
self._Icons["done"].NewCoord(self._Width - 25,5)
self._Icons["done"].Draw()
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
class NotificationPage(Page):
_FootMsg = ["Nav","","","Back","Toggle"]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela13")
_AList = {}
_Scrolled = 0
_BGwidth = 320
_BGheight = 240-24-20
_DrawOnce = False
_Scroller = None
_EasingDur = 30
_GSNOTIFY_JOBS = "gsnotify/Jobs"
_GSNOTIFY_SOCKET="/tmp/gsnotify.sock"
_Config =None
_AllowedExts = [".sh",".lsp",".lua",".bin",".py",".js"]
def __init__(self):
Page.__init__(self)
self._Icons = {}
if "arm" in platform.machine():
os.system( "git config --global core.filemode false" )
def GenList(self):
self._MyList = []
## map ini to self._AList
files_path = glob.glob(self._GSNOTIFY_JOBS+"/*")
start_x = 10
start_y = 0
counter = 0
for i,v in enumerate( files_path):
filename, file_extension = os.path.splitext(v)
alias_file = filename + ".alias"
if file_extension in self._AllowedExts:
li = NotifyJobListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + counter*InfoPageListItem._Height
li._Width = Width-10
li._Fonts["normal"] = self._ListFontObj
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
if IsExecutable(v):
li._ReadOnly = True
if os.path.isfile(alias_file):
fp = open(alias_file, "r")
alias = fp.read()
alias = alias.strip()
label_text = alias.decode("utf8")
li.Init( label_text )
fp.close()
else:
li.Init( os.path.basename(v) )
li._Flag = v
##li.SetSmallText( v )
self._MyList.append(li)
counter += 1
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._CanvasHWND = self._Screen._CanvasHWND
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
ps = InfoPageSelector()
ps._PosX = 11
ps._Parent = self
ps._Width = self._Width-10
self._Ps = ps
self._PsIndex = 0
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = 2
self._Scroller._PosY = 2
self._Scroller.Init()
def Click(self):
if len(self._MyList) == 0:
return
cur_li = self._MyList[self._PsIndex]
#print("Click ",cur_li._Flag)
if IsExecutable(cur_li._Flag):
os.system("chmod -x "+cur_li._Flag)
else:
os.system("chmod +x "+cur_li._Flag)
self.GenList()
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
self.GenList()
def OnReturnBackCb(self):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self._Screen._MsgBox.SetText("Applying")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(638)
self.Click()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
self._Ps.Draw()
if len(self._MyList) > 0:
for i in self._MyList:
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*InfoPageListItem._Height,
self._PsIndex*InfoPageListItem._Height)
self._Scroller.Draw()
class APIOBJ(object):
_Page = None
def __init__(self):
pass
def Init(self,main_screen):
self._Page = NotificationPage()
self._Page._Screen = main_screen
self._Page._Name ="Notify"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -4,17 +4,16 @@ import pygame
#UI lib
from UI.constants import RUNSYS
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.confirm_page import ConfirmPage
from UI.lang_manager import MyLangManager
from UI.skin_manager import MySkinManager
import config
class PowerOffConfirmPage(ConfirmPage):
_ConfirmText = MyLangManager.Tr("Confirm Power OFF?")
_ConfirmText = "Confirm Power OFF?"
def CheckBattery(self):
try:
f = open(config.Battery)
@ -42,17 +41,17 @@ class PowerOffConfirmPage(ConfirmPage):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"]:
if self.CheckBattery() < 20:
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
else:
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
cmdpath += "sleep 3;"

View File

@ -12,19 +12,19 @@ from libs.roundrects import aa_round_rect
from UI.constants import Width,Height,ICON_TYPES,POWEROPT
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.skin_manager import SkinManager
import config
class ListPageSelector(PageSelector):
_BackgroundColor = MySkinManager.GiveColor('Front')
_BackgroundColor = SkinManager().GiveColor('Front')
def __init__(self):
self._PosX = 0
@ -84,7 +84,7 @@ class PageListItem(object):
l = Label()
l._PosX = 10
l.SetCanvasHWND(self._Parent._CanvasHWND)
text = MyLangManager.Tr(text)
l.Init(text,self._Fonts["normal"])
self._Labels["Text"] = l
@ -103,13 +103,13 @@ 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,MySkinManager.GiveColor('Line'),(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):
_FootMsg = ["Nav","","","Back",""]
_FootMsg = ["Nav.","","","Back",""]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela15")
_ListFontObj = fonts["varela15"]
_AList = {}
_Time1 = 40
@ -123,22 +123,22 @@ class InfoPage(Page):
m = int(secs/60)
s = secs % 60
if m > 1:
min_str = ("%d "+MyLangManager.Tr("minutes")+" ") % m
min_str = "%d minutes " % m
else:
min_str = ("%d "+MyLangManager.Tr("minute")+" ") % m
min_str = "%d minute " % m
if s == 1:
sec_str = ("%d "+MyLangManager.Tr("second")) % s
sec_str = "%d second" % s
elif s > 1:
sec_str = ("%d "+MyLangManager.Tr("seconds")) % s
sec_str = "%d seconds" % s
elif secs > 0:
if secs > 1:
sec_str = ("%d "+MyLangManager.Tr("seconds")) % secs
sec_str = "%d seconds" % secs
else:
sec_str = ("%d "+MyLangManager.Tr("second")) % secs
sec_str = "%d second" % secs
elif secs == 0:
sec_str = MyLangManager.Tr("Never")
sec_str = "Never"
return min_str + sec_str
@ -156,7 +156,7 @@ class InfoPage(Page):
time1 = {}
time1["key"] = "time1"
if self._Time1 == 0:
time1["value"] = MyLangManager.Tr("Never")
time1["value"] = "Never"
else:
time1["value"] = "%d secs" % self._Time1
time1["label"] = "Screen dimming"
@ -164,7 +164,7 @@ class InfoPage(Page):
time2 = {}
time2["key"] = "time2"
if self._Time2 == 0:
time2["value"] = MyLangManager.Tr("Never")
time2["value"] = "Never"
else:
time2["value"] = "%d secs" % self._Time2
@ -174,7 +174,7 @@ class InfoPage(Page):
time3["key"] = "time3"
if self._Time3 == 0:
time3["value"] = MyLangManager.Tr("Never")
time3["value"] = "Never"
else:
time3["value"] = "%d secs" % self._Time3
time3["label"] = "Power OFF"
@ -189,17 +189,17 @@ class InfoPage(Page):
start_y = 0
for i,v in enumerate( self._AList):
#print(v)
print(v)
li = PageListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + i*PageListItem._Height
li._Width = Width
li._Fonts["normal"] = self._ListFontObj
li._Fonts["small"] = MyLangManager.TrFont("varela12")
li._Fonts["small"] = fonts["varela12"]
if self._AList[v]["label"] != "":
li.Init( self._AList[v]["label"] )
li.Init( self._AList[v]["label"] )
else:
li.Init( self._AList[v]["key"] )
@ -267,7 +267,7 @@ class InfoPage(Page):
"""
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
@ -289,9 +289,9 @@ class InfoPage(Page):
i.Draw()
class PowerOptionsPage(Page):
_FootMsg = ["Nav","Detail","","Back","Select"]
_FootMsg = ["Nav.","","Detail","Back","Select"]
_MyList = []
_ListFont = MyLangManager.TrFont("notosanscjk15")
_ListFont = fonts["notosanscjk15"]
_AList = {}
@ -378,7 +378,7 @@ class PowerOptionsPage(Page):
self._Height = self._Screen._Height
done = IconItem()
done._ImgSurf = MyIconPool.GiveIconSurface("done")
done._ImgSurf = MyIconPool._Icons["done"]
done._MyType = ICON_TYPES["STAT"]
done._Parent = self
self._Icons["done"] = done
@ -401,6 +401,30 @@ class PowerOptionsPage(Page):
self._InfoPage._Screen = self._Screen
self._InfoPage._Name = "Power option detail"
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):
if len(self._MyList) == 0:
@ -421,11 +445,11 @@ class PowerOptionsPage(Page):
config.PowerLevel = cur_li._Value
if config.PowerLevel!= "supersaving":
os.system("sudo iw wlan0 set power_save off > /dev/null")
os.system("sudo iw wlan0 set power_save off")
else:
os.system("sudo iw wlan0 set power_save on > /dev/null")
os.system("sudo iw wlan0 set power_save on")
self._Screen._MsgBox.SetText("Applying")
self._Screen._MsgBox.SetText("Applying...")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
@ -460,12 +484,12 @@ class PowerOptionsPage(Page):
self._Screen.SwapAndShow()
"""
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"]:
self.Click()
if event.key == CurKeys["Up"]:
@ -521,7 +545,7 @@ class PowerOptionsPage(Page):
i.Draw()
if self._HWND != None:
self._HWND.fill(MySkinManager.GiveColor("White"))
self._HWND.fill((255,255,255))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )

View File

@ -1,294 +0,0 @@
# -*- coding: utf-8 -*-
import os
import pygame
#import commands
import glob
#from beeprint import pp
from libs.roundrects import aa_round_rect
## local UI import
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect,FileExists
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.info_page_list_item import InfoPageListItem
from UI.info_page_selector import InfoPageSelector
import config
class ListPageSelector(InfoPageSelector):
def Draw(self):
idx = self._Parent._PsIndex
if idx < len(self._Parent._MyList):
x = self._Parent._MyList[idx]._PosX+2 ## ++
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class PageListItem(InfoPageListItem):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Labels = {}
_Icons = {}
_Fonts = {}
_LinkObj = None
_Active = False
_Value = ""
def Draw(self):
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
if self._Active == True:
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
self._Parent._Icons["done"].Draw()
self._Labels["Text"].Draw(self._Active)
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
self._Labels["Small"].Draw()
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
class SkinsPage(Page):
_FootMsg = ["Nav","","Scan","Back","Select"]
_MyList = []
_ListFont = MyLangManager.TrFont("notosanscjk15")
_AList = {}
_Scrolled = 0
_BGwidth = 320
_BGheight = 240-24-20
_DrawOnce = False
_Scroller = None
_InfoPage = None
def __init__(self):
Page.__init__(self)
self._Icons = {}
def GenList(self):
self._MyList = []
start_x = 0
start_y = 0
last_height = 0
skins = [["../skin/default","Default"]]
files_path = glob.glob("/home/cpi/skins/*")
for i ,v in enumerate(files_path):
if os.path.isdir(v):
bname = os.path.basename(v)
print(v,bname)
skins.append([v,bname])
for i,u in enumerate( skins ):
#print(i,u)
li = PageListItem()
li._Parent = self
li._PosX = start_x
li._PosY = start_y + last_height
li._Width = Width
li._Fonts["normal"] = self._ListFont
li._Active = False
li._Value = u[0]
li.Init( u[1] )
last_height += li._Height
self._MyList.append(li)
def Init(self):
if self._Screen != None:
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
self._HWND = self._Screen._CanvasHWND
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
self._PosX = self._Index*self._Screen._Width
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
done = IconItem()
done._ImgSurf = MyIconPool.GiveIconSurface("done")
done._MyType = ICON_TYPES["STAT"]
done._Parent = self
self._Icons["done"] = done
ps = ListPageSelector()
ps._Parent = self
self._Ps = ps
self._PsIndex = 0
self.GenList()
self._Scroller = ListScroller()
self._Scroller._Parent = self
self._Scroller._PosX = self._Width - 10
self._Scroller._PosY = 2
self._Scroller.Init()
self._Scroller.SetCanvasHWND(self._HWND)
def Click(self):
if len(self._MyList) == 0:
return
cur_li = self._MyList[self._PsIndex]
if cur_li._Active == True:
return
print(cur_li._Value)
for i in self._MyList:
i._Active = False
cur_li._Active = True
self._Screen._MsgBox.SetText("Applying")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
if "../skin/default" in cur_li._Value:
os.system("rm %s/.gameshell_skin" % os.path.expanduser('~') )
else:
os.system("echo %s > %s/.gameshell_skin" % (cur_li._Value,os.path.expanduser('~') ))
pygame.time.delay(700)
pygame.event.post( pygame.event.Event(RESTARTUI, message=""))
def OnLoadCb(self):
self._Scrolled = 0
self._PosY = 0
self._DrawOnce = False
for i in self._MyList:
i._Active = False
for i in self._MyList:
if config.SKIN in i._Value:
i._Active = True
def OnReturnBackCb(self):
pass
"""
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
"""
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self.Click()
if event.key == CurKeys["Up"]:
self.ScrollUp()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Down"]:
self.ScrollDown()
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["X"]:
self.GenList()
for i in self._MyList:
i._Active = False
for i in self._MyList:
if config.SKIN in i._Value:
i._Active = True
self._Screen.Draw()
self._Screen.SwapAndShow()
def Draw(self):
self.ClearCanvas()
if len(self._MyList) == 0:
return
else:
if len(self._MyList) * PageListItem._Height > self._Height:
self._Ps._Width = self._Width - 11
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
self._Scroller.Draw()
else:
self._Ps._Width = self._Width
self._Ps.Draw()
for i in self._MyList:
if i._PosY > self._Height + self._Height/2:
break
if i._PosY < 0:
continue
i.Draw()
if self._HWND != None:
self._HWND.fill(MySkinManager.GiveColor("White"))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
class APIOBJ(object):
_Page = None
def __init__(self):
pass
def Init(self,main_screen):
self._Page = SkinsPage()
self._Page._Screen = main_screen
self._Page._Name ="Skin selection"
self._Page.Init()
def API(self,main_screen):
if main_screen !=None:
main_screen.PushPage(self._Page)
main_screen.Draw()
main_screen.SwapAndShow()
OBJ = APIOBJ()
def Init(main_screen):
OBJ.Init(main_screen)
def API(main_screen):
OBJ.API(main_screen)

View File

@ -7,7 +7,7 @@ import myvars
def InitSoundPage(main_screen):
myvars.SoundPage = SoundPage()
myvars.SoundPage._Screen = main_screen
myvars.SoundPage._Name = "Sound Volume"
myvars.SoundPage._Name = "Sound volume"
myvars.SoundPage.Init()

View File

@ -11,8 +11,9 @@ from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.icon_item import IconItem
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.slider import Slider
from UI.multi_icon_item import MultiIconItem
@ -43,7 +44,7 @@ class SoundSlider(Slider):
self._Height = self._Parent._Height
self._BGpng = IconItem()
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("vol")
self._BGpng._ImgSurf = MyIconPool._Icons["vol"]
self._BGpng._MyType = ICON_TYPES["STAT"]
self._BGpng._Parent = self
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
@ -53,7 +54,7 @@ class SoundSlider(Slider):
self._Scale = MultiIconItem()
self._Scale._MyType = ICON_TYPES["STAT"]
self._Scale._Parent = self
self._Scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
self._Scale._ImgSurf = MyIconPool._Icons["scale"]
self._Scale._IconWidth = 82
self._Scale._IconHeight = 63
self._Scale.Adjust(0,0,82,63,0)
@ -82,7 +83,7 @@ class SoundSlider(Slider):
if self._Value < 0:
self._Value = 0
vol = self.snd_segs[self._Value][0] + (self.snd_segs[self._Value][1] - self.snd_segs[self._Value][0])/2
vol = self.snd_segs[self._Value][0]
if self.OnChangeCB != None:
if callable(self.OnChangeCB):
@ -112,6 +113,7 @@ class SoundPage(Page):
self._Height = self._Screen._Height
self._MySlider = SoundSlider()
self._MySlider._Parent = self
self._MySlider.SetCanvasHWND(self._CanvasHWND)
@ -121,19 +123,19 @@ class SoundPage(Page):
self._MySlider.Init()
try:
m = alsaaudio.Mixer()
self._MySlider.SetValue(m.getvolume()[0])
except Exception,e:
print(str(e))
self._MySlider.SetValue(0)
m = alsaaudio.Mixer()
self._MySlider.SetValue(m.getvolume()[0])
except Exception,e:
print(str(e))
self._MySlider.SetValue(0)
def OnLoadCb(self):
try:
m = alsaaudio.Mixer()
self._MySlider.SetValue(m.getvolume()[0])
except Exception,e:
print(str(e))
try:
m = alsaaudio.Mixer()
self._MySlider.SetValue(m.getvolume()[0])
except Exception,e:
print(str(e))
def WhenSliderDrag(self,value): ##value 0-100
if value < 0 or value > 100:
@ -144,7 +146,7 @@ class SoundPage(Page):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()

View File

@ -6,11 +6,12 @@ import os
## local UI import
from UI.page import Page
from UI.skin_manager import MySkinManager
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
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from libs.roundrects import aa_round_rect
@ -27,7 +28,7 @@ class StoragePage(Page):
_BGmsg = "%.1fGB of %.1fGB Used"
_DskUsg = None
_HighColor = MySkinManager.GiveColor('High')
_HighColor = SkinManager().GiveColor('High')
_FootMsg = ["Nav.","","","Back",""]
def __init__(self):
@ -54,11 +55,11 @@ class StoragePage(Page):
self._Height = self._Screen._Height
self._BGpng = IconItem()
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("icon_sd")
self._BGpng._ImgSurf = MyIconPool._Icons["icon_sd"]
self._BGpng._MyType = ICON_TYPES["STAT"]
self._BGpng._Parent = self
self._BGpng.AddLabel(self._BGmsg % (self._DskUsg[1]-self._DskUsg[0], self._DskUsg[1]), MySkinManager.GiveFont("varela15"))
self._BGpng.AddLabel(self._BGmsg % (self._DskUsg[1]-self._DskUsg[0], self._DskUsg[1]), fonts["varela15"])
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
@ -67,12 +68,12 @@ class StoragePage(Page):
usage_percent = (self._DskUsg[0]/self._DskUsg[1] )*100.0
self._BGlabel.Init("%d%%"% int(usage_percent),MySkinManager.GiveFont("varela25"))
self._BGlabel.Init("%d%%"% int(usage_percent),fonts["varela25"])
self._BGlabel.SetColor( self._HighColor )
self._FreeLabel = Label()
self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
self._FreeLabel.Init("Free",MySkinManager.GiveFont("varela13"))
self._FreeLabel.Init("Free",fonts["varela13"])
self._FreeLabel.SetColor(self._BGlabel._Color)
@ -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_, MySkinManager.GiveColor('Line'), 5, 0, MySkinManager.GiveColor('Line'))
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, MySkinManager.GiveColor('Front'),5,0,MySkinManager.GiveColor('Front'))
aa_round_rect(self._CanvasHWND,rect2, SkinManager().GiveColor('Front'),5,0,SkinManager().GiveColor('Front'))
class APIOBJ(object):

View File

@ -7,9 +7,10 @@ from libs.roundrects import aa_round_rect
from UI.constants import ICON_TYPES
from UI.page import Page
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 MySkinManager
from UI.skin_manager import SkinManager
# a item for List
# - - - - - - - - - - - --
@ -31,7 +32,7 @@ class ListItemIcon(IconItem):
class ListItemLabel(Label):
_ActiveColor = MySkinManager.GiveColor('Active')
_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,MySkinManager.GiveColor('Line'),(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()

View File

@ -10,14 +10,15 @@ from libs.roundrects import aa_round_rect
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.icon_item import IconItem
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
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 MySkinManager
from UI.lang_manager import MyLangManager
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 = MySkinManager.GiveColor('Front')
_BackgroundColor = SkinManager().GiveColor('Front')
def __init__(self):
self._PosX = 0
@ -85,7 +86,7 @@ class TimezoneListPage(Page):
_FootMsg = ["Nav","","","Back","Select"]
_MyList = []
_SwapMyList = []
_ListFont = MyLangManager.TrFont("notosanscjk15")
_ListFont = fonts["notosanscjk15"]
_MyStack = None
_Scroller = None
@ -176,7 +177,7 @@ class TimezoneListPage(Page):
self.SyncList("/usr/share/zoneinfo/posix")
icon_for_list = MultiIconItem()
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
icon_for_list._MyType = ICON_TYPES["STAT"]
icon_for_list._Parent = self
@ -185,11 +186,11 @@ class TimezoneListPage(Page):
self._BGpng = IconItem()
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
self._BGpng._MyType = ICON_TYPES["STAT"]
self._BGpng._Parent = self
self._BGpng.AddLabel("No timezones found on system!", MyLangManager.TrFont("varela22"))
self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
self._BGpng.AddLabel("No timezones found on system!", fonts["varela22"])
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
@ -199,6 +200,35 @@ class TimezoneListPage(Page):
self._Scroller._PosY = 2
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):
if len(self._MyList) == 0:
return
@ -229,7 +259,7 @@ class TimezoneListPage(Page):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
@ -245,16 +275,16 @@ class TimezoneListPage(Page):
self._Screen.SwapAndShow()
if event.key == CurKeys["Right"]:
self.FScrollDown(Step=5)
self.ScrollDown(Step=5)
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Left"]:
self.FScrollUp(Step=5)
self.ScrollUp(Step=5)
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["Enter"]:
self.Click()
def Draw(self):

View File

@ -9,27 +9,23 @@ import gobject
## local UI import
from UI.page import Page
from UI.constants import ICON_TYPES,Width,Height,RUNEVT,RUNSH
from UI.constants import ICON_TYPES,Width,Height,RUNEVT
from UI.icon_item import IconItem
from UI.icon_pool import MyIconPool
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect,CmdClean,get_git_revision_short_hash
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.info_page_list_item import InfoPageListItem
from UI.skin_manager import SkinManager
from libs.roundrects import aa_round_rect
from libs.DBUS import is_wifi_connected_now
import config
LauncherLoc = "/home/cpi/launcher"
class UpdateDownloadPage(DownloadProcessPage):
_MD5 = ""
@ -43,7 +39,7 @@ class UpdateDownloadPage(DownloadProcessPage):
if filename.endswith(".tar.gz"):
#/home/cpi/apps/[launcher]
cmdpath = "tar zxf " + CmdClean(filename) + " -C /home/cpi/ ;rm -rf "+ filename
cmdpath = "tar zxf " + CmdClean(filename) + " -C /home/cpi/apps ;rm -rf "+ filename
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
self.ReturnToUpLevelPage()
@ -64,7 +60,7 @@ class UpdateDownloadPage(DownloadProcessPage):
print(filename)
os.system("rm -rf %s" % CmdClean(filename))
self._Screen._MsgBox.SetText("DownloadFailed")
self._Screen._MsgBox.SetText("Download failed")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
return False
@ -109,22 +105,22 @@ class UpdateConfirmPage(ConfirmPage):
_GIT = False
def KeyDown(self,event):
global LauncherLoc
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"]:
if self._GIT == True:
cmdpath = "%s/update.sh %s" % (LauncherLoc,self._Version)
pygame.event.post( pygame.event.Event(RUNSH, message=cmdpath))
cmdpath = "feh --bg-center /home/cpi/apps/launcher/sys.py/gameshell/wallpaper/updating.png; cd /home/cpi/apps/launcher ;git pull; git reset --hard %s ; feh --bg-center /home/cpi/apps/launcher/sys.py/gameshell/wallpaper/loading.png " % self._Version
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
self._GIT = False
return
if self._DownloadPage == None:
self._DownloadPage = UpdateDownloadPage()
self._DownloadPage._Screen = self._Screen
self._DownloadPage._Name = "Downloading"
self._DownloadPage._Name = "Downloading..."
self._DownloadPage.Init()
self._DownloadPage._MD5 = self._MD5
@ -152,14 +148,65 @@ class UpdateConfirmPage(ConfirmPage):
self.Reset()
class InfoPageListItem(object):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Labels = {}
_Icons = {}
_Fonts = {}
_LinkObj = None
def __init__(self):
self._Labels = {}
self._Icons = {}
self._Fonts = {}
def SetSmallText(self,text):
l = Label()
l._PosX = 40
l.SetCanvasHWND(self._Parent._CanvasHWND)
l.Init(text,self._Fonts["small"])
self._Labels["Small"] = l
def Init(self,text):
#self._Fonts["normal"] = fonts["veramono12"]
l = Label()
l._PosX = 10
l.SetCanvasHWND(self._Parent._CanvasHWND)
l.Init(text,self._Fonts["normal"])
self._Labels["Text"] = l
def Draw(self):
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
self._Labels["Text"].Draw()
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width-5
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
self._Labels["Small"].Draw()
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):
_Icons = {}
_FootMsg = ["Nav","","Check Update","Back",""]
_FootMsg = ["Nav.","Check Update","","Back",""]
_ListFontObj = MyLangManager.TrFont("varela15")
_ListFontObj = fonts["varela15"]
_ConfirmPage = None
_AList = {}
_MyList = []
def __init__(self):
Page.__init__(self)
self._Icons = {}
@ -176,7 +223,7 @@ class UpdatePage(Page):
li._PosY = start_y + i*InfoPageListItem._Height
li._Width = Width
li._Fonts["normal"] = self._ListFontObj
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
li._Fonts["small"] = fonts["varela12"]
if self._AList[v]["label"] != "":
li.Init( self._AList[v]["label"] )
@ -209,8 +256,7 @@ class UpdatePage(Page):
self.GenList()
def CheckUpdate(self):
global LauncherLoc
self._Screen._MsgBox.SetText("CheckingUpdate")
self._Screen._MsgBox.SetText("Checking update...")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
@ -234,12 +280,12 @@ class UpdatePage(Page):
self._Screen.PushPage(self._ConfirmPage)
self._Screen.Draw()
self._ConfirmPage.SnapMsg(MyLangManager.Tr("ConfirmUpdateToFQ") % json_["version"] )
self._ConfirmPage.SnapMsg("Confirm Update to %s ?" % json_["version"] )
self._Screen.SwapAndShow()
elif "gitversion" in json_: ### just use git to run update
cur_dir = os.getcwd()
os.chdir(LauncherLoc)
os.chdir("/home/cpi/apps/launcher")
current_git_version = get_git_revision_short_hash()
current_git_version = current_git_version.strip("\n")
current_git_version = current_git_version.strip("\t")
@ -253,11 +299,11 @@ class UpdatePage(Page):
self._Screen.PushPage(self._ConfirmPage)
self._Screen.Draw()
self._ConfirmPage.SnapMsg(MyLangManager.Tr("UpdateToFQ") % json_["gitversion"] )
self._ConfirmPage.SnapMsg("Update to %s ?" % json_["gitversion"] )
self._Screen.SwapAndShow()
else:
self._Screen.Draw()
self._Screen._MsgBox.SetText("LauncherIsUpToDate")
self._Screen._MsgBox.SetText("Launcher is up to date")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
pygame.time.delay(765)
@ -276,7 +322,7 @@ class UpdatePage(Page):
pass
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
@ -288,12 +334,12 @@ class UpdatePage(Page):
self._Screen.SwapAndShow()
else:
self._Screen.Draw()
self._Screen._MsgBox.SetText("CheckingUpdateFailed")
self._Screen._MsgBox.SetText("Checking update failed")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
else:
self._Screen.Draw()
self._Screen._MsgBox.SetText("CheckWifiConnection")
self._Screen._MsgBox.SetText("Please Check your Wi-Fi connection")
self._Screen._MsgBox.Draw()
self._Screen.SwapAndShow()
@ -314,7 +360,7 @@ class APIOBJ(object):
self._UpdatePage = UpdatePage()
self._UpdatePage._Screen = main_screen
self._UpdatePage._Name = "Update Launcher"
self._UpdatePage._Name ="Update"
self._UpdatePage.Init()
def API(self,main_screen):

View File

@ -13,8 +13,7 @@ except:
def Init(main_screen):
pages.InitPasswordPage(main_screen)
pages.InitScanPage(main_screen)
myvars.PasswordPage._Caller = myvars.ScanPage
def API(main_screen):
if main_screen != None:

View File

@ -8,11 +8,12 @@ from libs import easing
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.icon_item import IconItem
from UI.icon_pool import MyIconPool
from UI.skin_manager import MySkinManager
from UI.skin_manager import SkinManager
from libs.roundrects import aa_round_rect
@ -22,7 +23,11 @@ from text_item import TextItem
import myvars
class KeyboardIcon(IconItem):
_Color = MySkinManager.GiveColor('Text')
_PosX = 0
_PosY = 0
_Width = 0
_Height = 0
_Color = SkinManager().GiveColor('Text')
_MyType = ICON_TYPES["NAV"]
_Parent = None
_Str = ""
@ -52,6 +57,10 @@ class KeyboardSelector(PageSelector):
# pygame.draw.rect(self._Parent._CanvasHWND,(0,0,0),rect,1)
class Keyboard(Page):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 0
_SectionNumbers = 3
_SectionIndex = 1
@ -62,10 +71,9 @@ class Keyboard(Page):
_Textarea = None
_Selector = None
_LeftOrRight = 1
_FootMsg = ["Nav.","Done","ABC","Backspace","Enter"]
_FootMsg = ["Nav.","ABC","Done","Backspace","Enter"]
_RowIndex = 0
_Caller = None
def __init__(self):
self._Secs = {}
@ -107,7 +115,7 @@ class Keyboard(Page):
self._Width = self._Screen._Width
self._Height = self._Screen._Height
fontobj = MySkinManager.GiveFont("veramono24")
fontobj = fonts["veramono24"]
word_margin = 15
start_x = (self._Width - fontobj.size( "".join(self._Secs[0][0]))[0]-len(self._Secs[0][0])*word_margin)/2+word_margin/2
@ -128,7 +136,7 @@ class Keyboard(Page):
if val == "_L" or val == "_R":
it = KeyboardIcon()
it._ImgSurf = MyIconPool.GiveIconSurface(val)
it._ImgSurf = MyIconPool._Icons[val]
it._Parent = self
it._Str = val
it.Init(start_x+it._ImgSurf.get_width()/2 ,start_y,it._ImgSurf.get_width(),it._ImgSurf.get_height(),0)
@ -140,7 +148,7 @@ class Keyboard(Page):
else:
if val == "_S":
val = "Space"
ti._FontObj = MySkinManager.GiveFont("veramono15")
ti._FontObj = fonts["veramono15"]
ti._Bold = True
cur_alpha_size = ti._FontObj.size( val)
@ -290,7 +298,7 @@ class Keyboard(Page):
self.SelectNextChar()
if event.key == CurKeys["Left"]:
self.SelectPrevChar()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"] or event.key == CurKeys["Enter"]:
self.ClickOnChar()
if event.key == CurKeys["X"]:
if self._SectionIndex <= 0:
@ -309,14 +317,10 @@ class Keyboard(Page):
print("".join(self._Textarea._MyWords))
self.ReturnToUpLevelPage()
self._Screen.SwapAndShow()
if self._Caller != None:
on_kbd_return_back_cb = getattr(self._Caller,"OnKbdReturnBackCb",None)
if on_kbd_return_back_cb != None:
if callable( on_kbd_return_back_cb ):
self._Caller.OnKbdReturnBackCb()
#Uplevel page invokes OnReturnBackCb,eg: ConfigWireless
## config and connect now
myvars.ScanPage.ConfigWireless( "".join(self._Textarea._MyWords))
if event.key == CurKeys["B"]:
if event.key == CurKeys["A"]:
self._Textarea.RemoveFromLastText()
self._Textarea.Draw()
self._Screen.SwapAndShow()

View File

@ -5,11 +5,12 @@ import pygame
## local UI import
from UI.page import Page
from UI.label import Label
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 MySkinManager
from UI.widget import Widget
from UI.skin_manager import SkinManager
class NetItemMultiIcon(MultiIconItem):
_CanvasHWND = None
@ -32,7 +33,10 @@ class NetItemIcon(IconItem):
self._CanvasHWND.blit(self._ImgSurf,(self._PosX,self._PosY+(self._Parent._Height-self._Height)/2,self._Width,self._Height))
class NetItem(Widget):
class NetItem(object):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Bssid="" # 50:3A:A0:51:18:3C
@ -137,13 +141,13 @@ class NetItem(Widget):
lock_icon = NetItemIcon()
lock_icon._ImgSurf = MyIconPool.GiveIconSurface("lock")
lock_icon._ImgSurf = MyIconPool._Icons["lock"]
lock_icon._CanvasHWND = self._Parent._CanvasHWND
lock_icon._Parent = self
self._Icons["lock"] = lock_icon
done_icon = NetItemIcon()
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
done_icon._ImgSurf = MyIconPool._Icons["done"]
done_icon._CanvasHWND = self._Parent._CanvasHWND
done_icon._Parent = self
@ -191,6 +195,6 @@ class NetItem(Widget):
self._Icons["wifistatus"].NewCoord(self._Width-23,self._PosY)
self._Icons["wifistatus"].Draw()
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(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)

View File

@ -16,7 +16,7 @@
## local UI import
from libs.DBUS import bus,daemon,wireless,wired
from UI.keyboard import Keyboard
from keyboard import Keyboard
from wifi_list import WifiList
import myvars

View File

@ -3,7 +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 MySkinManager
from UI.skin_manager import SkinManager
class TextItem(IconItem):
_PosX = 0
@ -11,7 +11,7 @@ class TextItem(IconItem):
_Width = 0
_Height = 0
_Str = ""
_Color = MySkinManager.GiveColor('Text')
_Color = SkinManager().GiveColor('Text')
_FontObj = None
_Bold = False
_MyType = ICON_TYPES["LETTER"]

View File

@ -3,15 +3,21 @@
import pygame
from libs.roundrects import aa_round_rect
## local UI import
from UI.page import Page,PageStack,PageSelector
from UI.label import Label
from UI.skin_manager import MySkinManager
from UI.lang_manager import MyLangManager
from UI.widget import Widget
from UI.fonts import fonts
from UI.skin_manager import SkinManager
class Textarea(Widget):
_BackgroundColor = MySkinManager.GiveColor('TitleBg')
class Textarea:
_PosX =0
_PosY = 0
_Width = 0
_Height = 0
_BackgroundColor = SkinManager().GiveColor('TitleBg')
_CanvasHWND = None
_MyWords = []
_BlitWords = []
@ -26,7 +32,7 @@ class Textarea(Widget):
pass
def Init(self):
self._FontObj = MyLangManager.TrFont("veramono24")
self._FontObj = fonts["veramono24"]
#pygame.font.Font(fonts_path["veramono"],24)
def SubTextIndex(self):
@ -64,7 +70,7 @@ class Textarea(Widget):
self.BlitText()
self.AddTextIndex()
else:
print("is Full %s" % "".join(str(self._MyWords)))
print("is Full %s" % "".join(self._MyWords))
def BuildBlitText(self):
blit_rows = [[]]
@ -74,7 +80,7 @@ class Textarea(Widget):
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()

View File

@ -10,34 +10,81 @@ from wicd import misc
from UI.constants import Width,Height
from UI.page import Page,PageSelector
from UI.label import Label
from UI.util_funcs import midRect,SwapAndShow,FileExists,ReadTheFileContent
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.fonts import fonts
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.info_page_list_item import InfoPageListItem
from UI.info_page_selector import InfoPageSelector
from libs.DBUS import is_wifi_connected_now
from UI.skin_manager import SkinManager
from net_item import NetItem
import myvars
class InfoPageListItem(object):
_PosX = 0
_PosY = 0
_Width = 0
_Height = 30
_Labels = {}
_Icons = {}
_Fonts = {}
_LinkObj = None
def __init__(self):
self._Labels = {}
self._Icons = {}
self._Fonts = {}
def SetSmallText(self,text):
l = Label()
l._PosX = 40
l.SetCanvasHWND(self._Parent._CanvasHWND)
l.Init(text,self._Fonts["small"])
self._Labels["Small"] = l
def Init(self,text):
#self._Fonts["normal"] = fonts["veramono12"]
l = Label()
l._PosX = 10
l.SetCanvasHWND(self._Parent._CanvasHWND)
l.Init(text,self._Fonts["normal"])
self._Labels["Text"] = l
def Draw(self):
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
self._Labels["Text"].Draw()
if "Small" in self._Labels:
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width-5
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
self._Labels["Small"].Draw()
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 WifiDisconnectConfirmPage(ConfirmPage):
_ConfirmText = MyLangManager.Tr("ConfirmDisconnectQ")
_ConfirmText = "Confirm Disconnect?"
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
self.SnapMsg(MyLangManager.Tr("Disconnecting"))
if event.key == CurKeys["B"]:
self.SnapMsg("Disconnecting...")
self._Screen.Draw()
self._Screen.SwapAndShow()
@ -58,10 +105,36 @@ class WifiDisconnectConfirmPage(ConfirmPage):
self.Reset()
class WifiInfoPageSelector(PageSelector):
_BackgroundColor = SkinManager().GiveColor('Front')
def __init__(self):
self._PosX = 0
self._PosY = 0
self._Height = 0
self._Width = Width
def AnimateDraw(self,x2,y2):
pass
def Draw(self):
idx = self._Parent._PsIndex
if idx < len(self._Parent._MyList):
x = 2
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class WifiInfoPage(Page):
_FootMsg = ["Nav","","","Back",""]
_FootMsg = ["Nav.","Disconnect","","Back",""]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela15")
_ListFontObj = fonts["varela15"]
_Wireless = None
_Daemon = None
@ -82,11 +155,7 @@ class WifiInfoPage(Page):
self._AList["ip"]["value"] = ip
self._AList["bssid"]["value"] = self._Wireless.GetWirelessProperty(self._NetworkId,"bssid")
if FileExists("/sys/class/net/wlan0/address"):
self._AList["mac_addr"]["value"] = ReadTheFileContent("/sys/class/net/wlan0/address").strip().upper()
else:
self._AList["mac_addr"]["value"] = ""
start_x = 0
start_y = 0
@ -97,7 +166,7 @@ class WifiInfoPage(Page):
li._PosY = start_y + i*InfoPageListItem._Height
li._Width = Width
li._Fonts["normal"] = self._ListFontObj
li._Fonts["small"] = MyLangManager.TrFont("varela12")
li._Fonts["small"] = fonts["varela12"]
if self._AList[v]["label"] != "":
li.Init( self._AList[v]["label"] )
@ -119,9 +188,8 @@ class WifiInfoPage(Page):
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
ps = InfoPageSelector()
ps = WifiInfoPageSelector()
ps._Parent = self
ps._PosX = 2
self._Ps = ps
self._PsIndex = 0
@ -134,16 +202,10 @@ class WifiInfoPage(Page):
bssid["key"] = "bssid"
bssid["label"] = "BSSID"
bssid["value"] = ""
mac_addr = {}
mac_addr["key"] = "mac_addr"
mac_addr["label"] = "MAC ADDR"
mac_addr["value"] = ""
self._AList["ip"] = ip
self._AList["bssid"] = bssid
self._AList["mac_addr"] = mac_addr
self.GenList()
self._DisconnectConfirmPage = WifiDisconnectConfirmPage()
@ -151,6 +213,30 @@ class WifiInfoPage(Page):
self._DisconnectConfirmPage._Name = "Confirm Disconnect"
self._DisconnectConfirmPage._Parent = self
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):
cur_li = self._MyList[self._PsIndex]
@ -168,9 +254,9 @@ class WifiInfoPage(Page):
def OnLoadCb(self):
if self._Wireless.GetCurrentNetworkID(self._Wireless.GetIwconfig()) == self._NetworkId \
and self._Wireless.GetWirelessIP('') is not None:
self._FootMsg[2] = "Disconnect"
self._FootMsg[1] = "Disconnect"
else:
self._FootMsg[2] = ""
self._FootMsg[1] = ""
self.GenList()
@ -180,7 +266,7 @@ class WifiInfoPage(Page):
self._Screen.SwapAndShow()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
@ -195,7 +281,7 @@ class WifiInfoPage(Page):
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["Enter"]:
self.Click()
if event.key == CurKeys["X"]:
@ -212,10 +298,12 @@ class WifiInfoPage(Page):
class WifiListSelector(PageSelector):
_BackgroundColor = MySkinManager.GiveColor('Front')
_BackgroundColor = SkinManager().GiveColor('Front')
def __init__(self):
pass
self._PosX = 0
self._PosY = 0
self._Height = 0
def AnimateDraw(self,x2,y2):
pass
@ -223,10 +311,10 @@ class WifiListSelector(PageSelector):
def Draw(self):
idx = self._Parent._PsIndex
if idx < len( self._Parent._MyList):
x = self._Parent._MyList[idx]._PosX+11
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
if idx < len( self._Parent._WirelessList):
x = self._Parent._WirelessList[idx]._PosX+11
y = self._Parent._WirelessList[idx]._PosY+1
h = self._Parent._WirelessList[idx]._Height -3
self._PosX = x
self._PosY = y
@ -246,14 +334,14 @@ class WifiListMessageBox(Label):
x = (self._Parent._Width - w)/2
y = (self._Parent._Height - h)/2
padding = 10
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(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,MySkinManager.GiveColor('Black'),(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))
class WifiList(Page):
_MyList = []
_WirelessList = []
#Wicd dbus part
_Wireless = None
_Daemon = None
@ -273,17 +361,16 @@ class WifiList(Page):
_BlockCb = None
_LastStatusMsg = ""
_FootMsg = ["Nav","Info","Scan","Back","Enter"]
_FootMsg = ["Nav.","Scan","Info","Back","Enter"]
_EncMethods = None
_Scroller = None
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
_ListFontObj = fonts["notosanscjk15"]
_InfoPage = None
_CurBssid = ""
def __init__(self):
Page.__init__(self)
self._MyList = []
self._WirelessList = []
self._CanvasHWND = None
def ShowBox(self,msg):
@ -300,7 +387,7 @@ class WifiList(Page):
self._Screen.SwapAndShow()
def GenNetworkList(self):
self._MyList = []
self._WirelessList = []
start_x = 0
start_y = 0
@ -319,7 +406,7 @@ class WifiList(Page):
#ni._Bssid = self._Wireless.GetWirelessProperty(network_id,"bssid")
ni.Init(network_id,is_active)
self._MyList.append(ni)
self._WirelessList.append(ni)
self._PsIndex = 0
@ -357,7 +444,7 @@ class WifiList(Page):
return
self._Scanning = True
self.ShowBox(MyLangManager.Tr("Wifi scanning"))
self.ShowBox("Wifi scanning...")
self._BlockingUI = True
print("dbus says start scan...")
@ -380,8 +467,8 @@ class WifiList(Page):
if info != None:
if len(info) > 3:
_id = int(info[3])
if _id < len(self._MyList):
self._MyList[_id].UpdateStrenLabel( str(info[2]))
if _id < len(self._WirelessList):
self._WirelessList[_id].UpdateStrenLabel( str(info[2]))
self._PrevWicdState = state
@ -501,14 +588,7 @@ class WifiList(Page):
return True
def ConfigWireless(self,password):
netid = self._PsIndex
for i,v in enumerate(self._MyList):
if v._Bssid == self._CurBssid:
netid = i
break
print(netid," ", password)
"""
self._Wireless.SetWirelessProperty(netid,"dhcphostname","GameShell")
@ -531,9 +611,9 @@ class WifiList(Page):
self._Wireless.SetWirelessProperty(netid,"apsk",password)
self._Wireless.SetWirelessProperty(netid,"automatic",1)
self.ShowBox(MyLangManager.Tr("Connecting"))
self.ShowBox("Connecting...")
self._MyList[netid].Connect()
self._WirelessList[netid].Connect()
print("after Connect")
self.UpdateStatus()
@ -567,37 +647,37 @@ class WifiList(Page):
"""
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):
self.HideBox()
self._Screen._FootBar.ResetNavText()
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
def OnKbdReturnBackCb(self):
password_inputed = "".join(myvars.PasswordPage._Textarea._MyWords)
if is_wifi_connected_now() == False:
self.ConfigWireless(password_inputed)
else:
for i in range(0,10):
if is_wifi_connected_now() == True:
self.ShowBox(MyLangManager.Tr("Launching"))
self._Daemon.Disconnect()
self._Daemon.SetForcedDisconnect(True)
self._Connecting = False
else:
break
pygame.time.delay(100)
if is_wifi_connected_now() == False:
self.ConfigWireless(password_inputed)
else:
self.ShowBox(MyLangManager.Tr("Disconnect first"))
def OnReturnBackCb(self):
pass
def KeyDown(self,event):
@ -605,12 +685,12 @@ class WifiList(Page):
# print("UI blocking ...")
# return
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
if self._Wireless != None:
wireless_connecting = self._Wireless.CheckIfWirelessConnecting()
if wireless_connecting:
self.ShutDownConnecting()
self.ShowBox(MyLangManager.Tr("ShutDownConnecting"))
self.ShowBox("ShutDownConnecting...")
self._BlockingUI=True
self._BlockCb = self.AbortedAndReturnToUpLevel
else:
@ -630,14 +710,13 @@ class WifiList(Page):
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key): ## enter to set password,enter is B on GM
if len(self._MyList) == 0:
if event.key == CurKeys["Enter"]: ## enter to set password,enter is B on GM
if len(self._WirelessList) == 0:
return
self._CurBssid = self._MyList[self._PsIndex]._Bssid
wicd_wirelss_encrypt_pwd = self.GetWirelessEncrypt(self._PsIndex)
if self._MyList[self._PsIndex]._IsActive:
if self._WirelessList[self._PsIndex]._IsActive:
self.ShowBox( self._Wireless.GetWirelessIP('') )
else:
self._Screen.PushCurPage()
@ -647,8 +726,8 @@ class WifiList(Page):
for i in wicd_wirelss_encrypt_pwd:
if "preshared_key" in i:
if i["preshared_key"] != None:
if len(str(i["preshared_key"])) > 0:
thepass = str(i["preshared_key"])
if len(i["preshared_key"]) > 0:
thepass = i["preshared_key"]
break
myvars.PasswordPage.SetPassword(thepass)
@ -667,7 +746,7 @@ class WifiList(Page):
self.Rescan(False)
if event.key == CurKeys["Y"]:
if len(self._MyList) == 0:
if len(self._WirelessList) == 0:
return
self._InfoPage._NetworkId = self._PsIndex
@ -697,7 +776,7 @@ class WifiList(Page):
msgbox = WifiListMessageBox()
msgbox._CanvasHWND = self._CanvasHWND
msgbox.Init(" ",MyLangManager.TrFont("veramono12"))
msgbox.Init(" ",fonts["veramono12"])
msgbox._Parent = self
self._MsgBox = msgbox
@ -730,19 +809,19 @@ class WifiList(Page):
self._InfoPage = WifiInfoPage()
self._InfoPage._Screen = self._Screen
self._InfoPage._Name = MyLangManager.Tr("Wifi info")
self._InfoPage._Name = "Wifi info"
self._InfoPage.Init()
def Draw(self):
self.ClearCanvas()
if len(self._MyList) == 0:
if len(self._WirelessList) == 0:
return
self._Ps.Draw()
for i in self._MyList:
for i in self._WirelessList:
i.Draw()
self._Scroller.UpdateSize( len(self._MyList)*NetItem._Height, self._PsIndex*NetItem._Height)
self._Scroller.UpdateSize( len(self._WirelessList)*NetItem._Height, self._PsIndex*NetItem._Height)
self._Scroller.Draw()

View File

@ -7,7 +7,8 @@ import pygame
## local UI import
from UI.page import Page
from UI.label import Label
from UI.lang_manager import MyLangManager
from UI.fonts import fonts
# a item for List
# - - - - - - - - - - - --
# | Icon Text..... > |
@ -33,6 +34,9 @@ class ListItem(object):
self._Icons = {}
self._Fonts = {}
def Init(self,text):
#self._Fonts["normal"] = fonts["veramono12"]
@ -40,7 +44,7 @@ class ListItem(object):
l = Label()
l._PosX = 16
l.SetCanvasHWND(self._Parent._CanvasHWND)
text = MyLangManager.Tr(text)
l.Init(text,self._Fonts["normal"])
self._Labels["Text"] = l

View File

@ -9,17 +9,44 @@ from libs.roundrects import aa_round_rect
from UI.constants import Width,Height
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect,FileExists
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.scroller import ListScroller
from UI.skin_manager import MySkinManager
from UI.lang_manager import MyLangManager
from UI.info_page_selector import InfoPageSelector
from UI.skin_manager import SkinManager
from list_item import ListItem
import myvars
class ListPageSelector(PageSelector):
_BackgroundColor = SkinManager().GiveColor('Front')
def __init__(self):
self._PosX = 0
self._PosY = 0
self._Height = 0
self._Width = Width
def AnimateDraw(self,x2,y2):
pass
def Draw(self):
idx = self._Parent._PsIndex
if idx < len(self._Parent._MyList):
x = 2
y = self._Parent._MyList[idx]._PosY+1
h = self._Parent._MyList[idx]._Height -3
self._PosX = x
self._PosY = y
self._Height = h
aa_round_rect(self._Parent._CanvasHWND,
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
class ListPage(Page):
_Icons = {}
@ -27,7 +54,7 @@ class ListPage(Page):
_FootMsg = ["Nav","","","Back","Enter"]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela15")
_ListFontObj = fonts["varela15"]
_Scroller = None
@ -44,9 +71,8 @@ class ListPage(Page):
self._CanvasHWND = self._Screen._CanvasHWND
ps = InfoPageSelector()
ps = ListPageSelector()
ps._Parent = self
ps._PosX = 2
self._Ps = ps
self._PsIndex = 0
@ -54,22 +80,14 @@ class ListPage(Page):
alist = [["","Airplane","Airplane Mode"],
["","PowerOptions","Power Options"],
["","Wifi","Wi-Fi"],
["","Bluetooth","Bluetooth"],
["","Sound","Sound Volume"],
["","Sound","Sound Volume"],
["","Brightness","BackLight Brightness"],
["","Storage",""],
["","Time","Timezone"],
["","Languages","Languages"],
["","Notification","Notification"],
["","Update", "Update Launcher"],
["","Cores", "Retroarch cores manager"],
["","Update", ""],
["","About", "About"],
["","PowerOFF","Power OFF"],
["","ButtonsLayout","Buttons Layout"],
["","Skins","Theme Manager"],
["","LauncherGo","Switch to LauncherGo"],
["","Lima","GPU Driver Switch"],
["","GateWay","Network gateway switch"]]
["","PowerOFF","Power off"],
["","ButtonsLayout","Buttons Layout"],]
start_x = 0
start_y = 0
@ -105,6 +123,30 @@ class ListPage(Page):
self._Scroller._PosY = 2
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):
cur_li = self._MyList[self._PsIndex]
if cur_li._LinkObj != None:
@ -115,7 +157,7 @@ class ListPage(Page):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
@ -130,7 +172,7 @@ class ListPage(Page):
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["Enter"]:
self.Click()
def Draw(self):

View File

@ -0,0 +1,6 @@
ROM=/home/cpi/games/MAME
ROM_SO=/home/cpi/apps/emulators/mame2003_plus_libretro.so
EXT=zip
LAUNCHER=retroarch -L
TITLE=MAME Roms
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mame2003_plus_libretro.so.zip

View File

@ -0,0 +1,6 @@
ROM=/home/cpi/games/MGBA
ROM_SO=/home/cpi/apps/emulators/mgba_libretro.so
EXT=gb,gbc,gba,gbx
LAUNCHER=retroarch -L
TITLE=MGBA Roms
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mgba_libretro.so.zip

View File

@ -0,0 +1,7 @@
ROM=/home/cpi/games/NESTOPIA
ROM_SO=/home/cpi/apps/emulators/nestopia_libretro.so
EXT=zip,nes
LAUNCHER=retroarch -L
TITLE=NESTOPIA Roms
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/nestopia_libretro.so.zip

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
#!/bin/bash
retroarch

View File

@ -1,6 +0,0 @@
ROM=/home/cpi/games/ChocoDM
ROM_SO=
EXT=wad
LAUNCHER=chocolate-doom -iwad
TITLE=ChocoDM
SO_URL=

View File

@ -1,4 +0,0 @@
#!/bin/bash
cd /home/cpi/games/PICO-8/pico-8 || exit
SDL_VIDEODRIVER=x11 DISPLAY=:0 ./pico8_dyn -splore -draw_rect 32,0,256,240

View File

@ -1,11 +0,0 @@
#!/bin/bash
mkdir ~/.lexaloffle
cp -rf pico-8 ~/.lexaloffle
mkdir ~/.lexaloffle/pico-8/carts
ln -s ~/.lexaloffle/pico-8/carts/ ~/games/PICO-8/carts
touch .done

View File

@ -1,19 +0,0 @@
{
"GameDir": "/home/cpi/games/PICO-8/",
"InstallDir": "pico-8",
"NotFoundMsg": [
"Please purchase the PICO-8 \n|None|varela16",
"and copy it to the \"~/games/PICO-8\"|None|varela16"
],
"MD5": {
"pico-8_0.2.2_raspi.zip": "e2dba152bf507d337459e9316061411d",
"pico-8_0.1.11g_raspi.zip": "a3f2995cf117499f880bd964d6a0e1f2",
"pico-8_0.1.11g_amd64.zip": "6726141c784afd4a41be6b7414c1b932",
"pico-8_0.1.12_raspi.zip": "08eda95570e63089a2b9f5531503431e",
"pico-8_0.1.12c_raspi.zip": "1a62b0d7d4e4be65f89f23ec9757cb66",
"pico-8_0.1.12c2_raspi.zip": "7a878795472fa39304e9a10128c1f712",
"pico-8_0.2.0e_raspi.zip": "085edfecd111c2b195b878b2197afe7a",
"pico-8.zip": "whatever it takes"
},
"Post-Up": "bash Post-Up.sh"
}

View File

@ -1,99 +0,0 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Configuration for pico-8
//
// config.txt is read on startup and saved on exit.
// To generate the default config.txt, delete this file.
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// :: Video Settings
window_size 0 0 // window width, height
screen_size 0 0 // screen width, height (stretched to window)
show_fps 0 // Draw frames per second in the corner
// :: Window Settings
windowed 0 // 1 to start up in windowed mode
window_position -1 -1 // x and y position of window, or -1, -1 to let the window manager decide
frameless 0 // 1 to use a window with no frame
fullscreen_method 0 // 0 maximized window (linux) 1 borderless desktop-sized window 2 fullscreen
// :: System Settings
foreground_sleep_ms 1 // number of milliseconds to sleep each frame. Try 10 to conserve battery power
background_sleep_ms 20 // number of milliseconds to sleep each frame when running in the background
sessions 4 // number of times program has been run
// (scancode) hold this key down and left-click to simulate right-click
rmb_key 0 // 0 for none 226 for LALT
// 0:off 1: ignore SDL_TEXTINPUT and use SDL_GetKeyboardState instead (mapped to a US layout)
emulate_textinput 1
// Desktop for saving screenshots etc. Defaults to $HOME/Desktop
desktop_path
// :: Audio Settings
sound_volume 256 // 0..256
music_volume 256 // 0..256
mix_buffer_size 1024 // usually 1024. Try 2048 if you get choppy sound
// ::
version 0.1.11g
// Location of pico-8's root folder
root_path /home/cpi/.lexaloffle/pico-8/carts/
// Location of cartridge save data
cdata_path /home/cpi/.lexaloffle/pico-8/cdata/
// Specify which player index joystick control begins at (0..7)
joystick_index 0
// Custom keyboard scancodes for buttons. player0 0..6, player1 0..5
button_keys 0 0 0 0 13 14 0 0 0 0 0 0 0
// Play notes as they are plotted in frequency mode
live_notes 0
// iff 1: when using keyboard cursor, snap to closest pixel / map cel
cursor_snap 0
// maximum length of gif in seconds (1..120, default 8)
gif_len 8
// 0 classic 1 dark blue background in code editor
gui_theme 0
// scale of screenshots and gifs // 2 means 256x256
screenshot_scale 3
gif_scale 2
// when 1 can enter glyphs using shift-A..Z
shift_glyphs 1
// 0 for off. 1 to notify whenever unsaved changes are backed up
show_backup_messages 1
// 0 for off. 1 to allow control of a cart's framerate due to host machine's cpu capacity (recommended)
host_framerate_control 1
// filter splore content
// 0 for no filter (18+) 1 medium (13+) 2 maximum (kid-friendly)
content_filter 1

View File

@ -1,90 +0,0 @@
codo_init
platform: Linux
Found config.txt
01 window_size 0 0 // window width, height
02 screen_size 0 0 // screen width, height (stretched to window)
03 show_fps 0 // Draw frames per second in the corner
04 windowed 0 // 1 to start up in windowed mode
05 window_position -1 -1 // x and y position of window, or -1, -1 to let the window manager decide
new window position: -1, -1
06 frameless 0 // 1 to use a window with no frame
07 fullscreen_method 1 // 0 maximized window (linux) 1 borderless desktop-sized window 2 fullscreen
08 foreground_sleep_ms 1 // number of milliseconds to sleep each frame. Try 10 to conserve battery power
09 background_sleep_ms 20 // number of milliseconds to sleep each frame when running in the background
10 sessions 3 // number of times program has been run
11 rmb_key 0 // 0 for none 226 for LALT
12 emulate_textinput 1
13 desktop_path
14 sound_volume 256 // 0..256
15 music_volume 256 // 0..256
16 mix_buffer_size 1024 // usually 1024. Try 2048 if you get choppy sound
17 version 0.1.11g
18 root_path /home/cpi/.lexaloffle/pico-8/carts/
19 cdata_path /home/cpi/.lexaloffle/pico-8/cdata/
20 joystick_index 0
21 button_keys 0 0 0 0 0 0 0 0 0 0 0 0 0
22 live_notes 0
23 cursor_snap 0
24 gif_len 8
25 gui_theme 0
26 screenshot_scale 3
27 gif_scale 2
28 shift_glyphs 1
29 show_backup_messages 1
30 host_framerate_control 1
31 content_filter 1
codo_system_init
Compiled against SDL version: 2.0.7
Linked against SDL version: 2.0.5
Built-in video drivers: 0 x11 1 wayland 2 dummy
Current video driver: x11
Built-in render drivers:
Renderer opengl:
Flags: 0x0000000E ( | | )
Texture formats (1): ARGB8888
Renderer opengles2:
Flags: 0x0000000E ( | | )
Texture formats (4): ARGB8888, ABGR8888, RGB888, BGR888
Renderer software:
Flags: 0x00000009 ( | )
Texture formats (8): ARGB8888, ABGR8888, RGBA8888, BGRA8888, RGB888, BGR888, RGB565, RGB555
codo_reset_timer
codo_gui_init
codo_keys_init
codo_text_init
codo_video_init
codo_mouse_init
codo_joystick_init
Reading controller mappings: /home/cpi/.lexaloffle/pico-8/sdl_controllers.txt
searching for joysticks
found 0 joysticks
ok
ok
codo_load_pod: /home/cpi/apps/Menu/50_PICO-8/pico8.dat ok
codo_set_screen 128 128 8 100
set pixel_perfect 1
window size: 640 480
codo_plat_pi: forcing fullscreen mode
Current renderer:
Renderer opengl:
Flags: 0x0000000A ( | )
Texture formats (5): ARGB8888, YV12, IYUV, 0x3231564e, 0x3132564e
Max Texture Size: 8192x8192
codo_sound_init mix_buffer_size: 1024
codo_sound_init
SDL_INIT_AUDIO ok
SDL_OpenAudio ok
Built-in audio drivers: 0 pulseaudio 1 alsa 2 sndio 3 dsp 4 disk 5 dummy
Current audio driver: alsa
codo_exit
cmusic_stop
codo_main_exit
codo_config_save
codo_sound_exit
codo_video_exit
codo_joystick_exit
codo_system_exit
codo_items_created: 1023
ok

View File

@ -1 +0,0 @@
// add SDL2 game controller mappings to this file

View File

@ -1,3 +0,0 @@
#!/bin/bash
exit 0

View File

@ -1,2 +1 @@
#!/bin/bash
retroarch -L /home/cpi/apps/emulators/nxengine_libretro.so /home/cpi/games/nxengine/cavestory/data

View File

@ -7,9 +7,10 @@ from libs.roundrects import aa_round_rect
from UI.constants import ICON_TYPES
from UI.page import Page
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 MySkinManager
from UI.skin_manager import SkinManager
# a item for List
# - - - - - - - - - - - --
@ -31,7 +32,7 @@ class ListItemIcon(IconItem):
class ListItemLabel(Label):
_ActiveColor = MySkinManager.GiveColor('Active')
_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,MySkinManager.GiveColor('Line'),(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,MySkinManager.GiveColor('Active'),(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()

View File

@ -15,12 +15,12 @@ from beeprint import pp
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.icon_item import IconItem
from UI.icon_pool import MyIconPool
from UI.skin_manager import MySkinManager
from UI.lang_manager import MyLangManager
from UI.skin_manager import SkinManager
from threading import Thread
@ -79,11 +79,11 @@ class MPDSpectrumPage(Page):
_Selector=None
_FootMsg = ["Nav","","","Back",""]
_MyList = []
_ListFont = MyLangManager.TrFont("veramono12")
_SongFont = MyLangManager.TrFont("notosanscjk12")
_ListFont = fonts["veramono12"]
_SongFont = fonts["notosanscjk12"]
_PIFI = None
_FIFO = None
_Color = MySkinManager.GiveColor('Front')
_Color = SkinManager().GiveColor('Front')
_GobjectIntervalId = -1
_Queue = None
_KeepReading = True
@ -136,26 +136,26 @@ class MPDSpectrumPage(Page):
"""
self._BGpng = IconItem()
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("sheep_bg")
self._BGpng._ImgSurf = MyIconPool._Icons["sheep_bg"]
self._BGpng._MyType = ICON_TYPES["STAT"]
self._BGpng._Parent = self
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
self._SheepHead = IconItem()
self._SheepHead._ImgSurf = MyIconPool.GiveIconSurface("sheep_head")
self._SheepHead._ImgSurf = MyIconPool._Icons["sheep_head"]
self._SheepHead._MyType = ICON_TYPES["STAT"]
self._SheepHead._Parent = self
self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)
self._SheepBody = IconItem()
self._SheepBody._ImgSurf = MyIconPool.GiveIconSurface("sheep_body")
self._SheepBody._ImgSurf = MyIconPool._Icons["sheep_body"]
self._SheepBody._MyType = ICON_TYPES["STAT"]
self._SheepBody._Parent = self
self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
"""
self._cwp_png = IconItem()
self._cwp_png._ImgSurf = MyIconPool.GiveIconSurface("tape")
self._cwp_png._ImgSurf = MyIconPool._Icons["tape"]
self._cwp_png._MyType = ICON_TYPES["STAT"]
self._cwp_png._Parent = self
self._cwp_png.Adjust(0,0,79,79,0)
@ -163,22 +163,22 @@ class MPDSpectrumPage(Page):
self._song_title = Label()
self._song_title.SetCanvasHWND(self._RollCanvas)
self._song_title.Init("Untitled",self._SongFont,MySkinManager.GiveColor('White'))
self._song_title.Init("Untitled",self._SongFont,SkinManager().GiveColor('White'))
self._title = Label()
self._title.SetCanvasHWND(self._CanvasHWND)
self._title.Init("Title:",self._ListFont,MySkinManager.GiveColor('White'))
self._title.Init("Title:",self._ListFont,SkinManager().GiveColor('White'))
self._time = Label()
self._time.SetCanvasHWND(self._CanvasHWND)
self._time.Init("Time:",self._ListFont,MySkinManager.GiveColor('White'))
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,
MySkinManager.GiveColor('White'))
SkinManager().GiveColor('White'))
self.Start()
@ -229,7 +229,7 @@ class MPDSpectrumPage(Page):
def ClearCanvas(self):
self._CanvasHWND.fill(MySkinManager.GiveColor('Black'))
self._CanvasHWND.fill(SkinManager().GiveColor('Black'))
def SgsSmooth(self):
passes = 1
@ -265,7 +265,7 @@ class MPDSpectrumPage(Page):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
try:
os.close(self._FIFO)
self._FIFO = None
@ -281,6 +281,13 @@ class MPDSpectrumPage(Page):
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Start"]:
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Enter"]:
pass
def Draw(self):
self.ClearCanvas()
@ -336,7 +343,7 @@ class MPDSpectrumPage(Page):
if self._RollCanvas != None:
# self._RollCanvas.fill((111,22,33))
self._RollCanvas.fill(MySkinManager.GiveColor('Black'))
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
@ -410,9 +417,9 @@ class MPDSpectrumPage(Page):
else:
self._capYPositionArray[i] = value
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(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,MySkinManager.GiveColor('White'),(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

View File

@ -8,14 +8,14 @@ from libs.roundrects import aa_round_rect
from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.label import Label
from UI.fonts import fonts
from UI.icon_item import IconItem
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
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 MySkinManager
from UI.lang_manager import MyLangManager
from UI.skin_manager import SkinManager
from list_item import ListItem
@ -49,7 +49,7 @@ class MusicLibStack:
return len(self.stack)
class ListPageSelector(PageSelector):
_BackgroundColor = MySkinManager.GiveColor('Front')
_BackgroundColor = SkinManager().GiveColor('Front')
def __init__(self):
self._PosX = 0
@ -81,10 +81,10 @@ class MusicLibListPage(Page):
_Icons = {}
_Selector=None
_FootMsg = ["Nav","","Scan","Back","Add to Playlist"]
_FootMsg = ["Nav","Scan","","Back","Add to Playlist"]
_MyList = []
_SwapMyList = []
_ListFont = MyLangManager.TrFont("notosanscjk15")
_ListFont = fonts["notosanscjk15"]
_MyStack = None
_Scroller = None
@ -172,7 +172,7 @@ class MusicLibListPage(Page):
self.SyncList("/")
icon_for_list = MultiIconItem()
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
icon_for_list._MyType = ICON_TYPES["STAT"]
icon_for_list._Parent = self
@ -181,11 +181,11 @@ class MusicLibListPage(Page):
self._BGpng = IconItem()
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
self._BGpng._MyType = ICON_TYPES["STAT"]
self._BGpng._Parent = self
self._BGpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
self._BGpng.AddLabel("Please upload data over Wi-Fi", fonts["varela22"])
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
@ -195,8 +195,36 @@ class MusicLibListPage(Page):
self._Scroller._PosY = 2
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):
self.RefreshPsIndex()
if len(self._MyList) == 0:
return
@ -226,7 +254,7 @@ class MusicLibListPage(Page):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key) or event.key == CurKeys["Left"]:
if event.key == CurKeys["Menu"] or event.key == CurKeys["Left"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
@ -243,12 +271,12 @@ class MusicLibListPage(Page):
"""
if event.key == CurKeys["Right"]:
self.FScrollDown(Step=5)
self.ScrollDown(Step=5)
self._Screen.Draw()
self._Screen.SwapAndShow()
if event.key == CurKeys["Left"]:
self.FScrollUp(Step=5)
self.ScrollUp(Step=5)
self._Screen.Draw()
self._Screen.SwapAndShow()
"""
@ -258,7 +286,7 @@ class MusicLibListPage(Page):
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["Enter"]:
self.Click()
def Draw(self):

View File

@ -10,11 +10,11 @@ from UI.constants import Width,Height,ICON_TYPES
from UI.page import Page,PageSelector
from UI.icon_item import IconItem
from UI.label import Label
from UI.fonts import fonts
from UI.util_funcs import midRect
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.icon_pool import MyIconPool
from UI.skin_manager import MySkinManager
from UI.lang_manager import MyLangManager
from UI.skin_manager import SkinManager
from UI.scroller import ListScroller
@ -23,7 +23,7 @@ from list_item import ListItem
import myvars
class ListPageSelector(PageSelector):
_BackgroundColor = MySkinManager.GiveColor('Front')
_BackgroundColor = SkinManager().GiveColor('Front')
def __init__(self):
self._PosX = 0
@ -60,9 +60,9 @@ class PlayListPage(Page):
_Icons = {}
_Selector=None
_FootMsg = ["Nav","Remove","RTA","Back","Play/Pause"]
_FootMsg = ["Nav","RTA","Remove","Back","Play/Pause"]
_MyList = []
_ListFont = MyLangManager.TrFont("notosanscjk15")
_ListFont = fonts["notosanscjk15"]
_Scroller = None
_CurSongTime="0:0"
@ -180,11 +180,11 @@ class PlayListPage(Page):
gobject.timeout_add(850,self.GObjectInterval)
self._BGpng = IconItem()
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("heart")
self._BGpng._ImgSurf = MyIconPool._Icons["heart"]
self._BGpng._MyType = ICON_TYPES["STAT"]
self._BGpng._Parent = self
self._BGpng.AddLabel(MyLangManager.Tr("my favorite music"), MyLangManager.TrFont("varela18"))
self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
self._BGpng.AddLabel("my favourites", fonts["varela18"])
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
self._Scroller = ListScroller()
@ -235,10 +235,9 @@ class PlayListPage(Page):
self._MyList[i]._PosY += self._Scrolled * self._MyList[i]._Height
def Click(self):
self.RefreshPsIndex()
if len(self._MyList) == 0:
return
cur_li = self._MyList[self._PsIndex]
play_pos_id = myvars.Poller.play(self._PsIndex)
@ -252,7 +251,7 @@ class PlayListPage(Page):
self.SyncScroll()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
if myvars.Poller != None:
myvars.Poller.stop()
self._CurSongTime=""
@ -283,7 +282,7 @@ class PlayListPage(Page):
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["Enter"]:
self.Click()
if event.key == CurKeys["X"]: # start spectrum

View File

@ -4,17 +4,15 @@ import pygame
#UI lib
from UI.constants import RUNSYS
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
from UI.keys_def import CurKeys
from UI.confirm_page import ConfirmPage
from UI.lang_manager import MyLangManager
from UI.skin_manager import MySkinManager
import config
class PowerOffConfirmPage(ConfirmPage):
_ConfirmText = MyLangManager.Tr("Awaiting Input")
_FootMsg = ["Nav","","Reboot","Cancel","Shutdown"]
_ConfirmText = "Awaiting Input"
_FootMsg = ["Nav","Reboot","","Cancel","Shutdown"]
def CheckBattery(self):
try:
@ -43,16 +41,17 @@ class PowerOffConfirmPage(ConfirmPage):
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
if IsKeyStartOrA(event.key):
if event.key == CurKeys["B"]:
if self.CheckBattery() < 20:
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
else:
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
cmdpath += "sleep 3;"
@ -62,7 +61,7 @@ class PowerOffConfirmPage(ConfirmPage):
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
if event.key == CurKeys["X"]:
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
cmdpath += "sleep 3;"
cmdpath += "sudo reboot"
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))

1
Menu/GameShell/RetroArch.sh Executable file
View File

@ -0,0 +1 @@
retroarch

View File

@ -1,33 +1,32 @@
# -*- coding: utf-8 -*-
import pygame
import validators
import commands
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, IsKeyMenuOrB
from UI.skin_manager import MySkinManager
from UI.lang_manager import MyLangManager
from UI.keys_def import CurKeys
from UI.skin_manager import SkinManager
from libs.DBUS import is_wifi_connected_now,get_wifi_ip
class TinyCloudPage(Page):
_FootMsg = ["Nav","","","Back",""]
_FootMsg = ["Nav.","","","Back",""]
_MyList = []
_ListFontObj = MyLangManager.TrFont("varela13")
_ListFontObj = fonts["varela13"]
_AList = {}
_Labels = {}
_Coords = {}
_URLColor = MySkinManager.GiveColor('URL')
_TextColor = MySkinManager.GiveColor('Text')
_URLColor = SkinManager().GiveColor('URL')
_TextColor = SkinManager().GiveColor('Text')
_Scrolled = 0
_PngSize = {}
@ -61,39 +60,32 @@ class TinyCloudPage(Page):
self._Coords["forssh"] = SimpleNamespace()
self._Coords["forssh"].x = self._Coords["forID"].x
self._Coords["forssh"].y = 36
self._Coords["forssh"].y = 47
self._Coords["ssh_addr"] = SimpleNamespace()
self._Coords["ssh_addr"].x = self._Coords["forID"].x
self._Coords["ssh_addr"].y = 54
self._Coords["ssh_addr"].y = 65
self._Coords["forwin"] = SimpleNamespace()
self._Coords["forwin"].x = self._Coords["forID"].x
self._Coords["forwin"].y = 80
self._Coords["forwin"].y = 101
self._Coords["samba_games"] = SimpleNamespace()
self._Coords["samba_games"].x = self._Coords["forID"].x
self._Coords["samba_games"].y = 97
self._Coords["samba_games"].y = 118
self._Coords["samba_music"] = SimpleNamespace()
self._Coords["samba_music"].x = self._Coords["samba_games"].x
self._Coords["samba_music"].y = 115
self._Coords["samba_music"].y = 136
self._Coords["for_airplay"] = SimpleNamespace()
self._Coords["for_airplay"].x = self._Coords["forID"].x
self._Coords["for_airplay"].y = 140
self._Coords["for_airplay"].y = 173
self._Coords["airplay_name"] = SimpleNamespace()
self._Coords["airplay_name"].x = 68
self._Coords["airplay_name"].y = self._Coords["for_airplay"].y
self._Coords["for-usb-eth"] = SimpleNamespace()
self._Coords["for-usb-eth"].x = self._Coords["forID"].x
self._Coords["for-usb-eth"].y = 163
self._Coords["usb-eth-addr"] = SimpleNamespace()
self._Coords["usb-eth-addr"].x = 112
self._Coords["usb-eth-addr"].y = self._Coords["for-usb-eth"].y
self._Coords["bg"] = SimpleNamespace()
self._Coords["bg"].x = self._Width/2
@ -117,10 +109,6 @@ class TinyCloudPage(Page):
else:
self._IP = "xxx.xxx.xxx.xxx"
hostname = commands.getstatusoutput("hostname")[1]
if hostname == "":
hostname = "clockworkpi"
labels = \
[["forssh","For ssh and scp:",self._ListFontObj,self._TextColor],
["ssh_addr","ssh cpi@%s" % self._IP, self._ListFontObj,self._URLColor],
@ -131,9 +119,7 @@ class TinyCloudPage(Page):
["forKey", "Key:", self._ListFontObj, self._TextColor],
["key_and_pass", "cpi", self._ListFontObj, self._URLColor],
["for_airplay", "Airplay:", self._ListFontObj, self._TextColor],
["airplay_name",hostname, self._ListFontObj, self._URLColor],
["for-usb-eth","USB-Ethernet:", self._ListFontObj, self._TextColor],
["usb-eth-addr","192.168.10.1", self._ListFontObj, self._URLColor]]
["airplay_name","clockworkpi", self._ListFontObj, self._URLColor]]
for i in labels:
l = Label()
@ -156,11 +142,11 @@ class TinyCloudPage(Page):
self._Width = self._Screen._Width ## equal to screen width
self._Height = self._Screen._Height
self._PngSize["bg"] = (253,114)
self._PngSize["bg"] = (253,132)
self._PngSize["online"] = (75,122)
bgpng = IconItem()
bgpng._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
bgpng._ImgSurf = MyIconPool._Icons["needwifi_bg"]
bgpng._MyType = ICON_TYPES["STAT"]
bgpng._Parent = self
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
@ -168,7 +154,7 @@ class TinyCloudPage(Page):
self._Icons["bg"] = bgpng
onlinepng = IconItem()
onlinepng._ImgSurf = MyIconPool.GiveIconSurface("online")
onlinepng._ImgSurf = MyIconPool._Icons["online"]
onlinepng._MyType = ICON_TYPES["STAT"]
onlinepng._Parent = self
onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)
@ -178,10 +164,12 @@ class TinyCloudPage(Page):
self.SetLabels()
def KeyDown(self,event):
if IsKeyMenuOrB(event.key):
self.ReturnToUpLevelPage()
self._Screen.Draw()
self._Screen.SwapAndShow()
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:
@ -203,12 +191,6 @@ class TinyCloudPage(Page):
self._Labels["key_and_pass"].Draw()
else:
self._Labels["for-usb-eth"].NewCoord(self._Coords["for-usb-eth"].x+55, self._Coords["for-usb-eth"].y)
self._Labels["for-usb-eth"].Draw()
self._Labels["usb-eth-addr"].NewCoord(self._Coords["usb-eth-addr"].x+55, self._Coords["usb-eth-addr"].y)
self._Labels["usb-eth-addr"].Draw()
self._Icons["bg"].NewCoord(self._Coords["bg"].x, self._Coords["bg"].y)
self._Icons["bg"].Draw()
@ -216,7 +198,7 @@ class TinyCloudPage(Page):
self._DrawOnce = True
if self._HWND != None:
self._HWND.fill(MySkinManager.GiveColor('White'))
self._HWND.fill(SkinManager().GiveColor('White'))
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )

1
Menu/GameShell/freeDM.sh Executable file
View File

@ -0,0 +1 @@
chocolate-doom -iwad /home/cpi/games/FreeDM/freedoom1.wad

View File

@ -46,14 +46,7 @@ sudo apt-get -y install mpd ncmpcpp git libuser
sudo apt-get -y install python-wicd wicd wicd-curses python-pycurl python-alsaaudio python-pygame python-gobject python-xlib
sudo apt-get -y install python-pip
sudo pip install validators numpy requests python-mpd2 beeprint
```
### With pip install and virtualenv
```
mkvirtualenv launcher
pip install -r requirements.txt
sudo pip install validators numpy requests python-mpd2
```
# Create “.mpd_cpi.conf” config
@ -90,5 +83,3 @@ audio_output {
filesystem_charset "UTF-8"
```

View File

@ -1,18 +0,0 @@
max-connection-per-server=5
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
log-level=error
log=/tmp/aria.log
dir=/home/cpi/aria2download
daemon=true
allow-overwrite=true
split=1
max-concurrent-downloads=100
disk-cache=15M
timeout=600
retry-wait=30
max-tries=50
save-session-interval=10
disable-ipv6=true
save-session=/home/cpi/aria2download/aria.session.txt

BIN
aria2c

Binary file not shown.

View File

@ -1,499 +0,0 @@
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup").widget
-- Load Debian menu entries
-- require("debian.menu")
local capi = { screen = screen,
client = client }
local ipairs = ipairs
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors,timeout=3 })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = tostring(err),timeout=3 })
in_error = false
end)
end
-- }}}
theme_base = "/home/cpi/launcher/awesome"
-- Themes define colours, icons, font and wallpapers.
beautiful.init(theme_base .. "/themes/default/theme.lua")
-- This is used later as the default terminal and editor to run.
terminal = "xterm"
editor = os.getenv("EDITOR") or "editor"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
awful.layout.suit.floating,
awful.layout.suit.tile,
awful.layout.suit.tile.left,
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
-- awful.layout.suit.spiral,
-- awful.layout.suit.spiral.dwindle,
--awful.layout.suit.max,
--awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier,
awful.layout.suit.corner.nw,
-- awful.layout.suit.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
}
-- }}}
-- {{{ Helper functions
local function tableHasKey(table,key)
return table[key] ~= nil
end
local function client_menu_toggle_fn()
local instance = nil
return function ()
if instance and instance.wibox.visible then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ theme = { width = 250 } })
end
end
end
-- }}}
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
{ "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{ "quit", function() awesome.quit() end}
}
mymenu = {
{ "xterm" , "xterm"},
{ "xclock", "xclock"}
}
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "MyStuff", mymenu },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Create a wibox for each screen and add it
local taglist_buttons = awful.util.table.join(
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end),
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
local tasklist_buttons = awful.util.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
-- Without this, the following
-- :isvisible() makes no sense
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
-- This will also un-minimize
-- the client, if needed
client.focus = c
c:raise()
end
end),
awful.button({ }, 3, client_menu_toggle_fn()),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
local function set_wallpaper(s)
-- Wallpaper
if beautiful.wallpaper then
local wallpaper = beautiful.wallpaper
local wallpaperpc = beautiful.wallpaperpc
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
-- wallpaper only in PC
if s.geometry.width > 320 then
gears.wallpaper.centered(wallpaperpc, s, 1)
end
end
end
local function get_screen(s)
return s and screen[s]
end
function awful.widget.tasklist.filter.currenttags_without_gs(c, screen)
screen = get_screen(screen)
-- Only print client on the same screen as this widget
if get_screen(c.screen) ~= screen then return false end
-- Include sticky client too
if c.sticky then return true end
local tags = screen.tags
for _, t in ipairs(tags) do
if t.selected then
local ctags = c:tags()
for _, v in ipairs(ctags) do
if v == t then
if c.class:lower() == "run.py" or c.class:lower() == "gsnotify-arm" or c.class:lower() == "main" then
return false
else
return true
end
end
end
end
end
return false
end
screen.connect_signal("property::geometry", set_wallpaper)
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
set_wallpaper(s)
-- Each screen has its own tag table.
awful.tag({ "GameShell" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
-- Create a taglist widget
s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags_without_gs, tasklist_buttons)
-- Create the wibox
if s.geometry.width > 320 then
s.mywibox = awful.wibar({ position = "bottom", screen = s,visible=true })
else
s.mywibox = awful.wibar({ position = "bottom", screen = s,visible=false })
end
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
mylauncher,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
s.mylayoutbox,
},
}
end)
-- }}}
-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize))
function titlebar_add_with_settings(c)
awful.titlebar.add(c, { modkey = modkey, height = 16, font = "Terminus 6"})
end
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = {
size_hints_honor = false,
border_width = 0,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
--placement = awful.placement.no_overlap+awful.placement.centered+awful.placement.no_offscreen
}
},
{ rule_any = {type = { "normal", "dialog"}
}, properties = { titlebars_enabled = true }
},
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
},
class = {
"Arandr",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Wpa_gui",
"pinentry",
"veromix",
"xtightvncviewer",
"xclock"
},
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
}
}, properties = { ontop=false,floating = true,titlebars_enabled=false }},
}
-- }}}
local gs_class = {"run.py","gsnotify","gsnotify-arm","retroarch","GSPLauncher","main"}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
if awesome.startup and
not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
c.ontop=false
c.above=false
c.below=true
c.fullscreen=false
if tableHasKey(c,"class") and c.class:lower() == "gsnotify-arm" then
-- naughty.notify({text = "launched!",timeout = 2,position = "top_center"})
c.ontop = true
c.above = true
c.focusable=false
c.type = "notification"
c.floating = true
c:raise()
end
for s in capi.screen do
if s.geometry.width > 320 then
for _,v in pairs(gs_class) do
if tableHasKey(c,"class") and c.class:lower() == v then
awful.titlebar.hide(c)
if v ~= "gsnotify-arm" then
awful.placement.centered(c)
end
break
end
end
-- centered bg with offset of tasklist_bar's height
-- c.y= c.y + s.mywibox.height
else
-- hide all titlebars in GS
awful.titlebar.hide(c)
end
end
end)
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar
local buttons = awful.util.table.join(
awful.button({ }, 1, function()
client.focus = c
c:raise()
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
client.focus = c
c:raise()
awful.mouse.client.resize(c)
end)
)
awful.titlebar(c) : setup {
{ -- Left
awful.titlebar.widget.closebutton(c),
-- buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "left",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
align="right",
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
-- awful.titlebar.widget.stickybutton (c),
-- awful.titlebar.widget.ontopbutton (c),
-- awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("focus",
function(c)
c.border_color = beautiful.border_normal
end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
client.disconnect_signal("request::activate", awful.ewmh.activate)
function awful.ewmh.activate(c)
if tableHasKey(c,"class") == false then
return
end
if c:isvisible() then
if c.class:lower() ~= "gsnotify-arm" then
client.focus = c
end
if c.class:lower() == "retroarch" then
c:lower()
end
end
end
client.connect_signal("request::activate", awful.ewmh.activate)
client.connect_signal("property::fullscreen", function (c)
c.fullscreen = false
c.ontop = false
c.focus=false
c:lower()
end)

View File

@ -1,3 +0,0 @@
Background images:
Mikael Eriksson <mikael_eriksson@miffe.org>
Licensed under CC-BY-SA-3.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Some files were not shown because too many files have changed in this diff Show More