Exemplo n.º 1
0
    def __init_icons(self):
        # Warning
        icon = QtGui.QIcon(os.path.join(IMAGE_PATH, "warning.png"))
        self.report_btn.setIcon(icon)
        # question
        icon = QtGui.QIcon(os.path.join(IMAGE_PATH, "question.png"))
        self.help_btn.setIcon(icon)

        pixmap = QtGui.QPixmap(os.path.join(IMAGE_PATH, "miguel.png"))
        self.icon.setPixmap(pixmap)
Exemplo n.º 2
0
 def __refresh_scene_info(self, metadata_object):
     self.sceneNameLB.setText(metadata_object.scene_name)
     self.userLB.setText(metadata_object.author)
     self.dateLB.setText(metadata_object.modified)
     pixmap = metadata_object.image if metadata_object.image else None
     self.scene_image_pixmap.setPixmap(QtGui.QPixmap(pixmap))
Exemplo n.º 3
0
class ChecksUIWidget(form, base):
    """Summary
    
    Attributes:
        battery_checker_list (TYPE): Description
        rows (list): Description
    """
    CHECKNAMEICON = QtGui.QPixmap(
        os.path.join(os.path.dirname(os.path.realpath(__file__)),
                     "gui/icons/name_tag.png"))
    DESCRIPTIONICON = QtGui.QPixmap(
        os.path.join(os.path.dirname(os.path.realpath(__file__)),
                     "gui/icons/description.png"))
    LOGICON = QtGui.QPixmap(
        os.path.join(os.path.dirname(os.path.realpath(__file__)),
                     "gui/icons/log.png"))
    RUNICON = QtGui.QIcon(
        os.path.join(os.path.dirname(os.path.realpath(__file__)),
                     "gui/icons/run.png"))
    FIXICON = QtGui.QIcon(
        os.path.join(os.path.dirname(os.path.realpath(__file__)),
                     "gui/icons/fix.png"))

    def __init__(self, battery_checker_list=None):
        """Summary
        
        Args:
            battery_checker_list (TYPE): Description
        """
        super(ChecksUIWidget, self).__init__()
        self.setupUi(self)
        self.__defaultStateWindow()
        self.__connectDefaultSignals()
        self.__addTabs()

    def __connectDefaultSignals(self):
        self.runallBT.clicked.connect(self.runAll)
        self.fixallBT.clicked.connect(self.fixAll)

    def __defaultStateWindow(self):
        self.nametag_icon.setPixmap(self.CHECKNAMEICON)
        self.description_icon.setPixmap(self.DESCRIPTIONICON)
        self.log_icon.setPixmap(self.LOGICON)
        self.runallBT.setIcon(self.RUNICON)
        self.fixallBT.setIcon(self.FIXICON)

    def __addTabs(self):
        batteriesChecks = checks_configuration.ALLBATTERIES
        for battery in batteriesChecks:
            scrollArea = QtWidgets.QScrollArea()
            scrollArea.setWidgetResizable(True)
            scrollWidget = QtWidgets.QWidget()
            scrollLayout = QtWidgets.QVBoxLayout()
            scrollLayout.setSpacing(0)
            scrollLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
            scrollLayout.setContentsMargins(0, 0, 0, 0)
            for check in battery.checks:
                checkWidget = CheckWidget(check, self)
                scrollLayout.addWidget(checkWidget)
            spacer = QtWidgets.QSpacerItem(100, 20,
                                           QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
            scrollLayout.addItem(spacer)
            scrollWidget.setLayout(scrollLayout)
            scrollArea.setWidget(scrollWidget)
            self.checksTab.addTab(scrollArea, battery.name)

    def runAll(self):
        currentWidget = self.checksTab.currentWidget()
        for widget in currentWidget.findChildren(CheckWidget):
            if widget.checkObject.state == widget.checkObject.CHECK_PASSED:
                continue
            widget.runCheck()

    def fixAll(self):
        currentWidget = self.checksTab.currentWidget()
        for widget in currentWidget.findChildren(CheckWidget):
            if widget.checkObject.state == widget.checkObject.CHECK_PASSED or not widget.checkObject.fixable:
                continue
            widget.fixCheck()