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.
This commit is contained in:
@@ -1,5 +1,79 @@
|
|||||||
# Adaptive Resource Monitor implementation report
|
# Adaptive Resource Monitor implementation report
|
||||||
|
|
||||||
|
## 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
|
## v0.6.2.2_alpha — Update channel correction
|
||||||
|
|
||||||
Windows Program Compatibility Assistant recorded the archived
|
Windows Program Compatibility Assistant recorded the archived
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from time import time
|
|||||||
import winreg
|
import winreg
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
from PySide6.QtCore import QLockFile, QObject, QRect, QSignalBlocker, Qt, QTimer, QUrl, Signal
|
from PySide6.QtCore import QByteArray, QEvent, QLockFile, QObject, QRect, QSignalBlocker, Qt, QTimer, QUrl, Signal
|
||||||
from PySide6.QtGui import QDesktopServices
|
from PySide6.QtGui import QDesktopServices
|
||||||
from PySide6.QtWidgets import QApplication, QDialog, QMessageBox, QSystemTrayIcon
|
from PySide6.QtWidgets import QApplication, QDialog, QMessageBox, QSystemTrayIcon
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@ from .model import ALL, LOCAL, TOTAL, Connection
|
|||||||
from .providers.ssh import update_host_key
|
from .providers.ssh import update_host_key
|
||||||
from .tray import HoverMonitor
|
from .tray import HoverMonitor
|
||||||
from .tray_menu import TrayMenu
|
from .tray_menu import TrayMenu
|
||||||
|
from .update_client import write_atomic
|
||||||
from .version import NAME, VERSION
|
from .version import NAME, VERSION
|
||||||
from .views import METRIC_NAMES, Monitor
|
from .views import METRIC_NAMES, Monitor
|
||||||
|
|
||||||
@@ -91,6 +92,19 @@ class Application(QObject):
|
|||||||
self.expanded = Monitor(self.dashboard, True, self.request_archive, self.open_expanded,
|
self.expanded = Monitor(self.dashboard, True, self.request_archive, self.open_expanded,
|
||||||
self.set_pin, self.about_page)
|
self.set_pin, self.about_page)
|
||||||
self.expanded.setWindowIcon(self.brand_icon)
|
self.expanded.setWindowIcon(self.brand_icon)
|
||||||
|
self.window_geometry_file = self.root / "monitor-window.bin"
|
||||||
|
self.saved_window_geometry = None
|
||||||
|
try:
|
||||||
|
geometry = self.window_geometry_file.read_bytes()
|
||||||
|
if self.expanded.restoreGeometry(QByteArray(geometry)):
|
||||||
|
self.saved_window_geometry = geometry
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
except OSError as exc:
|
||||||
|
LOG.warning("Could not read monitor window geometry: %s", exc)
|
||||||
|
self.window_geometry_timer = QTimer(self, singleShot=True, interval=350)
|
||||||
|
self.window_geometry_timer.timeout.connect(self.save_window_geometry)
|
||||||
|
self.expanded.installEventFilter(self)
|
||||||
self.popup = Monitor(self.dashboard, False, self.request_archive, self.open_expanded, self.set_pin)
|
self.popup = Monitor(self.dashboard, False, self.request_archive, self.open_expanded, self.set_pin)
|
||||||
for view in (self.popup, self.expanded):
|
for view in (self.popup, self.expanded):
|
||||||
view.add_update_banner(self.open_update)
|
view.add_update_banner(self.open_update)
|
||||||
@@ -116,6 +130,29 @@ class Application(QObject):
|
|||||||
self.change_brand_theme()
|
self.change_brand_theme()
|
||||||
self.configure()
|
self.configure()
|
||||||
|
|
||||||
|
def eventFilter(self, watched, event):
|
||||||
|
if watched is self.expanded:
|
||||||
|
if event.type() == QEvent.Type.Hide:
|
||||||
|
self.window_geometry_timer.stop()
|
||||||
|
self.save_window_geometry()
|
||||||
|
elif self.expanded.isVisible() and event.type() in (QEvent.Type.Move, QEvent.Type.Resize,
|
||||||
|
QEvent.Type.WindowStateChange):
|
||||||
|
self.window_geometry_timer.start()
|
||||||
|
return super().eventFilter(watched, event)
|
||||||
|
|
||||||
|
def save_window_geometry(self):
|
||||||
|
if self.expanded.isMinimized():
|
||||||
|
return
|
||||||
|
if self.expanded.isVisible():
|
||||||
|
self.expanded.fit_work_area()
|
||||||
|
geometry = bytes(self.expanded.saveGeometry())
|
||||||
|
if geometry != self.saved_window_geometry:
|
||||||
|
try:
|
||||||
|
write_atomic(self.window_geometry_file, geometry)
|
||||||
|
self.saved_window_geometry = geometry
|
||||||
|
except OSError as exc:
|
||||||
|
LOG.warning("Could not save monitor window geometry: %s", exc)
|
||||||
|
|
||||||
def change_brand_theme(self, scheme=None):
|
def change_brand_theme(self, scheme=None):
|
||||||
scheme = scheme or self.qt.styleHints().colorScheme()
|
scheme = scheme or self.qt.styleHints().colorScheme()
|
||||||
self.brand_colors = DARK if scheme == Qt.ColorScheme.Dark else LIGHT
|
self.brand_colors = DARK if scheme == Qt.ColorScheme.Dark else LIGHT
|
||||||
@@ -567,6 +604,7 @@ class Application(QObject):
|
|||||||
updates_stopped = self.about_page.updates.stop()
|
updates_stopped = self.about_page.updates.stop()
|
||||||
for timer in (self.tray_timer, self.hover_timer, self.view_timer):
|
for timer in (self.tray_timer, self.hover_timer, self.view_timer):
|
||||||
timer.stop()
|
timer.stop()
|
||||||
|
self.window_geometry_timer.stop()
|
||||||
for icon in self.icons.values():
|
for icon in self.icons.values():
|
||||||
icon.hide()
|
icon.hide()
|
||||||
self.popup.hide()
|
self.popup.hide()
|
||||||
@@ -608,12 +646,13 @@ def main():
|
|||||||
state = presentation(transaction) if transaction else {}
|
state = presentation(transaction) if transaction else {}
|
||||||
if state.get("expanded", not controller.settings.minimized):
|
if state.get("expanded", not controller.settings.minimized):
|
||||||
controller.open_expanded()
|
controller.open_expanded()
|
||||||
if geometry := state.get("geometry"):
|
if not controller.saved_window_geometry and (geometry := state.get("geometry")):
|
||||||
rect = QRect(*geometry)
|
rect = QRect(*geometry)
|
||||||
if any(screen.availableGeometry().intersects(rect) for screen in app.screens()):
|
if any(screen.availableGeometry().intersects(rect) for screen in app.screens()):
|
||||||
controller.expanded.setGeometry(rect)
|
controller.expanded.setGeometry(rect)
|
||||||
if state.get("about"):
|
if state.get("about"):
|
||||||
controller.expanded.tabs.setCurrentWidget(controller.about_page)
|
controller.expanded.tabs.setCurrentWidget(controller.about_page)
|
||||||
|
controller.expanded.fit_work_area()
|
||||||
if transaction:
|
if transaction:
|
||||||
controller.about_page.updates.follow_restart(transaction)
|
controller.about_page.updates.follow_restart(transaction)
|
||||||
signal_ready(root)
|
signal_ready(root)
|
||||||
|
|||||||
31
arm/views.py
31
arm/views.py
@@ -1,7 +1,7 @@
|
|||||||
from time import time, strftime, localtime
|
from time import time, strftime, localtime
|
||||||
|
|
||||||
from PySide6.QtCore import QSize, Qt, QSignalBlocker, QTimer
|
from PySide6.QtCore import QSize, Qt, QSignalBlocker, QTimer
|
||||||
from PySide6.QtGui import QColor, QPalette
|
from PySide6.QtGui import QColor, QGuiApplication, QPalette
|
||||||
from PySide6.QtWidgets import (
|
from PySide6.QtWidgets import (
|
||||||
QAbstractItemView, QComboBox, QFrame, QGridLayout, QHeaderView, QHBoxLayout, QLabel,
|
QAbstractItemView, QComboBox, QFrame, QGridLayout, QHeaderView, QHBoxLayout, QLabel,
|
||||||
QPushButton, QScrollArea, QSizePolicy, QTableWidget, QTableWidgetItem, QTabWidget, QVBoxLayout, QWidget,
|
QPushButton, QScrollArea, QSizePolicy, QTableWidget, QTableWidgetItem, QTabWidget, QVBoxLayout, QWidget,
|
||||||
@@ -9,6 +9,7 @@ from PySide6.QtWidgets import (
|
|||||||
|
|
||||||
from .graphs import Plot, resource_series, selected_resource
|
from .graphs import Plot, resource_series, selected_resource
|
||||||
from .model import ALL, LOCAL, NETWORK, TOTAL, Connection, INTERVALS, RANGES, RESOURCES, format_value
|
from .model import ALL, LOCAL, NETWORK, TOTAL, Connection, INTERVALS, RANGES, RESOURCES, format_value
|
||||||
|
from .version import VERSION
|
||||||
|
|
||||||
METRIC_NAMES = {
|
METRIC_NAMES = {
|
||||||
"cpu.util": "CPU utilization", "cpu.frequency": "Frequency", "cpu.temperature": "CPU temperature",
|
"cpu.util": "CPU utilization", "cpu.frequency": "Frequency", "cpu.temperature": "CPU temperature",
|
||||||
@@ -234,7 +235,15 @@ class Monitor(QWidget):
|
|||||||
layout.setContentsMargins(8, 7, 8, 7)
|
layout.setContentsMargins(8, 7, 8, 7)
|
||||||
layout.setSpacing(4)
|
layout.setSpacing(4)
|
||||||
layout.addLayout(top)
|
layout.addLayout(top)
|
||||||
|
if expanded:
|
||||||
layout.addWidget(self.header)
|
layout.addWidget(self.header)
|
||||||
|
else:
|
||||||
|
status = QHBoxLayout()
|
||||||
|
status.addWidget(self.header, 1)
|
||||||
|
version = QLabel(VERSION, textFormat=Qt.TextFormat.PlainText)
|
||||||
|
version.setAccessibleName(f"Installed version {VERSION}")
|
||||||
|
status.addWidget(version, 0, Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter)
|
||||||
|
layout.addLayout(status)
|
||||||
self.single = QWidget()
|
self.single = QWidget()
|
||||||
single_layout = QVBoxLayout(self.single)
|
single_layout = QVBoxLayout(self.single)
|
||||||
single_layout.setContentsMargins(0, 0, 0, 0)
|
single_layout.setContentsMargins(0, 0, 0, 0)
|
||||||
@@ -274,10 +283,30 @@ class Monitor(QWidget):
|
|||||||
|
|
||||||
def show_page(self, about=False):
|
def show_page(self, about=False):
|
||||||
self.tabs.setCurrentWidget(self.about_page if about else self.resource_page)
|
self.tabs.setCurrentWidget(self.about_page if about else self.resource_page)
|
||||||
|
self.ensurePolished()
|
||||||
|
self.layout().activate()
|
||||||
self.show()
|
self.show()
|
||||||
|
self.fit_work_area()
|
||||||
self.raise_()
|
self.raise_()
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
|
|
||||||
|
def fit_work_area(self):
|
||||||
|
if self.isMinimized() or self.isMaximized() or self.isFullScreen():
|
||||||
|
return
|
||||||
|
frame = self.frameGeometry()
|
||||||
|
screen = QGuiApplication.screenAt(frame.center()) or self.screen()
|
||||||
|
if screen is None:
|
||||||
|
return
|
||||||
|
area = screen.availableGeometry()
|
||||||
|
if frame.width() > area.width() or frame.height() > area.height():
|
||||||
|
self.resize(self.width() - max(0, frame.width() - area.width()),
|
||||||
|
self.height() - max(0, frame.height() - area.height()))
|
||||||
|
frame = self.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()):
|
||||||
|
self.move(x, y)
|
||||||
|
|
||||||
def brand_tabs(self, colors):
|
def brand_tabs(self, colors):
|
||||||
self.tabs.setStyleSheet(f"""
|
self.tabs.setStyleSheet(f"""
|
||||||
QTabWidget#armMainTabs::pane {{ border: 1px solid {colors.border}; }}
|
QTabWidget#armMainTabs::pane {{ border: 1px solid {colors.border}; }}
|
||||||
|
|||||||
Reference in New Issue
Block a user