Integrate the Design Creations license and refine the monitor
This commit is contained in:
@@ -1 +1,8 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Adaptive Resource Monitor."""
|
||||
|
||||
34
arm/about.py
34
arm/about.py
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""The Design Creations About tab and bundled project documents."""
|
||||
import json
|
||||
import logging
|
||||
@@ -19,6 +26,8 @@ from .branding import (
|
||||
APPLICATION_IMAGE, COMPANY_LOGO, COPYRIGHT, DEVELOPER, DESCRIPTION, INSTALL_ID,
|
||||
SUPPORT_URL, WEBSITE, asset, document,
|
||||
)
|
||||
from .software_license import LICENSE_LABEL, LicenseDialog
|
||||
from .update_release import LICENSE_FILE
|
||||
from .version import NAME, VERSION
|
||||
from .update_ui import UpdatePanel
|
||||
from .window_geometry import WindowGeometry
|
||||
@@ -27,7 +36,6 @@ LOG = logging.getLogger(__name__)
|
||||
DOCS = {
|
||||
"README.md": "README",
|
||||
"CHANGELOG.md": "Change Log",
|
||||
"LICENSE.md": "Software License",
|
||||
"THIRD_PARTY.md": "Third-party Notices",
|
||||
}
|
||||
UNINSTALL_KEY = rf"Software\Microsoft\Windows\CurrentVersion\Uninstall\{INSTALL_ID}_is1"
|
||||
@@ -127,9 +135,15 @@ class AboutPage(QWidget):
|
||||
self.version = QLabel(VERSION)
|
||||
details.addRow("Installed version", self.version)
|
||||
details.addRow("Release classification", QLabel(release_classification()))
|
||||
license_info = ("See Software License below." if "LICENSE.md" in self.documents
|
||||
else "Project license terms unavailable.")
|
||||
details.addRow("Software license", QLabel(license_info))
|
||||
license_row = QHBoxLayout()
|
||||
self.view_license = QPushButton("View License")
|
||||
self.view_license.clicked.connect(self.show_license)
|
||||
bundled = document(LICENSE_FILE).is_file()
|
||||
license_row.addWidget(QLabel(LICENSE_LABEL if bundled else "License file unavailable"))
|
||||
self.view_license.setEnabled(bundled)
|
||||
license_row.addWidget(self.view_license)
|
||||
license_row.addStretch()
|
||||
details.addRow("Software license", license_row)
|
||||
view = QPushButton("Application Details")
|
||||
view.clicked.connect(self.show_details)
|
||||
buttons = QHBoxLayout()
|
||||
@@ -194,11 +208,23 @@ class AboutPage(QWidget):
|
||||
self.document_group.setTitle(self.documents[name])
|
||||
try:
|
||||
self.browser.setMarkdown(path.read_text(encoding="utf-8"))
|
||||
if name == "CHANGELOG.md" and self.isVisible():
|
||||
self.updates.dismiss_success_notice()
|
||||
except (OSError, UnicodeError) as exc:
|
||||
LOG.warning("Unable to read About document %s: %s", name, exc)
|
||||
self.browser.setPlainText(f"Unable to open {name}.")
|
||||
self.browser.verticalScrollBar().setValue(0)
|
||||
|
||||
def show_license(self):
|
||||
try:
|
||||
markdown = document(LICENSE_FILE).read_text(encoding="utf-8-sig")
|
||||
except (OSError, UnicodeError) as exc:
|
||||
LOG.warning("Unable to read the bundled software license: %s", exc)
|
||||
return
|
||||
dialog = LicenseDialog(self, self.data_root, markdown)
|
||||
dialog.exec()
|
||||
dialog.deleteLater()
|
||||
|
||||
def open_link(self, target):
|
||||
if target in self.documents:
|
||||
self.show_document(target)
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
from dataclasses import replace
|
||||
from functools import partial
|
||||
import logging
|
||||
@@ -215,7 +222,7 @@ class Application(QObject):
|
||||
icon.activated.connect(partial(self.activate_icon, machine))
|
||||
icon.messageClicked.connect(lambda: self.open_update(self.update_notice_changelog))
|
||||
self.icons[machine] = icon
|
||||
self.menus[machine] = TrayMenu(self, machine)
|
||||
self.menus[machine] = TrayMenu(self)
|
||||
self.menus[machine].theme(self.brand_colors)
|
||||
self.set_menu_update(self.menus[machine])
|
||||
icon.setContextMenu(self.menus[machine])
|
||||
@@ -286,17 +293,13 @@ class Application(QObject):
|
||||
|
||||
def activate_icon(self, machine, reason):
|
||||
if reason == QSystemTrayIcon.ActivationReason.Trigger:
|
||||
self.toggle_pin(machine)
|
||||
if not self.popup.pinned:
|
||||
self.hover.show(machine)
|
||||
elif reason == QSystemTrayIcon.ActivationReason.DoubleClick:
|
||||
self.open_expanded()
|
||||
|
||||
def toggle_pin(self, machine):
|
||||
self.hover.pin(not self.popup.pinned or self.hover.anchor != machine, machine)
|
||||
self.sync_menus()
|
||||
|
||||
def set_pin(self, enabled):
|
||||
self.hover.pin(enabled)
|
||||
self.sync_menus()
|
||||
|
||||
def render(self):
|
||||
now = time()
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Shared Design Creations identity and asset locations."""
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Collector lifecycle and the Qt delivery boundary."""
|
||||
from collections import defaultdict
|
||||
from dataclasses import replace
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import json
|
||||
import logging
|
||||
import math
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Application-owned generic credentials in Windows Credential Manager."""
|
||||
import ctypes as ct
|
||||
from ctypes import wintypes as w
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
from dataclasses import replace
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Timestamp-based plots shared by the monitoring windows and tray."""
|
||||
from time import time
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""SQLite activity is confined to one background thread."""
|
||||
from contextlib import closing
|
||||
from pathlib import Path
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Machine checklists and drag controls shared by monitoring views."""
|
||||
from PySide6.QtCore import QEvent, QObject, QPoint, QSignalBlocker, Qt, QTimer
|
||||
from PySide6.QtWidgets import (
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
from collections import defaultdict, deque
|
||||
from dataclasses import dataclass
|
||||
from enum import StrEnum
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Independent telemetry providers."""
|
||||
import logging
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import logging
|
||||
import re
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
# The client sends a single dot for each observation over the existing channel.
|
||||
export LC_ALL=C
|
||||
os=$(uname -sr)
|
||||
nvidia=$(command -v nvidia-smi || :)
|
||||
sample() {
|
||||
printf '@arm-begin\nos\t%s\n' "$os"
|
||||
if read -r uptime _ < /proc/uptime; then
|
||||
printf 'uptime\t%s\n' "$uptime"
|
||||
fi
|
||||
while read -r name value; do
|
||||
case "$name" in
|
||||
cpu|cpu[0-9]*) printf 'cpu\t%s\t%s\n' "$name" "$value";;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Windows performance data and adapter identity."""
|
||||
import ctypes as ct
|
||||
from ctypes import wintypes as w
|
||||
@@ -9,6 +16,13 @@ import winreg
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def uptime_counter():
|
||||
counter = ct.WinDLL("kernel32").GetTickCount64
|
||||
counter.argtypes = ()
|
||||
counter.restype = ct.c_uint64
|
||||
return counter
|
||||
|
||||
|
||||
class _Double(ct.Structure):
|
||||
_fields_ = [("status", w.DWORD), ("value", ct.c_double)]
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import base64
|
||||
import csv
|
||||
import hashlib
|
||||
@@ -295,7 +302,9 @@ class LinuxParser:
|
||||
sensors = [row for row in sections["cpusensor"] if len(row) == 2]
|
||||
temperatures = [val for temp, _ in sensors if (val := num(temp, .001)) is not None]
|
||||
powers = [val for _, power in sensors if (val := num(power, .000001)) is not None]
|
||||
uptime = next((num(row[0]) for row in sections["uptime"] if len(row) == 1), None)
|
||||
items.extend(readings(machine, stamp, TOTAL, {
|
||||
"system.uptime": (uptime if uptime is not None and uptime >= 0 else None, "s"),
|
||||
"cpu.util": (usage(*cpu_values.get("cpu", (None, None))), "%"),
|
||||
"cpu.physical": (len(core_map) or None, "count"),
|
||||
"cpu.logical": (sum(key != "cpu" for key in cpu_values) if cpu_values else None, "count"),
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import logging
|
||||
import platform
|
||||
from time import perf_counter as monotonic, time
|
||||
@@ -5,7 +12,7 @@ from time import perf_counter as monotonic, time
|
||||
import psutil
|
||||
|
||||
from . import Provider
|
||||
from .native import Pdh, commit, cpu_identity, interface_info, pagefiles, physical_cores
|
||||
from .native import Pdh, commit, cpu_identity, interface_info, pagefiles, physical_cores, uptime_counter
|
||||
from ..model import (
|
||||
LOCAL, TOTAL, Availability, Device, Reading, Sample, aggregate, rate, readings, usage,
|
||||
)
|
||||
@@ -21,6 +28,7 @@ class Cpu(Provider):
|
||||
self.last = {}
|
||||
self.name = cpu_identity()
|
||||
self.cores = physical_cores()
|
||||
self.uptime = uptime_counter()
|
||||
self.stamp = 0
|
||||
|
||||
@staticmethod
|
||||
@@ -52,6 +60,7 @@ class Cpu(Provider):
|
||||
self.last, self.stamp = times, now
|
||||
frequency = psutil.cpu_freq()
|
||||
items.extend(readings(LOCAL, stamp, TOTAL, {
|
||||
"system.uptime": (self.uptime() / 1000, "s"),
|
||||
"cpu.util": (cpu_group(values, times), "%"),
|
||||
"cpu.frequency": (frequency.current if frequency else None, "MHz"),
|
||||
"cpu.physical": (len(cores) or psutil.cpu_count(logical=False), "count"),
|
||||
|
||||
43
arm/software_license.py
Normal file
43
arm/software_license.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Offline display and review of the application's software license."""
|
||||
from PySide6.QtWidgets import QDialog, QDialogButtonBox, QTextBrowser, QVBoxLayout
|
||||
from PySide6.QtGui import QDesktopServices
|
||||
|
||||
from .window_geometry import WindowGeometry
|
||||
|
||||
LICENSE_LABEL = "DC-ANCSA v1.0"
|
||||
|
||||
|
||||
class LicenseDialog(QDialog):
|
||||
def __init__(self, parent, root, markdown, review=False):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Design Creations Software License")
|
||||
self.resize(820, 640)
|
||||
layout = QVBoxLayout(self)
|
||||
self.browser = QTextBrowser(openLinks=False)
|
||||
self.browser.setAccessibleName("Software license text")
|
||||
self.browser.setMarkdown(markdown)
|
||||
self.browser.anchorClicked.connect(self.open_link)
|
||||
layout.addWidget(self.browser)
|
||||
if review:
|
||||
buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Cancel)
|
||||
accept = buttons.addButton("Accept license and install", QDialogButtonBox.ButtonRole.AcceptRole)
|
||||
accept.setAutoDefault(False)
|
||||
buttons.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True)
|
||||
else:
|
||||
buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Close)
|
||||
buttons.accepted.connect(self.accept)
|
||||
buttons.rejected.connect(self.reject)
|
||||
layout.addWidget(buttons)
|
||||
self.window_geometry = WindowGeometry(self, root / "software-license-window.bin")
|
||||
|
||||
@staticmethod
|
||||
def open_link(url):
|
||||
if url.scheme() in ("https", "http", "mailto"):
|
||||
QDesktopServices.openUrl(url)
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Use the cursor and Explorer's registered icon geometry for hover."""
|
||||
import ctypes as ct
|
||||
from ctypes import wintypes as w
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Design Creations tray commands for each visible ARM icon."""
|
||||
from PySide6.QtCore import QSize, Qt
|
||||
from PySide6.QtGui import QActionGroup, QColor, QFont, QIcon, QPainter, QPen, QPixmap
|
||||
@@ -12,9 +19,9 @@ SP = QStyle.StandardPixmap
|
||||
|
||||
|
||||
class TrayMenu(QMenu):
|
||||
def __init__(self, app, scope):
|
||||
def __init__(self, app):
|
||||
super().__init__()
|
||||
self.app, self.scope = app, scope
|
||||
self.app = app
|
||||
self.setAccessibleName(f"{NAME} tray menu")
|
||||
self.add_header()
|
||||
self.update = self.action(self, "", None, app.open_update)
|
||||
@@ -26,8 +33,6 @@ class TrayMenu(QMenu):
|
||||
open_monitor = self.action(self, "Open Resource Monitor", SP.SP_ComputerIcon,
|
||||
app.open_expanded)
|
||||
self.setDefaultAction(open_monitor)
|
||||
self.pin = self.action(self, "Pin Resource Monitor", None, lambda: app.toggle_pin(scope))
|
||||
self.pin.setCheckable(True)
|
||||
|
||||
self.addSeparator()
|
||||
self.machines = MachineMenu(app.dashboard, app.toggle_machine, self)
|
||||
@@ -101,7 +106,6 @@ class TrayMenu(QMenu):
|
||||
app = self.app
|
||||
self.machines.sync()
|
||||
self.modes[app.settings.mode].setChecked(True)
|
||||
self.pin.setChecked(app.popup.pinned and app.hover.anchor == self.scope)
|
||||
self.start.setChecked(app.startup_enabled())
|
||||
|
||||
def theme(self, colors):
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Anonymous update discovery and verified downloads from the ARM release repository."""
|
||||
from dataclasses import dataclass
|
||||
from hashlib import sha256
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -9,7 +17,8 @@ from urllib.parse import quote, urlsplit
|
||||
from urllib.request import HTTPRedirectHandler, Request, build_opener
|
||||
|
||||
from .update_release import (
|
||||
MANIFEST, MAX_MANIFEST_SIZE, Release, UpdateError, eligible, exclusion_reason, source_config, verify_file, verify_manifest,
|
||||
LICENSE_FILE, MANIFEST, MAX_MANIFEST_SIZE, Release, UpdateError, eligible, exclusion_reason,
|
||||
software_license_digest, source_config, verify_file, verify_manifest,
|
||||
)
|
||||
from .version import VERSION, version_key
|
||||
|
||||
@@ -72,6 +81,16 @@ class ReleaseClient:
|
||||
raise UpdateError(f"Release attachment size is inconsistent: {name}")
|
||||
return expected
|
||||
|
||||
def read_license(self, release):
|
||||
expected = software_license_digest(release.notes)
|
||||
if expected is None:
|
||||
raise UpdateError("The release has no signed software license checksum")
|
||||
source = f"{self.base}/{self.repository}/raw/tag/{quote(release.version, safe='')}/{LICENSE_FILE}"
|
||||
data = self.read(source, MAX_MANIFEST_SIZE)
|
||||
if sha256(data).hexdigest() != expected:
|
||||
raise UpdateError("The software license does not match the signed release checksum")
|
||||
return data.decode("utf-8-sig")
|
||||
|
||||
def check(self, installed, kind):
|
||||
rows = {}
|
||||
for page in range(1, 11):
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""A small, independent Windows window for the frozen maintenance launcher."""
|
||||
import logging
|
||||
from tkinter import Button, Frame, Label, Tk, TclError
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Signed release contract shared by the updater, maintenance worker and CI."""
|
||||
from base64 import b64decode
|
||||
from dataclasses import dataclass
|
||||
@@ -13,6 +20,8 @@ from .branding import APP_MODEL_ID
|
||||
from .version import CHANNELS, ROOT, version_key
|
||||
|
||||
MANIFEST = "arm-update-windows-x64.json"
|
||||
LICENSE_FILE = "LICENSE.md"
|
||||
LICENSE_NOTE = "Software license SHA-256 "
|
||||
ARCHITECTURE = "windows-x64"
|
||||
KINDS = {"installed": "-setup.exe", "portable": "-portable.zip"}
|
||||
MAX_PACKAGE_SIZE = 1024**3
|
||||
@@ -39,6 +48,15 @@ def sha256(path):
|
||||
return file_digest(stream, "sha256").hexdigest()
|
||||
|
||||
|
||||
def software_license_digest(notes):
|
||||
last = notes.rsplit("\n", 1)[-1]
|
||||
if last.startswith(LICENSE_NOTE):
|
||||
digest = last[len(LICENSE_NOTE):]
|
||||
if SHA256.fullmatch(digest):
|
||||
return digest
|
||||
return None
|
||||
|
||||
|
||||
def artifact_name(version, kind):
|
||||
version_key(version)
|
||||
return f"AdaptiveResourceMonitor-{version}-{ARCHITECTURE}{KINDS[kind]}"
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Presentation and persisted outcomes for the shared updater."""
|
||||
from enum import Enum, auto
|
||||
import json
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Asynchronous Workshop-style update controls for the About tab."""
|
||||
from datetime import datetime
|
||||
import json
|
||||
@@ -11,8 +18,10 @@ from PySide6.QtWidgets import (
|
||||
QPushButton, QVBoxLayout,
|
||||
)
|
||||
|
||||
from .branding import document
|
||||
from .software_license import LicenseDialog
|
||||
from .update_client import ReleaseClient, UpdateCancelled, write_atomic
|
||||
from .update_release import MANIFEST, UpdateError, eligible, verify_file, verify_manifest
|
||||
from .update_release import LICENSE_FILE, MANIFEST, UpdateError, eligible, sha256, software_license_digest, verify_file, verify_manifest
|
||||
from .update_state import Phase, notice, notify_once, read_json, result_for
|
||||
from .version import VERSION, version_key
|
||||
|
||||
@@ -260,6 +269,16 @@ class UpdatePanel(QGroupBox):
|
||||
self.downloaded = value
|
||||
self.fields["Verification"].setText("Manifest signature and package SHA-256 verified")
|
||||
self.status.setText("Verified package saved. Install it when ready.")
|
||||
elif operation == "license":
|
||||
self.job = "license-review"
|
||||
dialog = LicenseDialog(self, self.root.parent, value, review=True)
|
||||
accepted = dialog.exec()
|
||||
dialog.deleteLater()
|
||||
self.job = None
|
||||
if accepted:
|
||||
self.begin_install()
|
||||
else:
|
||||
self.status.setText("Installation deferred. The verified package is still available.")
|
||||
elif operation == "prepare":
|
||||
self.plan = value
|
||||
self.elapsed = 0
|
||||
@@ -295,10 +314,27 @@ class UpdatePanel(QGroupBox):
|
||||
def install_now(self):
|
||||
if not self.downloaded or self.job or self.plan or not self.installable:
|
||||
return
|
||||
release = self.release
|
||||
expected = software_license_digest(release.notes)
|
||||
if expected is None:
|
||||
self.status.setText("The release has no signed software license checksum. Installation deferred.")
|
||||
return
|
||||
try:
|
||||
already_installed = sha256(document(LICENSE_FILE)) == expected
|
||||
except OSError as exc:
|
||||
LOG.warning("Could not read the installed software license: %s", exc)
|
||||
already_installed = False
|
||||
if not already_installed:
|
||||
self.status.setText("Checking the updated software license…")
|
||||
self.start("license", lambda: self.client.read_license(release))
|
||||
return
|
||||
if QMessageBox.question(self, "Install Update", f"Install {self.release.version} and restart Adaptive Resource Monitor?",
|
||||
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
|
||||
QMessageBox.StandardButton.No) != QMessageBox.StandardButton.Yes:
|
||||
return
|
||||
self.begin_install()
|
||||
|
||||
def begin_install(self):
|
||||
from .about import installation
|
||||
from .update_worker import prepare
|
||||
release, artifact, target = self.release, self.downloaded, installation()[1]
|
||||
@@ -311,6 +347,11 @@ class UpdatePanel(QGroupBox):
|
||||
def defer_install(self):
|
||||
self.status.setText("Installation deferred. The verified package will be available from About.")
|
||||
|
||||
def dismiss_success_notice(self):
|
||||
if self.success_banner:
|
||||
self.success_banner = False
|
||||
self.set_controls()
|
||||
|
||||
def poll_worker(self):
|
||||
self.elapsed += 250
|
||||
status = read_json(self.plan / "status.json", {})
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Independent Windows updater. Transaction data never includes the ARM user profile."""
|
||||
import argparse
|
||||
from contextlib import contextmanager
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
32
arm/views.py
32
arm/views.py
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
from time import time, strftime, localtime
|
||||
|
||||
from PySide6.QtCore import QPoint, QRect, QSize, Qt, QSignalBlocker, QTimer
|
||||
@@ -9,7 +16,7 @@ from PySide6.QtWidgets import (
|
||||
|
||||
from .graphs import Plot, resource_series, selected_resource
|
||||
from .machine_controls import MachineDrag, MachineDropdown
|
||||
from .model import NETWORK, TOTAL, Connection, INTERVALS, RANGES, RESOURCES, format_value
|
||||
from .model import NETWORK, TOTAL, Availability, Connection, INTERVALS, RANGES, RESOURCES, format_value
|
||||
from .version import VERSION
|
||||
from .window_geometry import fit_work_area
|
||||
|
||||
@@ -73,6 +80,17 @@ def display_value(item):
|
||||
return description if item.valid else f"{description} · {item.availability}"
|
||||
|
||||
|
||||
def describe_uptime(reading):
|
||||
if reading is None or reading.value is None:
|
||||
return "Uptime unavailable"
|
||||
minutes, seconds = divmod(int(reading.value), 60)
|
||||
hours, minutes = divmod(minutes, 60)
|
||||
days, hours = divmod(hours, 24)
|
||||
parts = [f"{value}{unit}" for value, unit in ((days, "d"), (hours, "h"), (minutes, "m")) if value]
|
||||
text = "Uptime " + (" ".join(parts) if parts else f"{seconds}s")
|
||||
return f"{text} (last sample)" if reading.availability is Availability.STALE else text
|
||||
|
||||
|
||||
class Card(QFrame):
|
||||
def __init__(self, resource, detailed, compact=False):
|
||||
super().__init__()
|
||||
@@ -152,6 +170,10 @@ class MachineSection(QFrame):
|
||||
details.toggled.connect(refresh)
|
||||
header.addWidget(details)
|
||||
|
||||
def drag_surfaces(self):
|
||||
return (self, self.title, *(widget for card in self.cards.values()
|
||||
for widget in (card, *card.findChildren(QWidget))))
|
||||
|
||||
|
||||
class UpdateBanner(QFrame):
|
||||
def __init__(self, open_update):
|
||||
@@ -386,7 +408,8 @@ class Monitor(QWidget):
|
||||
self.simultaneous.setVisible(len(shown) > 1)
|
||||
for machine in self.sections.keys() - set(self.dashboard.machines()):
|
||||
section = self.sections.pop(machine)
|
||||
self.drag.unwatch(section.title)
|
||||
for widget in section.drag_surfaces():
|
||||
self.drag.unwatch(widget)
|
||||
self.group_rows.removeWidget(section)
|
||||
section.deleteLater()
|
||||
if len(shown) < 2:
|
||||
@@ -398,7 +421,8 @@ class Monitor(QWidget):
|
||||
for index, machine in enumerate(shown):
|
||||
if machine not in self.sections:
|
||||
self.sections[machine] = section = MachineSection(self.expanded, self.refresh)
|
||||
self.drag.watch(section.title, lambda _point, machine=machine: machine)
|
||||
for widget in section.drag_surfaces():
|
||||
self.drag.watch(widget, lambda _point, machine=machine: machine)
|
||||
section = self.sections[machine]
|
||||
current = self.group_rows.indexOf(section)
|
||||
if current != index:
|
||||
@@ -453,6 +477,8 @@ class Monitor(QWidget):
|
||||
last = collectors.last.get(scope)
|
||||
last_text = f" · Last sample {strftime('%H:%M:%S', localtime(last))}" if self.expanded and last else ""
|
||||
text = f"{os_label} · {self.dashboard.state(scope)} · Sample {self.dashboard.interval(scope):g} s{last_text}"
|
||||
uptime = self.dashboard.observation(scope, "cpu", TOTAL, "system.uptime", time())
|
||||
text += f" · {describe_uptime(uptime)}"
|
||||
if status and status.detail:
|
||||
text += f" · {status.detail}"
|
||||
if self.expanded and not concise:
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
# Adaptive Resource Monitor
|
||||
# Original developer: Sonja M Thomas
|
||||
# Copyright 2010-2026 SLT Design Creations, LLC
|
||||
# Licensed under the Design Creations Attribution-NonCommercial-ShareAlike License v1.0.
|
||||
# See LICENSE.md for complete license terms.
|
||||
# https://www.designcreations.us/
|
||||
|
||||
"""Keep user-facing windows within the work area and remember their placement."""
|
||||
import logging
|
||||
|
||||
|
||||
Reference in New Issue
Block a user