9 Commits

Author SHA1 Message Date
d2f8550111 Bundle Qt license notices and omit the unused virtual keyboard 2026-11-26 21:21:58 -06:00
6a592ebe4c Keep the machine checklist label clear at high DPI 2026-11-26 21:15:32 -06:00
26796a1f17 Persist machine ordering and checkbox display selection 2026-11-26 21:12:57 -06:00
31f0b430fb Wait for startup update restoration in the Windows regression 2026-11-26 20:47:35 -06:00
44fef12e75 Release hover version and window placement fixes 2026-11-26 20:46:00 -06:00
d40be62478 Persist expanded window geometry
Show the installed version in the compact monitor and keep the expanded window within the available screen area. Save and restore expanded-window geometry across launches, with recovery for oversized or off-screen placements.
2026-11-26 20:39:20 -06:00
5e8ea74be3 Promote Adaptive Resource Monitor v0.6.2.2 to Beta 2026-11-26 20:23:14 -06:00
68bd5a0036 Link Jenkins folder in documentation
Replace the plain Jenkins folder path with a direct link to the Adaptive Resource Monitor folder.
2026-11-26 20:04:25 -06:00
363c29fcdc Allow signed updates to more mature release channels 2026-11-26 20:01:54 -06:00
28 changed files with 2441 additions and 227 deletions

View File

@@ -1,10 +1,32 @@
# 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.
- Restore the last size and position of the main monitor and its reusable dialogs. Keep restored windows within the current work area where their content fits.
## v0.6.2.2_beta — 2026-11-26
- Promote Adaptive Resource Monitor to Beta after verifying the production self-update, restoration of local and remote monitoring, and signed same-number Beta discovery.
- The first Beta marks the completion of the original Windows monitoring scope. Beta development focuses on operational stability, monitoring accuracy, compatibility, and update reliability.
## v0.6.2.2_alpha — 2026-11-26
- Allow signed updates to the same or a more mature release channel, including Beta at the same numerical version as Alpha.
- Report when a release is excluded because of its numerical version or channel.
## v0.6.2.1_alpha — 2026-11-26
- Show verified update availability and installation readiness in the hover monitor, main window, and tray menu. Windows notifications can be turned off and repeat checks do not repeat them.
- Wait for ARM to finish saving settings and history and exit before replacing any application files. Show independent installation progress and report restart or recovery results.
- Restore the prior tray-only or expanded presentation after an update and let users open the changelog from the success confirmation.
- Published the signed Windows x64 installer and portable ZIP from Jenkins build #7.
## v0.6.1.1_alpha — 2026-11-26

View File

