Compare commits
438 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 975ce6a4a4 | |||
| 8f91cfe020 | |||
| 228a771184 | |||
| e93fc99fcd | |||
| e59787d5cd | |||
| cf7bcd615c | |||
| 5a2d662ba2 | |||
| 5313c26ea7 | |||
| 733fdbc55d | |||
| 7917aaaddc | |||
| 2dc6087950 | |||
| dc4f61ee92 | |||
| 277d3afdf9 | |||
| b6f0e69573 | |||
| efd83802d3 | |||
| 66607a26b3 | |||
| 3ecd4fa349 | |||
| 6f90f8d3cd | |||
| 3a38c26553 | |||
| 148c60330b | |||
| c5d8735b92 | |||
| b3879473b3 | |||
| 3a27edaa84 | |||
| f10cc77780 | |||
| d54a85b82a | |||
| 87943a7ac5 | |||
| 7d932ad590 | |||
| 119cf5f2ad | |||
| b2511e97c4 | |||
| 615c9e0dfc | |||
| ee71a91c0b | |||
| 38e217ef49 | |||
| f4cbaba80d | |||
| 4f7fcc6433 | |||
| eae8d4fae8 | |||
| d8426c37f0 | |||
| 6458e9c425 | |||
| 1d34a8b287 | |||
| 925076fac7 | |||
| 450680b2b3 | |||
| 66298985a4 | |||
| b36a750b3b | |||
| ae279bda94 | |||
| af8f80736e | |||
| f90b45059d | |||
| 9208fccacd | |||
| 720152dfe6 | |||
| 108e2b6877 | |||
| d8bd6a1718 | |||
| ba0c11bb4d | |||
| b488b5d4f1 | |||
| 99305de562 | |||
| d76dd08bf5 | |||
| 2577d0b534 | |||
| eab2724dc7 | |||
| 25b976d948 | |||
| 9e70c4a088 | |||
| ecfe99bc49 | |||
| f5ac2da976 | |||
| 534883ca1f | |||
| ad540da0c0 | |||
| bb66f3c8f0 | |||
| 13aa69700a | |||
| d919110d58 | |||
| fcd978b615 | |||
| 4b26c692ee | |||
| f3948dfd71 | |||
| b9e890137c | |||
| a871da1b85 | |||
| 8f55eea7cf | |||
| 52c1d12029 | |||
| ae589ac886 | |||
| 6ef89ddbff | |||
| 90dcd1bd25 | |||
| 0ead001f80 | |||
| f58d8218c2 | |||
| 3ec8a1a65b | |||
| 160ff76d6e | |||
| 51f62ea575 | |||
| 3c88f42924 | |||
| 40d705acb5 | |||
| ee88a3170b | |||
| c05da6de97 | |||
| 423044f496 | |||
| 5d93fda813 | |||
| 63d1af1337 | |||
| bceb9a372e | |||
| cb9562ebbd | |||
| bd88c1730e | |||
| 1d8d85812a | |||
| 8bca1166df | |||
| e38521e9c7 | |||
| 0bb9ed9eda | |||
| a5b10b16be | |||
| 0981ac4c59 | |||
| 25a191a4d0 | |||
| d3b508c3a1 | |||
| 6f855dc36f | |||
| 583d888aba | |||
| 5d1dba3479 | |||
| 823cb756eb | |||
| e3747493ad | |||
| 8cd87b5276 | |||
| 219e880f18 | |||
| c1b06db2dc | |||
| a2d8de4535 | |||
| b7cd5aaf90 | |||
| df05604013 | |||
| 5b0db0a461 | |||
| b47b020339 | |||
| c4587c12bf | |||
| 1fa3c80229 | |||
| 3196496018 | |||
| 17265eab55 | |||
| fd879c607a | |||
| ae8b4b775a | |||
| 827b7f06fa | |||
| 83e2cc8fe6 | |||
| 02b399dd01 | |||
| 10305da9e8 | |||
| dc33952c58 | |||
| 8b5b93f721 | |||
| 2e5ea437cd | |||
| f9a74d6579 | |||
| fc099786fe | |||
| 008f701029 | |||
| f7976d4406 | |||
| 9d1aa75619 | |||
| 689a573d6e | |||
| fe8f451392 | |||
| 7ae4303d58 | |||
| 2beaa2e862 | |||
| 9e75bc56e0 | |||
| 07070fc41e | |||
| c225aa7dde | |||
| d93e514e78 | |||
| a502612c7d | |||
| ff374a7667 | |||
| 83b56b57c3 | |||
| df90a133f9 | |||
| dd490ec3e9 | |||
| 2dd7143c14 | |||
| f999a22520 | |||
| 7079d778aa | |||
| b639e81b27 | |||
| d13e410aa7 | |||
| 793db0c984 | |||
| d062c4920c | |||
| 12c923df8a | |||
| f33e6080b9 | |||
| 530c08dc34 | |||
| be872d0536 | |||
| 565605cfef | |||
| e6c22c90e0 | |||
| 7e75d4856b | |||
| c641c8d84a | |||
| 0b8331d3d0 | |||
| f2bd7423e4 | |||
| d83d9e9360 | |||
| ea0eb4fb39 | |||
| 765f73d51f | |||
| 7905077d13 | |||
| 8cf3486f11 | |||
| 18516efdb5 | |||
| 670cfc24d0 | |||
| 034e4e91c9 | |||
| 1b01e25ce1 | |||
| 9920166630 | |||
| b15faabefa | |||
| 4ad682572c | |||
| 807fdfa428 | |||
| 4074f4bfc7 | |||
| e8dc44fb3e | |||
| ee3ddb54a7 | |||
| 4837bfcf60 | |||
| f3776f1c51 | |||
| c1228d321b | |||
| 9bd4a6e965 | |||
| df03f2889a | |||
| 06b8db3edb | |||
| c523b4ef3c | |||
| f84c14aecd | |||
| b9f8133e75 | |||
| ac2221fc84 | |||
| 321c4e9643 | |||
| 47f0fdab97 | |||
| 09b3c64160 | |||
| 8b9dba21e5 | |||
| f036a2f264 | |||
| f99f993b1f | |||
| c88e3146ec | |||
| 66f61e3465 | |||
| 3d60124d84 | |||
| 70e72e7172 | |||
| ba76103819 | |||
| c0aab424a6 | |||
| 6b866f940e | |||
| 301bb3b74c | |||
| 95387464bd | |||
| fb0e6c00e7 | |||
| 1d9f2fa1b6 | |||
| 4b0093e02d | |||
| 157c5554d5 | |||
| 2a4e951123 | |||
| d9a884520c | |||
| 36ebf2f7fc | |||
| 3c17813469 | |||
| df344ed12b | |||
| bb8d251556 | |||
| de577fd528 | |||
| 2bd0611b28 | |||
| 6472377a61 | |||
| 8a875ee847 | |||
| 171d4e38ef | |||
| 5395f3dad7 | |||
| 98bf5df99c | |||
| 7afb6634de | |||
| 07060948e4 | |||
| 3f1a24fea0 | |||
| a7ce02be8a | |||
| 5b7a162f18 | |||
| accbd7524e | |||
| f0df9b4214 | |||
| 517ac01bc7 | |||
| 7285f38b39 | |||
| 234d59eec1 | |||
| 26e78d93aa | |||
| 539468f467 | |||
| b81416a93c | |||
| a2d8555092 | |||
| 57bc0aba20 | |||
| 03d0e7cbe2 | |||
| f10768f8b0 | |||
| 31de17e669 | |||
| e1771e8c02 | |||
| c5fd06c049 | |||
| e3ffcf3908 | |||
| 1ebfd1cd5e | |||
| 329444332d | |||
| 7b59674ed3 | |||
| 13623f5c9c | |||
| b02abf964a | |||
| 4d5f8d9ea3 | |||
| 36c9ab6b15 | |||
| 8c54c38a9f | |||
| 6cb35eb09c | |||
| 18b566cc3d | |||
| 880121cd21 | |||
| 52bc2bed04 | |||
| 425cb66d6f | |||
| a54465776a | |||
| e9e59624fd | |||
| 655216e235 | |||
| d14276e31a | |||
| 65138e7586 | |||
| 5ef299dfce | |||
| 4c6b50897b | |||
| 3cd83855c6 | |||
| 35b1e505ee | |||
| 43d57620cb | |||
| e54509335a | |||
| ff4f2e8460 | |||
| 2ceba9d8cf | |||
| 114b7ab8c4 | |||
| dd3b95b3f5 | |||
| 40cafe09c5 | |||
| 493a920500 | |||
| 88ef0f5df5 | |||
| ef4f6869c9 | |||
| 16da52093a | |||
| db9eeaa957 | |||
| d3c04d5771 | |||
| 3541c101f8 | |||
| 7d3bb93eb2 | |||
| 578305dfb1 | |||
| 572984f294 | |||
| c61f818772 | |||
| eeb0a616c3 | |||
| 793e0cae3a | |||
| a4ad0de109 | |||
| 13dfa44c2c | |||
| 7d692ef113 | |||
| aac0bf1944 | |||
| ea673759d9 | |||
| 746fdb8412 | |||
| 73bcdb6d44 | |||
| 0d7a527e97 | |||
| 152b2a8ac7 | |||
| b3aea583a5 | |||
| 44ce359f0e | |||
| 6f45052d4c | |||
| c8d6e85c5b | |||
| 3c6416f85b | |||
| e314631a5a | |||
| 60a85739fa | |||
| 83a7547a0a | |||
| be6f539f8e | |||
| bb58718df4 | |||
| d175b5a1ba | |||
| 8869cd570c | |||
| 5452b6fe9c | |||
| 5e29592572 | |||
| efd9459ab3 | |||
| 571468bb8f | |||
| 3770686ce1 | |||
| e9ab068799 | |||
| e77178ea3b | |||
| 1142728615 | |||
| 55f7820e08 | |||
| 6f451bfb14 | |||
| 0d52efc96d | |||
| 694383765d | |||
| 7788d7541b | |||
| f586418ecd | |||
| c30aee6b3c | |||
| d665d739e7 | |||
| 7787b3e6f4 | |||
| f48c749368 | |||
| e7793f25ed | |||
| 69c2e8be6f | |||
| 8b70ef15df | |||
| a700ed7236 | |||
| bacd0b8e72 | |||
| 86694a9d06 | |||
| 55f4f9df27 | |||
| 1b042adb54 | |||
| 5cf8bb1917 | |||
| 723644579e | |||
| 28334adc6b | |||
| 2877a138e0 | |||
| d3148d1379 | |||
| 77215d4172 | |||
| 8186028711 | |||
| 9e787469ea | |||
| 02a90d52ce | |||
| 9dbe1ca630 | |||
| 0d03a717dc | |||
| 33aa7f6154 | |||
| 029e89737c | |||
| 478746e19d | |||
| 4d5a19d5bc | |||
| 46eb56cb57 | |||
| a1bbeafd8b | |||
| 10a91108dd | |||
| e0e6a6e3e7 | |||
| 47d08a5451 | |||
| a7227fbadf | |||
| efb6cb8164 | |||
| 500185fd9d | |||
| 5eaa259ba3 | |||
| eef5112f3e | |||
| cef6e9622e | |||
| a3b07ecadd | |||
| ac5cf8bb67 | |||
| b464c84277 | |||
| c7b1fbb30d | |||
| ed1a6f3416 | |||
| da2d61366f | |||
| 586a76d37b | |||
| 315a9a12b1 | |||
| 185330f4f2 | |||
| d245239e5d | |||
| 2a9bb59a35 | |||
| 37e4d655b1 | |||
| e7dc439869 | |||
| d3777d460d | |||
| 81119eba34 | |||
| 514b08e1d6 | |||
| 7b5eba3ed7 | |||
| 97e9aa76d5 | |||
| c317ba5d35 | |||
| 555cfd0c6d | |||
| 0d0964eefe | |||
| bd6a30d35f | |||
| 7f5b30d5b3 | |||
| 175ce6744a | |||
| dce2cfa43f | |||
| 2f92f62dae | |||
| ca72939743 | |||
| 33de507580 | |||
| 544aafa959 | |||
| 039e362b6d | |||
| 07e707a983 | |||
| 9039646303 | |||
| 84e21b9f38 | |||
| f9a6a74359 | |||
| f2e5858bd0 | |||
| 07e7e2a5dc | |||
| 0b7f83dc62 | |||
| 47570323d8 | |||
| e6d2b43c25 | |||
| 6966fba1b4 | |||
| cdd7caebff | |||
| d09af8a674 | |||
| 9c3286ad03 | |||
| c0d314f9ef | |||
| dac49f9df9 | |||
| d528510bca | |||
| d8be9845e4 | |||
| b0c11b5cc7 | |||
| 90d7a545d6 | |||
| 2276f9c1b2 | |||
| 5cd64c1b83 | |||
| fa5e474d3b | |||
| 1c3d598ffa | |||
| d1238a3176 | |||
| c19e8bee59 | |||
| 4ad8806fd1 | |||
| 36c55c08f8 | |||
| b65944ab37 | |||
| 93983bc2f5 | |||
| 1912b4e4af | |||
| f0fa9c8e56 | |||
| f762a10a62 | |||
| 843dda5570 | |||
| 19082db55a | |||
| 7e585ccfe4 | |||
| 41f7a04010 | |||
| 200339dddb | |||
| 5dd47f599b | |||
| cb5b3e21ee | |||
| 2898fdbf68 | |||
| f498099b12 | |||
| d8807f9386 | |||
| 1454e43bcb | |||
| 3ace6b098b | |||
| 28584e361d | |||
| c25c74a0bc | |||
| bf65f35f32 | |||
| 7f83440229 | |||
| 0863125269 | |||
| 93d9f22b10 | |||
| dcba607fc0 | |||
| b6c142a2b9 | |||
| f1961ee5d6 | |||
| ce9261f409 | |||
| 76b411388b | |||
| e7b3c881d0 |
@@ -0,0 +1,27 @@
|
||||
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
|
||||
@@ -5,3 +5,10 @@ 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
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#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};
|
||||
@@ -0,0 +1,62 @@
|
||||
#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};
|
||||
@@ -0,0 +1,46 @@
|
||||
#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};
|
||||
@@ -0,0 +1,14 @@
|
||||
#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};
|
||||
@@ -0,0 +1,52 @@
|
||||
#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 };
|
||||
@@ -0,0 +1,5 @@
|
||||
#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};
|
||||
@@ -0,0 +1,14 @@
|
||||
#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};
|
||||
@@ -0,0 +1,5 @@
|
||||
#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};
|
||||
@@ -0,0 +1,5 @@
|
||||
#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};
|
||||
@@ -0,0 +1,28 @@
|
||||
#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};
|
||||
@@ -0,0 +1,14 @@
|
||||
#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};
|
||||
@@ -0,0 +1,5 @@
|
||||
#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};
|
||||
@@ -0,0 +1,27 @@
|
||||
#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 };
|
||||
@@ -0,0 +1,14 @@
|
||||
#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 };
|
||||
@@ -0,0 +1,14 @@
|
||||
#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};
|
||||
@@ -0,0 +1,140 @@
|
||||
#---------------------------------
|
||||
# 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"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
session=${1:-gameshell}
|
||||
|
||||
case $session in
|
||||
hdmi )
|
||||
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/desktopbg.jpg
|
||||
exec ~/launcher/load.sh &
|
||||
exec ~/launcher/sys.py/gsnotify/gsnotify-arm daemon &
|
||||
#exec /usr/bin/twm -f ~/launcher/.twmrc
|
||||
exec ~/launcher/dwm-mod
|
||||
;;
|
||||
gameshell )
|
||||
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png
|
||||
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
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Section "Device"
|
||||
Identifier "Allwinner A10/A13 FBDEV"
|
||||
Driver "fbturbo"
|
||||
Option "fbdev" "/dev/fb0"
|
||||
|
||||
Option "SwapbuffersWait" "true"
|
||||
EndSection
|
||||
@@ -0,0 +1,7 @@
|
||||
Section "Device"
|
||||
Identifier "Allwinner A10/A13 FBDEV"
|
||||
Driver "modesetting"
|
||||
Option "fbdev" "/dev/fb0"
|
||||
|
||||
Option "SwapbuffersWait" "true"
|
||||
EndSection
|
||||
@@ -1,7 +1,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://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 <http://www.gnu.org/licenses/>.
|
||||
along with this program. If not, see <https://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
|
||||
<http://www.gnu.org/licenses/>.
|
||||
<https://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
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
love MANUAL.love gameshell
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
love OPERATION.love gameshell
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
love MAIL.love gameshell
|
||||
@@ -1,174 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
import commands
|
||||
|
||||
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
|
||||
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.multilabel import MultiLabel
|
||||
|
||||
class ButtonsLayoutPage(Page):
|
||||
_FootMsg = ["Nav.","","","Back","Toggle"]
|
||||
_MyList = []
|
||||
_ListFontObj = fonts["varela13"]
|
||||
|
||||
_AList = {}
|
||||
|
||||
_Scrolled = 0
|
||||
|
||||
_BGwidth = 320
|
||||
_BGheight = 240-24-20
|
||||
|
||||
_DrawOnce = False
|
||||
_Scroller = None
|
||||
|
||||
_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._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
DialogBoxs = MultiIconItem()
|
||||
DialogBoxs._ImgSurf = MyIconPool._Icons["buttonslayout"]
|
||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||
DialogBoxs._Parent = self
|
||||
DialogBoxs._IconWidth = 300
|
||||
DialogBoxs._IconHeight = 150
|
||||
DialogBoxs.Adjust(0,0,134,372,0)
|
||||
self._Icons["DialogBoxs"] = DialogBoxs
|
||||
|
||||
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):
|
||||
dis = 10
|
||||
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 self.GetButtonsLayoutMode() == "xbox":
|
||||
|
||||
with open(".buttonslayout", "w") as f:
|
||||
f.write("snes")
|
||||
|
||||
self._dialog_index = 1
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
else:
|
||||
|
||||
with open(".buttonslayout", "w") as f:
|
||||
f.write("xbox")
|
||||
|
||||
self._dialog_index = 0
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def OnLoadCb(self):
|
||||
self._Scrolled = 0
|
||||
self._PosY = 0
|
||||
self._DrawOnce = False
|
||||
|
||||
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 event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
self.ToggleMode()
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
|
||||
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 ) )
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
self._Page = ButtonsLayoutPage()
|
||||
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)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
OBJ.Init(main_screen)
|
||||
def API(main_screen):
|
||||
OBJ.API(main_screen)
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
|
||||
#from libs.roundrects import aa_round_rect
|
||||
|
||||
import alsaaudio
|
||||
|
||||
## local UI import
|
||||
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
|
||||
from UI.slider import Slider
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
|
||||
|
||||
from UI.icon_pool import MyIconPool
|
||||
|
||||
import myvars
|
||||
|
||||
class SoundSlider(Slider):
|
||||
OnChangeCB = None
|
||||
|
||||
_BGpng = None
|
||||
_BGwidth = 192
|
||||
_BGheight = 173
|
||||
|
||||
_NeedleSurf = None
|
||||
_Scale = None
|
||||
_Parent = None
|
||||
|
||||
snd_segs = [ [0,20],[21,40],[41,50],[51,60],[61,70],[71,85],[86,90],[91,95],[96,100] ]
|
||||
|
||||
|
||||
def __init__(self):
|
||||
Slider.__init__(self)
|
||||
|
||||
def Init(self):
|
||||
self._Width = self._Parent._Width
|
||||
self._Height = self._Parent._Height
|
||||
|
||||
self._BGpng = IconItem()
|
||||
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)
|
||||
|
||||
##self._NeedleSurf = pygame.Surface( (38,12),pygame.SRCALPHA )
|
||||
|
||||
self._Scale = MultiIconItem()
|
||||
self._Scale._MyType = ICON_TYPES["STAT"]
|
||||
self._Scale._Parent = self
|
||||
self._Scale._ImgSurf = MyIconPool._Icons["scale"]
|
||||
self._Scale._IconWidth = 82
|
||||
self._Scale._IconHeight = 63
|
||||
self._Scale.Adjust(0,0,82,63,0)
|
||||
|
||||
def SetValue(self,vol):#pct 0-100
|
||||
for i,v in enumerate(self.snd_segs):
|
||||
if vol >= v[0] and vol <= v[1]:
|
||||
self._Value = i # self._Value : 0 - 8
|
||||
break
|
||||
|
||||
def Further(self):
|
||||
self._Value+=1
|
||||
|
||||
if self._Value > len(self.snd_segs)-1:
|
||||
self._Value = len(self.snd_segs) -1
|
||||
|
||||
vol = self.snd_segs[self._Value][0] + (self.snd_segs[self._Value][1] - self.snd_segs[self._Value][0])/2
|
||||
|
||||
if self.OnChangeCB != None:
|
||||
if callable(self.OnChangeCB):
|
||||
self.OnChangeCB( vol )
|
||||
|
||||
def StepBack(self):
|
||||
self._Value-=1
|
||||
|
||||
if self._Value < 0:
|
||||
self._Value = 0
|
||||
|
||||
vol = self.snd_segs[self._Value][0]
|
||||
|
||||
if self.OnChangeCB != None:
|
||||
if callable(self.OnChangeCB):
|
||||
self.OnChangeCB( vol )
|
||||
|
||||
def Draw(self):
|
||||
|
||||
self._BGpng.NewCoord(self._Width/2,self._Height/2 )
|
||||
self._BGpng.Draw()
|
||||
|
||||
self._Scale.NewCoord(self._Width/2,self._Height/2)
|
||||
|
||||
self._Scale._IconIndex = self._Value
|
||||
|
||||
self._Scale.Draw()
|
||||
|
||||
|
||||
|
||||
class SoundPage(Page):
|
||||
|
||||
_MySlider = None
|
||||
_FootMsg = ["Nav","","","Back","Enter"]
|
||||
|
||||
def Init(self):
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
self._Width = self._Screen._Width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
self._MySlider = SoundSlider()
|
||||
|
||||
|
||||
self._MySlider._Parent = self
|
||||
self._MySlider.SetCanvasHWND(self._CanvasHWND)
|
||||
|
||||
self._MySlider.OnChangeCB = self.WhenSliderDrag
|
||||
|
||||
self._MySlider.Init()
|
||||
|
||||
try:
|
||||
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))
|
||||
|
||||
def WhenSliderDrag(self,value): ##value 0-100
|
||||
if value < 0 or value > 100:
|
||||
return
|
||||
|
||||
m = alsaaudio.Mixer()
|
||||
m.setvolume(int(value))
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Right"]:
|
||||
self._MySlider.Further()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Left"]:
|
||||
self._MySlider.StepBack()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
|
||||
self._MySlider.Draw()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
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=http://buildbot.libretro.com/nightly/linux/armhf/latest/mame2003_plus_libretro.so.zip
|
||||
@@ -1,6 +0,0 @@
|
||||
ROM=/home/cpi/games/MGBA
|
||||
ROM_SO=/home/cpi/apps/emulators/mgba_libretro.so
|
||||
EXT=gba,gbx
|
||||
LAUNCHER=retroarch -L
|
||||
TITLE=MGBA Roms
|
||||
SO_URL=http://buildbot.libretro.com/nightly/linux/armhf/latest/mgba_libretro.so.zip
|
||||
@@ -1,7 +0,0 @@
|
||||
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=http://buildbot.libretro.com/nightly/linux/armhf/latest/nestopia_libretro.so.zip
|
||||
|
||||
@@ -7,9 +7,9 @@ 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
|
||||
|
||||
# a item for List
|
||||
# - - - - - - - - - - - --
|
||||
@@ -31,7 +31,7 @@ class ListItemIcon(IconItem):
|
||||
|
||||
class ListItemLabel(Label):
|
||||
|
||||
_ActiveColor = pygame.Color(175,90,0)
|
||||
_ActiveColor = MySkinManager.GiveColor('Active')
|
||||
_Active = False
|
||||
def Draw(self):
|
||||
|
||||
@@ -116,7 +116,7 @@ class ListItem(object):
|
||||
|
||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.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 +127,7 @@ class ListItem(object):
|
||||
|
||||
if self._PlayingProcess > 0:
|
||||
seek_posx = int(self._Width * self._PlayingProcess/100.0)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(255,169,169),(self._PosX,self._PosY+self._Height-2),(self._PosX+seek_posx,self._PosY+self._Height-2),2)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Active'),(self._PosX,self._PosY+self._Height-2),(self._PosX+seek_posx,self._PosY+self._Height-2),2)
|
||||
|
||||
else:
|
||||
self._Labels["Text"].Draw()
|
||||
@@ -15,11 +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
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
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 threading import Thread
|
||||
|
||||
@@ -34,21 +35,27 @@ class PIFI(object):
|
||||
_FIRST_SELECTED_BIN = 5
|
||||
_NUMBER_OF_SELECTED_BINS = 1024
|
||||
|
||||
_samples_buffer = None
|
||||
|
||||
def __init__(self):
|
||||
self.sampleSize = self._SAMPLE_SIZE
|
||||
self.samplingRate = self._SAMPLING_RATE
|
||||
|
||||
def GetSpectrum(self,fifoFile,trim_by=10,log_scale=False,div_by=100):
|
||||
def GetSpectrum(self,fifoFile,trim_by=4,log_scale=False,div_by=100):
|
||||
try:
|
||||
rawSamples = os.read(fifoFile,self.sampleSize) # will return empty lines (non-blocking)
|
||||
if len(rawSamples) < 1:
|
||||
# print("Read error")
|
||||
return rawSamples
|
||||
# print("Read error")
|
||||
pass
|
||||
else:
|
||||
self._samples_buffer = rawSamples
|
||||
except Exception,e:
|
||||
pass
|
||||
|
||||
if self._samples_buffer == None:
|
||||
return ""
|
||||
|
||||
data = numpy.fromstring(rawSamples, dtype=numpy.int16)
|
||||
|
||||
data = numpy.fromstring(self._samples_buffer, dtype=numpy.int16)
|
||||
|
||||
data = data * numpy.hanning(len(data))
|
||||
|
||||
@@ -72,11 +79,11 @@ class MPDSpectrumPage(Page):
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","","","Back",""]
|
||||
_MyList = []
|
||||
_ListFont = fonts["veramono12"]
|
||||
_SongFont = fonts["notosanscjk12"]
|
||||
_ListFont = MyLangManager.TrFont("veramono12")
|
||||
_SongFont = MyLangManager.TrFont("notosanscjk12")
|
||||
_PIFI = None
|
||||
_FIFO = None
|
||||
_Color = pygame.Color(126,206,244)
|
||||
_Color = MySkinManager.GiveColor('Front')
|
||||
_GobjectIntervalId = -1
|
||||
_Queue = None
|
||||
_KeepReading = True
|
||||
@@ -156,21 +163,22 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
self._song_title = Label()
|
||||
self._song_title.SetCanvasHWND(self._RollCanvas)
|
||||
self._song_title.Init("Untitled",self._SongFont,(255,255,255))
|
||||
self._song_title.Init("Untitled",self._SongFont,MySkinManager.GiveColor('Text'))
|
||||
|
||||
|
||||
self._title = Label()
|
||||
self._title.SetCanvasHWND(self._CanvasHWND)
|
||||
self._title.Init("Title:",self._ListFont,(255,255,255))
|
||||
self._title.Init("Title:",self._ListFont,MySkinManager.GiveColor('Text'))
|
||||
|
||||
self._time = Label()
|
||||
self._time.SetCanvasHWND(self._CanvasHWND)
|
||||
self._time.Init("Time:",self._ListFont,(255,255,255))
|
||||
self._time.Init("Time:",self._ListFont,MySkinManager.GiveColor('Text'))
|
||||
|
||||
|
||||
self._time2 = Label()
|
||||
self._time2.SetCanvasHWND(self._CanvasHWND)
|
||||
self._time2.Init("00:00-00:00",self._ListFont,(255,255,255))
|
||||
self._time2.Init("00:00-00:00", self._ListFont,
|
||||
MySkinManager.GiveColor('Text'))
|
||||
|
||||
|
||||
self.Start()
|
||||
@@ -201,7 +209,7 @@ class MPDSpectrumPage(Page):
|
||||
#print("sleeping... 0.01")
|
||||
time.sleep(0.01)
|
||||
self.read_retry+=1
|
||||
if self.read_retry > 40:
|
||||
if self.read_retry > 20:
|
||||
os.close(self._FIFO)
|
||||
self._FIFO = os.open(self._PIFI._MPD_FIFO, os.O_RDONLY | os.O_NONBLOCK)
|
||||
self.read_retry = 0
|
||||
@@ -221,7 +229,7 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
|
||||
def ClearCanvas(self):
|
||||
self._CanvasHWND.fill((0,0,0))
|
||||
self._CanvasHWND.fill(MySkinManager.GiveColor('Black'))
|
||||
|
||||
def SgsSmooth(self):
|
||||
passes = 1
|
||||
@@ -257,7 +265,7 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
try:
|
||||
os.close(self._FIFO)
|
||||
self._FIFO = None
|
||||
@@ -273,13 +281,6 @@ 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()
|
||||
@@ -335,7 +336,7 @@ class MPDSpectrumPage(Page):
|
||||
|
||||
if self._RollCanvas != None:
|
||||
# self._RollCanvas.fill((111,22,33))
|
||||
self._RollCanvas.fill((0,0,0))
|
||||
self._RollCanvas.fill(MySkinManager.GiveColor('White'))
|
||||
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
|
||||
@@ -354,12 +355,14 @@ class MPDSpectrumPage(Page):
|
||||
if len(spects) == 0:
|
||||
return
|
||||
# print("spects:",spects)
|
||||
|
||||
step = int( round( len( spects ) / meterNum) )
|
||||
|
||||
# print(len(spects))
|
||||
self._bbs = []
|
||||
|
||||
a = numpy.logspace(0, 1, num=meterNum,endpoint=True)
|
||||
|
||||
for i in range(0,meterNum):
|
||||
index = int(i*step)
|
||||
index = int(a[i] * step)
|
||||
total = 0
|
||||
|
||||
value = spects[index]
|
||||
@@ -379,7 +382,7 @@ class MPDSpectrumPage(Page):
|
||||
value = 0
|
||||
|
||||
value = value/32768.0
|
||||
value = value * 100
|
||||
value = value * 123
|
||||
value = value % (self._Height-gap-margin_bottom)
|
||||
|
||||
if len(self._vis_values) < len(self._bby):
|
||||
@@ -389,7 +392,8 @@ class MPDSpectrumPage(Page):
|
||||
self._vis_values[i] = value
|
||||
|
||||
|
||||
except Empty:
|
||||
except Exception,e:
|
||||
print(e)
|
||||
return
|
||||
else: # got line
|
||||
if len(self._vis_values) == 0:
|
||||
@@ -406,9 +410,9 @@ class MPDSpectrumPage(Page):
|
||||
else:
|
||||
self._capYPositionArray[i] = value
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,(255,255,255),(i*(bw+gap)+margin_left,self._Height-gap-self._capYPositionArray[i]-margin_bottom,bw,gap),0)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),(i*(bw+gap)+margin_left,self._Height-gap-self._capYPositionArray[i]-margin_bottom,bw,gap),0)
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,(255,255,255),(i*(bw+gap)+margin_left,self._Height-value-gap-margin_bottom,bw,value+gap),0)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),(i*(bw+gap)+margin_left,self._Height-value-gap-margin_bottom,bw,value+gap),0)
|
||||
|
||||
self._vis_values[i] -= 2
|
||||
|
||||
@@ -2,19 +2,20 @@
|
||||
import os
|
||||
import pygame
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
#from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
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
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
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 list_item import ListItem
|
||||
|
||||
@@ -48,7 +49,7 @@ class MusicLibStack:
|
||||
return len(self.stack)
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = MySkinManager.GiveColor('Line')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -71,19 +72,19 @@ class ListPageSelector(PageSelector):
|
||||
self._PosY = y
|
||||
self._Height = h
|
||||
|
||||
aa_round_rect(self._Parent._CanvasHWND,
|
||||
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||
|
||||
#aa_round_rect(self._Parent._CanvasHWND,
|
||||
# (x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width-4,h),0)
|
||||
|
||||
|
||||
class MusicLibListPage(Page):
|
||||
|
||||
_Icons = {}
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","Scan","","Back","Add to Playlist"]
|
||||
_FootMsg = ["Nav","","Scan","Back","Add to Playlist"]
|
||||
_MyList = []
|
||||
_SwapMyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_MyStack = None
|
||||
|
||||
_Scroller = None
|
||||
@@ -183,8 +184,8 @@ class MusicLibListPage(Page):
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel("Please upload data over Wi-Fi", fonts["varela22"])
|
||||
self._BGpng.SetLableColor(pygame.Color(204,204,204))
|
||||
self._BGpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela18"))
|
||||
self._BGpng.SetLableColor(MySkinManager.GiveColor('Text'))
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
|
||||
@@ -194,35 +195,6 @@ 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):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
@@ -253,7 +225,7 @@ class MusicLibListPage(Page):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["Left"] or event.key == CurKeys["A"]:
|
||||
if IsKeyMenuOrB(event.key) or event.key == CurKeys["Left"]:
|
||||
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
@@ -270,12 +242,12 @@ class MusicLibListPage(Page):
|
||||
|
||||
"""
|
||||
if event.key == CurKeys["Right"]:
|
||||
self.ScrollDown(Step=5)
|
||||
self.FScrollDown(Step=5)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Left"]:
|
||||
self.ScrollUp(Step=5)
|
||||
self.FScrollUp(Step=5)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
"""
|
||||
@@ -285,7 +257,7 @@ class MusicLibListPage(Page):
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Enter"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.Click()
|
||||
|
||||
def Draw(self):
|
||||
@@ -3,17 +3,18 @@ import os
|
||||
import pygame
|
||||
import gobject
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
#from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
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
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.skin_manager import MySkinManager
|
||||
from UI.lang_manager import MyLangManager
|
||||
|
||||
from UI.scroller import ListScroller
|
||||
|
||||
@@ -22,7 +23,7 @@ from list_item import ListItem
|
||||
import myvars
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = MySkinManager.GiveColor('Line')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -50,18 +51,18 @@ class ListPageSelector(PageSelector):
|
||||
self._PosY = y
|
||||
self._Height = h
|
||||
|
||||
aa_round_rect(self._Parent._CanvasHWND,
|
||||
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||
|
||||
#aa_round_rect(self._Parent._CanvasHWND,
|
||||
# (x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width-4,h),0)
|
||||
|
||||
|
||||
class PlayListPage(Page):
|
||||
|
||||
_Icons = {}
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","RTA","Remove","Back","Play/Pause"]
|
||||
_FootMsg = ["Nav","Remove","RTA","Back","Play/Pause"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_Scroller = None
|
||||
_CurSongTime="0:0"
|
||||
@@ -97,7 +98,11 @@ class PlayListPage(Page):
|
||||
li._Fonts["normal"] = self._ListFont
|
||||
|
||||
if "title" in v:
|
||||
li.Init( v["title"])
|
||||
if isinstance(v["title"], (list,)):
|
||||
li.Init(" | ".join(v["title"]))
|
||||
else:
|
||||
li.Init( v["title"])
|
||||
|
||||
if "file" in v:
|
||||
li._Path = v["file"]
|
||||
|
||||
@@ -178,8 +183,8 @@ class PlayListPage(Page):
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["heart"]
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._BGpng.AddLabel("my favourites", fonts["varela18"])
|
||||
self._BGpng.SetLableColor(pygame.Color(204,204,204))
|
||||
self._BGpng.AddLabel(MyLangManager.Tr("my favorite music"), MyLangManager.TrFont("varela18"))
|
||||
self._BGpng.SetLableColor(MySkinManager.GiveColor('Text'))
|
||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
@@ -246,7 +251,7 @@ class PlayListPage(Page):
|
||||
self.SyncScroll()
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
if myvars.Poller != None:
|
||||
myvars.Poller.stop()
|
||||
self._CurSongTime=""
|
||||
@@ -277,7 +282,7 @@ class PlayListPage(Page):
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Enter"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.Click()
|
||||
|
||||
if event.key == CurKeys["X"]: # start spectrum
|
||||
@@ -1,31 +1,34 @@
|
||||
# -*- 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
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.skin_manager import MySkinManager
|
||||
from UI.lang_manager import MyLangManager
|
||||
|
||||
from libs.DBUS import is_wifi_connected_now,get_wifi_ip
|
||||
|
||||
class TinyCloudPage(Page):
|
||||
_FootMsg = ["Nav.","","","Back",""]
|
||||
_FootMsg = ["Nav","","","Back",""]
|
||||
_MyList = []
|
||||
|
||||
_ListFontObj = fonts["varela13"]
|
||||
|
||||
_ListFontObj = MyLangManager.TrFont("veramono13")
|
||||
_ListLabelFontObj = MyLangManager.TrFont("varela13")
|
||||
|
||||
_AList = {}
|
||||
_Labels = {}
|
||||
|
||||
_Coords = {}
|
||||
|
||||
_URLColor = pygame.Color(51,166,255)
|
||||
_TextColor = pygame.Color(83,83,83)
|
||||
_URLColor = MySkinManager.GiveColor('URL')
|
||||
_TextColor = MySkinManager.GiveColor('Text')
|
||||
_Scrolled = 0
|
||||
|
||||
_PngSize = {}
|
||||
@@ -59,32 +62,39 @@ class TinyCloudPage(Page):
|
||||
|
||||
self._Coords["forssh"] = SimpleNamespace()
|
||||
self._Coords["forssh"].x = self._Coords["forID"].x
|
||||
self._Coords["forssh"].y = 47
|
||||
self._Coords["forssh"].y = 36
|
||||
|
||||
self._Coords["ssh_addr"] = SimpleNamespace()
|
||||
self._Coords["ssh_addr"].x = self._Coords["forID"].x
|
||||
self._Coords["ssh_addr"].y = 65
|
||||
self._Coords["ssh_addr"].y = 54
|
||||
|
||||
self._Coords["forwin"] = SimpleNamespace()
|
||||
self._Coords["forwin"].x = self._Coords["forID"].x
|
||||
self._Coords["forwin"].y = 101
|
||||
self._Coords["forwin"].y = 80
|
||||
|
||||
self._Coords["samba_games"] = SimpleNamespace()
|
||||
self._Coords["samba_games"].x = self._Coords["forID"].x
|
||||
self._Coords["samba_games"].y = 118
|
||||
self._Coords["samba_games"].y = 97
|
||||
|
||||
self._Coords["samba_music"] = SimpleNamespace()
|
||||
self._Coords["samba_music"].x = self._Coords["samba_games"].x
|
||||
self._Coords["samba_music"].y = 136
|
||||
self._Coords["samba_music"].y = 115
|
||||
|
||||
self._Coords["for_airplay"] = SimpleNamespace()
|
||||
self._Coords["for_airplay"].x = self._Coords["forID"].x
|
||||
self._Coords["for_airplay"].y = 173
|
||||
self._Coords["for_airplay"].y = 140
|
||||
|
||||
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
|
||||
@@ -108,17 +118,27 @@ 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],
|
||||
[["forssh","For ssh and scp:",self._ListLabelFontObj,self._TextColor],
|
||||
["ssh_addr","ssh cpi@%s" % self._IP, self._ListFontObj,self._URLColor],
|
||||
["forwin", "For Windows network:", self._ListFontObj, self._TextColor],
|
||||
|
||||
["forwin", "For Windows network:", self._ListLabelFontObj, self._TextColor],
|
||||
["samba_games", "\\\\%s\games" % self._IP, self._ListFontObj,self._URLColor],
|
||||
["samba_music", "\\\\%s\music" % self._IP, self._ListFontObj,self._URLColor],
|
||||
["forID", "ID:", self._ListFontObj, self._TextColor],
|
||||
["forKey", "Key:", self._ListFontObj, self._TextColor],
|
||||
|
||||
["forID", "ID:", self._ListLabelFontObj, self._TextColor],
|
||||
["forKey", "Key:", self._ListLabelFontObj, self._TextColor],
|
||||
["key_and_pass", "cpi", self._ListFontObj, self._URLColor],
|
||||
["for_airplay", "Airplay:", self._ListFontObj, self._TextColor],
|
||||
["airplay_name","clockworkpi", self._ListFontObj, self._URLColor]]
|
||||
|
||||
["for_airplay", "Airplay:", self._ListLabelFontObj, self._TextColor],
|
||||
["airplay_name",hostname, self._ListFontObj, self._URLColor],
|
||||
|
||||
["for-usb-eth","USB-Ethernet:", self._ListLabelFontObj, self._TextColor],
|
||||
["usb-eth-addr","192.168.10.1", self._ListFontObj, self._URLColor]]
|
||||
|
||||
for i in labels:
|
||||
l = Label()
|
||||
@@ -141,8 +161,8 @@ class TinyCloudPage(Page):
|
||||
self._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
self._PngSize["bg"] = (253,132)
|
||||
self._PngSize["online"] = (75,122)
|
||||
self._PngSize["bg"] = (253,114)
|
||||
#self._PngSize["online"] = (75,122)
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
||||
@@ -152,6 +172,7 @@ class TinyCloudPage(Page):
|
||||
|
||||
self._Icons["bg"] = bgpng
|
||||
|
||||
"""
|
||||
onlinepng = IconItem()
|
||||
onlinepng._ImgSurf = MyIconPool._Icons["online"]
|
||||
onlinepng._MyType = ICON_TYPES["STAT"]
|
||||
@@ -159,16 +180,14 @@ class TinyCloudPage(Page):
|
||||
onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)
|
||||
|
||||
self._Icons["online"] = onlinepng
|
||||
|
||||
"""
|
||||
self.SetLabels()
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if self._FootMsg[3] == "Back":
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
return
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def Draw(self):
|
||||
if self._DrawOnce == False:
|
||||
@@ -176,8 +195,8 @@ class TinyCloudPage(Page):
|
||||
|
||||
if is_wifi_connected_now():
|
||||
|
||||
self._Icons["online"].NewCoord(self._Coords["online"].x, self._Coords["online"].y)
|
||||
self._Icons["online"].Draw()
|
||||
#self._Icons["online"].NewCoord(self._Coords["online"].x, self._Coords["online"].y)
|
||||
#self._Icons["online"].Draw()
|
||||
|
||||
self.SetLabels()
|
||||
|
||||
@@ -190,6 +209,12 @@ 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()
|
||||
|
||||
@@ -197,7 +222,7 @@ class TinyCloudPage(Page):
|
||||
self._DrawOnce = True
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor('White'))
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
|
||||
@@ -210,7 +235,7 @@ class APIOBJ(object):
|
||||
def Init(self,main_screen):
|
||||
self._Page = TinyCloudPage()
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="Tiny cloud"
|
||||
self._Page._Name ="CONNECT"
|
||||
self._Page.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exit 0
|
||||
@@ -12,15 +12,16 @@ 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
|
||||
from UI.util_funcs import midRect,FileExists
|
||||
from UI.keys_def import CurKeys, 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.multilabel import MultiLabel
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
|
||||
from config import VERSION
|
||||
|
||||
class InfoPageListItem(object):
|
||||
_PosX = 0
|
||||
@@ -79,7 +80,7 @@ class InfoPageListItem(object):
|
||||
class AboutPage(Page):
|
||||
_FootMsg = ["Nav.","","","Back",""]
|
||||
_MyList = []
|
||||
_ListFontObj = fonts["varela13"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@@ -207,7 +208,32 @@ 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 = []
|
||||
@@ -216,7 +242,7 @@ class AboutPage(Page):
|
||||
start_y = 10
|
||||
last_height = 0
|
||||
|
||||
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname"] ):
|
||||
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname","launcher_ver","os_image_ver"] ):
|
||||
#for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
|
||||
if u not in self._AList:
|
||||
continue
|
||||
@@ -229,7 +255,7 @@ class AboutPage(Page):
|
||||
li._PosY = start_y + last_height
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||
|
||||
if self._AList[u]["label"] != "":
|
||||
li.Init( self._AList[u]["label"] )
|
||||
@@ -240,7 +266,7 @@ class AboutPage(Page):
|
||||
|
||||
li.SetSmallText( self._AList[u]["value"] )
|
||||
|
||||
last_height += li._Height
|
||||
last_height += li._Height+2 ## fix offset for long line text covered on the right background png
|
||||
|
||||
self._MyList.append(li)
|
||||
|
||||
@@ -248,14 +274,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) )
|
||||
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight+50) )
|
||||
|
||||
self._PosX = self._Index*self._Screen._Width
|
||||
self._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
||||
bgpng = MultiIconItem()
|
||||
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
@@ -267,6 +293,9 @@ class AboutPage(Page):
|
||||
self.CpuMhz()
|
||||
self.Uname()
|
||||
|
||||
self.LauncherVersion()
|
||||
self.OsImageVersion()
|
||||
|
||||
self.GenList()
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
@@ -278,7 +307,7 @@ class AboutPage(Page):
|
||||
|
||||
def ScrollDown(self):
|
||||
dis = 10
|
||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 50:
|
||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 100:
|
||||
self._PosY -= dis
|
||||
self._Scrolled -= dis
|
||||
|
||||
@@ -300,7 +329,7 @@ class AboutPage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@@ -321,16 +350,19 @@ 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((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
@@ -12,74 +12,20 @@ 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
|
||||
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.skin_manager import MySkinManager
|
||||
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.","","","Back","Toggle"]
|
||||
_FootMsg = ["Nav","","Rescue","Back","Toggle"]
|
||||
_MyList = []
|
||||
_ListFontObj = fonts["varela13"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@@ -117,7 +63,7 @@ class AirplanePage(Page):
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
|
||||
|
||||
"""
|
||||
airwire = IconItem()
|
||||
airwire._ImgSurf = MyIconPool._Icons["airwire"]
|
||||
airwire._MyType = ICON_TYPES["STAT"]
|
||||
@@ -131,14 +77,15 @@ class AirplanePage(Page):
|
||||
GS._Parent = self
|
||||
GS.Adjust(0,0,72,95,0)
|
||||
self._Icons["GS"] = GS
|
||||
"""
|
||||
|
||||
DialogBoxs = MultiIconItem()
|
||||
DialogBoxs._ImgSurf = MyIconPool._Icons["DialogBoxs"]
|
||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||
DialogBoxs._Parent = self
|
||||
DialogBoxs._IconWidth = 134
|
||||
DialogBoxs._IconHeight = 93
|
||||
DialogBoxs.Adjust(0,0,134,372,0)
|
||||
DialogBoxs._IconWidth = 180
|
||||
DialogBoxs._IconHeight = 80
|
||||
DialogBoxs.Adjust(0,0,180,320,0)
|
||||
self._Icons["DialogBoxs"] = DialogBoxs
|
||||
|
||||
|
||||
@@ -161,6 +108,8 @@ 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:
|
||||
@@ -175,7 +124,7 @@ class AirplanePage(Page):
|
||||
|
||||
def ToggleModeAni(self): ## with animation
|
||||
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
|
||||
if out[1] == "yes":
|
||||
if "yes" in out[1]:
|
||||
data = self.EasingData(0,43)
|
||||
for _,v in enumerate(data):
|
||||
self._airwire_y -= v
|
||||
@@ -205,25 +154,31 @@ class AirplanePage(Page):
|
||||
def ToggleMode(self):
|
||||
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
|
||||
print out
|
||||
if out[1] == "yes":
|
||||
self._Screen._MsgBox.SetText("Turning On")
|
||||
if "yes" in out[1]:
|
||||
self._Screen._MsgBox.SetText("TurningOn")
|
||||
self._Screen._MsgBox.Draw()
|
||||
commands.getstatusoutput("sudo rfkill unblock all")
|
||||
self._Screen._TitleBar._InAirPlaneMode = False
|
||||
|
||||
else:
|
||||
self._Screen._MsgBox.SetText("Turning Off")
|
||||
self._Screen._MsgBox.SetText("TurningOff")
|
||||
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 out[1] == "yes":
|
||||
if "yes" in out[1]:
|
||||
self._Screen._TitleBar._InAirPlaneMode = True
|
||||
self._airwire_y = 50+43
|
||||
self._dialog_index = 1
|
||||
@@ -239,12 +194,12 @@ class AirplanePage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.ToggleModeAni()
|
||||
"""
|
||||
self.ToggleMode()
|
||||
@@ -265,23 +220,36 @@ 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()
|
||||
|
||||
self._Icons["DialogBoxs"].NewCoord(145,23)
|
||||
self._Icons["airwire"].NewCoord(80,self._airwire_y)
|
||||
self._Icons["DialogBoxs"].NewCoord(70,58)
|
||||
#self._Icons["airwire"].NewCoord(80,self._airwire_y)
|
||||
|
||||
self._Icons["DialogBoxs"]._IconIndex = self._dialog_index
|
||||
|
||||
self._Icons["DialogBoxs"].DrawTopLeft()
|
||||
self._Icons["airwire"].Draw()
|
||||
#self._Icons["airwire"].Draw()
|
||||
|
||||
self._Icons["GS"].NewCoord(98,118)
|
||||
self._Icons["GS"].Draw()
|
||||
#self._Icons["GS"].NewCoord(98,118)
|
||||
#self._Icons["GS"].Draw()
|
||||
|
||||
self.DrawCross(10,10)
|
||||
self.DrawCross(self._Screen._Width-20,10)
|
||||
self.DrawCross(10,self._Screen._Height-20)
|
||||
self.DrawCross(self._Screen._Width-20,self._Screen._Height-20)
|
||||
|
||||
if self._HWND != None:
|
||||
self._HWND.fill((255,255,255))
|
||||
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||
|
||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||
|
||||
@@ -0,0 +1,815 @@
|
||||
# -*- 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('Line')
|
||||
|
||||
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)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width-4,h),0)
|
||||
|
||||
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('Line')
|
||||
|
||||
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)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor, (x,y,self._Width-4,h),0 )
|
||||
|
||||
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('Text'),(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)
|
||||
@@ -0,0 +1,224 @@
|
||||
# -*- 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()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
# -*- 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._Icons["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)
|
||||
@@ -10,25 +10,23 @@ 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
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.slider import Slider
|
||||
from UI.icon_pool import MyIconPool
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
|
||||
from config import BackLight
|
||||
|
||||
|
||||
import myvars
|
||||
|
||||
class BSlider(Slider):
|
||||
|
||||
|
||||
OnChangeCB = None
|
||||
_BGpng = None
|
||||
_BGwidth = 179
|
||||
_BGheight = 153
|
||||
|
||||
_NeedleSurf = None
|
||||
_Scale = None
|
||||
_Parent = None
|
||||
_Icons = {}
|
||||
|
||||
@@ -39,22 +37,11 @@ class BSlider(Slider):
|
||||
self._Width = self._Parent._Width
|
||||
self._Height = self._Parent._Height
|
||||
|
||||
bgpng = IconItem()
|
||||
bgpng._ImgSurf = MyIconPool._Icons["light"]
|
||||
bgpng._MyType = ICON_TYPES["STAT"]
|
||||
bgpng._Parent = self
|
||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
self._Icons["bg"] = bgpng
|
||||
##self._NeedleSurf = pygame.Surface( (38,12),pygame.SRCALPHA )
|
||||
self._BrightnessLabel = Label()
|
||||
self._BrightnessLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._BrightnessLabel.Init("BRIGHT",MySkinManager.GiveFont("EurostileBold13"))
|
||||
self._BrightnessLabel.SetColor(MySkinManager.GiveColor('Text'))
|
||||
|
||||
scale = MultiIconItem()
|
||||
scale._MyType = ICON_TYPES["STAT"]
|
||||
scale._Parent = self
|
||||
scale._ImgSurf = MyIconPool._Icons["scale"]
|
||||
scale._IconWidth = 82
|
||||
scale._IconHeight = 63
|
||||
scale.Adjust(0,0,82,63,0)
|
||||
self._Icons["scale"] = scale
|
||||
|
||||
def SetValue(self,brt):
|
||||
self._Value = brt
|
||||
@@ -79,27 +66,40 @@ class BSlider(Slider):
|
||||
self.OnChangeCB(self._Value)
|
||||
|
||||
def Draw(self):
|
||||
start_x = 82
|
||||
start_y = self._Parent._Screen._Height/2-5
|
||||
height = 30
|
||||
width = 4
|
||||
padding = 15
|
||||
seg = self._Value-1
|
||||
|
||||
self._Icons["bg"].NewCoord(self._Width/2,self._Height/2 +11 )
|
||||
self._Icons["bg"].Draw()
|
||||
for i in range(0,9):
|
||||
rect = pygame.Rect(start_x+i*(width+padding),start_y,width,height)
|
||||
if i > seg:
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),rect, 1)
|
||||
#aa_round_rect(self._CanvasHWND,rect, MySkinManager.GiveColor('Text'),1,1, MySkinManager.GiveColor('White'))
|
||||
else:
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),rect, 0)
|
||||
#aa_round_rect(self._CanvasHWND,rect, MySkinManager.GiveColor('Text'),1,0, MySkinManager.GiveColor('White'))
|
||||
|
||||
self._BrightnessLabel.NewCoord(118,self._Parent._Screen._Height/2-30)
|
||||
self._BrightnessLabel.Draw(True)
|
||||
|
||||
minus_box_rect = pygame.Rect(start_x- (4+6)*4,start_y,6*4,30)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),minus_box_rect, 0)
|
||||
|
||||
minus_rect = pygame.Rect(start_x-8*4,start_y+14,2*4,2)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),minus_rect, 0)
|
||||
|
||||
plus_box_rect = pygame.Rect(start_x + 39*4 +4*4,start_y,6*4,30)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),plus_box_rect, 0)
|
||||
|
||||
cross1_rect = pygame.Rect(start_x+39*4+4*4+2*4,start_y+14,2*4,2)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),cross1_rect, 0)
|
||||
cross2_rect = pygame.Rect(start_x+39*4+4*4+2*4+3,start_y+14-3,2,2*4)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),cross2_rect, 0)
|
||||
|
||||
self._Icons["scale"].NewCoord(self._Width/2,self._Height/2 )
|
||||
|
||||
icon_idx = self._Value - 1
|
||||
if icon_idx < 0:
|
||||
icon_idx = 0
|
||||
|
||||
self._Icons["scale"]._IconIndex = icon_idx
|
||||
self._Icons["scale"].Draw()
|
||||
"""
|
||||
pygame.draw.line(self._CanvasHWND,(255,0,0), (posx,self._PosY),(self._Width,self._PosY),3) ## range line
|
||||
pygame.draw.line(self._CanvasHWND,(0,0,255), (self._PosX,self._PosY),(posx,self._PosY),3) ## range line
|
||||
|
||||
pygame.draw.circle(self._CanvasHWND,(255,255,255),( posx, self._PosY),7,0)
|
||||
pygame.draw.circle(self._CanvasHWND,(0,0,0) ,( posx, self._PosY),7,1)## outer border
|
||||
"""
|
||||
|
||||
|
||||
|
||||
class BrightnessPage(Page):
|
||||
|
||||
@@ -161,7 +161,7 @@ class BrightnessPage(Page):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@@ -0,0 +1,267 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
import commands
|
||||
import shutil
|
||||
import os
|
||||
|
||||
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
|
||||
from UI.keys_def import CurKeys, GetButtonsLayoutMode, SetButtonsLayoutMode, 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.multilabel import MultiLabel
|
||||
from UI.confirm_page import ConfirmPage
|
||||
|
||||
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):
|
||||
lnk = ln.split("=")[0].strip()
|
||||
if lnk == "input_player1_a":
|
||||
confarr[i] = "input_player1_a = \"" + keys[0] + "\"\n"
|
||||
bka = True
|
||||
if lnk == "input_player1_b":
|
||||
confarr[i] = "input_player1_b = \"" + keys[1] + "\"\n"
|
||||
bkb = True
|
||||
if lnk == "input_player1_x":
|
||||
confarr[i] = "input_player1_x = \"" + keys[2] + "\"\n"
|
||||
bkx = True
|
||||
if lnk == "input_player1_y":
|
||||
confarr[i] = "input_player1_y = \"" + keys[3] + "\"\n"
|
||||
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):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
|
||||
if self._LayoutMode == "xbox":
|
||||
keymap = ["j","k","u","i"]
|
||||
elif self._LayoutMode == "snes":
|
||||
keymap = ["k","j","i","u"]
|
||||
else:
|
||||
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
|
||||
|
||||
def OnReturnBackCb(self):
|
||||
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"]
|
||||
_MyList = []
|
||||
|
||||
_AList = {}
|
||||
|
||||
_Scrolled = 0
|
||||
|
||||
_BGwidth = 320
|
||||
_BGheight = 240-24-20
|
||||
|
||||
_DrawOnce = False
|
||||
_Scroller = None
|
||||
_ConfirmPage = None
|
||||
|
||||
_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._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
DialogBoxs = MultiIconItem()
|
||||
DialogBoxs._ImgSurf = MyIconPool._Icons["buttonslayout"]
|
||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||
DialogBoxs._Parent = self
|
||||
DialogBoxs._IconWidth = 300
|
||||
DialogBoxs._IconHeight = 150
|
||||
DialogBoxs.Adjust(0,0,134,372,0)
|
||||
self._Icons["DialogBoxs"] = DialogBoxs
|
||||
|
||||
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)
|
||||
|
||||
self._ConfirmPage = UpdateConfirmPage()
|
||||
self._ConfirmPage._LayoutMode = GetButtonsLayoutMode()
|
||||
self._ConfirmPage._Screen = self._Screen
|
||||
self._ConfirmPage._Name = "Overwrite RA conf"
|
||||
self._ConfirmPage._Parent = self
|
||||
self._ConfirmPage.Init()
|
||||
|
||||
|
||||
def ScrollDown(self):
|
||||
dis = 10
|
||||
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 ToggleMode(self):
|
||||
|
||||
if GetButtonsLayoutMode() == "xbox":
|
||||
SetButtonsLayoutMode("snes")
|
||||
|
||||
self._dialog_index = 1
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
else:
|
||||
SetButtonsLayoutMode("xbox")
|
||||
|
||||
self._dialog_index = 0
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def OnLoadCb(self):
|
||||
self._Scrolled = 0
|
||||
self._PosY = 0
|
||||
self._DrawOnce = False
|
||||
|
||||
self._dialog_index = 0 if GetButtonsLayoutMode() == "xbox" else 1
|
||||
|
||||
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.ToggleMode()
|
||||
|
||||
if event.key == CurKeys["X"]:
|
||||
self._ConfirmPage._LayoutMode = 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"]._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 ) )
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
self._Page = ButtonsLayoutPage()
|
||||
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)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
OBJ.Init(main_screen)
|
||||
def API(main_screen):
|
||||
OBJ.API(main_screen)
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
# -*- 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()
|
||||
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 = 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)
|
||||
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
# -*- 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)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width-4,h) ,0)
|
||||
|
||||
|
||||
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._Icons["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((255,255,255))
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
# -*- 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)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width-4,h) ,0)
|
||||
|
||||
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._Icons["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((255,255,255))
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import pygame
|
||||
#import math
|
||||
#mport subprocess
|
||||
import platform
|
||||
#from beeprint import pp
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
from UI.lang_manager import MyLangManager
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
_Page = None
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
def Init(self,main_screen):
|
||||
pass
|
||||
def API(self,main_screen):
|
||||
if main_screen !=None:
|
||||
main_screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||
main_screen._MsgBox.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
pygame.time.delay(300)
|
||||
if "arm" in platform.machine():
|
||||
os.system("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||
os.system("sudo reboot")
|
||||
|
||||
OBJ = APIOBJ()
|
||||
def Init(main_screen):
|
||||
OBJ.Init(main_screen)
|
||||
def API(main_screen):
|
||||
OBJ.API(main_screen)
|
||||
@@ -0,0 +1,302 @@
|
||||
# -*- 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 len(self._MyList) == 0:
|
||||
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)
|
||||
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
# -*- 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._Icons["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)
|
||||
|
||||
|
||||
@@ -4,16 +4,15 @@ import pygame
|
||||
|
||||
#UI lib
|
||||
from UI.constants import RUNSYS
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.confirm_page import ConfirmPage
|
||||
|
||||
from UI.lang_manager import MyLangManager
|
||||
import config
|
||||
|
||||
class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
_ConfirmText = "Confirm Power OFF?"
|
||||
_ConfirmText = MyLangManager.Tr("Confirm Power OFF?")
|
||||
|
||||
|
||||
def CheckBattery(self):
|
||||
try:
|
||||
f = open(config.Battery)
|
||||
@@ -41,13 +40,13 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
if self.CheckBattery() < 20:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
||||
else:
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import pygame
|
||||
#import math
|
||||
#mport subprocess
|
||||
@@ -12,18 +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
|
||||
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
|
||||
|
||||
import config
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = MySkinManager.GiveColor('Line')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
@@ -46,9 +47,9 @@ class ListPageSelector(PageSelector):
|
||||
self._PosY = y
|
||||
self._Height = h
|
||||
|
||||
aa_round_rect(self._Parent._CanvasHWND,
|
||||
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||
|
||||
#aa_round_rect(self._Parent._CanvasHWND,
|
||||
# (x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width-4,h),0 )
|
||||
|
||||
class PageListItem(object):
|
||||
_PosX = 0
|
||||
@@ -83,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
|
||||
|
||||
@@ -102,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,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.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 = fonts["varela15"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||
_AList = {}
|
||||
|
||||
_Time1 = 40
|
||||
@@ -122,22 +123,22 @@ class InfoPage(Page):
|
||||
m = int(secs/60)
|
||||
s = secs % 60
|
||||
if m > 1:
|
||||
min_str = "%d minutes " % m
|
||||
min_str = ("%d "+MyLangManager.Tr("minutes")+" ") % m
|
||||
else:
|
||||
min_str = "%d minute " % m
|
||||
min_str = ("%d "+MyLangManager.Tr("minute")+" ") % m
|
||||
|
||||
if s == 1:
|
||||
sec_str = "%d second" % s
|
||||
sec_str = ("%d "+MyLangManager.Tr("second")) % s
|
||||
elif s > 1:
|
||||
sec_str = "%d seconds" % s
|
||||
sec_str = ("%d "+MyLangManager.Tr("seconds")) % s
|
||||
elif secs > 0:
|
||||
if secs > 1:
|
||||
sec_str = "%d seconds" % secs
|
||||
sec_str = ("%d "+MyLangManager.Tr("seconds")) % secs
|
||||
else:
|
||||
sec_str = "%d second" % secs
|
||||
sec_str = ("%d "+MyLangManager.Tr("second")) % secs
|
||||
|
||||
elif secs == 0:
|
||||
sec_str = "Never"
|
||||
sec_str = MyLangManager.Tr("Never")
|
||||
|
||||
return min_str + sec_str
|
||||
|
||||
@@ -155,7 +156,7 @@ class InfoPage(Page):
|
||||
time1 = {}
|
||||
time1["key"] = "time1"
|
||||
if self._Time1 == 0:
|
||||
time1["value"] = "Never"
|
||||
time1["value"] = MyLangManager.Tr("Never")
|
||||
else:
|
||||
time1["value"] = "%d secs" % self._Time1
|
||||
time1["label"] = "Screen dimming"
|
||||
@@ -163,7 +164,7 @@ class InfoPage(Page):
|
||||
time2 = {}
|
||||
time2["key"] = "time2"
|
||||
if self._Time2 == 0:
|
||||
time2["value"] = "Never"
|
||||
time2["value"] = MyLangManager.Tr("Never")
|
||||
else:
|
||||
time2["value"] = "%d secs" % self._Time2
|
||||
|
||||
@@ -173,7 +174,7 @@ class InfoPage(Page):
|
||||
time3["key"] = "time3"
|
||||
|
||||
if self._Time3 == 0:
|
||||
time3["value"] = "Never"
|
||||
time3["value"] = MyLangManager.Tr("Never")
|
||||
else:
|
||||
time3["value"] = "%d secs" % self._Time3
|
||||
time3["label"] = "Power OFF"
|
||||
@@ -188,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"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MyLangManager.TrFont("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"] )
|
||||
|
||||
@@ -266,7 +267,7 @@ class InfoPage(Page):
|
||||
"""
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@@ -288,9 +289,9 @@ class InfoPage(Page):
|
||||
i.Draw()
|
||||
|
||||
class PowerOptionsPage(Page):
|
||||
_FootMsg = ["Nav.","","Detail","Back","Select"]
|
||||
_FootMsg = ["Nav","Detail","","Back","Select"]
|
||||
_MyList = []
|
||||
_ListFont = fonts["notosanscjk15"]
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_AList = {}
|
||||
|
||||
@@ -400,30 +401,6 @@ 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:
|
||||
@@ -443,7 +420,12 @@ class PowerOptionsPage(Page):
|
||||
|
||||
config.PowerLevel = cur_li._Value
|
||||
|
||||
self._Screen._MsgBox.SetText("Applying...")
|
||||
if config.PowerLevel!= "supersaving":
|
||||
os.system("sudo iw wlan0 set power_save off > /dev/null")
|
||||
else:
|
||||
os.system("sudo iw wlan0 set power_save on > /dev/null")
|
||||
|
||||
self._Screen._MsgBox.SetText("Applying")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
@@ -478,12 +460,12 @@ class PowerOptionsPage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
"""
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.Click()
|
||||
|
||||
if event.key == CurKeys["Up"]:
|
||||
@@ -0,0 +1,167 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
|
||||
#from libs.roundrects import aa_round_rect
|
||||
|
||||
import alsaaudio
|
||||
|
||||
## local UI import
|
||||
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.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||
from UI.slider import Slider
|
||||
from UI.multi_icon_item import MultiIconItem
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
from UI.icon_pool import MyIconPool
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
import myvars
|
||||
|
||||
class SoundSlider(Slider):
|
||||
OnChangeCB = None
|
||||
|
||||
_Parent = None
|
||||
_VolumeLabel =None
|
||||
|
||||
def __init__(self):
|
||||
Slider.__init__(self)
|
||||
|
||||
def Init(self):
|
||||
self._Width = self._Parent._Width
|
||||
self._Height = self._Parent._Height
|
||||
|
||||
self._VolumeLabel = Label()
|
||||
self._VolumeLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._VolumeLabel.Init("VOLUME",MySkinManager.GiveFont("EurostileBold13"))
|
||||
self._VolumeLabel.SetColor(MySkinManager.GiveColor('Text'))
|
||||
|
||||
def SetValue(self,vol):#pct 0-100
|
||||
if vol >= 0 and vol <= 100:
|
||||
self._Value = vol
|
||||
|
||||
def Further(self):
|
||||
self._Value+=5
|
||||
|
||||
if self._Value > 100:
|
||||
self._Value = 100
|
||||
|
||||
if self.OnChangeCB != None:
|
||||
if callable(self.OnChangeCB):
|
||||
self.OnChangeCB( self._Value )
|
||||
|
||||
def StepBack(self):
|
||||
self._Value-=5
|
||||
|
||||
if self._Value < 0:
|
||||
self._Value = 0
|
||||
|
||||
if self.OnChangeCB != None:
|
||||
if callable(self.OnChangeCB):
|
||||
self.OnChangeCB( self._Value )
|
||||
|
||||
def Draw(self):
|
||||
start_x = 82
|
||||
start_y = self._Parent._Screen._Height/2-5
|
||||
height = 30
|
||||
width = 4
|
||||
seg = self._Value / 5
|
||||
|
||||
for i in range(0, 20):
|
||||
rect = pygame.Rect(start_x+i*(width*2),start_y,width,height)
|
||||
if i > seg:
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),rect, 1)
|
||||
#aa_round_rect(self._CanvasHWND,rect, MySkinManager.GiveColor('Text'),1,1, MySkinManager.GiveColor('White'))
|
||||
else:
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),rect, 0)
|
||||
#aa_round_rect(self._CanvasHWND,rect, MySkinManager.GiveColor('Text'),1,0, MySkinManager.GiveColor('White'))
|
||||
|
||||
self._VolumeLabel.NewCoord(118,self._Parent._Screen._Height/2-30)
|
||||
self._VolumeLabel.Draw(True)
|
||||
|
||||
minus_box_rect = pygame.Rect(start_x- (4+6)*4,start_y,6*4,30)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),minus_box_rect, 0)
|
||||
|
||||
minus_rect = pygame.Rect(start_x-8*4,start_y+14,2*4,2)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),minus_rect, 0)
|
||||
|
||||
plus_box_rect = pygame.Rect(start_x + 39*4 +4*4,start_y,6*4,30)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),plus_box_rect, 0)
|
||||
|
||||
cross1_rect = pygame.Rect(start_x+39*4+4*4+2*4,start_y+14,2*4,2)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),cross1_rect, 0)
|
||||
cross2_rect = pygame.Rect(start_x+39*4+4*4+2*4+3,start_y+14-3,2,2*4)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),cross2_rect, 0)
|
||||
|
||||
class SoundPage(Page):
|
||||
|
||||
_MySlider = None
|
||||
_FootMsg = ["Nav","","","Back","Enter"]
|
||||
|
||||
def Init(self):
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
self._Width = self._Screen._Width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
self._MySlider = SoundSlider()
|
||||
|
||||
self._MySlider._Parent = self
|
||||
self._MySlider.SetCanvasHWND(self._CanvasHWND)
|
||||
|
||||
self._MySlider.OnChangeCB = self.WhenSliderDrag
|
||||
|
||||
self._MySlider.Init()
|
||||
|
||||
try:
|
||||
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))
|
||||
|
||||
def WhenSliderDrag(self,value): ##value 0-100
|
||||
if value < 0 or value > 100:
|
||||
return
|
||||
|
||||
m = alsaaudio.Mixer()
|
||||
m.setvolume(int(value))
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Right"]:
|
||||
self._MySlider.Further()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Left"]:
|
||||
self._MySlider.StepBack()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
|
||||
self._MySlider.Draw()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,15 +6,13 @@ import os
|
||||
|
||||
## local UI import
|
||||
from UI.page import Page
|
||||
from UI.skin_manager import MySkinManager
|
||||
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
|
||||
|
||||
class StoragePage(Page):
|
||||
|
||||
_Icons = {}
|
||||
@@ -24,10 +22,10 @@ class StoragePage(Page):
|
||||
_BGlabel = None
|
||||
_FreeLabel = None
|
||||
|
||||
_BGmsg = "%.1fGB of %.1fGB Used"
|
||||
_GBmsg = "%.1fGB of %.1fGB Used"
|
||||
_DskUsg = None
|
||||
|
||||
_HighColor = pygame.Color(51,166,255)
|
||||
_TextColor = MySkinManager.GiveColor('Text')
|
||||
_FootMsg = ["Nav.","","","Back",""]
|
||||
|
||||
def __init__(self):
|
||||
@@ -53,27 +51,24 @@ class StoragePage(Page):
|
||||
self._Width = self._Screen._Width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
self._BGpng = IconItem()
|
||||
self._BGpng._ImgSurf = MyIconPool._Icons["icon_sd"]
|
||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||
self._BGpng._Parent = self
|
||||
self._GBLabel = Label()
|
||||
self._GBLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._GBLabel.Init(self._GBmsg % (self._DskUsg[1]-self._DskUsg[0], self._DskUsg[1]),MySkinManager.GiveFont("varela11") )
|
||||
self._GBLabel.SetColor(self._TextColor)
|
||||
|
||||
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)
|
||||
|
||||
|
||||
self._BGlabel = Label()
|
||||
self._BGlabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._PctLabel = Label()
|
||||
self._PctLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
|
||||
usage_percent = (self._DskUsg[0]/self._DskUsg[1] )*100.0
|
||||
|
||||
self._BGlabel.Init("%d%%"% int(usage_percent),fonts["varela25"])
|
||||
self._BGlabel.SetColor( self._HighColor )
|
||||
|
||||
self._PctLabel.Init("%d%%"% int(usage_percent),MySkinManager.GiveFont("EurostileBold30"))
|
||||
self._PctLabel.SetColor( self._TextColor )
|
||||
|
||||
self._FreeLabel = Label()
|
||||
self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
|
||||
self._FreeLabel.Init("Free",fonts["varela13"])
|
||||
self._FreeLabel.SetColor(self._BGlabel._Color)
|
||||
self._FreeLabel.Init("FREE",MySkinManager.GiveFont("varela12"))
|
||||
self._FreeLabel.SetColor(self._PctLabel._Color)
|
||||
|
||||
|
||||
def OnLoadCb(self):
|
||||
@@ -82,31 +77,43 @@ class StoragePage(Page):
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
|
||||
self._BGpng.NewCoord(self._Width/2,self._Height/2-10)
|
||||
self._BGpng.Draw()
|
||||
self._BGlabel.NewCoord(self._Width/2-28,self._Height/2-30)
|
||||
self._BGlabel.Draw()
|
||||
self._PctLabel.NewCoord(32,102- 33)
|
||||
self._PctLabel.Draw()
|
||||
|
||||
self._FreeLabel.NewCoord(self._BGlabel._PosX+10 ,self._Height/2)
|
||||
self._FreeLabel.NewCoord(33 ,130-25)
|
||||
self._FreeLabel.Draw()
|
||||
|
||||
self._GBLabel.NewCoord(145,103-29)
|
||||
self._GBLabel.Draw()
|
||||
|
||||
#bgcolor = (238,238,238), fgcolor = (126,206,244)
|
||||
#aa_round_rect
|
||||
|
||||
usage_percent = (self._DskUsg[0]/self._DskUsg[1] )
|
||||
if usage_percent < 0.1:
|
||||
usage_percent = 0.1
|
||||
|
||||
rect_ = midRect(self._Width/2,self._Height-30,170,17, Width,Height)
|
||||
rect_ = pygame.Rect(144,118-25, 283-144,139-117)
|
||||
|
||||
aa_round_rect(self._CanvasHWND,rect_, (193,193,193),5,0,(193,193,193))
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'), rect_, 1)
|
||||
|
||||
|
||||
rect2 = midRect(self._Width/2,self._Height-30,int(170*(1.0-usage_percent)),17, Width,Height)
|
||||
rect2 = pygame.Rect(144,118-25,int((283-144)*(1.0-usage_percent)),139-117)
|
||||
|
||||
rect2.left = rect_.left
|
||||
rect2.top = rect_.top
|
||||
|
||||
aa_round_rect(self._CanvasHWND,rect2, (126,206,244),5,0,(126,206,244))
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),rect2, 0)
|
||||
|
||||
sep_rect = pygame.Rect(129,99-25,2,42)
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Inactive'),sep_rect, 0)
|
||||
|
||||
##4 cross
|
||||
self.DrawCross(10,10)
|
||||
self.DrawCross(self._Screen._Width-20,10)
|
||||
self.DrawCross(10,self._Screen._Height-20)
|
||||
self.DrawCross(self._Screen._Width-20,self._Screen._Height-20)
|
||||
|
||||
|
||||
class APIOBJ(object):
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
|
||||
## local UI import
|
||||
import pages
|
||||
import myvars
|
||||
|
||||
def Init(main_screen):
|
||||
pages.InitTimezoneListPage(main_screen)
|
||||
|
||||
def API(main_screen):
|
||||
if main_screen !=None:
|
||||
main_screen.PushCurPage()
|
||||
main_screen.SetCurPage(myvars.TimezoneListPage)
|
||||
main_screen.Draw()
|
||||
main_screen.SwapAndShow()
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import pygame
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
from UI.constants import ICON_TYPES
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.icon_item import IconItem
|
||||
from UI.util_funcs import midRect
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
# a item for List
|
||||
# - - - - - - - - - - - --
|
||||
# | Icon Text..... > |
|
||||
# ------------------------
|
||||
|
||||
import myvars # icons_path
|
||||
|
||||
class ListItemIcon(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 ListItemLabel(Label):
|
||||
|
||||
_ActiveColor = MySkinManager.GiveColor('Active')
|
||||
_Active = False
|
||||
def Draw(self):
|
||||
|
||||
self._FontObj.set_bold(self._Active)
|
||||
|
||||
my_text = self._FontObj.render( self._Text,True,self._Color)
|
||||
self._CanvasHWND.blit(my_text,(self._PosX,self._PosY,self._Width,self._Height))
|
||||
|
||||
|
||||
class ListItem(object):
|
||||
_PosX = 0
|
||||
_PosY = 0
|
||||
_Width = 0
|
||||
_Height = 30
|
||||
|
||||
_Labels = {}
|
||||
_Icons = {}
|
||||
_Fonts = {}
|
||||
_MyType = ICON_TYPES["EXE"]
|
||||
_LinkObj = None
|
||||
_Path = ""
|
||||
_Active = False
|
||||
_Parent = None
|
||||
|
||||
_Text = ""
|
||||
def __init__(self):
|
||||
self._Labels = {}
|
||||
self._Icons = {}
|
||||
self._Fonts = {}
|
||||
|
||||
|
||||
def Init(self,text):
|
||||
|
||||
self._Text = text
|
||||
|
||||
l = ListItemLabel()
|
||||
l._PosX = 22
|
||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
||||
|
||||
if self._MyType == ICON_TYPES["DIR"]:
|
||||
l.Init(text,self._Fonts["normal"])
|
||||
self._Path = text
|
||||
else:
|
||||
l.Init(text,self._Fonts["normal"])
|
||||
self._Path = text
|
||||
|
||||
|
||||
self._Labels["Text"] = l
|
||||
|
||||
|
||||
def NewCoord(self,x,y):
|
||||
self._PosX = x
|
||||
self._PosY = y
|
||||
|
||||
def Draw(self):
|
||||
|
||||
if self._MyType == ICON_TYPES["DIR"] and self._Path != "[..]":
|
||||
self._Parent._Icons["sys"]._IconIndex = 0
|
||||
self._Parent._Icons["sys"].NewCoord(self._PosX+12,self._PosY+ (self._Height - self._Parent._Icons["sys"]._Height)/2+self._Parent._Icons["sys"]._Height/2)
|
||||
self._Parent._Icons["sys"].Draw()
|
||||
|
||||
if self._MyType == ICON_TYPES["FILE"]:
|
||||
self._Parent._Icons["sys"]._IconIndex = 1
|
||||
self._Parent._Icons["sys"].NewCoord(self._PosX+12,self._PosY+ (self._Height - self._Parent._Icons["sys"]._Height)/2+self._Parent._Icons["sys"]._Height/2)
|
||||
self._Parent._Icons["sys"].Draw()
|
||||
|
||||
if self._Active == True:
|
||||
self._Labels["Text"]._Active = True
|
||||
else:
|
||||
self._Labels["Text"]._Active = False
|
||||
|
||||
|
||||
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)
|
||||
|
||||
self._Labels["Text"].Draw()
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import logzero
|
||||
|
||||
def get_logger():
|
||||
# Set a custom formatter
|
||||
log_format = '%(color)s[%(levelname)1.1s ' \
|
||||
'%(asctime)s.%(msecs)03d %(module)s:%(lineno)d]' \
|
||||
'%(end_color)s %(message)s'
|
||||
formatter = logzero.LogFormatter(fmt=log_format)
|
||||
logzero.setup_default_logger(formatter=formatter)
|
||||
|
||||
logzero.logfile(
|
||||
'logzero.log',
|
||||
maxBytes=1e6,
|
||||
backupCount=3
|
||||
)
|
||||
return logzero.logger
|
||||
@@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
TimePage = None
|
||||
TimezoneListPage = None
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from timezone_lib_list_page import TimezoneListPage
|
||||
import myvars
|
||||
|
||||
def InitTimePage(main_screen):
|
||||
myvars.TimePage = None
|
||||
|
||||
def InitTimezoneListPage(main_screen):
|
||||
myvars.TimezoneListPage = TimezoneListPage()
|
||||
myvars.TimezoneListPage._Screen = main_screen
|
||||
myvars.TimezoneListPage._Name = "Timezone Selection"
|
||||
myvars.TimezoneListPage.Init()
|
||||
@@ -0,0 +1,304 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import pygame
|
||||
|
||||
from libs.roundrects import aa_round_rect
|
||||
|
||||
## local UI import
|
||||
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.util_funcs import midRect
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
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 list_item import ListItem
|
||||
|
||||
|
||||
import myvars
|
||||
|
||||
|
||||
class TimeLibStack:
|
||||
def __init__(self):
|
||||
self.stack = list()
|
||||
|
||||
def Push(self,data):
|
||||
if data not in self.stack:
|
||||
self.stack.append(data)
|
||||
return True
|
||||
return False
|
||||
|
||||
def Pop(self):
|
||||
if len(self.stack)<=0:
|
||||
return None,False
|
||||
return self.stack.pop(),True
|
||||
|
||||
def Last(self):
|
||||
idx = len(self.stack) -1
|
||||
if idx < 0:
|
||||
return "/usr/share/zoneinfo/posix"
|
||||
else:
|
||||
return self.stack[ idx ]
|
||||
|
||||
def Length(self):
|
||||
return len(self.stack)
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = MySkinManager.GiveColor('Line')
|
||||
|
||||
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 = 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)
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width-4,h),0)
|
||||
|
||||
|
||||
class TimezoneListPage(Page):
|
||||
|
||||
_Icons = {}
|
||||
_Selector=None
|
||||
_FootMsg = ["Nav","","","Back","Select"]
|
||||
_MyList = []
|
||||
_SwapMyList = []
|
||||
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||
_MyStack = None
|
||||
|
||||
_Scroller = None
|
||||
|
||||
_BGpng = None
|
||||
_BGwidth = 56
|
||||
_BGheight = 70
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
self._Icons = {}
|
||||
self._CanvasHWND = None
|
||||
self._MyList = []
|
||||
self._SwapMyList = []
|
||||
self._MyStack = TimeLibStack()
|
||||
|
||||
def buildDirectoryList(self, path):
|
||||
elements = [
|
||||
{
|
||||
'name': f,
|
||||
'file_path': os.path.join(path, f),
|
||||
'is_file': os.path.isfile(os.path.join(path, f))
|
||||
}
|
||||
for f in os.listdir(path)
|
||||
]
|
||||
return elements
|
||||
|
||||
def SyncList(self,path):
|
||||
|
||||
alist = self.buildDirectoryList(path)
|
||||
if not alist:
|
||||
print("buildDirectoryList empty")
|
||||
return
|
||||
|
||||
self._MyList = []
|
||||
self._SwapMyList = []
|
||||
|
||||
start_x = 0
|
||||
start_y = 0
|
||||
hasparent = 0
|
||||
if self._MyStack.Length() > 0:
|
||||
hasparent = 1
|
||||
li = ListItem()
|
||||
li._Parent = self
|
||||
li._PosX = start_x
|
||||
li._PosY = start_y
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFont
|
||||
li._MyType = ICON_TYPES["DIR"]
|
||||
li.Init("[..]")
|
||||
self._MyList.append(li)
|
||||
|
||||
for i,v in enumerate(sorted(alist)):
|
||||
li = ListItem()
|
||||
li._Parent = self
|
||||
li._PosX = start_x
|
||||
li._PosY = start_y + (i+hasparent)*ListItem._Height
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFont
|
||||
li._MyType = ICON_TYPES["FILE"]
|
||||
|
||||
if not v['is_file']:
|
||||
li._MyType = ICON_TYPES["DIR"]
|
||||
else:
|
||||
li._MyType = ICON_TYPES["FILE"]
|
||||
|
||||
li.Init( v['name'] )
|
||||
li._Path = v["file_path"]
|
||||
|
||||
|
||||
self._MyList.append(li)
|
||||
|
||||
for i in self._MyList:
|
||||
self._SwapMyList.append(i)
|
||||
|
||||
def Init(self):
|
||||
self._PosX = self._Index * self._Screen._Width
|
||||
self._Width = self._Screen._Width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
ps = ListPageSelector()
|
||||
ps._Parent = self
|
||||
self._Ps = ps
|
||||
self._PsIndex = 0
|
||||
|
||||
self.SyncList("/usr/share/zoneinfo/posix")
|
||||
|
||||
icon_for_list = MultiIconItem()
|
||||
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
|
||||
icon_for_list._MyType = ICON_TYPES["STAT"]
|
||||
icon_for_list._Parent = self
|
||||
|
||||
icon_for_list.Adjust(0,0,18,18,0)
|
||||
self._Icons["sys"] = icon_for_list
|
||||
|
||||
|
||||
self._BGpng = IconItem()
|
||||
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.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||
|
||||
|
||||
self._Scroller = ListScroller()
|
||||
self._Scroller._Parent = self
|
||||
self._Scroller._PosX = self._Width - 10
|
||||
self._Scroller._PosY = 2
|
||||
self._Scroller.Init()
|
||||
|
||||
def Click(self):
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
cur_li = self._MyList[self._PsIndex]
|
||||
|
||||
if cur_li._MyType == ICON_TYPES["DIR"]:
|
||||
if cur_li._Path == "[..]":
|
||||
self._MyStack.Pop()
|
||||
self.SyncList( self._MyStack.Last() )
|
||||
self._PsIndex = 0
|
||||
else:
|
||||
self._MyStack.Push( self._MyList[self._PsIndex]._Path )
|
||||
self.SyncList( self._MyStack.Last() )
|
||||
self._PsIndex = 0
|
||||
|
||||
if cur_li._MyType == ICON_TYPES["FILE"]: ## set the current timezone
|
||||
subprocess.call(['sudo', 'cp', cur_li._Path, '/etc/localtime'])
|
||||
#copyfile(cur_li._Path, '/etc/localtime')
|
||||
print("add" , cur_li._Path)
|
||||
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def Rescan(self):
|
||||
self.SyncList("/usr/share/zoneinfo/posix")
|
||||
self._PsIndex = 0
|
||||
|
||||
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 event.key == CurKeys["Right"]:
|
||||
self.FScrollDown(Step=5)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Left"]:
|
||||
self.FScrollUp(Step=5)
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.Click()
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
|
||||
if len(self._MyList) == 0:
|
||||
self._BGpng.NewCoord(self._Width/2,self._Height/2)
|
||||
self._BGpng.Draw()
|
||||
return
|
||||
|
||||
else:
|
||||
if len(self._MyList) * ListItem._Height > self._Height:
|
||||
self._Ps._Width = self._Width - 11
|
||||
|
||||
self._Ps.Draw()
|
||||
for i in self._MyList:
|
||||
if False:
|
||||
i._Active = True
|
||||
else:
|
||||
i._Active = False
|
||||
|
||||
if i._PosY > self._Height + self._Height/2:
|
||||
break
|
||||
|
||||
if i._PosY < 0:
|
||||
continue
|
||||
|
||||
i.Draw()
|
||||
|
||||
self._Scroller.UpdateSize( len(self._MyList)*ListItem._Height, self._PsIndex*ListItem._Height)
|
||||
self._Scroller.Draw()
|
||||
else:
|
||||
self._Ps._Width = self._Width
|
||||
self._Ps.Draw()
|
||||
for i in self._MyList:
|
||||
if False:
|
||||
i._Active = True
|
||||
else:
|
||||
i._Active = False
|
||||
|
||||
if i._PosY > self._Height + self._Height/2:
|
||||
break
|
||||
|
||||
if i._PosY < 0:
|
||||
continue
|
||||
|
||||
i.Draw()
|
||||
@@ -9,22 +9,27 @@ import gobject
|
||||
|
||||
## local UI import
|
||||
from UI.page import Page
|
||||
from UI.constants import ICON_TYPES,Width,Height,RUNEVT
|
||||
from UI.constants import ICON_TYPES,Width,Height,RUNEVT,RUNSH
|
||||
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
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
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 libs.roundrects import aa_round_rect
|
||||
from libs.DBUS import is_wifi_connected_now
|
||||
|
||||
import config
|
||||
|
||||
LauncherLoc = "/home/cpi/launcher"
|
||||
|
||||
class UpdateDownloadPage(DownloadProcessPage):
|
||||
_MD5 = ""
|
||||
|
||||
@@ -38,7 +43,7 @@ class UpdateDownloadPage(DownloadProcessPage):
|
||||
|
||||
if filename.endswith(".tar.gz"):
|
||||
#/home/cpi/apps/[launcher]
|
||||
cmdpath = "tar zxf " + CmdClean(filename) + " -C /home/cpi/apps ;rm -rf "+ filename
|
||||
cmdpath = "tar zxf " + CmdClean(filename) + " -C /home/cpi/ ;rm -rf "+ filename
|
||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||
|
||||
self.ReturnToUpLevelPage()
|
||||
@@ -59,7 +64,7 @@ class UpdateDownloadPage(DownloadProcessPage):
|
||||
print(filename)
|
||||
os.system("rm -rf %s" % CmdClean(filename))
|
||||
|
||||
self._Screen._MsgBox.SetText("Download failed")
|
||||
self._Screen._MsgBox.SetText("DownloadFailed")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
return False
|
||||
@@ -104,22 +109,22 @@ class UpdateConfirmPage(ConfirmPage):
|
||||
_GIT = False
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
global LauncherLoc
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
if self._GIT == True:
|
||||
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
|
||||
cmdpath = "%s/update.sh %s" % (LauncherLoc,self._Version)
|
||||
pygame.event.post( pygame.event.Event(RUNSH, message=cmdpath))
|
||||
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
|
||||
@@ -147,65 +152,14 @@ 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,(169,169,169),(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 = fonts["varela15"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||
_ConfirmPage = None
|
||||
_AList = {}
|
||||
_MyList = []
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
self._Icons = {}
|
||||
@@ -222,7 +176,7 @@ class UpdatePage(Page):
|
||||
li._PosY = start_y + i*InfoPageListItem._Height
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||
|
||||
if self._AList[v]["label"] != "":
|
||||
li.Init( self._AList[v]["label"] )
|
||||
@@ -255,7 +209,8 @@ class UpdatePage(Page):
|
||||
self.GenList()
|
||||
|
||||
def CheckUpdate(self):
|
||||
self._Screen._MsgBox.SetText("Checking update...")
|
||||
global LauncherLoc
|
||||
self._Screen._MsgBox.SetText("CheckingUpdate")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
@@ -279,12 +234,12 @@ class UpdatePage(Page):
|
||||
self._Screen.PushPage(self._ConfirmPage)
|
||||
|
||||
self._Screen.Draw()
|
||||
self._ConfirmPage.SnapMsg("Confirm Update to %s ?" % json_["version"] )
|
||||
self._ConfirmPage.SnapMsg(MyLangManager.Tr("ConfirmUpdateToFQ") % json_["version"] )
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
elif "gitversion" in json_: ### just use git to run update
|
||||
cur_dir = os.getcwd()
|
||||
os.chdir("/home/cpi/apps/launcher")
|
||||
os.chdir(LauncherLoc)
|
||||
current_git_version = get_git_revision_short_hash()
|
||||
current_git_version = current_git_version.strip("\n")
|
||||
current_git_version = current_git_version.strip("\t")
|
||||
@@ -298,11 +253,11 @@ class UpdatePage(Page):
|
||||
self._Screen.PushPage(self._ConfirmPage)
|
||||
|
||||
self._Screen.Draw()
|
||||
self._ConfirmPage.SnapMsg("Update to %s ?" % json_["gitversion"] )
|
||||
self._ConfirmPage.SnapMsg(MyLangManager.Tr("UpdateToFQ") % json_["gitversion"] )
|
||||
self._Screen.SwapAndShow()
|
||||
else:
|
||||
self._Screen.Draw()
|
||||
self._Screen._MsgBox.SetText("Launcher is up to date")
|
||||
self._Screen._MsgBox.SetText("LauncherIsUpToDate")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
pygame.time.delay(765)
|
||||
@@ -321,7 +276,7 @@ class UpdatePage(Page):
|
||||
pass
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@@ -333,12 +288,12 @@ class UpdatePage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
else:
|
||||
self._Screen.Draw()
|
||||
self._Screen._MsgBox.SetText("Checking update failed")
|
||||
self._Screen._MsgBox.SetText("CheckingUpdateFailed")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
else:
|
||||
self._Screen.Draw()
|
||||
self._Screen._MsgBox.SetText("Please Check your Wi-Fi connection")
|
||||
self._Screen._MsgBox.SetText("CheckWifiConnection")
|
||||
self._Screen._MsgBox.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
@@ -359,7 +314,7 @@ class APIOBJ(object):
|
||||
self._UpdatePage = UpdatePage()
|
||||
|
||||
self._UpdatePage._Screen = main_screen
|
||||
self._UpdatePage._Name ="Update"
|
||||
self._UpdatePage._Name = "Update"
|
||||
self._UpdatePage.Init()
|
||||
|
||||
def API(self,main_screen):
|
||||
@@ -13,7 +13,8 @@ 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:
|
||||
@@ -5,11 +5,11 @@ 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
|
||||
|
||||
class NetItemMultiIcon(MultiIconItem):
|
||||
_CanvasHWND = None
|
||||
@@ -32,10 +32,7 @@ class NetItemIcon(IconItem):
|
||||
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
|
||||
class NetItem(Widget):
|
||||
_Height = 30
|
||||
|
||||
_Bssid="" # 50:3A:A0:51:18:3C
|
||||
@@ -140,13 +137,13 @@ class NetItem(object):
|
||||
|
||||
|
||||
lock_icon = NetItemIcon()
|
||||
lock_icon._ImgSurf = MyIconPool._Icons["lock"]
|
||||
lock_icon._ImgSurf = MyIconPool.GiveIconSurface("lock")
|
||||
lock_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
lock_icon._Parent = self
|
||||
self._Icons["lock"] = lock_icon
|
||||
|
||||
done_icon = NetItemIcon()
|
||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
||||
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||
done_icon._Parent = self
|
||||
|
||||
@@ -194,6 +191,6 @@ class NetItem(object):
|
||||
self._Icons["wifistatus"].NewCoord(self._Width-23,self._PosY)
|
||||
self._Icons["wifistatus"].Draw()
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
## local UI import
|
||||
from libs.DBUS import bus,daemon,wireless,wired
|
||||
|
||||
from keyboard import Keyboard
|
||||
from UI.keyboard import Keyboard
|
||||
from wifi_list import WifiList
|
||||
|
||||
import myvars
|
||||
@@ -10,80 +10,34 @@ from wicd import misc
|
||||
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,SwapAndShow
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
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 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,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
|
||||
class WifiDisconnectConfirmPage(ConfirmPage):
|
||||
|
||||
_ConfirmText = "Confirm Disconnect?"
|
||||
_ConfirmText = MyLangManager.Tr("ConfirmDisconnectQ")
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
self.SnapMsg("Disconnecting...")
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.SnapMsg(MyLangManager.Tr("Disconnecting"))
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
@@ -104,36 +58,10 @@ class WifiDisconnectConfirmPage(ConfirmPage):
|
||||
|
||||
self.Reset()
|
||||
|
||||
class WifiInfoPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
|
||||
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.","Disconnect","","Back",""]
|
||||
_FootMsg = ["Nav","","","Back",""]
|
||||
_MyList = []
|
||||
_ListFontObj = fonts["varela15"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||
|
||||
_Wireless = None
|
||||
_Daemon = None
|
||||
@@ -165,7 +93,7 @@ class WifiInfoPage(Page):
|
||||
li._PosY = start_y + i*InfoPageListItem._Height
|
||||
li._Width = Width
|
||||
li._Fonts["normal"] = self._ListFontObj
|
||||
li._Fonts["small"] = fonts["varela12"]
|
||||
li._Fonts["small"] = MyLangManager.TrFont("varela12")
|
||||
|
||||
if self._AList[v]["label"] != "":
|
||||
li.Init( self._AList[v]["label"] )
|
||||
@@ -187,8 +115,9 @@ class WifiInfoPage(Page):
|
||||
self._Width = self._Screen._Width ## equal to screen width
|
||||
self._Height = self._Screen._Height
|
||||
|
||||
ps = WifiInfoPageSelector()
|
||||
ps = InfoPageSelector()
|
||||
ps._Parent = self
|
||||
ps._PosX = 2
|
||||
self._Ps = ps
|
||||
self._PsIndex = 0
|
||||
|
||||
@@ -212,30 +141,6 @@ 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]
|
||||
@@ -253,9 +158,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[1] = "Disconnect"
|
||||
self._FootMsg[2] = "Disconnect"
|
||||
else:
|
||||
self._FootMsg[1] = ""
|
||||
self._FootMsg[2] = ""
|
||||
|
||||
self.GenList()
|
||||
|
||||
@@ -265,7 +170,7 @@ class WifiInfoPage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@@ -280,7 +185,7 @@ class WifiInfoPage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
|
||||
if event.key == CurKeys["Enter"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.Click()
|
||||
|
||||
if event.key == CurKeys["X"]:
|
||||
@@ -297,12 +202,10 @@ class WifiInfoPage(Page):
|
||||
|
||||
|
||||
class WifiListSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
_BackgroundColor = MySkinManager.GiveColor('Line')
|
||||
|
||||
def __init__(self):
|
||||
self._PosX = 0
|
||||
self._PosY = 0
|
||||
self._Height = 0
|
||||
pass
|
||||
|
||||
def AnimateDraw(self,x2,y2):
|
||||
pass
|
||||
@@ -310,17 +213,16 @@ class WifiListSelector(PageSelector):
|
||||
|
||||
def Draw(self):
|
||||
idx = self._Parent._PsIndex
|
||||
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
|
||||
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
|
||||
|
||||
self._PosX = x
|
||||
self._PosY = y
|
||||
self._Height = h
|
||||
|
||||
aa_round_rect(self._Parent._CanvasHWND,
|
||||
(x,y,self._Width,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||
|
||||
pygame.draw.rect(self._Parent._CanvasHWND,self._BackgroundColor,(x,y,self._Width,h),0)
|
||||
|
||||
|
||||
class WifiListMessageBox(Label):
|
||||
@@ -333,14 +235,14 @@ class WifiListMessageBox(Label):
|
||||
x = (self._Parent._Width - w)/2
|
||||
y = (self._Parent._Height - h)/2
|
||||
padding = 10
|
||||
pygame.draw.rect(self._CanvasHWND,(255,255,255),(x-padding,y-padding, w+padding*2,h+padding*2))
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(x-padding,y-padding, w+padding*2,h+padding*2))
|
||||
|
||||
pygame.draw.rect(self._CanvasHWND,(0,0,0),(x-padding,y-padding, w+padding*2,h+padding*2),1)
|
||||
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Text'),(x-padding,y-padding, w+padding*2,h+padding*2),1)
|
||||
|
||||
self._CanvasHWND.blit(my_text,(x,y,w,h))
|
||||
|
||||
class WifiList(Page):
|
||||
_WirelessList = []
|
||||
_MyList = []
|
||||
#Wicd dbus part
|
||||
_Wireless = None
|
||||
_Daemon = None
|
||||
@@ -360,16 +262,17 @@ class WifiList(Page):
|
||||
_BlockCb = None
|
||||
|
||||
_LastStatusMsg = ""
|
||||
_FootMsg = ["Nav.","Scan","Info","Back","Enter"]
|
||||
_FootMsg = ["Nav","Info","Scan","Back","Enter"]
|
||||
_EncMethods = None
|
||||
_Scroller = None
|
||||
_ListFontObj = fonts["notosanscjk15"]
|
||||
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
|
||||
|
||||
_InfoPage = None
|
||||
_CurBssid = ""
|
||||
|
||||
def __init__(self):
|
||||
Page.__init__(self)
|
||||
self._WirelessList = []
|
||||
self._MyList = []
|
||||
self._CanvasHWND = None
|
||||
|
||||
def ShowBox(self,msg):
|
||||
@@ -386,7 +289,7 @@ class WifiList(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
def GenNetworkList(self):
|
||||
self._WirelessList = []
|
||||
self._MyList = []
|
||||
start_x = 0
|
||||
start_y = 0
|
||||
|
||||
@@ -405,7 +308,7 @@ class WifiList(Page):
|
||||
#ni._Bssid = self._Wireless.GetWirelessProperty(network_id,"bssid")
|
||||
|
||||
ni.Init(network_id,is_active)
|
||||
self._WirelessList.append(ni)
|
||||
self._MyList.append(ni)
|
||||
|
||||
self._PsIndex = 0
|
||||
|
||||
@@ -443,7 +346,7 @@ class WifiList(Page):
|
||||
return
|
||||
|
||||
self._Scanning = True
|
||||
self.ShowBox("Wifi scanning...")
|
||||
self.ShowBox(MyLangManager.Tr("Wifi scanning"))
|
||||
self._BlockingUI = True
|
||||
print("dbus says start scan...")
|
||||
|
||||
@@ -466,8 +369,8 @@ class WifiList(Page):
|
||||
if info != None:
|
||||
if len(info) > 3:
|
||||
_id = int(info[3])
|
||||
if _id < len(self._WirelessList):
|
||||
self._WirelessList[_id].UpdateStrenLabel( str(info[2]))
|
||||
if _id < len(self._MyList):
|
||||
self._MyList[_id].UpdateStrenLabel( str(info[2]))
|
||||
|
||||
self._PrevWicdState = state
|
||||
|
||||
@@ -485,6 +388,7 @@ class WifiList(Page):
|
||||
"""
|
||||
|
||||
if wireless_connecting:
|
||||
|
||||
if not fast:
|
||||
iwconfig = self._Wireless.GetIwconfig()
|
||||
else:
|
||||
@@ -498,7 +402,6 @@ class WifiList(Page):
|
||||
|
||||
self._Screen._FootBar.UpdateNavText(self._LastStatusMsg)
|
||||
SwapAndShow()
|
||||
|
||||
#self._ConnectTry+=1
|
||||
|
||||
return True
|
||||
@@ -536,7 +439,7 @@ class WifiList(Page):
|
||||
dbus.UInt32(2L)
|
||||
['192.168.31.141', 'TP-LINK4G', '88', '0', '72.2 Mb/s']
|
||||
"""
|
||||
pp(info)
|
||||
# pp(info)
|
||||
self.UpdateNetList(state,info)
|
||||
if info != None:
|
||||
self._Screen.Draw()
|
||||
@@ -587,7 +490,14 @@ 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")
|
||||
@@ -610,8 +520,9 @@ class WifiList(Page):
|
||||
self._Wireless.SetWirelessProperty(netid,"apsk",password)
|
||||
self._Wireless.SetWirelessProperty(netid,"automatic",1)
|
||||
|
||||
self.ShowBox(MyLangManager.Tr("Connecting"))
|
||||
|
||||
self._WirelessList[netid].Connect()
|
||||
self._MyList[netid].Connect()
|
||||
print("after Connect")
|
||||
self.UpdateStatus()
|
||||
|
||||
@@ -645,50 +556,50 @@ 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):
|
||||
|
||||
if self._BlockingUI == True:
|
||||
print("UI blocking ...")
|
||||
return
|
||||
# if self._BlockingUI == True:
|
||||
# print("UI blocking ...")
|
||||
# return
|
||||
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
if self._Wireless != None:
|
||||
wireless_connecting = self._Wireless.CheckIfWirelessConnecting()
|
||||
if wireless_connecting:
|
||||
self.ShutDownConnecting()
|
||||
self.ShowBox("ShutDownConnecting...")
|
||||
self.ShowBox(MyLangManager.Tr("ShutDownConnecting"))
|
||||
self._BlockingUI=True
|
||||
self._BlockCb = self.AbortedAndReturnToUpLevel
|
||||
else:
|
||||
@@ -708,13 +619,14 @@ class WifiList(Page):
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["Enter"]: ## enter to set password,enter is B on GM
|
||||
if len(self._WirelessList) == 0:
|
||||
if IsKeyStartOrA(event.key): ## enter to set password,enter is B on GM
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
wicd_wirelss_encrypt_pwd = self.GetWirelessEncrypt(self._PsIndex)
|
||||
self._CurBssid = self._MyList[self._PsIndex]._Bssid
|
||||
|
||||
if self._WirelessList[self._PsIndex]._IsActive:
|
||||
wicd_wirelss_encrypt_pwd = self.GetWirelessEncrypt(self._PsIndex)
|
||||
if self._MyList[self._PsIndex]._IsActive:
|
||||
self.ShowBox( self._Wireless.GetWirelessIP('') )
|
||||
else:
|
||||
self._Screen.PushCurPage()
|
||||
@@ -724,8 +636,8 @@ class WifiList(Page):
|
||||
for i in wicd_wirelss_encrypt_pwd:
|
||||
if "preshared_key" in i:
|
||||
if i["preshared_key"] != None:
|
||||
if len(i["preshared_key"]) > 0:
|
||||
thepass = i["preshared_key"]
|
||||
if len(str(i["preshared_key"])) > 0:
|
||||
thepass = str(i["preshared_key"])
|
||||
break
|
||||
|
||||
myvars.PasswordPage.SetPassword(thepass)
|
||||
@@ -744,7 +656,7 @@ class WifiList(Page):
|
||||
self.Rescan(False)
|
||||
|
||||
if event.key == CurKeys["Y"]:
|
||||
if len(self._WirelessList) == 0:
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
self._InfoPage._NetworkId = self._PsIndex
|
||||
@@ -774,7 +686,7 @@ class WifiList(Page):
|
||||
|
||||
msgbox = WifiListMessageBox()
|
||||
msgbox._CanvasHWND = self._CanvasHWND
|
||||
msgbox.Init(" ",fonts["veramono12"])
|
||||
msgbox.Init(" ",MyLangManager.TrFont("veramono12"))
|
||||
msgbox._Parent = self
|
||||
|
||||
self._MsgBox = msgbox
|
||||
@@ -807,19 +719,19 @@ class WifiList(Page):
|
||||
|
||||
self._InfoPage = WifiInfoPage()
|
||||
self._InfoPage._Screen = self._Screen
|
||||
self._InfoPage._Name = "Wifi info"
|
||||
self._InfoPage._Name = MyLangManager.Tr("Wifi info")
|
||||
self._InfoPage.Init()
|
||||
|
||||
def Draw(self):
|
||||
self.ClearCanvas()
|
||||
|
||||
if len(self._WirelessList) == 0:
|
||||
if len(self._MyList) == 0:
|
||||
return
|
||||
|
||||
self._Ps.Draw()
|
||||
for i in self._WirelessList:
|
||||
for i in self._MyList:
|
||||
i.Draw()
|
||||
|
||||
|
||||
self._Scroller.UpdateSize( len(self._WirelessList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
||||
self._Scroller.UpdateSize( len(self._MyList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
||||
self._Scroller.Draw()
|
||||
@@ -7,7 +7,8 @@ import pygame
|
||||
## local UI import
|
||||
from UI.page import Page
|
||||
from UI.label import Label
|
||||
from UI.fonts import fonts
|
||||
from UI.lang_manager import MyLangManager
|
||||
from UI.skin_manager import MySkinManager
|
||||
|
||||
# a item for List
|
||||
# - - - - - - - - - - - --
|
||||
@@ -34,9 +35,6 @@ class ListItem(object):
|
||||
self._Icons = {}
|
||||
self._Fonts = {}
|
||||
|
||||
|
||||
|
||||
|
||||
def Init(self,text):
|
||||
|
||||
#self._Fonts["normal"] = fonts["veramono12"]
|
||||
@@ -44,7 +42,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
|
||||
|
||||
@@ -54,6 +52,6 @@ class ListItem(object):
|
||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
||||
self._Labels["Text"].Draw()
|
||||
|
||||
pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||
|
||||
|
||||
@@ -9,43 +9,17 @@ 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
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
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 list_item import ListItem
|
||||
|
||||
import myvars
|
||||
|
||||
class ListPageSelector(PageSelector):
|
||||
_BackgroundColor = pygame.Color(131,199,219)
|
||||
|
||||
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 = {}
|
||||
@@ -53,7 +27,7 @@ class ListPage(Page):
|
||||
|
||||
_FootMsg = ["Nav","","","Back","Enter"]
|
||||
_MyList = []
|
||||
_ListFontObj = fonts["varela15"]
|
||||
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||
|
||||
_Scroller = None
|
||||
|
||||
@@ -70,22 +44,31 @@ class ListPage(Page):
|
||||
|
||||
self._CanvasHWND = self._Screen._CanvasHWND
|
||||
|
||||
ps = ListPageSelector()
|
||||
ps = InfoPageSelector()
|
||||
ps._Parent = self
|
||||
ps._PosX = 2
|
||||
self._Ps = ps
|
||||
self._PsIndex = 0
|
||||
|
||||
|
||||
# "" pkgname, label
|
||||
alist = [["","Airplane","Airplane Mode"],
|
||||
["","PowerOptions","Power Options"],
|
||||
["","Wifi","Wi-Fi"],
|
||||
["","Sound","Sound Volume"],
|
||||
["","Bluetooth","Bluetooth"],
|
||||
["","Sound","Sound Volume"],
|
||||
["","Brightness","BackLight Brightness"],
|
||||
["","Storage",""],
|
||||
["","Time","Timezone"],
|
||||
["","Languages","Languages"],
|
||||
["","Notification","Notification"],
|
||||
["","Update", ""],
|
||||
["","Cores", "Retroarch cores manager"],
|
||||
["","About", "About"],
|
||||
["","PowerOFF","Power off"],
|
||||
["","ButtonsLayout","Buttons Layout"],]
|
||||
["","PowerOFF","Power OFF"],
|
||||
["","ButtonsLayout","Buttons Layout"],
|
||||
#["","LauncherGo","Switch to LauncherGo"],
|
||||
["","Lima","GPU Driver Switch"],
|
||||
["","GateWay","Network Gateway Switch"]]
|
||||
|
||||
start_x = 0
|
||||
start_y = 0
|
||||
@@ -121,30 +104,6 @@ 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:
|
||||
@@ -155,7 +114,7 @@ class ListPage(Page):
|
||||
|
||||
|
||||
def KeyDown(self,event):
|
||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
@@ -170,7 +129,7 @@ class ListPage(Page):
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
|
||||
if event.key == CurKeys["Enter"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
self.Click()
|
||||
|
||||
def Draw(self):
|
||||
@@ -4,15 +4,16 @@ import pygame
|
||||
|
||||
#UI lib
|
||||
from UI.constants import RUNSYS
|
||||
from UI.keys_def import CurKeys
|
||||
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||
from UI.confirm_page import ConfirmPage
|
||||
from UI.lang_manager import MyLangManager
|
||||
|
||||
import config
|
||||
|
||||
class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
_ConfirmText = "Confirm Power OFF?"
|
||||
|
||||
_ConfirmText = MyLangManager.Tr("Awaiting Input")
|
||||
_FootMsg = ["Nav","","Reboot","Cancel","Shutdown"]
|
||||
|
||||
def CheckBattery(self):
|
||||
try:
|
||||
@@ -41,13 +42,12 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
def KeyDown(self,event):
|
||||
|
||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
||||
|
||||
if IsKeyMenuOrB(event.key):
|
||||
self.ReturnToUpLevelPage()
|
||||
self._Screen.Draw()
|
||||
self._Screen.SwapAndShow()
|
||||
|
||||
if event.key == CurKeys["B"]:
|
||||
if IsKeyStartOrA(event.key):
|
||||
if self.CheckBattery() < 20:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
||||
else:
|
||||
@@ -59,7 +59,12 @@ class PowerOffConfirmPage(ConfirmPage):
|
||||
|
||||
cmdpath += "sudo halt -p"
|
||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||
|
||||
|
||||
if event.key == CurKeys["X"]:
|
||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
||||
cmdpath += "sleep 3;"
|
||||
cmdpath += "sudo reboot"
|
||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||
|
||||
|
||||
class APIOBJ(object):
|
||||
@@ -71,7 +76,7 @@ class APIOBJ(object):
|
||||
self._Page = PowerOffConfirmPage()
|
||||
|
||||
self._Page._Screen = main_screen
|
||||
self._Page._Name ="Power OFF"
|
||||
self._Page._Name ="SHUTDOWN"
|
||||
self._Page.Init()
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
retroarch -L /home/cpi/apps/emulators/nxengine_libretro.so /home/cpi/games/nxengine/cavestory/data
|
||||
@@ -1 +0,0 @@
|
||||
retroarch
|
||||
@@ -1 +0,0 @@
|
||||
chocolate-doom -iwad /home/cpi/games/FreeDM/freedoom1.wad
|
||||
@@ -0,0 +1,499 @@
|
||||
-- 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)
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Background images:
|
||||
Mikael Eriksson <mikael_eriksson@miffe.org>
|
||||
Licensed under CC-BY-SA-3.0
|
||||
|
After Width: | Height: | Size: 403 KiB |
|
After Width: | Height: | Size: 403 KiB |
|
After Width: | Height: | Size: 451 B |
|
After Width: | Height: | Size: 409 B |
|
After Width: | Height: | Size: 439 B |
|
After Width: | Height: | Size: 381 B |
|
After Width: | Height: | Size: 424 B |
|
After Width: | Height: | Size: 411 B |
|
After Width: | Height: | Size: 424 B |
|
After Width: | Height: | Size: 423 B |
|
After Width: | Height: | Size: 425 B |