fnschool 20241126.81759.821__tar.gz → 20250109.80500.803__tar.gz

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 (85) hide show
  1. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/PKG-INFO +2 -2
  2. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/__init__.py +2 -2
  3. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/bill.py +11 -2
  4. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/currency.py +1 -1
  5. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/entry.py +7 -1
  6. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/base.py +23 -2
  7. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/consumingsum.py +13 -7
  8. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/ctspreadsheet.py +1 -1
  9. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/food.py +59 -3
  10. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/merging.py +4 -7
  11. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/preconsuming.py +10 -6
  12. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/purchasing.py +8 -8
  13. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/purchasingsum.py +28 -14
  14. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/spreadsheet.py +1 -1
  15. fnschool-20250109.80500.803/src/fnschool/canteen/spreadsheet/translating.py +12 -0
  16. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/entry.py +15 -9
  17. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/email.py +3 -3
  18. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/entry.py +4 -4
  19. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/score.py +8 -8
  20. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/external.py +1 -1
  21. fnschool-20241126.81759.821/src/fnschool/show.py → fnschool-20250109.80500.803/src/fnschool/inoutput.py +1 -1
  22. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/locales/en_US/LC_MESSAGES/fnschool.mo +0 -0
  23. fnschool-20250109.80500.803/src/fnschool/locales/zh_CN/LC_MESSAGES/fnschool.mo +0 -0
  24. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/locales/zh_HK/LC_MESSAGES/fnschool.mo +0 -0
  25. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/locales/zh_SG/LC_MESSAGES/fnschool.mo +0 -0
  26. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/locales/zh_TW/LC_MESSAGES/fnschool.mo +0 -0
  27. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/path.py +1 -1
  28. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/user.py +5 -5
  29. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool.egg-info/PKG-INFO +2 -2
  30. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool.egg-info/SOURCES.txt +2 -2
  31. fnschool-20241126.81759.821/src/fnschool/canteen/workbook.py +0 -2661
  32. fnschool-20241126.81759.821/src/fnschool/locales/zh_CN/LC_MESSAGES/fnschool.mo +0 -0
  33. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/LICENSE +0 -0
  34. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/README.md +0 -0
  35. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/pyproject.toml +0 -0
  36. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/setup.cfg +0 -0
  37. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/__main__.py +0 -0
  38. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/app.py +0 -0
  39. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/__init__.py +0 -0
  40. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/__main__.py +0 -0
  41. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/canteen.py +0 -0
  42. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/canteen.toml +0 -0
  43. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/config.py +0 -0
  44. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/consume.py +0 -0
  45. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/consuming.py +0 -0
  46. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/data/bill.i18n.xlsx +0 -0
  47. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/data/bill.xlsx +0 -0
  48. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/data/consuming.xlsx +0 -0
  49. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/data/purchase_list.xlsx +0 -0
  50. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/food.py +0 -0
  51. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/food_classes.py +0 -0
  52. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/food_classes.toml +0 -0
  53. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/food_recount.toml +0 -0
  54. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/food_recounts.toml +0 -0
  55. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/operator.py +0 -0
  56. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/path.py +0 -0
  57. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/__init__.py +0 -0
  58. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/consuming.py +0 -0
  59. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/cover.py +0 -0
  60. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/inventory.py +0 -0
  61. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/unwarehousing.py +0 -0
  62. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/unwarehousingsum.py +0 -0
  63. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/warehousing.py +0 -0
  64. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/spreadsheet/workbook.py +0 -0
  65. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/test.py +0 -0
  66. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/warehouse.py +0 -0
  67. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/canteen/workbook.toml +0 -0
  68. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/config.py +0 -0
  69. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/__init__.py +0 -0
  70. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/__main__.py +0 -0
  71. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/data/parental_emails.xlsx +0 -0
  72. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/data/score.xlsx +0 -0
  73. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/language.py +0 -0
  74. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/path.py +0 -0
  75. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/subject.py +0 -0
  76. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/exam/teacher.py +0 -0
  77. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/games/__init__.py +0 -0
  78. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/games/__main__.py +0 -0
  79. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/games/games.py +0 -0
  80. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/language.py +0 -0
  81. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool/test.py +0 -0
  82. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool.egg-info/dependency_links.txt +0 -0
  83. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool.egg-info/entry_points.txt +0 -0
  84. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool.egg-info/requires.txt +0 -0
  85. {fnschool-20241126.81759.821 → fnschool-20250109.80500.803}/src/fnschool.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: fnschool
