Skip to content

Commit

Permalink
better css; image rotation; lolcat i18n; update about
Browse files Browse the repository at this point in the history
the works are still incomplete. expecting more code cleaning
  • Loading branch information
NaitLee committed Jul 9, 2022
1 parent 947cb9a commit 502a572
Show file tree
Hide file tree
Showing 13 changed files with 423 additions and 173 deletions.
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Note: not ordered. do whatever I/you want
+ Make a build guide for android:
Summary the hacks to p4a, bleak p4a recipe, p4a webview bootstrap, and AdvancedWebView
+ Try to implement enough without more dependencies
+ More funny i18n
+ Arch Linux package / AUR, package for other distros
+ Service for other init systems (a systemd unit file is there)
+ ...
Expand Down
31 changes: 31 additions & 0 deletions dev-diary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,34 @@ 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/
2 changes: 1 addition & 1 deletion printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def _main():
parser.add_argument('-f', '--fake', metavar='XY01', type=str, default='',
help=i18n('virtual-run-on-specified-model'))
parser.add_argument('-m', '--dump', action='store_true',
help=i18n('dump-the-traffic'))
help=i18n('dump-traffic'))
parser.add_argument('-n', '--nothing', action='store_true',
help=i18n('do-nothing'))

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.2
0.6.0.1
15 changes: 14 additions & 1 deletion www/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ <h2 data-i18n="contributors">Contributors</h2>
<a target="_blank" href="https://github.com/NaitLee">NaitLee</a>
</dt>
<dd data-i18n="developer">Developer</dd>
<dd data-i18n="translator">Translator</dd>
</dl>
<dl>
<dt>
Expand All @@ -32,7 +33,19 @@ <h2 data-i18n="contributors">Contributors</h2>
<dd data-i18n="translator">Translator</dd>
</dl>
<dl>
<dt data-i18n="all-testers-and-users">All testers & users</dt>
<dt>
<a target="_blank" href="https://github.com/andypiper">andypiper</a>
</dt>
<dd data-i18n="minor-tweaks">Minor Tweaks</dd>
</dl>
<dl>
<dt>
<a target="_blank" href="https://github.com/sync1211">sync1211</a>
</dt>
<dd data-i18n="developer">Developer</dd>
</dl>
<dl>
<dt data-i18n="all-users-and-developers">All testers & users</dt>
<dd data-i18n="everyone-is-awesome">Everyone is awesome!</dd>
</dl>
</div>
Expand Down
47 changes: 23 additions & 24 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ <h1 id="title" data-i18n="cat-printer">Cat Printer</h1>
<span class="label-span-input">
<span data-i18n="process-as-">Process as:</span>
<span>
<label>
<input type="radio" name="algo" value="algo-direct" data-key />
<span data-i18n="text">Text</span>
</label>
<label>
<input type="radio" name="algo" value="algo-steinberg" data-key checked />
<span data-i18n="picture">Picture</span>
</label>
<label>
<input type="radio" name="algo" value="algo-direct" data-key />
<span data-i18n="text">Text</span>
</label>
</span>
</span>
<!-- "brightness" is historically "threshold" -->
Expand All @@ -52,6 +52,10 @@ <h1 id="title" data-i18n="cat-printer">Cat Printer</h1>
<input type="range" min="24" max="36" value="32" step="4" name="quality" data-key data-default />
</label>
</div>
<label class="label-input-span">
<input type="checkbox" name="rotate" data-key />
<span data-i18n="rotate-image">Rotate Image</span>
</label>
<label class="label-input-span" data-hide-as="print">
<input type="checkbox" name="transparent-as-white" data-key checked />
<span data-i18n="transparent-as-white">Transparent as White</span>
Expand Down Expand Up @@ -120,7 +124,7 @@ <h1 id="title" data-i18n="cat-printer">Cat Printer</h1>
<div id="control-overlay">
<div>
<button id="insert-picture" data-i18n="insert-picture" data-key="Enter">Insert Picture</button>
<button id="insert-text" data-i18n="insert-text" data-key="">Insert Text</button>
<button id="insert-text" data-i18n="insert-text" data-key="\">Insert Text</button>
<p data-i18n="or-drag-file-to-below" class="hide-on-android">Or drag file to below</p>
</div>
</div>
Expand All @@ -131,7 +135,6 @@ <h1 id="title" data-i18n="cat-printer">Cat Printer</h1>
<div class="center buttons">
<!-- <button id="canvas-expand" data-i18n="expand">Expand</button>
<button id="canvas-crop" data-i18n="crop">Crop</button> -->
<!-- <button id="button-preview" data-i18n="preview">Preview</button> -->
<button id="button-reset" data-i18n="reset" data-key>Reset</button>
<button id="button-print" data-i18n="print" data-key=" ">Print</button>
</div>
Expand All @@ -141,6 +144,7 @@ <h1 id="title" data-i18n="cat-printer">Cat Printer</h1>
<div id="hidden" class="hard-hidden">
<!-- Hidden area for putting elements -->
<input type="file" id="file" />
<img src="" id="img" alt="hidden-image" />
<div id="accessibility">
<div>
<h2>
Expand Down Expand Up @@ -180,42 +184,37 @@ <h2 data-i18n="layout">Layout</h2>
<div id="text-input">
<h1 data-i18n="insert-text">Insert Text</h1>
<div>

