ono_sendai - wip
This commit is contained in:
parent
e7d1f0ea03
commit
b93521988b
15 changed files with 296 additions and 69 deletions
22
ono_sendai/animation/0.txt
Normal file
22
ono_sendai/animation/0.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
▄╥╥,, ,╓╓╥╥╥╥╥╓,, ,╓╥╥▄
|
||||
,╓╦╦╦w, ╙╣╫▓╦ ╔Ñ▒╫╫╫╫╫Ñ╩╩╩╫╫╫Ñw ,╦▓Ñ╩╙ ¿╔╦╦╥ç
|
||||
╔D╩▀▀╩▒╫╫╫╫Φw ╙▀╬▓╫▄ ,▓▓╫╫╫╫╫Ñ░░░░░░░╫╫▓▓ ▄╫▓ÑÅ┘ ╓╫╫╫╫╬╫╩▀▀╩▄w
|
||||
▒╫╢╫Ñ▌ ╓▒╟▓╫⌐ ▌╫╫╫╫╫╫╫N░╦╦╦░░░]╫╫╫▓ ▐╫▓K║╓ ,╫╫╫╬╬╬
|
||||
ⁿ▄╣╫Ñ▌ ▓▒╣▓▌ ╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╩╫╫╫╫╣╫╫▌ ▀▓▓Ñ╣ ▌╫╫Ñ╟
|
||||
▓Ö╟╫╫▓ 1▒╬▓▓ ╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╦]╫╫╫╫╫╫▌ ▌▓▓╣▄ ▒╫╫K║▓
|
||||
▄Ü░╣╫▓^ ╘▓░▓▓▓ ▐╫╫╫▓╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫⌐ ▌▓▓╬▌⌐ ╙▓╫Ñ░h┐
|
||||
┼▒░╬╫╬⌐ ▒╫▓▓▓▌ ╙╫╫╫╫╫╫╫╣╫╫╬╫╫╫╫╬╫╫▓Γ Φ▓▓▓░╫ ▐▒╫Ñb▒▌
|
||||
▌»╟╫╫╣ ▒▌╬▓▓▓┐ └▓╫▓╠Å╫▓╫╫╫▓╫╠Å╫╫▓ ]▓▓▓▌╫▒ ╒▒╫╫░b▌
|
||||
╣▌░╢╫╫▓ ▀╟▓▓▓▓▄ ╙╫╫╫╫╫╫╫╫╫╫╫╫╫╫╬ ,▄▓▓▓▓░▀ ,▓╫╫R░║Æ
|
||||
`▀░░╣╫╫▌ ╚╠▓▓╫▓▓▓▓▌╫╫╫╫╫░▒▒╫╫╫╫╬▓▓▓▓▓▓▓▓▒⌐ ,▓╫╫Ñ░░▀
|
||||
╓╥mMMM╦╫▄╙╟╣╫╫▓▄▄╓Å╬╫▓▓▓▓█╫╫╫╫╫╩Ü»▄▀▒╫╫▌╫█▓▓▓▓╫▌⌠╓▄▄▓╫╫╫Ö▐▄╫#MMMm╥w
|
||||
#░╫╫Ñ╩╩╩╫╫╫▒▒▒╫╫╫▒╫▓▓▓▓▓▓▓▀╫╫╫╫╫▓▄Å░¥▄╫╫╫╫╫╫╫▓▓▓▓▓▓▓╫▒╫╫╫▒▒░╫╫╩╩╩╩Ñ╫ÑÑ╖
|
||||
Φ╫Ñ╠╨╩╜"^N▐Γ╨╨Ñ╫╫╫╫▒▒▒╫╫╫╫╫╫╫╫╫╫╫╫╫╫▒▒╫╫╫╫╫╫╫╫╫╫╫╫░▒▒▒╫╫╫╫Ñ╨╨▐∞╣^"▀N╨φ╫KL
|
||||
▌╫║ `$▄¡░╨╨Ñ╫╫╫╫╫╫╫╫╫╫Ñ╫╫╫╫╫╬╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╨╨░¿▄▌` D╫║
|
||||
╚╠▌ ` `╙╫▒V≡╩╨╨╨"` ▒╠╫╫╫▓▓ ▀╬╫Ñ╫╫⌐"╨╨╨╩≡╝▒Ñ"` ` ╟ÑΓ
|
||||
╙▓ ▄╫╫╫╫▌ ▓╫╫D╫▌ ▌¬
|
||||
` ╙@╫╫╫╫M `╫╫Ñ╨╩
|
||||
|
||||
|
||||
|
22
ono_sendai/animation/1.txt
Normal file
22
ono_sendai/animation/1.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
|
||||
≈▄ ,▄⌐
|
||||
`▀╩▓Ñ╦╥, ╙╫N ,,╓╓╓╓,,, ╓╣╣┘ ,╥╦Ñ▓╩▀
|
||||
╙╫╫ÑÑw ╣╟╫, ,ΦÑ▒╫╫╫╫╫ÑÑ╫░▒ÑN, J╫ÑW ╔╫╫╬╩╨
|
||||
▀╠╬╬╫ Φ╟▓▓ ▓╫╫╫╫╫╫╫░░░░░░╨╫╫╫N ▓╣▌▌ ,M╫╣░╝
|
||||
╚K╩╣Ñ╟ ▓░╣▓▓ ▓╫╫╫╫╫╫╫░░░░░░░░]╫╫╫▓ ▓▓▓║▓ ▀╫╫░▌Γ
|
||||
║]╫╫╫L Φ╫▓▓▀ Φ╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╫╫╫╫╫╫╫Γ ▀▓▓░╕ ¢╬╫ÑH▄
|
||||
╚▓░╫╫╫Γ╥▀╬▓▓▄ ╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ░]╫╫╫╫╫╫▌ ▐▓▓K╣╖▐╫╫Ñ░▌Γ
|
||||
╟╗╔╫╫╫ ╙▒╫▓▓▌ ▐╫╫╫╬╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫Γ ▓▓▓░╢╛ ▌╫╫░≥L
|
||||
-╣N╬╫╫▌ ▀╫▓▓╫▄ ▀╫╫╫╫╫╫╫╫╫Ñ╫╫╫╫╫╫▓╫╫▀ ▄╫▓▓╫▌ ║╫╫K╢M
|
||||
▐π░╫╫╫ ╙▌╢▓▓╫▌ ╙╫╫KÜ╨╫▓╫╫╫▓╫╨╫╫╫╫┘ ╬▓▓▓Ü▓╜ `╫╫╬»╢L
|
||||
,zmD░░░BN╫▓░╫╫╫▄ `▄▓▓╫▓▌ ╙╫▓▓▓▌╫╫╫╫╫▓╫▓▌╫┘ ▓▓╫▓▌╬ ▐╫╫╫µ▌▀ΦB░░░Dmw,
|
||||
,╦B╩╬╨╨╨╨╩╩╫╫╫▒╫╫╫╫▄ ╫▓▓╫▓▓▓▌▄╫╫╫╫╫Φ▒╫╫╫╬╣▓▓▓▓▓▓▓╩ ▄╫╫╫▀▒╫╫Ñ╩╩╨╨╨╨╬╩╬╦
|
||||
#╩" º╩"Ü╙╨╫╫░▀╫╫╫▓K╗▄▓▓▓▓▓▓▓▌╫╬╫▀½▄A▀▒╬╬▀╣▓▓▓▓▓▓▄@Φ▓╫╫╫▀▒╫╫╩░≥"╩╜ ╙╩H
|
||||
╘Ñ¥╙╩╫╫╫▒▀╫╫╫▀▀▀▀▀╫╫╣╣╫╫▓NÖ»╠╦╫╫╫╫╫╫╫▀▀▀▀▀▀╫╫▀▒╫╫╫╩:KÑ╛
|
||||
▀φ╙╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫░▒░╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╩░$╛
|
||||
`╙^╩▄░╨╨╩╫╫╫╫╫╫╫╫╫Ñ╫╫╫╫╫╬╫╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╩╨╨░▄╙╙*
|
||||
╙╝╨"╜╨╜""`` ▒╠╫╫╫╣▓ ▀╬╫Ñ╠╫┘`""╜╨╜"╝╩┘
|
||||
Φ╚╫╫╫╫` ▀╬╫N╨▌
|
||||
▒╩╫╫╫▌ ▀╫╫╧*
|
||||
|
22
ono_sendai/animation/2.txt
Normal file
22
ono_sendai/animation/2.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
▄ ╥
|
||||
,╬ ≤╫▓ ,,,, ▀▓╖ N
|
||||
M╫ ¿╢╬╫^ ╦Φ╫▒▒╫╫╫╫░▒╫╫Φ╦ ▐╫▒p, ▀╣
|
||||
H╬W, ║░╣╫ #╫╫╫╫╫╫╫░░░░░░╨╫╫╫▄ ▓▓╠▌ ,╫R║
|
||||
`╬╨╫╫▒Φ, ▄▒╫▓╫ ▓╫╫╫╫╫╫╫░░░░░░░░╠╫╫╫▌ ,▓▓╫B╖ zΦ▒╫╫╩Å
|
||||
Φ▒░╣ÑN ▐M╫▓▓▌ Φ╫╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╦╫╫╫╫╫L ║▓▓MÆ` Φ╫Ñ░Å▀
|
||||
╫Ñ╫Ñ▌ ▒╫▓▓▓ ╫╫╫▓╫╫╫╫╫╫╫╫╫Ñ░]╫╫╫▓╫╫▌ ▌▓▓M╫ ╢╫╫░▌
|
||||
╩▌╫╫╫∩[╢░╣▓▓▌ ╚╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫Γ ▓▓▓▓░▌L╒╫╫╣╟╝
|
||||
▌╟╫╫▌ └▒░╢▓▓▄ ▀╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╬▓╫╫▌ ▄▓▓▓░▌` ║╫╫K╟
|
||||
, ▀N░╫╫▓ ╢▓╫▓▓▓▌ ▀╫╫╫╩╩╫╣▓▓▓▓╫╩╫╟╫╫▀ ,▓▓▓▓╨╬╕ ,▒╫╫░║▀ ,
|
||||
▌╫, -▄░╫╫╫▓ "╬╬▓▓▓▓W 1╫▓╬▄▌╫╫╫╫╫▓╫▓▌╫▀,Φ▓▓▓▓Ü▓" ▓╫╫╣░▄ ¿╫▌
|
||||
'╬╫╬DWm╥=,, ╘▒▄╟╫╫╫▓, ╬╢▓▓▓▓▓▓▓Ñ╬╫╫╫╫╩╬▒╫╫Ñ╣╢▓▓▓▓▓▓ÑÅ ╓▓╫╫╫░▐▒Γ ,,╓╥mmN╦Ñ║
|
||||
"╩╨╩Ñ╫NNN╫▒╫M▄╠╣╫╫╫▓K▄⌠╫▓▓╫▓█╫▒╬╬╫▀ñ▄╝╙▒╬╫╣╫█▓╫▓▓▌▄▄Φ▓╫╫╫╣▄▄╣╫▒╫╫NÑ╫Ñ╩╠Å^
|
||||
╙╫1╩Ü░╩╫╫╫╫▒▀╫╫╫╫▓▓▓▓▓▓╫╫╫╫╫╫▓Ñ▌⌂▄▓╫╫╫╫╫╫╫▓▓▓▓▓▓▒╫╫╩▀▒╫╫╫Ñ╩░ÑÅûΩ┘
|
||||
╘╧╙╝▄╨Ñ╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╨▄╧╙╨┘
|
||||
╙╝ⁿ≡╨╨╩╫╫╫╫╫╫╫╫╫╫Ñ╫╫╫╫╫╫╫╫╫╫╫╫╫╬╫╫╫╫╫╫╫╫╩╨Ü≡*╩┘
|
||||
╚▒M╜≡╩╨╨""`▐░╫╫╫╬╫╨ ╙▒╫Ñ╙╬▄""╨╨≡╝╨╬▒▀
|
||||
▒╨╫╫╫▓ⁿ ╙▒╫╫Ü╫╕
|
||||
"╩Ñ╬▌ ╙ÑÑ╨`
|
||||
|
||||
|
22
ono_sendai/animation/3.txt
Normal file
22
ono_sendai/animation/3.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
|
||||
|
||||
|
||||
▄╦ΦÑ╫▒▒▒▒▒╫ÑΦ╦▄
|
||||
▄▄▄, Φ╫╫╫╫╫╫╫╨░░░░░╨╫╫╫N ,▄▄╓
|
||||
▄▓ `╙╩╫╫R╦µ ▓╫╫╫╫╫╫╫░░░░░░░░░╫╫╫▓ ╓╦Ñ╫╫╩╨` ▌▌
|
||||
▀╙Ñ ╚╩╫╣▓╫W ▓╫╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╦╫╫╫╫╫▓ Φ╫▓▓Ñ╩╨ .╫░▀
|
||||
░╟╫ ▓▒╣▓▓▓ ▌╫╫╫╫╫╫╫╫╫╫╫╫Ñ░╨╫╫╫╫╫╫▓ ▓▓▓Ñ║▓ ,╫у
|
||||
╙╨╬░N╥, J▒╣▓▓▌ ▓╫╫▓╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫▓╫╫▓ ║▓▓▌╫L ,╥╬╫Ñ▐`
|
||||
║▄╬╬╫╬╫Nç ▀╣╫▓▓╫∩ ▐╫╫╫▓╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫ ╓╫▓▓╫▌╜ ╓Φ╫╫╫╩M╠▌
|
||||
``▒▒╠╣Ñ╫▄ ▐▒╫▓▓▓, `▓╫▓╫Ñ╫╫▓╬╬╣▓╫ÑÑ╫╫╫▓ ╓▓▓▓╫╩H ΦÑ╫╫Ü╬╬``
|
||||
"\╨╫╫╫N ▀▓╫╢▓▓╫▄ ▓╫▌▓╣╫╫╫╫╫╫╫▄▓▓╫▓ ,▄╫▓▓▓Ñ▓╛ Φ╫╫╫░▀"
|
||||
╢Φ╠╣╫╫▓╦ ╚╫╬▓▓▓▓▓╗▄▓B╫╫╫░╩╨╩▒╫╫╫╫▌▄╗▓▓▓▓▓╣Φ╛ ╦╫╫╫Ñ░#╛
|
||||
╓╥ ╘I╨╣╫╫╫▓▄▄┌╚▒╫╫▓▓▓█▓╫╬╬╫M╠R▒╙▒╬╫╫▌█▓▓▓╫╫▓╙╓▄▄▓╫╫╫╣ÜhΓ ,╥
|
||||
╩░╫h≥╖,,╓╥╦##Φ╢▄▄╨╣╫╫╫╫╫▓▓▓╫▓▓▀╫╫╫╫╫╫▓▌▄▄▓▓╫╫╫╫╫▀▓▓╫▓▓▓╫╫╫╫╫╣╫▄ΦRNm#╥╥,,,╥σÆ╫╩Å
|
||||
╙╩╩K╬ÑÑ╩╨╨Ñ╫╫╫╫▒▒▒▒▒▀▀▀▀╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫▀▀▀▀▒▒╣▒░╫╫╫╫Ñ╨╨Ñ╫ÑK╩╬╩╜
|
||||
`"▄M``╚▒Φ▄╨╨Ñ╫╫╫╫╫╫╫╫╫╫╫╫╫╬▒Ñ╫╫╫╫╫╬╫╫╫╫╫╫╬╫╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╨╨▄U▒⌐`'╬╢"`
|
||||
▀B╨╜╜≡▄▄╠╩╝╨╨"` ,H╫╫╫╫╫▀ ╙▒╫Ñ╫╩▌""╨╨╩╩▄▄╗≡╜╜VQ▀
|
||||
` .╬]╫╫╫╫╛ ╙▓╫╫N╨╫⌐ `
|
||||
"╩Ñ╣▀ ╙ÑÑ"
|
||||
|
22
ono_sendai/animation/4.txt
Normal file
22
ono_sendai/animation/4.txt
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
|
||||
|
||||
,,,,
|
||||
╦Φ╫▒▒╫╫╫╫░▒╫╫Φ╦
|
||||
╓φΦΦ╫╫NN╥, #╫╫╫╫╫╫╫░░░░░░╨╫╫╫▄ ╓φΦ╫╫╫╫╬ΦW▄
|
||||
,╓φΦDΦ╦╥, ```╙╨▒▒╣▓╣╫∩ ▓╫╫╫╫╫╫╫░░░░░░░░╠╫╣╫▄ ▓▓╫▓Ñ╬▀` ╓φΦÑ▒╫╫N╦µ
|
||||
``"*╩Å╨╬╫╫Φ╥ ▌╫▓▓▓ Φ╫╫╫╫╫╫╫╫╫╫╫╫╫╫Ñ╦╫╫▓╫╫ ▄▓▓▓╬▄ x╫╫╫╬╫Ñ╨"-
|
||||
[╣╣╣╫▒╗ ╙▒▓▓▓⌐ ╫╫╫▓╫╫╫╫╫╫╫╫╫Ñ░]╫╫╫╫╫╫ ▓▓▓K▌ ╓╫╫╫╩╗▓
|
||||
`|╟╫╫╫ ╒╫░▓▓▓ ╚╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╣╫╫╫ ▓▓Ü╫▓ ▓╫╫╫H┘
|
||||
@░╟╫╫╬ ¡▀╣▓╫Γ ▀╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╬▓╫▓^ ▓▓▓░Ñ ╟╫╫╫Ñ╣╕
|
||||
▐T╣╫╫╢ ╣M╬▓╫▓ ▀╫╫╫╩╩╫╣▓▓▓▓╫╩╫╟╫▓ ▄╫▓▓Å▓╕ ║╫╫╫K║
|
||||
╢▒╫╫╫╫▌ ╙▌░╢▓▓▌, ▀╫▓╬▄▌╫╫╫╫╫▓╫▓▌▓, ,▄╫▓▓Ü╣Γ ,▒╫╫╫╙▌╕
|
||||
╙▌╨╫╫╫╫▄ ╫╫╣▓▓▓▓▓▓▓▓Ñ╬╫╫╫╫╩╬▒╫╫Ñ╣▓▓▓▓▓▓▓▓╣Φ┘ ╓▀╫╫╫Ü╙"
|
||||
,%╬╣╫╫╫╫▓▄▄▄▀▄╫▓▓▓▓█╫▒╬╬╫▀ñ▄╝╙▒╬╫╣╫▓▓▓╫▓▓▓▓▄#▓╫╫╫╫╫Ñ╠▒
|
||||
,,,,,, ╝╬░╟╣╫╫╫╫╫╫▓▓▓▓╫▓▀╫╫╫╫╫▓Ñ▌⌂▄▓╫╫╫╫╫╫╫▓▓▓▓▓╫╫╫╫╫╫╫M░║^╙,╓╥╥╥w,
|
||||
,ó╫╦Ñ╫╫Ñ╦╫K╦▄▄»╨╟╣╬▒▒╬╫▀▀╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫▀╫╫╬╬▒╫▄▄▄▓╦Æ░╦╫╫Ñ╩╬Ñ╫≥
|
||||
z░╩╨"╩M╙╝╨╨Ñ╫╫╫▒▒▒▒░╫╫╫╫╫╫╫╫╫╫╫Ñ╫╫╫╫╫╬╫╫╫╫╫╫▒╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╩╨▐╝^`╨┘`╙╫╫
|
||||
j╩` ╩╩╚ú░╨╩╩╫╫ÑÑÑ╩╩╨╨▄╙╨▄░╫╫╫╬╫╨ ▀╬╫Ñ╙╣▌╨Ü▄╨╨╨╩╩╩╩╩╨╨Ü≡╜╙╜┘ `▓
|
||||
'╝╨'"╜▀ßM^` ▒╨╫╫╫╫⌐ ▀╬╫Ñ╙╫⌐ └╝╧╙└` ╜┘
|
||||
"╩ÑÑ╩ ▀ÑÑ"`
|
||||
|
BIN
ono_sendai/animation/frame_0_delay-0.15s.gif
Normal file
BIN
ono_sendai/animation/frame_0_delay-0.15s.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
ono_sendai/animation/frame_1_delay-0.15s.gif
Normal file
BIN
ono_sendai/animation/frame_1_delay-0.15s.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
ono_sendai/animation/frame_2_delay-0.15s.gif
Normal file
BIN
ono_sendai/animation/frame_2_delay-0.15s.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
ono_sendai/animation/frame_3_delay-0.15s.gif
Normal file
BIN
ono_sendai/animation/frame_3_delay-0.15s.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
ono_sendai/animation/frame_4_delay-0.15s.gif
Normal file
BIN
ono_sendai/animation/frame_4_delay-0.15s.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
ono_sendai/animation/octopus-clipart-animated-gif-6.gif
Normal file
BIN
ono_sendai/animation/octopus-clipart-animated-gif-6.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
22
ono_sendai/animation/prova.py
Normal file
22
ono_sendai/animation/prova.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from colorama import Style, Fore
|
||||
|
||||
|
||||
from time import sleep
|
||||
from os import system
|
||||
|
||||
|
||||
frames = []
|
||||
for i in range(5):
|
||||
with open(str(i)+'.txt', 'r') as f:
|
||||
content = f.read()
|
||||
frames.append(f'{Fore.MAGENTA}'+content+f'{Style.RESET_ALL}')
|
||||
|
||||
def animate(n):
|
||||
for i in range(n):
|
||||
print(frames[i%5])
|
||||
sleep(0.2)
|
||||
system('clear')
|
||||
|
||||
if __name__ == '__main__':
|
||||
from sys import argv
|
||||
animate(int(argv[1]))
|
|
@ -4,6 +4,10 @@ from picotui.screen import Screen
|
|||
from time import sleep
|
||||
|
||||
from widgets import *
|
||||
import state
|
||||
|
||||
action = ''
|
||||
exit = False
|
||||
|
||||
class FrameFactory:
|
||||
titles = ['0x10', '0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17',
|
||||
|
@ -21,7 +25,29 @@ class FrameFactory:
|
|||
self.titlen = 0
|
||||
self.hand = None
|
||||
self.maxwidth = 0
|
||||
|
||||
|
||||
def constrainAllWidgets(self, callerId):
|
||||
cc = self.widgets[callerId].choice if id != -1 else self.hand.choice
|
||||
|
||||
# check hand first
|
||||
if callerId != -1 and self.hand.choice > 1 and cc > 1:
|
||||
self.hand.choice = 1
|
||||
self.hand.redraw()
|
||||
return
|
||||
# check other widgets
|
||||
for w in self.widgets:
|
||||
if w.id != callerId and w.choice != 1:
|
||||
if w.choice == 0 and cc == 0:
|
||||
w.choice = 1
|
||||
w.redraw()
|
||||
return
|
||||
elif w.choice > 1 and cc > 1:
|
||||
w.choice = 1
|
||||
w.redraw()
|
||||
return
|
||||
else:
|
||||
pass
|
||||
|
||||
def newFrame(self, cards):
|
||||
# can handle 9 frames per row
|
||||
assert type(cards) is list, type(cards)
|
||||
|
@ -29,7 +55,7 @@ class FrameFactory:
|
|||
h = 2 + len(cards) # height ?
|
||||
self.maxwidth = h if h > self.maxwidth else self.maxwidth
|
||||
title = self.titles[self.titlen]
|
||||
w = WCardRadioButton(cards)
|
||||
w = WCardRadioButton(cards, len(self.widgets), self.constrainAllWidgets)
|
||||
|
||||
self.d.add(self.x, self.y, WColoredFrame(12, h, title))
|
||||
self.d.add(self.x+1, self.y+1, w)
|
||||
|
@ -47,7 +73,7 @@ class FrameFactory:
|
|||
|
||||
def emptyFrame(self):
|
||||
title = self.titles[-1]
|
||||
w = WCardRadioButton(['', ''])
|
||||
w = WCardRadioButton(['', ''], len(self.widgets), self.constrainAllWidgets)
|
||||
|
||||
self.d.add(self.x, self.y, WColoredFrame(12, 4, title))
|
||||
self.d.add(self.x+1, self.y+1, w)
|
||||
|
@ -59,8 +85,9 @@ class FrameFactory:
|
|||
def newHandFrame(self, cards):
|
||||
assert type(cards) is list, type(cards)
|
||||
h = 27 # height ?
|
||||
self.d.add(1, 1, WColoredFrame(12, h, 'HAND', blue))
|
||||
w = WCardRadioButton([f'{Fore.BLUE}'+cards[0]] + cards[1:-1] + [cards[-1]+f'{Style.RESET_ALL}'], isHand=True)
|
||||
self.d.add(1, 1, WColoredFrame(12, h, 'HAND', blue))
|
||||
coloredCards = [f'{Fore.BLUE}'+cards[0]] + cards[1:-1] + [cards[-1]+f'{Style.RESET_ALL}']
|
||||
w = WCardRadioButton(coloredCards, -1, self.constrainAllWidgets, isHand=True)
|
||||
self.d.add(2, 2, w)
|
||||
self.hand = w
|
||||
|
||||
|
@ -81,44 +108,61 @@ class FrameFactory:
|
|||
src = i, w.choice-2
|
||||
return src, dst
|
||||
|
||||
def makeButtons(d):
|
||||
buttonSend = WColoredButton(7, "SND", C_RED)
|
||||
dialog.add(108, 28, buttonSend)
|
||||
buttonSend.finish_dialog = ACTION_OK
|
||||
def btnSend(w):
|
||||
global action; action = "SEND"
|
||||
buttonSend.on_click = btnSend
|
||||
|
||||
cc = ['asd', 'asd']
|
||||
c = ['asd', 'asd']
|
||||
buttonRst = WColoredButton(7, "RST", C_RED)
|
||||
dialog.add(100, 28, buttonRst)
|
||||
buttonRst.finish_dialog = ACTION_OK
|
||||
def btnReset(w):
|
||||
global action; action = "RESET"
|
||||
buttonRst.on_click = btnReset
|
||||
|
||||
buttonMov = WColoredButton(7, "MOV", C_BLUE)
|
||||
dialog.add(92, 28, buttonMov)
|
||||
buttonMov.finish_dialog = ACTION_OK
|
||||
def btnMove(w):
|
||||
global action; action = "MOVE"
|
||||
buttonMov.on_click = btnMove
|
||||
|
||||
buttonDraw = WColoredButton(7, "DRW", C_RED)
|
||||
dialog.add(84, 28, buttonDraw)
|
||||
buttonDraw.finish_dialog = ACTION_OK
|
||||
def btnDraw(w):
|
||||
global action; action = "DRAW"
|
||||
buttonDraw.on_click = btnDraw
|
||||
|
||||
buttonAbort = WColoredButton(13, f'{Fore.BLACK}'+" ABRT "+f'{Style.RESET_ALL}', C_WHITE)
|
||||
dialog.add(4, 28, buttonAbort)
|
||||
buttonAbort.finish_dialog = ACTION_OK
|
||||
def doExit(w):
|
||||
global action ; action = "EXIT"
|
||||
buttonAbort.on_click = doExit
|
||||
|
||||
buttonback = WColoredButton(7, " BAK ", C_MAGENTA)
|
||||
dialog.add(76, 28, buttonback)
|
||||
buttonback.finish_dialog = ACTION_OK
|
||||
def doBack(w):
|
||||
global action ; action = "BACK"
|
||||
buttonback.on_click = doBack
|
||||
|
||||
import state
|
||||
table = state.table
|
||||
hand = state.hand
|
||||
|
||||
exit = False
|
||||
while not exit:
|
||||
table, hand = state.next()
|
||||
with Context():
|
||||
|
||||
Screen.attr_color(C_WHITE, C_GREEN)
|
||||
Screen.cls()
|
||||
Screen.attr_reset()
|
||||
tableDialog = Dialog(1, 1, 120, 30)
|
||||
f = FrameFactory(tableDialog)
|
||||
dialog = Dialog(1, 1, 120, 30)
|
||||
f = FrameFactory(dialog)
|
||||
|
||||
#### BUTTONS ####
|
||||
buttonOk = WColoredButton(7, "SND", C_RED)
|
||||
tableDialog.add(108, 28, buttonOk)
|
||||
buttonOk.finish_dialog = ACTION_OK
|
||||
buttonRst = WColoredButton(7, "RST", C_RED)
|
||||
tableDialog.add(100, 28, buttonRst)
|
||||
buttonRst.finish_dialog = ACTION_OK
|
||||
buttonMov = WColoredButton(7, "MOV", C_BLUE)
|
||||
tableDialog.add(92, 28, buttonMov)
|
||||
buttonMov.finish_dialog = ACTION_OK
|
||||
buttonDraw = WColoredButton(7, "DRW", C_RED)
|
||||
tableDialog.add(84, 28, buttonDraw)
|
||||
buttonDraw.finish_dialog = ACTION_OK
|
||||
|
||||
buttonAbort = WColoredButton(13, f'{Fore.BLACK}'+" ABRT "+f'{Style.RESET_ALL}', C_WHITE)
|
||||
tableDialog.add(4, 28, buttonAbort)
|
||||
buttonAbort.finish_dialog = ACTION_OK
|
||||
def doExit(w):
|
||||
global exit ; exit = True
|
||||
buttonAbort.on_click = doExit
|
||||
makeButtons(dialog)
|
||||
|
||||
#### FRAMES ####
|
||||
f.emptyFrame()
|
||||
|
@ -126,14 +170,24 @@ while not exit:
|
|||
f.newFrame(cards)
|
||||
f.newHandFrame(hand.widget_repr())
|
||||
|
||||
tableDialog.redraw()
|
||||
res = tableDialog.loop()
|
||||
dialog.redraw()
|
||||
res = dialog.loop()
|
||||
if res == 1001 or res == 9: # or res == KEY_END or res == KEY_ESC: # 1001 is exit? # 9 is ctrl-c
|
||||
exit = True
|
||||
else:
|
||||
print(*f.getChoices())
|
||||
sleep(2)
|
||||
table, hand = state.update_table(table, hand, *f.getChoices())
|
||||
|
||||
|
||||
print('TODO: sempre due scelte')
|
||||
if action == 'EXIT':
|
||||
exit = True
|
||||
elif action == 'MOVE':
|
||||
# TODO: transition effect
|
||||
state.update_table(table, hand, *f.getChoices()) # get them from next
|
||||
elif action == 'DRAW':
|
||||
pass
|
||||
elif action == 'RESET':
|
||||
while state.size() > 1:
|
||||
state.prev()
|
||||
elif action == 'SEND':
|
||||
pass
|
||||
elif action == 'BACK':
|
||||
state.prev()
|
||||
else:
|
||||
assert False
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import sys
|
||||
sys.path.append('../')
|
||||
import json
|
||||
|
||||
from metro_holografix.cardtypes import *
|
||||
import symbols as sym
|
||||
|
||||
|
||||
Hand = Tavolo
|
||||
class Table(Tavolo):
|
||||
|
||||
|
@ -21,21 +22,6 @@ class Table(Tavolo):
|
|||
yi.append(sym.sym[seed][card[1]])
|
||||
yield yi
|
||||
|
||||
|
||||
|
||||
table = Table([
|
||||
TaggedCards([
|
||||
Card("Pikes", 2),
|
||||
Card("Clovers", 2),
|
||||
Card("Tiles", 2),
|
||||
Card("Hearts", 2)]),
|
||||
TaggedCards([
|
||||
Card("Hearts", 1),
|
||||
Card("Clovers", 1),
|
||||
Card("Pikes", 1),
|
||||
Card("Tiles", 1)]),
|
||||
])
|
||||
|
||||
|
||||
class Hand:
|
||||
def __init__(self, cards):
|
||||
|
@ -50,17 +36,58 @@ class Hand:
|
|||
seed = card[0].lower()
|
||||
yi.append(sym.sym[seed][card[1]])
|
||||
return yi
|
||||
|
||||
|
||||
hand = Hand([
|
||||
Card("Pikes", 12),
|
||||
Card("Clovers", 12),
|
||||
Card("Tiles", 12),
|
||||
Card("Hearts", 12),
|
||||
Card("Hearts", 13),
|
||||
Card("Clovers", 13),
|
||||
Card("Pikes", 13),
|
||||
Card("Tiles", 13)
|
||||
])
|
||||
events = [ # list of tuples table-hand
|
||||
(Table([
|
||||
TaggedCards([
|
||||
Card("Pikes", 2),
|
||||
Card("Clovers", 2),
|
||||
Card("Tiles", 2),
|
||||
Card("Hearts", 2)]),
|
||||
TaggedCards([
|
||||
Card("Hearts", 1),
|
||||
Card("Clovers", 1),
|
||||
Card("Pikes", 1),
|
||||
Card("Tiles", 1)]),
|
||||
]), Hand([
|
||||
Card("Pikes", 12),
|
||||
Card("Clovers", 12),
|
||||
Card("Tiles", 12),
|
||||
Card("Hearts", 12),
|
||||
Card("Hearts", 13),
|
||||
Card("Clovers", 13),
|
||||
Card("Pikes", 13),
|
||||
Card("Tiles", 13)
|
||||
]))
|
||||
]
|
||||
|
||||
def fromJson(j):
|
||||
hcards = [Card(seed, value) for seed, value in j['hand']]
|
||||
tcards = []
|
||||
for tc in j['table']:
|
||||
tcards.append(TaggedCards([Card(seed, value) for seed, value in tc]))
|
||||
return Table(tcards), Hand(hcards)
|
||||
|
||||
def toJson(table, hand):
|
||||
j = dict()
|
||||
j['hand'] = hand.cards
|
||||
j['table'] = []
|
||||
for tc in table.cards:
|
||||
j['table'].append(tc.cards)
|
||||
return json.dumps(j)
|
||||
|
||||
def next():
|
||||
return events[-1]
|
||||
|
||||
def prev():
|
||||
if len(events) >= 2:
|
||||
return events.pop()
|
||||
else:
|
||||
return events[0]
|
||||
|
||||
def size():
|
||||
return len(events)
|
||||
|
||||
# TODO: refactor language
|
||||
def gioca(tavolo, hand, src, dst):
|
||||
|
@ -90,4 +117,6 @@ def gioca(tavolo, hand, src, dst):
|
|||
return Table(news), Hand(hcards)
|
||||
|
||||
def update_table(table, hand, src, dst):
|
||||
return gioca(table, hand, src, dst)
|
||||
t, h = gioca(table, hand, src, dst)
|
||||
events.append((t, h))
|
||||
return t, h
|
||||
|
|
|
@ -29,6 +29,9 @@ class WColoredButton(WButton):
|
|||
self.on_click(self)
|
||||
return r
|
||||
|
||||
def handle_key(self, inp):
|
||||
pass
|
||||
|
||||
def on_click(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
@ -39,6 +42,8 @@ class WColoredFrame(WFrame):
|
|||
title = color.decode('utf-8') + title + self.rst.decode('utf-8')
|
||||
super().__init__(w, h, title)
|
||||
self.color = color
|
||||
def handle_key(self, inp):
|
||||
pass
|
||||
|
||||
def draw_box(self, left, top, width, height):
|
||||
# Use http://www.utf8-chartable.de/unicode-utf8-table.pl
|
||||
|
@ -73,10 +78,15 @@ class WColoredFrame(WFrame):
|
|||
class WCardRadioButton(WRadioButton):
|
||||
isHand = False
|
||||
|
||||
def __init__(self, items, isHand=False):
|
||||
def __init__(self, items, id, cb, isHand=False):
|
||||
super().__init__(items)
|
||||
self.choice = 1
|
||||
self.isHand = isHand
|
||||
self.cb = cb
|
||||
self.id = id
|
||||
|
||||
def handle_key(self, inp):
|
||||
pass # TODO: maybe enable keyboard
|
||||
|
||||
def redraw(self):
|
||||
i = 0
|
||||
|
@ -95,5 +105,7 @@ class WCardRadioButton(WRadioButton):
|
|||
def handle_mouse(self, x, y):
|
||||
newchoice = y - self.y
|
||||
self.choice = 1 if self.choice == newchoice else newchoice
|
||||
if self.choice != 1:
|
||||
self.cb(self.id)
|
||||
self.redraw()
|
||||
self.signal("changed")
|
||||
|
|
Loading…
Reference in a new issue