mirror of
https://github.com/NaitLee/Cat-Printer.git
synced 2025-05-15 14:50:26 -07:00
Better Models code, categorized; Follow up newer Bleak, handle “no powered Bluetooth adapters”
207 lines
5.9 KiB
Plaintext
207 lines
5.9 KiB
Plaintext
|
|
YEAR 2022
|
|
|
|
MARCH
|
|
|
|
31st
|
|
|
|
Well, frontend development is just ongoing.
|
|
|
|
APRIL
|
|
|
|
1st
|
|
|
|
Costed one hour try to find an event propagation problem,
|
|
but finally found it's a matter of CSS selector.
|
|
|
|
BTW frontend can communicate with backend now.
|
|
|
|
2nd
|
|
|
|
(Formally) Started playing with Android.
|
|
|
|
Costed 4 hours to find why Java class (on android) always can't be found,
|
|
but finally realized pyjnius can't work with python thread/subprocess,
|
|
while I'm using ThreadingHTTPServer.
|
|
|
|
See "Note" around:
|
|
https://python-for-android.readthedocs.io/en/latest/buildoptions/#webview
|
|
|
|
NEVER MISS ANY SENTENCE OF A DOCUMENT
|
|
|
|
3rd
|
|
|
|
Costed the whole day to solve WebView problem --
|
|
it doesn't do reaction to <input type="file"> by default.
|
|
|
|
Finally done with library AdvancedWebView, but still with some hacks.
|
|
|
|
... It's now 4th 2:00 a.m. though
|
|
|
|
4th
|
|
|
|
Purged many small problems.
|
|
|
|
Wished to release it today, but no luck...
|
|
|
|
5th
|
|
|
|
Bundle script, optimized project structure.
|
|
|
|
It's finally ready...
|
|
|
|
6th
|
|
|
|
Documentation.
|
|
|
|
What else? First Release!
|
|
|
|
|
|
... ...
|
|
|
|
(some day)
|
|
|
|
Determined to make backend better,
|
|
but resulting in full rewrite.
|
|
|
|
|
|
... ... (worked hard)
|
|
|
|
15th
|
|
|
|
Feeling it's there.
|
|
|
|
Oh, asyncio always quits like a mad cat, throwing bleak there
|
|
and just ends everything, uncleanly.
|
|
|
|
16th
|
|
|
|
Solved many things left yesterday.
|
|
|
|
Thought i18n needs be universal across there, so made one by myself.
|
|
|
|
Tried to implement flip, rtl and wrap in text printing,
|
|
wasted some time, but didn't regret.
|
|
|
|
Well, slightly update document and try compiling,
|
|
give everyone a surprise.
|
|
|
|
Try --release on p4a build. It worked. 5.9MiB apk, satisfied now?
|
|
Don't forget -Djava.net.useSystemProxies=true on gradle anymore,
|
|
when a proxy to google is needed.
|
|
|
|
Phone says a release apk should be signed to be installed.
|
|
Satisfy it. https://stackoverflow.com/questions/4853011/how-to-sign-an-android-apk-file
|
|
|
|
Okay, it's 17th 3 a.m. publish it and sleep.
|
|
|
|
|
|
... ... (doing something else)
|
|
|
|
24th
|
|
|
|
Took some misc things.
|
|
|
|
Made a minor change in `server.py`,
|
|
but resulting in MUCH faster server response...
|
|
I don't know what's the point. But it's great. Period.
|
|
|
|
|
|
... ... (went away for other ideas)
|
|
|
|
JULY
|
|
|
|
7th
|
|
|
|
In this period I've struggled about many bad things, notably Node.js.
|
|
That's the worst dev experience, ever. Darn it and luckily I didn't take it as my primary skill.
|
|
|
|
I'd tell less about; here is a place to start to know what's wrong with all of those:
|
|
http://harmful.cat-v.org/software/
|
|
|
|
(Don't take everything serious; what really matters is the philosophy: do one thing and do it well.)
|
|
|
|
I'm trying to balance it all the way. And look that in this small project:
|
|
how users are satisfied, average or advanced;
|
|
how developers contributed, novice or experienced.
|
|
|
|
Here is an unseen star of the galaxy, not even comparable to the megas.
|
|
But, settling here means that we are unique, and its existence is the best gift, to the world, to everyone.
|
|
|
|
Hope the spirit will persist.
|
|
|
|
----
|
|
|
|
After seeking around, I'll go farther. In my GitHub profile Bio there is a short description.
|
|
|
|
Here in this project, I have idea: Tcl/Tk
|
|
https://tcl.tk/
|
|
|
|
I want to make a path to communicate between that Python backend and a "better" frontend.
|
|
There's currently one, Web, but Web is too heavy in some cases, and I'm not that satisfied.
|
|
Tcl/Tk is a good choice. Python have Tkinter, but I don't go with it.
|
|
|
|
The simplest approach is shell/subprocess `python3 printer.py` at Tcl side.
|
|
Feel free to make one if you have experience & time, but I'd go in other way --
|
|
|
|
I want it through stdin/stdout of `wish`, the Tk shell.
|
|
Tk just do the UI, and echo interactions back (like when user click button, or input text)
|
|
The same can also be applied to Web, but maybe with frequent/delayed requests (or even WebSocket),
|
|
so that it become universal.
|
|
That may involve another (partial) rewrite.
|
|
|
|
Afraid not, experiment always worth it. And remember: it's all about idea, everyone can make use of then.
|
|
|
|
Yawn... bed time...
|
|
|
|
9th
|
|
|
|
Did some stylesheet fix.
|
|
|
|
Then go for image rotation. It shouldn't be that hard:
|
|
|
|
0 1 2 3 16 17 18 19 32 33 34 35 48 49 50 51
|
|
4 5 6 7 20 21 22 23 36 37 38 39 52 53 54 55
|
|
8 9 10 11 24 25 26 27 40 41 42 43 56 57 58 59
|
|
12 13 14 15 28 29 30 31 44 45 46 47 60 61 62 63
|
|
16 17 18 19 32 33 34 35 48 49 50 51 64 65 66 67
|
|
20 21 22 23 36 37 38 39 52 53 54 55 68 69 70 71
|
|
|
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
|
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
|
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
|
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
|
|
|
Think about HTML canvas ImageData, one dimensional [R,G,B,A,...] array.
|
|
The "big" problem is just make a procedure to transform from the first matrix to the second.
|
|
(and flip the result horizontally)
|
|
|
|
Know what happened? I produced a right procedure from very start, but the image screwed up.
|
|
|
|
Tried to "fix" it, used at least 4 hours, finally found it's a matter of didn't floor a floating number.
|
|
(Height is got by multiplying aspect ratio)
|
|
|
|
So the Internet JavaScript memes are damned true.
|
|
https://programmerhumor.io/javascript-memes/why-is-it-like-this-2/
|
|
https://programmerhumor.io/javascript-memes/sorry-dad-_-2/
|
|
|
|
14th
|
|
|
|
... How silly is the above approach. This time I simply changed to Uint32Array. That became much more trivial.
|
|
|
|
So, I've re-written the image processing "lib". I wanted to go for WebAssembly (with AssemblyScript), so made it separate (in dir `wasm`).
|
|
After finish, it really worked -- but it's ~100% slower than the equivalent JavaScript (`asc` versus `tsc`)
|
|
And that may involve unacceptable change to scripting structure (ESModule etc.), thus Wasm was given up.
|
|
But hey, in this rewrite some algorithm practial overhead was removed, thus much more efficient! Enjoy the blazing speed!
|
|
|
|
In main.js the event handler was reworked too. No more double event dispatches.
|
|
Thanks to this, another image processing performance problem is fixed.
|
|
|
|
YEAR 2023
|
|
|
|
APRIL
|
|
|
|
2nd
|
|
|
|
Anniversary days to Cat-Printer! Thank all of you! Keep it up!
|