Left column: fixed width preference, auto scrollbars, pane floors
The tree and palette column took a share of every extra pixel the window gained. It is now pinned to a width set in Preferences, defaulting to 230 px, so widening the window only ever feeds the wiresheet. That fixed width brought two existing weaknesses into view: - Long paths and type names had nowhere to go. Both lists now size their tree column to the widest visible row - ttk derives the horizontal scroll range from the column width, so a column left stretching can never scroll - and carry vertical and horizontal scrollbars that leave the grid when they have nothing to scroll. - A short window squeezed the navigation tree away entirely. Both lists asked for ten rows, so the palette requested the most while the tree, carrying the larger weight, gave up its height first. The requested rows are now 6 and 5, a 300 px minimum window height keeps the shortfall shallow, and clamp_left_pane_split holds a dragged sash between the two floors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+20
-4
@@ -19,6 +19,13 @@ DEFAULT_BOX_WIDTH = 100
|
||||
MIN_ALLOWED_BOX_WIDTH = 60
|
||||
MAX_ALLOWED_BOX_WIDTH = 400
|
||||
|
||||
# The tree and palette column is held at this width whatever the window does, so a wider
|
||||
# window only ever gives the wiresheet more room. The sash can still be dragged; this is
|
||||
# the width the column is set to at startup and whenever the preference changes.
|
||||
DEFAULT_LEFT_PANE_WIDTH = 230
|
||||
MIN_ALLOWED_LEFT_PANE_WIDTH = 120
|
||||
MAX_ALLOWED_LEFT_PANE_WIDTH = 600
|
||||
|
||||
# Widget handles, filled in by main once the UI exists
|
||||
window = None
|
||||
canvas = None
|
||||
@@ -70,6 +77,7 @@ def load_preferences():
|
||||
grid_size = DEFAULT_GRID_SIZE
|
||||
add_timestamp = DEFAULT_ADD_TIMESTAMP
|
||||
box_width = DEFAULT_BOX_WIDTH
|
||||
left_pane_width = DEFAULT_LEFT_PANE_WIDTH
|
||||
sedona_home = ""
|
||||
|
||||
if os.path.exists(PROPERTIES_FILE):
|
||||
@@ -78,6 +86,9 @@ def load_preferences():
|
||||
grid_size = config.getint("Editor", "grid_size", fallback=DEFAULT_GRID_SIZE)
|
||||
add_timestamp = config.getboolean("Editor", "add_timestamp", fallback=DEFAULT_ADD_TIMESTAMP)
|
||||
box_width = config.getint("Editor", "box_width", fallback=DEFAULT_BOX_WIDTH)
|
||||
left_pane_width = config.getint(
|
||||
"Editor", "left_pane_width", fallback=DEFAULT_LEFT_PANE_WIDTH
|
||||
)
|
||||
sedona_home = config.get("Editor", "sedona.home", fallback="").strip()
|
||||
except Exception:
|
||||
pass
|
||||
@@ -86,7 +97,8 @@ def load_preferences():
|
||||
"sedona.home": "",
|
||||
"grid_size": str(DEFAULT_GRID_SIZE),
|
||||
"add_timestamp": str(DEFAULT_ADD_TIMESTAMP),
|
||||
"box_width": str(DEFAULT_BOX_WIDTH)
|
||||
"box_width": str(DEFAULT_BOX_WIDTH),
|
||||
"left_pane_width": str(DEFAULT_LEFT_PANE_WIDTH)
|
||||
}
|
||||
try:
|
||||
with open(PROPERTIES_FILE, "w") as configfile:
|
||||
@@ -95,7 +107,10 @@ def load_preferences():
|
||||
pass
|
||||
|
||||
box_width = max(MIN_ALLOWED_BOX_WIDTH, min(MAX_ALLOWED_BOX_WIDTH, box_width))
|
||||
return sedona_home, grid_size, add_timestamp, box_width
|
||||
left_pane_width = max(
|
||||
MIN_ALLOWED_LEFT_PANE_WIDTH, min(MAX_ALLOWED_LEFT_PANE_WIDTH, left_pane_width)
|
||||
)
|
||||
return sedona_home, grid_size, add_timestamp, box_width, left_pane_width
|
||||
|
||||
|
||||
def save_preferences():
|
||||
@@ -105,7 +120,8 @@ def save_preferences():
|
||||
"sedona.home": SEDONA_HOME,
|
||||
"grid_size": str(GRID_SIZE),
|
||||
"add_timestamp": str(ADD_TIMESTAMP),
|
||||
"box_width": str(BOX_WIDTH)
|
||||
"box_width": str(BOX_WIDTH),
|
||||
"left_pane_width": str(LEFT_PANE_WIDTH)
|
||||
}
|
||||
with open(PROPERTIES_FILE, "w") as configfile:
|
||||
config.write(configfile)
|
||||
@@ -148,4 +164,4 @@ def mark_clean():
|
||||
canvas.config(bg="white")
|
||||
|
||||
|
||||
SEDONA_HOME, GRID_SIZE, ADD_TIMESTAMP, BOX_WIDTH = load_preferences()
|
||||
SEDONA_HOME, GRID_SIZE, ADD_TIMESTAMP, BOX_WIDTH, LEFT_PANE_WIDTH = load_preferences()
|
||||
|
||||
Reference in New Issue
Block a user