diff --git a/nixview/ui/helpdialog.py b/nixview/ui/helpdialog.py index d6b5f97..130e960 100644 --- a/nixview/ui/helpdialog.py +++ b/nixview/ui/helpdialog.py @@ -1,7 +1,7 @@ import os from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QFrame, QHBoxLayout, QPushButton, QSizePolicy, QTextBrowser, QVBoxLayout, QWidget -from PyQt5.QtCore import QUrl +from PyQt5.QtCore import QUrl, QSettings import nixview.constants as cnst @@ -9,20 +9,27 @@ class HelpDialog(QDialog): def __init__(self, parent = None) -> None: super().__init__(parent=parent) - + self._settings = QSettings() + width = int(self._settings.value("help/width", 640)) + height = int(self._settings.value("help/height", 480)) + x = int(self._settings.value("help/pos_x", 100)) + y = int(self._settings.value("help/pos_y", 100)) self.setModal(True) self.setMinimumSize(500, 750) - + self.resize(width, height) + self.move(x, y) + self.finished.connect(self.on_finished) + self.help = HelpBrowser() self.help._edit.historyChanged.connect(self._on_history_changed) - self.back_btn = QPushButton(QIcon(os.path.join(cnst.ICONS_FOLDER, "back_btn")), "back") + self.back_btn = QPushButton(QIcon(":/icons/docs_back"), "back") self.back_btn.setEnabled(False) self.back_btn.clicked.connect(self.help._edit.backward) - self.home_btn = QPushButton(QIcon(os.path.join(cnst.ICONS_FOLDER, "home_btn")),"home") + self.home_btn = QPushButton(QIcon(":icons/docs_home"),"home") self.home_btn.clicked.connect(self.help._edit.home) - self.fwd_btn = QPushButton(QIcon(os.path.join(cnst.ICONS_FOLDER, "fwd_btn")),"forward") + self.fwd_btn = QPushButton(QIcon(":icons/docs_forward"),"forward") self.fwd_btn.setEnabled(False) self.fwd_btn.clicked.connect(self.help._edit.forward) @@ -48,6 +55,12 @@ class HelpDialog(QDialog): self.back_btn.setEnabled(self.help._edit.isBackwardAvailable()) self.fwd_btn.setEnabled(self.help._edit.isForwardAvailable()) + def on_finished(self): + self._settings.setValue("help/width", self.width()) + self._settings.setValue("help/height", self.height()) + self._settings.setValue("help/pos_x", self.x()) + self._settings.setValue("help/pos_y", self.y()) + class HelpBrowser(QWidget): def __init__(self, parent=None) -> None: