mirror of
https://github.com/Zeyi-Lin/HivisionIDPhotos.git
synced 2026-08-28 19:45:12 +08:00
@@ -378,6 +378,10 @@ docker run -d -p 7860:7860 \
|
||||
|
||||
- 修改`demo/assets/title.md`
|
||||
|
||||
## 5. 如何添加/修改「打印排版」中的尺寸?
|
||||
|
||||
- 修改`demo/locales.py`中的`print_switch`字典,添加/修改新的尺寸名称和尺寸参数,然后重新运行`python app.py`
|
||||
|
||||
<br>
|
||||
|
||||
# 📧 联系我们
|
||||
|
||||
@@ -718,6 +718,7 @@ LOCALES = {
|
||||
},
|
||||
},
|
||||
"print_switch": {
|
||||
"shape": [[1205, 1795], [1051, 1500], [2479, 3508], [1051, 1500], [1205, 1795]],
|
||||
"en": {
|
||||
"label": "Paper size",
|
||||
"choices": ["6 inch", "5 inch", "A4", "3R", "4R"],
|
||||
|
||||
+5
-12
@@ -442,20 +442,13 @@ class IDPhotoProcessor:
|
||||
if idphoto_json["size_mode"] in LOCALES["size_mode"][language]["choices"][1]:
|
||||
return None, False
|
||||
|
||||
# 预设排版照尺寸
|
||||
SIX_INCH = [1205, 1795]
|
||||
FIVE_INCH = [1051, 1500]
|
||||
A4 = [2479, 3508]
|
||||
THREE_R = [1051, 1500]
|
||||
FOUR_R = [1205, 1795]
|
||||
|
||||
# 预设排版照尺寸字典
|
||||
PRESET_LAYOUT_SIZE = {
|
||||
LOCALES["print_switch"][language]["choices"][0]: SIX_INCH,
|
||||
LOCALES["print_switch"][language]["choices"][1]: FIVE_INCH,
|
||||
LOCALES["print_switch"][language]["choices"][2]: A4,
|
||||
LOCALES["print_switch"][language]["choices"][3]: THREE_R,
|
||||
LOCALES["print_switch"][language]["choices"][4]: FOUR_R,
|
||||
choice: shape
|
||||
for choice, shape in zip(
|
||||
LOCALES["print_switch"][language]["choices"],
|
||||
LOCALES["print_switch"]["shape"]
|
||||
)
|
||||
}
|
||||
|
||||
choose_layout_size = PRESET_LAYOUT_SIZE[idphoto_json["print_switch"]]
|
||||
|
||||
@@ -351,7 +351,6 @@ def create_ui(
|
||||
value=LOCALES["print_switch"][DEFAULT_LANG]["choices"][0],
|
||||
interactive=True,
|
||||
)
|
||||
|
||||
|
||||
|
||||
img_but = gr.Button(
|
||||
|
||||
Reference in New Issue
Block a user