diff --git a/app_state.py b/app_state.py index 645072e..d467ff8 100644 --- a/app_state.py +++ b/app_state.py @@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it. import configparser import os -VERSION = "0.0.0.125" +VERSION = "0.0.0.126" PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties") DEFAULT_GRID_SIZE = 10 DEFAULT_ADD_TIMESTAMP = True diff --git a/main.py b/main.py index b6d9e05..a903d0d 100644 --- a/main.py +++ b/main.py @@ -163,6 +163,9 @@ def refresh_dirty_display(): only turned red on the paths that happened to rebuild the tree -- a Properties Save did, dragging a box did not. """ + if ox_page_panel is not None: + ox_page_panel.refresh_dirty_tint() + tree = app_state.tree if tree is None: return diff --git a/ox_page_view.py b/ox_page_view.py index b4a9d80..c7cbfbe 100644 --- a/ox_page_view.py +++ b/ox_page_view.py @@ -143,6 +143,9 @@ def _get_widget_children(page_comp): return [c for c in page_comp if c.tag == "comp" and _is_ox_widget(c)] +CANVAS_BG = "#e0e0e0" + + class OxPageViewPanel: def __init__(self, parent, comp, on_change=None, on_close=None): @@ -256,7 +259,7 @@ class OxPageViewPanel: hscroll.pack(side=tk.BOTTOM, fill=tk.X) self._canvas = tk.Canvas( - parent, bg="#e0e0e0", highlightthickness=0, + parent, bg=self._background(), highlightthickness=0, xscrollcommand=hscroll.set, yscrollcommand=vscroll.set, scrollregion=(0, 0, int(self._canvas_w * self._zoom), int(self._canvas_h * self._zoom)), ) @@ -604,6 +607,13 @@ class OxPageViewPanel: def refresh(self): self._render_page() + def _background(self): + return app_state.DIRTY_TINT if app_state.is_dirty else CANVAS_BG + + def refresh_dirty_tint(self): + """Wears the wiresheet's unsaved-state tint while the document has unwritten changes.""" + self._canvas.config(bg=self._background()) + def close(self): if self.on_close is not None: self.on_close()