<div id="text-settings">
<div name="font-and-size" class="text-settings-group">

<select id="text-font">
<option value="Arial">Arial (sans-serif)</option>
<option value="Brush Script MT">Brush Script MT (cursive)</option>
<option value="Courier New">Courier New (monospace)</option>
<option value="Garamond">Garamond (serif)</option>
<option value="Georgia">Georgia (serif)</option>
<option value="Helvetica" selected>Helvetica (sans-serif)</option>
<option value="Tahoma">Tahoma (sans-serif)</option>
<option value="Times New Roman">Times New Roman (serif)</option>
<option value="Trebuchet MS">Trebuchet MS (sans-serif)</option>
<option value="Verdana">Verdana (sans-serif)</option>
<select id="text-font" contenteditable="true" data-key>
<option value="serif" data-i18n="serif">Serif</option>
<option value="sans-serif" data-i18n="sans-serif" selected>Sans Serif</option>
<option value="monospace" data-i18n="monospace">Monospace</option>
<option value="Unifont" data-i18n="unifont">Unifont</option>
</select>
<input id="text-size" type="number" name="text-size" min="1" max="100" value="20" data-key style="margin: 0px;"/>
</div>
<div name="wrap-and-align" class="text-settings-group">
<label data-i18n="wrap-by-space" name="wrap-by-space-label"><input type="checkbox" name="wrap-by-space" data-key checked />Wrap text</label>
<label>
<input type="checkbox" name="wrap-words-by-spaces" data-key checked />
<span data-i18n="wrap-words-by-spaces">Wrap words by spaces</span>
</label>
<span class="text-align-container">
<input type="radio" name="text-align" value="left" checked/>
<input type="radio" name="text-align" value="left" data-key checked />
<span class="text-align-checkmark text-align-left"></span>
</span>
<span class="text-align-container">
<input type="radio" name="text-align" value="center"/>
<input type="radio" name="text-align" value="center" data-key />
<span class="text-align-checkmark text-align-center"></span>
</span>
<span class="text-align-container">
<input type="radio" name="text-align" value="right"/>
<input type="radio" name="text-align" value="right" data-key />
<span class="text-align-checkmark text-align-right"></span>
</span>
</div>
</div>
<div id="text-textarea">
<textarea id="insert-text-area"></textarea>
<textarea id="insert-text-area" data-key="/"></textarea>
</div>
</div>
</div>
Expand Down
5 changes: 2 additions & 3 deletions www/lang/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"supported-models-": "Unterstützte Modelle:",
"path-to-input-file-dash-for-stdin": "Pfad zur Datei. '-' für stdin",
"scan-for-specified-seconds": "Suchlauf für die angegebenen Sekunden",
"dump-the-traffic": "Den Datenverkehr auf dem Drucker ausgeben und PBM-Bild beim Textdruck",
"text-printing-mode": "Textdruckmodus",
"please-install-pyobjc-via-pip": "Bitte installieren Sie `pyobjc` über pip",
"please-install-bleak-via-pip": "Bitte installieren Sie `bleak` über pip",
Expand Down Expand Up @@ -94,7 +93,7 @@
"contributors": "Beitragende",
"developer": "Entwickler",
"translator": "Übersetzer",
"all-testers-and-users": "All Tester & Benutzer",
"all-users-and-developers": "All Tester & Benutzer",
"everyone-is-awesome": "Jeder ist super",
"license": "Lizenz",
"exiting": "Exiting…",
Expand All @@ -107,5 +106,5 @@
"text-font": "Schriftart",
"text-size": "Textgröße",
"enter-text": "Text eingeben",
"wrap-by-space": "Autom. Zeilenumbruch"
"wrap-words-by-spaces": "Autom. Zeilenumbruch"
}
9 changes: 7 additions & 2 deletions www/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"contributors": "Contributors",
"developer": "Developer",
"translator": "Translator",
"all-testers-and-users": "All testers & users",
"all-users-and-developers": "All users & developers",
"everyone-is-awesome": "Everyone is awesome!",
"license": "License",
"exiting": "Exiting…",
Expand Down Expand Up @@ -132,5 +132,10 @@
"text-font": "Font",
"text-size": "Size",
"enter-text": "Enter text",
"wrap-by-space": "Wrap words by spaces"
"wrap-words-by-spaces": "Wrap words by spaces",
"minor-tweaks": "Minor Tweaks",
"serif": "Serif",
"sans-serif": "Sans Serif",
"monospace": "Monospace",
"rotate-image": "Rotate Image"
}
3 changes: 2 additions & 1 deletion www/lang/list.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"en-US": "English (US)",
"zh-CN": "中文(简体)",
"de-DE": "Deutsch"
"de-DE": "Deutsch",
"lolcat": "LOLCAT"
}
136 changes: 136 additions & 0 deletions www/lang/lolcat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"$language": "LOLCAT",
"cat-printer": "KITTE PAWS 🐾",
"printer": "PAWS",
"device-": "KITTE>",
"refresh": "FIND",
"mode-": "HOW>",
"canvas": "VIEW",
"document": "DOC",
"insert-picture": "PUT CAT PIC",
"insert-text": "SAY MEOW",
"help": "HALP",
"javascript-license-information": "BROWSR JUNK",
"settings": "CONFIGUR",
"image": "PIC",
"threshold-": "BLAK OR WHITE",
"transparent-as-white": "DONT POLUT PIC",
"misc": "OTHR",
"system": "SYS",
"disable-animation": "NO MOTION",
"exit": "BAK TO HOM",
"error-message": "SOMTHIN WRONG",
"preview": "LOOK",
"print": "PAW STEP",
"expand": "MORE",
"crop": "LESS",
"scanning-for-devices": "LUKIN FOR KITTEZ",
"scan-time-": "HOW LONG TO FIND",
"-seconds": "SECS",
"no-available-devices-found": "NO KITTE FOUND",
"found-0-available-devices": {
"single": "THER IS {0} KITTE",
"multiple": "THER R {0} KITTEZ"
},
"please-check-if-the-printer-is-down": "CHEK IF KITTE IS SLIPIN",
"printing": "KITTE WALKIN…",
"finished": "K BYE!!",
"coming-soon": "COMIN SOON…",
"dry-run": "DONT STEP WITH INK",
"dry-run-test-print-process-only": "WONT REILLY STEP NOW",
"you-can-close-this-page-manually": "KITTE SLEP YA MAY GO",
"please-enable-bluetooth": "OPEN YA BLUETOOTH PLZ",
"error-happened-please-check-error-message": "SOMTHIN WRONG CHK ERR LOG PLZ",
"you-can-seek-for-help-with-detailed-info-below": "ASK OTHR KITTE WITH THEZ",
"or-try-to-scan-longer": "TRY TO FIND BIT LONGER",
"print-to-cat-printer": "PAWS TO STEP ON PAPR OF KITTE PRINTER!",
"supported-models-": "KNOWN KITTEZ>",
"path-to-input-file-dash-for-stdin": "WHAT FILE TO STEP '-' MEAN STDIN",
"please-install-pyobjc-via-pip": "INSTAL `pyobjc` VIA pip",
"please-install-bleak-via-pip": "INSTAL `bleak` VIA pip",
"folder-printer_lib-is-incomplete-or-missing-please-check": "DIR `printer_lib` HAV PROBLM CHK PLZ",
"input-is-not-pbm-image": "INPUT ISNT PBM PIC",
"unsuitable-image-width-expected-0-got-1": "WRONG PIC WIDZ {0} WANT {1}",
"broken-pbm-image": "BAD PBM PIC",
"input-is-not-text-file": "SAY MEOW MEOW NOT PIC",
"match-printer-with-this-name-or-address": "PICK TIS KITTE NAM,ADDR",
"virtual-run-on-specified-model": "DREAM ABOUT TIS KITTE YA DONT HAVE",
"font-size-0": "PAW BIG AS {0}",
"stopping": "LEAVIN",
"connecting": "IM COMIN",
"model-0-is-not-supported-yet": "KITTE '{0}' UNKNON",
"invalid-address-0": "THER ISNT A KITTE AT '{0}'",
"will-listen-on-all-addresses": "GATHER CONN ON ALL ADDRS",
"serving-at-0": "IM AT {0}",
"disconnecting-from-printer": "LEAVIN KITTE",
"connected-to-0-1": "PICKD TIS {0} {1}",
"flip-horizontally": "FLIP <>",
"flip-vertically": "FLIP ^v",
"dump-traffic": "WACH KITTE PAWS",
"right-to-left-text-order": "YA READ RTL",
"auto-wrap-line": "WRAP MEOW",
"process-as-": "HOW TO STEP>",
"text": "MEOW",
"picture": "PICS",
"pattern": "SPOTS",
"large-font": "BIGGR PAW",
"accessibility": "IM SPECIAL",
"language": "WHAT YA SAY",
"layout": "WHAT YA LOOK",
"ok": "GO",
"cancel": "BACK",
"yes": "YEAH",
"no": "NOPE",
"about": "KITTE INFO",
"home-page-": "CAT HOME>",
"contributors": "GOOD PEEPL",
"developer": "H4CKR",
"translator": "LOLCAT",
"all-users-and-developers": "ALL LITL N BIG CATS",
"everyone-is-awesome": "YA LL AWSOM!!",
"license": "SERIOS THINY",
"exiting": "STOPIN…",