3
- Version: 20241126.81759.821
3
+ Version: 20250109.80500.803
4
4
  Summary: Just some school related scripts, without any ambition.
5
5
  Author-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>, Larry W3i <larryw3i@yeah.net>
6
6
  Maintainer-email: larryw3i <larryw3i@163.com>, Larry Wei <larryw3i@126.com>
@@ -21,7 +21,7 @@ from openpyxl.styles import numbers
21
21
  from openpyxl.styles import Font
22
22
  from fnschool.app import *
23
23
  from fnschool.language import _
24
- from fnschool.show import *
24
+ from fnschool.inoutput import *
25
25
  from fnschool.path import *
26
26
  from fnschool.entry import *
27
27
  from fnschool.external import *
@@ -29,7 +29,7 @@ from fnschool.user import *
29
29
  from fnschool.config import *
30
30
 
31
31
 
32
- __version__ = "20241126.81759.821"
32
+ __version__ = "20250109.80500.803"
33
33
 
34
34
 
35
35
  # The end.
@@ -18,13 +18,19 @@ class Bill:
18
18
  self._operator_name = None
19
19
  self._food_classes = None
20
20
  self._operator = None
21
- self.currency = Currency().CNY
21
+ self._currency = None
22
22
  self._consuming = None
23
23
  self.significant_digits = 2
24
24
  self._meal_type = None
25
25
 
26
26
  pass
27
27
 
28
+ @property
29
+ def currency(self):
30
+ if not self._currency:
31
+ self._currency = Currency().CNY if is_zh_CN else Currency().CNY
32
+ return self._currency
33
+
28
34
  @property
29
35
  def consuming(self):
30
36
  if not self._consuming:
@@ -156,6 +162,9 @@ class Bill:
156
162
  purchaser = self.foods[-1].purchaser
157
163
  return purchaser
158
164
 
165
+ def make_spreadsheets_g(self):
166
+ pass
167
+
159
168
  def make_spreadsheets(self):
160
169
  self.spreadsheet.update()
161
170
  pass
@@ -230,7 +239,7 @@ class Bill:
230
239
  self._food_classes[fclass] = name_likes
231
240
 
232
241
  print_info(_("Ok! I know it. (Press any key to continue)"))
233
- input0()
242
+ get_input()
234
243
 
235
244
  return self._food_classes
236
245
 
@@ -12,6 +12,6 @@ class Currency:
12
12
 
13
13
  @property
14
14
  def CNY(self):
15
- CNY = Currency("CNY", _("CNY"), "¥")
15
+ CNY = Currency("CNY", _("CNY"), "\u00a5")
16
16
 
17
17
  return CNY
@@ -25,10 +25,16 @@ def parse_canteen(subparsers):
25
25
  )
26
26
  parser_canteen.add_argument(
27
27
  "action",
28
- choices=["mk_bill", "merge_foodsheets"],
28
+ choices=[
29
+ "mk_bill",
30
+ "merge_foodsheets",
31
+ ],
29
32
  help=_(
30
33
  'The functions of canteen. "mk_bill": Make bill. '
31
34
  + '"merge_foodsheets": Merge food sheets.'
32
35
  ),
33
36
  )
34
37
  parser_canteen.set_defaults(func=set_canteen)
38
+
39
+
40
+ # The end.
@@ -12,6 +12,7 @@ from fnschool import *
12
12
  class Base:
13
13
  def __init__(self, bill):
14
14
  self.bill = bill
15
+ self.currency = self.bill.currency
15
16
  self.spreadsheet = self.bill.spreadsheet
16
17
  self.s = self.spreadsheet
17
18
  self._bill_workbook = None
@@ -41,6 +42,13 @@ class Base:
41
42
  self.food_sheet0_name = "材料台账母表"
42
43
  self.food_form_title_like = "材料入库、出库台账"
43
44
 
45
+ def get_local_total_price(self, total_price):
46
+ return (
47
+ self.bill.get_CNY_chars(total_price)
48
+ if is_zh_CN
49
+ else self.bill.get_CNY_chars(total_price)
50
+ )
51
+
44
52
  @property
45
53
  def bill_workbook(self):
46
54
  if not self._bill_workbook:
@@ -113,12 +121,22 @@ class Base:
113
121
  return self._sheet
114
122
 
115
123
  def get_bill_year(self, wb=None):
124
+ return (
125
+ self.get_zh_CN_bill_year(wb)
126
+ if is_zh_CN
127
+ else self.get_zh_CN_bill_year(wb)
128
+ )
129
+
130
+ def get_zh_CN_bill_year(self, wb=None):
131
+ return self.get_bill_year_by_x_year(wb, "年")
132
+
133
+ def get_bill_year_by_x_year(self, wb=None, year_word="年"):
116
134
  wb = wb or self.bwb
117
135
  cover_sheet = wb[self.s.cover_name]
118
136
  year = str(cover_sheet.cell(1, 1).value)
119
137
  year0 = ""
120
- year_char = "年"
121
- year = year.split(year_char)[0]
138
+ year_word = year_word
139
+ year = year.split(year_word)[0]
122
140
  for i in range(len(year) - 1, -1, -1):
123
141
  if year[i].isnumeric():
124
142
  year0 = year[i] + year0
@@ -186,6 +204,9 @@ class Base:
186
204
  pass
187
205
  pass
188
206
  pass
207
+ pass
208
+
209
+ pass
189
210
 
190
211
 
191
212
  # The end.
@@ -38,28 +38,34 @@ class ConsumingSum(Base):
38
38
  cssheet.cell(row[0].row, 2).number_format = numbers.FORMAT_NUMBER_00
39
39
 
40
40
  total_price = round(total_price, self.sd + 1)
41
- total_price_CNY = self.bill.get_CNY_chars(total_price)
41
+ local_total_price = self.get_local_total_price(total_price)
42
42
  cssheet.cell(
43
43
  1,
44
44
  1,
45
45
  (
46
46
  self.bill.operator.superior_department
47
- + "食堂食品、材料出库汇总报销单"
47
+ + _("食堂食品、材料出库汇总报销单")
48
48
  ),
49
49
  )
50
50
  cssheet.cell(
51
51
  2,
52
52
  1,
53
- f"编制单位:{self.purchaser} "
54
- + f"单位:元 "
55
- + f"{year}年{month}月{day}日",
53
+ _("编制单位:")
54
+ + f"{self.purchaser} "
55
+ + _("单位:元")
56
+ + f" "
57
+ + _("{0}年{1}月{2}日").format(year, month, day),
56
58
  )
57
59
  cssheet.cell(
58
60
  11,
59
61
  1,
60
- (f"总金额(大写):{total_price_CNY} " + f"¥{total_price}"),
62
+ (
63
+ _("总金额(大写)")
64
+ + f":{local_total_price} "
65
+ + f"{self.currency.mark}{total_price}"
66
+ ),
61
67
  )
62
- cssheet.cell(12, 1, f"经办人:{self.operator.name} ")
68
+ cssheet.cell(12, 1, _("经办人:") + f"{self.operator.name} ")
63
69
 
64
70
  wb = self.bwb
65
71
  wb.active = cssheet
@@ -165,7 +165,7 @@ class CtSpreadSheet:
165
165
  ).format(self.operator.bill_fpath)
166
166
  )
167
167
 
168
- s_input = input0()
168
+ s_input = get_input()
169
169
 
170
170
  print()
171
171
  print_info(_("Saving. . ."))
@@ -177,14 +177,14 @@ class Food(Base):
177
177
  print_error(
178
178
  _(
179
179
  "cannot find the starting index of form in "
180
- + '"{0}". (row {1})'
180
+ + 'Sheet "{0}". (row {1})'
181
181
  ).format(sheet.title, row[0].row)
182
182
  )
183
183
  if not row_index1:
184
184
  print_error(
185
185
  _(
186
186
  "cannot find the ending index of form in "
187
- + '"{0}". (row {1})'
187
+ + 'Sheet "{0}". (row {1})'
188
188
  ).form(sheet.title, row[0].row)
189
189
  )
