fnschool 20250109.80531.837__py3-none-any.whl → 20251011.80531.840__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fnschool might be problematic. Click here for more details.

Files changed (276) hide show
  1. fnschoo1/__init__.py +52 -0
  2. fnschoo1/canteen/admin.py +3 -0
  3. fnschoo1/canteen/apps.py +6 -0
  4. fnschoo1/canteen/forms.py +84 -0
  5. fnschoo1/canteen/migrations/0001_initial.py +119 -0
  6. fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py +20 -0
  7. fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py +23 -0
  8. fnschoo1/canteen/migrations/0004_alter_ingredient_name_category_and_more.py +66 -0
  9. fnschoo1/canteen/migrations/0005_alter_category_created_at_alter_category_name_and_more.py +41 -0
  10. fnschoo1/canteen/migrations/0006_category_is_disabled_alter_category_user_and_more.py +49 -0
  11. fnschoo1/canteen/migrations/0007_alter_consumption_amount_used_and_more.py +30 -0
  12. fnschoo1/canteen/migrations/0008_category_abbreviation_mealtype.py +67 -0
  13. fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py +55 -0
  14. fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py +215 -0
  15. fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py +23 -0
  16. fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py +18 -0
  17. fnschoo1/canteen/models.py +179 -0
  18. fnschoo1/canteen/templates/canteen/category/create.html +17 -0
  19. fnschoo1/canteen/templates/canteen/category/delete.html +61 -0
  20. fnschoo1/canteen/templates/canteen/category/list.html +63 -0
  21. fnschoo1/canteen/templates/canteen/category/update.html +23 -0
  22. fnschoo1/canteen/templates/canteen/close.html +11 -0
  23. fnschoo1/canteen/templates/canteen/consumption/_create.html +19 -0
  24. fnschoo1/canteen/templates/canteen/consumption/create.html +456 -0
  25. fnschoo1/canteen/templates/canteen/ingredient/close.html +11 -0
  26. fnschoo1/canteen/templates/canteen/ingredient/create.html +19 -0
  27. fnschoo1/canteen/templates/canteen/ingredient/create_one.html +17 -0
  28. fnschoo1/canteen/templates/canteen/ingredient/delete.html +41 -0
  29. fnschoo1/canteen/templates/canteen/ingredient/list.html +128 -0
  30. fnschoo1/canteen/templates/canteen/ingredient/update.html +23 -0
  31. fnschoo1/canteen/templates/canteen/meal_type/create.html +17 -0
  32. fnschoo1/canteen/templates/canteen/meal_type/delete.html +56 -0
  33. fnschoo1/canteen/templates/canteen/meal_type/list.html +59 -0
  34. fnschoo1/canteen/templates/canteen/meal_type/update.html +23 -0
  35. fnschoo1/canteen/tests.py +3 -0
  36. fnschoo1/canteen/urls.py +116 -0
  37. fnschoo1/canteen/views.py +814 -0
  38. fnschoo1/canteen/workbook/generate.py +2098 -0
  39. fnschoo1/db.sqlite3 +0 -0
  40. fnschoo1/fnschool/__init__.py +13 -0
  41. fnschoo1/fnschool/asgi.py +16 -0
  42. fnschoo1/fnschool/settings.py +167 -0
  43. fnschoo1/fnschool/templatetags/fnschool_tags.py +27 -0
  44. fnschoo1/fnschool/urls.py +30 -0
  45. fnschoo1/fnschool/views.py +9 -0
  46. fnschoo1/fnschool/wsgi.py +16 -0
  47. fnschoo1/locale/en/LC_MESSAGES/django.mo +0 -0
  48. fnschoo1/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
  49. fnschoo1/manage.py +25 -0
  50. fnschoo1/profiles/admin.py +27 -0
  51. fnschoo1/profiles/apps.py +12 -0
  52. fnschoo1/profiles/forms.py +67 -0
  53. fnschoo1/profiles/migrations/0001_initial.py +192 -0
  54. fnschoo1/profiles/migrations/0002_alter_profile_bio.py +20 -0
  55. fnschoo1/profiles/migrations/0003_alter_profile_options_alter_profile_address_and_more.py +67 -0
  56. fnschoo1/profiles/migrations/0004_profile_gender.py +26 -0
  57. fnschoo1/profiles/migrations/0005_alter_profile_gender.py +23 -0
  58. fnschoo1/profiles/models.py +60 -0
  59. fnschoo1/profiles/signals.py +20 -0
  60. fnschoo1/profiles/templates/profiles/create.html +16 -0
  61. fnschoo1/profiles/templates/profiles/detail.html +14 -0
  62. fnschoo1/profiles/templates/profiles/edit.html +12 -0
  63. fnschoo1/profiles/templates/profiles/log_in.html +20 -0
  64. fnschoo1/profiles/templates/profiles/log_out.html +12 -0
  65. fnschoo1/profiles/tests.py +3 -0
  66. fnschoo1/profiles/urls.py +15 -0
  67. fnschoo1/profiles/views.py +63 -0
  68. fnschoo1/static/css/bootstrap.min.css +11776 -0
  69. fnschoo1/static/css/fnschool.css +26 -0
  70. fnschoo1/static/js/bootstrap.bundle.min.js +4223 -0
  71. fnschoo1/static/js/bootstrap.min.js +2919 -0
  72. fnschoo1/static/js/fnschool.js +84 -0
  73. fnschoo1/static/js/jquery.min.js +5413 -0
  74. fnschoo1/static/js/jquery.slim.min.js +4331 -0
  75. fnschoo1/static/js/popper.min.js +1306 -0
  76. fnschoo1/static_collected/admin/css/autocomplete.css +377 -0
  77. fnschoo1/static_collected/admin/css/base.css +1224 -0
  78. fnschoo1/static_collected/admin/css/changelists.css +334 -0
  79. fnschoo1/static_collected/admin/css/dark_mode.css +136 -0
  80. fnschoo1/static_collected/admin/css/dashboard.css +30 -0
  81. fnschoo1/static_collected/admin/css/forms.css +546 -0
  82. fnschoo1/static_collected/admin/css/login.css +62 -0
  83. fnschoo1/static_collected/admin/css/nav_sidebar.css +145 -0
  84. fnschoo1/static_collected/admin/css/responsive.css +1043 -0
  85. fnschoo1/static_collected/admin/css/responsive_rtl.css +84 -0
  86. fnschoo1/static_collected/admin/css/rtl.css +311 -0
  87. fnschoo1/static_collected/admin/css/vendor/select2/select2.css +708 -0
  88. fnschoo1/static_collected/admin/css/vendor/select2/select2.min.css +1 -0
  89. fnschoo1/static_collected/admin/css/widgets.css +639 -0
  90. fnschoo1/static_collected/admin/js/SelectBox.js +128 -0
  91. fnschoo1/static_collected/admin/js/SelectFilter2.js +503 -0
  92. fnschoo1/static_collected/admin/js/actions.js +232 -0
  93. fnschoo1/static_collected/admin/js/admin/DateTimeShortcuts.js +496 -0
  94. fnschoo1/static_collected/admin/js/admin/RelatedObjectLookups.js +276 -0
  95. fnschoo1/static_collected/admin/js/autocomplete.js +33 -0
  96. fnschoo1/static_collected/admin/js/calendar.js +251 -0
  97. fnschoo1/static_collected/admin/js/cancel.js +29 -0
  98. fnschoo1/static_collected/admin/js/change_form.js +21 -0
  99. fnschoo1/static_collected/admin/js/collapse.js +43 -0
  100. fnschoo1/static_collected/admin/js/core.js +174 -0
  101. fnschoo1/static_collected/admin/js/filters.js +37 -0
  102. fnschoo1/static_collected/admin/js/inlines.js +439 -0
  103. fnschoo1/static_collected/admin/js/jquery.init.js +8 -0
  104. fnschoo1/static_collected/admin/js/nav_sidebar.js +81 -0
  105. fnschoo1/static_collected/admin/js/popup_response.js +24 -0
  106. fnschoo1/static_collected/admin/js/prepopulate.js +43 -0
  107. fnschoo1/static_collected/admin/js/prepopulate_init.js +20 -0
  108. fnschoo1/static_collected/admin/js/theme.js +57 -0
  109. fnschoo1/static_collected/admin/js/urlify.js +529 -0
  110. fnschoo1/static_collected/admin/js/vendor/jquery/jquery.js +10913 -0
  111. fnschoo1/static_collected/admin/js/vendor/jquery/jquery.min.js +2 -0
  112. fnschoo1/static_collected/admin/js/vendor/select2/i18n/af.js +43 -0
  113. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ar.js +36 -0
  114. fnschoo1/static_collected/admin/js/vendor/select2/i18n/az.js +33 -0
  115. fnschoo1/static_collected/admin/js/vendor/select2/i18n/bg.js +38 -0
  116. fnschoo1/static_collected/admin/js/vendor/select2/i18n/bn.js +39 -0
  117. fnschoo1/static_collected/admin/js/vendor/select2/i18n/bs.js +48 -0
  118. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ca.js +41 -0
  119. fnschoo1/static_collected/admin/js/vendor/select2/i18n/cs.js +62 -0
  120. fnschoo1/static_collected/admin/js/vendor/select2/i18n/da.js +37 -0
  121. fnschoo1/static_collected/admin/js/vendor/select2/i18n/de.js +41 -0
  122. fnschoo1/static_collected/admin/js/vendor/select2/i18n/dsb.js +51 -0
  123. fnschoo1/static_collected/admin/js/vendor/select2/i18n/el.js +43 -0
  124. fnschoo1/static_collected/admin/js/vendor/select2/i18n/en.js +41 -0
  125. fnschoo1/static_collected/admin/js/vendor/select2/i18n/es.js +41 -0
  126. fnschoo1/static_collected/admin/js/vendor/select2/i18n/et.js +38 -0
  127. fnschoo1/static_collected/admin/js/vendor/select2/i18n/eu.js +45 -0
  128. fnschoo1/static_collected/admin/js/vendor/select2/i18n/fa.js +42 -0
  129. fnschoo1/static_collected/admin/js/vendor/select2/i18n/fi.js +42 -0
  130. fnschoo1/static_collected/admin/js/vendor/select2/i18n/fr.js +43 -0
  131. fnschoo1/static_collected/admin/js/vendor/select2/i18n/gl.js +40 -0
  132. fnschoo1/static_collected/admin/js/vendor/select2/i18n/he.js +44 -0
  133. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hi.js +40 -0
  134. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hr.js +45 -0
  135. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hsb.js +51 -0
  136. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hu.js +44 -0
  137. fnschoo1/static_collected/admin/js/vendor/select2/i18n/hy.js +40 -0
  138. fnschoo1/static_collected/admin/js/vendor/select2/i18n/id.js +36 -0
  139. fnschoo1/static_collected/admin/js/vendor/select2/i18n/is.js +37 -0
  140. fnschoo1/static_collected/admin/js/vendor/select2/i18n/it.js +43 -0
  141. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ja.js +40 -0
  142. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ka.js +42 -0
  143. fnschoo1/static_collected/admin/js/vendor/select2/i18n/km.js +38 -0
  144. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ko.js +42 -0
  145. fnschoo1/static_collected/admin/js/vendor/select2/i18n/lt.js +45 -0
  146. fnschoo1/static_collected/admin/js/vendor/select2/i18n/lv.js +41 -0
  147. fnschoo1/static_collected/admin/js/vendor/select2/i18n/mk.js +42 -0
  148. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ms.js +38 -0
  149. fnschoo1/static_collected/admin/js/vendor/select2/i18n/nb.js +38 -0
  150. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ne.js +44 -0
  151. fnschoo1/static_collected/admin/js/vendor/select2/i18n/nl.js +46 -0
  152. fnschoo1/static_collected/admin/js/vendor/select2/i18n/pl.js +43 -0
  153. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ps.js +41 -0
  154. fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt-BR.js +39 -0
  155. fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt.js +41 -0
  156. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ro.js +43 -0
  157. fnschoo1/static_collected/admin/js/vendor/select2/i18n/ru.js +48 -0
  158. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sk.js +61 -0
  159. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sl.js +41 -0
  160. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sq.js +43 -0
  161. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr-Cyrl.js +48 -0
  162. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr.js +48 -0
  163. fnschoo1/static_collected/admin/js/vendor/select2/i18n/sv.js +40 -0
  164. fnschoo1/static_collected/admin/js/vendor/select2/i18n/th.js +36 -0
  165. fnschoo1/static_collected/admin/js/vendor/select2/i18n/tk.js +36 -0
  166. fnschoo1/static_collected/admin/js/vendor/select2/i18n/tr.js +40 -0
  167. fnschoo1/static_collected/admin/js/vendor/select2/i18n/uk.js +59 -0
  168. fnschoo1/static_collected/admin/js/vendor/select2/i18n/vi.js +37 -0
  169. fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-CN.js +36 -0
  170. fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-TW.js +33 -0
  171. fnschoo1/static_collected/admin/js/vendor/select2/select2.full.js +7115 -0
  172. fnschoo1/static_collected/admin/js/vendor/select2/select2.full.min.js +2 -0
  173. fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.js +4993 -0
  174. fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.min.js +160 -0
  175. fnschoo1/static_collected/css/bootstrap.min.css +11776 -0
  176. fnschoo1/static_collected/css/fnschool.css +26 -0
  177. fnschoo1/static_collected/js/bootstrap.bundle.min.js +4223 -0
  178. fnschoo1/static_collected/js/bootstrap.min.js +2919 -0
  179. fnschoo1/static_collected/js/fnschool.js +84 -0
  180. fnschoo1/static_collected/js/jquery.min.js +5413 -0
  181. fnschoo1/static_collected/js/jquery.slim.min.js +4331 -0
  182. fnschoo1/static_collected/js/popper.min.js +1306 -0
  183. fnschoo1/templates/base/_css.html +1 -0
  184. fnschoo1/templates/base/_js.html +15 -0
  185. fnschoo1/templates/base/content.html +30 -0
  186. fnschoo1/templates/base/header_content_footer.html +35 -0
  187. fnschoo1/templates/close.html +11 -0
  188. fnschoo1/templates/home.html +51 -0
  189. fnschoo1/templates/includes/_footer.html +39 -0
  190. fnschoo1/templates/includes/_header.html +77 -0
  191. fnschoo1/templates/includes/_navigation.html +0 -0
  192. fnschoo1/templates/includes/_paginator.html +27 -0
  193. fnschoo1/templates/registration/logged_out.html +0 -0
  194. fnschoo1/templates/registration/login.html +0 -0
  195. fnschool-20251011.80531.840.dist-info/METADATA +179 -0
  196. fnschool-20251011.80531.840.dist-info/RECORD +207 -0
  197. {fnschool-20250109.80531.837.dist-info → fnschool-20251011.80531.840.dist-info}/WHEEL +1 -1
  198. fnschool-20251011.80531.840.dist-info/entry_points.txt +2 -0
  199. fnschool-20251011.80531.840.dist-info/top_level.txt +1 -0
  200. fnschool/__init__.py +0 -35
  201. fnschool/__main__.py +0 -16
  202. fnschool/app.py +0 -103
  203. fnschool/canteen/__init__.py +0 -3
  204. fnschool/canteen/__main__.py +0 -3
  205. fnschool/canteen/bill.py +0 -253
  206. fnschool/canteen/canteen.py +0 -1
  207. fnschool/canteen/canteen.toml +0 -61
  208. fnschool/canteen/config.py +0 -10
  209. fnschool/canteen/consuming.py +0 -53
  210. fnschool/canteen/currency.py +0 -17
  211. fnschool/canteen/data/bill.i18n.xlsx +0 -0
  212. fnschool/canteen/data/bill.xlsx +0 -0
  213. fnschool/canteen/data/consuming.xlsx +0 -0
  214. fnschool/canteen/data/purchase_list.xlsx +0 -0
  215. fnschool/canteen/entry.py +0 -40
  216. fnschool/canteen/food.py +0 -206
  217. fnschool/canteen/food_classes.py +0 -33
  218. fnschool/canteen/food_classes.toml +0 -64
  219. fnschool/canteen/operator.py +0 -91
  220. fnschool/canteen/path.py +0 -28
  221. fnschool/canteen/spreadsheet/base.py +0 -213
  222. fnschool/canteen/spreadsheet/consuming.py +0 -310
  223. fnschool/canteen/spreadsheet/consumingsum.py +0 -76
  224. fnschool/canteen/spreadsheet/cover.py +0 -64
  225. fnschool/canteen/spreadsheet/ctspreadsheet.py +0 -351
  226. fnschool/canteen/spreadsheet/food.py +0 -680
  227. fnschool/canteen/spreadsheet/inventory.py +0 -375
  228. fnschool/canteen/spreadsheet/merging.py +0 -340
  229. fnschool/canteen/spreadsheet/preconsuming.py +0 -329
  230. fnschool/canteen/spreadsheet/purchasing.py +0 -885
  231. fnschool/canteen/spreadsheet/purchasingsum.py +0 -110
  232. fnschool/canteen/spreadsheet/spreadsheet.py +0 -363
  233. fnschool/canteen/spreadsheet/translating.py +0 -12
  234. fnschool/canteen/spreadsheet/unwarehousing.py +0 -178
  235. fnschool/canteen/spreadsheet/unwarehousingsum.py +0 -11
  236. fnschool/canteen/spreadsheet/warehousing.py +0 -360
  237. fnschool/canteen/spreadsheet/workbook.py +0 -17
  238. fnschool/canteen/test.py +0 -97
  239. fnschool/config.py +0 -48
  240. fnschool/entry.py +0 -67
  241. fnschool/exam/__init__.py +0 -8
  242. fnschool/exam/data/parental_emails.xlsx +0 -0
  243. fnschool/exam/data/score.xlsx +0 -0
  244. fnschool/exam/email.py +0 -349
  245. fnschool/exam/entry.py +0 -36
  246. fnschool/exam/language.py +0 -19
  247. fnschool/exam/path.py +0 -24
  248. fnschool/exam/score.py +0 -1191
  249. fnschool/exam/subject.py +0 -20
  250. fnschool/exam/teacher.py +0 -54
  251. fnschool/external.py +0 -89
  252. fnschool/games/__init__.py +0 -1
  253. fnschool/games/__main__.py +0 -1
  254. fnschool/games/games.py +0 -1
  255. fnschool/inoutput.py +0 -97
  256. fnschool/language.py +0 -40
  257. fnschool/locales/en_US/LC_MESSAGES/fnschool.mo +0 -0
  258. fnschool/locales/zh_CN/LC_MESSAGES/fnschool.mo +0 -0
  259. fnschool/locales/zh_HK/LC_MESSAGES/fnschool.mo +0 -0
  260. fnschool/locales/zh_SG/LC_MESSAGES/fnschool.mo +0 -0
  261. fnschool/locales/zh_TW/LC_MESSAGES/fnschool.mo +0 -0
  262. fnschool/path.py +0 -45
  263. fnschool/test.py +0 -24
  264. fnschool/user.py +0 -262
  265. fnschool-20250109.80531.837.dist-info/METADATA +0 -342
  266. fnschool-20250109.80531.837.dist-info/RECORD +0 -78
  267. fnschool-20250109.80531.837.dist-info/entry_points.txt +0 -5
  268. fnschool-20250109.80531.837.dist-info/top_level.txt +0 -1
  269. /fnschool/canteen/consume.py → /fnschoo1/canteen/__init__.py +0 -0
  270. /fnschool/canteen/food_recount.toml → /fnschoo1/canteen/migrations/__init__.py +0 -0
  271. {fnschool/canteen/spreadsheet → fnschoo1/canteen/workbook}/__init__.py +0 -0
  272. /fnschool/exam/__main__.py → /fnschoo1/fnschool/templatetags/__init__.py +0 -0
  273. /fnschool/canteen/food_recounts.toml → /fnschoo1/profiles/__init__.py +0 -0
  274. /fnschool/canteen/warehouse.py → /fnschoo1/profiles/migrations/__init__.py +0 -0
  275. /fnschool/canteen/workbook.toml → /fnschoo1/templates/base/_content.html +0 -0
  276. {fnschool-20250109.80531.837.dist-info → fnschool-20251011.80531.840.dist-info/licenses}/LICENSE +0 -0
fnschool/exam/subject.py DELETED
@@ -1,20 +0,0 @@
1
- import os
2
- import sys
3
-
4
- from fnschool import *
5
- from fnschool.exam import *
6
- from fnschool.exam.path import *
7
-
8
-
9
- class Subject:
10
- def __init__(
11
- self,
12
- name,
13
- teacher,
14
- grade,
15
- ):
16
- self.name = name
17
- self.teacher = teacher
18
- self.fpath0 = score_fpath0
19
- self.grade = grade
20
- pass
fnschool/exam/teacher.py DELETED
@@ -1,54 +0,0 @@
1
- import os
2
- import sys
3
- from fnschool import *
4
- from fnschool.exam import *
5
- from fnschool.exam.path import *
6
-
7
-
8
- class Teacher(User):
9
- def __init__(
10
- self,
11
- ):
12
- super().__init__(user_exam_dpath, teach_name_fpath)
13
- self._name = None
14
- self._dpath = None
15
- self._exam_dpath = None
16
- self._scores_html_fpath = None
17
- pass
18
-
19
- @property
20
- def exam_dpath(self):
21
- if not self._exam_dpath:
22
- self._exam_dpath = self.dpath / _("exam")
23
- if not self._exam_dpath.exists():
24
- os.makedirs(self._exam_dpath, exist_ok=True)
25
- return self._exam_dpath
26
- return self._exam_dpath
27
-
28
- @property
29
- def scores_html_fpath(self):
30
- if not self._scores_html_fpath:
31
- fpath = self.exam_dpath / (_("scores_info") + ".html")
32
- if not fpath.exists():
33
- with open(fpath, "w+", encoding="utf-8") as f:
34
- f.write(
35
- "\n".join(
36
- [
37
- "<h1>" + _("Hello!") + " {{ chaperone }}:</h1>",
38
- "<p>{{ scores_s }}</p>",
39
- '<img src="{{ scores_m1_img.src }}" width=100%>',
40
- '<img src="{{ scores_img.src }}" width=100%>',
41
- "<p>",
42
- " " + _("Kind regards!"),
43
- "</p>",
44
- '<p style="text-align: right;">',
45
- " {{ sender }}",
46
- "</p>",
47
- ]
48
- )
49
- )
50
- self._scores_html_fpath = fpath
51
- return self._scores_html_fpath
52
-
53
-
54
- # The end.
fnschool/external.py DELETED
@@ -1,89 +0,0 @@
1
- import os
2
- import sys
3
- import subprocess
4
-
5
- from fnschool.language import *
6
- from fnschool.inoutput import *
7
- from fnschool.path import *
8
-
9
-
10
- def sys_is_linux():
11
- return "inux" in sys.platform
12
-
13
-
14
- def sys_is_win():
15
- return sys.platform.startswith("win")
16
-
17
-
18
- def sys_is_darwin():
19
- return "darwin" in sys.platform
20
-
21
-
22
- os_is_linux = sys_is_linux()
23
- os_is_win = sys_is_win()
24
- os_is_darwin = sys_is_darwin()
25
-
26
-
27
- def get_new_issue_url():
28
- return (
29
- "https://gitee.com/larryw3i/funingschool/issues"
30
- if is_zh_CN
31
- else "https://github.com/larryw3i/funingschool/issues/new"
32
- )
33
-
34
-
35
- def get_sponsor_url():
36
- return (
37
- (
38
- "https://gitee.com/larryw3i/funingschool"
39
- + "/blob/master/Documentation/"
40
- + "README/zh_CN.md#support"
41
- )
42
- if is_zh_CN
43
- else ("https://github.com/larryw3i/" + "funingschool#support")
44
- )
45
-
46
-
47
- def print_sponsor():
48
- from fnschool.app import app_name
49
-
50
- print()
51
- u2764 = Fore.RED + "\u2764" + Style.RESET_ALL
52
- print(u2764, end=" ")
53
- print(
54
- Fore.GREEN
55
- + _(
56
- "If you feel {0} is great, "
57
- + "please sponsor it. "
58
- + "Your sponsorship will keep "
59
- + "the project alive."
60
- ).format(app_name)
61
- + Style.RESET_ALL,
62
- end="",
63
- )
64
- print(u2764)
65
-
66
- print_warning("\t" + _("Sponsor URL: {0}").format(get_sponsor_url()))
67
- print()
68
-
69
-
70
- def open_path(file_path):
71
- file_path = str(file_path)
72
- bin_name = "open" if (sys_is_linux() or sys_is_darwin()) else "start"
73
- file_path = '"' + file_path + '"'
74
- if sys_is_win():
75
- if file_path.endswith('.toml"'):
76
- bin_name = "notepad"
77
- elif Path(file_path).is_dir():
78
- bin_name = "explorer"
79
- else:
80
- os.startfile(file_path)
81
-
82
- return None
83
-
84
- os.system(f"{bin_name} {file_path}")
85
-
86
- return None
87
-
88
-
89
- # The end.
@@ -1 +0,0 @@
1
- # The end.
@@ -1 +0,0 @@
1
- # The end.
fnschool/games/games.py DELETED
@@ -1 +0,0 @@
1
- # The end.
fnschool/inoutput.py DELETED
@@ -1,97 +0,0 @@
1
- import os
2
- import sys
3
- import platform
4
- import math
5
- import random
6
-
7
- from colorama import Fore, Style
8
-
9
- if platform.system() == "Windows":
10
- from colorama import just_fix_windows_console
11
-
12
- just_fix_windows_console()
13
-
14
-
15
- def get_random_sep_char():
16
- sep_char = random.choice(
17
- ["-", "+", "=", "|", "o", "`", ".", "x", "z", "#", "^", "*"]
18
- )
19
- return sep_char
20
-
21
-
22
- def is_zh_CN_char(value):
23
- result = (
24
- 0x4E00 <= ord(value) <= 0x9FA5
25
- or 0xFF00 <= ord(value) <= 0xFFEF
26
- or 0x3000 <= ord(value) <= 0x303F
27
- )
28
- return result
29
-
30
-
31
- def get_input():
32
- i_value = input(">_ ")
33
- return i_value
34
-
35
-
36
- def get_len(value):
37
- value_len = 0
38
- if isinstance(value, str):
39
- value_len = len(value) + len([c for c in value if is_zh_CN_char(c)])
40
- else:
41
- value_len = len(value)
42
- return value_len
43
-
44
-
45
- def get_zh_CN_chars_len(value):
46
- value_len = len([c for c in value if is_zh_CN_char(c)])
47
- return value_len
48
-
49
-
50
- def sqr_slist(slist):
51
- if not isinstance(slist, list):
52
- return slist
53
-
54
- slist_len = len(slist)
55
- slist_len_sqrt = math.ceil(slist_len**0.5)
56
-
57
- slist_col_count = slist_len_sqrt
58
- for col_index in range(0, slist_col_count):
59
- col_values = [
60
- (i, slist[i])
61
- for i in range(0, slist_len)
62
- if i % slist_col_count == col_index
63
- ]
64
-
65
- rc_len = max([get_len(v) for i, v in col_values]) + 1
66
- for i, v in col_values:
67
- v_len = rc_len - get_zh_CN_chars_len(v)
68
- slist[i] = f"{v:<{v_len}}"
69
-
70
- s_value = ""
71
- for i, v in enumerate(slist):
72
- if i % slist_col_count == 0 and i != 0:
73
- s_value += "\n"
74
- s_value += v
75
-
76
- return s_value
77
-
78
-
79
- def print_info(*args, **kwargs):
80
- print(Fore.GREEN, end="")
81
- print(*args, **kwargs, end="")
82
- print(Style.RESET_ALL)
83
-
84
-
85
- def print_warning(*args, **kwargs):
86
- print(Fore.YELLOW, end="")
87
- print(*args, **kwargs, end="")
88
- print(Style.RESET_ALL)
89
-
90
-
91
- def print_error(*args, **kwargs):
92
- print(Fore.RED, end="")
93
- print(*args, **kwargs, end="")
94
- print(Style.RESET_ALL)
95
-
96
-
97
- # The end.
fnschool/language.py DELETED
@@ -1,40 +0,0 @@
1
- import os
2
- import sys
3
- import gettext
4
- import locale
5
- from pathlib import Path
6
- from fnschool.app import *
7
-
8
- locale_dir = (Path(__file__).parent / "locales").as_posix()
9
-
10
-
11
- def get_language_code():
12
- locale.setlocale(locale.LC_ALL, "")
13
- language_code = (
14
- locale.getdefaultlocale()[0]
15
- if sys.platform.startswith("win")
16
- else locale.getlocale()[0]
17
- )
18
- app_language_codes = os.listdir(locale_dir)
19
-
20
- language_code = (
21
- language_code if language_code in app_language_codes else "en_US"
22
- )
23
-
24
- return language_code
25
-
26
-
27
- app_language_code = get_language_code()
28
-
29
- language_code_is_zh_CN = "zh_CN" in app_language_code
30
- is_zh_CN = language_code_is_zh_CN
31
-
32
- T = gettext.translation(
33
- app_name, locale_dir, fallback=True, languages=[app_language_code]
34
- )
35
- T.install()
36
-
37
- t = T.gettext
38
- _ = t
39
-
40
- # The end.
fnschool/path.py DELETED
@@ -1,45 +0,0 @@
1
- import os
2
- import sys
3
- from pathlib import Path, PosixPath
4
- import shutil
5
- import getpass
6
- import platform
7
- import subprocess
8
- from datetime import datetime
9
-
10
- from appdirs import AppDirs
11
- from fnschool.inoutput import *
12
- from fnschool.app import *
13
-
14
-
15
- user_name = getpass.getuser()
16
-
17
- dirs = AppDirs(app_name, app_author)
18
-
19
- app_dpath = Path(__file__).parent
20
- data_dpath = app_dpath / "data"
21
- user_config_dir = Path(dirs.user_config_dir)
22
- user_data_dir = Path(dirs.user_data_dir)
23
-
24
-
25
- for d in [
26
- user_config_dir,
27
- user_data_dir,
28
- ]:
29
- if not d.exists():
30
- os.makedirs(d)
31
-
32
-
33
- def get_file_mtime(path):
34
- mtime = os.path.getmtime(path)
35
- mdatetime = datetime.fromtimestamp(mtime)
36
- return mdatetime
37
-
38
-
39
- def get_file_ctime(path):
40
- ctime = os.path.getctime(path)
41
- cdatetime = datetime.fromtimestamp(ctime)
42
- return cdatetime
43
-
44
-
45
- # The end.
fnschool/test.py DELETED
@@ -1,24 +0,0 @@
1
- import os
2
- import sys
3
- from pathlib import Path
4
- import unittest
5
-
6
- sys.path.append(Path(__file__).parent.parent.as_posix())
7
-
8
- from fnschool import *
9
-
10
-
11
- class TestCateen(unittest.TestCase):
12
- def test_open_file_via_sys_app(self):
13
- open_file_via_sys_app(
14
- file_path=Path(
15
- Path(__file__).parent.parent.parent
16
- / "tests"
17
- / "files"
18
- / "changsheng.3.1-3.15.xlsx"
19
- ).as_posix()
20
- )
21
-
22
-
23
- if __name__ == "__main__":
24
- unittest.main()
fnschool/user.py DELETED
@@ -1,262 +0,0 @@
1
- import os
2
- import sys
3
-
4
- from fnschool import *
5
- from fnschool.config import *
6
-
7
-
8
- class User:
9
- def __init__(self, parent_dpath=None, name_fpath=None, ask_name_s=None):
10
- self.parent_dpath = parent_dpath
11
- self.name_fpath = name_fpath
12
- self.ask_name_s = ask_name_s or _("Enter your name, please!")
13
-
14
- self._name = None
15
- self.dpath_showed = False
16
- self._dpath = None
17
- self._profile = {}
18
- self._config = None
19
- self.is_male_key = _("is_male")
20
-
21
- def __str__(self):
22
- return self.name
23
-
24
- def save_profile(self):
25
- profile = self.profile
26
- with open(self.profile_fpath, "w", encoding="utf-8") as f:
27
- f.write("\n".join([f'"{k}"="{v}"' for k, v in profile.items()]))
28
- return profile
29
-
30
- @property
31
- def profile_fpath(self):
32
- fpath = self.config_dpath / (_("profile") + ".toml")
33
- if not fpath.exists():
34
- with open(fpath, "w+", encoding="utf-8") as f:
35
- f.write("")
36
- return fpath
37
-
38
- @property
39
- def profile(self):
40
- if not self._profile:
41
- with open(self.profile_fpath, "rb") as f:
42
- self._profile = tomllib.load(f)
43
- return self._profile
44
-
45
- def get_profile(self, key, info=None, allow_blank=False):
46
- profile = self.profile
47
- if not key in profile.keys() or profile.get(key).strip() == "":
48
- print_warning(
49
- info or _("Please tell {0} the {1}.").format(app_name, key)
50
- )
51
- i_value = None
52
- for i in range(0, 3):
53
- i_value = get_input().replace(" ", "")
54
- if len(i_value) > 0:
55
- break
56
- if allow_blank:
57
- i_value = ""
58
- break
59
- print_error(_("Unexpected value got."))
60
- if i >= 2:
61
- exit()
62
-
63
- self.profile[key] = i_value
64
- self.save_profile()
65
- print_info(
66
- _(
67
- '"{0}" has been saved to "{1}". '
68
- + "(Ok! I know that. "
69
- + "[Press any key to continue])"
70
- ).format(key, self.profile_fpath)
71
- )
72
- get_input()
73
-
74
- return self.profile[key]
75
-
76
- @property
77
- def is_male(self):
78
- m = self.get_profile(
79
- self.is_male_key,
80
- info=_(
81
- "Excuse me, could you tell me your gender? "
82
- + "('F' for \"Female\", 'M' for \"Male\","
83
- + "default: 'F')"
84
- ),
85
- )
86
- return m.lower() == "m"
87
-
88
- @property
89
- def name(self):
90
- name_writed_s = _('Your name has been saved to "{0}".').format(
91
- self.name_fpath
92
- )
93
-
94
- if not self._name:
95
- name = None
96
- with open(self.name_fpath, "r", encoding="utf-8") as f:
97
- name = f.read().replace(" ", "").strip()
98
-
99
- print_info(
100
- (
101
- _('The saved names have been read from "{0}".')
102
- if "\n" in name
103
- else (
104
- _('No name was read from "{0}".')
105
- if len(name) < 1
106
- else _('The saved name has been read from "{0}".')
107
- )
108
- ).format(self.name_fpath)
109
- )
110
-
111
- if "\n" in name:
112
- names = name.split("\n")
113
-
114
- name0 = None
115
- if ">" in name:
116
- name0 = name.split(">")[1]
117
- if "\n" in name0:
118
- name0 = name0.split("\n")[0]
119
- else:
120
- name0 = names[0]
121
-
122
- print_info(
123
- _("The names saved by {0} are as follows:").format(app_name)
124
- )
125
-
126
- names_len = len(names)
127
- names_len2 = len(str(names_len))
128
- name_s = sqr_slist(
129
- [f"({i+1:>{names_len2}}) {n}" for i, n in enumerate(names)]
130
- )
131
- print_warning(name_s)
132
-
133
- for i in range(0, 3):
134
- if i > 2:
135
- print_error(_("Unexpected value was got. Exit."))
136
- exit()
137
-
138
- print_info(
139
- _(
140
- "Enter the Number of your name, "
141
- + 'or enter your name. ("Enter" for "{0}")'
142
- ).format(name0)
143
- )
144
-
145
- n_input = get_input()
146
-
147
- if n_input.isnumeric():
148
- n_input = int(n_input) - 1
149
- if n_input > names_len or n_input < 0:
150
- continue
151
- name0 = names[n_input]
152
- if name0.startswith(">"):
153
- name0 = name0[1:]
154
- break
155
-
156
- elif n_input == "":
157
- self._name = name0
158
- break
159
- else:
160
- name0 = n_input
161
- break
162
-
163
- if not self._name:
164
- if name0 in names:
165
- names.remove(name0)
166
- elif (">" + name0) in names:
167
- names.remove((">" + name0))
168
-
169
- self._name = name0
170
- name0 = ">" + name0
171
- names = [n.replace(">", "") for n in names]
172
-
173
- with open(self.name_fpath, "w", encoding="utf-8") as f:
174
- f.write("\n".join([name0] + names))
175
-
176
- print_info(name_writed_s)
177
-
178
- elif len(name) > 0:
179
-
180
- if ">" in name:
181
- name = name[1:]
182
-
183
- print_warning(
184
- _(
185
- "Hi~ is {0} your name? or enter your "
186
- + "name, please! (Yes: 'Y','y','')"
187
- ).format(name)
188
- )
189
-
190
- n_input = input("> ").replace(" ", "")
191
- if not n_input in "Yy":
192
- name0 = ">" + n_input
193
-
194
- with open(self.name_fpath, "w", encoding="utf-8") as f:
195
- f.write("\n".join([name0, name]))
196
-
197
- print_info(name_writed_s)
198
- self._name = n_input
199
- else:
200
- self._name = name
201
-
202
- else:
203
-
204
- print_warning(self.ask_name_s)
205
- for i in range(0, 3):
206
- n_input = get_input().replace(" ", "")
207
- n_input_len = len(n_input)
208
- if n_input_len > 0:
209
- self._name = n_input
210
- break
211
- elif n_input_len < 1 and i < 3:
212
- print_error(_("Unexpected value was got."))
213
- else:
214
- print_error(_("Unexpected value was got. Exit."))
215
- exit()
216
-
217
- with open(self.name_fpath, "w", encoding="utf-8") as f:
218
- f.write(">" + self._name)
219
-
220
- print_info(name_writed_s)
221
-
222
- return self._name
223
-
224
- @property
225
- def dpath(self):
226
- if not self._dpath:
227
- dpath = self.parent_dpath / self.name
228
- self._dpath = dpath
229
- if not self._dpath.exists():
230
- os.makedirs(self._dpath, exist_ok=True)
231
- if not self.dpath_showed:
232
- print_info(
233
- _(
234
- "Hey! {0}, all of your files will be"
235
- + ' saved to "{1}", show it now? '
236
- + "(Yes: 'Y','y')"
237
- ).format(self.name, self._dpath)
238
- )
239
- o_input = get_input().replace(" ", "")
240
- if len(o_input) > 0 and o_input in "Yy":
241
- open_path(self._dpath)
242
- self.dpath_showed = True
243
- return self._dpath
244
-
245
- @property
246
- def config(self):
247
- if not self._config:
248
- self._config = Config(
249
- (self.config_dpath / (_("app_config") + ".toml"))
250
- )
251
-
252
- return self._config
253
-
254
- @property
255
- def config_dpath(self):
256
- dpath = self.dpath / _("config")
257
- if not dpath.exists():
258
- os.makedirs(dpath, exist_ok=True)
259
- return dpath
260
-
261
-
262
- # The end.