@@ -1,5 +1,337 @@
# 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`.
The earlier hover label and expanded-window geometry corrections were
committed afterward in `d40be62478eb45f572a1555ce22491e4a2cc5eb8`. The
published Beta and its installed executable therefore lacked both changes.
This Bug-Fix increments only the last numerical counter. The hover monitor
reads VERSION.md through the shared version module and renders it above the
selectors and Pin and Details controls. A shared geometry handler preserves
the existing main-window state file and remembers Settings, Remote Targets,
Remote Machine and Application Details placement. The About layout remains
the same as the previous release.
The 34 regressions passed. Native Windows checks exercised individual and
All Systems, pinned and unpinned, and a popup anchored to a separate machine
icon. Both themes were checked at effective 100% and 150% scaling using
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
check passed before the Beta build. The promotion kept the four numerical
counters at `0.6.2.2`. All 34 regression tests and the isolated native
Windows verification passed. Build and Archive #10 used commit
`5e8ea74be3fd94156bdc7a0810cfcc8eaac739f0`. Publish Release #10 published
its artifacts as a separate Gitea prerelease. The earlier Alpha releases
remain public.
[Build #10](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Build-and-Archive/10/)
[Publication #10](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Publish-Release/10/)
[Public Beta](https://phantom.zapto.org/gitea/sonja/Adaptive_Resource_Monitor/releases/tag/v0.6.2.2_beta)
All seven Beta attachments matched anonymously by size and SHA-256. The
Ed25519 signature, version, x64 PE metadata, portable package and build
receipt verified. The installed corrective Alpha client verified this
public Beta as eligible.
| Windows x64 package | Bytes | SHA-256 |
| --- | ---: | --- |
| Installer | 60,165,231 | `305cd316547245eaf0d77703f1b4be93404f7762fa4839b4b4a693c13d3bd78f` |
| Portable ZIP | 74,682,861 | `e1ee75e4218594feb7c1735cf1853739f18e5560df37666e25b186216077657a` |
### Production Beta acceptance
The installed corrective Alpha displayed the signed Beta as available, then
ready to install after the package download. ARM recorded one availability
notification for the Beta. Install Later kept the same verified bytes and
timestamp. Installation began through the installed application's controls.
Transaction `04ef6d0d8a3745bd8629d8945a6f2349` recorded the old process
acknowledging shutdown and exiting at 8:34:40.683 PM CST with exit code 0.
The installer log was created at 8:34:41.896 PM. The independent progress
window was visible during installation. The same Windows user, session and
non-elevated privilege level were retained. The automatic restart reported
v0.6.2.2_beta, persisted its completion receipt and displayed the success
confirmation. Windows registration and About reported Beta. The 298
installed payload files matched build #10. The restarted process remained
the sole ARM instance and the maintenance launcher exited.
The production settings and SSH host key files matched their pre-update
hashes. All credential references remained accessible, and startup,
Windows notification and automatic update-check preferences were preserved.
Persistent recording was off before both updates. All Systems displayed
four independent histories with fresh Local Machine, Rain, Phantom and
LAMP samples and distinct network IN and OUT readings. All four sample
timestamps advanced during a 20-second observation. Explorer returned a
live tray icon with six distinct rendered frames. The installed About
check verified Beta as current. The acceptance checks covered 169 seconds
after the automatic Beta restart.
Both production self-updates passed. Adaptive Resource Monitor is publicly
released and running in production as v0.6.2.2_beta. The production
screenshots, shutdown acknowledgement, installer log and completion
receipts are retained locally under `evidence/v0.6.2.2_alpha-production`
and `evidence/v0.6.2.2_beta-production`.
### Separate window changes and cleanup
The local hover monitor shows the installed version on the status row below
the controls. The expanded window keeps the existing About layout, fits
inside the monitor's work area, and restores its saved size and position.
Private native Windows checks verified the hover label at 300 and 500 pixels
and verified exact geometry restoration, oversized window handling, and
off-screen placement recovery. These are separate source changes after
the pinned Beta commit.
Anonymous Beta readback removed 134,850,358 bytes of duplicate downloads.
The two isolated window checks removed 6,220 bytes of temporary data.
A final isolated GUI regression passed and removed 55,800 bytes of test
data. A 719-byte incomplete capture was discarded. Jenkins cleared its build
and publication workspaces. The verified local release archives, selected
production screenshots and actual updater logs were retained.
## v0.6.2.2_alpha — Update channel correction
Windows Program Compatibility Assistant recorded the archived
`release/v0.6.2.1_alpha/AdaptiveResourceMonitor-v0.6.2.1_alpha-windows-x64-setup.exe`
launching at 7:44:03 PM CST on November 26. The installed uninstaller was
written in the same second and its data was written at 7:44:12 PM. The
new application started at 7:44:13 PM. Gitea published build #7 at 7:48:46
PM. The installer was launched from the release archive, outside the
disposable test paths and before the update was available publicly.
A production updater transaction or receipt for this launch was absent.
The available audit and session records do not identify the launcher.
Jenkins build #7 compiled and archived the files, and publication #8
handled Gitea publication. The recorded isolated installer tests used
disposable targets. Production fingerprints now bracket development
validation, and the release procedure requires the installed UI and a
complete updater receipt for live acceptance.
The corrective version changes only the Bug-Fix counter. Discovery,
download and installation now share a policy that allows the installed
channel and more mature channels while rejecting lower numerical versions.
The release index distinguishes channel and version exclusions from
signature or metadata failures. There was no explicit channel preference
in the existing settings. All 34 regression tests passed, including signed
same-number Alpha-to-Beta discovery and the full channel matrix.
### Corrective Alpha release
The native Windows agent's Build and Archive #8 succeeded at commit
`363c29fcdc3766c0e28558a0a0ede76308b7405f`. Publish Release #9 reused that
archive. All seven public attachments passed independent anonymous size
and SHA-256 verification, including a fresh signature, PE metadata and
portable package check. The old Alpha releases remain public.
[Build #8](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Build-and-Archive/8/)
[Publication #9](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Publish-Release/9/)
[Public corrective Alpha](https://phantom.zapto.org/gitea/sonja/Adaptive_Resource_Monitor/releases/tag/v0.6.2.2_alpha)
| Windows x64 package | Bytes | SHA-256 |
| --- | ---: | --- |
| Installer | 60,156,586 | `266b7aeb525a963f05605152e5be0bb7d41ac86537d5dbdf18d9ae6e1e91efa6` |
| Portable ZIP | 74,683,844 | `fc6074018fd04a60a7b8c9c5d671dcec991cec8cde5435c5774c2e04a29c57b2` |
The live v0.6.2.1_alpha executable, maintenance launcher, build receipt,
settings, SSH host keys and process identity matched the recorded start
of development. Existing update-check and startup preferences and all
three credential references also matched. Persistent history was off.
The installed executable's released update client verified the public
v0.6.2.2_alpha as eligible. The corrective archive's frozen updater also
selected the correctly signed v0.6.2.2_beta fixture with identical
numerical counters. This test used a temporary fixture outside production.
### Corrective Alpha production self-update
The installed ARM controls discovered v0.6.2.2_alpha, displayed the
available notice and downloaded the verified Windows x64 installer.
The hover and tray menu notices were confirmed at the workstation and
captured, along with About, the expanded banner and the ready state.
Two checks kept a single Windows notification record for the release.
Install Later preserved the verified package and its file timestamp.
Transaction `1cfe7ea68d16460198509fcb49ff4382` recorded the normal update
controls handing off to the independent launcher. The main process
acknowledged closure and exited successfully at 8:18:31.284 PM CST.
The installer log was created at 8:18:32.712 PM. The independent progress
window was visible during installation. The launcher restarted ARM in
the same user session and at the same elevation. The restarted process
wrote the v0.6.2.2_alpha completion receipt and the GUI displayed success.
The maintenance processes exited. All 298 installed payload files
matched the archived build.
The operator confirmed a separate reopen after seeing the successful
automatic restart. Explorer was the parent of that later launch. The
automatic restart receipt and success capture were already present.
The settings and SSH key files were byte-identical after the update.
Startup, automatic update checks and Windows notification preferences
were preserved. All three credential entries were accessible. ARM
reestablished SSH connections to Rain, Phantom and LAMP. The installed
corrective Alpha also selected the correctly signed same-number Beta
fixture in a read-only test of the shipped code.
Explorer registered the Local Machine tray icon, and six passive samples
showed six distinct live frames. The periodic check option remains under
Settings → General with the production interval set to Off.
All Systems reported four connected machines with fresh Local Machine, Rain,
Phantom and LAMP samples and separate network IN and OUT readings. The live
Explorer hover window displayed the same independent histories. Production
Alpha acceptance passed, including discovery of the signed same-number
Beta fixture by the installed corrective updater.
Publication readback removed 134,842,388 bytes of duplicate downloads.
The isolated frozen-client check removed 4,148,335 bytes, and the private
Windows UI validation removed 59,841 bytes. Package verifiers and Jenkins
removed their staging. The verified release archive and prepublication
fingerprints are retained as evidence.
## v0.6.2.1_alpha publication and production assessment — 2026-11-26
### Publication and anonymous verification
Publish Release #8 succeeded using the seven artifacts from Build and
Archive #7 at commit `035fb8ddc918337fdf6cf9743082aacae940b9db`. No build
was run for publication. Gitea published the Alpha prerelease at 7:48:46 PM
CST. Its version tag resolves to the pinned commit, and the public release
notes match the tagged changelog and signed manifest.
[Public release](https://phantom.zapto.org/gitea/sonja/Adaptive_Resource_Monitor/releases/tag/v0.6.2.1_alpha)
[Publish Release #8](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Publish-Release/8/)
Jenkins and an independent anonymous download verified all seven attachments
against the archived bytes. The Ed25519 signature, Windows x64 architecture,
package types, executable versions, package lengths, SHA-256 checksums and
build identity passed. The earlier v0.6.1.1_alpha release is still public.
| Windows x64 package | Bytes | SHA-256 |
| --- | ---: | --- |
| Installer | 60,163,795 | `7d79e692b88819298c6ae00bf6041cdcea77c2171965a784f39fd2961179080a` |
| Portable ZIP | 74,681,911 | `966edc69169ab607f810e67af0def5ac1ad86360bfcd3996e884104b4ae32b98` |
### Production Alpha acceptance
The first production inspection found v0.6.2.1_alpha already installed and
running. ARM logged the earlier instance stopping at 7:43:48 PM CST and the
new version starting at 7:44:15 PM, before the target release became public.
The production profile had no staged updater download, transaction plan or
completion receipt. The required production self-update from v0.6.1.1_alpha
could not be performed or established from that starting state. Automatic
shutdown, installation, restart and the success notification for that
transition remain unverified. The working installation was preserved.
- Windows registration, the installed executable and the build receipt report
v0.6.2.1_alpha from build #7. All 298 installed payload files matched the
verified archive. One ARM process was running in the console session with
no orphaned ARM installer or maintenance process observed.
- Rain, Phantom and LAMP had established SSH connections owned by ARM, and
Windows Credential Manager returned entries for all three saved references.
The production settings and pinned host-key file stayed byte-identical
during this assessment. A pre-upgrade data comparison for the earlier
version change was unavailable. Persistent recording is disabled, and
startup and periodic update checks remain disabled.
- Explorer returned one registered tray icon for ARM. Six passive samples
showed six different rendered frames. Foreground hover, tray-menu and
All Systems interactions were outside this passive production check.
- The frozen v0.6.1.1_alpha release client discovered and verified the
published Alpha as an eligible upgrade. The frozen client from the production
v0.6.2.1_alpha executable verified the same release as current. Both checks
used the actual public endpoint and no Gitea authentication.
**Alpha production self-update acceptance did not pass.**
### Beta promotion blocked
The version comparison and discovery test used updater code read from the
installed v0.6.2.1_alpha executable. Numeric counters sort before maturity,
and the supported tags sort `alpha < beta < rc < stable`. Same-number Beta
has a higher version key, but the shipped client only considers its current
prerelease channel and eligible stable releases. It skipped the signed Beta
fixture before requesting its manifest and selected the signed Alpha fixture
as current. The fixture's Beta signature independently verified. The tests
also confirmed same-version installation rejection, Beta-to-Alpha downgrade
rejection, eligible numeric progression and malformed-version rejection.
Production remains on v0.6.2.1_alpha. VERSION.md and the numerical version
counters are unchanged. No Beta build, tag, publication, production
notification exercise or installation was performed. An updater
compatibility change would require a separately authorized corrective release.
### Publication cleanup
Removed 138,981,356 measured bytes of temporary anonymous downloads and
previous-updater test files. The verifier removed its temporary payload
extractions, and Jenkins deleted its publication workspace. The published
releases, their archived packages and the existing validation evidence
were retained.
## v0.6.2.1_alpha — Update notifications and installation lifecycle
The Minor counter advanced. The hover monitor, expanded window and tray menu
@@ -10,9 +342,76 @@ shutdown and process exit, shows independent installation progress and
checks the restarted version before reporting success. The release uses
the existing Jenkins build and authorized publication jobs.
Production self-update acceptance follows authorized publication using the
installed v0.6.1.1_alpha updater. Its maintenance launcher handles the first
upgrade. The newly installed application reads the legacy completion receipt.
### Native Windows validation
- The 28-test regression suite passed. The private desktop suite passed on
native Windows, including update availability, rejected signatures,
downloading, install readiness, deferral and notification deduplication.
Both Design Creations themes and the confirmation's View Changelog action
passed. The notification also appeared in the separate remote tray menu
and the pinned remote and All Systems popup. Live telemetry, individual
tray sources and separate network IN and OUT remained operational.
- Disposable installed and portable x64 copies updated to a signed local
fixture. The installer exited with code 7 when its destination executable
was running. The updater waited for the original process and its clean
shutdown acknowledgement. An exit without acknowledgement left the
payload untouched. The independent helper displayed progress while the
installer installed the verified update.
- The installed upgrade restored the expanded window and the portable
upgrade restored tray-only mode. The restarted process ran as the same
user in the same Windows session at the same elevation. A second launch
exited without creating another instance. Settings, Windows Credential
Manager references, saved fixture credentials, the SSH trust file and
existing SQLite samples survived. Each lifecycle test exited with code 0.
- A fixture with a signed commit mismatch exercised rollback after
replacement. The previous portable executable was restored byte for byte
and restarted. A separate interrupted replacement recovered from the
persisted journal and cleared its RunOnce entry.
- The previous v0.6.1.1_alpha frozen launcher applied the exact signed
portable archive from Jenkins #7 on a private desktop. It restarted
v0.6.2.1_alpha, the new application displayed confirmation from the legacy
receipt and the fixture profile remained identical. The installed
lifecycle tests used a disposable installer AppId.
### Jenkins release candidate
Build and Archive #7 completed on the native Windows agent after an SCM
change. The pinned source
commit is `035fb8ddc918337fdf6cf9743082aacae940b9db`. Jenkins validated PE
metadata, installer and portable package identity, ZIP integrity and two
portable launches. All seven archived files were retrieved and verified
locally against the same commit and build. The ARM Ed25519 verification key,
signature, package version, architecture, filenames, sizes and SHA-256
hashes passed. The archive includes the checksums, signed manifest, public
key, release notes and build receipt alongside the two packages.
[Jenkins build record](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/job/Build-and-Archive/7/)
| Windows x64 artifact | Bytes | SHA-256 |
| --- | ---: | --- |
| AdaptiveResourceMonitor-v0.6.2.1_alpha-windows-x64-setup.exe | 60,163,795 | `7d79e692b88819298c6ae00bf6041cdcea77c2171965a784f39fd2961179080a` |
| AdaptiveResourceMonitor-v0.6.2.1_alpha-windows-x64-portable.zip | 74,681,911 | `966edc69169ab607f810e67af0def5ac1ad86360bfcd3996e884104b4ae32b98` |
The verified archive is in `release/v0.6.2.1_alpha`. Six captures of the
hover, expanded window, tray menu, About tab, installation progress and
successful update are in `evidence/v0.6.2.1_alpha`. The availability captures
show the signed local fixture version.
### Production status before publication
At the end of prepublication validation, production and the public release
index still reported v0.6.1.1_alpha. The executable, settings and pinned SSH
host-key file matched the before-test hashes. The new progress window
applies to updates started from v0.6.2.1_alpha onward.
### Validation cleanup
Removed the staged compiler, private test key, test-only builds, profiles,
QA scripts, temporary extractions and two superseded captures. Manual
cleanup removed 2,536,086,381 bytes by logical file size. The two local
package builds automatically removed another 686,018,471 bytes of build
staging. The disposable Windows apps and their recovery entries were
cleared. Jenkins cleaned its build workspace. The verified #7 archive
and six requested captures are retained as release and validation evidence.
## Initial public release and production upgrade — 2026-11-26

View File

@@ -1,7 +1,7 @@
# Jenkins
The Phantom Jenkins controller's Applications view contains the
Adaptive Resource Monitor folder at job/Adaptive-Resource-Monitor/.
[Adaptive Resource Monitor folder](https://phantom.zapto.org:8080/jenkins/job/Adaptive-Resource-Monitor/).
Both jobs use the existing inkiron-windows native Windows x64 agent through
its inkiron-windows-x64 label. The agent needs Windows Git, Python 3.12 x64,
trusted HTTPS, workspace write access and permission to create a private

View File

@@ -19,19 +19,35 @@ 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.
Signed update discovery supports gaining release maturity from v0.6.2.2_alpha
onward. Production acceptance and promotion status are recorded in the
implementation report. [Public releases](https://phantom.zapto.org/gitea/sonja/Adaptive_Resource_Monitor/releases)
The first Beta covers the original Windows monitoring scope, including
remote Linux monitoring. Beta development prioritizes stability, performance,
hardware and remote compatibility, security, and update and installer
reliability.
The application version is defined in [VERSION.md](VERSION.md). Open **About →
Check for Updates** to check the public ARM Releases page. Downloading and
installing are separate actions. Settings can enable startup or periodic checks.
installing are separate actions. Under **Settings → General**, enable
**Check for updates at startup** or use **Check for updates periodically**
to choose Off, every 4 hours, every 12 hours, daily, or weekly.
Both Windows x64 distributions use signed update metadata. See
[Update mechanism](UPDATE_MECHANISM.md) and [Release process](RELEASE_PROCESS.md).
See [BUILD.md](BUILD.md) for Windows build and verification commands,

View File

@@ -23,3 +23,18 @@ never include private configuration, credentials or signing keys.
Existing version tags must point to the same commit. A public release for that
version is accepted only if its attachments match the pinned archive. Use a
new authorized application version for any change to its released bytes.
Before publishing a channel promotion, verify discovery and eligibility
with the already-shipped updater. The v0.6.2.1_alpha updater requires an
Alpha corrective release before it can discover Beta. Starting with
v0.6.2.2_alpha, a release can progress to a more mature channel at identical
numerical version counters. Production self-update acceptance and signed
fixture discovery are required before the promoted release is published.
Record the production executable version, process and profile fingerprints
before and after development validation. Run candidate launch tests from
isolated folders and profiles. Validate an installer in a disposable
environment that has no production installation with the same Windows
application ID. A production self-update starts from the current installed
application's update controls after publication. Retain its shutdown
acknowledgement, transaction log and restart receipt as acceptance evidence.

View File

@@ -28,8 +28,15 @@ JSON manifest and a base64 Ed25519 signature. Protocol 1 includes the
application ID, Windows x64 architecture, exact VERSION.md value, Git commit,
Jenkins build number and release notes. Its installed and portable package
records carry the exact filename, byte count and SHA-256. The trusted public
key is embedded in both executables. A client accepts its own release channel
and eligible stable releases. A package for installation must be strictly newer.
key is embedded in both executables.
Starting with v0.6.2.2_alpha, a client accepts its own release channel and more
mature channels. Supported channels in order are Alpha, Beta, Release
Candidate (`rc`) and Stable. The numerical version must be at least as high
as the installed version. Maturity breaks ties at identical numerical
versions. A verified identical release can confirm that ARM is current.
Downloading and installing require a strictly newer version. About reports
version and channel exclusions separately from verification failures.
## Installed and portable applications

View File

@@ -1 +1 @@
v0.6.2.1_alpha
v0.8.2.3_beta

View File

@@ -21,6 +21,7 @@ from .branding import (
)
from .version import NAME, VERSION
from .update_ui import UpdatePanel
from .window_geometry import WindowGeometry
LOG = logging.getLogger(__name__)
DOCS = {
@@ -232,4 +233,5 @@ class AboutPage(QWidget):
buttons.rejected.connect(dialog.reject)
layout.addWidget(buttons)
dialog.resize(620, dialog.sizeHint().height())
dialog.window_geometry = WindowGeometry(dialog, self.data_root / "application-details-window.bin")
dialog.exec()

View File

@@ -29,6 +29,7 @@ from .tray import HoverMonitor
from .tray_menu import TrayMenu
from .version import NAME, VERSION
from .views import METRIC_NAMES, Monitor
from .window_geometry import WindowGeometry, fit_work_area
LOG = logging.getLogger(__name__)
RUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"
@@ -52,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__()
@@ -77,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 = {}
@@ -89,16 +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.popup = Monitor(self.dashboard, False, self.request_archive, self.open_expanded, self.set_pin)
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.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)
@@ -121,6 +124,8 @@ class Application(QObject):
self.brand_colors = DARK if scheme == Qt.ColorScheme.Dark else LIGHT
self.about_page.theme(self.brand_colors)
self.expanded.brand_tabs(self.brand_colors)
self.popup.header.setStyleSheet(f"color: {self.brand_colors.text}")
self.popup.version_label.setStyleSheet(f"color: {self.brand_colors.muted}")
for view in (self.popup, self.expanded):
view.update_banner.theme(self.brand_colors)
for menu in self.menus.values():
@@ -137,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)
@@ -167,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()
@@ -212,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:
@@ -295,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))
@@ -306,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
@@ -608,12 +624,13 @@ def main():
state = presentation(transaction) if transaction else {}
if state.get("expanded", not controller.settings.minimized):
controller.open_expanded()
if geometry := state.get("geometry"):
if not controller.window_geometry.saved and (geometry := state.get("geometry")):
rect = QRect(*geometry)
if any(screen.availableGeometry().intersects(rect) for screen in app.screens()):
controller.expanded.setGeometry(rect)
if state.get("about"):
controller.expanded.tabs.setCurrentWidget(controller.about_page)
fit_work_area(controller.expanded)
if transaction:
controller.about_page.updates.follow_restart(transaction)
signal_ready(root)

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,10 @@ 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
def checkbox(value):
@@ -122,6 +124,7 @@ class SettingsDialog(QDialog):
self.timer.timeout.connect(self.update_diagnostics)
self.timer.start()
self.update_diagnostics()
self.window_geometry = WindowGeometry(self, app.root / "settings-window.bin")
def section(self, title):
page = QWidget()
@@ -159,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",
@@ -170,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])
@@ -331,6 +333,7 @@ class TargetDialog(QDialog):
self.os.currentIndexChanged.connect(update)
self.auth.currentIndexChanged.connect(update)
update()
self.window_geometry = WindowGeometry(self, app.root / "remote-machine-window.bin")
def save(self):
host, name, user = (field.text().strip() for field in (self.host, self.name, self.username))
@@ -374,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()
@@ -394,10 +398,15 @@ 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")
def selected(self):
row = self.table.currentRow()
@@ -405,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

@@ -8,7 +8,9 @@ from urllib.error import HTTPError, URLError
from urllib.parse import quote, urlsplit
from urllib.request import HTTPRedirectHandler, Request, build_opener
from .update_release import MANIFEST, MAX_MANIFEST_SIZE, Release, UpdateError, eligible, source_config, verify_file, verify_manifest
from .update_release import (
MANIFEST, MAX_MANIFEST_SIZE, Release, UpdateError, eligible, exclusion_reason, source_config, verify_file, verify_manifest,
)
from .version import VERSION, version_key
MAX_INDEX_SIZE = 2 * 1024**2
@@ -29,6 +31,7 @@ class Check:
published: str | None
release: Release | None
issues: tuple[str, ...]
exclusions: tuple[str, ...] = ()
class ReleaseClient:
@@ -88,8 +91,10 @@ class ReleaseClient:
break
ordered = sorted(rows, key=version_key, reverse=True)
issues = []
exclusions = []
for version in ordered:
if not eligible(version, installed):
if reason := exclusion_reason(version, installed):
exclusions.append(f"{version}: {reason}")
continue
try:
if len(rows[version]) != 1:
@@ -106,8 +111,8 @@ class ReleaseClient:
except (UpdateError, HTTPError, KeyError, TypeError, AttributeError) as exc:
issues.append(f"{version}: {exc.code if isinstance(exc, HTTPError) else exc}")
continue
return Check(ordered[0], release, tuple(issues))
return Check(ordered[0] if ordered else None, None, tuple(issues))
return Check(ordered[0], release, tuple(issues), tuple(exclusions))
return Check(ordered[0] if ordered else None, None, tuple(issues), tuple(exclusions))
def download(self, release, kind, storage, progress, cancelled):
signed = verify_manifest(release.envelope, self.source["public_key"], release.version)

View File

@@ -10,7 +10,7 @@ from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
from .branding import APP_MODEL_ID
from .version import ROOT, version_key
from .version import CHANNELS, ROOT, version_key
MANIFEST = "arm-update-windows-x64.json"
ARCHITECTURE = "windows-x64"
@@ -106,7 +106,16 @@ def verify_file(path, package):
raise UpdateError("Package SHA-256 does not match the signed manifest")
def eligible(version, installed):
def exclusion_reason(version, installed):
"""Return the policy reason a tag cannot be considered for this installation."""
candidate = version_key(version)
current = version_key(installed)
return candidate >= current and candidate[-1] in (current[-1], 3)
if candidate[:4] < current[:4]:
return f"Numerical version is older than installed {installed}"
if candidate[-1] < current[-1]:
return f"{CHANNELS[candidate[-1]].capitalize()} releases are ineligible for a {CHANNELS[current[-1]]} installation"
return None
def eligible(version, installed):
return exclusion_reason(version, installed) is None

View File

@@ -247,6 +247,8 @@ class UpdatePanel(QGroupBox):
self.status.setText("No eligible verified update is available.")
if value.issues:
self.status.setText(self.status.text() + " Rejected " + "; ".join(value.issues)[:380])
if value.exclusions:
self.status.setText(self.status.text() + " Excluded " + "; ".join(value.exclusions)[:380])
if value.release or not value.issues:
try:
write_atomic(self.last_file, json.dumps(datetime.now().astimezone().isoformat()).encode())

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,10 @@ 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
METRIC_NAMES = {
"cpu.util": "CPU utilization", "cpu.frequency": "Frequency", "cpu.temperature": "CPU temperature",
@@ -40,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]
@@ -183,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)
@@ -195,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()
@@ -205,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:
@@ -214,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)
@@ -233,8 +232,19 @@ class Monitor(QWidget):
layout = QVBoxLayout(self.resource_page if expanded else self)
layout.setContentsMargins(8, 7, 8, 7)
layout.setSpacing(4)
if not expanded:
version = QLabel(VERSION, textFormat=Qt.TextFormat.PlainText)
version.setAccessibleName(f"Installed version {VERSION}")
font = version.font()
font.setPointSize(8)
version.setFont(font)
layout.addWidget(version, alignment=Qt.AlignmentFlag.AlignRight)
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)
@@ -251,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)
@@ -274,7 +284,10 @@ class Monitor(QWidget):
def show_page(self, about=False):
self.tabs.setCurrentWidget(self.about_page if about else self.resource_page)
self.ensurePolished()
self.layout().activate()
self.show()
fit_work_area(self)
self.raise_()
self.activateWindow()
@@ -292,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):
@@ -305,24 +322,30 @@ class Monitor(QWidget):
def popup_size(self):
cfg = self.dashboard.settings
banner = self.update_banner.sizeHint().height() + self.layout().spacing() if (
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:
return QSize(cfg.popup_width, cfg.popup_height + banner)
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())
return QSize(max(cfg.popup_width, 875), max(cfg.popup_height, rows_height + 72) + banner)
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):
self.update_banner = UpdateBanner(open_update)
self.layout().insertWidget(0 if self.expanded else 2, self.update_banner)
self.layout().insertWidget(0 if self.expanded else self.layout().indexOf(self.header) + 1, self.update_banner)
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))] + [
@@ -335,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)
@@ -349,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
@@ -426,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:

