diff --git a/pyrelacs/app.py b/pyrelacs/app.py index 790a738..bcf1cb6 100644 --- a/pyrelacs/app.py +++ b/pyrelacs/app.py @@ -10,6 +10,7 @@ import resources log = config_logging() +from . import resources # best created with pyside6-rcc resources.qrc -o resources.py (rcc produces an error...) def main(): app = QApplication(sys.argv) diff --git a/pyrelacs/icons/connect.png b/pyrelacs/icons/connect.png index 0ea0bc4..4585bef 100644 Binary files a/pyrelacs/icons/connect.png and b/pyrelacs/icons/connect.png differ diff --git a/pyrelacs/icons/disconnect.png b/pyrelacs/icons/disconnect.png index 5ffb319..f17b5a0 100644 Binary files a/pyrelacs/icons/disconnect.png and b/pyrelacs/icons/disconnect.png differ diff --git a/pyrelacs/icons/exit.png b/pyrelacs/icons/exit.png index 1be01ac..f66edf3 100644 Binary files a/pyrelacs/icons/exit.png and b/pyrelacs/icons/exit.png differ diff --git a/pyrelacs/icons/record.png b/pyrelacs/icons/record.png index 4ef1915..947bb2a 100644 Binary files a/pyrelacs/icons/record.png and b/pyrelacs/icons/record.png differ diff --git a/pyrelacs/icons/stop.png b/pyrelacs/icons/stop.png index 9b2ab09..28a9e27 100644 Binary files a/pyrelacs/icons/stop.png and b/pyrelacs/icons/stop.png differ diff --git a/pyrelacs/resources.qrc b/pyrelacs/resources.qrc index da26e63..ac1857d 100644 --- a/pyrelacs/resources.qrc +++ b/pyrelacs/resources.qrc @@ -5,5 +5,6 @@ icons/disconnect.png icons/record.png icons/stop.png + icons/relacstuxheader.png \ No newline at end of file diff --git a/pyrelacs/ui/about.py b/pyrelacs/ui/about.py index 1636d65..5ad40f7 100644 --- a/pyrelacs/ui/about.py +++ b/pyrelacs/ui/about.py @@ -1,5 +1,3 @@ -import pathlib - from PyQt6.QtGui import QPixmap from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QVBoxLayout, QWidget from PyQt6.QtCore import Qt @@ -40,8 +38,7 @@ class About(QWidget): rtd_link.setAlignment(Qt.AlignmentFlag.AlignCenter) iconlabel = QLabel() - _root = pathlib.Path(__file__).parent.parent - pixmap = QPixmap(str(pathlib.Path.joinpath(_root, "icons/relacstuxheader.png"))) + pixmap = QPixmap(":/icons/relacstuxheader.png") s = pixmap.size() new_height = int(s.height() * 300/s.width()) pixmap = pixmap.scaled(300, new_height, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.FastTransformation) diff --git a/pyrelacs/ui/mainwindow.py b/pyrelacs/ui/mainwindow.py index 153f1ef..14986d9 100644 --- a/pyrelacs/ui/mainwindow.py +++ b/pyrelacs/ui/mainwindow.py @@ -64,9 +64,7 @@ class PyRelacs(QMainWindow): self.nix_file = nix.File.open(str(filename), nix.FileMode.Overwrite) def create_actions(self): - self._rlx_exitaction = QAction( - QIcon(str(path.joinpath(_root, "icons/exit.png"))), "Exit", self - ) + self._rlx_exitaction = QAction(QIcon(":/icons/exit.png"), "Exit", self) self._rlx_exitaction.setStatusTip("Close relacs") self._rlx_exitaction.setShortcut(QKeySequence("Alt+q")) self._rlx_exitaction.triggered.connect(self.on_exit) @@ -76,27 +74,17 @@ class PyRelacs(QMainWindow): self._rlx_aboutaction.setEnabled(True) self._rlx_aboutaction.triggered.connect(self.on_about) - self._daq_connectaction = QAction( - QIcon(str(path.joinpath(_root, "icons/connect.png"))), "Connect DAQ", self - ) + self._daq_connectaction = QAction(QIcon(":icons/connect.png"), "Connect DAQ", self) self._daq_connectaction.setStatusTip("Connect to daq device") # self._daq_connectaction.setShortcut(QKeySequence("Alt+d")) self._daq_connectaction.triggered.connect(self.connect_dac) - self._daq_disconnectaction = QAction( - QIcon(str(path.joinpath(_root, "icons/disconnect.png"))), - "Disconnect DAQ", - self, - ) + self._daq_disconnectaction = QAction(QIcon(":/icons/disconnect.png"), "Disconnect DAQ", self) self._daq_disconnectaction.setStatusTip("Disconnect the DAQ device") # self._daq_connectaction.setShortcut(QKeySequence("Alt+d")) self._daq_disconnectaction.triggered.connect(self.disconnect_dac) - self._daq_calibaction = QAction( - QIcon(str(path.joinpath(_root, "icons/calibration.png"))), - "Plot calibration", - self, - ) + self._daq_calibaction = QAction(QIcon(":/icons/calibration.png"), "Plot calibration", self) self._daq_calibaction.setStatusTip("Calibrate the attenuator device") # self._daq_calibaction.setShortcut(QKeySequence("Alt+d")) self._daq_calibaction.triggered.connect(self.plot_calibration)