"dark-theme": "BLAK EYES",
"high-contrast": "WEAK EYES",
"welcome": "HAI THER!!",
"copyright-and-license": "SERIOS THINY",
"some-rights-reserved": "Some rights reserved.",
"ENTER": "ENTR",
"SPACE": "SPAC",
"ESCAPE": "ESC",
"TAB": "TAB",
"COMMA": "COMA",
"DOT": "DOT",
"to-enter-keyboard-mode-press-tab": "KEYBORD G33KS PRES TAB",
"usage-": "HOW TO USE>",
"positional-arguments-": "ARGS>",
"options-": "OPTS>",
"show-this-help-message": "SHOW WHAT YA LOOKIN NOW",
"do-nothing": "SLEEPY KITTE",
"scan-for-a-printer": "FIND A KITTE",
"text-printing-mode-with-options": "NO STEP PIC WANT MEOW",
"image-printing-options": "HOW TO STEP A PIC",
"convert-input-image-with-imagemagick": "HLP WITH ImageMagick",
"reset-configuration-": "RLY SCREW CFG?",
"brightness-": "BLAK OR WHITE>",
"text-printing-mode": "MEOW MEOW",
"internal-error-please-see-terminal": "ERR IN CONSOL PLZ SI",
"control-printer-thermal-strength": "HOW MUCH INK",
"strength-": "HOW MUCH INK>",
"or-drag-file-to-below": "THRW PIC OR MEOW HERE",
"reset": "STRT OVR",
"cat-face-toward": "WANT KITTE FACE NOT BUTT",
"quality-": "CAREFUL STEP>",
"print-quality": "HOW CAREFUL R STEPS",
"show-more-options": "LOT CFGS HERE",
"text-font": "PAW SHAP",
"text-size": "BIG OR SMAL",
"enter-text": "MEOW HERE",
"wrap-words-by-spaces": "NO HAF A WORD",
"minor-tweaks": "LITTL TRIKS",
"serif": "SHARP PAW",
"sans-serif": "SOFT PAW",
"monospace": "H4CKY PAW",
"rotate-image": "ROLL PIC"
}
Loading

0 comments on commit 502a572

Please sign in to comment.