69
arm/window_geometry.py Normal file
View File

@@ -0,0 +1,69 @@
"""Keep user-facing windows within the work area and remember their placement."""
import logging
from PySide6.QtCore import QByteArray, QEvent, QObject, QTimer
from PySide6.QtGui import QGuiApplication
from .update_client import write_atomic
LOG = logging.getLogger(__name__)
def fit_work_area(window):
if window.isMinimized() or window.isMaximized() or window.isFullScreen():
return
frame = window.frameGeometry()
screen = QGuiApplication.screenAt(frame.center()) or window.screen()
if screen is None:
return
area = screen.availableGeometry()
if frame.width() > area.width() or frame.height() > area.height():
window.resize(window.width() - max(0, frame.width() - area.width()),
window.height() - max(0, frame.height() - area.height()))
frame = window.frameGeometry()
x = max(area.left(), min(frame.left(), area.right() - frame.width() + 1))
y = max(area.top(), min(frame.top(), area.bottom() - frame.height() + 1))
if (x, y) != (frame.left(), frame.top()):
window.move(x, y)
class WindowGeometry(QObject):
def __init__(self, window, path):
super().__init__(window)
self.window, self.path = window, path
self.saved = None
try:
geometry = path.read_bytes()
if window.restoreGeometry(QByteArray(geometry)):
self.saved = geometry
except FileNotFoundError:
pass
except OSError as exc:
LOG.warning("Could not read %s: %s", path.name, exc)
self.timer = QTimer(self, singleShot=True, interval=350)
self.timer.timeout.connect(self.save)
window.installEventFilter(self)
def eventFilter(self, watched, event):
if event.type() == QEvent.Type.Show:
fit_work_area(watched)
if event.type() == QEvent.Type.Hide:
self.timer.stop()
self.save()
elif watched.isVisible() and event.type() in (QEvent.Type.Show, QEvent.Type.Move, QEvent.Type.Resize,
QEvent.Type.WindowStateChange):
self.timer.start()
return super().eventFilter(watched, event)
def save(self):
if self.window.isMinimized():
return
if self.window.isVisible():
fit_work_area(self.window)
geometry = bytes(self.window.saveGeometry())
if geometry != self.saved:
try:
write_atomic(self.path, geometry)
self.saved = geometry
except OSError as exc:
LOG.warning("Could not save %s: %s", self.path.name, exc)

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

