mirror of
https://git.hiabuto.net/C3MA/CCMA.git
synced 2026-08-24 22:45:18 +02:00
Fix column order/widths and Chronik pane share in the member view
Forderungen: reorder columns to Fällig, Betrag, Status, Forderung. Zahlungen and Spenden already had the requested order. Across all three tables, the date/amount-like columns now share one fixed width, the status column is a third wider (it tends to hold longer label text), and only the trailing description/reference column stretches to fill the remaining space. The Chronik pane now defaults to a third of the member view's width instead of three fifths, matching the other panes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
ad5aeb74b6
commit
65bcc9f447
+27
-19
@@ -37,11 +37,18 @@ from ccma.ui.messages import MessageAction, MessageBannerList, TabMessage
|
|||||||
from ccma.ui.payment_dialog import PaymentCreateDialog, PaymentEditDialog
|
from ccma.ui.payment_dialog import PaymentCreateDialog, PaymentEditDialog
|
||||||
from ccma.ui.scrolling import ScrollableFrame
|
from ccma.ui.scrolling import ScrollableFrame
|
||||||
|
|
||||||
|
# Shared column sizing for the ledger-style tables (Forderungen/Zahlungen/Spenden): date-
|
||||||
|
# and amount-like columns get the same fixed width, status columns get a third more
|
||||||
|
# (they tend to hold longer label text), and only the trailing description/reference
|
||||||
|
# column stretches to take up whatever space remains.
|
||||||
|
FIXED_COLUMN_WIDTH = 90
|
||||||
|
STATUS_COLUMN_WIDTH = round(FIXED_COLUMN_WIDTH * 4 / 3)
|
||||||
|
|
||||||
CLAIM_TABLE_COLUMNS = (
|
CLAIM_TABLE_COLUMNS = (
|
||||||
|
("due", "Fällig", FIXED_COLUMN_WIDTH),
|
||||||
|
("amount", "Betrag", FIXED_COLUMN_WIDTH),
|
||||||
|
("status", "Status", STATUS_COLUMN_WIDTH),
|
||||||
("title", "Forderung", 220),
|
("title", "Forderung", 220),
|
||||||
("due", "Fällig", 100),
|
|
||||||
("amount", "Betrag", 90),
|
|
||||||
("status", "Status", 110),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -127,7 +134,7 @@ class MemberTab(ttk.Frame):
|
|||||||
self.details_pane = ttk.Frame(self.pane, padding=(0, 0, 10, 0))
|
self.details_pane = ttk.Frame(self.pane, padding=(0, 0, 10, 0))
|
||||||
self.timeline_pane = ttk.Frame(self.pane, padding=(10, 0, 0, 0))
|
self.timeline_pane = ttk.Frame(self.pane, padding=(10, 0, 0, 0))
|
||||||
self.pane.add(self.details_pane, weight=2)
|
self.pane.add(self.details_pane, weight=2)
|
||||||
self.pane.add(self.timeline_pane, weight=3)
|
self.pane.add(self.timeline_pane, weight=1)
|
||||||
self._build_details(self.details_pane)
|
self._build_details(self.details_pane)
|
||||||
self._build_timeline(self.timeline_pane)
|
self._build_timeline(self.timeline_pane)
|
||||||
self._pane_position_initialized = False
|
self._pane_position_initialized = False
|
||||||
@@ -139,7 +146,8 @@ class MemberTab(ttk.Frame):
|
|||||||
try:
|
try:
|
||||||
width = int(getattr(event, "width", 0)) or self.pane.winfo_width()
|
width = int(getattr(event, "width", 0)) or self.pane.winfo_width()
|
||||||
if width > 1:
|
if width > 1:
|
||||||
self.pane.sashpos(0, max(360, int(width * 0.4)))
|
# Chronik (timeline_pane) defaults to a third of the available width.
|
||||||
|
self.pane.sashpos(0, max(360, round(width * 2 / 3)))
|
||||||
self._pane_position_initialized = True
|
self._pane_position_initialized = True
|
||||||
except tk.TclError:
|
except tk.TclError:
|
||||||
return
|
return
|
||||||
@@ -283,13 +291,13 @@ class MemberTab(ttk.Frame):
|
|||||||
row=0, column=0, sticky="w", pady=(0, 10)
|
row=0, column=0, sticky="w", pady=(0, 10)
|
||||||
)
|
)
|
||||||
self.claims = ttk.Treeview(
|
self.claims = ttk.Treeview(
|
||||||
contribution_tab, columns=("title", "due", "amount", "status"), show="headings"
|
contribution_tab, columns=("due", "amount", "status", "title"), show="headings"
|
||||||
)
|
)
|
||||||
self.claim_sort_column = "due"
|
self.claim_sort_column = "due"
|
||||||
self.claim_sort_descending = False
|
self.claim_sort_descending = False
|
||||||
for key, title, width in CLAIM_TABLE_COLUMNS:
|
for key, title, width in CLAIM_TABLE_COLUMNS:
|
||||||
self.claims.heading(key, text=title, command=lambda column=key: self._toggle_claim_sort(column))
|
self.claims.heading(key, text=title, command=lambda column=key: self._toggle_claim_sort(column))
|
||||||
self.claims.column(key, width=width, anchor="w")
|
self.claims.column(key, width=width, anchor="w", stretch=key == "title")
|
||||||
self.claims.grid(row=1, column=0, sticky="nsew")
|
self.claims.grid(row=1, column=0, sticky="nsew")
|
||||||
self.claims.bind("<Double-1>", lambda _event: self._open_selected_claim())
|
self.claims.bind("<Double-1>", lambda _event: self._open_selected_claim())
|
||||||
self.claims.bind("<Return>", lambda _event: self._open_selected_claim())
|
self.claims.bind("<Return>", lambda _event: self._open_selected_claim())
|
||||||
@@ -307,14 +315,14 @@ class MemberTab(ttk.Frame):
|
|||||||
selectmode="browse",
|
selectmode="browse",
|
||||||
)
|
)
|
||||||
for key, title, width in (
|
for key, title, width in (
|
||||||
("date", "Datum", 100),
|
("date", "Datum", FIXED_COLUMN_WIDTH),
|
||||||
("amount", "Betrag", 90),
|
("amount", "Betrag", FIXED_COLUMN_WIDTH),
|
||||||
("allocated", "Zugeordnet", 90),
|
("allocated", "Zugeordnet", FIXED_COLUMN_WIDTH),
|
||||||
("available", "Frei", 90),
|
("available", "Frei", FIXED_COLUMN_WIDTH),
|
||||||
("reference", "Referenz", 320),
|
("reference", "Referenz", 320),
|
||||||
):
|
):
|
||||||
self.payments.heading(key, text=title)
|
self.payments.heading(key, text=title)
|
||||||
self.payments.column(key, width=width, anchor="w")
|
self.payments.column(key, width=width, anchor="w", stretch=key == "reference")
|
||||||
self.payments.grid(row=1, column=0, sticky="nsew")
|
self.payments.grid(row=1, column=0, sticky="nsew")
|
||||||
self.payments.bind("<Double-1>", lambda _event: self._edit_selected_payment())
|
self.payments.bind("<Double-1>", lambda _event: self._edit_selected_payment())
|
||||||
self.payments.bind("<Return>", lambda _event: self._edit_selected_payment())
|
self.payments.bind("<Return>", lambda _event: self._edit_selected_payment())
|
||||||
@@ -347,15 +355,15 @@ class MemberTab(ttk.Frame):
|
|||||||
selectmode="browse",
|
selectmode="browse",
|
||||||
)
|
)
|
||||||
for key, title, width in (
|
for key, title, width in (
|
||||||
("date", "Datum", 100),
|
("date", "Datum", FIXED_COLUMN_WIDTH),
|
||||||
("amount", "Betrag", 90),
|
("amount", "Betrag", FIXED_COLUMN_WIDTH),
|
||||||
("allocated", "Zugeordnet", 90),
|
("allocated", "Zugeordnet", FIXED_COLUMN_WIDTH),
|
||||||
("balance", "Offen", 90),
|
("balance", "Offen", FIXED_COLUMN_WIDTH),
|
||||||
("status", "Status", 150),
|
("status", "Status", STATUS_COLUMN_WIDTH),
|
||||||
("reference", "Referenz / Zweck", 260),
|
("reference", "Referenz / Zweck", 260),
|
||||||
):
|
):
|
||||||
self.donations.heading(key, text=title)
|
self.donations.heading(key, text=title)
|
||||||
self.donations.column(key, width=width, anchor="w")
|
self.donations.column(key, width=width, anchor="w", stretch=key == "reference")
|
||||||
self.donations.grid(row=1, column=0, sticky="nsew")
|
self.donations.grid(row=1, column=0, sticky="nsew")
|
||||||
self.donations.bind("<Double-1>", lambda _event: self._edit_selected_donation())
|
self.donations.bind("<Double-1>", lambda _event: self._edit_selected_donation())
|
||||||
self.donations.bind("<Return>", lambda _event: self._edit_selected_donation())
|
self.donations.bind("<Return>", lambda _event: self._edit_selected_donation())
|
||||||
@@ -602,10 +610,10 @@ class MemberTab(ttk.Frame):
|
|||||||
"end",
|
"end",
|
||||||
iid=claim_id,
|
iid=claim_id,
|
||||||
values=(
|
values=(
|
||||||
claim.get("title", "Beitrag"),
|
|
||||||
format_date_for_display(str(claim.get("due_date", ""))),
|
format_date_for_display(str(claim.get("due_date", ""))),
|
||||||
money_text(claim_total(claim)),
|
money_text(claim_total(claim)),
|
||||||
CLAIM_STATUS_LABELS.get(status, status.upper()),
|
CLAIM_STATUS_LABELS.get(status, status.upper()),
|
||||||
|
claim.get("title", "Beitrag"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
for payment in sorted(
|
for payment in sorted(
|
||||||
|
|||||||
Reference in New Issue
Block a user