refine(console): give both lower bands a floor so neither can swallow the other
Follow-up to the console redesign, from looking at the window at its minimum size (1040x760) rather than at the size it happens to open in: the operation list and the output well are both weighted rows, so at the floor one could collapse toward nothing. Each now carries a minsize, and the comment records why.
This commit is contained in:
parent
06c96690ca
commit
8dde8dff3a
1 changed files with 24 additions and 17 deletions
|
|
@ -2685,8 +2685,10 @@ class BfGui: # pragma: no cover - pencere gerektirir (statik testler dokunmaz)
|
||||||
root.minsize(1040, 760)
|
root.minsize(1040, 760)
|
||||||
root.columnconfigure(0, weight=1)
|
root.columnconfigure(0, weight=1)
|
||||||
# Bantlar: baslik -> uyarilar -> hedef -> govde -> cikti -> eylem.
|
# Bantlar: baslik -> uyarilar -> hedef -> govde -> cikti -> eylem.
|
||||||
root.rowconfigure(3, weight=3)
|
# minsize: minimum pencerede (1040x760) islem listesi de cikti kuyusu da
|
||||||
root.rowconfigure(4, weight=2)
|
# gorunur kalir; ikisi de agirlikla buyur, hicbiri digerini yutamaz.
|
||||||
|
root.rowconfigure(3, weight=3, minsize=200)
|
||||||
|
root.rowconfigure(4, weight=2, minsize=170)
|
||||||
|
|
||||||
self._build_header()
|
self._build_header()
|
||||||
self._build_notices()
|
self._build_notices()
|
||||||
|
|
@ -2717,18 +2719,21 @@ class BfGui: # pragma: no cover - pencere gerektirir (statik testler dokunmaz)
|
||||||
"""Sozcuklu rozet: renk TEK BASINA anlam tasimaz (kural 2)."""
|
"""Sozcuklu rozet: renk TEK BASINA anlam tasimaz (kural 2)."""
|
||||||
return ttk.Label(parent, text=word, style=style)
|
return ttk.Label(parent, text=word, style=style)
|
||||||
|
|
||||||
def _bind_wrap(self, label, padding: int) -> None:
|
def _bind_wrap(self, container, label, padding: int,
|
||||||
"""Etiketi KENDI genisligine gore sarar: dar pencerede kirpilmasin.
|
minimum: int = 220) -> None:
|
||||||
|
"""Etiketin sarma sinirini KAPSAYICININ genisliginden turetir.
|
||||||
|
|
||||||
Sabit bir wraplength dar pencerede metni kesiyordu; bu yuzden sarma
|
Etiketi kendi genisligine baglamak, sarma genisligi etiketin istegiyle
|
||||||
siniri her yeniden boyutlanmada panelin gercek genisliginden turetilir.
|
birbirini besledigi icin hecelere bolunen metin uretiyordu (olculdu).
|
||||||
|
Kapsayicinin genisligi grid'den gelir ve kararli oldugu icin sarma
|
||||||
|
siniri oradan hesaplanir; alt sinir da metnin okunabilir kalmasi icin.
|
||||||
"""
|
"""
|
||||||
def on_configure(event) -> None:
|
def on_configure(event) -> None:
|
||||||
width = max(theme.SP_6, int(event.width) - padding)
|
width = max(minimum, int(event.width) - padding)
|
||||||
if str(label.cget("wraplength")) != str(width):
|
if str(label.cget("wraplength")) != str(width):
|
||||||
label.configure(wraplength=width)
|
label.configure(wraplength=width)
|
||||||
|
|
||||||
label.bind("<Configure>", on_configure)
|
container.bind("<Configure>", on_configure)
|
||||||
|
|
||||||
def _set_status(self, word: str, severity: str = "idle") -> None:
|
def _set_status(self, word: str, severity: str = "idle") -> None:
|
||||||
"""Durum gostergesi: sozcuk + renk (duz gri bir etiket degil)."""
|
"""Durum gostergesi: sozcuk + renk (duz gri bir etiket degil)."""
|
||||||
|
|
@ -3108,7 +3113,7 @@ class BfGui: # pragma: no cover - pencere gerektirir (statik testler dokunmaz)
|
||||||
style=self.styles["panel_label"],
|
style=self.styles["panel_label"],
|
||||||
justify="left")
|
justify="left")
|
||||||
detail_label.grid(row=1, column=0, sticky="w", padx=theme.SP_3)
|
detail_label.grid(row=1, column=0, sticky="w", padx=theme.SP_3)
|
||||||
self._bind_wrap(detail_label, theme.SP_4)
|
self._bind_wrap(right, detail_label, theme.SP_6)
|
||||||
options_frame = ttk.Frame(right, style=self.styles["panel"])
|
options_frame = ttk.Frame(right, style=self.styles["panel"])
|
||||||
options_frame.grid(row=2, column=0, sticky="ew", padx=theme.SP_3,
|
options_frame.grid(row=2, column=0, sticky="ew", padx=theme.SP_3,
|
||||||
pady=theme.SP_3)
|
pady=theme.SP_3)
|
||||||
|
|
@ -3124,7 +3129,7 @@ class BfGui: # pragma: no cover - pencere gerektirir (statik testler dokunmaz)
|
||||||
)
|
)
|
||||||
hint.grid(row=3, column=0, sticky="w", padx=theme.SP_3,
|
hint.grid(row=3, column=0, sticky="w", padx=theme.SP_3,
|
||||||
pady=(0, theme.SP_3))
|
pady=(0, theme.SP_3))
|
||||||
self._bind_wrap(hint, theme.SP_4)
|
self._bind_wrap(right, hint, theme.SP_6)
|
||||||
|
|
||||||
def _render_rows(self, category: str) -> None:
|
def _render_rows(self, category: str) -> None:
|
||||||
"""Liste satirlarini (varsa suzgece gore) yeniden cizer."""
|
"""Liste satirlarini (varsa suzgece gore) yeniden cizer."""
|
||||||
|
|
@ -3200,20 +3205,22 @@ class BfGui: # pragma: no cover - pencere gerektirir (statik testler dokunmaz)
|
||||||
elif spec.kind == "choice":
|
elif spec.kind == "choice":
|
||||||
var = tk.StringVar(value=spec.default or (spec.choices[0] if spec.choices else ""))
|
var = tk.StringVar(value=spec.default or (spec.choices[0] if spec.choices else ""))
|
||||||
widget = ttk.Combobox(options_frame, textvariable=var,
|
widget = ttk.Combobox(options_frame, textvariable=var,
|
||||||
values=list(spec.choices), width=24,
|
values=list(spec.choices), width=22,
|
||||||
state="readonly")
|
state="readonly")
|
||||||
self.option_widgets[spec.name] = ("str", var)
|
self.option_widgets[spec.name] = ("str", var)
|
||||||
else:
|
else:
|
||||||
var = tk.StringVar(value=spec.default)
|
var = tk.StringVar(value=spec.default)
|
||||||
widget = ttk.Entry(options_frame, textvariable=var, width=26)
|
widget = ttk.Entry(options_frame, textvariable=var, width=22)
|
||||||
self.option_widgets[spec.name] = ("str", var)
|
self.option_widgets[spec.name] = ("str", var)
|
||||||
widget.grid(row=row, column=1, sticky="w", pady=theme.SP_1)
|
widget.grid(row=row, column=1, sticky="w", pady=theme.SP_1)
|
||||||
if spec.hint:
|
if spec.hint:
|
||||||
hint = ttk.Label(options_frame, text=spec.hint,
|
# Kisa ipucu: sabit sarma siniri yeterli ve kendi kendini
|
||||||
|
# besleme riski yok (etiketin kendi genisligine baglanmaz).
|
||||||
|
ttk.Label(options_frame, text=spec.hint,
|
||||||
style=self.styles["panel_faint"],
|
style=self.styles["panel_faint"],
|
||||||
justify="left")
|
wraplength=theme.SP_7 * 3,
|
||||||
hint.grid(row=row, column=2, sticky="w", padx=(theme.SP_2, 0))
|
justify="left").grid(row=row, column=2, sticky="w",
|
||||||
self._bind_wrap(hint, theme.SP_2)
|
padx=(theme.SP_2, 0))
|
||||||
row += 1
|
row += 1
|
||||||
|
|
||||||
badges = ttk.Frame(options_frame, style=self.styles["panel"])
|
badges = ttk.Frame(options_frame, style=self.styles["panel"])
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue