aboutsummaryrefslogtreecommitdiffstats
path: root/sb_builder/packages.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-20 11:16:23 +0200
committerDanilo M. <danix@danix.xyz>2026-10-20 11:16:23 +0200
commitbafab248a348e861511c8a984bdafa48fc32215f (patch)
treec67d14bb0b32464676f38e43c3f6e1abd4ef9dcd /sb_builder/packages.py
parent2989606c3c0bcf08e99468067b0ab73c6810aa1c (diff)
downloadsb-builder-bafab248a348e861511c8a984bdafa48fc32215f.tar.gz
sb-builder-bafab248a348e861511c8a984bdafa48fc32215f.zip
Hints screen: upstream check, hint jobs, diff and revert
Check upstream fills the upstream column and ticks the outdated hints, Update selected starts hint-update, Delete hint acts on the VM. When a hint job ends its SBB-RESULT opens a dialog with each changed hint's diff, Revert per package (once) and Build these. The Packages detail pane gets New hint and Open in Hints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'sb_builder/packages.py')
-rw-r--r--sb_builder/packages.py53
1 files changed, 50 insertions, 3 deletions
diff --git a/sb_builder/packages.py b/sb_builder/packages.py
index 34ce7f5..146db51 100644
--- a/sb_builder/packages.py
+++ b/sb_builder/packages.py
@@ -20,8 +20,9 @@ import html
from PyQt6.QtCore import QAbstractTableModel, QModelIndex, QSortFilterProxyModel, Qt, pyqtSignal
from PyQt6.QtGui import QColor
-from PyQt6.QtWidgets import (QHBoxLayout, QLabel, QLineEdit, QMessageBox, QPushButton,
- QScrollArea, QSplitter, QTableView, QVBoxLayout, QWidget)
+from PyQt6.QtWidgets import (QCheckBox, QDialog, QDialogButtonBox, QFormLayout, QHBoxLayout,
+ QLabel, QLineEdit, QMessageBox, QPushButton, QScrollArea, QSplitter,
+ QTableView, QVBoxLayout, QWidget)
from . import hints as hintlib
from .dashboard import STATUS
@@ -209,6 +210,7 @@ def table(rows):
class PackagesTab(QWidget):
start_requested = pyqtSignal(list) # job-start arguments
+ hints_requested = pyqtSignal(str) # package to show in the Hints tab
def __init__(self, remote, parent=None):
super().__init__(parent)
@@ -245,8 +247,22 @@ class PackagesTab(QWidget):
alignment=Qt.AlignmentFlag.AlignTop)
self.detail.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse)
self.detail.setContentsMargins(12, 8, 12, 8)
+ self.new_hint_btn = QPushButton("New hint")
+ self.new_hint_btn.clicked.connect(self.new_hint)
+ self.open_hint_btn = QPushButton("Open in Hints")
+ self.open_hint_btn.clicked.connect(lambda: self.hints_requested.emit(self.current()["name"]))
+ detail_bar = QHBoxLayout()
+ detail_bar.addWidget(self.new_hint_btn)
+ detail_bar.addWidget(self.open_hint_btn)
+ detail_bar.addStretch()
+ pane = QWidget()
+ pane_layout = QVBoxLayout(pane)
+ pane_layout.addWidget(self.detail)
+ pane_layout.addLayout(detail_bar)
+ pane_layout.addStretch()
scroll = QScrollArea(widgetResizable=True)
- scroll.setWidget(self.detail)
+ scroll.setWidget(pane)
+ self.show_detail(QModelIndex(), None)
split = QSplitter()
split.addWidget(self.table)
split.addWidget(scroll)
@@ -327,6 +343,37 @@ class PackagesTab(QWidget):
== QMessageBox.StandardButton.Yes:
self.start_requested.emit(["publish"])
+ def current(self):
+ index = self.table.currentIndex()
+ return index.data(Qt.ItemDataRole.UserRole) if index.isValid() else None
+
def show_detail(self, current, _previous):
row = current.data(Qt.ItemDataRole.UserRole) if current.isValid() else None
self.detail.setText(detail_html(row) if row else "")
+ self.new_hint_btn.setVisible(bool(row) and not row["hint_path"])
+ self.open_hint_btn.setVisible(bool(row) and bool(row["hint_path"]))
+
+ def ask_new_hint(self, name):
+ """(version or "", no download) for a new hint, None on cancel."""
+ d = QDialog(self, windowTitle=f"New hint: {name}")
+ version = QLineEdit(placeholderText="the .info version")
+ no_dl = QCheckBox('no download (DOWNLOAD="no")')
+ buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok
+ | QDialogButtonBox.StandardButton.Cancel)
+ buttons.accepted.connect(d.accept)
+ buttons.rejected.connect(d.reject)
+ form = QFormLayout(d)
+ form.addRow("version", version)
+ form.addRow(no_dl)
+ form.addRow(buttons)
+ if d.exec() != QDialog.DialogCode.Accepted:
+ return None
+ return version.text().strip(), no_dl.isChecked()
+
+ def new_hint(self):
+ row = self.current()
+ answer = row and self.ask_new_hint(row["name"])
+ if answer:
+ version, no_dl = answer
+ self.start_requested.emit(["hint-new", row["name"], *([version] if version else []),
+ *(["--no-dl"] if no_dl else [])])