Changed to central asset organization.

This commit is contained in:
jupfi 2023-08-16 13:51:03 +02:00
parent c77ecc6524
commit 8371149a43
12 changed files with 15 additions and 25 deletions

View file

@ -4,6 +4,7 @@ from PyQt6.QtWidgets import QWidget, QLabel, QLineEdit, QHBoxLayout, QSizePolicy
from PyQt6.QtGui import QIcon from PyQt6.QtGui import QIcon
from PyQt6.QtCore import Qt, pyqtSlot from PyQt6.QtCore import Qt, pyqtSlot
from nqrduck.module.module_view import ModuleView from nqrduck.module.module_view import ModuleView
from nqrduck.assets.icons import Logos
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -60,8 +61,7 @@ class BaseSpectrometerView(ModuleView):
if setting.description is not None: if setting.description is not None:
logger.debug("Adding tooltip to setting: %s", setting.name) logger.debug("Adding tooltip to setting: %s", setting.name)
self_path = Path(__file__).parent self_path = Path(__file__).parent
tooltip_icon_path = self_path / "resources/icons" / "QuestionMark_16x16.png" icon = Logos.QuestionMark_16x16()
icon = QIcon(str(tooltip_icon_path))
icon_label = QLabel() icon_label = QLabel()
icon_label.setPixmap(icon.pixmap(icon.availableSizes()[0])) icon_label.setPixmap(icon.pixmap(icon.availableSizes()[0]))
icon_label.setFixedSize(icon.availableSizes()[0]) icon_label.setFixedSize(icon.availableSizes()[0])

View file

@ -6,6 +6,7 @@ from pathlib import Path
from PyQt6.QtGui import QPixmap from PyQt6.QtGui import QPixmap
from nqrduck.contrib.mplwidget import MplWidget from nqrduck.contrib.mplwidget import MplWidget
from nqrduck.helpers.signalprocessing import SignalProcessing as sp from nqrduck.helpers.signalprocessing import SignalProcessing as sp
from nqrduck.assets.icons import PulseParamters
from .base_spectrometer_model import BaseSpectrometerModel from .base_spectrometer_model import BaseSpectrometerModel
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -174,9 +175,7 @@ class Function:
Returns: Returns:
QPixmap -- The default pixmap for every function""" QPixmap -- The default pixmap for every function"""
self_path = Path(__file__).parent pixmap = PulseParamters.TXCustom()
image_path = self_path / "resources/pulseparameter/TXCustom.png"
pixmap = QPixmap(str(image_path))
return pixmap return pixmap
@ -213,9 +212,7 @@ class RectFunction(Function):
super().__init__(expr) super().__init__(expr)
def get_pixmap(self): def get_pixmap(self):
self_path = Path(__file__).parent pixmap = PulseParamters.TXRect()
image_path = self_path / "resources/pulseparameter/TXRect.png"
pixmap = QPixmap(str(image_path))
return pixmap return pixmap
@ -230,9 +227,7 @@ class SincFunction(Function):
self.end_x = np.pi self.end_x = np.pi
def get_pixmap(self): def get_pixmap(self):
self_path = Path(__file__).parent pixmap = PulseParamters.TXSinc()
image_path = self_path / "resources/pulseparameter/TXSinc.png"
pixmap = QPixmap(str(image_path))
return pixmap return pixmap
@ -248,9 +243,7 @@ class GaussianFunction(Function):
self.end_x = np.pi self.end_x = np.pi
def get_pixmap(self): def get_pixmap(self):
self_path = Path(__file__).parent pixmap = PulseParamters.TXGauss()
image_path = self_path / "resources/pulseparameter/TXGauss.png"
pixmap = QPixmap(str(image_path))
return pixmap return pixmap
@ -357,12 +350,11 @@ class TXPulse(BaseSpectrometerModel.PulseParameter):
) )
def get_pixmap(self): def get_pixmap(self):
self_path = Path(__file__).parent
if self.get_option_by_name(self.RELATIVE_AMPLITUDE).value > 0: if self.get_option_by_name(self.RELATIVE_AMPLITUDE).value > 0:
return self.get_option_by_name(self.TX_PULSE_SHAPE).get_pixmap() return self.get_option_by_name(self.TX_PULSE_SHAPE).get_pixmap()
else: else:
image_path = self_path / "resources/pulseparameter/TXOff.png" pixmap = PulseParamters.TXOff()
pixmap = QPixmap(str(image_path))
return pixmap return pixmap
@ -373,12 +365,11 @@ class RXReadout(BaseSpectrometerModel.PulseParameter):
self.add_option(BooleanOption(self.RX, False)) self.add_option(BooleanOption(self.RX, False))
def get_pixmap(self): def get_pixmap(self):
self_path = Path(__file__).parent
if self.get_option_by_name(self.RX).value == False: if self.get_option_by_name(self.RX).value == False:
image_path = self_path / "resources/pulseparameter/RXOff.png" pixmap = PulseParamters.RXOff()
else: else:
image_path = self_path / "resources/pulseparameter/RXOn.png" pixmap = PulseParamters.RXOn()
pixmap = QPixmap(str(image_path))
return pixmap return pixmap
@ -389,10 +380,9 @@ class Gate(BaseSpectrometerModel.PulseParameter):
self.add_option(BooleanOption(self.GATE_STATE, False)) self.add_option(BooleanOption(self.GATE_STATE, False))
def get_pixmap(self): def get_pixmap(self):
self_path = Path(__file__).parent
if self.get_option_by_name(self.GATE_STATE).value == False: if self.get_option_by_name(self.GATE_STATE).value == False:
image_path = self_path / "resources/pulseparameter/GateOff.png" pixmap = PulseParamters.GateOff()
else: else:
image_path = self_path / "resources/pulseparameter/GateOn.png" pixmap = PulseParamters.GateOn()
pixmap = QPixmap(str(image_path))
return pixmap return pixmap

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B