From 403a23415a78352ef353b318368314fb7e547044 Mon Sep 17 00:00:00 2001 From: NaitLee Date: Thu, 7 Jul 2022 17:34:50 +0800 Subject: [PATCH] Add license info per-file, adjust docs: Remove `COPYING` for being identified as "unknown", moved to readme Few fixes to readme and contributing More in TODO & dev-diary --- .vscode/settings.json | 4 ++++ CONTRIBUTING.md | 24 ++++++++++--------- COPYING | 6 ----- README.md | 16 +++++++++---- TODO | 10 ++++++-- dev-diary.txt | 48 +++++++++++++++++++++++++++++++++++++ printer.py | 8 ++++++- printer_lib/commander.py | 7 +++++- printer_lib/i18n.py | 9 +++++-- printer_lib/ipp.py | 6 ++++- printer_lib/models.py | 2 +- printer_lib/pf2.py | 10 +++++--- printer_lib/text_print.py | 2 +- readme.i18n/README.de_DE.md | 10 +++++++- readme.i18n/README.zh_CN.md | 16 +++++++++---- server.py | 8 ++++++- www/accessibility.js | 5 ++++ www/i18n-ext.js | 5 ++++ www/i18n.js | 5 ++++ www/loader.js | 5 ++++ www/main.js | 7 ++++++ www/polyfill.js | 7 +++++- 22 files changed, 180 insertions(+), 40 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 COPYING diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..572a386 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "js/ts.implicitProjectConfig.strictNullChecks": false, + "js/ts.implicitProjectConfig.checkJs": false +} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 376d7e0..cb6e3ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ # Contributing -Thank you for considering this project. +Thank you for looking into this project. Let's keep short & be positive: @@ -37,37 +37,39 @@ You can seek for help here, to do grammar extensions & leftovers. 3. Keep the existing "way". Here are details: -- Think about the Unix Philosophy before doing. +- Think about the Unix Philosophy before doing. Try to suck less. - Follow coding style & naming convention. -- Consider the use cases, support Web UI and/or command-line backend +- Think about the use cases: Web UI and/or command-line backend, average and/or advanced users - Test the code well. Document if necessary. - Don't forget internationalization & necessary accessibility features. 4. Finally, "rules". Just skim these, don't feel pressure as I trust you won't mistake: - Don't leak development/test cache/junk to the repo. Please. - And never put pictures/executables/any big binary to this repo. Try uploading to an issue/discussion instead. -- Don't connect to an online service to fetch resource. + And never put pictures/executables/any big binary to this repo. Try uploading in an issue/discussion instead. +- Don't connect to an online service to fetch resource. + If necessary, ask the user first. - No more 3rd-party blackbox dependencies/assets, without explaining & using its most functionality. - Consider using existing system programs, or implementing it in your own. + Consider using existing system programs, or implementing enough from scratch. If that really happened, make it optional (i.e. don't fail the load just for its non-existence), And don't push the dependency source code. For big dependencies, if you really love it, it's suggested to fork this repo & develop in your own way. -- Don't make anti-features. Don't be someone yourself dislike most. Examples: - - You can do: simple borders & stickers, simple PostScript interpreter, another common printing protocol +- Don't make anti-features. Don't be someone yourself dislike most. + Examples: + - You can do: simple borders & stickers, scribbling, simple PostScript interpreter, another common printing protocol - Considering previous rule, discuss first: Bar/QR Code, formula, Native (non-Web) UI - You shouldn't do: Way too fancy UI/editor, Cloud storage, camera integration & OCR - - Never consider: Accounting, non-free service integration, advertisement injection + - Never consider: online account, non-free service integration, analysis/telemetry - Please don't violate the license (GNU General Public License version 3) Modification to existing files are released under its existing license, mostly GPL3 or CC0, according to statement in readme. - If you want to preserve your copyright & use other license, create new file(s) for your work. But, never release your code under any non-free license. -5. You can take any part of this project to do something else. It's still contribution! +5. You can take any part of this project to do something else. It's also contribution! Let the ideas spread! ## Footnote Nothing could go wrong. Trust yourself & try your best. -Let's together build a better project, and a better world. +Let's together build it better. Thank you. diff --git a/COPYING b/COPYING deleted file mode 100644 index 61f8e93..0000000 --- a/COPYING +++ /dev/null @@ -1,6 +0,0 @@ - -This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/README.md b/README.md index 0e35276..7bf09b2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Currently: | | | |----|----| -| Supported | `GB0X, GT01, YT01` | +| Known to support | `GB0X, GT01, YT01` | \* `X` represents any digit @@ -117,10 +117,16 @@ Of course Pull Requests are welcome if you can handle them! Copyright © 2021-2022 NaitLee Soft. Some rights reserved. -See file `COPYING`, `LICENSE`, and detail of used JavaScript in file `www/jslicense.html` +``` +This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +You should have received a copy of the GNU General Public License along with this program. If not, see . +``` + +See file `LICENSE`, and detail of used JavaScript in file `www/jslicense.html` -Particularly, `printer.py`, `server.py` and `main.js` are released under GNU GPL 3. -All other parts, except which have special statements, are in Public Domain (CC0). +Particularly, `printer.py`, `server.py` and `main.js` are released under GNU GPL 3 (`GPL-3.0-or-later`). +All other parts, except which have special statements, are in Public Domain (`CC0-1.0-only`). -------- @@ -142,4 +148,6 @@ Also interested in code development? See [development.md](development.md)! - [AdvancedWebView](https://github.com/delight-im/Android-AdvancedWebView) for saving my life from Java - Stack Overflow & the whole Internet, you let me know Android `Activity` all from beginning ... and many other helpful ideas as well +- Everyone that contributed through Issue/Pull Request/Discussion +- Everyone that is using this & caring about software freedom - ... Everyone is Awesome! diff --git a/TODO b/TODO index bdbc3b6..365af59 100644 --- a/TODO +++ b/TODO @@ -7,15 +7,21 @@ Note: not ordered. do whatever I/you want + Make error notice short while let users see detailed help/manual for what-to-do + Even better CUPS/IPP support + Even better frontend, language-friendly text printing ++ Tcl/Tk frontend. More in dev-diary.txt, July 7th. ++ Re-style frontend to make it usable in e.g. Otter Browser + 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 -+ Plugin, for including community features ++ Arch Linux package / AUR, package for other distros ++ Service for other init systems (a systemd unit file is there) + ... ? Optimize PF2 text printing? It seems a bit slow (in algorithm). ? Built-in PostScript (Even if very basic) ? Data compression for GB03. Optional +? Plugin, for including community features (that involves usefulness but also bloatness) + It's usually messy. Try forking in your own way, at the moment. +? Process picture with WebAssembly? (Web frontend only) ? Put Android APP on F-Droid? But it needs automatic build system... Android guys can help this! -? ... Or put to APKPure? But wait for good frontend before doing all of these +? ... Or put to APKPure? But make frontend well before doing all of these diff --git a/dev-diary.txt b/dev-diary.txt index 27f14fb..c6ff4b9 100644 --- a/dev-diary.txt +++ b/dev-diary.txt @@ -105,3 +105,51 @@ 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... diff --git a/printer.py b/printer.py index af1b2d8..67082ff 100644 --- a/printer.py +++ b/printer.py @@ -1,4 +1,10 @@ -'Cat-Printer: Core driver' +''' +Cat-Printer Core + +Copyright © 2021-2022 NaitLee Soft. All rights reserved. + +License GPL-3.0-or-later: https://www.gnu.org/licenses/gpl-3.0.html +''' import os import io diff --git a/printer_lib/commander.py b/printer_lib/commander.py index ffadf6a..af9b6db 100644 --- a/printer_lib/commander.py +++ b/printer_lib/commander.py @@ -1,4 +1,9 @@ -'Printer Commander' +''' +Cat-Printer Commander, way to communicate with cat printers via bluetooth + +Copyright © 2021-2022 NaitLee Soft. No rights reserved. +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 +''' from abc import ABCMeta, abstractmethod diff --git a/printer_lib/i18n.py b/printer_lib/i18n.py index b5a8c72..3fb07bc 100644 --- a/printer_lib/i18n.py +++ b/printer_lib/i18n.py @@ -1,4 +1,9 @@ -'Minimal internationalization lib' +''' +Minimal internationalization + +Copyright © 2021-2022 NaitLee Soft. No rights reserved. +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 +''' import os import json @@ -6,7 +11,7 @@ class I18nLib(): ''' Minimal implementation of current frontend i18n in Python. - Not Complete (yet)! + Yet incomplete. ''' lang: str diff --git a/printer_lib/ipp.py b/printer_lib/ipp.py index 9d5fec9..59d2fea 100644 --- a/printer_lib/ipp.py +++ b/printer_lib/ipp.py @@ -1,4 +1,8 @@ -''' Provide *very* basic CUPS/IPP support +''' +Provide *very* basic CUPS/IPP support + +Copyright © 2021-2022 NaitLee Soft. No rights reserved. +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 ''' import io diff --git a/printer_lib/models.py b/printer_lib/models.py index 381d8c9..9947d0a 100644 --- a/printer_lib/models.py +++ b/printer_lib/models.py @@ -1,4 +1,4 @@ -'Printer model specifications' +'Printer model specifications. License CC0-1.0-only' class Model(): ''' A printer model diff --git a/printer_lib/pf2.py b/printer_lib/pf2.py index b97eda9..46af476 100644 --- a/printer_lib/pf2.py +++ b/printer_lib/pf2.py @@ -1,6 +1,10 @@ -''' Python lib for reading PF2 font files: http://grub.gibibit.com/New_font_format - I'd like to put it in Public Domain. - Don't forget to see how it's used in `text_print.py` +''' +Python lib for reading PF2 font files: http://grub.gibibit.com/New_font_format + +Copyright © 2021-2022 NaitLee Soft. No rights reserved. +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 + +Don't forget to see how it's used in `text_print.py` ''' import io diff --git a/printer_lib/text_print.py b/printer_lib/text_print.py index e1bccd3..5daa8ce 100644 --- a/printer_lib/text_print.py +++ b/printer_lib/text_print.py @@ -1,4 +1,4 @@ -'Things used by Text Printing feature' +'Things used by Text Printing feature. License CC0-1.0-only' from .pf2 import PF2S diff --git a/readme.i18n/README.de_DE.md b/readme.i18n/README.de_DE.md index e041bfa..c0bca21 100644 --- a/readme.i18n/README.de_DE.md +++ b/readme.i18n/README.de_DE.md @@ -92,7 +92,15 @@ Natürlich sind PRs willkommen, wenn Sie sie meistern können! Copyright © 2021-2022 NaitLee Soft. Einige Rechte sind vorbehalten. -Siehe Datei `COPYING`, `LICENSE` und Details zum verwendeten JavaScript in der Datei `www/jslicense.html`. +``` +Dieses Programm ist Freie Software: Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation, Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren veröffentlichten Version, weiter verteilen und/oder modifizieren. + +Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein wird, jedoch OHNE JEDE GEWÄHR,; sogar ohne die implizite Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. Siehe die GNU General Public License für weitere Einzelheiten. + +Sie sollten eine Kopie der GNU General Public License zusammen mit diesem Programm erhalten haben. Wenn nicht, siehe . +``` + +Siehe Datei `LICENSE` und Details zum verwendeten JavaScript in der Datei `www/jslicense.html`. -------- diff --git a/readme.i18n/README.zh_CN.md b/readme.i18n/README.zh_CN.md index 6900c7c..9b7fecb 100644 --- a/readme.i18n/README.zh_CN.md +++ b/readme.i18n/README.zh_CN.md @@ -11,7 +11,7 @@ | | | |----|----| -| 支持 | `GB0X, GT01, YT01` | +| 已知支持 | `GB0X, GT01, YT01` | \* `X` 表示任意数字 @@ -115,10 +115,16 @@ python3 server.py Copyright © 2021-2022 NaitLee Soft. 保留一些权利。 -敬请查看文件 `COPYING`,`LICENSE`,以及在 `www/jslicense.html` 中有关 JavaScript 许可的详细内容。 +``` +本程序是自由软件:你可以再分发之和/或依照由自由软件基金会发布的 GNU 通用公共许可证修改之,无论是版本 3 许可证,还是(按你的决定)任何以后版都可以。 +发布该程序是希望它能有用,但是并无保障;甚至连可销售和符合某个特定的目的都不保证。请参看 GNU 通用公共许可证,了解详情。 +你应该随程序获得一份 GNU 通用公共许可证的复本。如果没有,请看 。 +``` + +敬请查看文件 `LICENSE`,以及在 `www/jslicense.html` 中有关 JavaScript 许可的详细内容。 -具体地,`printer.py`,`server.py` 和 `main.js` 以 GNU GPL 3 发布。 -其余所有部分,若无特殊声明,均在公有领域(CC0)。 +具体地,`printer.py`,`server.py` 和 `main.js` 以 GNU GPL 3 发布(`GPL-3.0-or-later`)。 +其余所有部分,若无特殊声明,均在公有领域(`CC0-1.0-only`)。 -------- @@ -143,4 +149,6 @@ Copyright © 2021-2022 NaitLee Soft. 保留一些权利。 - [AdvancedWebView](https://github.com/delight-im/Android-AdvancedWebView) 从 Java 拯救了我的生命 - Stack Overflow 和整个互联网,你们让我从零开始了解了安卓“活动” `Activity` ……当然还有其他方面的帮助 +- 每一位贡献于 Issue/Pull Request/Discussion 的人 +- 每一位使用此作品并关心软件自由的人 - ……每个人都是好样的! diff --git a/server.py b/server.py index 0cfd34e..7d23f33 100644 --- a/server.py +++ b/server.py @@ -1,4 +1,10 @@ -'Cat Printer - Serve a Web UI' +''' +Cat-Printer: Web Interface Server + +Copyright © 2021-2022 NaitLee Soft. All rights reserved. + +License GPL-3.0-or-later: https://www.gnu.org/licenses/gpl-3.0.html +''' # if pylint is annoying you, see file .pylintrc diff --git a/www/accessibility.js b/www/accessibility.js index 01b9327..ac6de84 100644 --- a/www/accessibility.js +++ b/www/accessibility.js @@ -1,3 +1,8 @@ +` +Copyright © 2021-2022 NaitLee Soft. No rights reserved. + +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 +`; 'use strict'; diff --git a/www/i18n-ext.js b/www/i18n-ext.js index 2e1b2e9..8de7fe3 100644 --- a/www/i18n-ext.js +++ b/www/i18n-ext.js @@ -1,3 +1,8 @@ +` +Copyright © 2021-2022 NaitLee Soft. No rights reserved. + +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 +`; /// diff --git a/www/i18n.js b/www/i18n.js index 7719054..4666688 100644 --- a/www/i18n.js +++ b/www/i18n.js @@ -1,3 +1,8 @@ +` +Copyright © 2021-2022 NaitLee Soft. No rights reserved. + +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 +`; 'use strict'; diff --git a/www/loader.js b/www/loader.js index ed8c8a8..97b3edf 100644 --- a/www/loader.js +++ b/www/loader.js @@ -1,3 +1,8 @@ +` +Copyright © 2021-2022 NaitLee Soft. No rights reserved. + +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 +`; /** * Satisfy both development and old-old webView need diff --git a/www/main.js b/www/main.js index 06a6707..834754d 100644 --- a/www/main.js +++ b/www/main.js @@ -1,3 +1,10 @@ +` +Cat-Printer: Web Frontend + +Copyright © 2021-2022 NaitLee Soft. All rights reserved. + +License GPL-3.0-or-later: https://www.gnu.org/licenses/gpl-3.0.html +`; 'use strict'; diff --git a/www/polyfill.js b/www/polyfill.js index d240750..c8fe558 100644 --- a/www/polyfill.js +++ b/www/polyfill.js @@ -1,9 +1,14 @@ +` +Copyright © 2021-2022 NaitLee Soft. No rights reserved. + +License CC0-1.0-only: https://directory.fsf.org/wiki/License:CC0 +`; + // Polyfills // home-made minimal fetch // Note: only useful with this application. Extend (or remove) it as needed. // In fact I wanted to support Otter Browser for resource-concerning people -// But it still can't cope with few other JS (even after transpiled to es5) and CSS variables if (!window.fetch) window.fetch = function(url, options) { options = options || {}; return new Promise(function(resolve, reject) {