Kit Manager: all columns fixed width with horizontal scrollbar
No columns stretch — sizes are set for the longest kit name (ontrolModbusTcpSlaveSmart) and action text (Keep with no checksum). A horizontal scrollbar appears when the pane is narrower than the total column width. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
|
|||||||
import configparser
|
import configparser
|
||||||
import os
|
import os
|
||||||
|
|
||||||
VERSION = "0.0.0.067"
|
VERSION = "0.0.0.068"
|
||||||
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||||
DEFAULT_GRID_SIZE = 10
|
DEFAULT_GRID_SIZE = 10
|
||||||
DEFAULT_ADD_TIMESTAMP = True
|
DEFAULT_ADD_TIMESTAMP = True
|
||||||
|
|||||||
+16
-10
@@ -213,23 +213,29 @@ class KitsPanel:
|
|||||||
self.frame = ttk.Frame(parent, padding=10)
|
self.frame = ttk.Frame(parent, padding=10)
|
||||||
|
|
||||||
COLUMNS = ("name", "installed", "latest", "action")
|
COLUMNS = ("name", "installed", "latest", "action")
|
||||||
|
|
||||||
|
table_frame = ttk.Frame(self.frame)
|
||||||
|
table_frame.pack(fill=tk.BOTH, expand=True)
|
||||||
|
|
||||||
self.table = ttk.Treeview(
|
self.table = ttk.Treeview(
|
||||||
self.frame, columns=COLUMNS, show="tree headings", selectmode="browse",
|
table_frame, columns=COLUMNS, show="tree headings", selectmode="browse",
|
||||||
)
|
)
|
||||||
self.table.heading("#0", text="")
|
self.table.heading("#0", text="")
|
||||||
self.table.column("#0", width=32, minwidth=32, stretch=False, anchor="center")
|
self.table.column("#0", width=32, minwidth=32, stretch=False, anchor="center")
|
||||||
for column, heading, width, stretch, anchor in [
|
for column, heading, width, anchor in [
|
||||||
("name", "Kit name", 200, True, "w"),
|
("name", "Kit name", 190, "w"),
|
||||||
("installed", "Installed", 105, False, "w"),
|
("installed", "Installed", 105, "w"),
|
||||||
("latest", "Latest", 105, False, "w"),
|
("latest", "Latest", 105, "w"),
|
||||||
("action", "Action", 300, False, "w"),
|
("action", "Action", 195, "w"),
|
||||||
]:
|
]:
|
||||||
self.table.heading(column, text=heading, anchor=anchor)
|
self.table.heading(column, text=heading, anchor=anchor)
|
||||||
self.table.column(column, width=width, anchor=anchor, stretch=stretch)
|
self.table.column(column, width=width, minwidth=width, anchor=anchor, stretch=False)
|
||||||
|
|
||||||
scrollbar = ttk.Scrollbar(self.frame, orient=tk.VERTICAL, command=self.table.yview)
|
vscroll = ttk.Scrollbar(table_frame, orient=tk.VERTICAL, command=self.table.yview)
|
||||||
self.table.configure(yscrollcommand=scrollbar.set)
|
hscroll = ttk.Scrollbar(table_frame, orient=tk.HORIZONTAL, command=self.table.xview)
|
||||||
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
self.table.configure(yscrollcommand=vscroll.set, xscrollcommand=hscroll.set)
|
||||||
|
vscroll.pack(side=tk.RIGHT, fill=tk.Y)
|
||||||
|
hscroll.pack(side=tk.BOTTOM, fill=tk.X)
|
||||||
self.table.pack(fill=tk.BOTH, expand=True)
|
self.table.pack(fill=tk.BOTH, expand=True)
|
||||||
|
|
||||||
self.table.tag_configure(SECTION_TAG, background="#dcdcdc")
|
self.table.tag_configure(SECTION_TAG, background="#dcdcdc")
|
||||||
|
|||||||
Reference in New Issue
Block a user