190
190
  if row_index0 and row_index1:
@@ -282,13 +282,69 @@ class Food(Base):
282
282
  sheet.cell(
283
283
  row_indexp1,
284
284
  12,
285
- i_unit_price * (i_count + w_count_n - c_count_n),
285
+ i_unit_price * (i_count + w_count_n - c_count_n)
286
286
  )
287
287
 
288
288
  pass
289
289
  pass
290
290
  pass
291
+
292
+ for row_index in range(ri0,ri1+1):
293
+ w_count = sheet.cell(row_index, 4).value
294
+ w_unit_price = sheet.cell(row_index, 5).value
295
+ if str(w_count).replace(".", "").isnumeric():
296
+ w_count = float(w_count)
297
+ else:
298
+ w_count = 0
299
+ if str(w_unit_price).replace(".", "").isnumeric():
300
+ w_unit_price = float(w_unit_price)
301
+ else:
302
+ w_unit_price = 0
303
+ w_total_price = w_count * w_unit_price
304
+
305
+ if not sheet.cell(row_index,6).value:
306
+ sheet.cell(row_index, 6, w_total_price)
307
+
308
+ c_count = sheet.cell(row_index, 7).value
309
+ c_unit_price = sheet.cell(row_index, 8).value
310
+ if str(c_count).replace(".", "").isnumeric():
311
+ c_count = float(c_count)
312
+ else:
313
+ c_count = 0
314
+ if str(c_unit_price).replace(".", "").isnumeric():
315
+ c_unit_price = float(c_unit_price)
316
+ else:
317
+ c_unit_price = 0
318
+ c_total_price = c_count * c_unit_price
319
+
320
+ if not sheet.cell(row_index, 9).value:
321
+ sheet.cell(row_index, 9, c_total_price)
322
+
323
+ i_count = sheet.cell(row_index, 10).value
324
+ i_unit_price = sheet.cell(row_index, 11).value
325
+ if str(i_count).replace(".", "").isnumeric():
326
+ i_count = float(i_count)
327
+ else:
328
+ i_count = 0
329
+ if str(i_unit_price).replace(".", "").isnumeric():
330
+ i_unit_price = float(i_unit_price)
331
+ else:
332
+ i_unit_price = 0
333
+ i_total_price = i_count * i_unit_price
334
+
335
+ if i_count == 0:
336
+ sheet.cell(row_index, 10, "0")
337
+
338
+ if not sheet.cell(row_index, 12).value:
339
+ sheet.cell(row_index, 12, i_total_price)
340
+
341
+
342
+
343
+
344
+ pass
345
+
291
346
  print_info(_("Update completed!"))
347
+
292
348
  pass
293
349
 
294
350
  def update_summation(self, sheet):
@@ -154,7 +154,9 @@ class Merging(Base):
154
154
  if rc1_value and "材料名称:()" in rc1_value:
155
155
  unit = [f.unit_name for f in bfoods if f.name == name]
156
156
  unit = unit[0] if len(unit) > 0 else "斤"
157
- sheet.cell(row_index, 1, f"材料名称:{name}({unit})")
157
+ sheet.cell(
158
+ row_index, 1, "材料名称:{0}({1})".format(name, unit)
159
+ )
158
160
 
159
161
  return sheet
160
162
 
@@ -195,12 +197,7 @@ class Merging(Base):
195
197
  break
196
198
  elif row_diff < 0:
197
199
  row_diff = abs(row_diff)
198
- lsheet.insert_rows(lrow0 + 1, row_diff)
199
- for row_index_f in range(lrow0 + 1, lrow0 + 1 + row_diff):
200
- for col_index_f in range(1, 14):
201
- cell = lsheet.cell(row_index_f, col_index_f)
202
- cell.border = self.cell_border0
203
- cell.alignment = self.cell_alignment0
200
+ csheet.delete_rows(lrow0 + 1, row_diff)
204
201
  self.make_row_counts_same(lsheet, csheet)
205
202
  break
206
203
 
@@ -150,22 +150,26 @@ class PreConsuming(Base):
150
150
  sheet.cell(row_index, 2, wbfood.get_remainder(mday_m1))
151
151
  sheet.cell(row_index, 4, wbfood.unit_price)
