From 7f6a13daaf86809d9689608a5020e54abe1b3eea Mon Sep 17 00:00:00 2001 From: LorenEteval Date: Sat, 20 Jun 2026 09:27:13 +0800 Subject: [PATCH] Feature Enhancement: added permanent widget in RoutingPreviewDialog Signed-off-by: LorenEteval --- Furious/Window/UserRoutingWindow.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Furious/Window/UserRoutingWindow.py b/Furious/Window/UserRoutingWindow.py index 5b3a678f..d439fa72 100644 --- a/Furious/Window/UserRoutingWindow.py +++ b/Furious/Window/UserRoutingWindow.py @@ -24,7 +24,7 @@ from Furious.Qt import * from Furious.Qt import gettext as _ from PySide6 import QtCore -from PySide6.QtGui import QDesktopServices +from PySide6.QtGui import * from PySide6.QtWidgets import * import copy @@ -136,8 +136,18 @@ class RoutingPreviewDialog(AppQDialog): else: self.setWindowModality(QtCore.Qt.WindowModality.WindowModal) + self.lineColumnLabel = QLabel('1:1 0') + self.statusBar = QStatusBar() + self.statusBar.addPermanentWidget(self.lineColumnLabel) + + def cursorChangedCallback(cursor: QTextCursor): + self.lineColumnLabel.setText( + f'{cursor.blockNumber() + 1}:{cursor.columnNumber() + 1} {cursor.position()}' + ) + self.textEditor = DraculaJSONTextEditor(fontFamily=AppFontName()) self.textEditor.setLineWrapMode(DraculaJSONTextEditor.LineWrapMode.NoWrap) + self.textEditor.registerCursorPositionChangedCb(cursorChangedCallback) self.textEditor.setPlainText( UJSONEncoder.encode(routingObjectFromProfile(routingProfile), indent=4) ) @@ -145,6 +155,7 @@ class RoutingPreviewDialog(AppQDialog): layout = QVBoxLayout() layout.addWidget(self.textEditor) + layout.addWidget(self.statusBar) self.setLayout(layout) @@ -497,7 +508,7 @@ class RoutingRuleEditDialog(AppQDialog): self.setLayout(layout) def setWidthAndHeight(self): - self.setFixedSize(int(760 * GOLDEN_RATIO), 760) + self.resize(int(800 * GOLDEN_RATIO), 800) def routingRule(self): rule = { @@ -693,7 +704,7 @@ class RoutingRulesQListWidget(AppQListWidget): @QtCore.Slot(QtCore.QPoint) def handleCustomContextMenuRequested(self, point): - self.contextMenu.exec(self.mapToGlobal(point)) + self.contextMenu.exec(self.viewport().mapToGlobal(point)) class RoutingRulesDialog(AppQDialog):