3 Commits

19 changed files with 1811 additions and 210 deletions

View File

@@ -1,5 +1,11 @@
# Changelog
## v0.8.2.3_beta — 2026-11-26
- Drag machine headers to reorder sections in either monitor, or drag rows in Remote Targets. ARM saves the shared order as soon as a machine is dropped.
- Choose any set of machines with the checkbox menu. The hover monitor, expanded monitor and tray menu share the saved selection. Hidden machines continue collecting telemetry.
- Include Qt's LGPL and GPL license texts in Windows packages and omit the unused Qt Virtual Keyboard.
## v0.6.2.3_beta — 2026-11-26
- Show the installed version at the upper right of the hover monitor above its controls.

View File

@@ -1,5 +1,28 @@
# Adaptive Resource Monitor implementation report
## v0.8.2.3_beta — Machine ordering and display selection
Two Feature increments combine drag-and-drop machine ordering and checkbox
selection in one Beta. The machine order and selection use stable profile
identifiers and one immediately saved file in the ARM settings directory.
The file is flushed before atomic replacement. A Windows write-through move
commits the new file. It remains available if an earlier application version
rewrites its settings during rollback. The original single-machine or All
Systems preference supplies the initial selection and order.
The hover and expanded monitors and tray submenu share the same checkbox
selection. Remote Targets and both monitors share the same order. Sorting a
subset changes its visible slots and preserves the positions of hidden
machines. The save completes before a new selection or order is displayed.
Sorting and visibility changes leave telemetry providers, SSH sessions,
history and the primary tray source in place.
Package inspection found a Qt Virtual Keyboard plugin brought in by the
freezer and missing LGPL v3 and GPL v3 license texts. The build excludes the
optional plugin and includes the upstream notices and versioned sources for
the dynamically linked Qt and PySide runtime. The native package test checks
both notice files and the absence of the plugin.
## v0.6.2.3_beta — Hover monitor version and window placement
Production v0.6.2.2_beta was built from `5e8ea74be3fd94156bdc7a0810cfcc8eaac739f0`.
@@ -21,6 +44,48 @@ Qt's per-process scale factor on private Windows desktops. A native geometry
check confirmed exact positioning on reopening and recovery of an off-screen
About window on the current display.
Build and Archive #13 built commit
`31f0b430fbe05eafcbef87a7f6cf39c07aa9030e`. The native package checks
and Ed25519 verification passed. Publish Release #11 published the pinned
archive. All seven anonymous downloads matched the archive by size and
SHA-256. The signed manifest, exact version, x64 packages, Gitea tag, and
release notes were independently verified. The installed v0.6.2.2_beta
updater code found the release eligible without a verification error.
[Build #13](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Build-and-Archive/13/)
[Publication #11](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Publish-Release/11/)
[Public release](https://phantom.zapto.org/gitea/sonja/Adaptive_Resource_Monitor/releases/tag/v0.6.2.3_beta)
| Windows x64 package | Bytes | SHA-256 |
| --- | ---: | --- |
| Installer | 60,172,627 | `ef64b5a98194c35a4dac15b733dcf1206ad680dfb37a3e3963667da4a9a14c46` |
| Portable ZIP | 74,687,810 | `7e7cfe7bfd0752896da4216d2a1ed02539e636e01529b27541ada446a9a3dbe1` |
### Production acceptance
The installed updater reported the verified release and downloaded the
60,172,627-byte installer with the expected SHA-256. Transaction
`ec8569b9bdf0454aa9229283796e6d1a` captured independent preparation and
installation progress. ARM acknowledged shutdown, exited with code 0
before the installer log was created, and automatically restarted in the
same Windows user session and privilege level. The completion receipt and
success notification were saved. One ARM instance remained and the updater
exited. All 298 installed files matched the archived build.
Local Machine, Rain, Phantom, LAMP and PhantomNet resumed monitoring.
The production Explorer hover screenshot shows all five systems,
independent network IN and OUT graphs, and `v0.6.2.3_beta` at the upper
right. Settings and pinned SSH host keys matched their pre-upgrade hashes.
Saved credentials remained accessible and automatic checks remained off.
Persistent disk recording was already off. The shipped client verified
that the public release matched the installed version.
The signed packages remain under `release/v0.6.2.3_beta/`. Native
screenshots are under `evidence/v0.6.2.3_beta-native/`. The live screenshot,
installer log, process verification and completion receipt are retained
under `evidence/v0.6.2.3_beta-production/`. The independent anonymous
verification removed 134,862,477 bytes of temporary downloads. Jenkins
removed its staging and package-test data and cleaned both job workspaces.
## v0.6.2.2_beta — Beta promotion
Alpha production acceptance and the signed same-number compatibility

View File

@@ -19,12 +19,17 @@ machine for the primary icon. It defaults to Local Machine. Enable Separate
machine icons to also show icons for Local Machine and remote targets with
their tray option enabled.
Monitor Machine selects the history shown in the hover and expanded
monitors. All Systems shows six independent graphs for every enabled
machine. Changing the monitor selection leaves the tray icon source as
configured in Settings. Hover machine and history selections save as you
change them. Network IN and OUT have configurable colors and share one
throughput scale per machine.
Use the machine dropdown in either monitor or the tray's **Monitor Machine**
submenu to check the systems you want to display. The **All Systems** checkbox
selects or clears all enabled machines. With several machines selected, the
monitor shows separate graph sections in your saved order. Hidden machines
continue collecting telemetry. The primary tray icon keeps its configured
machine.
Drag machine headers in either monitor or rows in **Manage Remote Targets**
to change the shared order. Press Escape to cancel a drag. ARM saves each
drop and checkbox change immediately. Network IN and OUT have configurable
colors and share one throughput scale per machine.
Open the About tab from the monitor
window or tray menu for build information, version history and support links.

View File

@@ -1 +1 @@
v0.6.2.3_beta
v0.8.2.3_beta

View File

@@ -53,6 +53,7 @@ class Application(QObject):
archived = Signal(object, object)
history_error = Signal(str)
process_info = Signal(str)
display_changed = Signal()
def __init__(self, qt, root):
super().__init__()
@@ -78,7 +79,7 @@ class Application(QObject):
self.history_error.connect(self.report_history_error)
self.process_info.connect(self.accept_process_info)
self.collectors = Collectors(self.settings, self.credentials, self.hosts)
self.dashboard = Dashboard(self.collectors)
self.dashboard = Dashboard(self.collectors, self.store.load_display(self.settings))
self.collectors.changed.connect(self.sync_status)
self.icons = {}
self.menus = {}
@@ -90,17 +91,17 @@ class Application(QObject):
self.about_page.updates.changed.connect(self.sync_update_notice)
self.about_page.updates.quit_requested.connect(self.close_for_update)
self.expanded = Monitor(self.dashboard, True, self.request_archive, self.open_expanded,
self.set_pin, self.about_page)
self.set_pin, self.toggle_machine, self.reorder_machines, self.about_page)
self.expanded.setWindowIcon(self.brand_icon)
self.window_geometry = WindowGeometry(self.expanded, self.root / "monitor-window.bin")
self.popup = Monitor(self.dashboard, False, self.request_archive, self.open_expanded, self.set_pin)
self.popup = Monitor(self.dashboard, False, self.request_archive, self.open_expanded, self.set_pin,
self.toggle_machine, self.reorder_machines)
for view in (self.popup, self.expanded):
view.add_update_banner(self.open_update)
self.hover = HoverMonitor(self.popup, self.dashboard, self.icons)
for view in (self.popup, self.expanded):
view.machine.currentIndexChanged.connect(partial(self.monitor_selected, view))
self.popup.machine.checklist.aboutToHide.connect(lambda: QTimer.singleShot(0, self.hover.reposition))
self.popup.interval.currentIndexChanged.connect(
lambda _: self.remember_monitor(span=self.popup.span))
lambda _: self.remember_monitor(self.popup.span))
self.tray_timer = QTimer(self)
self.tray_timer.timeout.connect(self.render)
self.hover_timer = QTimer(self)
@@ -141,7 +142,7 @@ class Application(QObject):
self.sync_icons()
self.popup.sync()
self.expanded.sync()
self.restore_monitor()
self.hover.reposition()
self.render()
self.about_page.updates.configure(settings)
@@ -171,24 +172,31 @@ class Application(QObject):
settings = replace(settings, hover_machine="")
if settings.tray_machine not in machine_ids(settings):
settings = replace(settings, tray_machine=LOCAL)
previous = self.dashboard.machine_display
display = previous.with_targets(settings)
self.store.save(settings)
self.settings = settings
self.dashboard.machine_display = display
self.configure()
self.expanded.archive()
if display != previous:
try:
self.store.save_display(display)
except OSError as exc:
LOG.exception("Could not save machine display preferences after changing profiles")
QMessageBox.warning(self.expanded, "Machine display preferences", str(exc))
LOG.info("Settings updated")
def sync_status(self):
self.popup.sync()
self.expanded.sync()
self.hover.reposition()
self.sync_menus()
self.refresh_views()
self.sync_display()
def scopes(self):
cfg = self.settings
if not cfg.separate_tray_icons:
return [cfg.tray_machine]
return list(dict.fromkeys((cfg.tray_machine, LOCAL, *(t.identifier for t in cfg.targets if t.tray))))
separate = {LOCAL, *(target.identifier for target in cfg.targets if target.tray)}
return [cfg.tray_machine, *(machine for machine in self.dashboard.machines()
if machine != cfg.tray_machine and machine in separate)]
def sync_icons(self):
scopes = self.scopes()
@@ -216,48 +224,56 @@ class Application(QObject):
def sync_menus(self):
for menu in self.menus.values():
if not menu.isVisible():
menu.refresh()
menu.refresh()
def monitor_machine(self):
choices = monitor_choices(self.settings)
return next((choice for choice in (self.settings.hover_machine, self.settings.default_machine)
if choice in choices), LOCAL)
def restore_monitor(self):
machine = self.monitor_machine()
self.popup.set_machine(machine)
self.expanded.set_machine(machine)
with QSignalBlocker(self.popup.interval):
self.popup.interval.setCurrentIndex(self.popup.interval.findData(self.settings.hover_range))
def sync_display(self):
self.popup.sync_display()
self.expanded.sync_display()
self.hover.reposition()
self.sync_menus()
def monitor_selected(self, view, _index):
self.remember_monitor(machine=view.selected_machine)
def remember_monitor(self, machine=None, span=None):
changes = {}
if machine in monitor_choices(self.settings) and machine != self.settings.hover_machine:
changes["hover_machine"] = machine
if span is not None and span != self.settings.hover_range:
changes["hover_range"] = span
if not changes:
def remember_monitor(self, span):
if span == self.settings.hover_range:
return
updated = replace(self.settings, **changes)
updated = replace(self.settings, hover_range=span)
try:
self.store.save(updated)
except OSError as exc:
self.restore_monitor()
QMessageBox.warning(self.popup, "Monitor selection", str(exc))
with QSignalBlocker(self.popup.interval):
self.popup.interval.setCurrentIndex(self.popup.interval.findData(self.settings.hover_range))
QMessageBox.warning(self.popup, "History range", str(exc))
return
# Display preferences need no collector restart or archive reset.
self.settings = self.collectors.settings = updated
self.restore_monitor()
def select_machine(self, machine, scope):
self.remember_monitor(machine=machine)
self.hover.show(scope)
def save_display(self, display, parent):
if display == self.dashboard.machine_display:
self.sync_display()
return
try:
self.store.save_display(display)
except OSError as exc:
self.sync_display()
LOG.exception("Could not save machine display preferences")
QMessageBox.warning(parent, "Machine display preferences", str(exc))
return
self.dashboard.machine_display = display
self.sync_display()
self.display_changed.emit()
def toggle_machine(self, machine):
display = self.dashboard.machine_display
eligible = display.eligible(self.settings)
checked = set(display.selected)
if machine == ALL:
checked = checked - eligible if eligible <= checked else checked | eligible
elif machine in eligible:
checked.symmetric_difference_update({machine})
self.save_display(display.with_selection(self.settings, checked), self.qt.activeWindow() or self.popup)
def reorder_machines(self, shown, source, index, parent):
display = self.dashboard.machine_display
if source in shown:
self.save_display(display.move(self.settings, shown, source, index), parent)
def set_tray_display(self, mode):
if mode == self.settings.mode:
@@ -299,10 +315,7 @@ class Application(QObject):
if view.monitor_visible:
view.refresh()
def open_expanded(self, machine=None, history=False):
if machine not in monitor_choices(self.settings):
machine = self.monitor_machine()
self.expanded.set_machine(machine)
def open_expanded(self, history=False):
if history:
index = self.expanded.interval.findData(3600)
self.expanded.interval.setCurrentIndex(max(0, index))
@@ -310,12 +323,11 @@ class Application(QObject):
self.expanded.refresh()
self.expanded.archive()
def request_archive(self, scope, span, selection):
def request_archive(self, machines, span, selection):
if not self.storage:
return
kind, device = selection
machines = self.dashboard.monitored() if scope == ALL else [scope]
signature = (scope, span, selection, tuple(machines))
signature = (span, selection, tuple(sorted(machines)))
if signature == self.archive_signature:
return
self.archive_signature = signature

View File

@@ -4,6 +4,7 @@ import math
import os
from pathlib import Path
from dataclasses import asdict, dataclass, field, fields
from tempfile import NamedTemporaryFile
from uuid import uuid4
from .model import ALL, DISK_MODES, INTERVALS, LOCAL, NETWORK, RANGES, RESOURCES
@@ -193,6 +194,50 @@ def monitor_choices(settings):
return machine_ids(settings) | {ALL}
@dataclass(frozen=True, slots=True)
class MachineDisplay:
order: tuple[str, ...]
selected: tuple[str, ...]
select_new: bool = False
@staticmethod
def eligible(settings):
return {LOCAL, *(target.identifier for target in settings.targets if target.enabled)}
@classmethod
def from_legacy(cls, settings):
order = (LOCAL, *(target.identifier for target in settings.targets))
choice = next((item for item in (settings.hover_machine, settings.default_machine)
if item in monitor_choices(settings)), LOCAL)
return cls(order, order if choice == ALL else (choice,)).with_targets(settings)
def visible(self, settings):
eligible = self.eligible(settings)
return tuple(machine for machine in self.order if machine in eligible and machine in self.selected)
def with_targets(self, settings):
configured = (LOCAL, *(target.identifier for target in settings.targets))
prior = tuple(machine for machine in self.order if machine in configured)
added = tuple(machine for machine in configured if machine not in prior)
order = prior + added
checked = set(self.selected) | (set(added) if self.select_new else set())
return self.with_selection(settings, checked, order)
def with_selection(self, settings, checked, order=None):
order = self.order if order is None else order
return MachineDisplay(order, tuple(machine for machine in order if machine in checked),
self.eligible(settings).issubset(checked))
def move(self, settings, shown, source, index):
# Reorder only the visible slots. Hidden and disabled machines retain their positions.
moved = list(shown)
moved.remove(source)
moved.insert(index, source)
remaining = iter(moved)
order = tuple(next(remaining) if machine in shown else machine for machine in self.order)
return self.with_selection(settings, set(self.selected), order)
def valid_color(value, default):
if isinstance(value, str) and len(value) == 7 and value.startswith("#"):
if all(char in "0123456789abcdef" for char in value[1:].lower()):
@@ -203,6 +248,7 @@ def valid_color(value, default):
class ConfigStore:
def __init__(self, path):
self.path = Path(path)
self.display_path = self.path.with_name("machine-display.json")
def load(self):
if not self.path.is_file():
@@ -223,3 +269,52 @@ class ConfigStore:
temporary.replace(self.path)
finally:
temporary.unlink(missing_ok=True)
def load_display(self, settings):
try:
data = json.loads(self.display_path.read_text(encoding="utf-8"))
if isinstance(data, dict):
saved = MachineDisplay(tuple(strings(data.get("order"))),
tuple(strings(data.get("selected"))), data.get("select_new") is True)
return saved.with_targets(settings)
except FileNotFoundError:
pass
except (OSError, ValueError):
LOG.warning("Could not load machine display preferences", exc_info=True)
return MachineDisplay.from_legacy(settings)
def save_display(self, display):
# Earlier releases can still save settings.json after an update rollback.
# Keep these preferences in their own atomic file under the same settings root.
path = self.display_path
path.parent.mkdir(parents=True, exist_ok=True)
stream = NamedTemporaryFile(dir=path.parent, prefix=path.name + ".", suffix=".tmp", delete=False)
temporary = Path(stream.name)
try:
with stream:
stream.write((json.dumps(asdict(display), indent=2) + "\n").encode("utf-8"))
stream.flush()
os.fsync(stream.fileno())
replace_durable(temporary, path)
finally:
temporary.unlink(missing_ok=True)
def replace_durable(temporary, path):
if os.name == "nt":
import ctypes
from ctypes import wintypes
move = ctypes.WinDLL("kernel32", use_last_error=True).MoveFileExW
move.argtypes = (wintypes.LPCWSTR, wintypes.LPCWSTR, wintypes.DWORD)
move.restype = wintypes.BOOL
replace_existing, write_through = 0x1, 0x8
if not move(str(temporary), str(path), replace_existing | write_through):
raise ctypes.WinError(ctypes.get_last_error())
return
temporary.replace(path)
directory = os.open(path.parent, os.O_RDONLY)
try:
os.fsync(directory)
finally:
os.close(directory)

View File

@@ -1,7 +1,7 @@
from dataclasses import replace
from pathlib import Path
from PySide6.QtCore import Qt, QTimer
from PySide6.QtCore import QRect, QSignalBlocker, Qt, QTimer
from PySide6.QtGui import QColor
from PySide6.QtWidgets import (
QCheckBox, QColorDialog, QComboBox, QDialog, QDialogButtonBox, QDoubleSpinBox,
@@ -11,8 +11,9 @@ from PySide6.QtWidgets import (
)
from .config import TRAY_MODES
from .machine_controls import MachineDrag
from .model import DISK_MODES, LOCAL, NETWORK, RANGES, RESOURCES, Connection
from .views import fill, interval_choices, machine_choices, plain
from .views import fill, interval_choices, plain
from .window_geometry import WindowGeometry
@@ -161,7 +162,6 @@ class SettingsDialog(QDialog):
form.addRow("Start with Windows", self.startup)
self.check(form, "Start minimized", "minimized")
self.select(form, "Theme", "theme", [(value, value) for value in ("System", "Light", "Dark")])
self.select(form, "Default machine", "default_machine", machine_choices(self.app.dashboard))
self.check(form, "Check for updates at startup", "update_startup")
self.check(form, "Show Windows update notifications", "update_notifications")
self.select(form, "Check for updates periodically", "update_interval",
@@ -172,7 +172,7 @@ class SettingsDialog(QDialog):
form = self.section("Tray Icon")
self.select(form, "Visualization", "mode", [(v, v) for v in TRAY_MODES])
self.select(form, "Tray icon machine", "tray_machine",
[("Local Machine", LOCAL)] + [(t.name, t.identifier) for t in self.cfg.targets])
[(self.app.dashboard.name(machine), machine) for machine in self.app.dashboard.machines()])
self.check(form, "Separate machine icons", "separate_tray_icons")
self.select(form, "Refresh", "tray_refresh", interval_choices())
self.select(form, "History range", "tray_range", [(v, k) for k, v in RANGES.items() if k <= 3600])
@@ -377,6 +377,7 @@ class ConnectionsDialog(QDialog):
self.table.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.table.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
self.table.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.table.setVerticalScrollMode(QAbstractItemView.ScrollMode.ScrollPerPixel)
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
self.table.cellDoubleClicked.connect(lambda *_: self.edit())
self.info = plain()
@@ -397,8 +398,12 @@ class ConnectionsDialog(QDialog):
row.addStretch()
layout.addLayout(row)
self.test_results = {}
self.identifiers = ()
self.drag = MachineDrag(self.table, self.row_rects, self.reorder)
self.drag.watch(self.table.viewport(), self.machine_at)
self.table.itemSelectionChanged.connect(self.status_text)
app.collectors.changed.connect(self.sync)
app.display_changed.connect(self.sync)
app.collectors.test_finished.connect(self.test_finished)
self.sync()
self.window_geometry = WindowGeometry(self, app.root / "remote-targets-window.bin")
@@ -409,20 +414,37 @@ class ConnectionsDialog(QDialog):
identifier = item.data(Qt.ItemDataRole.UserRole) if item else None
return next((target for target in self.app.settings.targets if target.identifier == identifier), None)
def machine_at(self, point):
row = self.table.rowAt(point.y())
return self.identifiers[row] if 0 <= row < len(self.identifiers) else None
def row_rects(self):
return [(machine, QRect(0, self.table.rowViewportPosition(row), self.table.viewport().width(),
self.table.rowHeight(row))) for row, machine in enumerate(self.identifiers)]
def reorder(self, source, index):
self.app.reorder_machines(self.identifiers, source, index, self)
def sync(self):
prior = self.selected()
self.table.setRowCount(len(self.app.settings.targets))
for row, target in enumerate(self.app.settings.targets):
state = self.app.dashboard.state(target.identifier)
for column, value in enumerate((target.name, f"{target.host}:{target.port}", target.method, state.value)):
item = QTableWidgetItem(value)
if column == 0:
item.setData(Qt.ItemDataRole.UserRole, target.identifier)
self.table.setItem(row, column, item)
if prior and prior.identifier == target.identifier:
self.table.selectRow(row)
if self.table.currentRow() < 0 and self.table.rowCount():
self.table.selectRow(0)
targets = {target.identifier: target for target in self.app.settings.targets}
self.identifiers = tuple(machine for machine in self.app.dashboard.machines() if machine in targets)
with QSignalBlocker(self.table):
self.table.setRowCount(len(self.identifiers))
for row, machine in enumerate(self.identifiers):
target = targets[machine]
state = self.app.dashboard.state(machine)
for column, value in enumerate((target.name, f"{target.host}:{target.port}", target.method, state.value)):
item = self.table.item(row, column)
if item is None:
item = QTableWidgetItem()
self.table.setItem(row, column, item)
item.setText(value)
if column == 0:
item.setData(Qt.ItemDataRole.UserRole, machine)
if self.identifiers:
selected = prior.identifier if prior else None
self.table.selectRow(self.identifiers.index(selected) if selected in self.identifiers else 0)
self.status_text()
def status_text(self):

View File

@@ -5,6 +5,7 @@ from PySide6.QtCore import QPointF, QRectF, QSize, Qt
from PySide6.QtGui import QColor, QIcon, QPainter, QPainterPath, QPen, QPixmap
from PySide6.QtWidgets import QSizePolicy, QWidget
from .config import MachineDisplay
from .model import ALL, Connection, LOCAL, NETWORK, RESOURCES, TOTAL, current_reading, graph_scale, normalized
METRICS = {kind: d[2] for kind, d in RESOURCES.items()}
@@ -96,8 +97,9 @@ def stroke(painter, rect, points, now, span, gap, color, width=1.3):
class Dashboard:
def __init__(self, collectors):
def __init__(self, collectors, machine_display=None):
self.collectors = collectors
self.machine_display = machine_display or MachineDisplay.from_legacy(collectors.settings)
self.archived = {}
@property
@@ -112,10 +114,11 @@ class Dashboard:
return next((t.name for t in self.settings.targets if t.identifier == machine), "Unknown machine")
def machines(self):
return [LOCAL] + [target.identifier for target in self.settings.targets]
return self.machine_display.order
def monitored(self):
return [LOCAL] + [target.identifier for target in self.settings.targets if target.enabled]
eligible = MachineDisplay.eligible(self.settings)
return [machine for machine in self.machines() if machine in eligible]
def state(self, machine):
status = self.collectors.statuses.get(machine)

210
arm/machine_controls.py Normal file
View File

@@ -0,0 +1,210 @@
"""Machine checklists and drag controls shared by monitoring views."""
from PySide6.QtCore import QEvent, QObject, QPoint, QSignalBlocker, Qt, QTimer
from PySide6.QtWidgets import (
QApplication, QCheckBox, QFrame, QMenu, QPushButton, QScrollArea, QSizePolicy,
QVBoxLayout, QWidget, QWidgetAction,
)
from .model import ALL
class MachineCheckbox(QCheckBox):
def hitButton(self, point):
return self.rect().contains(point)
class MachineMenu(QMenu):
def __init__(self, dashboard, toggle, parent=None):
super().__init__(parent)
self.dashboard = dashboard
self.toggle = toggle
self.entries = {}
self.signature = None
self.master = self.checkbox("All Systems", ALL)
action = QWidgetAction(self)
action.setDefaultWidget(self.master)
self.addAction(action)
self.addSeparator()
self.scroll = QScrollArea()
self.scroll.setFrameShape(QFrame.Shape.NoFrame)
self.scroll.setWidgetResizable(True)
self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
rows = QWidget()
self.rows = QVBoxLayout(rows)
self.rows.setContentsMargins(0, 0, 0, 0)
self.rows.setSpacing(0)
self.scroll.setWidget(rows)
action = QWidgetAction(self)
action.setDefaultWidget(self.scroll)
self.addAction(action)
self.aboutToShow.connect(self.sync)
def checkbox(self, name, machine):
box = MachineCheckbox(name.replace("&", "&&"))
box.setStyleSheet("QCheckBox { padding: 4px 9px; }")
box.setAccessibleName(name)
box.clicked.connect(lambda: self.toggle(machine))
return box
def sync(self):
dashboard = self.dashboard
eligible = set(dashboard.monitored())
display = dashboard.machine_display
signature = [(machine, dashboard.name(machine)) for machine in dashboard.machines()]
if signature != self.signature:
for row in self.entries.values():
self.rows.removeWidget(row)
row.hide()
row.deleteLater()
self.entries = {machine: self.checkbox(name, machine) for machine, name in signature}
self.signature = signature
for box in self.entries.values():
self.rows.addWidget(box)
height = sum(box.sizeHint().height() for box in self.entries.values())
self.scroll.setFixedHeight(min(height, 280))
self.scroll.setMinimumWidth(max(box.sizeHint().width() for box in self.entries.values()) + 18)
selected = set(display.selected)
with QSignalBlocker(self.master):
self.master.setTristate(True)
self.master.setCheckState(
Qt.CheckState.Checked if eligible <= selected else
Qt.CheckState.PartiallyChecked if eligible & selected else Qt.CheckState.Unchecked)
for machine, box in self.entries.items():
box.setEnabled(machine in eligible)
box.setChecked(machine in selected)
class MachineDropdown(QPushButton):
def __init__(self, dashboard, toggle):
super().__init__()
self.dashboard = dashboard
self.setAccessibleName("Machine selection")
self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
self.setMinimumWidth(145)
self.setStyleSheet("""
QPushButton { text-align: left; padding: 3px 22px 3px 8px; min-height: 17px; }
QPushButton::menu-indicator { subcontrol-position: center right; right: 5px; }
""")
self.checklist = MachineMenu(dashboard, toggle, self)
self.setMenu(self.checklist)
def sync(self, displayed):
names = [self.dashboard.name(machine) for machine in displayed]
if not names:
label = "No Systems Selected"
elif len(names) == 1:
label = names[0]
elif len(names) == len(self.dashboard.monitored()):
label = "All Systems"
else:
label = f"{len(names)} Systems Selected"
metrics = self.fontMetrics()
label = metrics.elidedText(label, Qt.TextElideMode.ElideRight, 165)
self.setMinimumWidth(max(145, metrics.horizontalAdvance(label) + 34))
self.setText(label)
self.setToolTip("\n".join(names))
self.checklist.sync()
class MachineDrag(QObject):
def __init__(self, scroll, items, dropped):
super().__init__(scroll)
self.scroll, self.items, self.dropped = scroll, items, dropped
self.viewport = scroll.viewport()
self.line = QFrame(self.viewport)
self.line.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)
self.line.setStyleSheet("background-color: palette(highlight)")
self.line.hide()
self.widgets = {}
self.source = self.origin = self.position = self.index = None
self.active = False
self.timer = QTimer(self)
self.timer.setInterval(40)
self.timer.timeout.connect(self.autoscroll)
def watch(self, widget, machine_at):
self.widgets[widget] = machine_at
widget.installEventFilter(self)
widget.setCursor(Qt.CursorShape.OpenHandCursor)
def unwatch(self, widget):
if self.origin is widget:
self.cancel()
self.widgets.pop(widget, None)
widget.removeEventFilter(self)
def eventFilter(self, widget, event):
kind = event.type()
if kind == QEvent.Type.KeyPress and self.active and event.key() == Qt.Key.Key_Escape:
self.cancel()
return True
if widget is self.origin and kind in (QEvent.Type.Hide, QEvent.Type.UngrabMouse):
self.cancel()
if kind == QEvent.Type.MouseButtonPress and event.button() == Qt.MouseButton.LeftButton:
self.source = self.widgets[widget](event.position().toPoint())
self.origin = widget if self.source is not None else None
self.start = event.globalPosition().toPoint()
return widget is self.origin and widget is not self.viewport
if widget is not self.origin:
return False
if kind == QEvent.Type.MouseMove:
position = event.globalPosition().toPoint()
if (not self.active and event.buttons() & Qt.MouseButton.LeftButton
and (position - self.start).manhattanLength() >= QApplication.startDragDistance()):
self.active = True
widget.setCursor(Qt.CursorShape.ClosedHandCursor)
widget.grabMouse()
widget.grabKeyboard()
self.timer.start()
if self.active:
self.position = position
self.indicate()
return True
if kind == QEvent.Type.MouseButtonRelease and event.button() == Qt.MouseButton.LeftButton:
active = self.active
if active:
self.position = event.globalPosition().toPoint()
self.indicate()
source, index = self.source, self.index
self.cancel()
if active and index is not None:
self.dropped(source, index)
return active
return False
def indicate(self):
point = self.viewport.mapFromGlobal(self.position)
if not self.viewport.rect().contains(point):
self.index = None
self.line.hide()
return
rows = [(machine, rect) for machine, rect in self.items() if machine != self.source]
self.index = next((index for index, (_, rect) in enumerate(rows) if point.y() < rect.center().y()), len(rows))
if not rows:
return
edges = [rect.top() for _, rect in rows] + [rows[-1][1].bottom() + 1]
y = max(0, min(self.viewport.height() - 3, edges[self.index]))
self.line.setGeometry(3, y, max(1, self.viewport.width() - 6), 2)
self.line.raise_()
self.line.show()
def autoscroll(self):
point = self.viewport.mapFromGlobal(self.position)
threshold = min(40, self.viewport.height() // 4)
if 0 <= point.x() < self.viewport.width() and -threshold <= point.y() < self.viewport.height() + threshold:
direction = -1 if point.y() < threshold else 1 if point.y() >= self.viewport.height() - threshold else 0
if direction:
bar = self.scroll.verticalScrollBar()
bar.setValue(bar.value() + direction * max(4, bar.singleStep() // 2))
self.indicate()
def cancel(self):
widget, active = self.origin, self.active
self.source = self.origin = self.index = None
self.active = False
self.timer.stop()
self.line.hide()
if active:
widget.releaseKeyboard()
widget.releaseMouse()
widget.setCursor(Qt.CursorShape.OpenHandCursor)

View File

@@ -92,8 +92,7 @@ class HoverMonitor:
hovered = machine
break
over = self.popup.isVisible() and (self.popup.frameGeometry().contains(cursor)
or self.popup.interval.view().isVisible()
or self.popup.machine.view().isVisible())
or self.popup.interaction_active)
cfg = self.dashboard.settings
visible = self.popup.isVisible() and (self.anchor == hovered or hovered is None or over)
action = self.state.update(monotonic(), hovered, over, visible, self.popup.pinned,
@@ -126,10 +125,23 @@ class HoverMonitor:
self.reposition()
def reposition(self):
if self.location is not None:
if self.location is not None and not self.popup.drag.active:
screen, rect = self.location
position = place_popup(screen.availableGeometry(), rect, self.popup.popup_size())
area = screen.availableGeometry()
self.popup.layout().activate()
position = place_popup(area, rect, self.popup.popup_size())
menu = self.popup.machine.checklist
if menu.isVisible():
# Keep the menu anchored to the control during successive clicks.
before = self.popup.geometry()
position.moveTo(max(area.left(), min(before.x(), area.right() - position.width() + 1)),
max(area.top(), min(before.y(), area.bottom() - position.height() + 1)))
delta = position.topLeft() - self.popup.geometry().topLeft()
self.popup.setGeometry(position)
if menu.isVisible() and not delta.isNull():
point = menu.pos() + delta
menu.move(max(area.left(), min(point.x(), area.right() - menu.width() + 1)),
max(area.top(), min(point.y(), area.bottom() - menu.height() + 1)))
def pin(self, value, machine=None):
self.popup.pinned = value

View File

@@ -5,7 +5,7 @@ from PySide6.QtWidgets import QHBoxLayout, QLabel, QMenu, QStyle, QVBoxLayout, Q
from .about import BrandImage
from .config import TRAY_MODES
from .model import ALL, LOCAL
from .machine_controls import MachineMenu
from .version import NAME, VERSION
SP = QStyle.StandardPixmap
@@ -30,14 +30,10 @@ class TrayMenu(QMenu):
self.pin.setCheckable(True)
self.addSeparator()
machines = self.submenu("Monitor Machine", SP.SP_ComputerIcon)
self.machine_group = QActionGroup(self)
self.machine_group.setExclusive(True)
self.local = self.machine_action(machines, "Local Machine", LOCAL)
self.remote = machines.addMenu(self.standard_icon(SP.SP_DriveNetIcon), "Configured Remote Machines")
self.all = self.machine_action(machines, "All Systems", ALL)
self.remote_entries = {}
self.targets = None
self.machines = MachineMenu(app.dashboard, app.toggle_machine, self)
self.machines.setTitle("Monitor Machine")
self.machines.setIcon(self.standard_icon(SP.SP_ComputerIcon))
self.addMenu(self.machines)
display = self.submenu("Tray Display", SP.SP_FileDialogDetailedView)
mode_group = QActionGroup(self)
@@ -101,25 +97,9 @@ class TrayMenu(QMenu):
def submenu(self, title, icon):
return self.addMenu(self.standard_icon(icon), title)
def machine_action(self, menu, name, machine):
action = self.action(menu, name, None, lambda: self.app.select_machine(machine, self.scope))
action.setCheckable(True)
self.machine_group.addAction(action)
return action
def refresh(self):
app = self.app
targets = [(t.identifier, t.name, app.dashboard.state(t.identifier).value) for t in app.settings.targets]
if targets != self.targets:
self.targets = targets
self.remote.clear()
self.remote_entries = {
machine: self.machine_action(self.remote, f"{name.replace('&', '&&')} · {status}", machine)
for machine, name, status in targets
}
self.remote.menuAction().setVisible(bool(targets))
choices = {LOCAL: self.local, ALL: self.all, **self.remote_entries}
choices[app.monitor_machine()].setChecked(True)
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())

View File

@@ -1,6 +1,6 @@
from time import time, strftime, localtime
from PySide6.QtCore import QSize, Qt, QSignalBlocker, QTimer
from PySide6.QtCore import QPoint, QRect, QSize, Qt, QSignalBlocker, QTimer
from PySide6.QtGui import QColor, QPalette
from PySide6.QtWidgets import (
QAbstractItemView, QComboBox, QFrame, QGridLayout, QHeaderView, QHBoxLayout, QLabel,
@@ -8,7 +8,8 @@ from PySide6.QtWidgets import (
)
from .graphs import Plot, resource_series, selected_resource
from .model import ALL, LOCAL, NETWORK, TOTAL, Connection, INTERVALS, RANGES, RESOURCES, format_value
from .machine_controls import MachineDrag, MachineDropdown
from .model import NETWORK, TOTAL, Connection, INTERVALS, RANGES, RESOURCES, format_value
from .version import VERSION
from .window_geometry import fit_work_area
@@ -42,10 +43,6 @@ def fill(combo, values, selected=None):
combo.setCurrentIndex(max(index, 0))
def machine_choices(dashboard):
return [(dashboard.name(machine), machine) for machine in (*dashboard.machines(), ALL)]
def interval_choices():
return [(f"{value:g} s", value) for value in INTERVALS]
@@ -185,7 +182,8 @@ class UpdateBanner(QFrame):
class Monitor(QWidget):
def __init__(self, dashboard, expanded, request_archive, switch_expanded, set_pin, about_page=None):
def __init__(self, dashboard, expanded, request_archive, switch_expanded, set_pin, toggle_machine,
reorder_machines, about_page=None):
flags = Qt.WindowType.Window if expanded else (
Qt.WindowType.Tool | Qt.WindowType.FramelessWindowHint | Qt.WindowType.WindowStaysOnTopHint)
super().__init__(None, flags)
@@ -197,8 +195,7 @@ class Monitor(QWidget):
self.setAttribute(Qt.WidgetAttribute.WA_ShowWithoutActivating, True)
self.setObjectName("hoverMonitor")
self.pinned = False
self.machine = QComboBox()
self.machine.setAccessibleName("Machine")
self.machine = MachineDropdown(dashboard, toggle_machine)
self.interval = QComboBox()
self.interval.setAccessibleName("History range")
self.device = QComboBox()
@@ -207,7 +204,7 @@ class Monitor(QWidget):
self.header.setWordWrap(True)
top = QHBoxLayout()
for control in (self.machine, self.interval):
top.addWidget(control)
top.addWidget(control, 0 if expanded else 1)
if expanded:
top.addWidget(self.device, 1)
else:
@@ -216,9 +213,9 @@ class Monitor(QWidget):
pin.toggled.connect(set_pin)
self.pin = pin
details = QPushButton("Details")
details.clicked.connect(lambda: switch_expanded(self.machine.currentData()))
top.addWidget(pin)
top.addWidget(details)
details.clicked.connect(lambda: switch_expanded())
top.addWidget(pin, 1)
top.addWidget(details, 1)
self.cards = {kind: Card(kind, expanded) for kind in RESOURCES}
self.grid = QGridLayout()
self.grid.setSpacing(5)
@@ -245,6 +242,9 @@ class Monitor(QWidget):
self.version_label = version
layout.addLayout(top)
layout.addWidget(self.header)
self.empty = plain(QLabel("No systems selected for display."))
self.empty.setAlignment(Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft)
layout.addWidget(self.empty, 1)
self.single = QWidget()
single_layout = QVBoxLayout(self.single)
single_layout.setContentsMargins(0, 0, 0, 0)
@@ -261,13 +261,13 @@ class Monitor(QWidget):
self.simultaneous.setWidget(groups)
layout.addWidget(self.simultaneous, 1)
self.sections = {}
self.drag = MachineDrag(self.simultaneous, self.section_rects,
lambda source, index: reorder_machines(self.displayed, source, index, self))
if expanded:
self.table = measurements_table()
single_layout.addWidget(self.table, 2)
self.resize(900, 690)
self.machine.currentIndexChanged.connect(self.sync_devices)
self.device.currentIndexChanged.connect(self.selection_changed)
self.machine.currentIndexChanged.connect(self.selection_changed)
self.interval.currentIndexChanged.connect(self.selection_changed)
self.archive_due = QTimer(self)
self.archive_due.setSingleShot(True)
@@ -305,8 +305,12 @@ class Monitor(QWidget):
""")
@property
def selected_machine(self):
return self.machine.currentData() or LOCAL
def displayed(self):
return self.dashboard.machine_display.visible(self.dashboard.settings)
@property
def interaction_active(self):
return self.drag.active or self.machine.checklist.isVisible() or self.interval.view().isVisible()
@property
def selection(self):
@@ -321,11 +325,13 @@ class Monitor(QWidget):
extra = self.version_label.sizeHint().height() + self.layout().spacing()
extra += self.update_banner.sizeHint().height() + self.layout().spacing() if (
hasattr(self, "update_banner") and not self.update_banner.isHidden()) else 0
if self.selected_machine != ALL:
if not self.displayed:
return QSize(cfg.popup_width, 72 + extra)
if len(self.displayed) == 1:
return QSize(cfg.popup_width, cfg.popup_height + extra)
# Cap in HoverMonitor against the work area. The scroll area keeps
# six columns together even on a narrow monitor.
rows_height = sum(max(138, section.sizeHint().height()) for section in self.sections.values())
rows_height = sum(max(138, self.sections[machine].sizeHint().height()) for machine in self.displayed)
return QSize(max(cfg.popup_width, 875), max(cfg.popup_height, rows_height + 72) + extra)
def add_update_banner(self, open_update):
@@ -335,8 +341,11 @@ class Monitor(QWidget):
def sync_devices(self):
if not self.expanded:
return
machine = self.selected_machine
self.device.setVisible(machine != ALL)
shown = self.displayed
self.device.setVisible(len(shown) == 1)
if len(shown) != 1:
return
machine = shown[0]
devices = self.dashboard.collectors.devices.get(machine, {})
kinds = {"cpu": "CPU", "gpu": "GPU", "disk": "Disk", "net": "Network"}
values = [("Selected devices · aggregate", ("", TOTAL))] + [
@@ -349,12 +358,9 @@ class Monitor(QWidget):
def sync(self):
settings = self.dashboard.settings
fill(self.machine, machine_choices(self.dashboard),
self.machine.currentData() or settings.hover_machine or settings.default_machine)
ranges = [(label, span) for span, label in RANGES.items()
if span <= 3600 or (self.expanded and settings.persistent and span <= settings.retention_days * 86400)]
fill(self.interval, ranges, (self.interval.currentData() or 60) if self.expanded else settings.hover_range)
self.sync_devices()
columns = 2 if self.expanded else settings.popup_columns
kinds = tuple(self.cards) if self.expanded else tuple(
kind for kind in self.cards if kind in settings.hover_resources)
@@ -363,55 +369,70 @@ class Monitor(QWidget):
card.setVisible(resource in kinds)
for index, kind in enumerate(kinds):
self.grid.addWidget(self.cards[kind], index // columns, index % columns)
self.sync_sections()
self.sync_display()
def set_machine(self, machine):
index = self.machine.findData(machine)
if index >= 0:
with QSignalBlocker(self.machine):
self.machine.setCurrentIndex(index)
def sync_display(self):
self.machine.sync(self.displayed)
self.sync_devices()
self.sync_sections()
if self.monitor_visible:
self.selection_changed()
def sync_sections(self):
both = self.selected_machine == ALL
self.single.setVisible(not both)
self.simultaneous.setVisible(both)
if not both:
return
machines = self.dashboard.monitored()
for machine in self.sections.keys() - set(machines):
shown = self.displayed
self.empty.setVisible(not shown)
self.header.setVisible(bool(shown))
self.single.setVisible(len(shown) == 1)
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)
self.group_rows.removeWidget(section)
section.deleteLater()
if len(shown) < 2:
return
for machine in self.sections.keys() - set(shown):
section = self.sections[machine]
self.group_rows.removeWidget(section)
section.hide()
section.deleteLater()
for index, machine in enumerate(machines):
for index, machine in enumerate(shown):
if machine not in self.sections:
section = MachineSection(self.expanded, self.refresh)
self.sections[machine] = section
self.sections[machine] = section = MachineSection(self.expanded, self.refresh)
self.drag.watch(section.title, lambda _point, machine=machine: machine)
section = self.sections[machine]
current = self.group_rows.indexOf(section)
if current != index:
if current >= 0:
self.group_rows.removeWidget(section)
self.group_rows.insertWidget(index, section)
section.show()
def section_rects(self):
return [(machine, QRect(self.sections[machine].mapTo(self.simultaneous.viewport(), QPoint()),
self.sections[machine].size())) for machine in self.displayed]
def selection_changed(self):
self.sync_sections()
if self.monitor_visible:
self.refresh()
self.archive_due.start()
def archive(self):
if self.expanded and self.monitor_visible:
self.request_archive(self.selected_machine, self.span, self.selection)
if self.expanded and self.monitor_visible and self.displayed:
selected = self.selection if len(self.displayed) == 1 else ("", TOTAL)
self.request_archive(self.displayed, self.span, selected)
def refresh(self):
self.sync_devices()
now, span, scope = time(), self.span, self.selected_machine
shown = self.displayed
if not shown:
return
now, span = time(), self.span
cfg = self.dashboard.settings
archive = self.expanded and cfg.persistent
if scope == ALL:
self.sync_sections()
self.refresh_sections(now, span, archive)
if len(shown) > 1:
self.refresh_sections(shown, now, span, archive)
return
scope = shown[0]
text = self.scope_status(scope)
set_label(self.header, text + f" · Tray {cfg.tray_refresh:g} s")
device_kind, selected = self.selection
@@ -440,8 +461,7 @@ class Monitor(QWidget):
text += f" · {cpu_name}"
return text
def refresh_sections(self, now, span, archive):
machines = self.dashboard.monitored()
def refresh_sections(self, machines, now, span, archive):
online = sum(self.dashboard.state(machine) == Connection.ONLINE for machine in machines)
set_label(self.header, f"{online}/{len(machines)} connected · Individual machine histories")
for machine in machines:

View File

@@ -7,9 +7,17 @@ The NVIDIA display driver's NVML DLL
is provided by the driver. License text distributed by the dependency wheels
is included in this directory.
Qt is dynamically linked. The Qt DLLs and PySide bindings are separately
replaceable under the applicable Qt licenses. The exact tested versions and
rebuild instructions are in the ARM source repository. Qt source is available
from the [Qt source archive](https://download.qt.io/archive/qt/) and PySide
source from the [Qt for Python source archive](https://download.qt.io/official_releases/QtForPython/).
Python source is available from [python.org](https://www.python.org/downloads/source/).
The Qt and PySide 6.11.2 runtime is distributed under the GNU Lesser General
Public License v3. The accompanying LGPL v3 and GPL v3 texts are in the
Third-party notices directory. Qt is dynamically linked and the Qt DLLs
and PySide bindings can be replaced with compatible modified copies.
Users retain their rights under these licenses, including reverse
engineering to debug such modifications. ARM uses native Windows input.
The GPLv3 or commercial Qt Virtual Keyboard plugin is omitted.
Corresponding upstream sources and build instructions are available for
[Qt 6.11.2](https://download.qt.io/archive/qt/6.11/6.11.2/single/qt-everywhere-src-6.11.2.tar.xz)
and [PySide and Shiboken 6.11.2](https://github.com/pyside/pyside-setup/tree/v6.11.2).
The complete Qt license texts come from the
[Qt 6.11.2 source](https://code.qt.io/cgit/qt/qtbase.git/tree/LICENSES?h=v6.11.2).
CPython source is available from [python.org](https://www.python.org/downloads/source/).

View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -1,10 +1,12 @@
import json
from dataclasses import replace
import tempfile
from pathlib import Path
from types import SimpleNamespace
import unittest
from unittest.mock import patch
from arm.config import ConfigStore, Settings, Target, monitor_choices
from arm.config import ConfigStore, MachineDisplay, Settings, Target, monitor_choices
from arm.credentials import CredentialStore
from arm.graphs import Dashboard, composite_samples
from arm.model import (ALL, LOCAL, NETWORK, TOTAL, Availability, Connection, History, Status,
@@ -14,6 +16,69 @@ from arm.tray import HoverState, place_popup
from PySide6.QtCore import QRect, QSize
class MachineDisplayTests(unittest.TestCase):
def setUp(self):
self.cfg = Settings(hover_machine=ALL, tray_machine="c", targets=[
Target(identifier=identifier, name=identifier) for identifier in ("a", "b", "c", "d")
])
self.display = MachineDisplay.from_legacy(self.cfg)
def test_legacy_monitor_preferences(self):
self.assertEqual(self.display.visible(self.cfg), (LOCAL, "a", "b", "c", "d"))
self.assertTrue(self.display.select_new)
for setting in ({"hover_machine": "b"}, {"default_machine": "b", "hover_machine": ""}):
cfg = replace(self.cfg, **setting)
display = MachineDisplay.from_legacy(cfg)
self.assertEqual(display.visible(cfg), ("b",))
self.assertFalse(display.select_new)
self.assertEqual(self.display.with_selection(self.cfg, set()).visible(self.cfg), ())
def test_order_moves_in_both_directions_and_keeps_hidden_slots(self):
display = self.display.with_selection(self.cfg, {LOCAL, "b", "d"})
first = display.move(self.cfg, display.visible(self.cfg), "d", 0)
self.assertEqual(first.order, ("d", "a", LOCAL, "c", "b"))
self.assertEqual(first.visible(self.cfg), ("d", LOCAL, "b"))
up = first.move(self.cfg, first.visible(self.cfg), "b", 1)
self.assertEqual(up.order, ("d", "a", "b", "c", LOCAL))
last = up.move(self.cfg, up.visible(self.cfg), "d", 2)
self.assertEqual(last.order, ("b", "a", LOCAL, "c", "d"))
self.assertEqual(last.with_selection(self.cfg, set(last.order)).visible(self.cfg), last.order)
self.assertEqual(self.cfg.tray_machine, "c")
def test_profile_lifecycle_preserves_display_intent(self):
checked = self.display.with_selection(self.cfg, {"b", "d"})
changed = replace(self.cfg, targets=[
Target(identifier="b", name="Renamed", enabled=False), self.cfg.targets[3],
Target(identifier="new", name="New"),
])
self.assertEqual(checked.with_targets(changed).order, (LOCAL, "b", "d", "new"))
self.assertEqual(checked.with_targets(changed).selected, ("b", "d"))
self.assertEqual(checked.with_targets(changed).visible(changed), ("d",))
self.assertEqual(self.display.with_targets(changed).visible(changed), (LOCAL, "d", "new"))
enabled = replace(changed, targets=[replace(changed.targets[0], enabled=True), *changed.targets[1:]])
self.assertEqual(checked.with_targets(changed).with_targets(enabled).visible(enabled), ("b", "d"))
def test_atomic_commit_and_rollback_compatibility(self):
with tempfile.TemporaryDirectory(prefix="arm-display-test-") as temp:
store = ConfigStore(Path(temp) / "settings.json")
store.save(self.cfg)
order = ("d", "a", "b", LOCAL, "c")
saved = self.display.with_selection(self.cfg, {"b", "d"}, order)
store.save_display(saved)
initial = store.display_path.read_bytes()
fresh = ConfigStore(store.path)
self.assertEqual(fresh.load_display(fresh.load()), saved)
with patch("arm.config.replace_durable", side_effect=OSError("replacement failed")):
with self.assertRaisesRegex(OSError, "replacement failed"):
store.save_display(self.display)
self.assertEqual(store.display_path.read_bytes(), initial)
self.assertEqual(list(Path(temp).glob("*.tmp")), [])
# A rolled-back executable can rewrite its existing settings file.
store.save(replace(self.cfg, hover_machine=LOCAL, hover_range=300))
self.assertEqual(fresh.load_display(fresh.load()), saved)
self.assertEqual(fresh.load().hover_range, 300)
class ModelTests(unittest.TestCase):
def test_rate_baseline_reset_delayed_and_zero(self):
self.assertIsNone(rate(None, 33, 1, 1))

View File

@@ -257,6 +257,10 @@ def validate_packages(release, work, result, upgrade_from=None, captures=None, p
assert json.loads((payload / "BUILD.json").read_text())["version"] == VERSION
assert VERSION in (payload / "CHANGELOG.md").read_text(encoding="utf-8")
assert (payload / "Third-party notices" / "README.md").is_file()
for name in ("LGPL-3.0-only.txt", "GPL-3.0-only.txt"):
assert (payload / "Third-party notices" / name).read_bytes() == (
ROOT / "packaging" / "qt-notices" / name).read_bytes()
assert not list((payload / "_internal").rglob("*[Vv]irtual[Kk]eyboard*"))
for name in BUNDLED_ASSETS:
assert (payload / "_internal" / "branding" / name).read_bytes() == asset(name).read_bytes()
verify_executable(setup, VERSION)
@@ -362,8 +366,8 @@ def verify_branding(session, results, captures=None):
results["transparent_ico_frames"] = list(ICON_SIZES)
menu = session.menus[LOCAL]
assert menu.version.text() == VERSION and menu.local.isChecked()
assert not menu.remote.menuAction().isVisible()
assert menu.version.text() == VERSION and menu.machines.entries[LOCAL].isChecked()
assert tuple(menu.machines.entries) == (LOCAL,)
actions = {action.text(): action for action in menu.actions()}
assert "Check for Updates" in actions
actions[f"About {NAME}"].trigger()
@@ -419,15 +423,23 @@ def verify_branding(session, results, captures=None):
menu.hide()
actions["Resource History"].trigger()
assert session.expanded.monitor_visible and session.expanded.span == 3600
menu.all.trigger()
assert session.popup.selected_machine == ALL and menu.all.isChecked()
menu.local.trigger()
assert session.popup.selected_machine == LOCAL
menu.machines.master.click()
assert session.popup.displayed == () and not menu.machines.master.isChecked()
menu.machines.entries[LOCAL].click()
assert session.popup.displayed == (LOCAL,)
session.popup.hide()
session.expanded.close()
results["verified_about_and_tray_actions"] = True
def choose_display(session, machine):
from arm.model import ALL
display = session.dashboard.machine_display
checked = set(display.order) if machine == ALL else {machine}
session.save_display(display.with_selection(session.settings, checked), session.popup)
def verify_update_notices(session, wait_for, results, captures):
from PySide6.QtCore import QPoint
from unittest.mock import patch
@@ -471,11 +483,11 @@ def verify_update_notices(session, wait_for, results, captures):
assert hover.popup_size().height() > initial_size.height()
assert hover.update_banner.label.text() == available
capture(hover, "update-hover.png")
session.select_machine(ALL, LOCAL)
choose_display(session, ALL)
session.hover.pin(True, LOCAL)
assert hover.update_banner.isVisible() and hover.selected_machine == ALL
assert hover.update_banner.isVisible() and hover.displayed == tuple(session.dashboard.monitored())
session.hover.pin(False)
session.select_machine(LOCAL, LOCAL)
choose_display(session, LOCAL)
hover.hide()
session.open_expanded()
assert expanded.update_banner.isVisible() and expanded.monitor_visible
@@ -516,6 +528,7 @@ def verify_hover_version(session, remote, results, captures):
from arm.version import VERSION
original = session.settings
display = session.dashboard.machine_display
hover = session.popup
scale = round(hover.devicePixelRatioF() * 100)
modes = (
@@ -529,13 +542,15 @@ def verify_hover_version(session, remote, results, captures):
session.apply(replace(original, theme=theme))
for name, selection, anchor, pinned in modes:
session.hover.pin(False)
session.select_machine(selection, anchor)
choose_display(session, selection)
session.hover.show(anchor)
session.hover.pin(pinned, anchor)
session.qt.processEvents()
label = hover.version_label
rect = label.geometry()
assert hover.isVisible() and hover.pinned == pinned
assert hover.selected_machine == selection and session.hover.anchor == anchor
expected = tuple(session.dashboard.monitored()) if selection == ALL else (selection,)
assert hover.displayed == expected and session.hover.anchor == anchor
assert label.isVisible() and label.text() == VERSION
assert rect.bottom() < hover.machine.geometry().top()
assert rect.right() == hover.width() - hover.layout().contentsMargins().right() - 1
@@ -547,10 +562,179 @@ def verify_hover_version(session, remote, results, captures):
session.hover.pin(False)
hover.hide()
session.apply(original)
session.save_display(display, hover)
results["hover_version"] = {"version": VERSION, "scale_percent": scale,
"themes": ["Light", "Dark"], "views": [row[0] for row in modes]}
def verify_machine_display(session, wait_for, results, captures):
from PySide6.QtCore import QEvent, QPoint, QPointF, Qt
from PySide6.QtGui import QKeyEvent, QMouseEvent
from PySide6.QtTest import QTest
from arm.dialogs import ConnectionsDialog
from arm.model import ALL, LOCAL, TOTAL, Connection
from unittest.mock import patch
app, hover, expanded = session.qt, session.popup, session.expanded
local, rain, phantom, lamp, phantomnet = session.dashboard.machines()
tray = session.menus[session.scopes()[0]].machines
menu = hover.machine.checklist
history = session.collectors.history
workers = dict(session.collectors.workers)
left, released = Qt.MouseButton.LeftButton, Qt.MouseButton.NoButton
def capture(widget, filename):
app.processEvents()
if captures:
QTest.qWait(100)
capture_native_window(int(widget.winId()), captures / filename)
def pointer(widget, kind, point):
button = released if kind == QEvent.Type.MouseMove else left
buttons = released if kind == QEvent.Type.MouseButtonRelease else left
event = QMouseEvent(kind, QPointF(widget.mapFromGlobal(point)), QPointF(point), button, buttons,
Qt.KeyboardModifier.NoModifier)
app.sendEvent(widget, event)
app.processEvents()
def drag_to(drag, widget, start, end, cancel=False, scroll_to_end=False):
pointer(widget, QEvent.Type.MouseButtonPress, start)
pointer(widget, QEvent.Type.MouseMove, end)
assert drag.active and drag.line.isVisible()
if scroll_to_end:
bar = drag.scroll.verticalScrollBar()
wait_for(lambda: bar.value() == bar.maximum())
if cancel:
app.sendEvent(widget, QKeyEvent(QEvent.Type.KeyPress, Qt.Key.Key_Escape, Qt.KeyboardModifier.NoModifier))
pointer(widget, QEvent.Type.MouseButtonRelease, end)
assert not drag.active and not drag.line.isVisible()
def persisted():
return session.store.load_display(session.store.load())
choose_display(session, ALL)
session.hover.show(local)
menu.popup(hover.machine.mapToGlobal(hover.machine.rect().bottomLeft()))
app.processEvents()
assert menu.isVisible() and hover.interaction_active
assert menu.master.checkState() == Qt.CheckState.Checked
combos = (
("none", set(), "No Systems Selected"),
("rain", {rain}, "Rain"),
("rain-phantom", {rain, phantom}, "2 Systems Selected"),
("lamp-phantomnet", {lamp, phantomnet}, "2 Systems Selected"),
("local-rain-phantomnet", {local, rain, phantomnet}, "3 Systems Selected"),
("all", {local, rain, phantom, lamp, phantomnet}, "All Systems"),
)
for name, wanted, label in combos:
before = set(hover.displayed)
if name in ("none", "all"):
QTest.mouseClick(menu.master, left)
assert menu.isVisible() and hover.isVisible(), (name, menu.isVisible(), hover.isVisible())
else:
for machine in sorted(before ^ wanted):
QTest.mouseClick(menu.entries[machine], left)
assert menu.isVisible() and hover.isVisible(), (name, menu.isVisible(), hover.isVisible())
assert persisted().visible(session.settings) == hover.displayed == expanded.displayed
checked = Qt.CheckState.Unchecked if not wanted else (
Qt.CheckState.Checked if len(wanted) == 5 else Qt.CheckState.PartiallyChecked)
assert set(hover.displayed) == wanted and menu.master.checkState() == tray.master.checkState() == checked
assert hover.empty.isVisible() == (not wanted)
assert hover.single.isVisible() == (len(wanted) == 1)
assert hover.simultaneous.isVisible() == (len(wanted) > 1)
assert hover.machine.text() == label
assert hover.machine.width() >= hover.machine.fontMetrics().horizontalAdvance(label) + 24
if name == "rain":
observed = history.latest(phantom, TOTAL, "ram.util")
assert observed is not None
wait_for(lambda: history.latest(phantom, TOTAL, "ram.util").timestamp > observed.timestamp)
if name == "rain-phantom":
assert history.since(phantom, TOTAL, "ram.util", 0)[-2].timestamp <= observed.timestamp
assert any(value is not None for _, value in hover.sections[phantom].cards["ram"].plot.data[0][0][0])
capture(menu, "machine-checkbox-dropdown.png")
capture(hover, f"machine-selection-{name}.png")
app.sendEvent(menu, QKeyEvent(QEvent.Type.KeyPress, Qt.Key.Key_Escape, Qt.KeyboardModifier.NoModifier))
assert not menu.isVisible()
menu.popup(hover.machine.mapToGlobal(hover.machine.rect().bottomLeft()))
app.processEvents()
pointer(menu, QEvent.Type.MouseButtonPress, menu.mapToGlobal(QPoint(-25, -25)))
assert not menu.isVisible()
app.processEvents()
viewport = hover.simultaneous.viewport()
local_header = hover.sections[local].title
section_objects = dict(hover.sections)
viewport_origin = lambda: viewport.mapToGlobal(QPoint(viewport.width() // 2, 3))
point = lambda w: w.mapToGlobal(w.rect().center())
bottom = viewport.mapToGlobal(QPoint(viewport.width() // 2, viewport.height() - 3))
before = persisted()
drag_to(hover.drag, local_header, point(local_header), bottom, cancel=True)
assert persisted() == before
drag_to(hover.drag, local_header, point(local_header), bottom, scroll_to_end=True)
assert hover.displayed == (rain, phantom, lamp, phantomnet, local)
assert persisted().order == hover.displayed and hover.sections == section_objects
assert tuple(tray.entries) == hover.displayed
session.set_pin(True)
first_header = hover.sections[rain].title
last_header = hover.sections[local].title
drag_to(hover.drag, last_header, point(last_header), viewport_origin())
assert hover.displayed.index(local) < 4 and hover.pinned
hover.simultaneous.ensureWidgetVisible(first_header, 0, 0)
app.processEvents()
session.set_pin(False)
session.open_expanded()
view = expanded.simultaneous.viewport()
start = expanded.displayed[1]
top = view.mapToGlobal(QPoint(view.width() // 2, 3))
drag_to(expanded.drag, expanded.sections[start].title, point(expanded.sections[start].title), top)
assert expanded.displayed[0] == start and expanded.displayed == hover.displayed
capture(expanded, "machine-order-expanded.png")
manager = ConnectionsDialog(session)
manager.show()
app.processEvents()
try:
remote, first = manager.identifiers[-1], manager.identifiers[0]
rows = dict(manager.row_rects())
viewport = manager.table.viewport()
local_slot = hover.displayed.index(local)
drag_to(manager.drag, viewport, viewport.mapToGlobal(rows[remote].center()),
viewport.mapToGlobal(rows[first].topLeft() + QPoint(15, 1)))
assert manager.identifiers[0] == remote and hover.displayed.index(local) == local_slot
assert manager.identifiers == tuple(machine for machine in hover.displayed if machine != local)
capture(manager, "machine-order-remote-targets.png")
finally:
manager.close()
manager.deleteLater()
tray.entries[phantom].click()
assert phantom not in hover.displayed and phantom not in expanded.displayed
assert menu.entries[phantom].checkState() == Qt.CheckState.Unchecked
tray.entries[phantom].click()
assert persisted().visible(session.settings) == hover.displayed
assert session.collectors.history is history and session.collectors.workers == workers
assert all(session.dashboard.state(machine) == Connection.ONLINE for machine in hover.displayed)
before = persisted()
with patch.object(session.store, "save_display", side_effect=OSError("Fixture write failed")), \
patch("arm.application.QMessageBox.warning") as shown, patch("arm.application.LOG.exception"):
tray.entries[phantom].click()
shown.assert_called_once()
assert tray.entries[phantom].isChecked() and persisted() == before
expanded.close()
hover.hide()
session.hover.show(local)
assert hover.displayed == before.visible(session.settings)
hover.simultaneous.verticalScrollBar().setValue(0)
capture(hover, "machine-order-hover.png")
hover.hide()
results["machine_display"] = {
"checkbox_combinations": [name for name, _, _ in combos],
"shared_drag_interfaces": ["hover", "expanded", "Remote Targets"],
"final_order": [session.dashboard.name(machine) for machine in before.order],
"saved_before_close": True, "cancelled_drag_and_failed_write_retained_order": True,
"unchanged_collectors_and_hidden_history": True,
}
def evaluate_app(work, results, short=False, captures=None):
import psutil
from PySide6.QtCore import QEventLoop, QTimer
@@ -681,7 +865,7 @@ def evaluate_app(work, results, short=False, captures=None):
session.popup.pin.click()
assert not session.popup.pinned
session.popup.hide()
session.open_expanded(LOCAL)
session.open_expanded()
assert session.expanded.isVisible() and session.expanded.table.rowCount() > 20
assert session.expanded.device.count() > 10
assert app.primaryScreen().availableGeometry().contains(session.popup.frameGeometry())
@@ -714,11 +898,11 @@ def evaluate_app(work, results, short=False, captures=None):
raise AssertionError(f"SSH fixture {i}: {server.connections} TCP sessions, "
f"{len(server.commands)} commands, {server.samples} frames, "
f"{session.dashboard.state(target.identifier)}") from exc
assert "Connected" in menu.remote_entries[target.identifier].text()
menu.remote_entries[target.identifier].trigger()
assert session.popup.selected_machine == target.identifier
choose_display(session, target.identifier)
assert menu.machines.entries[target.identifier].isChecked()
assert session.popup.displayed == (target.identifier,)
assert session.scopes() == [LOCAL]
menu.local.trigger()
choose_display(session, LOCAL)
session.popup.hide()
if i == 1 and not short:
measure("one_loopback_ssh")
@@ -732,20 +916,21 @@ def evaluate_app(work, results, short=False, captures=None):
tray_machine.setCurrentIndex(tray_machine.findData(primary))
prefs.save()
prefs.deleteLater()
assert session.scopes() == [primary] and session.popup.selected_machine == LOCAL
assert session.scopes() == [primary] and session.popup.displayed == (LOCAL,)
menu = session.menus[primary]
for select, expected in ((menu.all, ALL), (menu.remote_entries[other], other), (menu.local, LOCAL)):
select.trigger()
for choice in (ALL, other, LOCAL):
choose_display(session, choice)
expected = tuple(session.dashboard.monitored()) if choice == ALL else (choice,)
with patch("arm.application.tray_icon", wraps=tray_icon) as draw:
session.render()
assert [call.args[1] for call in draw.call_args_list] == [primary]
assert session.popup.selected_machine == session.expanded.selected_machine == expected
assert select.isChecked()
if expected == ALL:
assert session.popup.displayed == session.expanded.displayed == expected
assert all(menu.machines.entries[machine].isChecked() for machine in expected)
if choice == ALL:
for view in (session.popup, session.expanded):
assert set(view.sections) == {LOCAL, primary, other}
assert all(set(section.cards) == set(RESOURCES) for section in view.sections.values())
menu.all.trigger()
menu.machines.master.click()
history = session.collectors.history
wait_for(lambda: all(
(reading := history.latest(machine, TOTAL, direction)) and reading.valid and reading.value > 0
@@ -762,12 +947,13 @@ def evaluate_app(work, results, short=False, captures=None):
session.popup.interval.setCurrentIndex(session.popup.interval.findData(300))
session.popup.hide()
menu.defaultAction().trigger()
assert session.expanded.selected_machine == ALL
assert session.expanded.displayed == tuple(session.dashboard.monitored())
session.expanded.close()
session.hover.show(primary)
assert session.popup.selected_machine == ALL and session.popup.span == 300
assert session.popup.displayed == tuple(session.dashboard.monitored()) and session.popup.span == 300
assert session.store.load_display(session.settings).select_new
saved = ConfigStore(root / "settings.json").load()
assert (saved.hover_machine, saved.hover_range, saved.tray_machine) == (ALL, 300, primary)
assert (saved.hover_range, saved.tray_machine) == (300, primary)
session.popup.hide()
session.apply(replace(session.settings, separate_tray_icons=True, persistent=True))
assert set(session.icons) == {LOCAL, *(target.identifier for target in targets)}
@@ -778,17 +964,32 @@ def evaluate_app(work, results, short=False, captures=None):
assert draw.call_count == 3
results["independent_tray_and_monitor"] = "Local plus two SSH targets, six graphs each, three independent icon sources"
results["loopback_frame_counts"] = [server.samples for server in servers]
for target, name in zip(targets, ("Rain", "Phantom")):
session.save_target(replace(target, name=name), "", False)
for name in ("LAMP", "PhantomNet"):
server = stack.enter_context(Fixture())
target = Target(name=name, host="127.0.0.1", port=server.port, username="tester", interval=1)
update_host_key(session.hosts, f"[127.0.0.1]:{server.port}", server.key)
session.save_target(target, SECRET, False)
targets.append(target)
wait_for(lambda: all(session.dashboard.state(machine) == Connection.ONLINE and
session.collectors.history.latest(machine, TOTAL, "ram.util")
for machine in session.dashboard.monitored()), 15)
verify_machine_display(session, wait_for, results, captures)
for target in targets[2:]:
session.remove_target(next(t for t in session.settings.targets if t.identifier == target.identifier))
targets = targets[:2]
for target in targets:
session.collectors.disconnect(target.identifier)
assert all(session.dashboard.state(t.identifier) == Connection.OFFLINE for t in targets)
assert session.popup.selected_machine == ALL
assert session.popup.displayed == tuple(session.dashboard.monitored())
session.apply(replace(session.settings, separate_tray_icons=False, persistent=False))
if not short:
measure("disconnected_remotes")
assert set(session.icons) == {primary}
for target in list(session.settings.targets):
session.remove_target(target)
assert set(session.icons) == {LOCAL} and session.popup.selected_machine == ALL
assert set(session.icons) == {LOCAL} and session.popup.displayed == (LOCAL,)
exit_action = next(action for action in next(iter(session.menus.values())).actions()
if action.text().startswith("Exit Adaptive Resource Monitor"))
QTimer.singleShot(0, exit_action.trigger)
@@ -803,7 +1004,7 @@ def evaluate_app(work, results, short=False, captures=None):
restart_root = work / "restart"
store = ConfigStore(restart_root / "settings.json")
stored_targets = [replace(target, enabled=False, credential="test-reference") for target in saved.targets]
store.save(replace(saved, targets=stored_targets))
store.save(replace(saved, targets=stored_targets, hover_machine=ALL))
for legacy in (False, True):
if legacy:
source = json.loads(store.path.read_text(encoding="utf-8"))
@@ -821,7 +1022,8 @@ def evaluate_app(work, results, short=False, captures=None):
reopened = Application(app, restart_root)
try:
assert reopened.scopes() == [primary]
assert reopened.popup.selected_machine == reopened.expanded.selected_machine == ALL
assert reopened.popup.displayed == reopened.expanded.displayed == (LOCAL,)
assert reopened.dashboard.machine_display.selected == (LOCAL, primary, other)
assert reopened.popup.span == 300 and not reopened.popup.pinned
assert reopened.settings.targets == stored_targets
panel = reopened.about_page.updates
@@ -833,6 +1035,54 @@ def evaluate_app(work, results, short=False, captures=None):
app.processEvents()
results["restored_monitor_and_tray"] = "New and legacy settings restored All Systems at five minutes with a separate tray source"
results["startup_update_and_periodic_timer"] = True
verify_abrupt_display_restart(work, results)
def verify_abrupt_display_restart(work, results):
from arm.config import ConfigStore, Settings, Target
from arm.model import ALL
root = work / "abrupt-display"
ConfigStore(root / "settings.json").save(Settings(
hover_machine=ALL, targets=[Target(identifier="qa-remote", name="QA profile", os_type="Windows")]
))
argv = [sys.executable, str(Path(__file__).resolve()), "--desktop", results["desktop"], "--work", str(root)]
with subprocess.Popen([*argv, "--abrupt-display", "write"], creationflags=subprocess.CREATE_NO_WINDOW) as instance:
try:
deadline = monotonic() + 20
while not (root / "saved").is_file():
assert instance.poll() is None and monotonic() < deadline, "Isolated display test did not save"
sleep(.05)
finally:
instance.kill()
instance.wait(8)
assert instance.returncode != 0
result = subprocess.run([*argv, "--abrupt-display", "inspect"], timeout=30, creationflags=subprocess.CREATE_NO_WINDOW)
assert result.returncode == 0, f"Isolated restart failed with exit {result.returncode}"
results["forced_termination_restored_display"] = True
def abrupt_display_child(args):
from PySide6.QtWidgets import QApplication
from arm.application import Application
from arm.model import LOCAL
verify_desktop(args.desktop)
app = QApplication([])
assert app.platformName() == "windows"
session = Application(app, args.work)
if args.abrupt_display == "write":
session.reorder_machines(session.popup.displayed, LOCAL, 1, session.popup)
session.popup.machine.checklist.entries[LOCAL].click()
assert session.popup.displayed == ("qa-remote",)
(args.work / "saved").touch()
app.exec()
raise RuntimeError("The isolated process was expected to be terminated")
try:
assert session.dashboard.machines() == ("qa-remote", LOCAL)
assert session.popup.displayed == session.expanded.displayed == ("qa-remote",)
finally:
session.close()
def child(args):
@@ -893,7 +1143,11 @@ if __name__ == "__main__":
parser.add_argument("--upgrade-from", type=Path)
parser.add_argument("--captures", type=Path)
parser.add_argument("--short", action="store_true")
parser.add_argument("--abrupt-display", choices=("write", "inspect"))
args = parser.parse_args()
if args.abrupt_display:
abrupt_display_child(args)
raise SystemExit(0)
if args.desktop:
raise SystemExit(child(args))
raise SystemExit(parent(args))

View File

@@ -12,7 +12,7 @@ from types import SimpleNamespace
from unittest.mock import patch
from uuid import uuid4
from windows_gui import start_isolated, verify_desktop
from windows_gui import choose_display, start_isolated, verify_desktop
def evaluate(root, captures, restart, result):
@@ -50,9 +50,7 @@ def evaluate(root, captures, restart, result):
raise AssertionError(f"Readings not ready: {state}")
def choose(value):
index = session.popup.machine.findData(value)
assert index >= 0
session.popup.machine.setCurrentIndex(index)
choose_display(session, value)
def measure(name, seconds=12):
before, start = proc.cpu_times(), monotonic()
@@ -75,9 +73,9 @@ def evaluate(root, captures, restart, result):
machines = session.dashboard.monitored()
assert len(machines) == 4
if restart:
assert session.settings.hover_machine == ALL and session.settings.hover_range == 300
assert session.dashboard.machine_display.select_new and session.settings.hover_range == 300
session.hover.show(primary)
assert session.popup.selected_machine == ALL and session.popup.span == 300
assert session.popup.displayed == tuple(machines) and session.popup.span == 300
assert not session.popup.pinned
wait(30, lambda: all(session.dashboard.state(m) == Connection.ONLINE for m in machines))
history = session.collectors.history
@@ -110,8 +108,8 @@ def evaluate(root, captures, restart, result):
menu = session.menus[primary]
icon_count = len(session.icons)
menu.all.trigger()
assert menu.all.isChecked() and len(session.icons) == icon_count
menu.machines.master.click()
assert menu.machines.master.isChecked() and len(session.icons) == icon_count
with patch("arm.application.tray_icon", wraps=tray_icon) as draw:
session.render()
assert {call.args[1] for call in draw.call_args_list} == set(session.icons)
@@ -137,7 +135,7 @@ def evaluate(root, captures, restart, result):
session.popup.hide()
session.open_expanded()
assert session.expanded.selected_machine == ALL and set(session.expanded.sections) == set(machines)
assert session.expanded.displayed == tuple(machines) and set(session.expanded.sections) == set(machines)
capture(session.expanded, "04-all-systems-expanded")
assert session.expanded.simultaneous.horizontalScrollBar().maximum() == 0
assert session.expanded.simultaneous.verticalScrollBar().maximum() == 0
@@ -149,7 +147,7 @@ def evaluate(root, captures, restart, result):
measure("All Systems expanded, four connected machines")
session.expanded.showMinimized()
session.expanded.showNormal()
assert session.expanded.selected_machine == ALL
assert session.expanded.displayed == tuple(machines)
session.expanded.close()
session.hover.show(primary)
@@ -181,11 +179,11 @@ def evaluate(root, captures, restart, result):
chosen = machines[1]
choose(chosen)
session.collectors.disconnect(chosen)
assert session.popup.selected_machine == chosen and "Disconnected" in session.popup.header.text()
assert ConfigStore(root / "settings.json").load().hover_machine == chosen
assert session.popup.displayed == (chosen,) and "Disconnected" in session.popup.header.text()
assert session.store.load_display(session.settings).selected == (chosen,)
session.collectors.reconnect(chosen)
wait(25, lambda: session.dashboard.state(chosen) == Connection.ONLINE)
assert session.popup.selected_machine == chosen
assert session.popup.displayed == (chosen,)
choose(ALL)
session.popup.interval.setCurrentIndex(session.popup.interval.findData(300))
session.set_pin(True)
@@ -201,10 +199,10 @@ def evaluate(root, captures, restart, result):
session.hover.tick()
assert session.popup.isHidden()
session.hover.show(primary)
assert session.popup.selected_machine == ALL and session.popup.span == 300
assert session.expanded.selected_machine == ALL
assert session.popup.displayed == tuple(machines) and session.popup.span == 300
assert session.expanded.displayed == tuple(machines)
saved = ConfigStore(root / "settings.json").load()
assert saved.hover_machine == ALL and saved.hover_range == 300
assert session.store.load_display(saved).select_new and saved.hover_range == 300
result["retained_dismissal_pin_disconnect"] = True
finally:
session.close()

View File

@@ -53,6 +53,8 @@ def run(args):
def copy_notices(payload):
notices = payload / "Third-party notices"
notices.mkdir()
for name in ("LGPL-3.0-only.txt", "GPL-3.0-only.txt"):
shutil.copyfile(ROOT / "packaging" / "qt-notices" / name, notices / name)
for package in ("PySide6", "PySide6-Essentials", "PySide6-Addons", "shiboken6", "psutil",
"paramiko", "cryptography", "cffi", "bcrypt", "PyNaCl", "PyInstaller",
"setuptools", "nvidia-ml-py", "invoke", "pycparser"):
@@ -145,6 +147,11 @@ def build(compiler, output):
str(ROOT / "monitor.pyw"),
])
payload = temporary / "dist" / "AdaptiveResourceMonitor"
# PyInstaller discovers optional Qt plugins that ARM never loads.
# Qt Virtual Keyboard is GPLv3 or commercial, outside the LGPL Qt runtime.
qt = payload / "_internal" / "PySide6"
for file in ("Qt6VirtualKeyboard.dll", "plugins/platforminputcontexts/qtvirtualkeyboardplugin.dll"):
(qt / file).unlink(missing_ok=True)
shutil.copyfile(temporary / "maintenance" / f"{worker_name}.exe", payload / f"{worker_name}.exe")
(payload / "VERSION.txt").write_text(VERSION + "\n", encoding="utf-8")
(payload / "BUILD.json").write_text(json.dumps(identity, indent=2) + "\n", encoding="utf-8")