152
152
  if wbfood.meal_type and not last_meal_type == wbfood.meal_type:
153
+ new_meal_type_rows.append([wbfood.meal_type, row_index])
153
154
  last_meal_type = wbfood.meal_type
154
- new_meal_type_rows.append(row_index)
155
155
 
156
156
  for row_index in range(row_index + 1, sheet.max_row + 1):
157
157
  sheet.cell(row_index, 1, "")
158
158
  sheet.cell(row_index, 2, "")
159
159
  sheet.cell(row_index, 4, "")
160
+ pass
160
161
 
161
162
  new_meal_type_rows = [
162
- [new_meal_type_rows[i], new_meal_type_rows[i + 1]]
163
+ [new_meal_type_rows[i][1], new_meal_type_rows[i + 1][1]]
163
164
  for i in range(0, len(new_meal_type_rows), 2)
164
165
  if i + 1 < len(new_meal_type_rows)
165
166
  ]
167
+
166
168
  for [row_index0, row_index1] in new_meal_type_rows:
169
+ colored_cols = self.get_colored_cols(days_diff)
170
+
167
171
  for row_index in range(row_index0, row_index1):
168
- for col_index in self.get_colored_cols(days_diff):
172
+ for col_index in colored_cols:
169
173
  cell = sheet.cell(row_index, col_index)
170
174
  cell.fill = self.cell_fill0
171
175
  cell.border = self.cell_border1
@@ -223,7 +227,7 @@ class PreConsuming(Base):
223
227
  + "(Ok, I know [press any key to continue])"
224
228
  )
225
229
  )
226
- input0()
230
+ get_input()
227
231
  wb.close()
228
232
  open_path(wb_fpath)
229
233
  print_info(
@@ -231,7 +235,7 @@ class PreConsuming(Base):
231
235
  "Ok! I have updated spreadsheet '{0}'. (Press any key)"
232
236
  ).format(wb_fpath)
233
237
  )
234
- input0()
238
+ get_input()
235
239
 
236
240
  wb = load_workbook(wb_fpath)
237
241
  sheet = wb[self.sheet_name0]
@@ -315,7 +319,7 @@ class PreConsuming(Base):
315
319
  _("Yes, they are all right. (Press any key to continue)")
316
320
  )
317
321
 
318
- input0()
322
+ get_input()
319
323
 
320
324
  pass
321
325
 
@@ -344,7 +344,7 @@ class Purchasing(Base):
344
344
  + "(Press any key to check the file)"
345
345
  )
346
346
  )
347
- input0()
347
+ get_input()
348
348
  open_path(self.path)
349
349
  print_info(
350
350
  _(
@@ -353,7 +353,7 @@ class Purchasing(Base):
353
353
  + "file. (Press any key to continue)"
354
354
  )
355
355
  )
356
- input0()
356
+ get_input()
357
357
  pass
358
358
 
359
359
  @property
@@ -568,7 +568,7 @@ class Purchasing(Base):
568
568
  ).format(self.path)
569
569
  )
570
570
 
571
- f_input = input0().replace(" ", "")
571
+ f_input = get_input().replace(" ", "")
572
572
  if len(f_input) > 0 and f_input in "Yy":
573
573
  update_yn = True
574
574
  max_row = len(
@@ -647,12 +647,12 @@ class Purchasing(Base):
647
647
  )
648
648
  )
649
649
  )
650
- input0()
650
+ get_input()
651
651
  open_path(self.path)
652
652
  print_info(
653
653
  _("Ok, I checked it, it's ok. " + "(Press any key to continue)")
654
654
  )
655
- input0()
655
+ get_input()
656
656
  pass
657
657
 
658
658
  pass
@@ -724,7 +724,7 @@ class Purchasing(Base):
724
724
  + ")"
725
725
  ).format(f.name)
726
726
  )
727
- split_mode = input0()
727
+ split_mode = get_input()
728
728
 
729
729
  if split_mode and split_mode in "Ss":
730
730
  return
@@ -827,7 +827,7 @@ class Purchasing(Base):
827
827
  + "(Yes: 'Y' or 'y'. Default: No.)"
828
828
  ).format(self.path)
829
829
  )
830
- re_edit_yn = input0()
830
+ re_edit_yn = get_input()
831
831
  if re_edit_yn and re_edit_yn in "Yy":
832
832
  open_path(self.path)
833
833
  print_info(
@@ -836,7 +836,7 @@ class Purchasing(Base):
836
836
  + "(Press any key to continue)"
837
837
  )
838
838
  )
839
- input0()
839
+ get_input()
840
840
  return False
841
841
 
842
842
  return True
@@ -23,7 +23,7 @@ class PurchasingSum(Base):
23
23
  1,
24
24
  (
25
25
  self.bill.operator.superior_department
26
- + "食堂食品、材料入库汇总报销单"
26
+ + _("食堂食品、材料入库汇总报销单")
27
27
  ),
28
28
  )
29
29
  pssheet.cell(
@@ -31,26 +31,30 @@ class PurchasingSum(Base):
31
31
  1,
32
32
  (
33
33
  self.bill.operator.superior_department
34
- + "食堂食品、材料未入库汇总报销单"
34
+ + _("食堂食品、材料未入库汇总报销单")
35
35
  ),
36
36
  )
37
37
  pssheet.cell(
38
38
  2,
39
39
  1,
40
- f"编制单位:{self.purchaser}"
40
+ _("编制单位:")
41
+ + f"{self.purchaser}"
41
42
  + f" "
42
- + f"单位:元"
43
+ + _("单位:")
44
+ + f"{self.currency.unit}"
43
45
  + f" "
44
- + f"{year}年{month}月{day}日",
46
+ + _("{0}年{1}月{2}日").format(year, month, day),
45
47
  )
46
48
  pssheet.cell(
47
49
  20,
48
50
  1,
49
- f"编制单位:{self.purchaser}"
51
+ _("编制单位:")
52
+ + f"{self.purchaser}"
50
53
  + f" "
51
- + f"单位:元"
54
+ + _("单位:")
55
+ + self.currency.unit
52
56
  + f" "
53
- + f"{year}年{month}月{day}日",
57
+ + _("{0}年{1}月{2}日").format(year, month, day),
54
58
  )
55
59
  foods = [f for f in self.bfoods if (not f.is_inventory)]
56
60
 
@@ -72,20 +76,30 @@ class PurchasingSum(Base):
72
76
  total_price += _total_price
73
77
 
74
78
  total_price = round(total_price, self.sd + 1)
75
- total_price_CNY = self.bill.get_CNY_chars(total_price)
79
+ local_total_price = self.get_local_total_price(total_price)
76
80
  pssheet.cell(
77
- 11, 1, f"总金额(大写):{total_price_CNY} ¥{total_price}"
81
+ 11,
82
+ 1,
83
+ (
84
+ _("总金额(大写):")
85
+ + f"{local_total_price} "
86
+ + f"{self.currency.mark}{total_price}"
87
+ ),
78
88
  )
79
- pssheet.cell(12, 1, f"经办人:{self.operator.name} ")
89
+ pssheet.cell(12, 1, _("经办人:") + f"{self.operator.name} ")
80
90
 
81
91
  total_price = sum([f.count * f.unit_price for f in uwfoods])
82
- total_price_CNY = self.bill.get_CNY_chars(total_price)
92
+ local_total_price = self.bill.get_CNY_chars(total_price)
83
93
  pssheet.cell(27, 2, total_price)
84
94
  pssheet.cell(
85
- 29, 1, f"总金额(大写):{total_price_CNY} ¥{total_price}"
95
+ 29,
96
+ 1,
97
+ _("总金额(大写):")
98
+ + f"{local_total_price} "
99
+ + f"{self.currency.mark}{total_price}",
86
100
  )
87
101
 
88
- pssheet.cell(30, 1, f"经办人:{self.operator.name} ")
102
+ pssheet.cell(30, 1, _("经办人:") + f"{self.operator.name} ")
89
103
 
90
104
  wb = self.bwb
91
105
  wb.active = pssheet
@@ -166,7 +166,7 @@ class SpreadSheet:
166
166
  ).format(self.operator.bill_fpath)
167
167
  )
168
168
 
169
- s_input = input0()
169
+ s_input = get_input()
170
170
 
171
171
  print()
172
172
  print_info(_("Saving. . ."))
@@ -0,0 +1,12 @@
1
+ # Why does this file appear?
2
+ # In fact, this project was not built from scratch. At first, I just wanted
3
+ # to complete the tasks assigned by the superior department, so I didn't think
4
+ # too much because there were many things that needed to be urgently completed.
5
+ # So some files in this project inevitably contain a large number of Chinese
6
+ # characters in their text. When this project can successfully complete many
7
+ # tasks, internationalization has become very troublesome and difficult to
8
+ # start (and I don't have that much time). So, this file is responsible for
9
+ # translating an international copy.
10
+
11
+
12
+ # The end.
@@ -16,20 +16,18 @@ entry_name = "entry.py"
16
16
  def get_entries():
17
17
  entries = [
18
18
  ".".join(
19
- os.path.splitext(p.relative_to(module_dpath.parent.as_posix()))[0]
20
- .replace("\\", "/")
21
- .split("/")
19
+ os.path.splitext(
20
+ p.relative_to(module_dpath.parent.as_posix()).as_posix()
21
+ )[
22
+ 0
23
+ ].split("/")
22
24
  )
23
25
  for p in module_dpath.glob(f"*/{entry_name}")
24
26
  ]
27
+ print(entries)
25
28
  return entries
26
29
 
27
30
 
28
- def show_gui():
29
- print_info(_("Just wait."))
30
- pass
31
-
32
-
33
31
  def read_cli():
34
32
  parser = argparse.ArgumentParser(
35
33
  prog=_("fnschool"),
@@ -38,15 +36,21 @@ def read_cli():
38
36
  )
39
37
  subparsers = parser.add_subparsers(help=_("The modules to run."))
40
38
  entries = get_entries()
39
+ added_entries = []
41
40
 
42
41
  for entry in entries:
42
+ entry_name = entry
43
43
  entry = importlib.import_module(entry)
44
44
  names = dir(entry)
45
45
  for name in names:
46
46
  attr = getattr(entry, name)
47
47
  if inspect.isfunction(attr):
48
- if name.startswith("parse_"):
48
+ if name.startswith("parse_") and not name in added_entries:
49
49
  attr(subparsers)
50
+ added_entries.append(name)
51
+ pass
52
+
53
+ del added_entries
50
54
 
51
55
  args = parser.parse_args()
52
56
 
@@ -57,5 +61,7 @@ def read_cli():
57
61
 
58
62
  print_sponsor()
59
63
 
64
+ del parser
65
+
60
66
 
61
67
  # The end.
@@ -129,7 +129,7 @@ class Email:
129
129
  + " to chaperones? (Yes: 'Y','y')"
130
130
  ).format(self.teacher.name)
131
131
  )
132
- s_input = input0()
132
+ s_input = get_input()
133
133
  if s_input and s_input in "Yy":
134
134
  scores_img_fpaths = self.score.scores_img_fpaths
135
135
  msg_subject = _('The scores of Test "{0}"').format(
@@ -332,14 +332,14 @@ class Email:
332
332
  + "me. [Press any key to open it])"
333
333
  ).format(fpath)
334
334
  )
335
- input0()
335
+ get_input()
336
336
  open_path(fpath)
337
337
  print_info(
338
338
  _(
339
339
  "(Ok! I have filled them in? [Press any key to continue])"
340
340
  )
341
341
  )
342
- input0()
342
+ get_input()
343
343
 
344
344
  self._fpath = fpath
345
345
 
@@ -19,18 +19,18 @@ def set_exam(args):
19
19
 
20
20
 
21
21
  def parse_exam(subparsers):
22
- parser_canteen = subparsers.add_parser(
22
+ parser_exam = subparsers.add_parser(
23
23
  "exam", help=_("Examination related functions.")
24
24
  )
25
- parser_canteen.add_argument(
25
+ parser_exam.add_argument(
26
26
  "action",
27
27
  choices=["enter", "read"],
28
28
  help=_(
29
29
  '"enter": Enter the examination scores. '
30
- + '"read":Read the examination scores.'
30
+ + '"read": Read the examination scores.'
31
31
  ),
32
32
  )
33
- parser_canteen.set_defaults(func=set_exam)
33
+ parser_exam.set_defaults(func=set_exam)
34
34
 
35
35
 
36
36
  # The end.