Kit Manager: detect unsupported kits via platform database
Scan sedona/platforms/db/ to find which native kits are compiled for the SAX's platform. Kits with native code for other platforms, kits providing a PlatformService for a different device, and their transitive dependents are placed in a "Not supported" section with a red-cross checkbox that cannot be toggled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+25
-5
@@ -37,8 +37,14 @@ TICK_BLOCKS = [
|
||||
(2, 5), (3, 6), (4, 7), (5, 6), (6, 5), (7, 4), (8, 3), (9, 2),
|
||||
]
|
||||
|
||||
# The cross (X), as filled 2x2 blocks: two diagonal strokes.
|
||||
CROSS_BLOCKS = [
|
||||
(2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9),
|
||||
(9, 2), (8, 3), (7, 4), (6, 5), (5, 6), (4, 7), (3, 8), (2, 9),
|
||||
]
|
||||
|
||||
def make_checkbox_image(checked, enabled):
|
||||
|
||||
def make_checkbox_image(checked, enabled, cross=False):
|
||||
"""A checkbox drawn pixel by pixel, so a locked tick can be greyed out.
|
||||
|
||||
Tk has no disabled state for a cell, and a row tag would grey the whole row including
|
||||
@@ -56,7 +62,10 @@ def make_checkbox_image(checked, enabled):
|
||||
image.put(border, to=(0, 0, 1, CHECKBOX_SIZE))
|
||||
image.put(border, to=(CHECKBOX_SIZE - 1, 0, CHECKBOX_SIZE, CHECKBOX_SIZE))
|
||||
|
||||
if checked:
|
||||
if cross:
|
||||
for x, y in CROSS_BLOCKS:
|
||||
image.put("#b04040", to=(x, y, x + 2, y + 2))
|
||||
elif checked:
|
||||
for x, y in TICK_BLOCKS:
|
||||
image.put(ink, to=(x, y, x + 2, y + 2))
|
||||
|
||||
@@ -134,6 +143,10 @@ def collect_rows():
|
||||
# clearest place to see that the file points at something missing.
|
||||
others = [name for name in installed if name not in declared_names]
|
||||
|
||||
bad = palette.unsupported_kits()
|
||||
compatible = [name for name in others if name not in bad]
|
||||
incompatible = [name for name in others if name in bad]
|
||||
|
||||
groups = [
|
||||
("Installed kits", [
|
||||
(name, checksum) for name, checksum in declared if name in required
|
||||
@@ -141,7 +154,8 @@ def collect_rows():
|
||||
("Installed but not used kits", [
|
||||
(name, checksum) for name, checksum in declared if name not in required
|
||||
]),
|
||||
("Kits available on the computer", [(name, None) for name in others]),
|
||||
("Kits available on the computer", [(name, None) for name in compatible]),
|
||||
("Not supported", [(name, None) for name in incompatible]),
|
||||
]
|
||||
|
||||
rows = []
|
||||
@@ -153,6 +167,7 @@ def collect_rows():
|
||||
builds = palette.kit_builds(name)
|
||||
latest = builds[0] if builds else None
|
||||
is_declared = name in declared_names
|
||||
is_unsupported = name in bad
|
||||
options = action_options(name, checksum, is_declared, builds)
|
||||
|
||||
if not is_declared:
|
||||
@@ -168,6 +183,7 @@ def collect_rows():
|
||||
"kit": name,
|
||||
"declared": is_declared,
|
||||
"required": name in required,
|
||||
"unsupported": is_unsupported,
|
||||
"checksum": checksum,
|
||||
"builds": builds,
|
||||
"latest": latest,
|
||||
@@ -175,7 +191,6 @@ def collect_rows():
|
||||
"latest_text": column_label(*latest) if latest else NOT_DECLARED,
|
||||
"options": options,
|
||||
"choice": 0,
|
||||
# The tick reflects the file as it stands: declared kits start ticked.
|
||||
"checked": is_declared,
|
||||
})
|
||||
return rows
|
||||
@@ -248,6 +263,7 @@ class KitsPanel:
|
||||
(True, False): make_checkbox_image(True, False),
|
||||
(False, False): make_checkbox_image(False, False),
|
||||
}
|
||||
self.cross_box = make_checkbox_image(False, False, cross=True)
|
||||
|
||||
hint = ttk.Label(
|
||||
self.frame,
|
||||
@@ -370,6 +386,8 @@ class KitsPanel:
|
||||
return (row["kit"], row["installed_text"], row["latest_text"], self._action_text(row))
|
||||
|
||||
def _row_image(self, row):
|
||||
if row.get("unsupported"):
|
||||
return self.cross_box
|
||||
return self.boxes[(row["checked"], not row["required"])]
|
||||
|
||||
def _rebuild_table(self):
|
||||
@@ -403,7 +421,7 @@ class KitsPanel:
|
||||
|
||||
def _toggle_check(self, item):
|
||||
row = self.row_by_item[item]
|
||||
if row["required"]:
|
||||
if row["required"] or row.get("unsupported"):
|
||||
return
|
||||
|
||||
row["checked"] = not row["checked"]
|
||||
@@ -420,6 +438,8 @@ class KitsPanel:
|
||||
|
||||
def _edit_action(self, item):
|
||||
row = self.row_by_item[item]
|
||||
if row.get("unsupported"):
|
||||
return
|
||||
cell = self.table.bbox(item, "action")
|
||||
if not cell:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user