mirror of
https://git.hiabuto.net/C3MA/CCMA.git
synced 2026-07-01 11:14:52 +02:00
refactor: localize UI labels and store filenames
This commit is contained in:
@@ -19,6 +19,7 @@ from ccma.domain.contributions import (
|
||||
)
|
||||
from ccma.domain.dates import date_input_hint, format_date_for_display
|
||||
from ccma.storage.repository import MemberRepository, RepositoryError
|
||||
from ccma.ui.labels import CLAIM_ITEM_TYPE_LABELS, display_label, storage_key
|
||||
|
||||
|
||||
class ClaimTab(ttk.Frame):
|
||||
@@ -181,7 +182,7 @@ class ClaimTab(ttk.Frame):
|
||||
"end",
|
||||
iid=str(item.get("item_id", "")),
|
||||
values=(
|
||||
item.get("type", ""),
|
||||
display_label(CLAIM_ITEM_TYPE_LABELS, str(item.get("type", ""))),
|
||||
item.get("description", ""),
|
||||
item.get("quantity", "1"),
|
||||
item.get("unit_price", item.get("amount", "")),
|
||||
@@ -294,7 +295,7 @@ class ItemDialog(_Dialog):
|
||||
def __init__(self, master, repository, member_id, claim_id, on_saved):
|
||||
super().__init__(master, "Forderungsposition hinzufügen", on_saved)
|
||||
self.repository, self.member_id, self.claim_id = repository, member_id, claim_id
|
||||
self.type_var = tk.StringVar(value="correction")
|
||||
self.type_var = tk.StringVar(value=CLAIM_ITEM_TYPE_LABELS["correction"])
|
||||
self.description_var = tk.StringVar()
|
||||
self.quantity_var = tk.StringVar(value="1")
|
||||
self.unit_var = tk.StringVar()
|
||||
@@ -310,7 +311,7 @@ class ItemDialog(_Dialog):
|
||||
ttk.Combobox(
|
||||
self.frame,
|
||||
textvariable=variable,
|
||||
values=("base", "product", "service", "fee", "discount", "credit", "correction"),
|
||||
values=list(CLAIM_ITEM_TYPE_LABELS.values()),
|
||||
state="readonly",
|
||||
width=32,
|
||||
).grid(row=row, column=1, sticky="ew", pady=5)
|
||||
@@ -326,7 +327,7 @@ class ItemDialog(_Dialog):
|
||||
description=self.description_var.get(),
|
||||
quantity=self.quantity_var.get(),
|
||||
unit_price=self.unit_var.get(),
|
||||
item_type=self.type_var.get(),
|
||||
item_type=storage_key(CLAIM_ITEM_TYPE_LABELS, self.type_var.get()),
|
||||
)
|
||||
except RepositoryError as exc:
|
||||
messagebox.showerror("Position konnte nicht gespeichert werden", str(exc), parent=self)
|
||||
|
||||
Reference in New Issue
Block a user