Compare commits
3
Commits
b0e769075f
...
f3446f32ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3446f32ad | ||
|
|
7ca029e3ea | ||
|
|
26f9abb0dd |
+1
-1
@@ -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.124"
|
||||
VERSION = "0.0.0.127"
|
||||
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||
DEFAULT_GRID_SIZE = 10
|
||||
DEFAULT_ADD_TIMESTAMP = True
|
||||
|
||||
@@ -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
|
||||
|
||||
+20
-4
@@ -33,14 +33,17 @@ DEVICE_PROFILES = {
|
||||
"screen": (800, 480),
|
||||
"frame_file": "frame_orion.png",
|
||||
"screen_offset": (191, 169),
|
||||
"default_zoom": 0.5,
|
||||
},
|
||||
"ontrolRion": {
|
||||
"screen": (320, 240),
|
||||
"frame_file": "frame_rion.png",
|
||||
"screen_offset": (76, 62),
|
||||
"default_zoom": 1.0,
|
||||
},
|
||||
}
|
||||
DEFAULT_SCREEN = (800, 480)
|
||||
DEFAULT_ZOOM = 0.5
|
||||
|
||||
ZOOM_LEVELS = (0.25, 0.33, 0.5, 0.67, 0.8, 1.0, 1.25, 1.5, 2.0, 3.0)
|
||||
|
||||
@@ -143,6 +146,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):
|
||||
@@ -174,7 +180,7 @@ class OxPageViewPanel:
|
||||
self._canvas_w = self._screen_w + CANVAS_PADDING * 2
|
||||
self._canvas_h = self._screen_h + CANVAS_PADDING * 2
|
||||
|
||||
self._zoom = 0.5
|
||||
self._zoom = profile.get("default_zoom", DEFAULT_ZOOM) if profile else DEFAULT_ZOOM
|
||||
self._selected_widget = None
|
||||
self._widget_items = {}
|
||||
self._tag_to_comp = {}
|
||||
@@ -256,7 +262,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)),
|
||||
)
|
||||
@@ -397,8 +403,11 @@ class OxPageViewPanel:
|
||||
|
||||
for iid, comp in self._tree_items.items():
|
||||
if comp is widget:
|
||||
self._tree.selection_set(iid)
|
||||
self._tree.see(iid)
|
||||
# selection_set always fires <<TreeviewSelect>>, which calls
|
||||
# back into _select_widget — only set it when it changes.
|
||||
if self._tree.selection() != (iid,):
|
||||
self._tree.selection_set(iid)
|
||||
self._tree.see(iid)
|
||||
break
|
||||
|
||||
name = widget.get("name", "?")
|
||||
@@ -601,6 +610,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()
|
||||
|
||||
Reference in New Issue
Block a user