@@ -105,6 +105,84 @@ class UpdateTests(unittest.TestCase):
with patch.object(self.client, "read", side_effect=URLError("unavailable")), self.assertRaises(URLError):
self.client.check(VERSION, "installed")
def test_signed_discovery_allows_the_same_or_a_more_mature_channel(self):
channels = ("alpha", "beta", "rc", "stable")
for index, installed_channel in enumerate(channels):
installed = f"v0.6.2.2_{installed_channel}"
for maturity, offered in enumerate(channels):
newer = f"v0.6.2.3_{offered}"
with self.subTest(installed=installed, candidate=newer):
row, envelope = self.row(self.metadata(newer))
with patch.object(self.client, "read", side_effect=[canonical([row]), envelope]) as read:
found = self.client.check(installed, "installed")
self.assertEqual(found.issues, ())
if maturity >= index:
self.assertEqual(found.release.version, newer)
self.assertEqual(found.exclusions, ())
else:
self.assertIsNone(found.release)
self.assertIn(f"ineligible for a {installed_channel} installation", found.exclusions[0])
self.assertEqual(read.call_count, 1)
def test_same_number_beta_is_selected_over_signed_current_alpha(self):
alpha, beta = "v0.6.2.2_alpha", "v0.6.2.2_beta"
old, _ = self.row(self.metadata(alpha))
current, signature = self.row(self.metadata(beta))
with patch.object(self.client, "read", side_effect=[canonical([old, current]), signature]):
found = self.client.check(alpha, "portable")
self.assertEqual((found.published, found.release.version, found.exclusions), (beta, beta, ()))
with patch.object(self.client, "read", return_value=canonical([old])) as read:
rejected = self.client.check(beta, "portable")
self.assertIsNone(rejected.release)
self.assertIn("Alpha releases are ineligible", rejected.exclusions[0])
self.assertEqual(read.call_count, 1)
def test_more_mature_channel_cannot_downgrade_the_numerical_version(self):
row, _ = self.row(self.metadata("v0.6.2.1_stable"))
with patch.object(self.client, "read", return_value=canonical([row])) as read:
found = self.client.check("v0.6.2.2_alpha", "installed")
self.assertIsNone(found.release)
self.assertIn("Numerical version is older", found.exclusions[0])
self.assertEqual(read.call_count, 1)
def test_identical_verified_release_cannot_be_downloaded_as_an_update(self):
row, envelope = self.row(self.metadata(VERSION))
with patch.object(self.client, "read", side_effect=[canonical([row]), envelope]):
found = self.client.check(VERSION, "installed")
self.assertEqual(found.release.version, VERSION)
with self.assertRaisesRegex(UpdateError, "newer"):
self.client.download(found.release, "installed", self.work, lambda *_: None, lambda: False)
self.assertFalse(list(self.work.iterdir()))
def test_discovery_rejects_unsupported_and_malformed_tags(self):
rows = [{"draft": False, "tag_name": tag} for tag in (
"v0.6.2.2_preview", "v0.6.2_beta", "v00.6.2.2_beta", "v0.6.2.65536_alpha",
)]
with patch.object(self.client, "read", return_value=canonical(rows)) as read:
found = self.client.check("v0.6.2.2_alpha", "installed")
self.assertIsNone(found.published)
self.assertIsNone(found.release)
self.assertEqual(read.call_count, 1)
def test_discovery_preserves_signature_architecture_and_gitea_classification_checks(self):
beta = self.metadata("v0.6.2.2_beta")
stable = self.metadata("v0.6.2.2_stable")
tampered = json.loads(self.sign(beta))
tampered["manifest"]["notes"] = "Modified"
for metadata, envelope, flag, expected in (
(beta, canonical(tampered), True, "signature is invalid"),
(beta | {"architecture": "windows-arm64"}, None, True, "metadata is invalid"),
(beta, None, False, "classification disagrees"),
(stable, None, True, "classification disagrees"),
):
with self.subTest(expected=expected, tag=metadata["version"]):
row, signature = self.row(metadata, envelope)
with patch.object(self.client, "read", side_effect=[canonical([row | {"prerelease": flag}]), signature]):
found = self.client.check("v0.6.2.2_alpha", "installed")
self.assertIsNone(found.release)
self.assertEqual(found.exclusions, ())
self.assertIn(expected, found.issues[0])
def test_download_cancel_and_resume(self):
release = verify_manifest(self.sign(self.metadata()), self.public)
cancel = Event()

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
@@ -511,6 +523,218 @@ def verify_update_notices(session, wait_for, results, captures):
results["verified_shared_update_notices"] = "Verified, ready, rejected, deferred and duplicate notification states"
def verify_hover_version(session, remote, results, captures):
from arm.model import ALL, LOCAL
from arm.version import VERSION
original = session.settings
display = session.dashboard.machine_display
hover = session.popup
scale = round(hover.devicePixelRatioF() * 100)
modes = (
("individual-unpinned", LOCAL, LOCAL, False),
("individual-pinned", remote, remote, True),
("all-systems-unpinned", ALL, LOCAL, False),
("all-systems-pinned", ALL, remote, True),
)
try:
for theme in ("Light", "Dark"):
session.apply(replace(original, theme=theme))
for name, selection, anchor, pinned in modes:
session.hover.pin(False)
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
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
assert label.fontMetrics().horizontalAdvance(VERSION) <= rect.width()
assert hover.rect().contains(rect)
if captures and theme == ("Light" if scale > 100 else "Dark"):
capture_native_window(int(hover.winId()), captures / f"hover-{name}-{scale}.png")
finally:
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
@@ -605,6 +829,7 @@ def evaluate_app(work, results, short=False, captures=None):
assert release_check.wait(10)
return Check(None, None, ())
wait_for(lambda: update.job is None)
with patch.object(update.client, "check", side_effect=slow_check):
try:
sample = session.collectors.last[LOCAL]
@@ -640,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())
@@ -673,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")
@@ -691,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
@@ -721,32 +947,49 @@ 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)}
verify_hover_version(session, primary, results, captures)
with patch("arm.application.tray_icon", wraps=tray_icon) as draw:
session.render()
assert {call.args[1] for call in draw.call_args_list} == {LOCAL, primary, other}
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)
@@ -761,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"))
@@ -779,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
@@ -791,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):
@@ -851,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")