Compare commits
489 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e15f6155cd | ||
|
|
6e005cf435 | ||
|
|
13ed96d83c | ||
|
|
83de5fc575 | ||
|
|
95a14f6dfc | ||
|
|
8aee33e672 | ||
|
|
f030dc52ff | ||
|
|
e701756207 | ||
|
|
2f263ff707 | ||
|
|
2b136fae3c | ||
|
|
8dcdc977a8 | ||
|
|
76e61b521c | ||
|
|
15424129f0 | ||
|
|
e6fefe5779 | ||
|
|
de9248f87e | ||
|
|
d55fed3a78 | ||
|
|
75b74e4c6a | ||
|
|
661250f7b1 | ||
|
|
e15cf60412 | ||
|
|
712ce14fc5 | ||
|
|
6e9d146e80 | ||
|
|
5180b74a91 | ||
|
|
18c1b186af | ||
|
|
879a734666 | ||
|
|
c4a12ce2d2 | ||
|
|
8d662e0f19 | ||
|
|
9b5e3b411b | ||
|
|
df170b71ab | ||
|
|
987587c5af | ||
|
|
b0d5517b5e | ||
|
|
ac61a305ba | ||
|
|
7ea30feba7 | ||
|
|
e9db2ac4d1 | ||
|
|
d7b75ddec5 | ||
|
|
557cd04b64 | ||
|
|
6ba59fc9c0 | ||
|
|
9062cc8e9b | ||
|
|
edbcd7d47a | ||
|
|
5be4bc20ff | ||
|
|
1219a615fa | ||
|
|
3febbf7425 | ||
|
|
c9d9ad64fe | ||
|
|
708c863a33 | ||
|
|
f9a62573de | ||
|
|
743c82fc26 | ||
|
|
58877ba643 | ||
|
|
639f4c1700 | ||
|
|
ad4a82bad5 | ||
|
|
9b1c89af4c | ||
|
|
46b67bc12f | ||
|
|
31f117d65f | ||
|
|
42fd86bce6 | ||
|
|
5db3db2ee3 | ||
|
|
128e37e06a | ||
|
|
7e6d172512 | ||
|
|
0af791192f | ||
|
|
ccb11daa44 | ||
|
|
579164ce19 | ||
|
|
66d0558dfa | ||
|
|
9c69b6a637 | ||
|
|
103838c531 | ||
|
|
b725a86b9e | ||
|
|
3371393733 | ||
|
|
85d67dc218 | ||
|
|
ebe816ba5f | ||
|
|
2bb22f3914 | ||
|
|
764aa61b7f | ||
|
|
e9ed6d7cf1 | ||
|
|
1aac399de6 | ||
|
|
ac0df61352 | ||
|
|
f605b4bf91 | ||
|
|
0b42901e26 | ||
|
|
105a5fa596 | ||
|
|
888fdbbd18 | ||
|
|
c54191505d | ||
|
|
f55cb1aa8d | ||
|
|
972219570c | ||
|
|
e0dfe211a9 | ||
|
|
4e7bebbdb2 | ||
|
|
afe616de9e | ||
|
|
c9f06d2a55 | ||
|
|
3829a2a7f9 | ||
|
|
1c6bd61575 | ||
|
|
784edd007a | ||
|
|
870e71b85b | ||
|
|
852610914d | ||
|
|
98e39edcdf | ||
|
|
818916e0fb | ||
|
|
087a10da31 | ||
|
|
03302a3f70 | ||
|
|
b26b9f7fbd | ||
|
|
7fcdf54385 | ||
|
|
ab07fadf71 | ||
|
|
9597203d8f | ||
|
|
a6accdad18 | ||
|
|
4245bb3085 | ||
|
|
a6b2c1cdb8 | ||
|
|
f4d0766edb | ||
|
|
2e472ae11c | ||
|
|
2a6899cb52 | ||
|
|
78c5bb3d76 | ||
|
|
0730d86fa4 | ||
|
|
0f1b4bd57f | ||
|
|
58e9d1430a | ||
|
|
07805d7fd5 | ||
|
|
07fc53c11d | ||
|
|
f08d0faebf | ||
|
|
3dd659860e | ||
|
|
a8b3a7084c | ||
|
|
29ca4c4ac6 | ||
|
|
1e1c8f7f4c | ||
|
|
e09d197be0 | ||
|
|
9de0f722c8 | ||
|
|
e22a3286f3 | ||
|
|
c4411fc1aa | ||
|
|
a89304b250 | ||
|
|
3557feb44c | ||
|
|
ad94fbebfd | ||
|
|
2ca466257b | ||
|
|
86fa05e619 | ||
|
|
3826d3cfe2 | ||
|
|
63a30be0f6 | ||
|
|
8113002aa7 | ||
|
|
8f2fe08400 | ||
|
|
48bb893a5c | ||
|
|
41729a4b2a | ||
|
|
954f158f73 | ||
|
|
be3f53850b | ||
|
|
04120e0841 | ||
|
|
467a5623f6 | ||
|
|
546523359b | ||
|
|
9b63fc4c8f | ||
|
|
b6fb439ae1 | ||
|
|
e94897c5ec | ||
|
|
9c9896b06e | ||
|
|
d4a6c417bb | ||
|
|
75300a6e7b | ||
|
|
4f354f28c2 | ||
|
|
80c732b261 | ||
|
|
528e79648b | ||
|
|
eb0f43fd07 | ||
|
|
7d9146c6cf | ||
|
|
2c75adb1ae | ||
|
|
4e9d7a42f0 | ||
|
|
b520e83dd6 | ||
|
|
273db99c78 | ||
|
|
638f23a8b8 | ||
|
|
3673da1bf4 | ||
|
|
badeb13268 | ||
|
|
0f2cf846eb | ||
|
|
8c0c6ac86a | ||
|
|
0b733435f6 | ||
|
|
24abd55f86 | ||
|
|
03e0385cda | ||
|
|
d17a89e80c | ||
|
|
fb0c45229c | ||
|
|
457adc1b21 | ||
|
|
8e943d2751 | ||
|
|
dd6aa87ee6 | ||
|
|
1c7ca69a8f | ||
|
|
70a4c48c67 | ||
|
|
aad54336e8 | ||
|
|
fb8937fe0f | ||
|
|
ef0d5a6b52 | ||
|
|
5ef12f8081 | ||
|
|
a9a179fe47 | ||
|
|
2b1952c59d | ||
|
|
68d3ec052c | ||
|
|
9a3161eb05 | ||
|
|
380c972b13 | ||
|
|
77707a8118 | ||
|
|
16f521b8da | ||
|
|
b435507935 | ||
|
|
8468102ee5 | ||
|
|
7da6542a1e | ||
|
|
3ad1c48fce | ||
|
|
dd92daa60f | ||
|
|
7a592353b0 | ||
|
|
055ee12867 | ||
|
|
4d67c053ff | ||
|
|
29cbe9297a | ||
|
|
c559728454 | ||
|
|
acb6774495 | ||
|
|
baae2545f1 | ||
|
|
5aa744cb6b | ||
|
|
d75fcc6f1c | ||
|
|
58fd2e6a1a | ||
|
|
bac3f7899d | ||
|
|
0302741ac2 | ||
|
|
16b226dbc3 | ||
|
|
8c77f3ffc5 | ||
|
|
da29679180 | ||
|
|
e73c9138ea | ||
|
|
9ce60ff62f | ||
|
|
fe44274594 | ||
|
|
1b1cbbca28 | ||
|
|
858540bb7d | ||
|
|
8018bbfe1f | ||
|
|
24d711e538 | ||
|
|
a9220fc66e | ||
|
|
ed8699d6d4 | ||
|
|
e3624948d0 | ||
|
|
ce72585632 | ||
|
|
75975dea37 | ||
|
|
1b48ca875b | ||
|
|
1590ea44b8 | ||
|
|
d360b72007 | ||
|
|
67148d102b | ||
|
|
c9221e5a2a | ||
|
|
d6a5294afb | ||
|
|
1753a687e4 | ||
|
|
8ee95d9648 | ||
|
|
29e52bbaea | ||
|
|
0dc85f2407 | ||
|
|
fb156214f9 | ||
|
|
1b783d3ce2 | ||
|
|
201f2fb89c | ||
|
|
cb9562ebbd | ||
|
|
bd88c1730e | ||
|
|
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 |
27
.cpirc
Normal file
@ -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
|
||||||
15
.gitignore
vendored
@ -5,6 +5,21 @@ retroarch-core-options.cfg
|
|||||||
*.pyc
|
*.pyc
|
||||||
sys.py/.powerlevel
|
sys.py/.powerlevel
|
||||||
sys.py/.buttonslayout
|
sys.py/.buttonslayout
|
||||||
|
sys.py/.lang
|
||||||
*.cfg
|
*.cfg
|
||||||
**/Jobs/*
|
**/Jobs/*
|
||||||
!**/Jobs/.gitkeep
|
!**/Jobs/.gitkeep
|
||||||
|
!**/Jobs/00_lowpower.sh
|
||||||
|
!**/Jobs/00_lowpower.alias
|
||||||
|
.done
|
||||||
|
bios
|
||||||
|
bios/*
|
||||||
|
screenshots
|
||||||
|
screenshots/*
|
||||||
|
.pcsx
|
||||||
|
.pcsx/*
|
||||||
|
*.log
|
||||||
|
.DS_Store
|
||||||
|
sys.py/.*
|
||||||
|
sys.py/*.db
|
||||||
|
launcher.sublime-workspace
|
||||||
|
|||||||
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "sys.py/pyaria2_rpc"]
|
||||||
|
path = sys.py/pyaria2_rpc
|
||||||
|
url = https://github.com/cuu/pyaria2_rpc.git
|
||||||
38
.twm/Bach
Normal file
@ -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};
|
||||||
62
.twm/Escher
Normal file
@ -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};
|
||||||
46
.twm/Linux64
Normal file
@ -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};
|
||||||
14
.twm/am
Normal file
@ -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};
|
||||||
52
.twm/amule
Normal file
@ -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 };
|
||||||
5
.twm/close
Normal file
@ -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};
|
||||||
14
.twm/ff
Normal file
@ -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};
|
||||||
5
.twm/fullsize
Normal file
@ -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};
|
||||||
5
.twm/iconify
Normal file
@ -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};
|
||||||
28
.twm/moose
Normal file
@ -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};
|
||||||
14
.twm/mozilla
Normal file
@ -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};
|
||||||
5
.twm/resize
Normal file
@ -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};
|
||||||
27
.twm/torrent
Normal file
@ -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 };
|
||||||
14
.twm/tv
Normal file
@ -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 };
|
||||||
14
.twm/xlogo32
Normal file
@ -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};
|
||||||
140
.twmrc
Normal file
@ -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"
|
||||||
|
|
||||||
25
.xinitrc
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
session=${1:-gameshell}
|
||||||
|
|
||||||
|
case $session in
|
||||||
|
hdmi )
|
||||||
|
exec aria2c --conf-path=/home/cpi/launcher/aria2.conf &
|
||||||
|
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/desktopbg.jpg
|
||||||
|
cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
|
||||||
|
exec ~/launcher/load.sh &
|
||||||
|
exec ~/launcher/sys.py/gsnotify/gsnotify-arm daemon &
|
||||||
|
#exec /usr/bin/twm -f ~/launcher/.twmrc
|
||||||
|
exec ~/launcher/dwm-mod
|
||||||
|
;;
|
||||||
|
gameshell )
|
||||||
|
exec aria2c --conf-path=/home/cpi/launcher/aria2.conf &
|
||||||
|
feh --bg-center ~/launcher/sys.py/gameshell/wallpaper/loading.png
|
||||||
|
cd ~/launcher/sys.py/ ; python appinstaller.py > /tmp/appinstaller.log & cd ~/
|
||||||
|
exec ~/launcher/load.sh &
|
||||||
|
exec ~/launcher/sys.py/gsnotify/gsnotify-arm &
|
||||||
|
#exec awesome -c ~/launcher/awesome/rc.lua
|
||||||
|
exec ~/launcher/dwm-mod -w
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exec $1;;
|
||||||
|
esac
|
||||||
|
|
||||||
7
.xorg.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Section "Device"
|
||||||
|
Identifier "Allwinner A10/A13 FBDEV"
|
||||||
|
Driver "fbturbo"
|
||||||
|
Option "fbdev" "/dev/fb0"
|
||||||
|
|
||||||
|
Option "SwapbuffersWait" "true"
|
||||||
|
EndSection
|
||||||
7
.xorg_lima.conf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Section "Device"
|
||||||
|
Identifier "Allwinner A10/A13 FBDEV"
|
||||||
|
Driver "modesetting"
|
||||||
|
Option "fbdev" "/dev/fb0"
|
||||||
|
|
||||||
|
Option "SwapbuffersWait" "true"
|
||||||
|
EndSection
|
||||||
8
LICENSE
@ -1,7 +1,7 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
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
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
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.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
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.
|
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,
|
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.
|
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
|
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
|
The GNU General Public License does not permit incorporating your program
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
may consider it more useful to permit linking proprietary applications with
|
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
|
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
|
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>.
|
||||||
|
|||||||
@ -12,15 +12,16 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
from UI.util_funcs import midRect,FileExists
|
||||||
from UI.util_funcs import midRect
|
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||||
from UI.keys_def import CurKeys
|
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.icon_pool import MyIconPool
|
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.multilabel import MultiLabel
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
|
from config import VERSION
|
||||||
|
|
||||||
class InfoPageListItem(object):
|
class InfoPageListItem(object):
|
||||||
_PosX = 0
|
_PosX = 0
|
||||||
@ -79,7 +80,7 @@ class InfoPageListItem(object):
|
|||||||
class AboutPage(Page):
|
class AboutPage(Page):
|
||||||
_FootMsg = ["Nav.","","","Back",""]
|
_FootMsg = ["Nav.","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela13"]
|
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -207,7 +208,32 @@ class AboutPage(Page):
|
|||||||
memory["value"] = str( int(parts[1].strip())/1000.0) +" MB"
|
memory["value"] = str( int(parts[1].strip())/1000.0) +" MB"
|
||||||
self._AList["memory"] = memory
|
self._AList["memory"] = memory
|
||||||
break
|
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):
|
def GenList(self):
|
||||||
|
|
||||||
self._MyList = []
|
self._MyList = []
|
||||||
@ -216,7 +242,7 @@ class AboutPage(Page):
|
|||||||
start_y = 10
|
start_y = 10
|
||||||
last_height = 0
|
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"] ):
|
#for i,u in enumerate( ["processor","cpucores","cpumhz","flags","memory","uname"] ):
|
||||||
if u not in self._AList:
|
if u not in self._AList:
|
||||||
continue
|
continue
|
||||||
@ -229,7 +255,7 @@ class AboutPage(Page):
|
|||||||
li._PosY = start_y + last_height
|
li._PosY = start_y + last_height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||||
|
|
||||||
if self._AList[u]["label"] != "":
|
if self._AList[u]["label"] != "":
|
||||||
li.Init( self._AList[u]["label"] )
|
li.Init( self._AList[u]["label"] )
|
||||||
@ -248,14 +274,14 @@ class AboutPage(Page):
|
|||||||
if self._Screen != None:
|
if self._Screen != None:
|
||||||
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
self._HWND = self._Screen._CanvasHWND
|
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._PosX = self._Index*self._Screen._Width
|
||||||
self._Width = self._Screen._Width ## equal to screen width
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = MultiIconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
@ -267,6 +293,9 @@ class AboutPage(Page):
|
|||||||
self.CpuMhz()
|
self.CpuMhz()
|
||||||
self.Uname()
|
self.Uname()
|
||||||
|
|
||||||
|
self.LauncherVersion()
|
||||||
|
self.OsImageVersion()
|
||||||
|
|
||||||
self.GenList()
|
self.GenList()
|
||||||
|
|
||||||
self._Scroller = ListScroller()
|
self._Scroller = ListScroller()
|
||||||
@ -278,7 +307,7 @@ class AboutPage(Page):
|
|||||||
|
|
||||||
def ScrollDown(self):
|
def ScrollDown(self):
|
||||||
dis = 10
|
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._PosY -= dis
|
||||||
self._Scrolled -= dis
|
self._Scrolled -= dis
|
||||||
|
|
||||||
@ -300,7 +329,7 @@ class AboutPage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
@ -321,16 +350,19 @@ class AboutPage(Page):
|
|||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
#self._Ps.Draw()
|
#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:
|
for i in self._MyList:
|
||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
self._DrawOnce = True
|
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:
|
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 ) )
|
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.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
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.scroller import ListScroller
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
from UI.multilabel import MultiLabel
|
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):
|
class AirplanePage(Page):
|
||||||
_FootMsg = ["Nav.","","","Back","Toggle"]
|
_FootMsg = ["Nav","","Rescue","Back","Toggle"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela13"]
|
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -119,21 +65,21 @@ class AirplanePage(Page):
|
|||||||
|
|
||||||
|
|
||||||
airwire = IconItem()
|
airwire = IconItem()
|
||||||
airwire._ImgSurf = MyIconPool._Icons["airwire"]
|
airwire._ImgSurf = MyIconPool.GiveIconSurface("airwire")
|
||||||
airwire._MyType = ICON_TYPES["STAT"]
|
airwire._MyType = ICON_TYPES["STAT"]
|
||||||
airwire._Parent = self
|
airwire._Parent = self
|
||||||
airwire.Adjust(0,0,5,43,0)
|
airwire.Adjust(0,0,5,43,0)
|
||||||
self._Icons["airwire"] = airwire
|
self._Icons["airwire"] = airwire
|
||||||
|
|
||||||
GS = IconItem()
|
GS = IconItem()
|
||||||
GS._ImgSurf = MyIconPool._Icons["GS"]
|
GS._ImgSurf = MyIconPool.GiveIconSurface("GS")
|
||||||
GS._MyType = ICON_TYPES["STAT"]
|
GS._MyType = ICON_TYPES["STAT"]
|
||||||
GS._Parent = self
|
GS._Parent = self
|
||||||
GS.Adjust(0,0,72,95,0)
|
GS.Adjust(0,0,72,95,0)
|
||||||
self._Icons["GS"] = GS
|
self._Icons["GS"] = GS
|
||||||
|
|
||||||
DialogBoxs = MultiIconItem()
|
DialogBoxs = MultiIconItem()
|
||||||
DialogBoxs._ImgSurf = MyIconPool._Icons["DialogBoxs"]
|
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("DialogBoxs")
|
||||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||||
DialogBoxs._Parent = self
|
DialogBoxs._Parent = self
|
||||||
DialogBoxs._IconWidth = 134
|
DialogBoxs._IconWidth = 134
|
||||||
@ -144,7 +90,7 @@ class AirplanePage(Page):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
bgpng = MultiIconItem()
|
bgpng = MultiIconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["about_bg"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("about_bg")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
@ -161,6 +107,8 @@ class AirplanePage(Page):
|
|||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
self._Scroller.SetCanvasHWND(self._HWND)
|
self._Scroller.SetCanvasHWND(self._HWND)
|
||||||
|
|
||||||
|
self.OnLoadCb()
|
||||||
|
|
||||||
def ScrollDown(self):
|
def ScrollDown(self):
|
||||||
dis = 10
|
dis = 10
|
||||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 0:
|
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 0:
|
||||||
@ -175,7 +123,7 @@ class AirplanePage(Page):
|
|||||||
|
|
||||||
def ToggleModeAni(self): ## with animation
|
def ToggleModeAni(self): ## with animation
|
||||||
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
|
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)
|
data = self.EasingData(0,43)
|
||||||
for _,v in enumerate(data):
|
for _,v in enumerate(data):
|
||||||
self._airwire_y -= v
|
self._airwire_y -= v
|
||||||
@ -205,25 +153,31 @@ class AirplanePage(Page):
|
|||||||
def ToggleMode(self):
|
def ToggleMode(self):
|
||||||
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
|
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
|
||||||
print out
|
print out
|
||||||
if out[1] == "yes":
|
if "yes" in out[1]:
|
||||||
self._Screen._MsgBox.SetText("Turning On")
|
self._Screen._MsgBox.SetText("TurningOn")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
commands.getstatusoutput("sudo rfkill unblock all")
|
commands.getstatusoutput("sudo rfkill unblock all")
|
||||||
self._Screen._TitleBar._InAirPlaneMode = False
|
self._Screen._TitleBar._InAirPlaneMode = False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self._Screen._MsgBox.SetText("Turning Off")
|
self._Screen._MsgBox.SetText("TurningOff")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
commands.getstatusoutput("sudo rfkill block all")
|
commands.getstatusoutput("sudo rfkill block all")
|
||||||
self._Screen._TitleBar._InAirPlaneMode = True
|
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):
|
def OnLoadCb(self):
|
||||||
self._Scrolled = 0
|
self._Scrolled = 0
|
||||||
self._PosY = 0
|
self._PosY = 0
|
||||||
self._DrawOnce = False
|
self._DrawOnce = False
|
||||||
out = commands.getstatusoutput('sudo rfkill list | grep yes | cut -d " " -f3')
|
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._Screen._TitleBar._InAirPlaneMode = True
|
||||||
self._airwire_y = 50+43
|
self._airwire_y = 50+43
|
||||||
self._dialog_index = 1
|
self._dialog_index = 1
|
||||||
@ -239,12 +193,12 @@ class AirplanePage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.ToggleModeAni()
|
self.ToggleModeAni()
|
||||||
"""
|
"""
|
||||||
self.ToggleMode()
|
self.ToggleMode()
|
||||||
@ -265,7 +219,15 @@ class AirplanePage(Page):
|
|||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
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):
|
def Draw(self):
|
||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
|
|
||||||
|
|||||||
813
Menu/GameShell/10_Settings/Bluetooth/__init__.py
Normal file
@ -0,0 +1,813 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
import pygame
|
||||||
|
#import math
|
||||||
|
import commands
|
||||||
|
import dbus
|
||||||
|
from beeprint import pp
|
||||||
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
|
from libs.DBUS import bus, adapter,devices
|
||||||
|
|
||||||
|
#import gobject
|
||||||
|
#from wicd import misc
|
||||||
|
## local UI import
|
||||||
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
|
from UI.page import Page,PageSelector
|
||||||
|
from UI.label import Label
|
||||||
|
from UI.util_funcs import midRect
|
||||||
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
|
from UI.scroller import ListScroller
|
||||||
|
from UI.icon_pool import MyIconPool
|
||||||
|
from UI.icon_item import IconItem
|
||||||
|
from UI.multi_icon_item import MultiIconItem
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.confirm_page import ConfirmPage
|
||||||
|
from UI.info_page_list_item import InfoPageListItem
|
||||||
|
|
||||||
|
from UI.multilabel import MultiLabel
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.keyboard import Keyboard
|
||||||
|
|
||||||
|
from net_item import NetItem
|
||||||
|
|
||||||
|
from agent import BleAgent,BleAgentPairPage
|
||||||
|
|
||||||
|
class BleForgetConfirmPage(ConfirmPage):
|
||||||
|
|
||||||
|
_ConfirmText = MyLangManager.Tr("ConfirmForgetQ")
|
||||||
|
|
||||||
|
def KeyDown(self,event):
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self.SnapMsg(MyLangManager.Tr("Deleting"))
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
try:
|
||||||
|
#self._Parent._Adapter.RemoveDevice()
|
||||||
|
print("try to RemoveDevice")
|
||||||
|
except Exception,e:
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
pygame.time.delay(400)
|
||||||
|
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
#self.ClearCanvas()
|
||||||
|
self.DrawBG()
|
||||||
|
for i in self._MyList:
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
self.Reset()
|
||||||
|
|
||||||
|
|
||||||
|
class BleInfoPageSelector(PageSelector):
|
||||||
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._PosX = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._Height = 0
|
||||||
|
|
||||||
|
def AnimateDraw(self,x2,y2):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
idx = self._Parent._PsIndex
|
||||||
|
if idx < len( self._Parent._MyList):
|
||||||
|
x = self._PosX+2
|
||||||
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
|
self._PosX = x
|
||||||
|
self._PosY = y
|
||||||
|
self._Height = h
|
||||||
|
|
||||||
|
aa_round_rect(self._Parent._CanvasHWND,
|
||||||
|
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||||
|
|
||||||
|
class BleInfoPage(Page):
|
||||||
|
_FootMsg = ["Nav","Forget","Disconnect","Back",""]
|
||||||
|
_MyList = []
|
||||||
|
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||||
|
_ListSmFontObj = MySkinManager.GiveFont("varela12") # small font
|
||||||
|
_ListSm2FontObj= MySkinManager.GiveFont("varela11")
|
||||||
|
|
||||||
|
_AList = {}
|
||||||
|
_Path = ""
|
||||||
|
def Init(self):
|
||||||
|
if self._Screen != None:
|
||||||
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
|
self._CanvasHWND = self._Screen._CanvasHWND
|
||||||
|
|
||||||
|
self._PosX = self._Index*self._Screen._Width
|
||||||
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
|
ps = BleInfoPageSelector()
|
||||||
|
ps._Parent = self
|
||||||
|
self._Ps = ps
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
#_AList is an object
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
self._Scroller = ListScroller()
|
||||||
|
self._Scroller._Parent = self
|
||||||
|
self._Scroller._PosX = 2
|
||||||
|
self._Scroller._PosY = 2
|
||||||
|
self._Scroller.Init()
|
||||||
|
|
||||||
|
self._ConfirmPage1 = BleForgetConfirmPage()
|
||||||
|
self._ConfirmPage1._Screen = self._Screen
|
||||||
|
self._ConfirmPage1._Name = "ConfirmForget"
|
||||||
|
self._ConfirmPage1._Parent = self
|
||||||
|
self._ConfirmPage1.Init()
|
||||||
|
|
||||||
|
def GenList(self):
|
||||||
|
if self._AList== None:
|
||||||
|
return
|
||||||
|
self._MyList = []
|
||||||
|
self._PsIndex = 0
|
||||||
|
start_x = 0
|
||||||
|
start_y = 0
|
||||||
|
|
||||||
|
for i,v in enumerate( self._AList):
|
||||||
|
#print(i,v) # (0, dbus.String(u'AddressType'))
|
||||||
|
|
||||||
|
li = InfoPageListItem()
|
||||||
|
li._Parent = self
|
||||||
|
li._PosX = start_x
|
||||||
|
li._PosY = start_y + i*InfoPageListItem._Height
|
||||||
|
li._Width = Width
|
||||||
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
|
|
||||||
|
if v == "UUIDs":
|
||||||
|
li._Fonts["small"] = self._ListSm2FontObj
|
||||||
|
else:
|
||||||
|
li._Fonts["small"] = self._ListSmFontObj
|
||||||
|
|
||||||
|
li.Init( str(v) )
|
||||||
|
li._Flag = v
|
||||||
|
|
||||||
|
if v =="UUIDs":
|
||||||
|
if len(self._AList[v]) > 1:
|
||||||
|
pp(self._AList[v][0])
|
||||||
|
sm_text = str(self._AList[v][0])
|
||||||
|
else:
|
||||||
|
sm_text = "<empty>"
|
||||||
|
else:
|
||||||
|
sm_text = str(self._AList[v])
|
||||||
|
|
||||||
|
if sm_text == "0":
|
||||||
|
sm_text="No"
|
||||||
|
elif sm_text == "1":
|
||||||
|
sm_text="Yes"
|
||||||
|
|
||||||
|
sm_text = sm_text[:20]
|
||||||
|
li.SetSmallText(sm_text)
|
||||||
|
|
||||||
|
li._PosX = 2
|
||||||
|
self._MyList.append(li)
|
||||||
|
|
||||||
|
def TryToForget(self):
|
||||||
|
global adapter
|
||||||
|
proxy_obj = bus.get_object("org.bluez", self._Path)
|
||||||
|
dev = dbus.Interface(proxy_obj, "org.bluez.Device1")
|
||||||
|
|
||||||
|
self._Screen._MsgBox.SetText("Forgeting")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
try:
|
||||||
|
adapter.RemoveDevice(dev)
|
||||||
|
except Exception,e:
|
||||||
|
err_name = e.get_dbus_name()
|
||||||
|
if err_name == "org.freedesktop.DBus.Error.NoReply":
|
||||||
|
self._Screen._MsgBox.SetText("DBus noreply")
|
||||||
|
else:
|
||||||
|
self._Screen._MsgBox.SetText("Forget failed")
|
||||||
|
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
pygame.time.delay(500)
|
||||||
|
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def TryToDisconnect(self):
|
||||||
|
global bus
|
||||||
|
|
||||||
|
if "Connected" in self._AList:
|
||||||
|
if self._AList["Connected"] == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
proxy_obj = bus.get_object("org.bluez", self._Path)
|
||||||
|
dev = dbus.Interface(proxy_obj, "org.bluez.Device1")
|
||||||
|
|
||||||
|
self._Screen._FootBar.UpdateNavText("Disconnecting")
|
||||||
|
self._Screen._MsgBox.SetText("Disconnecting")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
try:
|
||||||
|
dev.Disconnect()
|
||||||
|
except Exception,e:
|
||||||
|
err_name = e.get_dbus_name()
|
||||||
|
if err_name == "org.freedesktop.DBus.Error.NoReply":
|
||||||
|
self._Screen._MsgBox.SetText("DBus noreply")
|
||||||
|
else:
|
||||||
|
self._Screen._MsgBox.SetText("Disconnect failed")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
pygame.time.delay(500)
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
self._Screen._FootBar.ResetNavText()
|
||||||
|
|
||||||
|
|
||||||
|
def Click(self):
|
||||||
|
if self._PsIndex >= len(self._MyList):
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
print(cur_li._Flag)
|
||||||
|
if cur_li._Flag in self._AList:
|
||||||
|
print(self._AList[ cur_li._Flag ])
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
if self._AList != None:
|
||||||
|
if "Connected" in self._AList:
|
||||||
|
if self._AList["Connected"] == 1:
|
||||||
|
self._FootMsg[1] = "Disconnect"
|
||||||
|
else:
|
||||||
|
self._FootMsg[1] = ""
|
||||||
|
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def KeyDown(self,event):
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self.Click()
|
||||||
|
|
||||||
|
if event.key == CurKeys["X"]:
|
||||||
|
self.TryToDisconnect()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Y"]:
|
||||||
|
self.TryToForget()
|
||||||
|
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.ClearCanvas()
|
||||||
|
|
||||||
|
if len(self._MyList) * InfoPageListItem._Height > self._Height:
|
||||||
|
self._Ps._Width = self._Width - 10
|
||||||
|
self._Ps._PosX = 9
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
self._Scroller.UpdateSize(len(self._MyList)*InfoPageListItem._Height, self._PsIndex*InfoPageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._Ps._Width = self._Width
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class BleListSelector(PageSelector):
|
||||||
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._PosX = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._Height = 0
|
||||||
|
|
||||||
|
def AnimateDraw(self,x2,y2):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
idx = self._Parent._PsIndex
|
||||||
|
if idx < len( self._Parent._MyList):
|
||||||
|
x = self._Parent._MyList[idx]._PosX+2
|
||||||
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
|
self._PosX = x
|
||||||
|
self._PosY = y
|
||||||
|
self._Height = h
|
||||||
|
|
||||||
|
aa_round_rect(self._Parent._CanvasHWND,
|
||||||
|
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||||
|
|
||||||
|
class BleListMessageBox(Label):
|
||||||
|
_Parent = None
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
my_text = self._FontObj.render( self._Text,True,self._Color)
|
||||||
|
w = my_text.get_width()
|
||||||
|
h = my_text.get_height()
|
||||||
|
x = (self._Parent._Width - w)/2
|
||||||
|
y = (self._Parent._Height - h)/2
|
||||||
|
padding = 10
|
||||||
|
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(x-padding,y-padding, w+padding*2,h+padding*2))
|
||||||
|
|
||||||
|
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Black'),(x-padding,y-padding, w+padding*2,h+padding*2),1)
|
||||||
|
|
||||||
|
self._CanvasHWND.blit(my_text,(x,y,w,h))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class BluetoothPage(Page):
|
||||||
|
_MyList = []
|
||||||
|
#Wicd dbus part
|
||||||
|
_Adapter = None
|
||||||
|
_Dbus = None
|
||||||
|
_Devices = None
|
||||||
|
|
||||||
|
_BlePassword = ""
|
||||||
|
_Connecting = False
|
||||||
|
_Scanning = False
|
||||||
|
|
||||||
|
_PrevState = None
|
||||||
|
_Selector = None
|
||||||
|
|
||||||
|
_ShowingMessageBox = False
|
||||||
|
_MsgBox = None
|
||||||
|
_ConnectTry = 0
|
||||||
|
_BlockCb = None
|
||||||
|
|
||||||
|
_LastStatusMsg = ""
|
||||||
|
_FootMsg = ["Nav","Info","Scan","Back","TryConnect"]
|
||||||
|
_Scroller = None
|
||||||
|
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
|
_InfoPage = None
|
||||||
|
|
||||||
|
_ADAPTER_DEV = "hci0"
|
||||||
|
|
||||||
|
_Offline = False
|
||||||
|
|
||||||
|
_Leader = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Page.__init__(self)
|
||||||
|
self._MyList = []
|
||||||
|
self._CanvasHWND = None
|
||||||
|
|
||||||
|
def ShowBox(self,msg):
|
||||||
|
|
||||||
|
self._MsgBox._Text = msg
|
||||||
|
self._ShowingMessageBox = True
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def HideBox(self):
|
||||||
|
self.Draw()
|
||||||
|
self._ShowingMessageBox = False
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def Init(self):
|
||||||
|
|
||||||
|
self._PosX = self._Index * self._Screen._Width
|
||||||
|
self._Width = self._Screen._Width
|
||||||
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
|
#self._CanvasHWND = pygame.Surface((self._Width,self._Height))
|
||||||
|
self._CanvasHWND = self._Screen._CanvasHWND
|
||||||
|
|
||||||
|
ps = BleListSelector()
|
||||||
|
ps._Parent = self
|
||||||
|
ps._Width = Width - 12
|
||||||
|
|
||||||
|
self._Ps = ps
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
msgbox = BleListMessageBox()
|
||||||
|
msgbox._CanvasHWND = self._CanvasHWND
|
||||||
|
msgbox.Init(" ",MyLangManager.TrFont("veramono12"))
|
||||||
|
msgbox._Parent = self
|
||||||
|
|
||||||
|
self._MsgBox = msgbox
|
||||||
|
|
||||||
|
self._Scroller = ListScroller()
|
||||||
|
self._Scroller._Parent = self
|
||||||
|
self._Scroller._PosX = 2
|
||||||
|
self._Scroller._PosY = 2
|
||||||
|
self._Scroller.Init()
|
||||||
|
|
||||||
|
self.GenNetworkList()
|
||||||
|
|
||||||
|
self._InfoPage = BleInfoPage()
|
||||||
|
self._InfoPage._Screen = self._Screen
|
||||||
|
self._InfoPage._Name = "BluetoothInfo"
|
||||||
|
self._InfoPage.Init()
|
||||||
|
|
||||||
|
def print_normal(self,address, properties):
|
||||||
|
print("[ " + address + " ]")
|
||||||
|
|
||||||
|
for key in properties.keys():
|
||||||
|
value = properties[key]
|
||||||
|
if type(value) is dbus.String:
|
||||||
|
value = unicode(value).encode('ascii', 'replace')
|
||||||
|
if (key == "Class"):
|
||||||
|
print(" %s = 0x%06x" % (key, value))
|
||||||
|
else:
|
||||||
|
print(" %s = %s" % (key, value))
|
||||||
|
|
||||||
|
print()
|
||||||
|
|
||||||
|
properties["Logged"] = True
|
||||||
|
|
||||||
|
def skip_dev(self,old_dev, new_dev):
|
||||||
|
if not "Logged" in old_dev:
|
||||||
|
return False
|
||||||
|
if "Name" in old_dev:
|
||||||
|
return True
|
||||||
|
if not "Name" in new_dev:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def DbusPropertiesChanged(self, interface, changed, invalidated, path):
|
||||||
|
global devices
|
||||||
|
print("DbusPropertiesChanged")
|
||||||
|
if interface != "org.bluez.Device1":
|
||||||
|
return
|
||||||
|
|
||||||
|
if path in devices:
|
||||||
|
dev = devices[path]
|
||||||
|
|
||||||
|
if self.skip_dev(dev, changed):
|
||||||
|
return
|
||||||
|
devices[path] = dict(devices[path].items() + changed.items())
|
||||||
|
else:
|
||||||
|
devices[path] = changed
|
||||||
|
|
||||||
|
if "Address" in devices[path]:
|
||||||
|
address = devices[path]["Address"]
|
||||||
|
else:
|
||||||
|
address = "<unknown>"
|
||||||
|
|
||||||
|
self._Devices = devices
|
||||||
|
self.print_normal(address, devices[path])
|
||||||
|
|
||||||
|
self.RefreshDevices()
|
||||||
|
self.GenNetworkList()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def ShutDownConnecting(self):
|
||||||
|
print("Bluetooth Shutdown connecting...")
|
||||||
|
|
||||||
|
def AbortedAndReturnToUpLevel(self):
|
||||||
|
self.HideBox()
|
||||||
|
self._Screen._FootBar.ResetNavText()
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
|
def CheckIfBluetoothConnecting(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def TryConnect(self):
|
||||||
|
global bus
|
||||||
|
|
||||||
|
if self._PsIndex >= len(self._MyList):
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
print(cur_li._Path)
|
||||||
|
|
||||||
|
if "Connected" in cur_li._Atts:
|
||||||
|
if cur_li._Atts["Connected"] == 1:
|
||||||
|
return
|
||||||
|
|
||||||
|
proxy_obj = bus.get_object("org.bluez", cur_li._Path)
|
||||||
|
dev = dbus.Interface(proxy_obj, "org.bluez.Device1")
|
||||||
|
|
||||||
|
self._Screen._FootBar.UpdateNavText("Connecting")
|
||||||
|
self.ShowBox(MyLangManager.Tr("Connecting"))
|
||||||
|
|
||||||
|
self._Leader._MyAgent.device_obj = dev
|
||||||
|
self._Leader._MyAgent.dev_path = cur_li._Path
|
||||||
|
|
||||||
|
try:
|
||||||
|
dev.Pair(reply_handler=self._Leader._MyAgent.pair_reply,
|
||||||
|
error_handler=self._Leader._MyAgent.pair_error,timeout=60000)
|
||||||
|
except Exception,e:
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
|
||||||
|
#self.HideBox()
|
||||||
|
#self._Screen._FootBar.ResetNavText()
|
||||||
|
|
||||||
|
def RefreshDevices(self):
|
||||||
|
global devices
|
||||||
|
devices = {}
|
||||||
|
try:
|
||||||
|
proxy_obj = bus.get_object("org.bluez", "/")
|
||||||
|
manager = dbus.Interface(proxy_obj,"org.freedesktop.DBus.ObjectManager")
|
||||||
|
objects = manager.GetManagedObjects()
|
||||||
|
for path, interfaces in objects.iteritems():
|
||||||
|
if "org.bluez.Device1" in interfaces:
|
||||||
|
devices[path] = interfaces["org.bluez.Device1"] ## like /org/bluez/hci0/dev_xx_xx_xx_yy_yy_yy
|
||||||
|
except Exception,e:
|
||||||
|
print(str(e))
|
||||||
|
devices={}
|
||||||
|
|
||||||
|
self._Devices = devices
|
||||||
|
|
||||||
|
|
||||||
|
def GenNetworkList(self):
|
||||||
|
self._MyList = []
|
||||||
|
start_x = 0
|
||||||
|
start_y = 0
|
||||||
|
|
||||||
|
counter = 0
|
||||||
|
for i,v in enumerate(self._Devices):
|
||||||
|
if "Name" in self._Devices[v]:
|
||||||
|
if len(self._Devices[v]["Name"]) < 2:
|
||||||
|
continue
|
||||||
|
if re.match("[0-9a-f]{2}([-:]?)[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", self._Devices[v]["Name"].lower()): ## skip xx:xx:xx:xx:xx
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
|
||||||
|
ni = NetItem()
|
||||||
|
ni._Parent = self
|
||||||
|
ni._PosX = start_x
|
||||||
|
ni._PosY = start_y + counter* NetItem._Height
|
||||||
|
ni._Width = Width
|
||||||
|
ni._FontObj = self._ListFontObj
|
||||||
|
|
||||||
|
ni.Init(v,self._Devices[v])
|
||||||
|
|
||||||
|
counter += 1
|
||||||
|
self._MyList.append(ni)
|
||||||
|
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
def Rescan(self):
|
||||||
|
if self._Screen._CurrentPage != self:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._Scanning = True
|
||||||
|
self.ShowBox(MyLangManager.Tr("BluetoothScanning"))
|
||||||
|
self._Screen._FootBar.UpdateNavText("Scanning")
|
||||||
|
|
||||||
|
proxy_obj = self._Dbus.get_object("org.bluez", "/org/bluez/" + self._ADAPTER_DEV)
|
||||||
|
adapter_props = dbus.Interface(proxy_obj,"org.freedesktop.DBus.Properties")
|
||||||
|
discoverying = adapter_props.Get("org.bluez.Adapter1", "Discovering")
|
||||||
|
print("discoverying", discoverying)
|
||||||
|
|
||||||
|
|
||||||
|
if self._Adapter!= None:
|
||||||
|
try:
|
||||||
|
self._Adapter.StopDiscovery()
|
||||||
|
except Exception,e:
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
try:
|
||||||
|
self._Adapter.StartDiscovery()
|
||||||
|
except Exception,e:
|
||||||
|
err_name = e.get_dbus_name()
|
||||||
|
if err_name == "org.freedesktop.DBus.Error.NoReply":
|
||||||
|
print("start discovery timeout")
|
||||||
|
else:
|
||||||
|
print("start discovery unknown err: ", str(e))
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
self.RefreshDevices()
|
||||||
|
self.GenNetworkList()
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
self._Offline = False
|
||||||
|
if self._Screen._TitleBar._InAirPlaneMode == False:
|
||||||
|
out = commands.getstatusoutput("hcitool dev | grep hci0 |cut -f3") ## bluetooth maybe dead after airplane mode
|
||||||
|
if len(out[1]) < 17:
|
||||||
|
self._Offline = True
|
||||||
|
print("Bluetooth OnLoadCb ,can not find hci0 alive,try to reboot")
|
||||||
|
else:
|
||||||
|
self.RefreshDevices()
|
||||||
|
self.GenNetworkList()
|
||||||
|
else:
|
||||||
|
self._Offline = True
|
||||||
|
|
||||||
|
def KeyDown(self,event):
|
||||||
|
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
if self._Offline == True:
|
||||||
|
self.AbortedAndReturnToUpLevel()
|
||||||
|
return
|
||||||
|
|
||||||
|
if self._Adapter != None:
|
||||||
|
try:
|
||||||
|
self._Adapter.StopDiscovery()
|
||||||
|
except Exception,e:
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
_connecting = self.CheckIfBluetoothConnecting()
|
||||||
|
if _connecting:
|
||||||
|
self.ShutDownConnecting()
|
||||||
|
self.ShowBox(MyLangManager.Tr("ShutDownConnecting"))
|
||||||
|
self.AbortedAndReturnToUpLevel()
|
||||||
|
else:
|
||||||
|
self.AbortedAndReturnToUpLevel()
|
||||||
|
else:
|
||||||
|
self.HideBox()
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
self._Screen._FootBar.ResetNavText()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["X"]:
|
||||||
|
if self._Offline == False:
|
||||||
|
self.Rescan()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Y"]:
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
if self._Offline == True:
|
||||||
|
return
|
||||||
|
|
||||||
|
self._InfoPage._AList = self._MyList[self._PsIndex]._Atts
|
||||||
|
self._InfoPage._Path = self._MyList[self._PsIndex]._Path
|
||||||
|
self._Screen.PushPage(self._InfoPage)
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
if self._Offline == False:
|
||||||
|
self.TryConnect()
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
self.ClearCanvas()
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(self._MyList) * NetItem._Height > self._Height:
|
||||||
|
self._Ps._Width = self._Width - 11
|
||||||
|
self._Ps.Draw()
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
else:
|
||||||
|
self._Ps._Width = self._Width
|
||||||
|
self._Ps.Draw()
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BUS_NAME = 'org.bluez'
|
||||||
|
AGENT_INTERFACE = 'org.bluez.Agent1'
|
||||||
|
AGENT_PATH = "/gameshell/bleagent"
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
_PairPage = None
|
||||||
|
_Page3 = None
|
||||||
|
_Prompts = {} # string key,string value
|
||||||
|
_PromptType = None
|
||||||
|
_MyAgent = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._Prompts["PIN"]=""
|
||||||
|
self._Prompts["PASS"]=""
|
||||||
|
|
||||||
|
def OnKbdReturnBackCb(self):
|
||||||
|
if self._PromptType == None:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
if self._PromptType in self._Prompts:
|
||||||
|
inputed = "".join(self._Page3._Textarea._MyWords)
|
||||||
|
self._Prompts[self._PromptType] = inputed
|
||||||
|
|
||||||
|
self._PromptType = None ##clear
|
||||||
|
|
||||||
|
|
||||||
|
def Ask(self,prompt,prompt_type=None):
|
||||||
|
|
||||||
|
self._Screen.PushPage(self._Page3)
|
||||||
|
self._Page3.SetPassword("")
|
||||||
|
self._Page3._Name = prompt
|
||||||
|
self._Page3._Caller = self
|
||||||
|
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if prompt_type != None:
|
||||||
|
self._PromptType = prompt_type
|
||||||
|
|
||||||
|
def RegisterMyAgent(self):
|
||||||
|
global AGENT_PATH, bus,devices,adapter
|
||||||
|
|
||||||
|
capability = "KeyboardDisplay"
|
||||||
|
self._MyAgent = BleAgent(bus, AGENT_PATH)
|
||||||
|
self._MyAgent._Leader = self
|
||||||
|
|
||||||
|
obj = bus.get_object(BUS_NAME, "/org/bluez");
|
||||||
|
manager = dbus.Interface(obj, "org.bluez.AgentManager1")
|
||||||
|
manager.RegisterAgent(AGENT_PATH, capability)
|
||||||
|
print("BleAgent %s registered" % AGENT_PATH)
|
||||||
|
|
||||||
|
def Init(self,main_screen):
|
||||||
|
global bus,devices,adapter
|
||||||
|
|
||||||
|
self._Page = BluetoothPage()
|
||||||
|
self._Page._Dbus = bus
|
||||||
|
self._Page._Devices = devices
|
||||||
|
self._Page._Adapter = adapter
|
||||||
|
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Bluetooth"
|
||||||
|
|
||||||
|
self._Page._Leader = self
|
||||||
|
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
self._PairPage = BleAgentPairPage()
|
||||||
|
self._PairPage._Screen = main_screen
|
||||||
|
self._PairPage._Name = "Bluetooth"
|
||||||
|
self._PairPage.Init()
|
||||||
|
|
||||||
|
self._Page3= Keyboard()
|
||||||
|
self._Page3._Name = "Enter"
|
||||||
|
self._Page3._Screen = main_screen
|
||||||
|
self._Page3.Init()
|
||||||
|
|
||||||
|
bus.add_signal_receiver(self._Page.DbusPropertiesChanged,
|
||||||
|
dbus_interface = "org.freedesktop.DBus.Properties",
|
||||||
|
signal_name = "PropertiesChanged",
|
||||||
|
arg0 = "org.bluez.Device1",
|
||||||
|
path_keyword = "path")
|
||||||
|
|
||||||
|
self.RegisterMyAgent()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
224
Menu/GameShell/10_Settings/Bluetooth/agent.py
Normal file
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
128
Menu/GameShell/10_Settings/Bluetooth/net_item.py
Normal file
@ -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.GiveIconSurface("done")
|
||||||
|
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
|
done_icon._Parent = self
|
||||||
|
|
||||||
|
self._Icons["done"] = done_icon
|
||||||
|
## reuse the resource from TitleBar
|
||||||
|
#pp(theString)
|
||||||
|
|
||||||
|
|
||||||
|
def Connect(self,notworkentry=None):
|
||||||
|
""" Execute connection. """
|
||||||
|
#dev = dbus.Interface(bus.get_object("org.bluez", "/org/bluez/hci0/dev_"+"34_88_5D_97_FF_26"), "org.bluez.Device1")
|
||||||
|
proxy_obj = self._Parent._Dbus.get_object("org.bluez",self._Path)
|
||||||
|
dev = self._Parent._Dbus.Interface(proxy_obj, "org.bluez.Device1")
|
||||||
|
dev.Connect()
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
#pygame.draw.line(self._Parent._CanvasHWND,(169,169,169),(self._PosX,self._PosY),(self._PosX+self._Width,self._PosY),1)
|
||||||
|
for i in self._Labels:
|
||||||
|
self._Labels[i]._PosY = self._PosY + (self._Height - self._Labels[i]._Height)/2
|
||||||
|
self._Labels[i].Draw()
|
||||||
|
|
||||||
|
if self._IsActive:
|
||||||
|
self._Icons["done"].NewCoord(320-22,self._PosY)
|
||||||
|
self._Icons["done"].Draw()
|
||||||
|
|
||||||
|
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),
|
||||||
|
(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||||
@ -10,9 +10,8 @@ from UI.constants import Width,Height,ICON_TYPES
|
|||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
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.slider import Slider
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
@ -40,7 +39,7 @@ class BSlider(Slider):
|
|||||||
self._Height = self._Parent._Height
|
self._Height = self._Parent._Height
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = IconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["light"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("light")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
bgpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
@ -50,7 +49,7 @@ class BSlider(Slider):
|
|||||||
scale = MultiIconItem()
|
scale = MultiIconItem()
|
||||||
scale._MyType = ICON_TYPES["STAT"]
|
scale._MyType = ICON_TYPES["STAT"]
|
||||||
scale._Parent = self
|
scale._Parent = self
|
||||||
scale._ImgSurf = MyIconPool._Icons["scale"]
|
scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||||
scale._IconWidth = 82
|
scale._IconWidth = 82
|
||||||
scale._IconHeight = 63
|
scale._IconHeight = 63
|
||||||
scale.Adjust(0,0,82,63,0)
|
scale.Adjust(0,0,82,63,0)
|
||||||
@ -161,7 +160,7 @@ class BrightnessPage(Page):
|
|||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
import commands
|
import commands
|
||||||
@ -9,9 +9,8 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.keys_def import CurKeys
|
from UI.keys_def import CurKeys, GetButtonsLayoutMode, SetButtonsLayoutMode, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
@ -23,15 +22,15 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
_ConfirmText = "Apply to RetroArch?"
|
_ConfirmText = "Apply to RetroArch?"
|
||||||
_RetroArchConf = "/home/cpi/.config/retroarch/retroarch.cfg"
|
_RetroArchConf = "/home/cpi/.config/retroarch/retroarch.cfg"
|
||||||
_LayoutMode = "Unknown"
|
_LayoutMode = "Unknown"
|
||||||
|
|
||||||
def ModifyRetroArchConf(self,keys):
|
def ModifyRetroArchConf(self,keys):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(self._RetroArchConf, mode="r") as f:
|
with open(self._RetroArchConf, mode="r") as f:
|
||||||
confarr = f.readlines()
|
confarr = f.readlines()
|
||||||
except:
|
except:
|
||||||
return "retroarch.cfg cannot open."
|
return "retroarch.cfg cannot open."
|
||||||
|
|
||||||
bka = bkb = bkx = bky = False
|
bka = bkb = bkx = bky = False
|
||||||
try:
|
try:
|
||||||
for i, ln in enumerate(confarr):
|
for i, ln in enumerate(confarr):
|
||||||
@ -50,35 +49,35 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
bky = True
|
bky = True
|
||||||
except:
|
except:
|
||||||
return "retroarch.cfg cannot parse."
|
return "retroarch.cfg cannot parse."
|
||||||
|
|
||||||
if bka and bkb and bkx and bky:
|
if bka and bkb and bkx and bky:
|
||||||
None
|
None
|
||||||
else:
|
else:
|
||||||
return "retroarch.cfg validation error."
|
return "retroarch.cfg validation error."
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(self._RetroArchConf, mode="w") as f:
|
with open(self._RetroArchConf, mode="w") as f:
|
||||||
confarr = f.writelines(confarr)
|
confarr = f.writelines(confarr)
|
||||||
except:
|
except:
|
||||||
return "retroarch.cfg cannot write."
|
return "retroarch.cfg cannot write."
|
||||||
|
|
||||||
return "Completed! Your RA keymap: " + self._LayoutMode.upper()
|
return "Completed! Your RA keymap: " + self._LayoutMode.upper()
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
def finalizeWithDialog(msg):
|
def finalizeWithDialog(msg):
|
||||||
self._Screen._MsgBox.SetText(msg)
|
self._Screen._MsgBox.SetText(msg)
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
return
|
return
|
||||||
|
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
|
|
||||||
if self._LayoutMode == "xbox":
|
if self._LayoutMode == "xbox":
|
||||||
keymap = ["j","k","u","i"]
|
keymap = ["j","k","u","i"]
|
||||||
elif self._LayoutMode == "snes":
|
elif self._LayoutMode == "snes":
|
||||||
@ -87,17 +86,17 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
finalizeWithDialog("Internal error.")
|
finalizeWithDialog("Internal error.")
|
||||||
return
|
return
|
||||||
print("mode: " + self._LayoutMode)
|
print("mode: " + self._LayoutMode)
|
||||||
|
|
||||||
if not os.path.isfile(self._RetroArchConf):
|
if not os.path.isfile(self._RetroArchConf):
|
||||||
finalizeWithDialog("retroarch.cfg was not found.")
|
finalizeWithDialog("retroarch.cfg was not found.")
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.copyfile(self._RetroArchConf, self._RetroArchConf + ".blbak")
|
shutil.copyfile(self._RetroArchConf, self._RetroArchConf + ".blbak")
|
||||||
except:
|
except:
|
||||||
finalizeWithDialog("Cannot create .blbak")
|
finalizeWithDialog("Cannot create .blbak")
|
||||||
return
|
return
|
||||||
|
|
||||||
finalizeWithDialog(self.ModifyRetroArchConf(keymap))
|
finalizeWithDialog(self.ModifyRetroArchConf(keymap))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -105,24 +104,23 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
self.DrawBG()
|
self.DrawBG()
|
||||||
for i in self._MyList:
|
for i in self._MyList:
|
||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
self.Reset()
|
self.Reset()
|
||||||
|
|
||||||
class ButtonsLayoutPage(Page):
|
class ButtonsLayoutPage(Page):
|
||||||
_FootMsg = ["Nav.","UpdateRetroArch","","Back","Toggle"]
|
_FootMsg = ["Nav.","","UpdateRetroArch","Back","Toggle"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela13"]
|
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
_Scrolled = 0
|
_Scrolled = 0
|
||||||
|
|
||||||
_BGwidth = 320
|
_BGwidth = 320
|
||||||
_BGheight = 240-24-20
|
_BGheight = 240-24-20
|
||||||
|
|
||||||
@ -133,29 +131,29 @@ class ButtonsLayoutPage(Page):
|
|||||||
_EasingDur = 30
|
_EasingDur = 30
|
||||||
|
|
||||||
_dialog_index = 0
|
_dialog_index = 0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Page.__init__(self)
|
Page.__init__(self)
|
||||||
self._Icons = {}
|
self._Icons = {}
|
||||||
|
|
||||||
def GenList(self):
|
def GenList(self):
|
||||||
|
|
||||||
self._MyList = []
|
self._MyList = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def Init(self):
|
def Init(self):
|
||||||
if self._Screen != None:
|
if self._Screen != None:
|
||||||
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
self._HWND = self._Screen._CanvasHWND
|
self._HWND = self._Screen._CanvasHWND
|
||||||
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
|
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
|
||||||
|
|
||||||
self._PosX = self._Index*self._Screen._Width
|
self._PosX = self._Index*self._Screen._Width
|
||||||
self._Width = self._Screen._Width ## equal to screen width
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
DialogBoxs = MultiIconItem()
|
DialogBoxs = MultiIconItem()
|
||||||
DialogBoxs._ImgSurf = MyIconPool._Icons["buttonslayout"]
|
DialogBoxs._ImgSurf = MyIconPool.GiveIconSurface("buttonslayout")
|
||||||
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
DialogBoxs._MyType = ICON_TYPES["STAT"]
|
||||||
DialogBoxs._Parent = self
|
DialogBoxs._Parent = self
|
||||||
DialogBoxs._IconWidth = 300
|
DialogBoxs._IconWidth = 300
|
||||||
@ -172,7 +170,7 @@ class ButtonsLayoutPage(Page):
|
|||||||
self._Scroller.SetCanvasHWND(self._HWND)
|
self._Scroller.SetCanvasHWND(self._HWND)
|
||||||
|
|
||||||
self._ConfirmPage = UpdateConfirmPage()
|
self._ConfirmPage = UpdateConfirmPage()
|
||||||
self._ConfirmPage._LayoutMode = self.GetButtonsLayoutMode()
|
self._ConfirmPage._LayoutMode = GetButtonsLayoutMode()
|
||||||
self._ConfirmPage._Screen = self._Screen
|
self._ConfirmPage._Screen = self._Screen
|
||||||
self._ConfirmPage._Name = "Overwrite RA conf"
|
self._ConfirmPage._Name = "Overwrite RA conf"
|
||||||
self._ConfirmPage._Parent = self
|
self._ConfirmPage._Parent = self
|
||||||
@ -184,38 +182,23 @@ class ButtonsLayoutPage(Page):
|
|||||||
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 0:
|
if abs(self._Scrolled) < (self._BGheight - self._Height)/2 + 0:
|
||||||
self._PosY -= dis
|
self._PosY -= dis
|
||||||
self._Scrolled -= dis
|
self._Scrolled -= dis
|
||||||
|
|
||||||
def ScrollUp(self):
|
def ScrollUp(self):
|
||||||
dis = 10
|
dis = 10
|
||||||
if self._PosY < 0:
|
if self._PosY < 0:
|
||||||
self._PosY += dis
|
self._PosY += dis
|
||||||
self._Scrolled += 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):
|
def ToggleMode(self):
|
||||||
|
|
||||||
if self.GetButtonsLayoutMode() == "xbox":
|
if GetButtonsLayoutMode() == "xbox":
|
||||||
|
SetButtonsLayoutMode("snes")
|
||||||
with open(".buttonslayout", "w") as f:
|
|
||||||
f.write("snes")
|
|
||||||
|
|
||||||
self._dialog_index = 1
|
self._dialog_index = 1
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
else:
|
else:
|
||||||
|
SetButtonsLayoutMode("xbox")
|
||||||
with open(".buttonslayout", "w") as f:
|
|
||||||
f.write("xbox")
|
|
||||||
|
|
||||||
self._dialog_index = 0
|
self._dialog_index = 0
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
@ -225,39 +208,36 @@ class ButtonsLayoutPage(Page):
|
|||||||
self._Scrolled = 0
|
self._Scrolled = 0
|
||||||
self._PosY = 0
|
self._PosY = 0
|
||||||
self._DrawOnce = False
|
self._DrawOnce = False
|
||||||
|
|
||||||
if self.GetButtonsLayoutMode() == "xbox":
|
self._dialog_index = 0 if GetButtonsLayoutMode() == "xbox" else 1
|
||||||
self._dialog_index = 0
|
|
||||||
else:
|
|
||||||
self._dialog_index = 1
|
|
||||||
|
|
||||||
def OnReturnBackCb(self):
|
def OnReturnBackCb(self):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.ToggleMode()
|
self.ToggleMode()
|
||||||
|
|
||||||
if event.key == CurKeys["X"]:
|
if event.key == CurKeys["X"]:
|
||||||
self._ConfirmPage._LayoutMode = self.GetButtonsLayoutMode()
|
self._ConfirmPage._LayoutMode = GetButtonsLayoutMode()
|
||||||
self._Screen.PushPage(self._ConfirmPage)
|
self._Screen.PushPage(self._ConfirmPage)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
|
|
||||||
self._Icons["DialogBoxs"].NewCoord(0,30)
|
self._Icons["DialogBoxs"].NewCoord(0,30)
|
||||||
self._Icons["DialogBoxs"]._IconIndex = self._dialog_index
|
self._Icons["DialogBoxs"]._IconIndex = self._dialog_index
|
||||||
self._Icons["DialogBoxs"].DrawTopLeft()
|
self._Icons["DialogBoxs"].DrawTopLeft()
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill((255,255,255))
|
self._HWND.fill((255,255,255))
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
@ -272,7 +252,7 @@ class APIOBJ(object):
|
|||||||
self._Page._Screen = main_screen
|
self._Page._Screen = main_screen
|
||||||
self._Page._Name ="Buttons Layout"
|
self._Page._Name ="Buttons Layout"
|
||||||
self._Page.Init()
|
self._Page.Init()
|
||||||
|
|
||||||
def API(self,main_screen):
|
def API(self,main_screen):
|
||||||
if main_screen !=None:
|
if main_screen !=None:
|
||||||
main_screen.PushPage(self._Page)
|
main_screen.PushPage(self._Page)
|
||||||
@ -280,8 +260,8 @@ class APIOBJ(object):
|
|||||||
main_screen.SwapAndShow()
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
OBJ = APIOBJ()
|
OBJ = APIOBJ()
|
||||||
def Init(main_screen):
|
def Init(main_screen):
|
||||||
OBJ.Init(main_screen)
|
OBJ.Init(main_screen)
|
||||||
def API(main_screen):
|
def API(main_screen):
|
||||||
OBJ.API(main_screen)
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|||||||
252
Menu/GameShell/10_Settings/Cores/__init__.py
Normal file
@ -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()
|
||||||
|
|
||||||
|
if len(self._MyList) > 0:
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*InfoPageListItem._Height,
|
||||||
|
self._PsIndex*InfoPageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = CoresPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Retroarch cores manager"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|
||||||
349
Menu/GameShell/10_Settings/GateWay/__init__.py
Normal file
@ -0,0 +1,349 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import pygame
|
||||||
|
import platform
|
||||||
|
import commands
|
||||||
|
#import glob
|
||||||
|
#from beeprint import pp
|
||||||
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
|
## local UI import
|
||||||
|
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||||
|
from UI.page import Page,PageSelector
|
||||||
|
from UI.label import Label
|
||||||
|
from UI.util_funcs import midRect,FileExists
|
||||||
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
|
from UI.scroller import ListScroller
|
||||||
|
from UI.icon_pool import MyIconPool
|
||||||
|
from UI.icon_item import IconItem
|
||||||
|
from UI.multilabel import MultiLabel
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.info_page_list_item import InfoPageListItem
|
||||||
|
from UI.info_page_selector import InfoPageSelector
|
||||||
|
|
||||||
|
from libs.DBUS import is_wifi_connected_now
|
||||||
|
import config
|
||||||
|
|
||||||
|
class ListPageSelector(InfoPageSelector):
|
||||||
|
def Draw(self):
|
||||||
|
idx = self._Parent._PsIndex
|
||||||
|
|
||||||
|
if idx < len(self._Parent._MyList):
|
||||||
|
x = self._Parent._MyList[idx]._PosX+2 ## ++
|
||||||
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
|
self._PosX = x
|
||||||
|
self._PosY = y
|
||||||
|
self._Height = h
|
||||||
|
|
||||||
|
aa_round_rect(self._Parent._CanvasHWND,
|
||||||
|
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||||
|
|
||||||
|
|
||||||
|
class PageListItem(InfoPageListItem):
|
||||||
|
_PosX = 0
|
||||||
|
_PosY = 0
|
||||||
|
_Width = 0
|
||||||
|
_Height = 30
|
||||||
|
|
||||||
|
_Labels = {}
|
||||||
|
_Icons = {}
|
||||||
|
_Fonts = {}
|
||||||
|
|
||||||
|
_LinkObj = None
|
||||||
|
|
||||||
|
_Active = False
|
||||||
|
_Value = ""
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
|
||||||
|
|
||||||
|
if self._Active == True:
|
||||||
|
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
|
||||||
|
self._Parent._Icons["done"].Draw()
|
||||||
|
|
||||||
|
self._Labels["Text"].Draw(self._Active)
|
||||||
|
|
||||||
|
if "Small" in self._Labels:
|
||||||
|
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
|
||||||
|
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
|
||||||
|
self._Labels["Small"].Draw()
|
||||||
|
|
||||||
|
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||||
|
|
||||||
|
class GateWayPage(Page):
|
||||||
|
_FootMsg = ["Nav","Clear All","","Back","Select"]
|
||||||
|
_MyList = []
|
||||||
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
|
_AList = {}
|
||||||
|
|
||||||
|
_Scrolled = 0
|
||||||
|
|
||||||
|
_BGwidth = 320
|
||||||
|
_BGheight = 240-24-20
|
||||||
|
|
||||||
|
_DrawOnce = False
|
||||||
|
_Scroller = None
|
||||||
|
_InfoPage = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Page.__init__(self)
|
||||||
|
self._Icons = {}
|
||||||
|
|
||||||
|
def GenList(self):
|
||||||
|
|
||||||
|
self._MyList = []
|
||||||
|
|
||||||
|
start_x = 0
|
||||||
|
start_y = 0
|
||||||
|
last_height = 0
|
||||||
|
|
||||||
|
drivers = [["usb0","USB Ethernet"],
|
||||||
|
["wlan0","Wi-Fi"]]
|
||||||
|
|
||||||
|
|
||||||
|
for i,u in enumerate( drivers ):
|
||||||
|
#print(i,u)
|
||||||
|
li = PageListItem()
|
||||||
|
li._Parent = self
|
||||||
|
li._PosX = start_x
|
||||||
|
li._PosY = start_y + last_height
|
||||||
|
li._Width = Width
|
||||||
|
li._Fonts["normal"] = self._ListFont
|
||||||
|
li._Active = False
|
||||||
|
li._Value = u[0]
|
||||||
|
li.Init( u[1] )
|
||||||
|
|
||||||
|
last_height += li._Height
|
||||||
|
|
||||||
|
self._MyList.append(li)
|
||||||
|
|
||||||
|
def Init(self):
|
||||||
|
if self._Screen != None:
|
||||||
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
|
self._HWND = self._Screen._CanvasHWND
|
||||||
|
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
|
||||||
|
|
||||||
|
self._PosX = self._Index*self._Screen._Width
|
||||||
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
|
done = IconItem()
|
||||||
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
|
done._Parent = self
|
||||||
|
self._Icons["done"] = done
|
||||||
|
|
||||||
|
ps = ListPageSelector()
|
||||||
|
ps._Parent = self
|
||||||
|
self._Ps = ps
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
self._Scroller = ListScroller()
|
||||||
|
self._Scroller._Parent = self
|
||||||
|
self._Scroller._PosX = self._Width - 10
|
||||||
|
self._Scroller._PosY = 2
|
||||||
|
self._Scroller.Init()
|
||||||
|
self._Scroller.SetCanvasHWND(self._HWND)
|
||||||
|
|
||||||
|
def Click(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._Active == True:
|
||||||
|
out = commands.getstatusoutput("sudo ip route | grep default | cut -d \" \" -f3")
|
||||||
|
if len(out[1]) > 7:
|
||||||
|
self._Screen._MsgBox.SetText(out[1])
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
return
|
||||||
|
|
||||||
|
print(cur_li._Value)
|
||||||
|
|
||||||
|
if "arm" in platform.machine():
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
self._Screen._MsgBox.SetText("Applying")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
cur_li._Active = self.ApplyGateWay(cur_li._Value)
|
||||||
|
|
||||||
|
pygame.time.delay(1000)
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
else:
|
||||||
|
self._Screen._MsgBox.SetText("Do it in GameShell")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def ClearAllGateways(self):
|
||||||
|
self._Screen._MsgBox.SetText("Cleaning up")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
os.system("sudo ip route del 0/0")
|
||||||
|
pygame.time.delay(800)
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def ApplyGateWay(self,gateway):
|
||||||
|
os.system("sudo ip route del 0/0")
|
||||||
|
if gateway== "usb0":
|
||||||
|
out = commands.getstatusoutput("sudo ifconfig usb0 | grep inet | tr -s \" \"| cut -d \" \" -f3")
|
||||||
|
if len(out[1]) > 7:
|
||||||
|
if "error" not in out[1]:
|
||||||
|
parts = out[1].split(".")
|
||||||
|
if len(parts) == 4:##IPv4
|
||||||
|
tp3 = int(parts[3])
|
||||||
|
tmp = tp3
|
||||||
|
if tp3 == 0:
|
||||||
|
tmp = int(parts[3]) + 1
|
||||||
|
elif tp3 == 1:
|
||||||
|
tmp = int(parts[3]) + 1
|
||||||
|
elif tp3 > 1:
|
||||||
|
tmp = int(parts[3]) - 1
|
||||||
|
|
||||||
|
parts[3] = str(tmp)
|
||||||
|
ipaddress = ".".join(parts)
|
||||||
|
os.system("sudo route add default gw "+ipaddress)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if is_wifi_connected_now():
|
||||||
|
os.system("sudo dhclient wlan0")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self._Screen._MsgBox.SetText("Wi-Fi is not connected")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
return False
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
self._Scrolled = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._DrawOnce = False
|
||||||
|
|
||||||
|
## grep Driver /etc/xorg.conf | tr -s " " | cut -d " " -f3
|
||||||
|
## "fbturbo"
|
||||||
|
## "modesetting"
|
||||||
|
thedrv = ""
|
||||||
|
|
||||||
|
if "arm" in platform.machine():
|
||||||
|
out = commands.getstatusoutput("sudo ip route | grep default")
|
||||||
|
if len(out[1]) > 7:
|
||||||
|
if "usb0" in out[1]:
|
||||||
|
thedrv = "usb0"
|
||||||
|
elif "wlan0" in out[1]:
|
||||||
|
thedrv = "wlan0"
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
if thedrv != "":
|
||||||
|
for i in self._MyList:
|
||||||
|
if thedrv in i._Value:
|
||||||
|
i._Active = True
|
||||||
|
## if usb0 and wlan0 all actived, clear all
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
pass
|
||||||
|
"""
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
"""
|
||||||
|
def KeyDown(self,event):
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self.Click()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Y"]:
|
||||||
|
self.ClearAllGateways()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self.ClearCanvas()
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
else:
|
||||||
|
if len(self._MyList) * PageListItem._Height > self._Height:
|
||||||
|
self._Ps._Width = self._Width - 11
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._Ps._Width = self._Width
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
if self._HWND != None:
|
||||||
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = GateWayPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Gateway switch"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|
||||||
309
Menu/GameShell/10_Settings/Languages/__init__.py
Normal file
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
class PageListItem(InfoPageListItem):
|
||||||
|
_PosX = 0
|
||||||
|
_PosY = 0
|
||||||
|
_Width = 0
|
||||||
|
_Height = 30
|
||||||
|
|
||||||
|
_Labels = {}
|
||||||
|
_Icons = {}
|
||||||
|
_Fonts = {}
|
||||||
|
|
||||||
|
_LinkObj = None
|
||||||
|
|
||||||
|
_Active = False
|
||||||
|
_Value = ""
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
|
||||||
|
|
||||||
|
if self._Active == True:
|
||||||
|
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
|
||||||
|
self._Parent._Icons["done"].Draw()
|
||||||
|
|
||||||
|
self._Labels["Text"].Draw(self._Active)
|
||||||
|
|
||||||
|
if "Small" in self._Labels:
|
||||||
|
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
|
||||||
|
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
|
||||||
|
self._Labels["Small"].Draw()
|
||||||
|
|
||||||
|
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||||
|
|
||||||
|
class LanguagesPage(Page):
|
||||||
|
_FootMsg = ["Nav","","","Back","Select"]
|
||||||
|
_MyList = []
|
||||||
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
|
_AList = {}
|
||||||
|
|
||||||
|
_Scrolled = 0
|
||||||
|
|
||||||
|
_BGwidth = 320
|
||||||
|
_BGheight = 240-24-20
|
||||||
|
|
||||||
|
_DrawOnce = False
|
||||||
|
_Scroller = None
|
||||||
|
_InfoPage = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Page.__init__(self)
|
||||||
|
self._Icons = {}
|
||||||
|
|
||||||
|
def GenList(self):
|
||||||
|
|
||||||
|
self._MyList = []
|
||||||
|
|
||||||
|
start_x = 0
|
||||||
|
start_y = 0
|
||||||
|
last_height = 0
|
||||||
|
|
||||||
|
files_path = [os.path.basename(x) for x in sorted(glob.glob('langs/*.ini'))]
|
||||||
|
|
||||||
|
for i,u in enumerate( files_path ):
|
||||||
|
#print(i,u)
|
||||||
|
li = PageListItem()
|
||||||
|
li._Parent = self
|
||||||
|
li._PosX = start_x
|
||||||
|
li._PosY = start_y + last_height
|
||||||
|
li._Width = Width
|
||||||
|
li._Fonts["normal"] = self._ListFont
|
||||||
|
li._Active = False
|
||||||
|
li._Value = u.decode("utf8")
|
||||||
|
lang_name = u.split("_")[1]
|
||||||
|
lang_name = lang_name.split(".")[0]
|
||||||
|
|
||||||
|
li.Init( lang_name.decode("utf8") )
|
||||||
|
|
||||||
|
last_height += li._Height
|
||||||
|
|
||||||
|
self._MyList.append(li)
|
||||||
|
|
||||||
|
def Init(self):
|
||||||
|
if self._Screen != None:
|
||||||
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
|
self._HWND = self._Screen._CanvasHWND
|
||||||
|
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
|
||||||
|
|
||||||
|
self._PosX = self._Index*self._Screen._Width
|
||||||
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
|
done = IconItem()
|
||||||
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
|
done._Parent = self
|
||||||
|
self._Icons["done"] = done
|
||||||
|
|
||||||
|
ps = ListPageSelector()
|
||||||
|
ps._Parent = self
|
||||||
|
self._Ps = ps
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
self._Scroller = ListScroller()
|
||||||
|
self._Scroller._Parent = self
|
||||||
|
self._Scroller._PosX = self._Width - 10
|
||||||
|
self._Scroller._PosY = 2
|
||||||
|
self._Scroller.Init()
|
||||||
|
self._Scroller.SetCanvasHWND(self._HWND)
|
||||||
|
|
||||||
|
|
||||||
|
def ScrollDown(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
self._PsIndex +=1
|
||||||
|
if self._PsIndex >= len(self._MyList):
|
||||||
|
self._PsIndex = len(self._MyList) -1
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._PosY +cur_li._Height > self._Height:
|
||||||
|
for i in range(0,len(self._MyList)):
|
||||||
|
self._MyList[i]._PosY -= self._MyList[i]._Height
|
||||||
|
|
||||||
|
def ScrollUp(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
self._PsIndex -= 1
|
||||||
|
if self._PsIndex < 0:
|
||||||
|
self._PsIndex = 0
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._PosY < 0:
|
||||||
|
for i in range(0, len(self._MyList)):
|
||||||
|
self._MyList[i]._PosY += self._MyList[i]._Height
|
||||||
|
|
||||||
|
|
||||||
|
def Click(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._Active == True:
|
||||||
|
return
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
cur_li._Active = True
|
||||||
|
print(cur_li._Value)
|
||||||
|
with open(".lang","w") as f:
|
||||||
|
f.write(cur_li._Value)
|
||||||
|
|
||||||
|
self._Screen._MsgBox.SetText("Applying")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
MyLangManager.UpdateLang()
|
||||||
|
|
||||||
|
pygame.event.post( pygame.event.Event(RESTARTUI, message="")) ##Restart Launcher
|
||||||
|
|
||||||
|
pygame.time.delay(1000)
|
||||||
|
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
self._Scrolled = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._DrawOnce = False
|
||||||
|
with open(".lang", "r") as f:
|
||||||
|
thelang = f.read()
|
||||||
|
|
||||||
|
thelang = thelang.strip()
|
||||||
|
|
||||||
|
if thelang == "":
|
||||||
|
thelang = "English"
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
if thelang in i._Value:
|
||||||
|
i._Active = True
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
pass
|
||||||
|
"""
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
"""
|
||||||
|
def KeyDown(self,event):
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self.Click()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self.ClearCanvas()
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
else:
|
||||||
|
if len(self._MyList) * PageListItem._Height > self._Height:
|
||||||
|
self._Ps._Width = self._Width - 11
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._Ps._Width = self._Width
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
if self._HWND != None:
|
||||||
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = LanguagesPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Languages"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|
||||||
55
Menu/GameShell/10_Settings/LauncherGo/__init__.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import pygame
|
||||||
|
#import math
|
||||||
|
#mport subprocess
|
||||||
|
#from beeprint import pp
|
||||||
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
|
## local UI import
|
||||||
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
|
from UI.util_funcs import ArmSystem
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.confirm_page import ConfirmPage
|
||||||
|
|
||||||
|
class SwitchToLauncherGoConfirmPage(ConfirmPage):
|
||||||
|
|
||||||
|
def KeyDown(self,event):
|
||||||
|
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self._Screen._MsgBox.SetText("Rebooting to LauncherGo")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
pygame.time.delay(300)
|
||||||
|
ArmSystem("sed -i s/launcher/launchergo/g ~/.bashrc" )
|
||||||
|
ArmSystem("sudo reboot")
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = SwitchToLauncherGoConfirmPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Switch To LauncherGo"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
302
Menu/GameShell/10_Settings/Lima/__init__.py
Normal file
@ -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 self._PsIndex > len(self._MyList) -1:
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._Active == True:
|
||||||
|
return
|
||||||
|
|
||||||
|
print(cur_li._Value)
|
||||||
|
|
||||||
|
if "arm" in platform.machine():
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
cur_li._Active = True
|
||||||
|
self._Screen._MsgBox.SetText("Applying")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if "modesetting" in cur_li._Value: ## enable lima
|
||||||
|
os.system("touch %s/.lima" % os.path.expanduser('~') )
|
||||||
|
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima /usr/lib/xorg/modules/drivers/modesetting_drv.so")
|
||||||
|
ArmSystem("sudo sed -i '/^#.*lima/s/^#//' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
|
||||||
|
ArmSystem("sudo ldconfig")
|
||||||
|
else: #disable lima
|
||||||
|
os.system("rm %s/.lima" % os.path.expanduser('~') )
|
||||||
|
ArmSystem("sudo mv /usr/lib/xorg/modules/drivers/modesetting_drv.so /usr/lib/xorg/modules/drivers/modesetting_drv.so.lima")
|
||||||
|
ArmSystem("sudo sed -i 's/^[^#]*lima/#&/' /etc/ld.so.conf.d/00-arm-linux-gnueabihf.conf")
|
||||||
|
ArmSystem("sudo ldconfig")
|
||||||
|
|
||||||
|
pygame.time.delay(800)
|
||||||
|
os.system("sudo reboot")
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._Screen._MsgBox.SetText("Do it in GameShell")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
self._Scrolled = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._DrawOnce = False
|
||||||
|
|
||||||
|
## grep Driver /etc/xorg.conf | tr -s " " | cut -d " " -f3
|
||||||
|
## "fbturbo"
|
||||||
|
## "modesetting"
|
||||||
|
thedrv = ""
|
||||||
|
|
||||||
|
if "arm" in platform.machine():
|
||||||
|
if FileExists("%s/.lima" % os.path.expanduser('~')):
|
||||||
|
thedrv = "modesetting"
|
||||||
|
else:
|
||||||
|
thedrv = "fbturbo"
|
||||||
|
|
||||||
|
if thedrv == "":
|
||||||
|
thedrv = "fbturbo"
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
if thedrv in i._Value:
|
||||||
|
i._Active = True
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
pass
|
||||||
|
"""
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
"""
|
||||||
|
def KeyDown(self,event):
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self.Click()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self.ClearCanvas()
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
else:
|
||||||
|
if len(self._MyList) * PageListItem._Height > self._Height:
|
||||||
|
self._Ps._Width = self._Width - 11
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._Ps._Width = self._Width
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
if self._HWND != None:
|
||||||
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = GPUDriverPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="GPU Driver Switch"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|
||||||
264
Menu/GameShell/10_Settings/Notification/__init__.py
Normal file
@ -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.GiveIconSurface("done")
|
||||||
|
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
|
done_icon._Parent = self
|
||||||
|
|
||||||
|
self._Icons["done"] = done_icon
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
if self._ReadOnly == False:
|
||||||
|
self._Labels["Text"].SetColor(MySkinManager.GiveColor("ReadOnlyText"))
|
||||||
|
else:
|
||||||
|
self._Labels["Text"].SetColor(MySkinManager.GiveColor("Text"))
|
||||||
|
|
||||||
|
|
||||||
|
self._Labels["Text"]._PosX = self._Labels["Text"]._PosX + self._PosX
|
||||||
|
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
||||||
|
self._Labels["Text"].Draw()
|
||||||
|
self._Labels["Text"]._PosX = self._Labels["Text"]._PosX - self._PosX
|
||||||
|
|
||||||
|
if "Small" in self._Labels:
|
||||||
|
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width-5
|
||||||
|
|
||||||
|
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
|
||||||
|
self._Labels["Small"].Draw()
|
||||||
|
|
||||||
|
if self._ReadOnly:
|
||||||
|
self._Icons["done"].NewCoord(self._Width - 25,5)
|
||||||
|
self._Icons["done"].Draw()
|
||||||
|
|
||||||
|
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||||
|
|
||||||
|
|
||||||
|
class NotificationPage(Page):
|
||||||
|
_FootMsg = ["Nav","","","Back","Toggle"]
|
||||||
|
_MyList = []
|
||||||
|
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||||
|
|
||||||
|
_AList = {}
|
||||||
|
|
||||||
|
_Scrolled = 0
|
||||||
|
|
||||||
|
_BGwidth = 320
|
||||||
|
_BGheight = 240-24-20
|
||||||
|
|
||||||
|
_DrawOnce = False
|
||||||
|
_Scroller = None
|
||||||
|
|
||||||
|
_EasingDur = 30
|
||||||
|
|
||||||
|
_GSNOTIFY_JOBS = "gsnotify/Jobs"
|
||||||
|
_GSNOTIFY_SOCKET="/tmp/gsnotify.sock"
|
||||||
|
_Config =None
|
||||||
|
_AllowedExts = [".sh",".lsp",".lua",".bin",".py",".js"]
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Page.__init__(self)
|
||||||
|
self._Icons = {}
|
||||||
|
|
||||||
|
if "arm" in platform.machine():
|
||||||
|
os.system( "git config --global core.filemode false" )
|
||||||
|
|
||||||
|
def GenList(self):
|
||||||
|
|
||||||
|
self._MyList = []
|
||||||
|
## map ini to self._AList
|
||||||
|
files_path = glob.glob(self._GSNOTIFY_JOBS+"/*")
|
||||||
|
|
||||||
|
|
||||||
|
start_x = 10
|
||||||
|
start_y = 0
|
||||||
|
counter = 0
|
||||||
|
for i,v in enumerate( files_path):
|
||||||
|
filename, file_extension = os.path.splitext(v)
|
||||||
|
alias_file = filename + ".alias"
|
||||||
|
|
||||||
|
if file_extension in self._AllowedExts:
|
||||||
|
li = NotifyJobListItem()
|
||||||
|
li._Parent = self
|
||||||
|
li._PosX = start_x
|
||||||
|
li._PosY = start_y + counter*InfoPageListItem._Height
|
||||||
|
li._Width = Width-10
|
||||||
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
|
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||||
|
|
||||||
|
if IsExecutable(v):
|
||||||
|
li._ReadOnly = True
|
||||||
|
|
||||||
|
if os.path.isfile(alias_file):
|
||||||
|
fp = open(alias_file, "r")
|
||||||
|
alias = fp.read()
|
||||||
|
alias = alias.strip()
|
||||||
|
label_text = alias.decode("utf8")
|
||||||
|
li.Init( label_text )
|
||||||
|
fp.close()
|
||||||
|
else:
|
||||||
|
li.Init( os.path.basename(v) )
|
||||||
|
li._Flag = v
|
||||||
|
##li.SetSmallText( v )
|
||||||
|
|
||||||
|
self._MyList.append(li)
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
def Init(self):
|
||||||
|
if self._Screen != None:
|
||||||
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
|
self._CanvasHWND = self._Screen._CanvasHWND
|
||||||
|
|
||||||
|
self._PosX = self._Index*self._Screen._Width
|
||||||
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
|
ps = InfoPageSelector()
|
||||||
|
ps._PosX = 11
|
||||||
|
ps._Parent = self
|
||||||
|
ps._Width = self._Width-10
|
||||||
|
self._Ps = ps
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
self._Scroller = ListScroller()
|
||||||
|
self._Scroller._Parent = self
|
||||||
|
self._Scroller._PosX = 2
|
||||||
|
self._Scroller._PosY = 2
|
||||||
|
self._Scroller.Init()
|
||||||
|
|
||||||
|
def Click(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
#print("Click ",cur_li._Flag)
|
||||||
|
if IsExecutable(cur_li._Flag):
|
||||||
|
os.system("chmod -x "+cur_li._Flag)
|
||||||
|
else:
|
||||||
|
os.system("chmod +x "+cur_li._Flag)
|
||||||
|
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
self._Scrolled = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._DrawOnce = False
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def KeyDown(self,event):
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
|
||||||
|
self._Screen._MsgBox.SetText("Applying")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
pygame.time.delay(638)
|
||||||
|
|
||||||
|
self.Click()
|
||||||
|
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
self.ClearCanvas()
|
||||||
|
self._Ps.Draw()
|
||||||
|
|
||||||
|
if len(self._MyList) > 0:
|
||||||
|
for i in self._MyList:
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*InfoPageListItem._Height,
|
||||||
|
self._PsIndex*InfoPageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = NotificationPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Notify"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|
||||||
@ -4,16 +4,17 @@ import pygame
|
|||||||
|
|
||||||
#UI lib
|
#UI lib
|
||||||
from UI.constants import RUNSYS
|
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.confirm_page import ConfirmPage
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
class PowerOffConfirmPage(ConfirmPage):
|
class PowerOffConfirmPage(ConfirmPage):
|
||||||
|
|
||||||
_ConfirmText = "Confirm Power OFF?"
|
_ConfirmText = MyLangManager.Tr("Confirm Power OFF?")
|
||||||
|
|
||||||
|
|
||||||
def CheckBattery(self):
|
def CheckBattery(self):
|
||||||
try:
|
try:
|
||||||
f = open(config.Battery)
|
f = open(config.Battery)
|
||||||
@ -41,17 +42,17 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
|
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
if self.CheckBattery() < 20:
|
if self.CheckBattery() < 20:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||||
else:
|
else:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
|
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
|
|
||||||
|
|||||||
@ -12,19 +12,19 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES,POWEROPT
|
from UI.constants import Width,Height,ICON_TYPES,POWEROPT
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
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.scroller import ListScroller
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.multilabel import MultiLabel
|
from UI.multilabel import MultiLabel
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
class ListPageSelector(PageSelector):
|
class ListPageSelector(PageSelector):
|
||||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
self._PosX = 0
|
||||||
@ -84,7 +84,7 @@ class PageListItem(object):
|
|||||||
l = Label()
|
l = Label()
|
||||||
l._PosX = 10
|
l._PosX = 10
|
||||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
||||||
|
text = MyLangManager.Tr(text)
|
||||||
l.Init(text,self._Fonts["normal"])
|
l.Init(text,self._Fonts["normal"])
|
||||||
self._Labels["Text"] = l
|
self._Labels["Text"] = l
|
||||||
|
|
||||||
@ -103,13 +103,13 @@ class PageListItem(object):
|
|||||||
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
|
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
|
||||||
self._Labels["Small"].Draw()
|
self._Labels["Small"].Draw()
|
||||||
|
|
||||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
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):
|
class InfoPage(Page):
|
||||||
_FootMsg = ["Nav.","","","Back",""]
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela15"]
|
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
_Time1 = 40
|
_Time1 = 40
|
||||||
@ -123,22 +123,22 @@ class InfoPage(Page):
|
|||||||
m = int(secs/60)
|
m = int(secs/60)
|
||||||
s = secs % 60
|
s = secs % 60
|
||||||
if m > 1:
|
if m > 1:
|
||||||
min_str = "%d minutes " % m
|
min_str = ("%d "+MyLangManager.Tr("minutes")+" ") % m
|
||||||
else:
|
else:
|
||||||
min_str = "%d minute " % m
|
min_str = ("%d "+MyLangManager.Tr("minute")+" ") % m
|
||||||
|
|
||||||
if s == 1:
|
if s == 1:
|
||||||
sec_str = "%d second" % s
|
sec_str = ("%d "+MyLangManager.Tr("second")) % s
|
||||||
elif s > 1:
|
elif s > 1:
|
||||||
sec_str = "%d seconds" % s
|
sec_str = ("%d "+MyLangManager.Tr("seconds")) % s
|
||||||
elif secs > 0:
|
elif secs > 0:
|
||||||
if secs > 1:
|
if secs > 1:
|
||||||
sec_str = "%d seconds" % secs
|
sec_str = ("%d "+MyLangManager.Tr("seconds")) % secs
|
||||||
else:
|
else:
|
||||||
sec_str = "%d second" % secs
|
sec_str = ("%d "+MyLangManager.Tr("second")) % secs
|
||||||
|
|
||||||
elif secs == 0:
|
elif secs == 0:
|
||||||
sec_str = "Never"
|
sec_str = MyLangManager.Tr("Never")
|
||||||
|
|
||||||
return min_str + sec_str
|
return min_str + sec_str
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ class InfoPage(Page):
|
|||||||
time1 = {}
|
time1 = {}
|
||||||
time1["key"] = "time1"
|
time1["key"] = "time1"
|
||||||
if self._Time1 == 0:
|
if self._Time1 == 0:
|
||||||
time1["value"] = "Never"
|
time1["value"] = MyLangManager.Tr("Never")
|
||||||
else:
|
else:
|
||||||
time1["value"] = "%d secs" % self._Time1
|
time1["value"] = "%d secs" % self._Time1
|
||||||
time1["label"] = "Screen dimming"
|
time1["label"] = "Screen dimming"
|
||||||
@ -164,7 +164,7 @@ class InfoPage(Page):
|
|||||||
time2 = {}
|
time2 = {}
|
||||||
time2["key"] = "time2"
|
time2["key"] = "time2"
|
||||||
if self._Time2 == 0:
|
if self._Time2 == 0:
|
||||||
time2["value"] = "Never"
|
time2["value"] = MyLangManager.Tr("Never")
|
||||||
else:
|
else:
|
||||||
time2["value"] = "%d secs" % self._Time2
|
time2["value"] = "%d secs" % self._Time2
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ class InfoPage(Page):
|
|||||||
time3["key"] = "time3"
|
time3["key"] = "time3"
|
||||||
|
|
||||||
if self._Time3 == 0:
|
if self._Time3 == 0:
|
||||||
time3["value"] = "Never"
|
time3["value"] = MyLangManager.Tr("Never")
|
||||||
else:
|
else:
|
||||||
time3["value"] = "%d secs" % self._Time3
|
time3["value"] = "%d secs" % self._Time3
|
||||||
time3["label"] = "Power OFF"
|
time3["label"] = "Power OFF"
|
||||||
@ -189,17 +189,17 @@ class InfoPage(Page):
|
|||||||
start_y = 0
|
start_y = 0
|
||||||
|
|
||||||
for i,v in enumerate( self._AList):
|
for i,v in enumerate( self._AList):
|
||||||
print(v)
|
#print(v)
|
||||||
li = PageListItem()
|
li = PageListItem()
|
||||||
li._Parent = self
|
li._Parent = self
|
||||||
li._PosX = start_x
|
li._PosX = start_x
|
||||||
li._PosY = start_y + i*PageListItem._Height
|
li._PosY = start_y + i*PageListItem._Height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MyLangManager.TrFont("varela12")
|
||||||
|
|
||||||
if self._AList[v]["label"] != "":
|
if self._AList[v]["label"] != "":
|
||||||
li.Init( self._AList[v]["label"] )
|
li.Init( self._AList[v]["label"] )
|
||||||
else:
|
else:
|
||||||
li.Init( self._AList[v]["key"] )
|
li.Init( self._AList[v]["key"] )
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ class InfoPage(Page):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
@ -289,9 +289,9 @@ class InfoPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
class PowerOptionsPage(Page):
|
class PowerOptionsPage(Page):
|
||||||
_FootMsg = ["Nav.","","Detail","Back","Select"]
|
_FootMsg = ["Nav","Detail","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ class PowerOptionsPage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
done = IconItem()
|
done = IconItem()
|
||||||
done._ImgSurf = MyIconPool._Icons["done"]
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done._MyType = ICON_TYPES["STAT"]
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
done._Parent = self
|
done._Parent = self
|
||||||
self._Icons["done"] = done
|
self._Icons["done"] = done
|
||||||
@ -401,30 +401,6 @@ class PowerOptionsPage(Page):
|
|||||||
self._InfoPage._Screen = self._Screen
|
self._InfoPage._Screen = self._Screen
|
||||||
self._InfoPage._Name = "Power option detail"
|
self._InfoPage._Name = "Power option detail"
|
||||||
self._InfoPage.Init()
|
self._InfoPage.Init()
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
@ -445,11 +421,11 @@ class PowerOptionsPage(Page):
|
|||||||
config.PowerLevel = cur_li._Value
|
config.PowerLevel = cur_li._Value
|
||||||
|
|
||||||
if config.PowerLevel!= "supersaving":
|
if config.PowerLevel!= "supersaving":
|
||||||
os.system("sudo iw wlan0 set power_save off")
|
os.system("sudo iw wlan0 set power_save off > /dev/null")
|
||||||
else:
|
else:
|
||||||
os.system("sudo iw wlan0 set power_save on")
|
os.system("sudo iw wlan0 set power_save on > /dev/null")
|
||||||
|
|
||||||
self._Screen._MsgBox.SetText("Applying...")
|
self._Screen._MsgBox.SetText("Applying")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
@ -484,12 +460,12 @@ class PowerOptionsPage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
"""
|
"""
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.Click()
|
self.Click()
|
||||||
|
|
||||||
if event.key == CurKeys["Up"]:
|
if event.key == CurKeys["Up"]:
|
||||||
@ -545,7 +521,7 @@ class PowerOptionsPage(Page):
|
|||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
if self._HWND != None:
|
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 ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|||||||
294
Menu/GameShell/10_Settings/Skins/__init__.py
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import pygame
|
||||||
|
#import commands
|
||||||
|
import glob
|
||||||
|
#from beeprint import pp
|
||||||
|
from libs.roundrects import aa_round_rect
|
||||||
|
|
||||||
|
## local UI import
|
||||||
|
from UI.constants import Width,Height,ICON_TYPES,RESTARTUI
|
||||||
|
from UI.page import Page,PageSelector
|
||||||
|
from UI.label import Label
|
||||||
|
from UI.util_funcs import midRect,FileExists
|
||||||
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
|
from UI.scroller import ListScroller
|
||||||
|
from UI.icon_pool import MyIconPool
|
||||||
|
from UI.icon_item import IconItem
|
||||||
|
from UI.multilabel import MultiLabel
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.info_page_list_item import InfoPageListItem
|
||||||
|
from UI.info_page_selector import InfoPageSelector
|
||||||
|
|
||||||
|
import config
|
||||||
|
|
||||||
|
class ListPageSelector(InfoPageSelector):
|
||||||
|
def Draw(self):
|
||||||
|
idx = self._Parent._PsIndex
|
||||||
|
|
||||||
|
if idx < len(self._Parent._MyList):
|
||||||
|
x = self._Parent._MyList[idx]._PosX+2 ## ++
|
||||||
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
|
self._PosX = x
|
||||||
|
self._PosY = y
|
||||||
|
self._Height = h
|
||||||
|
|
||||||
|
aa_round_rect(self._Parent._CanvasHWND,
|
||||||
|
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
||||||
|
|
||||||
|
|
||||||
|
class PageListItem(InfoPageListItem):
|
||||||
|
_PosX = 0
|
||||||
|
_PosY = 0
|
||||||
|
_Width = 0
|
||||||
|
_Height = 30
|
||||||
|
|
||||||
|
_Labels = {}
|
||||||
|
_Icons = {}
|
||||||
|
_Fonts = {}
|
||||||
|
|
||||||
|
_LinkObj = None
|
||||||
|
|
||||||
|
_Active = False
|
||||||
|
_Value = ""
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self._Labels["Text"]._PosY = self._PosY+ (self._Height- self._Labels["Text"]._Height)/2
|
||||||
|
|
||||||
|
if self._Active == True:
|
||||||
|
self._Parent._Icons["done"].NewCoord( self._Parent._Width-30,self._PosY+5)
|
||||||
|
self._Parent._Icons["done"].Draw()
|
||||||
|
|
||||||
|
self._Labels["Text"].Draw(self._Active)
|
||||||
|
|
||||||
|
if "Small" in self._Labels:
|
||||||
|
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width -10
|
||||||
|
self._Labels["Small"]._PosY = self._PosY + (self._Height- self._Labels["Small"]._Height)/2
|
||||||
|
self._Labels["Small"].Draw()
|
||||||
|
|
||||||
|
pygame.draw.line(self._Parent._CanvasHWND,MySkinManager.GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
||||||
|
|
||||||
|
class SkinsPage(Page):
|
||||||
|
_FootMsg = ["Nav","","Scan","Back","Select"]
|
||||||
|
_MyList = []
|
||||||
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
|
_AList = {}
|
||||||
|
|
||||||
|
_Scrolled = 0
|
||||||
|
|
||||||
|
_BGwidth = 320
|
||||||
|
_BGheight = 240-24-20
|
||||||
|
|
||||||
|
_DrawOnce = False
|
||||||
|
_Scroller = None
|
||||||
|
_InfoPage = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
Page.__init__(self)
|
||||||
|
self._Icons = {}
|
||||||
|
|
||||||
|
def GenList(self):
|
||||||
|
self._MyList = []
|
||||||
|
|
||||||
|
start_x = 0
|
||||||
|
start_y = 0
|
||||||
|
last_height = 0
|
||||||
|
|
||||||
|
|
||||||
|
skins = [["../skin/default","Default"]]
|
||||||
|
files_path = glob.glob("/home/cpi/skins/*")
|
||||||
|
|
||||||
|
for i ,v in enumerate(files_path):
|
||||||
|
if os.path.isdir(v):
|
||||||
|
bname = os.path.basename(v)
|
||||||
|
print(v,bname)
|
||||||
|
skins.append([v,bname])
|
||||||
|
|
||||||
|
for i,u in enumerate( skins ):
|
||||||
|
#print(i,u)
|
||||||
|
li = PageListItem()
|
||||||
|
li._Parent = self
|
||||||
|
li._PosX = start_x
|
||||||
|
li._PosY = start_y + last_height
|
||||||
|
li._Width = Width
|
||||||
|
li._Fonts["normal"] = self._ListFont
|
||||||
|
li._Active = False
|
||||||
|
li._Value = u[0]
|
||||||
|
li.Init( u[1] )
|
||||||
|
|
||||||
|
last_height += li._Height
|
||||||
|
|
||||||
|
self._MyList.append(li)
|
||||||
|
|
||||||
|
def Init(self):
|
||||||
|
if self._Screen != None:
|
||||||
|
if self._Screen._CanvasHWND != None and self._CanvasHWND == None:
|
||||||
|
self._HWND = self._Screen._CanvasHWND
|
||||||
|
self._CanvasHWND = pygame.Surface( (self._Screen._Width,self._BGheight) )
|
||||||
|
|
||||||
|
self._PosX = self._Index*self._Screen._Width
|
||||||
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
|
done = IconItem()
|
||||||
|
done._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
|
done._MyType = ICON_TYPES["STAT"]
|
||||||
|
done._Parent = self
|
||||||
|
self._Icons["done"] = done
|
||||||
|
|
||||||
|
ps = ListPageSelector()
|
||||||
|
ps._Parent = self
|
||||||
|
self._Ps = ps
|
||||||
|
self._PsIndex = 0
|
||||||
|
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
self._Scroller = ListScroller()
|
||||||
|
self._Scroller._Parent = self
|
||||||
|
self._Scroller._PosX = self._Width - 10
|
||||||
|
self._Scroller._PosY = 2
|
||||||
|
self._Scroller.Init()
|
||||||
|
self._Scroller.SetCanvasHWND(self._HWND)
|
||||||
|
|
||||||
|
def Click(self):
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
cur_li = self._MyList[self._PsIndex]
|
||||||
|
if cur_li._Active == True:
|
||||||
|
return
|
||||||
|
|
||||||
|
print(cur_li._Value)
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
cur_li._Active = True
|
||||||
|
self._Screen._MsgBox.SetText("Applying")
|
||||||
|
self._Screen._MsgBox.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if "../skin/default" in cur_li._Value:
|
||||||
|
os.system("rm %s/.gameshell_skin" % os.path.expanduser('~') )
|
||||||
|
else:
|
||||||
|
os.system("echo %s > %s/.gameshell_skin" % (cur_li._Value,os.path.expanduser('~') ))
|
||||||
|
|
||||||
|
pygame.time.delay(700)
|
||||||
|
pygame.event.post( pygame.event.Event(RESTARTUI, message=""))
|
||||||
|
|
||||||
|
def OnLoadCb(self):
|
||||||
|
self._Scrolled = 0
|
||||||
|
self._PosY = 0
|
||||||
|
self._DrawOnce = False
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
if config.SKIN in i._Value:
|
||||||
|
i._Active = True
|
||||||
|
|
||||||
|
def OnReturnBackCb(self):
|
||||||
|
pass
|
||||||
|
"""
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
"""
|
||||||
|
def KeyDown(self,event):
|
||||||
|
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
|
self.ReturnToUpLevelPage()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if IsKeyStartOrA(event.key):
|
||||||
|
self.Click()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Up"]:
|
||||||
|
self.ScrollUp()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["Down"]:
|
||||||
|
self.ScrollDown()
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
if event.key == CurKeys["X"]:
|
||||||
|
self.GenList()
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
i._Active = False
|
||||||
|
|
||||||
|
for i in self._MyList:
|
||||||
|
if config.SKIN in i._Value:
|
||||||
|
i._Active = True
|
||||||
|
|
||||||
|
self._Screen.Draw()
|
||||||
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
def Draw(self):
|
||||||
|
|
||||||
|
self.ClearCanvas()
|
||||||
|
if len(self._MyList) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
else:
|
||||||
|
if len(self._MyList) * PageListItem._Height > self._Height:
|
||||||
|
self._Ps._Width = self._Width - 11
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
self._Scroller.UpdateSize( len(self._MyList)*PageListItem._Height, self._PsIndex*PageListItem._Height)
|
||||||
|
self._Scroller.Draw()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self._Ps._Width = self._Width
|
||||||
|
self._Ps.Draw()
|
||||||
|
for i in self._MyList:
|
||||||
|
if i._PosY > self._Height + self._Height/2:
|
||||||
|
break
|
||||||
|
if i._PosY < 0:
|
||||||
|
continue
|
||||||
|
i.Draw()
|
||||||
|
|
||||||
|
if self._HWND != None:
|
||||||
|
self._HWND.fill(MySkinManager.GiveColor("White"))
|
||||||
|
|
||||||
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|
||||||
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
_Page = None
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def Init(self,main_screen):
|
||||||
|
self._Page = SkinsPage()
|
||||||
|
self._Page._Screen = main_screen
|
||||||
|
self._Page._Name ="Skin selection"
|
||||||
|
self._Page.Init()
|
||||||
|
|
||||||
|
def API(self,main_screen):
|
||||||
|
if main_screen !=None:
|
||||||
|
main_screen.PushPage(self._Page)
|
||||||
|
main_screen.Draw()
|
||||||
|
main_screen.SwapAndShow()
|
||||||
|
|
||||||
|
OBJ = APIOBJ()
|
||||||
|
def Init(main_screen):
|
||||||
|
OBJ.Init(main_screen)
|
||||||
|
def API(main_screen):
|
||||||
|
OBJ.API(main_screen)
|
||||||
|
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ import myvars
|
|||||||
def InitSoundPage(main_screen):
|
def InitSoundPage(main_screen):
|
||||||
|
|
||||||
myvars.SoundPage = SoundPage()
|
myvars.SoundPage = SoundPage()
|
||||||
|
|
||||||
myvars.SoundPage._Screen = main_screen
|
myvars.SoundPage._Screen = main_screen
|
||||||
myvars.SoundPage._Name = "Sound volume"
|
myvars.SoundPage._Name = "Sound Volume"
|
||||||
myvars.SoundPage.Init()
|
myvars.SoundPage.Init()
|
||||||
|
|||||||
@ -11,9 +11,8 @@ from UI.constants import Width,Height,ICON_TYPES
|
|||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
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.slider import Slider
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ class SoundSlider(Slider):
|
|||||||
self._Height = self._Parent._Height
|
self._Height = self._Parent._Height
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["vol"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("vol")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
@ -54,7 +53,7 @@ class SoundSlider(Slider):
|
|||||||
self._Scale = MultiIconItem()
|
self._Scale = MultiIconItem()
|
||||||
self._Scale._MyType = ICON_TYPES["STAT"]
|
self._Scale._MyType = ICON_TYPES["STAT"]
|
||||||
self._Scale._Parent = self
|
self._Scale._Parent = self
|
||||||
self._Scale._ImgSurf = MyIconPool._Icons["scale"]
|
self._Scale._ImgSurf = MyIconPool.GiveIconSurface("scale")
|
||||||
self._Scale._IconWidth = 82
|
self._Scale._IconWidth = 82
|
||||||
self._Scale._IconHeight = 63
|
self._Scale._IconHeight = 63
|
||||||
self._Scale.Adjust(0,0,82,63,0)
|
self._Scale.Adjust(0,0,82,63,0)
|
||||||
@ -83,7 +82,7 @@ class SoundSlider(Slider):
|
|||||||
if self._Value < 0:
|
if self._Value < 0:
|
||||||
self._Value = 0
|
self._Value = 0
|
||||||
|
|
||||||
vol = self.snd_segs[self._Value][0]
|
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 self.OnChangeCB != None:
|
||||||
if callable(self.OnChangeCB):
|
if callable(self.OnChangeCB):
|
||||||
@ -113,7 +112,6 @@ class SoundPage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
self._MySlider = SoundSlider()
|
self._MySlider = SoundSlider()
|
||||||
|
|
||||||
|
|
||||||
self._MySlider._Parent = self
|
self._MySlider._Parent = self
|
||||||
self._MySlider.SetCanvasHWND(self._CanvasHWND)
|
self._MySlider.SetCanvasHWND(self._CanvasHWND)
|
||||||
@ -123,19 +121,19 @@ class SoundPage(Page):
|
|||||||
self._MySlider.Init()
|
self._MySlider.Init()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
m = alsaaudio.Mixer()
|
m = alsaaudio.Mixer()
|
||||||
self._MySlider.SetValue(m.getvolume()[0])
|
self._MySlider.SetValue(m.getvolume()[0])
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
self._MySlider.SetValue(0)
|
self._MySlider.SetValue(0)
|
||||||
|
|
||||||
|
|
||||||
def OnLoadCb(self):
|
def OnLoadCb(self):
|
||||||
try:
|
try:
|
||||||
m = alsaaudio.Mixer()
|
m = alsaaudio.Mixer()
|
||||||
self._MySlider.SetValue(m.getvolume()[0])
|
self._MySlider.SetValue(m.getvolume()[0])
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
|
||||||
def WhenSliderDrag(self,value): ##value 0-100
|
def WhenSliderDrag(self,value): ##value 0-100
|
||||||
if value < 0 or value > 100:
|
if value < 0 or value > 100:
|
||||||
@ -146,7 +144,7 @@ class SoundPage(Page):
|
|||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|||||||
@ -6,12 +6,11 @@ import os
|
|||||||
|
|
||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
from UI.constants import ICON_TYPES,Width,Height
|
from UI.constants import ICON_TYPES,Width,Height
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
|
|
||||||
from libs.roundrects import aa_round_rect
|
from libs.roundrects import aa_round_rect
|
||||||
@ -28,7 +27,7 @@ class StoragePage(Page):
|
|||||||
_BGmsg = "%.1fGB of %.1fGB Used"
|
_BGmsg = "%.1fGB of %.1fGB Used"
|
||||||
_DskUsg = None
|
_DskUsg = None
|
||||||
|
|
||||||
_HighColor = SkinManager().GiveColor('High')
|
_HighColor = MySkinManager.GiveColor('High')
|
||||||
_FootMsg = ["Nav.","","","Back",""]
|
_FootMsg = ["Nav.","","","Back",""]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -55,11 +54,11 @@ class StoragePage(Page):
|
|||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["icon_sd"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("icon_sd")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
|
|
||||||
self._BGpng.AddLabel(self._BGmsg % (self._DskUsg[1]-self._DskUsg[0], self._DskUsg[1]), fonts["varela15"])
|
self._BGpng.AddLabel(self._BGmsg % (self._DskUsg[1]-self._DskUsg[0], self._DskUsg[1]), MySkinManager.GiveFont("varela15"))
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
|
|
||||||
|
|
||||||
@ -68,12 +67,12 @@ class StoragePage(Page):
|
|||||||
|
|
||||||
usage_percent = (self._DskUsg[0]/self._DskUsg[1] )*100.0
|
usage_percent = (self._DskUsg[0]/self._DskUsg[1] )*100.0
|
||||||
|
|
||||||
self._BGlabel.Init("%d%%"% int(usage_percent),fonts["varela25"])
|
self._BGlabel.Init("%d%%"% int(usage_percent),MySkinManager.GiveFont("varela25"))
|
||||||
self._BGlabel.SetColor( self._HighColor )
|
self._BGlabel.SetColor( self._HighColor )
|
||||||
|
|
||||||
self._FreeLabel = Label()
|
self._FreeLabel = Label()
|
||||||
self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
|
self._FreeLabel.SetCanvasHWND(self._CanvasHWND)
|
||||||
self._FreeLabel.Init("Free",fonts["varela13"])
|
self._FreeLabel.Init("Free",MySkinManager.GiveFont("varela13"))
|
||||||
self._FreeLabel.SetColor(self._BGlabel._Color)
|
self._FreeLabel.SetColor(self._BGlabel._Color)
|
||||||
|
|
||||||
|
|
||||||
@ -99,7 +98,7 @@ class StoragePage(Page):
|
|||||||
|
|
||||||
rect_ = midRect(self._Width/2,self._Height-30,170,17, Width,Height)
|
rect_ = midRect(self._Width/2,self._Height-30,170,17, Width,Height)
|
||||||
|
|
||||||
aa_round_rect(self._CanvasHWND, rect_, SkinManager().GiveColor('Line'), 5, 0, SkinManager().GiveColor('Line'))
|
aa_round_rect(self._CanvasHWND, rect_, MySkinManager.GiveColor('Line'), 5, 0, MySkinManager.GiveColor('Line'))
|
||||||
|
|
||||||
|
|
||||||
rect2 = midRect(self._Width/2,self._Height-30,int(170*(1.0-usage_percent)),17, Width,Height)
|
rect2 = midRect(self._Width/2,self._Height-30,int(170*(1.0-usage_percent)),17, Width,Height)
|
||||||
@ -107,7 +106,7 @@ class StoragePage(Page):
|
|||||||
rect2.left = rect_.left
|
rect2.left = rect_.left
|
||||||
rect2.top = rect_.top
|
rect2.top = rect_.top
|
||||||
|
|
||||||
aa_round_rect(self._CanvasHWND,rect2, SkinManager().GiveColor('Front'),5,0,SkinManager().GiveColor('Front'))
|
aa_round_rect(self._CanvasHWND,rect2, MySkinManager.GiveColor('Front'),5,0,MySkinManager.GiveColor('Front'))
|
||||||
|
|
||||||
class APIOBJ(object):
|
class APIOBJ(object):
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,9 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import ICON_TYPES
|
from UI.constants import ICON_TYPES
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
# a item for List
|
# a item for List
|
||||||
# - - - - - - - - - - - --
|
# - - - - - - - - - - - --
|
||||||
@ -32,7 +31,7 @@ class ListItemIcon(IconItem):
|
|||||||
|
|
||||||
class ListItemLabel(Label):
|
class ListItemLabel(Label):
|
||||||
|
|
||||||
_ActiveColor = SkinManager().GiveColor('Active')
|
_ActiveColor = MySkinManager.GiveColor('Active')
|
||||||
_Active = False
|
_Active = False
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
|
|
||||||
@ -107,7 +106,7 @@ class ListItem(object):
|
|||||||
|
|
||||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
||||||
|
|
||||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
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()
|
self._Labels["Text"].Draw()
|
||||||
|
|
||||||
|
|||||||
@ -10,15 +10,14 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
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.multi_icon_item import MultiIconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
from list_item import ListItem
|
from list_item import ListItem
|
||||||
|
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ class TimeLibStack:
|
|||||||
return len(self.stack)
|
return len(self.stack)
|
||||||
|
|
||||||
class ListPageSelector(PageSelector):
|
class ListPageSelector(PageSelector):
|
||||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
self._PosX = 0
|
||||||
@ -86,7 +85,7 @@ class TimezoneListPage(Page):
|
|||||||
_FootMsg = ["Nav","","","Back","Select"]
|
_FootMsg = ["Nav","","","Back","Select"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_SwapMyList = []
|
_SwapMyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
_MyStack = None
|
_MyStack = None
|
||||||
|
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
@ -177,7 +176,7 @@ class TimezoneListPage(Page):
|
|||||||
self.SyncList("/usr/share/zoneinfo/posix")
|
self.SyncList("/usr/share/zoneinfo/posix")
|
||||||
|
|
||||||
icon_for_list = MultiIconItem()
|
icon_for_list = MultiIconItem()
|
||||||
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
|
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
|
||||||
icon_for_list._MyType = ICON_TYPES["STAT"]
|
icon_for_list._MyType = ICON_TYPES["STAT"]
|
||||||
icon_for_list._Parent = self
|
icon_for_list._Parent = self
|
||||||
|
|
||||||
@ -186,11 +185,11 @@ class TimezoneListPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.AddLabel("No timezones found on system!", fonts["varela22"])
|
self._BGpng.AddLabel("No timezones found on system!", MyLangManager.TrFont("varela22"))
|
||||||
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
|
|
||||||
|
|
||||||
@ -200,35 +199,6 @@ class TimezoneListPage(Page):
|
|||||||
self._Scroller._PosY = 2
|
self._Scroller._PosY = 2
|
||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
|
|
||||||
|
|
||||||
def ScrollUp(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex -= Step
|
|
||||||
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
dy = tmp-self._PsIndex
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex +=Step
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
dy = self._PsIndex - tmp
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
@ -259,7 +229,7 @@ class TimezoneListPage(Page):
|
|||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
|
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
@ -275,16 +245,16 @@ class TimezoneListPage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Right"]:
|
if event.key == CurKeys["Right"]:
|
||||||
self.ScrollDown(Step=5)
|
self.FScrollDown(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Left"]:
|
if event.key == CurKeys["Left"]:
|
||||||
self.ScrollUp(Step=5)
|
self.FScrollUp(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.Click()
|
self.Click()
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
|
|||||||
@ -9,23 +9,27 @@ import gobject
|
|||||||
|
|
||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page
|
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_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,CmdClean,get_git_revision_short_hash
|
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.confirm_page import ConfirmPage
|
||||||
from UI.download import Download
|
from UI.download import Download
|
||||||
from UI.download_process_page import DownloadProcessPage
|
from UI.download_process_page import DownloadProcessPage
|
||||||
from UI.skin_manager import SkinManager
|
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.roundrects import aa_round_rect
|
||||||
from libs.DBUS import is_wifi_connected_now
|
from libs.DBUS import is_wifi_connected_now
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
|
LauncherLoc = "/home/cpi/launcher"
|
||||||
|
|
||||||
class UpdateDownloadPage(DownloadProcessPage):
|
class UpdateDownloadPage(DownloadProcessPage):
|
||||||
_MD5 = ""
|
_MD5 = ""
|
||||||
|
|
||||||
@ -39,7 +43,7 @@ class UpdateDownloadPage(DownloadProcessPage):
|
|||||||
|
|
||||||
if filename.endswith(".tar.gz"):
|
if filename.endswith(".tar.gz"):
|
||||||
#/home/cpi/apps/[launcher]
|
#/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))
|
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
||||||
|
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
@ -60,7 +64,7 @@ class UpdateDownloadPage(DownloadProcessPage):
|
|||||||
print(filename)
|
print(filename)
|
||||||
os.system("rm -rf %s" % CmdClean(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._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
return False
|
return False
|
||||||
@ -105,22 +109,22 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
_GIT = False
|
_GIT = False
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
global LauncherLoc
|
||||||
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
if self._GIT == True:
|
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
|
cmdpath = "%s/update.sh %s" % (LauncherLoc,self._Version)
|
||||||
pygame.event.post( pygame.event.Event(RUNEVT, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSH, message=cmdpath))
|
||||||
self._GIT = False
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._DownloadPage == None:
|
if self._DownloadPage == None:
|
||||||
self._DownloadPage = UpdateDownloadPage()
|
self._DownloadPage = UpdateDownloadPage()
|
||||||
self._DownloadPage._Screen = self._Screen
|
self._DownloadPage._Screen = self._Screen
|
||||||
self._DownloadPage._Name = "Downloading..."
|
self._DownloadPage._Name = "Downloading"
|
||||||
self._DownloadPage.Init()
|
self._DownloadPage.Init()
|
||||||
|
|
||||||
self._DownloadPage._MD5 = self._MD5
|
self._DownloadPage._MD5 = self._MD5
|
||||||
@ -148,65 +152,14 @@ class UpdateConfirmPage(ConfirmPage):
|
|||||||
self.Reset()
|
self.Reset()
|
||||||
|
|
||||||
|
|
||||||
class InfoPageListItem(object):
|
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 30
|
|
||||||
|
|
||||||
_Labels = {}
|
|
||||||
_Icons = {}
|
|
||||||
_Fonts = {}
|
|
||||||
|
|
||||||
_LinkObj = None
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self._Labels = {}
|
|
||||||
self._Icons = {}
|
|
||||||
self._Fonts = {}
|
|
||||||
|
|
||||||
def SetSmallText(self,text):
|
|
||||||
|
|
||||||
l = Label()
|
|
||||||
l._PosX = 40
|
|
||||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
|
||||||
l.Init(text,self._Fonts["small"])
|
|
||||||
self._Labels["Small"] = l
|
|
||||||
|
|
||||||
def Init(self,text):
|
|
||||||
|
|
||||||
#self._Fonts["normal"] = fonts["veramono12"]
|
|
||||||
|
|
||||||
l = Label()
|
|
||||||
l._PosX = 10
|
|
||||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
|
||||||
|
|
||||||
l.Init(text,self._Fonts["normal"])
|
|
||||||
self._Labels["Text"] = l
|
|
||||||
|
|
||||||
def Draw(self):
|
|
||||||
|
|
||||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
|
||||||
self._Labels["Text"].Draw()
|
|
||||||
|
|
||||||
if "Small" in self._Labels:
|
|
||||||
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width-5
|
|
||||||
|
|
||||||
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
|
|
||||||
self._Labels["Small"].Draw()
|
|
||||||
|
|
||||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
|
||||||
|
|
||||||
|
|
||||||
class UpdatePage(Page):
|
class UpdatePage(Page):
|
||||||
_Icons = {}
|
_Icons = {}
|
||||||
_FootMsg = ["Nav.","Check Update","","Back",""]
|
_FootMsg = ["Nav","","Check Update","Back",""]
|
||||||
|
|
||||||
_ListFontObj = fonts["varela15"]
|
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||||
_ConfirmPage = None
|
_ConfirmPage = None
|
||||||
_AList = {}
|
_AList = {}
|
||||||
_MyList = []
|
_MyList = []
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Page.__init__(self)
|
Page.__init__(self)
|
||||||
self._Icons = {}
|
self._Icons = {}
|
||||||
@ -223,7 +176,7 @@ class UpdatePage(Page):
|
|||||||
li._PosY = start_y + i*InfoPageListItem._Height
|
li._PosY = start_y + i*InfoPageListItem._Height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MySkinManager.GiveFont("varela12")
|
||||||
|
|
||||||
if self._AList[v]["label"] != "":
|
if self._AList[v]["label"] != "":
|
||||||
li.Init( self._AList[v]["label"] )
|
li.Init( self._AList[v]["label"] )
|
||||||
@ -256,7 +209,8 @@ class UpdatePage(Page):
|
|||||||
self.GenList()
|
self.GenList()
|
||||||
|
|
||||||
def CheckUpdate(self):
|
def CheckUpdate(self):
|
||||||
self._Screen._MsgBox.SetText("Checking update...")
|
global LauncherLoc
|
||||||
|
self._Screen._MsgBox.SetText("CheckingUpdate")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
@ -280,12 +234,12 @@ class UpdatePage(Page):
|
|||||||
self._Screen.PushPage(self._ConfirmPage)
|
self._Screen.PushPage(self._ConfirmPage)
|
||||||
|
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._ConfirmPage.SnapMsg("Confirm Update to %s ?" % json_["version"] )
|
self._ConfirmPage.SnapMsg(MyLangManager.Tr("ConfirmUpdateToFQ") % json_["version"] )
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
elif "gitversion" in json_: ### just use git to run update
|
elif "gitversion" in json_: ### just use git to run update
|
||||||
cur_dir = os.getcwd()
|
cur_dir = os.getcwd()
|
||||||
os.chdir("/home/cpi/apps/launcher")
|
os.chdir(LauncherLoc)
|
||||||
current_git_version = get_git_revision_short_hash()
|
current_git_version = get_git_revision_short_hash()
|
||||||
current_git_version = current_git_version.strip("\n")
|
current_git_version = current_git_version.strip("\n")
|
||||||
current_git_version = current_git_version.strip("\t")
|
current_git_version = current_git_version.strip("\t")
|
||||||
@ -299,11 +253,11 @@ class UpdatePage(Page):
|
|||||||
self._Screen.PushPage(self._ConfirmPage)
|
self._Screen.PushPage(self._ConfirmPage)
|
||||||
|
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._ConfirmPage.SnapMsg("Update to %s ?" % json_["gitversion"] )
|
self._ConfirmPage.SnapMsg(MyLangManager.Tr("UpdateToFQ") % json_["gitversion"] )
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
else:
|
else:
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen._MsgBox.SetText("Launcher is up to date")
|
self._Screen._MsgBox.SetText("LauncherIsUpToDate")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
pygame.time.delay(765)
|
pygame.time.delay(765)
|
||||||
@ -322,7 +276,7 @@ class UpdatePage(Page):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
@ -334,12 +288,12 @@ class UpdatePage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
else:
|
else:
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen._MsgBox.SetText("Checking update failed")
|
self._Screen._MsgBox.SetText("CheckingUpdateFailed")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
else:
|
else:
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen._MsgBox.SetText("Please Check your Wi-Fi connection")
|
self._Screen._MsgBox.SetText("CheckWifiConnection")
|
||||||
self._Screen._MsgBox.Draw()
|
self._Screen._MsgBox.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
@ -360,7 +314,7 @@ class APIOBJ(object):
|
|||||||
self._UpdatePage = UpdatePage()
|
self._UpdatePage = UpdatePage()
|
||||||
|
|
||||||
self._UpdatePage._Screen = main_screen
|
self._UpdatePage._Screen = main_screen
|
||||||
self._UpdatePage._Name ="Update"
|
self._UpdatePage._Name = "Update Launcher"
|
||||||
self._UpdatePage.Init()
|
self._UpdatePage.Init()
|
||||||
|
|
||||||
def API(self,main_screen):
|
def API(self,main_screen):
|
||||||
|
|||||||
@ -13,7 +13,8 @@ except:
|
|||||||
def Init(main_screen):
|
def Init(main_screen):
|
||||||
pages.InitPasswordPage(main_screen)
|
pages.InitPasswordPage(main_screen)
|
||||||
pages.InitScanPage(main_screen)
|
pages.InitScanPage(main_screen)
|
||||||
|
myvars.PasswordPage._Caller = myvars.ScanPage
|
||||||
|
|
||||||
def API(main_screen):
|
def API(main_screen):
|
||||||
|
|
||||||
if main_screen != None:
|
if main_screen != None:
|
||||||
|
|||||||
@ -5,12 +5,11 @@ import pygame
|
|||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.multi_icon_item import MultiIconItem
|
from UI.multi_icon_item import MultiIconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.widget import Widget
|
||||||
|
|
||||||
class NetItemMultiIcon(MultiIconItem):
|
class NetItemMultiIcon(MultiIconItem):
|
||||||
_CanvasHWND = None
|
_CanvasHWND = None
|
||||||
@ -33,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))
|
self._CanvasHWND.blit(self._ImgSurf,(self._PosX,self._PosY+(self._Parent._Height-self._Height)/2,self._Width,self._Height))
|
||||||
|
|
||||||
|
|
||||||
class NetItem(object):
|
class NetItem(Widget):
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 30
|
_Height = 30
|
||||||
|
|
||||||
_Bssid="" # 50:3A:A0:51:18:3C
|
_Bssid="" # 50:3A:A0:51:18:3C
|
||||||
@ -141,13 +137,13 @@ class NetItem(object):
|
|||||||
|
|
||||||
|
|
||||||
lock_icon = NetItemIcon()
|
lock_icon = NetItemIcon()
|
||||||
lock_icon._ImgSurf = MyIconPool._Icons["lock"]
|
lock_icon._ImgSurf = MyIconPool.GiveIconSurface("lock")
|
||||||
lock_icon._CanvasHWND = self._Parent._CanvasHWND
|
lock_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
lock_icon._Parent = self
|
lock_icon._Parent = self
|
||||||
self._Icons["lock"] = lock_icon
|
self._Icons["lock"] = lock_icon
|
||||||
|
|
||||||
done_icon = NetItemIcon()
|
done_icon = NetItemIcon()
|
||||||
done_icon._ImgSurf = MyIconPool._Icons["done"]
|
done_icon._ImgSurf = MyIconPool.GiveIconSurface("done")
|
||||||
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
done_icon._CanvasHWND = self._Parent._CanvasHWND
|
||||||
done_icon._Parent = self
|
done_icon._Parent = self
|
||||||
|
|
||||||
@ -195,6 +191,6 @@ class NetItem(object):
|
|||||||
self._Icons["wifistatus"].NewCoord(self._Width-23,self._PosY)
|
self._Icons["wifistatus"].NewCoord(self._Width-23,self._PosY)
|
||||||
self._Icons["wifistatus"].Draw()
|
self._Icons["wifistatus"].Draw()
|
||||||
|
|
||||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
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
|
## local UI import
|
||||||
from libs.DBUS import bus,daemon,wireless,wired
|
from libs.DBUS import bus,daemon,wireless,wired
|
||||||
|
|
||||||
from keyboard import Keyboard
|
from UI.keyboard import Keyboard
|
||||||
from wifi_list import WifiList
|
from wifi_list import WifiList
|
||||||
|
|
||||||
import myvars
|
import myvars
|
||||||
|
|||||||
@ -10,81 +10,34 @@ from wicd import misc
|
|||||||
from UI.constants import Width,Height
|
from UI.constants import Width,Height
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
from UI.util_funcs import midRect,SwapAndShow,FileExists,ReadTheFileContent
|
||||||
from UI.util_funcs import midRect,SwapAndShow
|
from UI.keys_def import CurKeys, IsKeyStartOrA, IsKeyMenuOrB
|
||||||
from UI.keys_def import CurKeys
|
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.confirm_page import ConfirmPage
|
from UI.confirm_page import ConfirmPage
|
||||||
from UI.skin_manager import SkinManager
|
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
|
from net_item import NetItem
|
||||||
|
|
||||||
import myvars
|
import myvars
|
||||||
|
|
||||||
|
|
||||||
class InfoPageListItem(object):
|
|
||||||
_PosX = 0
|
|
||||||
_PosY = 0
|
|
||||||
_Width = 0
|
|
||||||
_Height = 30
|
|
||||||
|
|
||||||
_Labels = {}
|
|
||||||
_Icons = {}
|
|
||||||
_Fonts = {}
|
|
||||||
|
|
||||||
_LinkObj = None
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self._Labels = {}
|
|
||||||
self._Icons = {}
|
|
||||||
self._Fonts = {}
|
|
||||||
|
|
||||||
def SetSmallText(self,text):
|
|
||||||
|
|
||||||
l = Label()
|
|
||||||
l._PosX = 40
|
|
||||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
|
||||||
l.Init(text,self._Fonts["small"])
|
|
||||||
self._Labels["Small"] = l
|
|
||||||
|
|
||||||
def Init(self,text):
|
|
||||||
|
|
||||||
#self._Fonts["normal"] = fonts["veramono12"]
|
|
||||||
|
|
||||||
l = Label()
|
|
||||||
l._PosX = 10
|
|
||||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
|
||||||
|
|
||||||
l.Init(text,self._Fonts["normal"])
|
|
||||||
self._Labels["Text"] = l
|
|
||||||
|
|
||||||
def Draw(self):
|
|
||||||
|
|
||||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
|
||||||
self._Labels["Text"].Draw()
|
|
||||||
|
|
||||||
if "Small" in self._Labels:
|
|
||||||
self._Labels["Small"]._PosX = self._Width - self._Labels["Small"]._Width-5
|
|
||||||
|
|
||||||
self._Labels["Small"]._PosY = self._PosY + (self._Height - self._Labels["Small"]._Height)/2
|
|
||||||
self._Labels["Small"].Draw()
|
|
||||||
|
|
||||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WifiDisconnectConfirmPage(ConfirmPage):
|
class WifiDisconnectConfirmPage(ConfirmPage):
|
||||||
|
|
||||||
_ConfirmText = "Confirm Disconnect?"
|
_ConfirmText = MyLangManager.Tr("ConfirmDisconnectQ")
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.SnapMsg("Disconnecting...")
|
self.SnapMsg(MyLangManager.Tr("Disconnecting"))
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
@ -105,36 +58,10 @@ class WifiDisconnectConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
self.Reset()
|
self.Reset()
|
||||||
|
|
||||||
class WifiInfoPageSelector(PageSelector):
|
|
||||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self._PosX = 0
|
|
||||||
self._PosY = 0
|
|
||||||
self._Height = 0
|
|
||||||
self._Width = Width
|
|
||||||
|
|
||||||
def AnimateDraw(self,x2,y2):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def Draw(self):
|
|
||||||
idx = self._Parent._PsIndex
|
|
||||||
if idx < len(self._Parent._MyList):
|
|
||||||
x = 2
|
|
||||||
y = self._Parent._MyList[idx]._PosY+1
|
|
||||||
h = self._Parent._MyList[idx]._Height -3
|
|
||||||
|
|
||||||
self._PosX = x
|
|
||||||
self._PosY = y
|
|
||||||
self._Height = h
|
|
||||||
|
|
||||||
aa_round_rect(self._Parent._CanvasHWND,
|
|
||||||
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
|
||||||
|
|
||||||
class WifiInfoPage(Page):
|
class WifiInfoPage(Page):
|
||||||
_FootMsg = ["Nav.","Disconnect","","Back",""]
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela15"]
|
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||||
|
|
||||||
_Wireless = None
|
_Wireless = None
|
||||||
_Daemon = None
|
_Daemon = None
|
||||||
@ -155,7 +82,11 @@ class WifiInfoPage(Page):
|
|||||||
self._AList["ip"]["value"] = ip
|
self._AList["ip"]["value"] = ip
|
||||||
|
|
||||||
self._AList["bssid"]["value"] = self._Wireless.GetWirelessProperty(self._NetworkId,"bssid")
|
self._AList["bssid"]["value"] = self._Wireless.GetWirelessProperty(self._NetworkId,"bssid")
|
||||||
|
if FileExists("/sys/class/net/wlan0/address"):
|
||||||
|
self._AList["mac_addr"]["value"] = ReadTheFileContent("/sys/class/net/wlan0/address").strip().upper()
|
||||||
|
else:
|
||||||
|
self._AList["mac_addr"]["value"] = ""
|
||||||
|
|
||||||
start_x = 0
|
start_x = 0
|
||||||
start_y = 0
|
start_y = 0
|
||||||
|
|
||||||
@ -166,7 +97,7 @@ class WifiInfoPage(Page):
|
|||||||
li._PosY = start_y + i*InfoPageListItem._Height
|
li._PosY = start_y + i*InfoPageListItem._Height
|
||||||
li._Width = Width
|
li._Width = Width
|
||||||
li._Fonts["normal"] = self._ListFontObj
|
li._Fonts["normal"] = self._ListFontObj
|
||||||
li._Fonts["small"] = fonts["varela12"]
|
li._Fonts["small"] = MyLangManager.TrFont("varela12")
|
||||||
|
|
||||||
if self._AList[v]["label"] != "":
|
if self._AList[v]["label"] != "":
|
||||||
li.Init( self._AList[v]["label"] )
|
li.Init( self._AList[v]["label"] )
|
||||||
@ -188,8 +119,9 @@ class WifiInfoPage(Page):
|
|||||||
self._Width = self._Screen._Width ## equal to screen width
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
ps = WifiInfoPageSelector()
|
ps = InfoPageSelector()
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
|
ps._PosX = 2
|
||||||
self._Ps = ps
|
self._Ps = ps
|
||||||
self._PsIndex = 0
|
self._PsIndex = 0
|
||||||
|
|
||||||
@ -202,10 +134,16 @@ class WifiInfoPage(Page):
|
|||||||
bssid["key"] = "bssid"
|
bssid["key"] = "bssid"
|
||||||
bssid["label"] = "BSSID"
|
bssid["label"] = "BSSID"
|
||||||
bssid["value"] = ""
|
bssid["value"] = ""
|
||||||
|
|
||||||
|
mac_addr = {}
|
||||||
|
mac_addr["key"] = "mac_addr"
|
||||||
|
mac_addr["label"] = "MAC ADDR"
|
||||||
|
mac_addr["value"] = ""
|
||||||
|
|
||||||
self._AList["ip"] = ip
|
self._AList["ip"] = ip
|
||||||
self._AList["bssid"] = bssid
|
self._AList["bssid"] = bssid
|
||||||
|
self._AList["mac_addr"] = mac_addr
|
||||||
|
|
||||||
self.GenList()
|
self.GenList()
|
||||||
|
|
||||||
self._DisconnectConfirmPage = WifiDisconnectConfirmPage()
|
self._DisconnectConfirmPage = WifiDisconnectConfirmPage()
|
||||||
@ -213,30 +151,6 @@ class WifiInfoPage(Page):
|
|||||||
self._DisconnectConfirmPage._Name = "Confirm Disconnect"
|
self._DisconnectConfirmPage._Name = "Confirm Disconnect"
|
||||||
self._DisconnectConfirmPage._Parent = self
|
self._DisconnectConfirmPage._Parent = self
|
||||||
self._DisconnectConfirmPage.Init()
|
self._DisconnectConfirmPage.Init()
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
cur_li = self._MyList[self._PsIndex]
|
cur_li = self._MyList[self._PsIndex]
|
||||||
@ -254,9 +168,9 @@ class WifiInfoPage(Page):
|
|||||||
def OnLoadCb(self):
|
def OnLoadCb(self):
|
||||||
if self._Wireless.GetCurrentNetworkID(self._Wireless.GetIwconfig()) == self._NetworkId \
|
if self._Wireless.GetCurrentNetworkID(self._Wireless.GetIwconfig()) == self._NetworkId \
|
||||||
and self._Wireless.GetWirelessIP('') is not None:
|
and self._Wireless.GetWirelessIP('') is not None:
|
||||||
self._FootMsg[1] = "Disconnect"
|
self._FootMsg[2] = "Disconnect"
|
||||||
else:
|
else:
|
||||||
self._FootMsg[1] = ""
|
self._FootMsg[2] = ""
|
||||||
|
|
||||||
self.GenList()
|
self.GenList()
|
||||||
|
|
||||||
@ -266,7 +180,7 @@ class WifiInfoPage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
@ -281,7 +195,7 @@ class WifiInfoPage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.Click()
|
self.Click()
|
||||||
|
|
||||||
if event.key == CurKeys["X"]:
|
if event.key == CurKeys["X"]:
|
||||||
@ -298,12 +212,10 @@ class WifiInfoPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
class WifiListSelector(PageSelector):
|
class WifiListSelector(PageSelector):
|
||||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
pass
|
||||||
self._PosY = 0
|
|
||||||
self._Height = 0
|
|
||||||
|
|
||||||
def AnimateDraw(self,x2,y2):
|
def AnimateDraw(self,x2,y2):
|
||||||
pass
|
pass
|
||||||
@ -311,10 +223,10 @@ class WifiListSelector(PageSelector):
|
|||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
idx = self._Parent._PsIndex
|
idx = self._Parent._PsIndex
|
||||||
if idx < len( self._Parent._WirelessList):
|
if idx < len( self._Parent._MyList):
|
||||||
x = self._Parent._WirelessList[idx]._PosX+11
|
x = self._Parent._MyList[idx]._PosX+11
|
||||||
y = self._Parent._WirelessList[idx]._PosY+1
|
y = self._Parent._MyList[idx]._PosY+1
|
||||||
h = self._Parent._WirelessList[idx]._Height -3
|
h = self._Parent._MyList[idx]._Height -3
|
||||||
|
|
||||||
self._PosX = x
|
self._PosX = x
|
||||||
self._PosY = y
|
self._PosY = y
|
||||||
@ -334,14 +246,14 @@ class WifiListMessageBox(Label):
|
|||||||
x = (self._Parent._Width - w)/2
|
x = (self._Parent._Width - w)/2
|
||||||
y = (self._Parent._Height - h)/2
|
y = (self._Parent._Height - h)/2
|
||||||
padding = 10
|
padding = 10
|
||||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('White'),(x-padding,y-padding, w+padding*2,h+padding*2))
|
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(x-padding,y-padding, w+padding*2,h+padding*2))
|
||||||
|
|
||||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('Black'),(x-padding,y-padding, w+padding*2,h+padding*2),1)
|
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('Black'),(x-padding,y-padding, w+padding*2,h+padding*2),1)
|
||||||
|
|
||||||
self._CanvasHWND.blit(my_text,(x,y,w,h))
|
self._CanvasHWND.blit(my_text,(x,y,w,h))
|
||||||
|
|
||||||
class WifiList(Page):
|
class WifiList(Page):
|
||||||
_WirelessList = []
|
_MyList = []
|
||||||
#Wicd dbus part
|
#Wicd dbus part
|
||||||
_Wireless = None
|
_Wireless = None
|
||||||
_Daemon = None
|
_Daemon = None
|
||||||
@ -361,16 +273,17 @@ class WifiList(Page):
|
|||||||
_BlockCb = None
|
_BlockCb = None
|
||||||
|
|
||||||
_LastStatusMsg = ""
|
_LastStatusMsg = ""
|
||||||
_FootMsg = ["Nav.","Scan","Info","Back","Enter"]
|
_FootMsg = ["Nav","Info","Scan","Back","Enter"]
|
||||||
_EncMethods = None
|
_EncMethods = None
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
_ListFontObj = fonts["notosanscjk15"]
|
_ListFontObj = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_InfoPage = None
|
_InfoPage = None
|
||||||
|
_CurBssid = ""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Page.__init__(self)
|
Page.__init__(self)
|
||||||
self._WirelessList = []
|
self._MyList = []
|
||||||
self._CanvasHWND = None
|
self._CanvasHWND = None
|
||||||
|
|
||||||
def ShowBox(self,msg):
|
def ShowBox(self,msg):
|
||||||
@ -387,7 +300,7 @@ class WifiList(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
def GenNetworkList(self):
|
def GenNetworkList(self):
|
||||||
self._WirelessList = []
|
self._MyList = []
|
||||||
start_x = 0
|
start_x = 0
|
||||||
start_y = 0
|
start_y = 0
|
||||||
|
|
||||||
@ -406,7 +319,7 @@ class WifiList(Page):
|
|||||||
#ni._Bssid = self._Wireless.GetWirelessProperty(network_id,"bssid")
|
#ni._Bssid = self._Wireless.GetWirelessProperty(network_id,"bssid")
|
||||||
|
|
||||||
ni.Init(network_id,is_active)
|
ni.Init(network_id,is_active)
|
||||||
self._WirelessList.append(ni)
|
self._MyList.append(ni)
|
||||||
|
|
||||||
self._PsIndex = 0
|
self._PsIndex = 0
|
||||||
|
|
||||||
@ -444,7 +357,7 @@ class WifiList(Page):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self._Scanning = True
|
self._Scanning = True
|
||||||
self.ShowBox("Wifi scanning...")
|
self.ShowBox(MyLangManager.Tr("Wifi scanning"))
|
||||||
self._BlockingUI = True
|
self._BlockingUI = True
|
||||||
print("dbus says start scan...")
|
print("dbus says start scan...")
|
||||||
|
|
||||||
@ -467,8 +380,8 @@ class WifiList(Page):
|
|||||||
if info != None:
|
if info != None:
|
||||||
if len(info) > 3:
|
if len(info) > 3:
|
||||||
_id = int(info[3])
|
_id = int(info[3])
|
||||||
if _id < len(self._WirelessList):
|
if _id < len(self._MyList):
|
||||||
self._WirelessList[_id].UpdateStrenLabel( str(info[2]))
|
self._MyList[_id].UpdateStrenLabel( str(info[2]))
|
||||||
|
|
||||||
self._PrevWicdState = state
|
self._PrevWicdState = state
|
||||||
|
|
||||||
@ -588,7 +501,14 @@ class WifiList(Page):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def ConfigWireless(self,password):
|
def ConfigWireless(self,password):
|
||||||
|
|
||||||
netid = self._PsIndex
|
netid = self._PsIndex
|
||||||
|
|
||||||
|
for i,v in enumerate(self._MyList):
|
||||||
|
if v._Bssid == self._CurBssid:
|
||||||
|
netid = i
|
||||||
|
break
|
||||||
|
|
||||||
print(netid," ", password)
|
print(netid," ", password)
|
||||||
"""
|
"""
|
||||||
self._Wireless.SetWirelessProperty(netid,"dhcphostname","GameShell")
|
self._Wireless.SetWirelessProperty(netid,"dhcphostname","GameShell")
|
||||||
@ -611,9 +531,9 @@ class WifiList(Page):
|
|||||||
self._Wireless.SetWirelessProperty(netid,"apsk",password)
|
self._Wireless.SetWirelessProperty(netid,"apsk",password)
|
||||||
self._Wireless.SetWirelessProperty(netid,"automatic",1)
|
self._Wireless.SetWirelessProperty(netid,"automatic",1)
|
||||||
|
|
||||||
self.ShowBox("Connecting...")
|
self.ShowBox(MyLangManager.Tr("Connecting"))
|
||||||
|
|
||||||
self._WirelessList[netid].Connect()
|
self._MyList[netid].Connect()
|
||||||
print("after Connect")
|
print("after Connect")
|
||||||
self.UpdateStatus()
|
self.UpdateStatus()
|
||||||
|
|
||||||
@ -647,37 +567,37 @@ class WifiList(Page):
|
|||||||
"""
|
"""
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._WirelessList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex-=1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
|
|
||||||
cur_ni = self._WirelessList[self._PsIndex]
|
|
||||||
if cur_ni._PosY < 0:
|
|
||||||
for i in range(0,len(self._WirelessList)):
|
|
||||||
self._WirelessList[i]._PosY += self._WirelessList[i]._Height
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._WirelessList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex+=1
|
|
||||||
if self._PsIndex >= len(self._WirelessList):
|
|
||||||
self._PsIndex = len(self._WirelessList) -1
|
|
||||||
|
|
||||||
cur_ni = self._WirelessList[self._PsIndex]
|
|
||||||
if cur_ni._PosY + cur_ni._Height > self._Height:
|
|
||||||
for i in range(0,len(self._WirelessList)):
|
|
||||||
self._WirelessList[i]._PosY -= self._WirelessList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def AbortedAndReturnToUpLevel(self):
|
def AbortedAndReturnToUpLevel(self):
|
||||||
self.HideBox()
|
self.HideBox()
|
||||||
self._Screen._FootBar.ResetNavText()
|
self._Screen._FootBar.ResetNavText()
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
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):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
@ -685,12 +605,12 @@ class WifiList(Page):
|
|||||||
# print("UI blocking ...")
|
# print("UI blocking ...")
|
||||||
# return
|
# return
|
||||||
|
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
if self._Wireless != None:
|
if self._Wireless != None:
|
||||||
wireless_connecting = self._Wireless.CheckIfWirelessConnecting()
|
wireless_connecting = self._Wireless.CheckIfWirelessConnecting()
|
||||||
if wireless_connecting:
|
if wireless_connecting:
|
||||||
self.ShutDownConnecting()
|
self.ShutDownConnecting()
|
||||||
self.ShowBox("ShutDownConnecting...")
|
self.ShowBox(MyLangManager.Tr("ShutDownConnecting"))
|
||||||
self._BlockingUI=True
|
self._BlockingUI=True
|
||||||
self._BlockCb = self.AbortedAndReturnToUpLevel
|
self._BlockCb = self.AbortedAndReturnToUpLevel
|
||||||
else:
|
else:
|
||||||
@ -710,13 +630,14 @@ class WifiList(Page):
|
|||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]: ## enter to set password,enter is B on GM
|
if IsKeyStartOrA(event.key): ## enter to set password,enter is B on GM
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
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('') )
|
self.ShowBox( self._Wireless.GetWirelessIP('') )
|
||||||
else:
|
else:
|
||||||
self._Screen.PushCurPage()
|
self._Screen.PushCurPage()
|
||||||
@ -726,8 +647,8 @@ class WifiList(Page):
|
|||||||
for i in wicd_wirelss_encrypt_pwd:
|
for i in wicd_wirelss_encrypt_pwd:
|
||||||
if "preshared_key" in i:
|
if "preshared_key" in i:
|
||||||
if i["preshared_key"] != None:
|
if i["preshared_key"] != None:
|
||||||
if len(i["preshared_key"]) > 0:
|
if len(str(i["preshared_key"])) > 0:
|
||||||
thepass = i["preshared_key"]
|
thepass = str(i["preshared_key"])
|
||||||
break
|
break
|
||||||
|
|
||||||
myvars.PasswordPage.SetPassword(thepass)
|
myvars.PasswordPage.SetPassword(thepass)
|
||||||
@ -746,7 +667,7 @@ class WifiList(Page):
|
|||||||
self.Rescan(False)
|
self.Rescan(False)
|
||||||
|
|
||||||
if event.key == CurKeys["Y"]:
|
if event.key == CurKeys["Y"]:
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._InfoPage._NetworkId = self._PsIndex
|
self._InfoPage._NetworkId = self._PsIndex
|
||||||
@ -776,7 +697,7 @@ class WifiList(Page):
|
|||||||
|
|
||||||
msgbox = WifiListMessageBox()
|
msgbox = WifiListMessageBox()
|
||||||
msgbox._CanvasHWND = self._CanvasHWND
|
msgbox._CanvasHWND = self._CanvasHWND
|
||||||
msgbox.Init(" ",fonts["veramono12"])
|
msgbox.Init(" ",MyLangManager.TrFont("veramono12"))
|
||||||
msgbox._Parent = self
|
msgbox._Parent = self
|
||||||
|
|
||||||
self._MsgBox = msgbox
|
self._MsgBox = msgbox
|
||||||
@ -809,19 +730,19 @@ class WifiList(Page):
|
|||||||
|
|
||||||
self._InfoPage = WifiInfoPage()
|
self._InfoPage = WifiInfoPage()
|
||||||
self._InfoPage._Screen = self._Screen
|
self._InfoPage._Screen = self._Screen
|
||||||
self._InfoPage._Name = "Wifi info"
|
self._InfoPage._Name = MyLangManager.Tr("Wifi info")
|
||||||
self._InfoPage.Init()
|
self._InfoPage.Init()
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
|
|
||||||
if len(self._WirelessList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._Ps.Draw()
|
self._Ps.Draw()
|
||||||
for i in self._WirelessList:
|
for i in self._MyList:
|
||||||
i.Draw()
|
i.Draw()
|
||||||
|
|
||||||
|
|
||||||
self._Scroller.UpdateSize( len(self._WirelessList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
self._Scroller.UpdateSize( len(self._MyList)*NetItem._Height, self._PsIndex*NetItem._Height)
|
||||||
self._Scroller.Draw()
|
self._Scroller.Draw()
|
||||||
|
|||||||
@ -7,8 +7,7 @@ import pygame
|
|||||||
## local UI import
|
## local UI import
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
# a item for List
|
# a item for List
|
||||||
# - - - - - - - - - - - --
|
# - - - - - - - - - - - --
|
||||||
# | Icon Text..... > |
|
# | Icon Text..... > |
|
||||||
@ -34,9 +33,6 @@ class ListItem(object):
|
|||||||
self._Icons = {}
|
self._Icons = {}
|
||||||
self._Fonts = {}
|
self._Fonts = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def Init(self,text):
|
def Init(self,text):
|
||||||
|
|
||||||
#self._Fonts["normal"] = fonts["veramono12"]
|
#self._Fonts["normal"] = fonts["veramono12"]
|
||||||
@ -44,7 +40,7 @@ class ListItem(object):
|
|||||||
l = Label()
|
l = Label()
|
||||||
l._PosX = 16
|
l._PosX = 16
|
||||||
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
l.SetCanvasHWND(self._Parent._CanvasHWND)
|
||||||
|
text = MyLangManager.Tr(text)
|
||||||
l.Init(text,self._Fonts["normal"])
|
l.Init(text,self._Fonts["normal"])
|
||||||
self._Labels["Text"] = l
|
self._Labels["Text"] = l
|
||||||
|
|
||||||
|
|||||||
@ -9,44 +9,17 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height
|
from UI.constants import Width,Height
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect,FileExists
|
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.scroller import ListScroller
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.info_page_selector import InfoPageSelector
|
||||||
|
|
||||||
from list_item import ListItem
|
from list_item import ListItem
|
||||||
|
|
||||||
import myvars
|
import myvars
|
||||||
|
|
||||||
class ListPageSelector(PageSelector):
|
|
||||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self._PosX = 0
|
|
||||||
self._PosY = 0
|
|
||||||
self._Height = 0
|
|
||||||
self._Width = Width
|
|
||||||
|
|
||||||
def AnimateDraw(self,x2,y2):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def Draw(self):
|
|
||||||
idx = self._Parent._PsIndex
|
|
||||||
if idx < len(self._Parent._MyList):
|
|
||||||
x = 2
|
|
||||||
y = self._Parent._MyList[idx]._PosY+1
|
|
||||||
h = self._Parent._MyList[idx]._Height -3
|
|
||||||
|
|
||||||
self._PosX = x
|
|
||||||
self._PosY = y
|
|
||||||
self._Height = h
|
|
||||||
|
|
||||||
aa_round_rect(self._Parent._CanvasHWND,
|
|
||||||
(x,y,self._Width-4,h),self._BackgroundColor,4,0,self._BackgroundColor)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ListPage(Page):
|
class ListPage(Page):
|
||||||
|
|
||||||
_Icons = {}
|
_Icons = {}
|
||||||
@ -54,7 +27,7 @@ class ListPage(Page):
|
|||||||
|
|
||||||
_FootMsg = ["Nav","","","Back","Enter"]
|
_FootMsg = ["Nav","","","Back","Enter"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFontObj = fonts["varela15"]
|
_ListFontObj = MyLangManager.TrFont("varela15")
|
||||||
|
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
|
|
||||||
@ -71,8 +44,9 @@ class ListPage(Page):
|
|||||||
|
|
||||||
self._CanvasHWND = self._Screen._CanvasHWND
|
self._CanvasHWND = self._Screen._CanvasHWND
|
||||||
|
|
||||||
ps = ListPageSelector()
|
ps = InfoPageSelector()
|
||||||
ps._Parent = self
|
ps._Parent = self
|
||||||
|
ps._PosX = 2
|
||||||
self._Ps = ps
|
self._Ps = ps
|
||||||
self._PsIndex = 0
|
self._PsIndex = 0
|
||||||
|
|
||||||
@ -80,14 +54,22 @@ class ListPage(Page):
|
|||||||
alist = [["","Airplane","Airplane Mode"],
|
alist = [["","Airplane","Airplane Mode"],
|
||||||
["","PowerOptions","Power Options"],
|
["","PowerOptions","Power Options"],
|
||||||
["","Wifi","Wi-Fi"],
|
["","Wifi","Wi-Fi"],
|
||||||
["","Sound","Sound Volume"],
|
["","Bluetooth","Bluetooth"],
|
||||||
|
["","Sound","Sound Volume"],
|
||||||
["","Brightness","BackLight Brightness"],
|
["","Brightness","BackLight Brightness"],
|
||||||
["","Storage",""],
|
["","Storage",""],
|
||||||
["","Time","Timezone"],
|
["","Time","Timezone"],
|
||||||
["","Update", ""],
|
["","Languages","Languages"],
|
||||||
|
["","Notification","Notification"],
|
||||||
|
["","Update", "Update Launcher"],
|
||||||
|
["","Cores", "Retroarch cores manager"],
|
||||||
["","About", "About"],
|
["","About", "About"],
|
||||||
["","PowerOFF","Power off"],
|
["","PowerOFF","Power OFF"],
|
||||||
["","ButtonsLayout","Buttons Layout"],]
|
["","ButtonsLayout","Buttons Layout"],
|
||||||
|
["","Skins","Theme Manager"],
|
||||||
|
["","LauncherGo","Switch to LauncherGo"],
|
||||||
|
["","Lima","GPU Driver Switch"],
|
||||||
|
["","GateWay","Network gateway switch"]]
|
||||||
|
|
||||||
start_x = 0
|
start_x = 0
|
||||||
start_y = 0
|
start_y = 0
|
||||||
@ -123,30 +105,6 @@ class ListPage(Page):
|
|||||||
self._Scroller._PosY = 2
|
self._Scroller._PosY = 2
|
||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
|
|
||||||
def ScrollUp(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex -= 1
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
self._PsIndex +=1
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
cur_li = self._MyList[self._PsIndex]
|
cur_li = self._MyList[self._PsIndex]
|
||||||
if cur_li._LinkObj != None:
|
if cur_li._LinkObj != None:
|
||||||
@ -157,7 +115,7 @@ class ListPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
@ -172,7 +130,7 @@ class ListPage(Page):
|
|||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.Click()
|
self.Click()
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
|
|||||||
@ -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=https://raw.githubusercontent.com/cuu/emulators/master/mame2003_plus_libretro.so.zip
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
ROM=/home/cpi/games/MGBA
|
|
||||||
ROM_SO=/home/cpi/apps/emulators/mgba_libretro.so
|
|
||||||
EXT=gb,gbc,gba,gbx
|
|
||||||
LAUNCHER=retroarch -L
|
|
||||||
TITLE=MGBA Roms
|
|
||||||
SO_URL=https://raw.githubusercontent.com/cuu/emulators/master/mgba_libretro.so.zip
|
|
||||||
@ -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=https://raw.githubusercontent.com/cuu/emulators/master/nestopia_libretro.so.zip
|
|
||||||
|
|
||||||
1188
Menu/GameShell/21_Warehouse/__init__.py
Normal file
2
Menu/GameShell/30_RetroArch.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
retroarch
|
||||||
@ -1 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
retroarch -L /home/cpi/apps/emulators/nxengine_libretro.so /home/cpi/games/nxengine/cavestory/data
|
retroarch -L /home/cpi/apps/emulators/nxengine_libretro.so /home/cpi/games/nxengine/cavestory/data
|
||||||
6
Menu/GameShell/32_ChocoDM/action.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
ROM=/home/cpi/games/ChocoDM
|
||||||
|
ROM_SO=
|
||||||
|
EXT=wad
|
||||||
|
LAUNCHER=chocolate-doom -iwad
|
||||||
|
TITLE=ChocoDM
|
||||||
|
SO_URL=
|
||||||
4
Menu/GameShell/50_PICO-8/PICO-8.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /home/cpi/games/PICO-8/pico-8 || exit
|
||||||
|
SDL_VIDEODRIVER=x11 DISPLAY=:0 ./pico8_dyn -splore -draw_rect 32,0,256,240
|
||||||
11
Menu/GameShell/50_PICO-8/Post-Up.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir ~/.lexaloffle
|
||||||
|
|
||||||
|
cp -rf pico-8 ~/.lexaloffle
|
||||||
|
|
||||||
|
mkdir ~/.lexaloffle/pico-8/carts
|
||||||
|
|
||||||
|
ln -s ~/.lexaloffle/pico-8/carts/ ~/games/PICO-8/carts
|
||||||
|
|
||||||
|
touch .done
|
||||||
19
Menu/GameShell/50_PICO-8/compkginfo.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"GameDir": "/home/cpi/games/PICO-8/",
|
||||||
|
"InstallDir": "pico-8",
|
||||||
|
"NotFoundMsg": [
|
||||||
|
"Please purchase the PICO-8 \n|None|varela16",
|
||||||
|
"and copy it to the \"~/games/PICO-8\"|None|varela16"
|
||||||
|
],
|
||||||
|
"MD5": {
|
||||||
|
"pico-8_0.2.2_raspi.zip": "e2dba152bf507d337459e9316061411d",
|
||||||
|
"pico-8_0.1.11g_raspi.zip": "a3f2995cf117499f880bd964d6a0e1f2",
|
||||||
|
"pico-8_0.1.11g_amd64.zip": "6726141c784afd4a41be6b7414c1b932",
|
||||||
|
"pico-8_0.1.12_raspi.zip": "08eda95570e63089a2b9f5531503431e",
|
||||||
|
"pico-8_0.1.12c_raspi.zip": "1a62b0d7d4e4be65f89f23ec9757cb66",
|
||||||
|
"pico-8_0.1.12c2_raspi.zip": "7a878795472fa39304e9a10128c1f712",
|
||||||
|
"pico-8_0.2.0e_raspi.zip": "085edfecd111c2b195b878b2197afe7a",
|
||||||
|
"pico-8.zip": "whatever it takes"
|
||||||
|
},
|
||||||
|
"Post-Up": "bash Post-Up.sh"
|
||||||
|
}
|
||||||
99
Menu/GameShell/50_PICO-8/pico-8/config.txt
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// Configuration for pico-8
|
||||||
|
//
|
||||||
|
// config.txt is read on startup and saved on exit.
|
||||||
|
// To generate the default config.txt, delete this file.
|
||||||
|
//
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|
||||||
|
// :: Video Settings
|
||||||
|
|
||||||
|
window_size 0 0 // window width, height
|
||||||
|
screen_size 0 0 // screen width, height (stretched to window)
|
||||||
|
show_fps 0 // Draw frames per second in the corner
|
||||||
|
|
||||||
|
|
||||||
|
// :: Window Settings
|
||||||
|
|
||||||
|
windowed 0 // 1 to start up in windowed mode
|
||||||
|
window_position -1 -1 // x and y position of window, or -1, -1 to let the window manager decide
|
||||||
|
frameless 0 // 1 to use a window with no frame
|
||||||
|
fullscreen_method 0 // 0 maximized window (linux) 1 borderless desktop-sized window 2 fullscreen
|
||||||
|
|
||||||
|
|
||||||
|
// :: System Settings
|
||||||
|
|
||||||
|
foreground_sleep_ms 1 // number of milliseconds to sleep each frame. Try 10 to conserve battery power
|
||||||
|
|
||||||
|
background_sleep_ms 20 // number of milliseconds to sleep each frame when running in the background
|
||||||
|
|
||||||
|
sessions 4 // number of times program has been run
|
||||||
|
|
||||||
|
// (scancode) hold this key down and left-click to simulate right-click
|
||||||
|
rmb_key 0 // 0 for none 226 for LALT
|
||||||
|
|
||||||
|
// 0:off 1: ignore SDL_TEXTINPUT and use SDL_GetKeyboardState instead (mapped to a US layout)
|
||||||
|
emulate_textinput 1
|
||||||
|
|
||||||
|
// Desktop for saving screenshots etc. Defaults to $HOME/Desktop
|
||||||
|
desktop_path
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// :: Audio Settings
|
||||||
|
|
||||||
|
sound_volume 256 // 0..256
|
||||||
|
music_volume 256 // 0..256
|
||||||
|
mix_buffer_size 1024 // usually 1024. Try 2048 if you get choppy sound
|
||||||
|
|
||||||
|
|
||||||
|
// ::
|
||||||
|
|
||||||
|
version 0.1.11g
|
||||||
|
|
||||||
|
|
||||||
|
// Location of pico-8's root folder
|
||||||
|
root_path /home/cpi/.lexaloffle/pico-8/carts/
|
||||||
|
|
||||||
|
|
||||||
|
// Location of cartridge save data
|
||||||
|
cdata_path /home/cpi/.lexaloffle/pico-8/cdata/
|
||||||
|
|
||||||
|
|
||||||
|
// Specify which player index joystick control begins at (0..7)
|
||||||
|
joystick_index 0
|
||||||
|
|
||||||
|
|
||||||
|
// Custom keyboard scancodes for buttons. player0 0..6, player1 0..5
|
||||||
|
button_keys 0 0 0 0 13 14 0 0 0 0 0 0 0
|
||||||
|
|
||||||
|
// Play notes as they are plotted in frequency mode
|
||||||
|
live_notes 0
|
||||||
|
|
||||||
|
// iff 1: when using keyboard cursor, snap to closest pixel / map cel
|
||||||
|
cursor_snap 0
|
||||||
|
|
||||||
|
// maximum length of gif in seconds (1..120, default 8)
|
||||||
|
gif_len 8
|
||||||
|
|
||||||
|
// 0 classic 1 dark blue background in code editor
|
||||||
|
gui_theme 0
|
||||||
|
|
||||||
|
// scale of screenshots and gifs // 2 means 256x256
|
||||||
|
screenshot_scale 3
|
||||||
|
gif_scale 2
|
||||||
|
|
||||||
|
// when 1 can enter glyphs using shift-A..Z
|
||||||
|
shift_glyphs 1
|
||||||
|
|
||||||
|
// 0 for off. 1 to notify whenever unsaved changes are backed up
|
||||||
|
show_backup_messages 1
|
||||||
|
|
||||||
|
// 0 for off. 1 to allow control of a cart's framerate due to host machine's cpu capacity (recommended)
|
||||||
|
host_framerate_control 1
|
||||||
|
|
||||||
|
// filter splore content
|
||||||
|
// 0 for no filter (18+) 1 medium (13+) 2 maximum (kid-friendly)
|
||||||
|
content_filter 1
|
||||||
|
|
||||||
90
Menu/GameShell/50_PICO-8/pico-8/log.txt
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
codo_init
|
||||||
|
platform: Linux
|
||||||
|
Found config.txt
|
||||||
|
|
||||||
|
01 window_size 0 0 // window width, height
|
||||||
|
02 screen_size 0 0 // screen width, height (stretched to window)
|
||||||
|
03 show_fps 0 // Draw frames per second in the corner
|
||||||
|
04 windowed 0 // 1 to start up in windowed mode
|
||||||
|
05 window_position -1 -1 // x and y position of window, or -1, -1 to let the window manager decide
|
||||||
|
new window position: -1, -1
|
||||||
|
06 frameless 0 // 1 to use a window with no frame
|
||||||
|
07 fullscreen_method 1 // 0 maximized window (linux) 1 borderless desktop-sized window 2 fullscreen
|
||||||
|
08 foreground_sleep_ms 1 // number of milliseconds to sleep each frame. Try 10 to conserve battery power
|
||||||
|
09 background_sleep_ms 20 // number of milliseconds to sleep each frame when running in the background
|
||||||
|
10 sessions 3 // number of times program has been run
|
||||||
|
11 rmb_key 0 // 0 for none 226 for LALT
|
||||||
|
12 emulate_textinput 1
|
||||||
|
13 desktop_path
|
||||||
|
14 sound_volume 256 // 0..256
|
||||||
|
15 music_volume 256 // 0..256
|
||||||
|
16 mix_buffer_size 1024 // usually 1024. Try 2048 if you get choppy sound
|
||||||
|
17 version 0.1.11g
|
||||||
|
18 root_path /home/cpi/.lexaloffle/pico-8/carts/
|
||||||
|
19 cdata_path /home/cpi/.lexaloffle/pico-8/cdata/
|
||||||
|
20 joystick_index 0
|
||||||
|
21 button_keys 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
22 live_notes 0
|
||||||
|
23 cursor_snap 0
|
||||||
|
24 gif_len 8
|
||||||
|
25 gui_theme 0
|
||||||
|
26 screenshot_scale 3
|
||||||
|
27 gif_scale 2
|
||||||
|
28 shift_glyphs 1
|
||||||
|
29 show_backup_messages 1
|
||||||
|
30 host_framerate_control 1
|
||||||
|
31 content_filter 1
|
||||||
|
|
||||||
|
codo_system_init
|
||||||
|
Compiled against SDL version: 2.0.7
|
||||||
|
Linked against SDL version: 2.0.5
|
||||||
|
Built-in video drivers: 0 x11 1 wayland 2 dummy
|
||||||
|
Current video driver: x11
|
||||||
|
Built-in render drivers:
|
||||||
|
Renderer opengl:
|
||||||
|
Flags: 0x0000000E ( | | )
|
||||||
|
Texture formats (1): ARGB8888
|
||||||
|
Renderer opengles2:
|
||||||
|
Flags: 0x0000000E ( | | )
|
||||||
|
Texture formats (4): ARGB8888, ABGR8888, RGB888, BGR888
|
||||||
|
Renderer software:
|
||||||
|
Flags: 0x00000009 ( | )
|
||||||
|
Texture formats (8): ARGB8888, ABGR8888, RGBA8888, BGRA8888, RGB888, BGR888, RGB565, RGB555
|
||||||
|
codo_reset_timer
|
||||||
|
codo_gui_init
|
||||||
|
codo_keys_init
|
||||||
|
codo_text_init
|
||||||
|
codo_video_init
|
||||||
|
codo_mouse_init
|
||||||
|
codo_joystick_init
|
||||||
|
Reading controller mappings: /home/cpi/.lexaloffle/pico-8/sdl_controllers.txt
|
||||||
|
searching for joysticks
|
||||||
|
found 0 joysticks
|
||||||
|
ok
|
||||||
|
ok
|
||||||
|
codo_load_pod: /home/cpi/apps/Menu/50_PICO-8/pico8.dat ok
|
||||||
|
codo_set_screen 128 128 8 100
|
||||||
|
set pixel_perfect 1
|
||||||
|
window size: 640 480
|
||||||
|
codo_plat_pi: forcing fullscreen mode
|
||||||
|
Current renderer:
|
||||||
|
Renderer opengl:
|
||||||
|
Flags: 0x0000000A ( | )
|
||||||
|
Texture formats (5): ARGB8888, YV12, IYUV, 0x3231564e, 0x3132564e
|
||||||
|
Max Texture Size: 8192x8192
|
||||||
|
codo_sound_init mix_buffer_size: 1024
|
||||||
|
codo_sound_init
|
||||||
|
SDL_INIT_AUDIO ok
|
||||||
|
SDL_OpenAudio ok
|
||||||
|
Built-in audio drivers: 0 pulseaudio 1 alsa 2 sndio 3 dsp 4 disk 5 dummy
|
||||||
|
Current audio driver: alsa
|
||||||
|
codo_exit
|
||||||
|
cmusic_stop
|
||||||
|
codo_main_exit
|
||||||
|
codo_config_save
|
||||||
|
codo_sound_exit
|
||||||
|
codo_video_exit
|
||||||
|
codo_joystick_exit
|
||||||
|
codo_system_exit
|
||||||
|
codo_items_created: 1023
|
||||||
|
ok
|
||||||
1
Menu/GameShell/50_PICO-8/pico-8/sdl_controllers.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
// add SDL2 game controller mappings to this file
|
||||||
3
Menu/GameShell/90_Reload UI.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
exit 0
|
||||||
@ -7,10 +7,9 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import ICON_TYPES
|
from UI.constants import ICON_TYPES
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
from UI.util_funcs import midRect
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
# a item for List
|
# a item for List
|
||||||
# - - - - - - - - - - - --
|
# - - - - - - - - - - - --
|
||||||
@ -32,7 +31,7 @@ class ListItemIcon(IconItem):
|
|||||||
|
|
||||||
class ListItemLabel(Label):
|
class ListItemLabel(Label):
|
||||||
|
|
||||||
_ActiveColor = SkinManager().GiveColor('Active')
|
_ActiveColor = MySkinManager.GiveColor('Active')
|
||||||
_Active = False
|
_Active = False
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
|
|
||||||
@ -117,7 +116,7 @@ class ListItem(object):
|
|||||||
|
|
||||||
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
self._Labels["Text"]._PosY = self._PosY + (self._Height - self._Labels["Text"]._Height)/2
|
||||||
|
|
||||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Line'),(self._PosX,self._PosY+self._Height-1),(self._PosX+self._Width,self._PosY+self._Height-1),1)
|
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:
|
if self._Playing == True:
|
||||||
self._Labels["Text"]._Active =True
|
self._Labels["Text"]._Active =True
|
||||||
@ -128,7 +127,7 @@ class ListItem(object):
|
|||||||
|
|
||||||
if self._PlayingProcess > 0:
|
if self._PlayingProcess > 0:
|
||||||
seek_posx = int(self._Width * self._PlayingProcess/100.0)
|
seek_posx = int(self._Width * self._PlayingProcess/100.0)
|
||||||
pygame.draw.line(self._Parent._CanvasHWND,SkinManager().GiveColor('Active'),(self._PosX,self._PosY+self._Height-2),(self._PosX+seek_posx,self._PosY+self._Height-2),2)
|
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:
|
else:
|
||||||
self._Labels["Text"].Draw()
|
self._Labels["Text"].Draw()
|
||||||
@ -15,12 +15,12 @@ from beeprint import pp
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
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_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
@ -79,11 +79,11 @@ class MPDSpectrumPage(Page):
|
|||||||
_Selector=None
|
_Selector=None
|
||||||
_FootMsg = ["Nav","","","Back",""]
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["veramono12"]
|
_ListFont = MyLangManager.TrFont("veramono12")
|
||||||
_SongFont = fonts["notosanscjk12"]
|
_SongFont = MyLangManager.TrFont("notosanscjk12")
|
||||||
_PIFI = None
|
_PIFI = None
|
||||||
_FIFO = None
|
_FIFO = None
|
||||||
_Color = SkinManager().GiveColor('Front')
|
_Color = MySkinManager.GiveColor('Front')
|
||||||
_GobjectIntervalId = -1
|
_GobjectIntervalId = -1
|
||||||
_Queue = None
|
_Queue = None
|
||||||
_KeepReading = True
|
_KeepReading = True
|
||||||
@ -136,26 +136,26 @@ class MPDSpectrumPage(Page):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["sheep_bg"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("sheep_bg")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
|
|
||||||
self._SheepHead = IconItem()
|
self._SheepHead = IconItem()
|
||||||
self._SheepHead._ImgSurf = MyIconPool._Icons["sheep_head"]
|
self._SheepHead._ImgSurf = MyIconPool.GiveIconSurface("sheep_head")
|
||||||
self._SheepHead._MyType = ICON_TYPES["STAT"]
|
self._SheepHead._MyType = ICON_TYPES["STAT"]
|
||||||
self._SheepHead._Parent = self
|
self._SheepHead._Parent = self
|
||||||
self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)
|
self._SheepHead.Adjust(0,0,self._SheepHeadW,self._SheepHeadH,0)
|
||||||
|
|
||||||
self._SheepBody = IconItem()
|
self._SheepBody = IconItem()
|
||||||
self._SheepBody._ImgSurf = MyIconPool._Icons["sheep_body"]
|
self._SheepBody._ImgSurf = MyIconPool.GiveIconSurface("sheep_body")
|
||||||
self._SheepBody._MyType = ICON_TYPES["STAT"]
|
self._SheepBody._MyType = ICON_TYPES["STAT"]
|
||||||
self._SheepBody._Parent = self
|
self._SheepBody._Parent = self
|
||||||
self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
|
self._SheepBody.Adjust(0,0,self._SheepBodyW,self._SheepBodyH,0)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self._cwp_png = IconItem()
|
self._cwp_png = IconItem()
|
||||||
self._cwp_png._ImgSurf = MyIconPool._Icons["tape"]
|
self._cwp_png._ImgSurf = MyIconPool.GiveIconSurface("tape")
|
||||||
self._cwp_png._MyType = ICON_TYPES["STAT"]
|
self._cwp_png._MyType = ICON_TYPES["STAT"]
|
||||||
self._cwp_png._Parent = self
|
self._cwp_png._Parent = self
|
||||||
self._cwp_png.Adjust(0,0,79,79,0)
|
self._cwp_png.Adjust(0,0,79,79,0)
|
||||||
@ -163,22 +163,22 @@ class MPDSpectrumPage(Page):
|
|||||||
|
|
||||||
self._song_title = Label()
|
self._song_title = Label()
|
||||||
self._song_title.SetCanvasHWND(self._RollCanvas)
|
self._song_title.SetCanvasHWND(self._RollCanvas)
|
||||||
self._song_title.Init("Untitled",self._SongFont,SkinManager().GiveColor('White'))
|
self._song_title.Init("Untitled",self._SongFont,MySkinManager.GiveColor('White'))
|
||||||
|
|
||||||
|
|
||||||
self._title = Label()
|
self._title = Label()
|
||||||
self._title.SetCanvasHWND(self._CanvasHWND)
|
self._title.SetCanvasHWND(self._CanvasHWND)
|
||||||
self._title.Init("Title:",self._ListFont,SkinManager().GiveColor('White'))
|
self._title.Init("Title:",self._ListFont,MySkinManager.GiveColor('White'))
|
||||||
|
|
||||||
self._time = Label()
|
self._time = Label()
|
||||||
self._time.SetCanvasHWND(self._CanvasHWND)
|
self._time.SetCanvasHWND(self._CanvasHWND)
|
||||||
self._time.Init("Time:",self._ListFont,SkinManager().GiveColor('White'))
|
self._time.Init("Time:",self._ListFont,MySkinManager.GiveColor('White'))
|
||||||
|
|
||||||
|
|
||||||
self._time2 = Label()
|
self._time2 = Label()
|
||||||
self._time2.SetCanvasHWND(self._CanvasHWND)
|
self._time2.SetCanvasHWND(self._CanvasHWND)
|
||||||
self._time2.Init("00:00-00:00", self._ListFont,
|
self._time2.Init("00:00-00:00", self._ListFont,
|
||||||
SkinManager().GiveColor('White'))
|
MySkinManager.GiveColor('White'))
|
||||||
|
|
||||||
|
|
||||||
self.Start()
|
self.Start()
|
||||||
@ -229,7 +229,7 @@ class MPDSpectrumPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
def ClearCanvas(self):
|
def ClearCanvas(self):
|
||||||
self._CanvasHWND.fill(SkinManager().GiveColor('Black'))
|
self._CanvasHWND.fill(MySkinManager.GiveColor('Black'))
|
||||||
|
|
||||||
def SgsSmooth(self):
|
def SgsSmooth(self):
|
||||||
passes = 1
|
passes = 1
|
||||||
@ -265,7 +265,7 @@ class MPDSpectrumPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
try:
|
try:
|
||||||
os.close(self._FIFO)
|
os.close(self._FIFO)
|
||||||
self._FIFO = None
|
self._FIFO = None
|
||||||
@ -281,13 +281,6 @@ class MPDSpectrumPage(Page):
|
|||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Start"]:
|
|
||||||
self._Screen.Draw()
|
|
||||||
self._Screen.SwapAndShow()
|
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
self.ClearCanvas()
|
self.ClearCanvas()
|
||||||
@ -343,7 +336,7 @@ class MPDSpectrumPage(Page):
|
|||||||
|
|
||||||
if self._RollCanvas != None:
|
if self._RollCanvas != None:
|
||||||
# self._RollCanvas.fill((111,22,33))
|
# self._RollCanvas.fill((111,22,33))
|
||||||
self._RollCanvas.fill(SkinManager().GiveColor('Black'))
|
self._RollCanvas.fill(MySkinManager.GiveColor('Black'))
|
||||||
if self._song_title._Width > self._RollW:
|
if self._song_title._Width > self._RollW:
|
||||||
if (self._song_title._PosX + self._song_title._Width) > self._RollW and self._frames % 30 == 0:
|
if (self._song_title._PosX + self._song_title._Width) > self._RollW and self._frames % 30 == 0:
|
||||||
self._song_title._PosX -= 1
|
self._song_title._PosX -= 1
|
||||||
@ -417,9 +410,9 @@ class MPDSpectrumPage(Page):
|
|||||||
else:
|
else:
|
||||||
self._capYPositionArray[i] = value
|
self._capYPositionArray[i] = value
|
||||||
|
|
||||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('White'),(i*(bw+gap)+margin_left,self._Height-gap-self._capYPositionArray[i]-margin_bottom,bw,gap),0)
|
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(i*(bw+gap)+margin_left,self._Height-gap-self._capYPositionArray[i]-margin_bottom,bw,gap),0)
|
||||||
|
|
||||||
pygame.draw.rect(self._CanvasHWND,SkinManager().GiveColor('White'),(i*(bw+gap)+margin_left,self._Height-value-gap-margin_bottom,bw,value+gap),0)
|
pygame.draw.rect(self._CanvasHWND,MySkinManager.GiveColor('White'),(i*(bw+gap)+margin_left,self._Height-value-gap-margin_bottom,bw,value+gap),0)
|
||||||
|
|
||||||
self._vis_values[i] -= 2
|
self._vis_values[i] -= 2
|
||||||
|
|
||||||
@ -8,14 +8,14 @@ from libs.roundrects import aa_round_rect
|
|||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.util_funcs import midRect
|
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.multi_icon_item import MultiIconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
from list_item import ListItem
|
from list_item import ListItem
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ class MusicLibStack:
|
|||||||
return len(self.stack)
|
return len(self.stack)
|
||||||
|
|
||||||
class ListPageSelector(PageSelector):
|
class ListPageSelector(PageSelector):
|
||||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
self._PosX = 0
|
||||||
@ -81,10 +81,10 @@ class MusicLibListPage(Page):
|
|||||||
|
|
||||||
_Icons = {}
|
_Icons = {}
|
||||||
_Selector=None
|
_Selector=None
|
||||||
_FootMsg = ["Nav","Scan","","Back","Add to Playlist"]
|
_FootMsg = ["Nav","","Scan","Back","Add to Playlist"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_SwapMyList = []
|
_SwapMyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
_MyStack = None
|
_MyStack = None
|
||||||
|
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
@ -172,7 +172,7 @@ class MusicLibListPage(Page):
|
|||||||
self.SyncList("/")
|
self.SyncList("/")
|
||||||
|
|
||||||
icon_for_list = MultiIconItem()
|
icon_for_list = MultiIconItem()
|
||||||
icon_for_list._ImgSurf = MyIconPool._Icons["sys"]
|
icon_for_list._ImgSurf = MyIconPool.GiveIconSurface("sys")
|
||||||
icon_for_list._MyType = ICON_TYPES["STAT"]
|
icon_for_list._MyType = ICON_TYPES["STAT"]
|
||||||
icon_for_list._Parent = self
|
icon_for_list._Parent = self
|
||||||
|
|
||||||
@ -181,11 +181,11 @@ class MusicLibListPage(Page):
|
|||||||
|
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["empty"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("empty")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.AddLabel("Please upload data over Wi-Fi", fonts["varela22"])
|
self._BGpng.AddLabel(MyLangManager.Tr("Please upload data over Wi-Fi"), MyLangManager.TrFont("varela22"))
|
||||||
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
|
|
||||||
|
|
||||||
@ -195,36 +195,8 @@ class MusicLibListPage(Page):
|
|||||||
self._Scroller._PosY = 2
|
self._Scroller._PosY = 2
|
||||||
self._Scroller.Init()
|
self._Scroller.Init()
|
||||||
|
|
||||||
|
|
||||||
def ScrollUp(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex -= Step
|
|
||||||
|
|
||||||
if self._PsIndex < 0:
|
|
||||||
self._PsIndex = 0
|
|
||||||
dy = tmp-self._PsIndex
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY < 0:
|
|
||||||
for i in range(0, len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY += self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
|
|
||||||
def ScrollDown(self,Step=1):
|
|
||||||
if len(self._MyList) == 0:
|
|
||||||
return
|
|
||||||
tmp = self._PsIndex
|
|
||||||
self._PsIndex +=Step
|
|
||||||
if self._PsIndex >= len(self._MyList):
|
|
||||||
self._PsIndex = len(self._MyList) -1
|
|
||||||
dy = self._PsIndex - tmp
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
|
||||||
if cur_li._PosY +cur_li._Height > self._Height:
|
|
||||||
for i in range(0,len(self._MyList)):
|
|
||||||
self._MyList[i]._PosY -= self._MyList[i]._Height*dy
|
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
|
self.RefreshPsIndex()
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -254,7 +226,7 @@ class MusicLibListPage(Page):
|
|||||||
|
|
||||||
def KeyDown(self,event):
|
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.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
@ -271,12 +243,12 @@ class MusicLibListPage(Page):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if event.key == CurKeys["Right"]:
|
if event.key == CurKeys["Right"]:
|
||||||
self.ScrollDown(Step=5)
|
self.FScrollDown(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Left"]:
|
if event.key == CurKeys["Left"]:
|
||||||
self.ScrollUp(Step=5)
|
self.FScrollUp(Step=5)
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
"""
|
"""
|
||||||
@ -286,7 +258,7 @@ class MusicLibListPage(Page):
|
|||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.Click()
|
self.Click()
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
@ -10,11 +10,11 @@ from UI.constants import Width,Height,ICON_TYPES
|
|||||||
from UI.page import Page,PageSelector
|
from UI.page import Page,PageSelector
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.util_funcs import midRect
|
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.icon_pool import MyIconPool
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
from UI.scroller import ListScroller
|
from UI.scroller import ListScroller
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ from list_item import ListItem
|
|||||||
import myvars
|
import myvars
|
||||||
|
|
||||||
class ListPageSelector(PageSelector):
|
class ListPageSelector(PageSelector):
|
||||||
_BackgroundColor = SkinManager().GiveColor('Front')
|
_BackgroundColor = MySkinManager.GiveColor('Front')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._PosX = 0
|
self._PosX = 0
|
||||||
@ -60,9 +60,9 @@ class PlayListPage(Page):
|
|||||||
|
|
||||||
_Icons = {}
|
_Icons = {}
|
||||||
_Selector=None
|
_Selector=None
|
||||||
_FootMsg = ["Nav","RTA","Remove","Back","Play/Pause"]
|
_FootMsg = ["Nav","Remove","RTA","Back","Play/Pause"]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
_ListFont = fonts["notosanscjk15"]
|
_ListFont = MyLangManager.TrFont("notosanscjk15")
|
||||||
|
|
||||||
_Scroller = None
|
_Scroller = None
|
||||||
_CurSongTime="0:0"
|
_CurSongTime="0:0"
|
||||||
@ -180,11 +180,11 @@ class PlayListPage(Page):
|
|||||||
gobject.timeout_add(850,self.GObjectInterval)
|
gobject.timeout_add(850,self.GObjectInterval)
|
||||||
|
|
||||||
self._BGpng = IconItem()
|
self._BGpng = IconItem()
|
||||||
self._BGpng._ImgSurf = MyIconPool._Icons["heart"]
|
self._BGpng._ImgSurf = MyIconPool.GiveIconSurface("heart")
|
||||||
self._BGpng._MyType = ICON_TYPES["STAT"]
|
self._BGpng._MyType = ICON_TYPES["STAT"]
|
||||||
self._BGpng._Parent = self
|
self._BGpng._Parent = self
|
||||||
self._BGpng.AddLabel("my favourites", fonts["varela18"])
|
self._BGpng.AddLabel(MyLangManager.Tr("my favorite music"), MyLangManager.TrFont("varela18"))
|
||||||
self._BGpng.SetLableColor(SkinManager().GiveColor('Disabled'))
|
self._BGpng.SetLableColor(MySkinManager.GiveColor('Disabled'))
|
||||||
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
self._BGpng.Adjust(0,0,self._BGwidth,self._BGheight,0)
|
||||||
|
|
||||||
self._Scroller = ListScroller()
|
self._Scroller = ListScroller()
|
||||||
@ -235,9 +235,10 @@ class PlayListPage(Page):
|
|||||||
self._MyList[i]._PosY += self._Scrolled * self._MyList[i]._Height
|
self._MyList[i]._PosY += self._Scrolled * self._MyList[i]._Height
|
||||||
|
|
||||||
def Click(self):
|
def Click(self):
|
||||||
|
self.RefreshPsIndex()
|
||||||
if len(self._MyList) == 0:
|
if len(self._MyList) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
cur_li = self._MyList[self._PsIndex]
|
cur_li = self._MyList[self._PsIndex]
|
||||||
play_pos_id = myvars.Poller.play(self._PsIndex)
|
play_pos_id = myvars.Poller.play(self._PsIndex)
|
||||||
|
|
||||||
@ -251,7 +252,7 @@ class PlayListPage(Page):
|
|||||||
self.SyncScroll()
|
self.SyncScroll()
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
if myvars.Poller != None:
|
if myvars.Poller != None:
|
||||||
myvars.Poller.stop()
|
myvars.Poller.stop()
|
||||||
self._CurSongTime=""
|
self._CurSongTime=""
|
||||||
@ -282,7 +283,7 @@ class PlayListPage(Page):
|
|||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["Enter"]:
|
if IsKeyStartOrA(event.key):
|
||||||
self.Click()
|
self.Click()
|
||||||
|
|
||||||
if event.key == CurKeys["X"]: # start spectrum
|
if event.key == CurKeys["X"]: # start spectrum
|
||||||
@ -1,32 +1,33 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import pygame
|
import pygame
|
||||||
import validators
|
import validators
|
||||||
|
import commands
|
||||||
|
|
||||||
from UI.constants import Width,Height,ICON_TYPES
|
from UI.constants import Width,Height,ICON_TYPES
|
||||||
from UI.simple_name_space import SimpleNamespace
|
from UI.simple_name_space import SimpleNamespace
|
||||||
from UI.page import Page
|
from UI.page import Page
|
||||||
from UI.label import Label
|
from UI.label import Label
|
||||||
from UI.fonts import fonts
|
|
||||||
from UI.icon_item import IconItem
|
from UI.icon_item import IconItem
|
||||||
from UI.icon_pool import MyIconPool
|
from UI.icon_pool import MyIconPool
|
||||||
from UI.keys_def import CurKeys
|
from UI.keys_def import CurKeys, IsKeyMenuOrB
|
||||||
from UI.skin_manager import SkinManager
|
from UI.skin_manager import MySkinManager
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
|
||||||
from libs.DBUS import is_wifi_connected_now,get_wifi_ip
|
from libs.DBUS import is_wifi_connected_now,get_wifi_ip
|
||||||
|
|
||||||
class TinyCloudPage(Page):
|
class TinyCloudPage(Page):
|
||||||
_FootMsg = ["Nav.","","","Back",""]
|
_FootMsg = ["Nav","","","Back",""]
|
||||||
_MyList = []
|
_MyList = []
|
||||||
|
|
||||||
_ListFontObj = fonts["varela13"]
|
_ListFontObj = MyLangManager.TrFont("varela13")
|
||||||
|
|
||||||
_AList = {}
|
_AList = {}
|
||||||
_Labels = {}
|
_Labels = {}
|
||||||
|
|
||||||
_Coords = {}
|
_Coords = {}
|
||||||
|
|
||||||
_URLColor = SkinManager().GiveColor('URL')
|
_URLColor = MySkinManager.GiveColor('URL')
|
||||||
_TextColor = SkinManager().GiveColor('Text')
|
_TextColor = MySkinManager.GiveColor('Text')
|
||||||
_Scrolled = 0
|
_Scrolled = 0
|
||||||
|
|
||||||
_PngSize = {}
|
_PngSize = {}
|
||||||
@ -60,32 +61,39 @@ class TinyCloudPage(Page):
|
|||||||
|
|
||||||
self._Coords["forssh"] = SimpleNamespace()
|
self._Coords["forssh"] = SimpleNamespace()
|
||||||
self._Coords["forssh"].x = self._Coords["forID"].x
|
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"] = SimpleNamespace()
|
||||||
self._Coords["ssh_addr"].x = self._Coords["forID"].x
|
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"] = SimpleNamespace()
|
||||||
self._Coords["forwin"].x = self._Coords["forID"].x
|
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"] = SimpleNamespace()
|
||||||
self._Coords["samba_games"].x = self._Coords["forID"].x
|
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"] = SimpleNamespace()
|
||||||
self._Coords["samba_music"].x = self._Coords["samba_games"].x
|
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"] = SimpleNamespace()
|
||||||
self._Coords["for_airplay"].x = self._Coords["forID"].x
|
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"] = SimpleNamespace()
|
||||||
self._Coords["airplay_name"].x = 68
|
self._Coords["airplay_name"].x = 68
|
||||||
self._Coords["airplay_name"].y = self._Coords["for_airplay"].y
|
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"] = SimpleNamespace()
|
||||||
self._Coords["bg"].x = self._Width/2
|
self._Coords["bg"].x = self._Width/2
|
||||||
@ -109,6 +117,10 @@ class TinyCloudPage(Page):
|
|||||||
else:
|
else:
|
||||||
self._IP = "xxx.xxx.xxx.xxx"
|
self._IP = "xxx.xxx.xxx.xxx"
|
||||||
|
|
||||||
|
hostname = commands.getstatusoutput("hostname")[1]
|
||||||
|
if hostname == "":
|
||||||
|
hostname = "clockworkpi"
|
||||||
|
|
||||||
labels = \
|
labels = \
|
||||||
[["forssh","For ssh and scp:",self._ListFontObj,self._TextColor],
|
[["forssh","For ssh and scp:",self._ListFontObj,self._TextColor],
|
||||||
["ssh_addr","ssh cpi@%s" % self._IP, self._ListFontObj,self._URLColor],
|
["ssh_addr","ssh cpi@%s" % self._IP, self._ListFontObj,self._URLColor],
|
||||||
@ -119,7 +131,9 @@ class TinyCloudPage(Page):
|
|||||||
["forKey", "Key:", self._ListFontObj, self._TextColor],
|
["forKey", "Key:", self._ListFontObj, self._TextColor],
|
||||||
["key_and_pass", "cpi", self._ListFontObj, self._URLColor],
|
["key_and_pass", "cpi", self._ListFontObj, self._URLColor],
|
||||||
["for_airplay", "Airplay:", self._ListFontObj, self._TextColor],
|
["for_airplay", "Airplay:", self._ListFontObj, self._TextColor],
|
||||||
["airplay_name","clockworkpi", self._ListFontObj, self._URLColor]]
|
["airplay_name",hostname, self._ListFontObj, self._URLColor],
|
||||||
|
["for-usb-eth","USB-Ethernet:", self._ListFontObj, self._TextColor],
|
||||||
|
["usb-eth-addr","192.168.10.1", self._ListFontObj, self._URLColor]]
|
||||||
|
|
||||||
for i in labels:
|
for i in labels:
|
||||||
l = Label()
|
l = Label()
|
||||||
@ -142,11 +156,11 @@ class TinyCloudPage(Page):
|
|||||||
self._Width = self._Screen._Width ## equal to screen width
|
self._Width = self._Screen._Width ## equal to screen width
|
||||||
self._Height = self._Screen._Height
|
self._Height = self._Screen._Height
|
||||||
|
|
||||||
self._PngSize["bg"] = (253,132)
|
self._PngSize["bg"] = (253,114)
|
||||||
self._PngSize["online"] = (75,122)
|
self._PngSize["online"] = (75,122)
|
||||||
|
|
||||||
bgpng = IconItem()
|
bgpng = IconItem()
|
||||||
bgpng._ImgSurf = MyIconPool._Icons["needwifi_bg"]
|
bgpng._ImgSurf = MyIconPool.GiveIconSurface("needwifi_bg")
|
||||||
bgpng._MyType = ICON_TYPES["STAT"]
|
bgpng._MyType = ICON_TYPES["STAT"]
|
||||||
bgpng._Parent = self
|
bgpng._Parent = self
|
||||||
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
bgpng.Adjust(0,0,self._PngSize["bg"][0],self._PngSize["bg"][1],0)
|
||||||
@ -154,7 +168,7 @@ class TinyCloudPage(Page):
|
|||||||
self._Icons["bg"] = bgpng
|
self._Icons["bg"] = bgpng
|
||||||
|
|
||||||
onlinepng = IconItem()
|
onlinepng = IconItem()
|
||||||
onlinepng._ImgSurf = MyIconPool._Icons["online"]
|
onlinepng._ImgSurf = MyIconPool.GiveIconSurface("online")
|
||||||
onlinepng._MyType = ICON_TYPES["STAT"]
|
onlinepng._MyType = ICON_TYPES["STAT"]
|
||||||
onlinepng._Parent = self
|
onlinepng._Parent = self
|
||||||
onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)
|
onlinepng.Adjust(0,0,self._PngSize["online"][0], self._PngSize["online"][1],0)
|
||||||
@ -164,12 +178,10 @@ class TinyCloudPage(Page):
|
|||||||
self.SetLabels()
|
self.SetLabels()
|
||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
if event.key == CurKeys["A"] or event.key == CurKeys["Menu"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
if self._FootMsg[3] == "Back":
|
self.ReturnToUpLevelPage()
|
||||||
self.ReturnToUpLevelPage()
|
self._Screen.Draw()
|
||||||
self._Screen.Draw()
|
self._Screen.SwapAndShow()
|
||||||
self._Screen.SwapAndShow()
|
|
||||||
return
|
|
||||||
|
|
||||||
def Draw(self):
|
def Draw(self):
|
||||||
if self._DrawOnce == False:
|
if self._DrawOnce == False:
|
||||||
@ -191,6 +203,12 @@ class TinyCloudPage(Page):
|
|||||||
self._Labels["key_and_pass"].Draw()
|
self._Labels["key_and_pass"].Draw()
|
||||||
|
|
||||||
else:
|
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"].NewCoord(self._Coords["bg"].x, self._Coords["bg"].y)
|
||||||
self._Icons["bg"].Draw()
|
self._Icons["bg"].Draw()
|
||||||
|
|
||||||
@ -198,7 +216,7 @@ class TinyCloudPage(Page):
|
|||||||
self._DrawOnce = True
|
self._DrawOnce = True
|
||||||
|
|
||||||
if self._HWND != None:
|
if self._HWND != None:
|
||||||
self._HWND.fill(SkinManager().GiveColor('White'))
|
self._HWND.fill(MySkinManager.GiveColor('White'))
|
||||||
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,self._Width, self._Height ) )
|
||||||
|
|
||||||
|
|
||||||
@ -4,15 +4,17 @@ import pygame
|
|||||||
|
|
||||||
#UI lib
|
#UI lib
|
||||||
from UI.constants import RUNSYS
|
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.confirm_page import ConfirmPage
|
||||||
|
from UI.lang_manager import MyLangManager
|
||||||
|
from UI.skin_manager import MySkinManager
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
class PowerOffConfirmPage(ConfirmPage):
|
class PowerOffConfirmPage(ConfirmPage):
|
||||||
|
|
||||||
_ConfirmText = "Awaiting Input"
|
_ConfirmText = MyLangManager.Tr("Awaiting Input")
|
||||||
_FootMsg = ["Nav","Reboot","","Cancel","Shutdown"]
|
_FootMsg = ["Nav","","Reboot","Cancel","Shutdown"]
|
||||||
|
|
||||||
def CheckBattery(self):
|
def CheckBattery(self):
|
||||||
try:
|
try:
|
||||||
@ -41,17 +43,16 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
|
|
||||||
def KeyDown(self,event):
|
def KeyDown(self,event):
|
||||||
|
|
||||||
if event.key == CurKeys["Menu"] or event.key == CurKeys["A"]:
|
if IsKeyMenuOrB(event.key):
|
||||||
|
|
||||||
self.ReturnToUpLevelPage()
|
self.ReturnToUpLevelPage()
|
||||||
self._Screen.Draw()
|
self._Screen.Draw()
|
||||||
self._Screen.SwapAndShow()
|
self._Screen.SwapAndShow()
|
||||||
|
|
||||||
if event.key == CurKeys["B"]:
|
if IsKeyStartOrA(event.key):
|
||||||
if self.CheckBattery() < 20:
|
if self.CheckBattery() < 20:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/gameover.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("gameover.png")
|
||||||
else:
|
else:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
|
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ class PowerOffConfirmPage(ConfirmPage):
|
|||||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||||
|
|
||||||
if event.key == CurKeys["X"]:
|
if event.key == CurKeys["X"]:
|
||||||
cmdpath = "feh --bg-center gameshell/wallpaper/seeyou.png;"
|
cmdpath = "feh --bg-center %s;" % MySkinManager.GiveWallpaper("seeyou.png")
|
||||||
cmdpath += "sleep 3;"
|
cmdpath += "sleep 3;"
|
||||||
cmdpath += "sudo reboot"
|
cmdpath += "sudo reboot"
|
||||||
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
pygame.event.post( pygame.event.Event(RUNSYS, message=cmdpath))
|
||||||
@ -1 +0,0 @@
|
|||||||
retroarch
|
|
||||||
@ -1 +0,0 @@
|
|||||||
chocolate-doom -iwad /home/cpi/games/FreeDM/freedoom1.wad
|
|
||||||
11
README.md
@ -46,7 +46,14 @@ sudo apt-get -y install mpd ncmpcpp git libuser
|
|||||||
sudo apt-get -y install python-wicd wicd wicd-curses python-pycurl python-alsaaudio python-pygame python-gobject python-xlib
|
sudo apt-get -y install python-wicd wicd wicd-curses python-pycurl python-alsaaudio python-pygame python-gobject python-xlib
|
||||||
|
|
||||||
sudo apt-get -y install python-pip
|
sudo apt-get -y install python-pip
|
||||||
sudo pip install validators numpy requests python-mpd2
|
sudo pip install validators numpy requests python-mpd2 beeprint
|
||||||
|
```
|
||||||
|
|
||||||
|
### With pip install and virtualenv
|
||||||
|
|
||||||
|
```
|
||||||
|
mkvirtualenv launcher
|
||||||
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
# Create “.mpd_cpi.conf” config
|
# Create “.mpd_cpi.conf” config
|
||||||
@ -83,3 +90,5 @@ audio_output {
|
|||||||
|
|
||||||
filesystem_charset "UTF-8"
|
filesystem_charset "UTF-8"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
18
aria2.conf
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
max-connection-per-server=5
|
||||||
|
enable-rpc=true
|
||||||
|
rpc-allow-origin-all=true
|
||||||
|
rpc-listen-all=true
|
||||||
|
log-level=error
|
||||||
|
log=/tmp/aria.log
|
||||||
|
dir=/home/cpi/aria2download
|
||||||
|
daemon=true
|
||||||
|
allow-overwrite=true
|
||||||
|
split=1
|
||||||
|
max-concurrent-downloads=100
|
||||||
|
disk-cache=15M
|
||||||
|
timeout=600
|
||||||
|
retry-wait=30
|
||||||
|
max-tries=50
|
||||||
|
save-session-interval=10
|
||||||
|
disable-ipv6=true
|
||||||
|
save-session=/home/cpi/aria2download/aria.session.txt
|
||||||
499
awesome/rc.lua
Normal file
@ -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)
|
||||||
|
|
||||||
|
|
||||||
3
awesome/themes/default/README
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Background images:
|
||||||
|
Mikael Eriksson <mikael_eriksson@miffe.org>
|
||||||
|
Licensed under CC-BY-SA-3.0
|
||||||
BIN
awesome/themes/default/background.png
Normal file
|
After Width: | Height: | Size: 403 KiB |
BIN
awesome/themes/default/background_white.png
Normal file
|
After Width: | Height: | Size: 403 KiB |
BIN
awesome/themes/default/layouts/cornerne.png
Normal file
|
After Width: | Height: | Size: 451 B |
BIN
awesome/themes/default/layouts/cornernew.png
Normal file
|
After Width: | Height: | Size: 409 B |
BIN
awesome/themes/default/layouts/cornernw.png
Normal file
|
After Width: | Height: | Size: 439 B |
BIN
awesome/themes/default/layouts/cornernww.png
Normal file
|
After Width: | Height: | Size: 381 B |
BIN
awesome/themes/default/layouts/cornerse.png
Normal file
|
After Width: | Height: | Size: 424 B |
BIN
awesome/themes/default/layouts/cornersew.png
Normal file
|
After Width: | Height: | Size: 411 B |
BIN
awesome/themes/default/layouts/cornersw.png
Normal file
|
After Width: | Height: | Size: 424 B |
BIN
awesome/themes/default/layouts/cornersww.png
Normal file
|
After Width: | Height: | Size: 423 B |
BIN
awesome/themes/default/layouts/dwindle.png
Normal file
|
After Width: | Height: | Size: 425 B |
BIN
awesome/themes/default/layouts/dwindlew.png
Normal file
|
After Width: | Height: | Size: 444 B |
BIN
awesome/themes/default/layouts/fairh.png
Normal file
|
After Width: | Height: | Size: 312 B |
BIN
awesome/themes/default/layouts/fairhw.png
Normal file
|
After Width: | Height: | Size: 314 B |
BIN
awesome/themes/default/layouts/fairv.png
Normal file
|
After Width: | Height: | Size: 323 B |
BIN
awesome/themes/default/layouts/fairvw.png
Normal file
|
After Width: | Height: | Size: 323 B |
BIN
awesome/themes/default/layouts/floating.png
Normal file
|
After Width: | Height: | Size: 361 B |
BIN
awesome/themes/default/layouts/floatingw.png
Normal file
|
After Width: | Height: | Size: 365 B |
BIN
awesome/themes/default/layouts/fullscreen.png
Normal file
|
After Width: | Height: | Size: 866 B |