Example #1
0
    def _setup_ui(self):
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        layout = QGridLayout(self)
        self.setLayout(layout)
        layout.setMargin(1)
        layout.setHorizontalSpacing(10)
        layout.setVerticalSpacing(1)

        self._create_header('MONITOR', layout, 0)
        self._mon_temp = self._create_meas('TEMP', layout, 1, 0, True)
        self._vccint = self._create_meas('VCCINT', layout, 2, 0, False)
        self._vccaux = self._create_meas('VCCAUX', layout, 3, 0, False)
        self._p3v3io = self._create_meas('+3V3IO', layout, 4, 0, False)

        self._create_header('AGC', layout, 2)
        self._agc_temp = self._create_meas('TEMP', layout, 1, 2, True)
        self._bplssw = self._create_meas('BPLSSW', layout, 2, 2, False)
        self._p4sw = self._create_meas('+4SW', layout, 3, 2, False)

        label = QLabel('MEASUREMENTS', self)
        font = label.font()
        font.setPointSize(12)
        font.setBold(True)
        label.setFont(font)
        label.setAlignment(Qt.AlignCenter)
        layout.addWidget(label, 4, 2, 1, 2, Qt.AlignRight)
Example #2
0
class StatisticsPanel(QWidget):
    _MAX_STAT_ROW = 3

    def __init__(self, parent: QWidget = None):
        super().__init__(parent)
        self.spinner = QtWaitingSpinner(parent=self, centerOnParent=True,
                                        disableParentWhenSpinning=True)

        self.spinner.setInnerRadius(15)
        self.layout = QGridLayout()
        self.layout.setHorizontalSpacing(2)
        self.layout.setVerticalSpacing(4)
        self.setLayout(self.layout)

    def setStatistics(self, stat: Dict[str, object]) -> None:
        item: QLayoutItem = self.layout.takeAt(0)
        while item:
            item.widget().deleteLater()
            self.layout.removeItem(item)
            item = self.layout.takeAt(0)
        r: int = 0
        c: int = 0
        for k, v in stat.items():
            self.layout.addWidget(QLabel('{}:'.format(k), self), r, c, 1, 1,
                                  alignment=Qt.AlignLeft)
            self.layout.addWidget(QLabel('{}'.format(str(v)), self), r, c + 1, 1, 1,
                                  alignment=Qt.AlignLeft)
            r += 1
            if r % StatisticsPanel._MAX_STAT_ROW == 0:
                self.layout.setColumnMinimumWidth(c + 2, 5)  # separator
                c += 3
                r = 0
Example #3
0
    def __init__(self):
        super().__init__()

        self._squares = [[SquareView((i, j)) for j in range(20)]
                         for i in range(20)]
        self._board_size = 20

        # Setup the layout
        layout = QGridLayout()
        layout.setHorizontalSpacing(2)
        layout.setVerticalSpacing(2)

        for i in range(self._board_size):
            # Row numbers decreasing
            row_label = Label("row", str(self._board_size - i))
            # TODO: Get alignment in styles/styles.qss
            row_label.setAlignment(Qt.AlignRight)
            layout.addWidget(row_label, i, 0)

            for j in range(self._board_size):
                layout.addWidget(self.squares[i][j], i, j + 1)

        # Column labels
        for i in range(self._board_size):
            col_label = Label("column", chr(i + ord("a")))
            # TODO: Get alignment in styles/styles.qss
            col_label.setAlignment(Qt.AlignHCenter)
            layout.addWidget(col_label, self._board_size, i + 1)

        self.setLayout(layout)
Example #4
0
    def initUI(self):
        grid = QGridLayout()
        grid.setHorizontalSpacing(2)
        grid.setVerticalSpacing(2)
        # Reference
        # https://stackoverflow.com/questions/16673074/how-can-i-fully-disable-resizing-a-window-including-the-resize-icon-when-the-mou
        grid.setSizeConstraint(QLayout.SetFixedSize)
        self.setLayout(grid)

        # This is register
        self.ent = Register()

        # This is display value of register
        self.lcd = QLCDNumber(self)
        self.lcd.setDigitCount(self.max_chars + 2)
        self.lcd.setSmallDecimalPoint(True)
        self.lcd.display(self.ent.get_text())
        self.lcd.setStyleSheet("QLCDNumber {color:darkgreen;}")
        self.lcd.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        grid.addWidget(self.lcd, 0, 0, 1, 4)
        grid.setRowMinimumHeight(0, 40)

        for key in self.keys_info:
            but = QPushButton(key['label'])
            method_name = key['method']
            method = getattr(self, method_name)
            but.clicked.connect(method)
            but.setStyleSheet(
                "QPushButton {font-size:12pt; padding:5px 30px; color:#666;}")
            but.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
            grid.addWidget(but, key['y'], key['x'], key['h'], key['w'])
Example #5
0
class QConditionsWidget(QFrame):
    """
    UI Component to display Turn Number, Day Time & Hour and weather combined.
    """
    def __init__(self):
        super(QConditionsWidget, self).__init__()
        self.setProperty("style", "QConditionsWidget")

        self.layout = QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setHorizontalSpacing(0)
        self.layout.setVerticalSpacing(0)
        self.setLayout(self.layout)

        self.time_turn_widget = QTimeTurnWidget()
        self.time_turn_widget.setStyleSheet("QGroupBox { margin-right: 0px; }")
        self.layout.addWidget(self.time_turn_widget, 0, 0)

        self.weather_widget = QWeatherWidget()
        self.weather_widget.setStyleSheet(
            "QGroupBox { margin-top: 5px; margin-left: 0px; border-left: 0px; }"
        )
        self.weather_widget.hide()
        self.layout.addWidget(self.weather_widget, 0, 1)

    def setCurrentTurn(self, turn: int, conditions: Conditions) -> None:
        """Sets the turn information display.

        :arg turn Current turn number.
        :arg conditions Current time and weather conditions.
        """
        self.time_turn_widget.setCurrentTurn(turn, conditions)
        self.weather_widget.setCurrentTurn(turn, conditions)
        self.weather_widget.show()
Example #6
0
    def __init__(self, parent, data):
        super(SegmentsWidget, self).__init__(parent)

        layout = QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setVerticalSpacing(1)
        layout.setHorizontalSpacing(
            UIContext.getScaledWindowSize(16, 16).width())

        self.segments = []
        for segment in data.segments:
            if segment.readable or segment.writable or segment.executable:
                self.segments.append(segment)
        self.segments.sort(key=lambda segment: segment.start)

        row = 0
        for segment in self.segments:
            begin = "0x%x" % segment.start
            end = "0x%x" % segment.end

            permissions = ""
            if segment.readable:
                permissions += "r"
            else:
                permissions += "-"
            if segment.writable:
                permissions += "w"
            else:
                permissions += "-"
            if segment.executable:
                permissions += "x"
            else:
                permissions += "-"

            rangeLayout = QHBoxLayout()
            rangeLayout.setContentsMargins(0, 0, 0, 0)
            beginLabel = headers.ClickableAddressLabel(begin)
            dashLabel = QLabel("-")
            dashLabel.setFont(binaryninjaui.getMonospaceFont(self))
            endLabel = headers.ClickableAddressLabel(end)
            rangeLayout.addWidget(beginLabel)
            rangeLayout.addWidget(dashLabel)
            rangeLayout.addWidget(endLabel)
            layout.addLayout(rangeLayout, row, 0)

            permissionsLabel = QLabel(permissions)
            permissionsLabel.setFont(binaryninjaui.getMonospaceFont(self))
            layout.addWidget(permissionsLabel, row, 1)

            row += 1

        layout.setColumnStretch(2, 1)
        self.setLayout(layout)
Example #7
0
 def _create_cells(self) -> Tuple[QWidget, List[List[FE14MapCell]]]:
     widget = QWidget(parent=self)
     layout = QGridLayout()
     cells = []
     for r in range(0, 32):
         row = []
         for c in range(0, 32):
             cell = self._create_cell(r, c)
             layout.addWidget(cell, r, c)
             row.append(cell)
         cells.append(row)
     layout.setVerticalSpacing(0)
     layout.setHorizontalSpacing(0)
     widget.setLayout(layout)
     return widget, cells
Example #8
0
    def __init__(self, parent=None):
        super().__init__(parent=parent)

        # Create layout
        layout = QGridLayout()
        layout.setHorizontalSpacing(0)
        layout.setVerticalSpacing(0)

        self.letters = {}

        for letter, (i, j) in self.letter_positions.items():
            self.letters[letter] = UsedLetter(letter)
            layout.addWidget(self.letters[letter], i, j)

        self.setLayout(layout)
Example #9
0
    def buildRightDataDisplays(self):
        grid = QGridLayout()

        for index, display in enumerate(constants.RIGHT_DATA_DISPLAYS):
            units = display['units'] if 'units' in display else ''
            widget = QSmallDataDisplay(self, display['label'], units)

            self.dataDisplays[display['field']] = widget
            grid.addWidget(widget,
                           int(index / constants.RIGHT_DATA_DISPLAYS_PER_ROW),
                           index % constants.RIGHT_DATA_DISPLAYS_PER_ROW)

        grid.setHorizontalSpacing(1)
        grid.setVerticalSpacing(1)

        return grid
Example #10
0
	def __init__(self, parent, header):
		super(HeaderWidget, self).__init__(parent)
		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(1)
		row = 0
		col = 0
		for field in header.fields:
			name = field[0]
			value = field[1]
			fieldType = ""
			if len(field) > 2:
				fieldType = field[2]
			layout.addWidget(QLabel(name + ": "), row, col * 3)
			if isinstance(value, list):
				for i in range(0, len(value)):
					if fieldType == "ptr":
						label = ClickableAddressLabel(value[i])
					elif fieldType == "code":
						label = ClickableCodeLabel(value[i])
					else:
						label = QLabel(value[i])
						label.setFont(binaryninjaui.getMonospaceFont(self))
					layout.addWidget(label, row, col * 3 + 1)
					row += 1
			else:
				if fieldType == "ptr":
					label = ClickableAddressLabel(value)
				elif fieldType == "code":
					label = ClickableCodeLabel(value)
				else:
					label = QLabel(value)
					label.setFont(binaryninjaui.getMonospaceFont(self))
				layout.addWidget(label, row, col * 3 + 1)
				row += 1
			if (header.columns > 1) and (row >= header.rows_per_column) and ((col + 1) < header.columns):
				row = 0
				col += 1
		for col in range(1, header.columns):
			layout.setColumnMinimumWidth(col * 3 - 1, UIContext.getScaledWindowSize(20, 20).width())
		layout.setColumnStretch(header.columns * 3 - 1, 1)
		self.setLayout(layout)
Example #11
0
class PuzzleGrid(QWidget):
    def __init__(self, parent=None, **kwargs):
        super().__init__(parent=parent, **kwargs)

        # Create layout
        self.layout = QGridLayout()
        self.layout.setHorizontalSpacing(0)
        self.layout.setVerticalSpacing(0)

        self.tiles = []
        for v in range(TILES_VERTICAL):
            for h in range(TILES_HORIZONTAL):
                tile = Tile(parent=self)
                self.tiles.append(tile)
                self.layout.addWidget(tile, v, h, 1, 1)

        self.setLayout(self.layout)

    def loadPuzzle(self, puzzle):
        i = 0
        for row in puzzle:
            for letter in row:
                self.tiles[i].setLetter(letter)
                i += 1

    def reveal(self, letter=None):
        revealed = 0
        for tile in self.tiles:
            if letter is None or tile.text() == letter.upper():
                tile.reveal()
                revealed += 1
        return revealed

    def hide(self, letter):
        for tile in self.tiles:
            if tile.text() == letter.upper():
                tile.hide()

    def clear(self):
        for tile in self.tiles:
            tile.setLetter(None)
Example #12
0
    def initPixelInfoLayout(self):
        layout = QGridLayout()
        layout.setColumnStretch(3, 9)
        layout.setVerticalSpacing(0)
        layout.setHorizontalSpacing(20)

        self.pixelXY1Label = QLabel()
        self.pixelXY2Label = QLabel()
        self.pixelIndex1Label = QLabel()
        self.pixelIndex2Label = QLabel()
        self.pixelColor1Label = QLabel()
        self.pixelColor2Label = QLabel()

        layout.addWidget(self.pixelXY1Label,
                         0,
                         0,
                         alignment=Qt.AlignLeft | Qt.AlignTop)
        layout.addWidget(self.pixelXY2Label,
                         1,
                         0,
                         alignment=Qt.AlignLeft | Qt.AlignTop)
        layout.addWidget(self.pixelIndex1Label,
                         0,
                         1,
                         alignment=Qt.AlignLeft | Qt.AlignTop)
        layout.addWidget(self.pixelIndex2Label,
                         1,
                         1,
                         alignment=Qt.AlignLeft | Qt.AlignTop)
        layout.addWidget(self.pixelColor1Label,
                         0,
                         2,
                         alignment=Qt.AlignLeft | Qt.AlignTop)
        layout.addWidget(self.pixelColor2Label,
                         1,
                         2,
                         alignment=Qt.AlignLeft | Qt.AlignTop)

        return layout
Example #13
0
 def generate_layout(self):
     layout = QGridLayout()
     layout.setMargin(7)
     layout.setHorizontalSpacing(7)
     layout.setVerticalSpacing(7)
     inner_layouts = []
     for row, col in itertools.product(range(3), range(3)):
         inner_layout = QGridLayout()
         inner_layout.setMargin(0)
         inner_layout.setHorizontalSpacing(3)
         inner_layout.setVerticalSpacing(3)
         inner_layouts.append(inner_layout)
         layout.addLayout(inner_layout, row, col)
     for cell in range(len(self.cells)):
         row = int(cell / 9)
         col = int(cell % 9)
         band = int(row / 3)
         stack = int(col / 3)
         box = int(band * 3 + stack)
         minirow = int(row % 3)
         minicol = int(col % 3)
         inner_layouts[box].addWidget(self.cells[cell], minirow, minicol)
     self.setLayout(layout)
Example #14
0
    def __init__(self):
        super().__init__()

        self.setTitle("Dernière détection")

        self._image_label = QLabel()
        self._image_label.setAlignment(Qt.AlignCenter)
        self._image_label.setObjectName("image")

        self._filename_label = QLabel()
        self._filename_label.setAlignment(Qt.AlignCenter)

        main_layout = QGridLayout(self)
        main_layout.addWidget(self._image_label, 0, 0)
        main_layout.addWidget(self._filename_label, 1, 0)

        main_layout.setRowStretch(0, 1)
        main_layout.setVerticalSpacing(10)

        self.setLayout(main_layout)

        self._highlight_detections_thread = DrawDetectionsThread()
        self._highlight_detections_thread.imageLoadedSignal.connect(
            self._highlightedImageReceived)
Example #15
0
class CentralWidgetOverview(QWidget):
    """
    CentralWidget of MainWindow
    """

    __selected_stylesheet = ("QPushButton {"
                           "border: 1px solid #adadad;"
                           "background-color: #ffffff;"
                           "padding-top: 3px;"
                           "padding-bottom: 3px;"
                           "border-top-left-radius:5px;"
                           "border-top-right-radius:5px;"
                           "}"
                           "QPushButton:hover {"
                           "border: 1px solid #0078d7;"
                           "background-color: #e5f1fb;"
                           "}")

    __normal_stylesheet = ("QPushButton {"
                           "border: 1px solid #adadad;"
                           "background-color: #D9D9DA;"
                           "padding-top: 3px;"
                           "padding-bottom: 3px;"
                           "border-top-left-radius:5px;"
                           "border-top-right-radius:5px;"
                           "}"
                           "QPushButton:hover {"
                           "border: 1px solid #0078d7;"
                           "background-color: #e5f1fb;"
                           "}")
    current_datatype = datatypes.Raum
    instance = None

    def __init__(self, data_handler, get_overview_funct, current_datatype=None):
        super(CentralWidgetOverview, self).__init__()
        CentralWidgetOverview.set_instance(self)

        self.data_handler = data_handler
        self.get_overview_funct = get_overview_funct
        self.current_overview = None

        if not (current_datatype is None):
            CentralWidgetOverview.set_current_datatype(current_datatype)

        # tabs
        self.tab_raeume = QPushButton("Räume")
        self.tab_aufsichtspersonen = QPushButton("Aufsichtspersonen")
        self.tab_pruefungen = QPushButton("Prüfungen")

        self.tab_raeume.clicked.connect(lambda: self.update_current_datatype(datatypes.Raum))
        self.tab_aufsichtspersonen.clicked.connect(lambda: self.update_current_datatype(datatypes.Aufsichtsperson))
        self.tab_pruefungen.clicked.connect(lambda: self.update_current_datatype(datatypes.Pruefung))

        self.tab_raeume.setStyleSheet(self.__normal_stylesheet)
        self.tab_aufsichtspersonen.setStyleSheet(self.__normal_stylesheet)
        self.tab_pruefungen.setStyleSheet(self.__normal_stylesheet)


        #layout
        self.grid_layout = QGridLayout()
        self.setLayout(self.grid_layout)

        self.grid_layout.setHorizontalSpacing(0)
        self.grid_layout.setVerticalSpacing(0)

        self.grid_layout.addWidget(self.tab_raeume,0,0)
        self.grid_layout.addWidget(self.tab_aufsichtspersonen,0,1)
        self.grid_layout.addWidget(self.tab_pruefungen,0,2)
        self.grid_layout.setMargin(0)

        #overview
        self.update_current_datatype(CentralWidgetOverview.get_current_datatype(), force_update=True)

        # add update listener
        data_handler.add_update_listener(self.data_updated)



    def data_updated(self, datatype):
        """
        called when data updated
        :param datatype: class of datatypes.py
        :return:
        """
        if CentralWidgetOverview.get_current_datatype() == datatype:
            # remove old overview
            if self.current_overview != None:
                self.grid_layout.removeWidget(self.current_overview)
                self.current_overview.deleteLater()

            self.set_current_overview()
        else:
            self.update_current_datatype(datatype)


    def update_current_datatype(self, datatype, force_update = False):
        """
        updates the widget based on datatype
        :param datatype: class of datatypes.py
        :return: None
        """
        if CentralWidgetOverview.get_current_datatype() != datatype or force_update:
            # update button paletts
            if CentralWidgetOverview.get_current_datatype() == datatypes.Raum:
                self.tab_raeume.setStyleSheet(self.__normal_stylesheet)
            elif CentralWidgetOverview.get_current_datatype() == datatypes.Aufsichtsperson:
                self.tab_aufsichtspersonen.setStyleSheet(self.__normal_stylesheet)
            elif CentralWidgetOverview.get_current_datatype() == datatypes.Pruefung:
                self.tab_pruefungen.setStyleSheet(self.__normal_stylesheet)

            if datatype == datatypes.Raum:
                self.tab_raeume.setStyleSheet(self.__selected_stylesheet)
            elif datatype == datatypes.Aufsichtsperson:
                self.tab_aufsichtspersonen.setStyleSheet(self.__selected_stylesheet)
            elif datatype == datatypes.Pruefung:
                self.tab_pruefungen.setStyleSheet(self.__selected_stylesheet)

            #remove old overview
            if self.current_overview != None:
                self.grid_layout.removeWidget(self.current_overview)
                self.current_overview.deleteLater()

            #update overview
            CentralWidgetOverview.set_current_datatype(datatype)
            self.set_current_overview()

    def set_current_overview(self):
        """
        sets the overview and adds it to layout
        :return: None
        """
        self.current_overview = self.get_overview_funct(self.data_handler, CentralWidgetOverview.get_current_datatype(), self)
        self.grid_layout.addWidget(self.current_overview,1,0,1,6)

    def paintEvent(self, event:QPaintEvent):
        """
        draws background
        :param event:
        :return: None
        """
        color = QColor(240,240,240)
        white = QColor(255,255,255)
        custom_painter = QPainter(self)
        custom_painter.fillRect(self.rect(), white)

    @staticmethod
    def set_current_datatype(datatype):
        CentralWidgetOverview.current_datatype = datatype
    @staticmethod
    def get_current_datatype():
        return CentralWidgetOverview.current_datatype


    @staticmethod
    def set_instance(instance):
        CentralWidgetOverview.instance = instance
    @staticmethod
    def get_instance():
        return CentralWidgetOverview.instance
Example #16
0
    def __init__(self):
        super().__init__()
        screenRect = QApplication.primaryScreen().geometry()
        screenHeight = screenRect.height() * 2 / 3
        screenWidth = screenRect.width() * 3 / 4
        self.resize(screenWidth, screenHeight)
        self.setWindowTitle('Anime4K画质扩展')
        self.showMaximized()
        self.videoPath = ''
        self.outputPath = ''
        self.videoWidth = 0
        self.videoHeight = 0
        # self.scaleSize = QSize(self.videoWidth * 1.5, self.videoHeight * 1.5)
        self.duration = 0
        self.videoPos = 0
        self.gpuMode = ''
        self.acnetMode = ''
        self.hdnMode = ''
        self.processing = [False for _ in range(10)]  # 5种预处理 + 5种后处理

        layout = QGridLayout()
        self.setLayout(layout)

        self.previewTab = QTabWidget()
        layout.addWidget(self.previewTab, 0, 0, 4, 3)

        # self.preview = QLabel('效果预览')
        # self.preview.setFixedSize(screenWidth * 4 / 5, screenWidth * 9 / 20)
        #
        # self.preview.setScaledContents(True)
        # self.preview.setAlignment(Qt.AlignCenter)
        # self.preview.setStyleSheet("QLabel{background:white;}")
        self.preview = ImageWithMouseControl('')
        previewWidget = QWidget()
        previewWidgetLayout = QGridLayout()
        previewWidget.setLayout(previewWidgetLayout)
        previewWidgetLayout.addWidget(self.preview)
        self.previewTab.addTab(previewWidget, '预览')

        compareWidget = QWidget()
        compareLayout = QHBoxLayout()
        compareWidget.setLayout(compareLayout)
        self.originPreview = ImageWithMouseControl('')
        self.scaledPreview = ImageWithMouseControl('')
        self.originPreview.wheelSignal.connect(self.scaledReciveWheelEvent)
        self.originPreview.moveSignal.connect(self.scaledReciveMoveEvent)
        self.scaledPreview.wheelSignal.connect(self.originReciveWheelEvent)
        self.scaledPreview.moveSignal.connect(self.originReciveMoveEvent)
        compareLayout.addWidget(self.originPreview)
        compareLayout.addWidget(self.scaledPreview)
        self.previewTab.addTab(compareWidget, '对比')
        self.previewTab.setCurrentIndex(1)
        self.point = ''

        self.previewSlider = Slider()
        self.previewSlider.setOrientation(Qt.Horizontal)
        self.previewSlider.setMinimum(0)
        self.previewSlider.setMaximum(1000)
        self.previewSlider.pointClicked.connect(self.setPreviewSlider)
        layout.addWidget(self.previewSlider, 4, 0, 1, 3)

        optionWidget = QWidget()
        layout.addWidget(optionWidget, 0, 3, 5, 1)
        optionLayout = QGridLayout()
        optionLayout.setVerticalSpacing(screenHeight / 15)
        optionWidget.setLayout(optionLayout)

        optionLayout.addWidget(QLabel(), 0, 0, 1, 1)
        self.videoPathButton = QPushButton('选择视频')
        self.videoPathButton.clicked.connect(self.selectVideo)
        optionLayout.addWidget(self.videoPathButton, 1, 0, 1, 1)
        self.videoPathEdit = QLineEdit()
        optionLayout.addWidget(self.videoPathEdit, 1, 1, 1, 5)
        self.outputPathButton = QPushButton('输出路径')
        self.outputPathButton.clicked.connect(self.setSavePath)
        optionLayout.addWidget(self.outputPathButton, 2, 0, 1, 1)
        self.outputPathEdit = QLineEdit()
        optionLayout.addWidget(self.outputPathEdit, 2, 1, 1, 5)

        optionLayout.addWidget(label('处理次数'), 3, 0, 1, 1)
        self.passes = QComboBox()
        self.passes.addItems([str(i) for i in range(1, 6)])
        self.passes.setCurrentIndex(1)
        optionLayout.addWidget(self.passes, 3, 1, 1, 1)

        optionLayout.addWidget(label('细化边缘'), 3, 2, 1, 1)
        self.strengthColor = QComboBox()
        self.strengthColor.addItems([str(i) for i in range(11)])
        self.strengthColor.setCurrentIndex(3)
        optionLayout.addWidget(self.strengthColor, 3, 3, 1, 1)

        optionLayout.addWidget(label('细化次数'), 3, 4, 1, 1)
        self.pushColorCount = QComboBox()
        self.pushColorCount.addItems([str(i) for i in range(1, 6)])
        self.pushColorCount.setCurrentIndex(1)
        optionLayout.addWidget(self.pushColorCount, 3, 5, 1, 1)

        optionLayout.addWidget(label('锐化程度'), 4, 0, 1, 1)
        self.strengthGradient = QComboBox()
        self.strengthGradient.addItems([str(i) for i in range(11)])
        self.strengthGradient.setCurrentIndex(10)
        optionLayout.addWidget(self.strengthGradient, 4, 1, 1, 1)

        optionLayout.addWidget(label('放大倍数'), 4, 2, 1, 1)
        self.zoomFactor = QComboBox()
        self.zoomFactor.addItems([str(i * 0.5) for i in range(3, 9)])
        self.zoomFactor.setCurrentIndex(1)
        self.zoomFactor.currentIndexChanged.connect(self.setTip)
        optionLayout.addWidget(self.zoomFactor, 4, 3, 1, 1)

        optionLayout.addWidget(label('快速模式'), 4, 4, 1, 1)
        self.fastMode = QComboBox()
        self.fastMode.addItems(['关闭', '开启'])
        optionLayout.addWidget(self.fastMode, 4, 5, 1, 1)

        preProcessingLabel = QLabel('预处理')
        preProcessingLabel.setAlignment(Qt.AlignCenter)
        optionLayout.addWidget(preProcessingLabel, 5, 0, 1, 1)
        preMedianBlur = pushButton('中性模糊')
        preMedianBlur.clicked.connect(lambda: self.setProcessing(0))
        optionLayout.addWidget(preMedianBlur, 5, 1, 1, 1)
        preMeanBlur = pushButton('平均模糊')
        preMeanBlur.clicked.connect(lambda: self.setProcessing(1))
        optionLayout.addWidget(preMeanBlur, 5, 2, 1, 1)
        preCAS = pushButton('CAS锐化')
        preCAS.clicked.connect(lambda: self.setProcessing(2))
        optionLayout.addWidget(preCAS, 5, 3, 1, 1)
        preGaussianBlur = pushButton('高斯模糊')
        preGaussianBlur.clicked.connect(lambda: self.setProcessing(3))
        optionLayout.addWidget(preGaussianBlur, 5, 4, 1, 1)
        preBilateralFilter = pushButton('双向过滤')
        preBilateralFilter.clicked.connect(lambda: self.setProcessing(4))
        optionLayout.addWidget(preBilateralFilter, 5, 5, 1, 1)

        postProcessingLabel = QLabel('后处理')
        postProcessingLabel.setAlignment(Qt.AlignCenter)
        optionLayout.addWidget(postProcessingLabel, 6, 0, 1, 1)
        postMedianBlur = pushButton('中性模糊')
        postMedianBlur.clicked.connect(lambda: self.setProcessing(5))
        optionLayout.addWidget(postMedianBlur, 6, 1, 1, 1)
        postMeanBlur = pushButton('平均模糊')
        postMeanBlur.clicked.connect(lambda: self.setProcessing(6))
        optionLayout.addWidget(postMeanBlur, 6, 2, 1, 1)
        postCAS = pushButton('CAS锐化')
        postCAS.clicked.connect(lambda: self.setProcessing(7))
        optionLayout.addWidget(postCAS, 6, 3, 1, 1)
        postGaussianBlur = pushButton('高斯模糊')
        postGaussianBlur.clicked.connect(lambda: self.setProcessing(8))
        optionLayout.addWidget(postGaussianBlur, 6, 4, 1, 1)
        postBilateralFilter = pushButton('双向过滤')
        postBilateralFilter.clicked.connect(lambda: self.setProcessing(9))
        optionLayout.addWidget(postBilateralFilter, 6, 5, 1, 1)

        self.decoder = pushButton('GPU加速')
        self.decoder.clicked.connect(self.setGPUMode)
        optionLayout.addWidget(self.decoder, 7, 0, 1, 2)
        self.acnet = pushButton('开启ACNet')
        self.acnet.clicked.connect(self.setACNetMode)
        optionLayout.addWidget(self.acnet, 7, 2, 1, 2)
        self.hdn = pushButton('HDN模式')
        self.hdn.setEnabled(False)
        self.hdn.clicked.connect(self.setHDNMode)
        optionLayout.addWidget(self.hdn, 7, 4, 1, 2)

        threadsLabel = QLabel('线程数')
        threadsLabel.setAlignment(Qt.AlignCenter)
        optionLayout.addWidget(threadsLabel, 8, 0, 1, 1)
        self.threads = QComboBox()
        cpuCount = psutil.cpu_count()
        self.threads.addItems([str(i) for i in range(1, cpuCount + 1)])
        self.threads.setCurrentIndex(cpuCount - 1)
        optionLayout.addWidget(self.threads, 8, 1, 1, 1)

        zoom = float(self.zoomFactor.currentText())
        self.tipLabel = label('扩展后视频分辨率:%d x %d' % (self.videoWidth * zoom, self.videoHeight * zoom))
        optionLayout.addWidget(self.tipLabel, 8, 2, 1, 4)

        self.startButton = QPushButton('开始扩展')
        self.startButton.setStyleSheet('background-color:#3daee9')
        self.startButton.clicked.connect(self.expandVideo)
        self.startButton.setFixedHeight(75)
        optionLayout.addWidget(self.startButton, 9, 0, 2, 6)

        self.args = {'videoPath': self.videoPathEdit.text(), 'outputPath': self.outputPathEdit.text(),
                     'passes': self.passes.currentText(), 'pushColorCount': self.pushColorCount.currentText(),
                     'strengthColor': str(self.strengthColor.currentIndex() / 10), 'strengthGradient': str(self.strengthGradient.currentIndex() / 10),
                     'zoomFactor': self.zoomFactor.currentText(), 'fastMode': '' if self.fastMode.currentIndex() == 0 else '-f',
                     'preProcessing': self.processing[:5], 'postProcessing': self.processing[5:], 'gpuMode': self.gpuMode,
                     'ACNet': self.acnetMode, 'hdnMode': self.hdnMode, 'position': self.videoPos}

        self.timer = QTimer()
        self.timer.setInterval(50)
        self.timer.timeout.connect(self.collectArgs)
        self.timer.start()
Example #17
0
    def __init__(self, parent, data):
        super(SectionsWidget, self).__init__(parent)

        layout = QGridLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setVerticalSpacing(1)
        layout.setHorizontalSpacing(
            UIContext.getScaledWindowSize(16, 16).width())

        maxNameLen = 0
        for section in data.sections.values():
            if len(section.name) > maxNameLen:
                maxNameLen = len(section.name)
        if maxNameLen > 32:
            maxNameLen = 32

        self.sections = []
        for section in data.sections.values():
            if section.semantics != SectionSemantics.ExternalSectionSemantics:
                self.sections.append(section)
        self.sections.sort(key=lambda section: section.start)

        row = 0
        for section in self.sections:
            name = section.name
            if len(name) > maxNameLen:
                name = name[:maxNameLen - 1] + "…"

            begin = "0x%x" % section.start
            end = "0x%x" % section.end
            typeName = section.type

            permissions = ""
            if data.is_offset_readable(section.start):
                permissions += "r"
            else:
                permissions += "-"
            if data.is_offset_writable(section.start):
                permissions += "w"
            else:
                permissions += "-"
            if data.is_offset_executable(section.start):
                permissions += "x"
            else:
                permissions += "-"

            semantics = ""
            if section.semantics == SectionSemantics.ReadOnlyCodeSectionSemantics:
                semantics = "Code"
            elif section.semantics == SectionSemantics.ReadOnlyDataSectionSemantics:
                semantics = "Ready-only Data"
            elif section.semantics == SectionSemantics.ReadWriteDataSectionSemantics:
                semantics = "Writable Data"

            nameLabel = QLabel(name)
            nameLabel.setFont(binaryninjaui.getMonospaceFont(self))
            layout.addWidget(nameLabel, row, 0)

            rangeLayout = QHBoxLayout()
            rangeLayout.setContentsMargins(0, 0, 0, 0)
            beginLabel = headers.ClickableAddressLabel(begin)
            dashLabel = QLabel("-")
            dashLabel.setFont(binaryninjaui.getMonospaceFont(self))
            endLabel = headers.ClickableAddressLabel(end)
            rangeLayout.addWidget(beginLabel)
            rangeLayout.addWidget(dashLabel)
            rangeLayout.addWidget(endLabel)
            layout.addLayout(rangeLayout, row, 1)

            permissionsLabel = QLabel(permissions)
            permissionsLabel.setFont(binaryninjaui.getMonospaceFont(self))
            layout.addWidget(permissionsLabel, row, 2)
            typeLabel = QLabel(typeName)
            typeLabel.setFont(binaryninjaui.getMonospaceFont(self))
            layout.addWidget(typeLabel, row, 3)
            semanticsLabel = QLabel(semantics)
            semanticsLabel.setFont(binaryninjaui.getMonospaceFont(self))
            layout.addWidget(semanticsLabel, row, 4)

            row += 1

        layout.setColumnStretch(5, 1)
        self.setLayout(layout)
Example #18
0
    def __init__(self):
        super(NumberConversion, self).__init__()

        # App attributes
        self.bin_format_base = None
        self.bin_format_base_byte = None

        # Use language settings
        self.ml = ManageLng()

        main_layout = QGridLayout()
        self.setLayout(main_layout)

        # Input
        self.inputbox = QGroupBox(
            self.ml.get_tr_text("tab_num_conv_inputbox_gbox_name"))
        self.inputbox.setMaximumWidth(400)

        main_layout.addWidget(self.inputbox, 0, 0)

        inputbox_layout = QGridLayout()
        inputbox_layout.setHorizontalSpacing(25)
        inputbox_layout.setVerticalSpacing(35)
        inputbox_layout.setAlignment(Qt.AlignCenter)

        self.inputbox.setLayout(inputbox_layout)

        self.input_number_label = QLabel(
            self.ml.get_tr_text("tab_num_conv_inputbox_in_number_lab"))
        self.input_number_textfield = QLineEdit()
        self.input_number_textfield.setPlaceholderText("192")
        self.input_number_textfield.setAlignment(Qt.AlignCenter)
        self.input_number_textfield.returnPressed.connect(self.convert_action)

        inputbox_layout.addWidget(self.input_number_label,
                                  0,
                                  0,
                                  alignment=Qt.AlignCenter)
        inputbox_layout.addWidget(self.input_number_textfield, 0, 1)

        button_layout = QVBoxLayout()
        self.bin_button = QRadioButton(
            self.ml.get_tr_text("tab_num_conv_inputbox_bin_chkbox"))
        self.bin_button.clicked.connect(
            lambda: self.input_number_textfield.setPlaceholderText("11100010"))
        self.dec_button = QRadioButton(
            self.ml.get_tr_text("tab_num_conv_inputbox_dec_chkbox"))
        self.dec_button.clicked.connect(
            lambda: self.input_number_textfield.setPlaceholderText("192"))
        self.hex_button = QRadioButton(
            self.ml.get_tr_text("tab_num_conv_inputbox_hex_chkbox"))
        self.hex_button.clicked.connect(
            lambda: self.input_number_textfield.setPlaceholderText("FF"))
        self.dec_button.setChecked(True)
        button_layout.addWidget(self.bin_button)
        button_layout.addWidget(self.dec_button)
        button_layout.addWidget(self.hex_button)
        inputbox_layout.addLayout(button_layout, 0, 3, 1, 2)

        self.convert_button = QPushButton(
            self.ml.get_tr_text("tab_num_conv_inputbox_conv_btn"))
        self.convert_button.clicked.connect(self.convert_action)
        self.convert_button.setIcon(QIcon("static/images/exchange.png"))
        inputbox_layout.addWidget(self.convert_button,
                                  1,
                                  1,
                                  alignment=Qt.AlignCenter)

        # Output
        self.outputbox = QGroupBox(
            self.ml.get_tr_text("tab_num_conv_outputbox_gbox_name"))
        main_layout.addWidget(self.outputbox, 0, 1)
        outputbox_layout = QGridLayout()
        outputbox_layout.setHorizontalSpacing(25)
        self.outputbox.setLayout(outputbox_layout)

        self.bin_label = QLabel(
            self.ml.get_tr_text("tab_num_conv_outputbox_bin_lab"))
        self.bin_label.setAlignment(Qt.AlignCenter)

        self.dec_label = QLabel(
            self.ml.get_tr_text("tab_num_conv_outputbox_dec_lab"))
        self.dec_label.setAlignment(Qt.AlignCenter)

        self.hex_label = QLabel(
            self.ml.get_tr_text("tab_num_conv_outputbox_hex_lab"))
        self.hex_label.setAlignment(Qt.AlignCenter)

        self.bin_output = QLineEdit()
        self.bin_output.setReadOnly(True)
        self.bin_output.setAlignment(Qt.AlignCenter)

        self.dec_output = QLineEdit()
        self.dec_output.setReadOnly(True)
        self.dec_output.setAlignment(Qt.AlignCenter)

        self.hex_output = QLineEdit()
        self.hex_output.setReadOnly(True)
        self.hex_output.setAlignment(Qt.AlignCenter)

        self.bin_output_copy_button = QPushButton(
            self.ml.get_tr_text("tab_num_conv_outputbox_copy_btn"))
        self.bin_output_copy_button.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.bin_output_copy_button.clicked.connect(
            lambda: copy_action(self.bin_output.text()))

        self.dec_output_copy_button = QPushButton(
            self.ml.get_tr_text("tab_num_conv_outputbox_copy_btn"))
        self.dec_output_copy_button.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.dec_output_copy_button.clicked.connect(
            lambda: copy_action(self.dec_output.text()))

        self.hex_output_copy_button = QPushButton(
            self.ml.get_tr_text("tab_num_conv_outputbox_copy_btn"))
        self.hex_output_copy_button.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.hex_output_copy_button.clicked.connect(
            lambda: copy_action(self.hex_output.text()))

        outputbox_layout.addWidget(self.bin_label, 0, 0)
        outputbox_layout.addWidget(self.bin_output, 0, 1)
        outputbox_layout.addWidget(self.bin_output_copy_button, 0, 2)

        outputbox_layout.addWidget(self.dec_label, 1, 0)
        outputbox_layout.addWidget(self.dec_output, 1, 1)
        outputbox_layout.addWidget(self.dec_output_copy_button, 1, 2)

        outputbox_layout.addWidget(self.hex_label, 2, 0)
        outputbox_layout.addWidget(self.hex_output, 2, 1)
        outputbox_layout.addWidget(self.hex_output_copy_button, 2, 2)

        # IP address/mask number conversion
        self.ip_address_number_conversion_box = QGroupBox(
            self.ml.get_tr_text("tab_num_conv_ip_mask_conv_gbox_name"))
        main_layout.addWidget(self.ip_address_number_conversion_box, 1, 0, 1,
                              2)

        ip_address_number_conversion_layout = QGridLayout()
        ip_address_number_conversion_layout.setAlignment(Qt.AlignCenter)
        ip_address_number_conversion_layout.setHorizontalSpacing(25)
        ip_address_number_conversion_layout.setVerticalSpacing(24)
        self.ip_address_number_conversion_box.setLayout(
            ip_address_number_conversion_layout)

        self.input_label = QLabel(
            self.ml.get_tr_text("tab_num_conv_ip_mask_conv_in_lab"))
        self.input_label.setAlignment(Qt.AlignCenter)
        self.input_label.setMaximumWidth(150)
        self.input_textfield = QLineEdit()
        self.input_textfield.setPlaceholderText("192.168.1.1")
        self.input_textfield.setAlignment(Qt.AlignLeft)
        self.input_textfield.setMaximumWidth(300)
        self.input_textfield.setAlignment(Qt.AlignCenter)
        self.input_textfield.returnPressed.connect(self.convert_action_2)
        ip_address_number_conversion_layout.addWidget(self.input_label, 0, 0)
        ip_address_number_conversion_layout.addWidget(self.input_textfield, 0,
                                                      1)

        button_layout_2 = QVBoxLayout()
        self.dec_to_bin_button = QRadioButton(
            self.ml.get_tr_text("tab_num_conv_ip_mask_conv_dectobin"))
        self.dec_to_bin_button.clicked.connect(
            lambda: self.input_textfield.setPlaceholderText("192.168.1.1"))
        self.dec_to_bin_button.setMaximumWidth(150)

        self.bin_to_dec_button = QRadioButton(
            self.ml.get_tr_text("tab_num_conv_ip_mask_conv_bintodec"))
        self.bin_to_dec_button.clicked.connect(
            lambda: self.input_textfield.setPlaceholderText(
                "11000000.10101000.00000001.00000001"))
        self.bin_to_dec_button.setMaximumWidth(150)
        self.dec_to_bin_button.setChecked(True)
        button_layout_2.addWidget(self.dec_to_bin_button)
        button_layout_2.addWidget(self.bin_to_dec_button)
        ip_address_number_conversion_layout.addLayout(button_layout_2, 0, 2)

        self.output_label = QLabel(
            self.ml.get_tr_text("tab_num_conv_ip_mask_conv_out_lab"))
        self.output_label.setAlignment(Qt.AlignCenter)
        self.output_textfield = QLineEdit()
        self.output_textfield.setMaximumWidth(300)
        self.output_textfield.setReadOnly(True)
        self.output_textfield.setAlignment(Qt.AlignCenter)
        ip_address_number_conversion_layout.addWidget(self.output_label, 1, 0)
        ip_address_number_conversion_layout.addWidget(self.output_textfield, 1,
                                                      1)

        self.output_textfield_copy_button = QPushButton(
            self.ml.get_tr_text("tab_num_conv_ip_mask_conv_copy_btn"))
        self.output_textfield_copy_button.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.output_textfield_copy_button.clicked.connect(
            lambda: copy_action(self.output_textfield.text()))
        ip_address_number_conversion_layout.addWidget(
            self.output_textfield_copy_button, 1, 2, alignment=Qt.AlignLeft)

        self.convert_button_2 = QPushButton(
            self.ml.get_tr_text("tab_num_conv_ip_mask_conv_convert_btn"))
        self.convert_button_2.clicked.connect(self.convert_action_2)
        self.convert_button_2.setIcon(QIcon("static/images/exchange.png"))
        ip_address_number_conversion_layout.addWidget(
            self.convert_button_2, 2, 0, 1, 3, alignment=Qt.AlignHCenter)
Example #19
0
class StatComponent(QGroupBox):
    def __init__(self):
        super().__init__()

        self._series = {}
        self._legend_items = {}

        self.setTitle("Statistiques")
        self.setProperty("qss-var", "pb-0")

        self._total_label = QLabel()

        self._legend_layout = QGridLayout()
        self._legend_layout.setVerticalSpacing(0)
        self._legend_layout.setHorizontalSpacing(50)

        main_layout = QVBoxLayout()
        main_layout.addWidget(self._total_label)
        main_layout.addLayout(self._legend_layout)
        main_layout.addSpacing(5)
        main_layout.addWidget(self._createLineChart(), 1)

        self.setLayout(main_layout)

    def reset(self, parameters: Parameters):
        self._parameters = parameters

        self._total_label.setText("Éponges détectées : 0")

        for i in reversed(range(self._legend_layout.count())):
            self._legend_layout.itemAt(i).widget().setParent(None)

        self._chart.removeAllSeries()
        self._legend_items = {}
        self._series = {}
        for i, m in parameters.selectedMorphotypes().items():
            self._series[i] = QtCharts.QLineSeries(self)
            self._series[i].setName(m.name())
            self._series[i].setColor(m.color())

            pen = QPen(m.color(), 3)
            pen.setCapStyle(Qt.RoundCap)
            self._series[i].setPen(pen)

            self._series[i].append(0, 0)
            self._chart.addSeries(self._series[i])

            self._legend_items[i] = ChartLegendItem(m.name(), m.color(), self)
            self._legend_items[i].toggled.connect(self._legendItemToggled)

        for i, k in enumerate(self._legend_items.keys()):
            row = i % 2 + 1
            col = i // 2 + 1

            self._legend_layout.addWidget(self._legend_items[k], row, col)

        axis_pen = QPen(Loader.QSSColor("@dark"))
        axis_pen.setWidth(2)

        grid_line_pen = QPen(Loader.QSSColor("@light-gray"))

        labels_font = QFont(Loader.QSSVariable("@font"))
        labels_font.setPointSize(10)

        self._chart.createDefaultAxes()

        for axis in (self._chart.axisX(), self._chart.axisY()):
            axis.setRange(0, 4)
            axis.setLinePen(axis_pen)
            axis.setGridLinePen(grid_line_pen)
            axis.setLabelFormat("%d")
            axis.setLabelsFont(labels_font)

    def _createLineChart(self) -> QtCharts.QChartView:
        self._chart = QtCharts.QChart()

        self._chart.setAnimationOptions(QtCharts.QChart.SeriesAnimations)

        self._chart.setTitle("Détections cumulées")
        self._chart.legend().setVisible(False)
        self._chart.setBackgroundBrush(QBrush(QColor("transparent")))
        self._chart.setMargins(QMargins(0, 0, 0, 0))

        title_font = QFont(Loader.QSSVariable("@font"))
        title_font.setPointSize(14)
        self._chart.setTitleFont(title_font)
        self._chart.setTitleBrush(QBrush(Loader.QSSColor("@dark")))

        chart_view = QtCharts.QChartView(self._chart)
        chart_view.setRenderHint(QPainter.Antialiasing)

        return chart_view

    def update(self, analysis: Analysis):
        self._analysis = analysis

        for class_id in self._parameters.selectedMorphotypes():
            last_idx = self._series[class_id].count() - 1

            new_x = self._series[class_id].at(last_idx).x() + 1
            new_y = analysis.cumulativeDetectionsFor(class_id)

            if last_idx > 1:
                if self._series[class_id].at(last_idx - 1).y(
                ) == new_y and self._series[class_id].at(
                        last_idx).y() == new_y:
                    self._series[class_id].replace(last_idx, new_x, new_y)
                    continue

            self._series[class_id].append(new_x, new_y)
            self._legend_items[class_id].setValue(str(new_y))

        self._total_label.setText("Éponges détectées : %d" %
                                  analysis.totalDetections())

        self._recalculateAxis()

    def _recalculateAxis(self):
        base_series = list(self._series.values())[0]

        last_idx = base_series.count() - 1
        x = base_series.at(last_idx).x()

        self._chart.axisX().setRange(0, max(x, 4))

        maxY = 0
        for k in self._series:
            if not self._legend_items[k].isChecked():
                continue

            maxY = max(maxY, self._analysis.cumulativeDetectionsFor(k))

        maxY = max(maxY, 4)

        # Add 5% to show the top series below the top line
        maxY = round(1.05 * maxY)

        self._chart.axisY().setRange(0, maxY)

    @Slot(bool)
    def _legendItemToggled(self, state: bool):
        for k, v in self._legend_items.items():
            if v == self.sender():
                self._series[k].setVisible(state)
                break

        self._recalculateAxis()
Example #20
0
    def _dependenciesTab(self) -> QWidget:
        tab = QWidget(self)
        tab.setObjectName("about-tab")

        layout = QVBoxLayout(tab)
        layout.setAlignment(Qt.AlignTop)

        # add link and version
        dependencies = {
            "PySide2": {
                "version": "5.15.2",
                "author": "Qt for Python Team",
                "link": "https://www.pyside.org",
                "license": "LGPL v3",
                "license-file": "pyside2.txt"
            },
            "PyTorch": {
                "version": "1.8.1+cu102",
                "author": "PyTorch Team",
                "link": "https://pytorch.org/",
                "license": "BSD-3",
                "license-file": "pytorch.txt"
            },
            "OpenCV Python": {
                "version": "4.5.1.48",
                "author": "Olli-Pekka Heinisuo",
                "link": "https://github.com/skvark/opencv-python",
                "license": "MIT",
                "license-file": "opencv-python.txt"
            },
            "NumPy": {
                "version": "1.20.2",
                "author": "Travis E. Oliphant et al.",
                "link": "https://www.numpy.org",
                "license": "BSD-3",
                "license-file": "numpy.txt"
            },
            "YoloV4": {
                "version": "N/A",
                "author":
                "Alexey Bochkovskiy, Chien-Yao Wang, Hong-Yuan Mark Liao",
                "link": "https://github.com/AlexeyAB/darknet",
                "license": "Unlicense",
                "license-file": "yolov4.txt"
            },
            "Pytorch-YOLOv4": {
                "version": "N/A",
                "author": "Tianxiaomo, ersheng-ai",
                "link": "https://github.com/Tianxiaomo/pytorch-YOLOv4",
                "license": "Apache-2.0",
                "license-file": "pytorch-yolov4.txt"
            },
            "dict2xml": {
                "version": "1.7.0",
                "author": "Stephen Moore",
                "link": "http://github.com/delfick/python-dict2xml",
                "license": "MIT",
                "license-file": "dict2xml.txt"
            }
        }

        dependencies_title = QLabel("Dépendances :")
        dependencies_title.setObjectName("tab-title")

        self._dependencies_list = QComboBox(self)
        for name, data in dependencies.items():
            self._dependencies_list.addItem(name, data)
        self._dependencies_list.currentIndexChanged.connect(
            self._dependenciesComboBoxChanged)

        dependencies_list_layout = QVBoxLayout()
        dependencies_list_layout.addWidget(self._dependencies_list)
        dependencies_list_layout.setContentsMargins(5, 0, 5, 5)

        version_layout = QHBoxLayout()
        version_layout.setAlignment(Qt.AlignLeft)
        version_title = QLabel("Version :")
        version_title.setObjectName("dependency-info")
        self._version = QLabel()
        version_layout.addWidget(version_title)
        version_layout.addWidget(self._version, 1)

        license_layout = QHBoxLayout()
        license_layout.setAlignment(Qt.AlignLeft)
        license_title = QLabel("License :")
        license_title.setObjectName("dependency-info")
        self._license = QLabel()
        license_layout.addWidget(license_title)
        license_layout.addWidget(self._license, 1)

        author_layout = QHBoxLayout()
        author_title = QLabel("Auteur(s) :")
        author_title.setObjectName("dependency-info")
        self._author = QLabel()
        author_layout.addWidget(author_title)
        author_layout.addWidget(self._author, 1)

        link_layout = QHBoxLayout()
        link_layout.setAlignment(Qt.AlignLeft)
        link_title = QLabel("Lien :")
        link_title.setObjectName("dependency-info")
        self._link = QLabel()
        self._link.setOpenExternalLinks(True)
        link_layout.addWidget(link_title)
        link_layout.addWidget(self._link, 1)

        dependency_info = QGridLayout()
        dependency_info.setVerticalSpacing(0)
        dependency_info.addLayout(version_layout, 0, 0)
        dependency_info.addLayout(license_layout, 0, 1)
        dependency_info.addLayout(author_layout, 1, 0, 1, 2)
        dependency_info.addLayout(link_layout, 2, 0, 1, 2)

        licenses_title = QLabel("Licence :")
        licenses_title.setObjectName("tab-title")

        self._license_area = QTextEdit(self)
        self._license_area.setReadOnly(True)
        self._license_area.setObjectName("license-file")
        license_area_layout = QVBoxLayout()
        license_area_layout.addWidget(self._license_area)
        license_area_layout.setContentsMargins(5, 0, 5, 5)

        layout.addWidget(dependencies_title)
        layout.addLayout(dependencies_list_layout)
        layout.addLayout(dependency_info)
        layout.addWidget(licenses_title)
        layout.addLayout(license_area_layout)

        self._dependenciesComboBoxChanged(0)

        return tab
Example #21
0
    def __init__(self):
        super(IpInformation, self).__init__()

        # Use language settings
        self.ml = ManageLng()

        main_layout = QGridLayout()
        self.setLayout(main_layout)

        # Prefix-mask-conversion group box
        self.prefix_mask_box = QGroupBox(
            self.ml.get_tr_text("tab_ip_information_prefix_mask_conv"))
        self.prefix_mask_box.setMaximumHeight(90)
        main_layout.addWidget(self.prefix_mask_box, 0, 0)
        prefix_mask_box_layout = QGridLayout()
        prefix_mask_box_layout.setContentsMargins(200, 20, 200, 20)
        prefix_mask_box_layout.setHorizontalSpacing(30)
        self.prefix_mask_box.setLayout(prefix_mask_box_layout)

        self.prefix_input = QLineEdit()
        self.prefix_input.setMaxLength(3)
        self.prefix_input.setAlignment(Qt.AlignCenter)
        self.prefix_input.setPlaceholderText(
            self.ml.get_tr_text("tab_ip_information_prefix_ptext"))
        prefix_mask_box_layout.addWidget(self.prefix_input, 0, 0)
        self.mask_input = QLineEdit()
        self.mask_input.setMaxLength(15)
        self.mask_input.setAlignment(Qt.AlignCenter)
        self.mask_input.setPlaceholderText(
            self.ml.get_tr_text("tab_ip_information_mask_ptext"))
        prefix_mask_box_layout.addWidget(self.mask_input, 0, 1)

        self.convert_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_conv_btn"))
        self.convert_btn.setIcon(QIcon("static/images/exchange.png"))
        self.convert_btn.clicked.connect(self.convert_action)
        self.prefix_input.returnPressed.connect(self.convert_action)
        self.mask_input.returnPressed.connect(self.convert_action)
        prefix_mask_box_layout.addWidget(self.convert_btn,
                                         0,
                                         2,
                                         alignment=Qt.AlignLeft)

        # IP information group box
        self.ip_information_box = QGroupBox(
            self.ml.get_tr_text("tab_ip_information_ipinfo_gbox"))
        main_layout.addWidget(self.ip_information_box, 1, 0)
        ip_information_box_layout = QGridLayout()
        ip_information_box_layout.setContentsMargins(80, 80, 80, 80)
        ip_information_box_layout.setHorizontalSpacing(30)
        ip_information_box_layout.setVerticalSpacing(15)
        self.ip_information_box.setLayout(ip_information_box_layout)

        self.ip_address_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_ipadd_lab"))
        ip_information_box_layout.addWidget(self.ip_address_label,
                                            0,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.ip_address_textfield = QLineEdit()
        self.ip_address_textfield.setPlaceholderText("192.168.1.100/24")
        self.ip_address_textfield.setAlignment(Qt.AlignCenter)
        self.ip_address_textfield.setMaxLength(18)
        ip_information_box_layout.addWidget(self.ip_address_textfield, 0, 1)

        self.get_info_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_getinfo_btn"))
        self.get_info_btn.setIcon(QIcon("static/images/get_info.png"))
        self.get_info_btn.clicked.connect(self.get_info_action)
        self.ip_address_textfield.returnPressed.connect(self.get_info_action)
        ip_information_box_layout.addWidget(self.get_info_btn, 0, 2)

        self.ip_class_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_ipclass_lab"))
        ip_information_box_layout.addWidget(self.ip_class_label,
                                            1,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.ip_class_textfield = QLineEdit()
        self.ip_class_textfield.setReadOnly(True)
        self.ip_class_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(self.ip_class_textfield, 1, 1)
        self.ip_class_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.ip_class_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.ip_class_copy_btn.clicked.connect(
            lambda: copy_action(self.ip_class_textfield.text()))
        ip_information_box_layout.addWidget(self.ip_class_copy_btn, 1, 2)

        self.ip_type_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_iptype_lab"))
        ip_information_box_layout.addWidget(self.ip_type_label,
                                            2,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.ip_type_textfield = QLineEdit()
        self.ip_type_textfield.setReadOnly(True)
        self.ip_type_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(self.ip_type_textfield, 2, 1)
        self.ip_type_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.ip_type_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.ip_type_copy_btn.clicked.connect(
            lambda: copy_action(self.ip_type_textfield.text()))
        ip_information_box_layout.addWidget(self.ip_type_copy_btn, 2, 2)

        self.network_address_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_netadd_lab"))
        ip_information_box_layout.addWidget(self.network_address_label,
                                            3,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.network_address_textfield = QLineEdit()
        self.network_address_textfield.setReadOnly(True)
        self.network_address_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(self.network_address_textfield, 3,
                                            1)
        self.network_address_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.network_address_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.network_address_copy_btn.clicked.connect(
            lambda: copy_action(self.network_address_textfield.text()))
        ip_information_box_layout.addWidget(self.network_address_copy_btn, 3,
                                            2)

        self.subnet_mask_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_mask_lab"))
        ip_information_box_layout.addWidget(self.subnet_mask_label,
                                            4,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.subnet_mask_textfield = QLineEdit()
        self.subnet_mask_textfield.setReadOnly(True)
        self.subnet_mask_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(self.subnet_mask_textfield, 4, 1)
        self.subnet_mask_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.subnet_mask_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.subnet_mask_copy_btn.clicked.connect(
            lambda: copy_action(self.subnet_mask_textfield.text()))
        ip_information_box_layout.addWidget(self.subnet_mask_copy_btn, 4, 2)

        self.first_addressable_ip_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_firstip_lab"))
        ip_information_box_layout.addWidget(self.first_addressable_ip_label,
                                            5,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.first_addressable_ip_textfield = QLineEdit()
        self.first_addressable_ip_textfield.setReadOnly(True)
        self.first_addressable_ip_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(
            self.first_addressable_ip_textfield, 5, 1)
        self.first_addressable_ip_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.first_addressable_ip_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.first_addressable_ip_copy_btn.clicked.connect(
            lambda: copy_action(self.first_addressable_ip_textfield.text()))
        ip_information_box_layout.addWidget(self.first_addressable_ip_copy_btn,
                                            5, 2)

        self.last_addressable_ip_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_lastip_lab"))
        ip_information_box_layout.addWidget(self.last_addressable_ip_label,
                                            6,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.last_addressable_ip_textfield = QLineEdit()
        self.last_addressable_ip_textfield.setReadOnly(True)
        self.last_addressable_ip_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(self.last_addressable_ip_textfield,
                                            6, 1)
        self.last_addressable_ip_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.last_addressable_ip_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.last_addressable_ip_copy_btn.clicked.connect(
            lambda: copy_action(self.last_addressable_ip_textfield.text()))
        ip_information_box_layout.addWidget(self.last_addressable_ip_copy_btn,
                                            6, 2)

        self.broadcast_address_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_bcastip_lab"))
        ip_information_box_layout.addWidget(self.broadcast_address_label,
                                            7,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.broadcast_address_textfield = QLineEdit()
        self.broadcast_address_textfield.setReadOnly(True)
        self.broadcast_address_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(self.broadcast_address_textfield,
                                            7, 1)
        self.broadcast_address_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.broadcast_address_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.broadcast_address_copy_btn.clicked.connect(
            lambda: copy_action(self.broadcast_address_textfield.text()))
        ip_information_box_layout.addWidget(self.broadcast_address_copy_btn, 7,
                                            2)

        self.next_network_address_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_nextnetip_lab"))
        ip_information_box_layout.addWidget(self.next_network_address_label,
                                            8,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.next_network_address_textfield = QLineEdit()
        self.next_network_address_textfield.setReadOnly(True)
        self.next_network_address_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(
            self.next_network_address_textfield, 8, 1)
        self.next_network_address_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.next_network_address_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.next_network_address_copy_btn.clicked.connect(
            lambda: copy_action(self.next_network_address_textfield.text()))
        ip_information_box_layout.addWidget(self.next_network_address_copy_btn,
                                            8, 2)

        self.max_endpoint_label = QLabel(
            self.ml.get_tr_text("tab_ip_information_maxend_lab"))
        ip_information_box_layout.addWidget(self.max_endpoint_label,
                                            9,
                                            0,
                                            alignment=Qt.AlignCenter)
        self.max_endpoint_textfield = QLineEdit()
        self.max_endpoint_textfield.setReadOnly(True)
        self.max_endpoint_textfield.setAlignment(Qt.AlignCenter)
        ip_information_box_layout.addWidget(self.max_endpoint_textfield, 9, 1)
        self.max_endpoint_copy_btn = QPushButton(
            self.ml.get_tr_text("tab_ip_information_copy_btn"))
        self.max_endpoint_copy_btn.setIcon(
            QIcon("static/images/copy_clipboard.png"))
        self.max_endpoint_copy_btn.clicked.connect(
            lambda: copy_action(self.max_endpoint_textfield.text()))
        ip_information_box_layout.addWidget(self.max_endpoint_copy_btn, 9, 2)
Example #22
0
    def __init__(self):
        super().__init__()

        # Main Layout
        main_layout = QHBoxLayout(self)
        main_layout.setContentsMargins(0, 0, 0, 0)

        title = QLabel(
            "Sp<font color='#419DD1'>o</font>ng<font color='#F4D05C'>o</font>")
        title.setObjectName("title")

        subtitle = QLabel(
            "Outil de classification et de reconnaissance de morphotypes d’éponges marines"
        )
        subtitle.setObjectName("subtitle")

        start_button = StylizedButton("Commencer une analyse", "blue")
        self._history_button = StylizedButton("Historique des analyses",
                                              "blue")
        about_button = StylizedButton("À propos", "blue")
        exit_button = StylizedButton("Quitter", "yellow")

        buttons_layout = QGridLayout()
        buttons_layout.setAlignment(Qt.AlignCenter)
        buttons_layout.setVerticalSpacing(24)
        buttons_layout.setHorizontalSpacing(30)

        buttons_layout.addWidget(start_button, 0, 0, 1, 2)
        buttons_layout.addWidget(self._history_button, 1, 0, 1, 2)
        buttons_layout.addWidget(about_button, 2, 0)
        buttons_layout.addWidget(exit_button, 2, 1)

        version_label = QLabel(AppInfo.version())
        version_label.setAlignment(Qt.AlignCenter)
        version_label.setObjectName("version")

        center_layout = QVBoxLayout()
        center_layout.setAlignment(Qt.AlignCenter)
        center_layout.setContentsMargins(15, 15, 15, 15)
        center_layout.addStretch(4)
        center_layout.addWidget(title)
        center_layout.addWidget(subtitle)
        center_layout.addLayout(buttons_layout)
        center_layout.addStretch(5)
        center_layout.addWidget(version_label)

        isen_logo = QLabel()
        isen_logo.setPixmap(
            QPixmap(":/img/isen_logo.png").scaledToWidth(
                180, Qt.SmoothTransformation))

        left_layout = QVBoxLayout()
        left_layout.setContentsMargins(0, 0, 0, 0)
        left_layout.addWidget(isen_logo, alignment=Qt.AlignBottom)

        ifremer_logo = QLabel()
        ifremer_logo.setAlignment(Qt.AlignRight)
        ifremer_logo.setPixmap(
            QPixmap(":/img/ifremer_logo.png").scaledToWidth(
                180, Qt.SmoothTransformation))

        right_layout = QVBoxLayout()
        right_layout.setContentsMargins(0, 0, 0, 0)
        right_layout.addWidget(ifremer_logo, alignment=Qt.AlignBottom)

        main_layout.addLayout(left_layout, 1)
        main_layout.addLayout(center_layout, 3)
        main_layout.addLayout(right_layout, 1)

        self.setLayout(main_layout)

        # Button slots
        start_button.clicked.connect(self._startButtonClicked)
        self._history_button.clicked.connect(self._historyButtonClicked)
        about_button.clicked.connect(self._aboutButtonClicked)
        exit_button.clicked.connect(self._exitButtonClicked)
Example #23
0
class Ui_Dialog(object):
    def setupUi(self, Dialog):
        if not Dialog.objectName():
            Dialog.setObjectName(u"Dialog")
        Dialog.resize(450, 235)
        Dialog.setMinimumSize(QSize(450, 235))
        Dialog.setMaximumSize(QSize(450, 235))
        Dialog.setStyleSheet(u"QDialog {\n" "	background:rgb(51,51,51);\n" "}")
        self.verticalLayout = QVBoxLayout(Dialog)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName(u"verticalLayout")
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.frame_2 = QFrame(Dialog)
        self.frame_2.setObjectName(u"frame_2")
        self.frame_2.setStyleSheet(u"background:rgb(51,51,51);")
        self.frame_2.setFrameShape(QFrame.NoFrame)
        self.frame_2.setFrameShadow(QFrame.Plain)
        self.verticalLayout_2 = QVBoxLayout(self.frame_2)
        self.verticalLayout_2.setSpacing(0)
        self.verticalLayout_2.setObjectName(u"verticalLayout_2")
        self.verticalLayout_2.setContentsMargins(2, 2, 2, 2)
        self.frame_top = QFrame(self.frame_2)
        self.frame_top.setObjectName(u"frame_top")
        self.frame_top.setMinimumSize(QSize(0, 55))
        self.frame_top.setMaximumSize(QSize(16777215, 55))
        self.frame_top.setStyleSheet(u"background:rgb(91,90,90);")
        self.frame_top.setFrameShape(QFrame.NoFrame)
        self.frame_top.setFrameShadow(QFrame.Plain)
        self.horizontalLayout = QHBoxLayout(self.frame_top)
        self.horizontalLayout.setSpacing(0)
        self.horizontalLayout.setObjectName(u"horizontalLayout")
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.lab_heading = QLabel(self.frame_top)
        self.lab_heading.setObjectName(u"lab_heading")
        font = QFont()
        font.setFamily(u"Segoe UI")
        font.setPointSize(14)
        self.lab_heading.setFont(font)
        self.lab_heading.setStyleSheet(u"color:rgb(255,255,255);")
        self.lab_heading.setAlignment(Qt.AlignCenter)

        self.horizontalLayout.addWidget(self.lab_heading)

        self.bn_min = QPushButton(self.frame_top)
        self.bn_min.setObjectName(u"bn_min")
        self.bn_min.setMinimumSize(QSize(55, 55))
        self.bn_min.setMaximumSize(QSize(55, 55))
        self.bn_min.setStyleSheet(u"QPushButton {\n"
                                  "	border: none;\n"
                                  "	background-color: rgb(51,51,51);\n"
                                  "}\n"
                                  "QPushButton:hover {\n"
                                  "	background-color: rgb(0,143,150);\n"
                                  "}\n"
                                  "QPushButton:pressed {	\n"
                                  "	background-color: rgb(51,51,51);\n"
                                  "}")
        icon = QIcon()
        icon.addFile(u"icons/1x/hideAsset 53.png", QSize(), QIcon.Normal,
                     QIcon.Off)
        self.bn_min.setIcon(icon)
        self.bn_min.setIconSize(QSize(22, 12))
        self.bn_min.setAutoDefault(False)
        self.bn_min.setFlat(True)

        self.horizontalLayout.addWidget(self.bn_min)

        self.bn_close = QPushButton(self.frame_top)
        self.bn_close.setObjectName(u"bn_close")
        self.bn_close.setMinimumSize(QSize(55, 55))
        self.bn_close.setMaximumSize(QSize(55, 55))
        self.bn_close.setStyleSheet(u"QPushButton {\n"
                                    "	border: none;\n"
                                    "	background-color: rgb(51,51,51);\n"
                                    "}\n"
                                    "QPushButton:hover {\n"
                                    "	background-color: rgb(0,143,150);\n"
                                    "}\n"
                                    "QPushButton:pressed {	\n"
                                    "	background-color: rgb(51,51,51);\n"
                                    "}")
        icon1 = QIcon()
        icon1.addFile(u"icons/1x/closeAsset 43.png", QSize(), QIcon.Normal,
                      QIcon.Off)
        self.bn_close.setIcon(icon1)
        self.bn_close.setIconSize(QSize(22, 22))
        self.bn_close.setAutoDefault(False)
        self.bn_close.setFlat(True)

        self.horizontalLayout.addWidget(self.bn_close)

        self.verticalLayout_2.addWidget(self.frame_top)

        self.frame_bottom = QFrame(self.frame_2)
        self.frame_bottom.setObjectName(u"frame_bottom")
        self.frame_bottom.setStyleSheet(u"background:rgb(91,90,90);")
        self.frame_bottom.setFrameShape(QFrame.StyledPanel)
        self.frame_bottom.setFrameShadow(QFrame.Raised)
        self.gridLayout = QGridLayout(self.frame_bottom)
        self.gridLayout.setObjectName(u"gridLayout")
        self.gridLayout.setHorizontalSpacing(5)
        self.gridLayout.setVerticalSpacing(0)
        self.gridLayout.setContentsMargins(15, -1, 35, 0)
        self.bn_east = QPushButton(self.frame_bottom)
        self.bn_east.setObjectName(u"bn_east")
        self.bn_east.setMinimumSize(QSize(69, 25))
        self.bn_east.setMaximumSize(QSize(69, 25))
        font1 = QFont()
        font1.setFamily(u"Segoe UI")
        font1.setPointSize(12)
        self.bn_east.setFont(font1)
        self.bn_east.setStyleSheet(u"QPushButton {\n"
                                   "	border: 2px solid rgb(51,51,51);\n"
                                   "	border-radius: 5px;	\n"
                                   "	color:rgb(255,255,255);\n"
                                   "	background-color: rgb(51,51,51);\n"
                                   "}\n"
                                   "QPushButton:hover {\n"
                                   "	border: 2px solid rgb(0,143,150);\n"
                                   "	background-color: rgb(0,143,150);\n"
                                   "}\n"
                                   "QPushButton:pressed {	\n"
                                   "	border: 2px solid rgb(0,143,150);\n"
                                   "	background-color: rgb(51,51,51);\n"
                                   "}")
        self.bn_east.setAutoDefault(False)

        self.gridLayout.addWidget(self.bn_east, 1, 3, 1, 1)

        self.lab_icon = QLabel(self.frame_bottom)
        self.lab_icon.setObjectName(u"lab_icon")
        self.lab_icon.setMinimumSize(QSize(40, 40))
        self.lab_icon.setMaximumSize(QSize(40, 40))

        self.gridLayout.addWidget(self.lab_icon, 0, 0, 1, 1)

        self.bn_west = QPushButton(self.frame_bottom)
        self.bn_west.setObjectName(u"bn_west")
        self.bn_west.setMinimumSize(QSize(69, 25))
        self.bn_west.setMaximumSize(QSize(69, 25))
        self.bn_west.setFont(font1)
        self.bn_west.setStyleSheet(u"QPushButton {\n"
                                   "	border: 2px solid rgb(51,51,51);\n"
                                   "	border-radius: 5px;	\n"
                                   "	color:rgb(255,255,255);\n"
                                   "	background-color: rgb(51,51,51);\n"
                                   "}\n"
                                   "QPushButton:hover {\n"
                                   "	border: 2px solid rgb(0,143,150);\n"
                                   "	background-color: rgb(0,143,150);\n"
                                   "}\n"
                                   "QPushButton:pressed {	\n"
                                   "	border: 2px solid rgb(0,143,150);\n"
                                   "	background-color: rgb(51,51,51);\n"
                                   "}")
        self.bn_west.setAutoDefault(False)

        self.gridLayout.addWidget(self.bn_west, 1, 2, 1, 1)

        self.lab_message = QLabel(self.frame_bottom)
        self.lab_message.setObjectName(u"lab_message")
        self.lab_message.setFont(font1)
        self.lab_message.setStyleSheet(u"color:rgb(255,255,255);")
        self.lab_message.setWordWrap(True)

        self.gridLayout.addWidget(self.lab_message, 0, 1, 1, 3)

        self.verticalLayout_2.addWidget(self.frame_bottom)

        self.verticalLayout.addWidget(self.frame_2)

        self.retranslateUi(Dialog)

        QMetaObject.connectSlotsByName(Dialog)

    # setupUi

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(
            QCoreApplication.translate("Dialog", u"Dialog", None))
        self.lab_heading.setText("")
        self.bn_min.setText("")
        self.bn_close.setText("")
        self.bn_east.setText("")
        self.lab_icon.setText("")
        self.bn_west.setText("")
        self.lab_message.setText("")
Example #24
0
    def setupUI(self):
        _translate = QtCore.QCoreApplication.translate
        self.setWindowTitle(_translate("MainWindow", "Function"))
        self.setFixedSize(350, 220)

        self.function_label = QtWidgets.QLabel()
        font = QtGui.QFont()
        font.setFamily("Helvetica")
        font.setPointSize(22)
        font.setBold(True)
        font.setWeight(75)
        self.function_label.setFont(font)
        self.function_label.setStyleSheet("color: rgb(255, 24, 128);")
        self.function_label.setAlignment(QtCore.Qt.AlignCenter)
        self.function_label.setObjectName("function_label")
        self.function_label.setText(_translate("MainWindow", "FUNCTION"))

        font = QtGui.QFont()
        font.setFamily("Helvetica")
        font.setPointSize(11)
        style = "background-color: rgb(224, 237, 255)"

        self.process_pack = RequestButtonPack(
            self, "PROCESS",
            self.MakeButton(font, style, "process_button",
                            _translate("MainWindow", "Xem Process")))

        self.application_pack = RequestButtonPack(
            self, "APPLICATION",
            self.MakeButton(font, style, "application_button",
                            _translate("MainWindow", "Xem Ứng dụng")))

        self.input_pack = RequestButtonPack(
            self, "KEYLOG",
            self.MakeButton(font, style, "input_button",
                            _translate("MainWindow", "Bàn phím")))

        self.screenshot_pack = RequestButtonPack(
            self, "SCREENSHOT",
            self.MakeButton(font, style, "screenshot_button",
                            _translate("MainWindow", "Chụp màn hình")))

        self.streaming_pack = RequestButtonPack(
            self, "LIVESTREAM",
            self.MakeButton(font, style, "streaming_button",
                            _translate("MainWindow", "Xem live màn hình")))

        self.directory_pack = RequestButtonPack(
            self, "DIRECTORY",
            self.MakeButton(font, style, "directory_button",
                            _translate("MainWindow", "Cây thư mục")))

        self.registry_pack = RequestButtonPack(
            self, "REGISTRY",
            self.MakeButton(font, style, "directory_button",
                            _translate("MainWindow", "Registry")))

        self.shutdown_button = self.MakeButton(
            font, style, "shutdown_button", _translate("MainWindow",
                                                       "Shutdown"))
        self.logout_button = self.MakeButton(
            font, style, "logout_button", _translate("MainWindow", "Logout"))
        self.info_button = self.MakeButton(
            font, style, "info_button", _translate("MainWindow",
                                                   "MAC Address"))

        self.info_button.clicked.connect(self.onShowMACAdress)
        self.shutdown_button.clicked.connect(self.onShutdown)
        self.logout_button.clicked.connect(self.onLogOut)

        layout1 = QVBoxLayout()
        layout1.addWidget(self.screenshot_pack.button)
        layout1.addSpacing(5)
        layout1.addWidget(self.streaming_pack.button)
        layout1.addSpacing(5)

        layout2 = QVBoxLayout()
        layout2.addWidget(self.input_pack.button)
        layout2.addSpacing(5)
        layout2.addWidget(self.directory_pack.button)
        layout2.addSpacing(5)

        layout3 = QVBoxLayout()
        layout3.addWidget(self.process_pack.button)
        layout3.addSpacing(5)
        layout3.addWidget(self.application_pack.button)
        layout3.addSpacing(5)
        layout3.addWidget(self.registry_pack.button)

        layout4t = QGridLayout()
        layout4t.setHorizontalSpacing(5)
        layout4t.addWidget(self.logout_button, 0, 0)
        layout4t.addWidget(self.shutdown_button, 0, 1)

        layout4 = QVBoxLayout()
        layout4.addWidget(self.info_button)
        layout4.addSpacing(5)
        layout4.addItem(layout4t)

        buttonLayout = QGridLayout()
        buttonLayout.setHorizontalSpacing(15)
        buttonLayout.setVerticalSpacing(10)
        buttonLayout.addItem(layout1, 0, 0)
        buttonLayout.addItem(layout2, 0, 1)
        buttonLayout.addItem(layout3, 1, 0)
        buttonLayout.addItem(layout4, 1, 1)

        tmp = QtWidgets.QWidget(self)
        tmp.setFixedSize(320, 210)
        # tmp.setStyleSheet("background-color: rgb(60, 60, 180)")

        mainLayout = QVBoxLayout(tmp)
        mainLayout.addWidget(self.function_label)
        mainLayout.addItem(buttonLayout)

        self.setLayout(mainLayout)
Example #25
0
class ProcessWidget(BlinkBackgroundWidget):
    actionRequested = Signal(str, str)
    process_state_changed = Signal(str, str)

    def __init__(self, process_data: ProcessData, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._awaiting_response = False
        self._process_data: ProcessData = process_data

        self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
        self.layout = QGridLayout()
        self.layout.setColumnMinimumWidth(0, 50)
        # self.layout.setColumnStretch(0, 1)
        self.layout.setContentsMargins(4, 4, 4, 4)
        self.layout.setVerticalSpacing(2)

        self.btn_restart = QPushButton(self, text="Restart")
        self.btn_start_stop = QPushButton(self, text="Start/Stop")
        self.btn_start_stop.setObjectName("btn_start_stop")
        self.btn_start_stop.setMinimumWidth(60)
        self.btn_restart.setMinimumWidth(60)
        self.txt_command = QLabel(self, text=process_data.command)
        self.txt_command.setSizePolicy(QSizePolicy.MinimumExpanding,
                                       QSizePolicy.Minimum)
        # self.txt_command.setPlaceholderText("Your command")

        self.lbl_uid = QLabel(self, text=process_data.uid)
        self.lbl_uid.setStyleSheet("font-weight: bold")
        self.lbl_state = QLabel(self, text=process_data.state_info())

        self.layout.addWidget(self.lbl_uid, 0, 0, 1, 2)
        self.layout.addWidget(self.lbl_state, 0, 2, 1, 1)
        self.layout.addWidget(self.txt_command, 1, 2)
        self.layout.addWidget(self.btn_start_stop, 1, 0)
        self.layout.addWidget(self.btn_restart, 1, 1)
        self.setLayout(self.layout)

        self.btn_start_stop.setIcon(self.style().standardIcon(
            QStyle.SP_MediaPlay))
        self.btn_restart.setIcon(self.style().standardIcon(
            QStyle.SP_BrowserReload))

        self.btn_start_stop.clicked.connect(self._start_stop_clicked)
        self.btn_restart.clicked.connect(
            lambda: self.request_action("restart"))

        self.update_state(process_data.state, process_data.exit_code, True)

    def get_command_text(self):
        return self.txt_command.text()

    def _start_stop_clicked(self):
        action = "stop" if self._process_data.is_in_state(
            ProcessData.STARTED) else "start"
        self.request_action(action)

    def request_action(self, action: str):
        logger.debug("Requesting action: %s", action)
        self._disable_buttons(True)
        self.actionRequested.emit(self._process_data.uid, action)

    @Slot(str)
    def on_action_completed(self, action_response: str):
        logger.debug("Action completed: %s", action_response)
        self._set_button_ui(
            self._process_data.state)  # make sure the conform to state

    def _disable_buttons(self, disable=True):
        self.btn_start_stop.setDisabled(disable)
        self.btn_restart.setDisabled(disable)

    def on_update_process_data(self, process_data: ProcessData):
        logger.debug("Process data updated: %s", process_data)
        self.update_state(process_data.state, process_data.exit_code)
        self.txt_command.setText(process_data.command)

    def update_state(self, state: str, exit_code: int, state_changed=False):
        self._process_data.exit_code = exit_code
        self._set_button_ui(state)

        if self._process_data.state != state or state_changed:
            self._process_data.state = state
            self.lbl_state.setText(self._process_data.state_info())

            self.change_bg_color_with_blink(
                get_color_for_process(self._process_data))
            self.process_state_changed.emit(self._process_data.uid, state)

    def _set_button_ui(self, state: str):
        is_running = state == ProcessData.STARTED
        self.btn_start_stop.setDisabled(False)

        if is_running:
            self.btn_start_stop.setText("Stop")
            self.btn_start_stop.setIcon(self.style().standardIcon(
                QStyle.SP_MediaStop))
        elif state in (ProcessData.INITIALIZED, ProcessData.ENDED):
            self.btn_start_stop.setText("Start")
            self.btn_start_stop.setIcon(self.style().standardIcon(
                QStyle.SP_MediaPlay))
        else:
            self.btn_start_stop.setDisabled(True)
        self.btn_restart.setDisabled(not is_running)
Example #26
0
    def __init__(self, parent, node):  # , node_image):
        super(NodeWidget, self).__init__(parent)

        self.custom_focused = False
        # self.node_image = node_image
        self.custom_focused_stylesheet = '''
NodeWidget {
    border: 2px solid #49aeed;
    background-color: #246187;
}
        '''
        self.custom_unfocused_stylesheet = '''
NodeWidget {
    border: 2px solid #3d3d3d;
}
        '''
        self.contents_stylesheet = '''
QLabel {
    color: ''' + node.color.name() + ''';
    border: None;
    background: transparent;
}
QToolTip {
    background-color: #040f16;
    color: #3B9CD9;
    border: 2px solid #144a6b;
    border-radius: 3px;
    padding: 5px;
}
        '''

        # UI
        main_layout = QGridLayout()

        name_label = QLabel(node.title)
        name_label.setFont(QFont('Poppins', 12))

        package_name_layout = QHBoxLayout()

        package_name_label = QLabel(node.package)
        package_name_label.setFont(QFont('Arial', 8, italic=True))
        package_name_label.setStyleSheet('color: white;')

        package_name_layout_spacer = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                                 QSizePolicy.Minimum)
        package_name_layout.addItem(package_name_layout_spacer)
        package_name_layout.addWidget(package_name_label)

        main_layout.addWidget(name_label, 0, 0)
        main_layout.addLayout(package_name_layout, 1, 0)

        # # ------------------------------------------
        # img_label = QLabel()
        # img_label.setStyleSheet('padding: 20px;')
        # pix = QPixmap(self.node_image)
        # img_label.setPixmap(pix)
        # main_layout.addWidget(img_label, 2, 0)
        # # ------------------------------------------

        self.setLayout(main_layout)

        main_layout.setVerticalSpacing(0)
        main_layout.setSpacing(0)
        self.setContentsMargins(-6, -6, -6, -6)
        main_layout.setContentsMargins(-6, -6, -6, -6)
        self.setToolTip(node.description)
        self.setStyleSheet(self.custom_unfocused_stylesheet + '\n' +
                           self.contents_stylesheet)
        self.setMinimumWidth(70)
Example #27
0
class _JoinEditor(AbsOperationEditor):
    def editorBody(self) -> QWidget:
        self.__g = RadioButtonGroup('Select join type:', self)
        for j in Join.JoinType:
            self.__g.addRadioButton(j.name, j, False)

        self.__onIndex = QCheckBox('Join on index?', self)

        self.__jpl = _JoinPanel('Left', None, None, self)
        self.__jpr = _JoinPanel('Right', None, None, self)

        w = QWidget(self)
        self.layout = QGridLayout()
        self.layout.addLayout(self.__g.glayout, 0, 0, 1, -1)
        self.layout.addWidget(self.__onIndex, 1, 0, 1, -1)
        self.layout.addWidget(self.__jpl, 2, 0, 1, 1)
        self.layout.addWidget(self.__jpr, 2, 1, 1, 1)
        self.errorLabel = QLabel(self)
        self.errorLabel.setWordWrap(True)
        self.layout.addWidget(self.errorLabel, 3, 0, 1, -1)
        self.layout.setHorizontalSpacing(15)
        self.layout.setVerticalSpacing(10)
        w.setLayout(self.layout)

        # Clear errors when something change
        self.__onIndex.stateChanged.connect(self.__onStateChange)
        self.__onIndex.stateChanged.connect(self.errorLabel.hide)

        return w

    def refresh(self) -> None:
        oldl = self.__jpl
        oldr = self.__jpr
        self.__jpl = _JoinPanel('Left', self.inputShapes[0], self.acceptedTypes, self)
        self.__jpr = _JoinPanel('Right', self.inputShapes[1], self.acceptedTypes, self)
        self.layout.replaceWidget(oldl, self.__jpl)
        self.layout.replaceWidget(oldr, self.__jpr)
        # Delete old widgets
        oldl.deleteLater()
        oldr.deleteLater()
        # Reconnect
        self.__jpl.box.widget.currentIndexChanged.connect(self.errorLabel.hide)
        self.__jpl.suffix.widget.textEdited.connect(self.errorLabel.hide)
        self.__jpr.box.widget.currentIndexChanged.connect(self.errorLabel.hide)
        self.__jpr.suffix.widget.textEdited.connect(self.errorLabel.hide)

    def showErrors(self, msg: str) -> None:
        text = self.errorLabel.text()
        if text:
            text += '<br>' + msg
        self.errorLabel.setText(text)

    def getOptions(self) -> Iterable:
        attrL, suffL = self.__jpl.getData()
        attrR, suffR = self.__jpr.getData()
        jtype = self.__g.getData()
        onIndex = self.__onIndex.isChecked()
        return suffL, suffR, onIndex, attrL, attrR, jtype

    def setOptions(self, lsuffix: str, rsuffix: str, on_index: bool, left_on: int, right_on: int,
                   type: Join.JoinType) -> None:
        self.__jpl.setData(left_on, lsuffix)
        self.__jpr.setData(right_on, rsuffix)
        self.__onIndex.setChecked(on_index)
        self.__g.setData(type)

    @Slot(Qt.CheckState)
    def __onStateChange(self, state: Qt.CheckState) -> None:
        if state == Qt.Checked:
            self.__jpl.box.widget.setDisabled(True)
            self.__jpr.box.widget.setDisabled(True)
        else:
            self.__jpl.box.widget.setEnabled(True)
            self.__jpr.box.widget.setEnabled(True)
Example #28
0
class MietobjektView(QWidget, ModifyInfo):  # IccView ):
    save = Signal(
    )  # speichere Änderungen am Hauswart, der Masterobjekt-Bemerkung,
    # des Mietobjekt-Containers und der Mietobjekt-Bemerkung
    edit_mieter = Signal()
    edit_miete = Signal()
    edit_verwaltung = Signal()
    edit_hausgeld = Signal()

    def __init__(self, x: XMietobjektExt):
        QWidget.__init__(self)
        ModifyInfo.__init__(self)
        Clearable.__init__(self)
        self._mietobjekt = x
        self._btnSave = QPushButton()
        self._layout = QGridLayout()
        self._anzCols = 12
        self.setLayout(self._layout)
        # masterobjekt fields
        self._lblMasterId = FatLabel()
        self._bbeMasterName = LabelTimesBold12()
        self._bbeStrHnr = BaseBoldEdit()
        self._bbePlz = BaseBoldEdit()
        self._bbeOrt = BaseBoldEdit()
        self._bbeAnzWhg = BaseBoldEdit()
        self._bbeGesamtWfl = BaseBoldEdit()
        self._lblVerwalter = FatLabel()
        self._lblWEG = FatLabel()
        self._sdVeraeussertAm = SmartDateEdit()
        self._beHauswart = BaseBoldEdit()
        self._beHauswartTelefon = BaseBoldEdit()
        self._beHauswartMailto = BaseBoldEdit()
        self._meBemerkungMaster = MultiLineEdit()
        # mietobjekt fields
        self._lblMietobjekt = LabelTimesBold12()
        self._beWhgBez = LabelTimesBold12()
        self._bbeQm = BaseBoldEdit()
        self._beContainerNr = BaseBoldEdit()
        self._meBemerkungMobj = MultiLineEdit()
        self._lblMieter = FatLabel()
        self._lblTelefonMieter = FatLabel()
        self._lblMailtoMieter = FatLabel()
        self._lblNettoMiete = FatLabel()
        self._lblNkv = FatLabel()
        self._lblBruttoMiete = FatLabel()
        self._lblKaution = FatLabel()

        self._lblHgvNetto = FatLabel()
        self._lblRueZuFue = FatLabel()
        self._lblHgvBrutto = FatLabel()

        self._createGui(x)
        self.setData(x)
        self.connectWidgetsToChangeSlot(self.onChange, self.onResetChangeFlag)

    def _createGui(self, x: XMietobjektExt):
        self._layout.setVerticalSpacing(15)
        self._createToolBar(0)
        # self._createHLine( 1, self._anzCols )
        # self._createDummyRow( 2, 10 )
        row = self._createMasterDisplay(3)
        # self._createDummyRow( 4, 10 )
        # self._createHLine( 5 )
        self._createMietObjektDisplay(row)
        # cols = self._layout.columnCount()
        # self._layout.setColumnStretch( 7, 1 )
        # rows = self._layout.rowCount()
        # self._layout.setRowStretch( rows, 1 )

    def _createToolBar(self, r: int):
        self._btnSave.setFixedSize(QSize(30, 30))
        self._btnSave.setIcon(QIcon(ICON_DIR + "save.png"))
        self._btnSave.setToolTip(
            "Änderungen des Hauswarts bzw. der Bemerkung des Master-Objekts speichern."
        )
        self._btnSave.setEnabled(False)
        self._btnSave.clicked.connect(self.save.emit)
        tb = QHBoxLayout()
        tb.addWidget(self._btnSave)
        self._layout.addLayout(tb, r, 0, alignment=Qt.AlignLeft)

    def _createHLine(self, r: int, columns: int = -1):
        line = HLine()
        if columns < 0: columns = self._layout.columnCount()
        self._layout.addWidget(line, r, 0, 1, columns)

    def _createDummyRow(self, r: int, h: int):
        dummy = QWidget()
        dummy.setFixedHeight(h)
        self._layout.addWidget(dummy, r, 0)

    def _createMasterDisplay(self, row: int) -> int:
        #l = GridLayout()
        l = self._layout
        #self._layout.addLayout( l, row, 0, 1, self._anzCols )
        # l.setVerticalSpacing( 15 )
        r = row

        def _createMasterHeader(r: int) -> int:
            self._createHLine(r, self._anzCols)
            r += 1
            wrapper = QWidget()
            wrapper.setStyleSheet("background: lightgray;")
            hbl = QHBoxLayout()
            wrapper.setLayout(hbl)
            self._layout.addWidget(wrapper, r, 0, 1, self._anzCols)
            #################### Master-ID
            lbl = LabelTimes12("Master-ID: ")
            hbl.addWidget(lbl, alignment=Qt.AlignRight)
            hbl.addWidget(self._lblMasterId, alignment=Qt.AlignLeft)
            #################### Master-Name
            lbl = LabelTimes12("Master-Name: ")
            hbl.addWidget(lbl, alignment=Qt.AlignRight)
            self._bbeMasterName.setText("Dummy-Master")
            #self._bbeMasterName.setStyleSheet( "background: white;" )
            hbl.addWidget(self._bbeMasterName, alignment=Qt.AlignLeft)
            r += 1
            self._createHLine(r)
            return r

        def _createMasterAddress(r: int) -> int:
            c = 0
            lbl = BaseLabel("Adresse: ")
            l.addWidget(lbl, r, c)
            c = 1
            self._bbePlz.setMaximumWidth(60)
            l.addWidget(self._bbePlz, r, c)
            c = 2
            l.addWidget(self._bbeOrt, r, c, 1, 4)
            c = 6
            l.addWidget(self._bbeStrHnr, r, c, 1, 7)
            return r

        def _createMasterMore(r: int) -> int:
            c = 0
            lbl = BaseLabel("Anzahl Whg.: ")
            l.addWidget(lbl, r, c)
            c += 1
            self._bbeAnzWhg.setEnabled(False)
            self._bbeAnzWhg.setMaximumWidth(40)
            l.addWidget(self._bbeAnzWhg, r, c)
            c = 4
            lbl = BaseLabel("Gesamt-Wfl.(qm):")
            l.addWidget(lbl, r, c, 1, 1, alignment=Qt.AlignRight)
            c += 1
            self._bbeGesamtWfl.setEnabled(False)
            self._bbeGesamtWfl.setMaximumWidth(40)
            l.addWidget(self._bbeGesamtWfl, r, c)
            return r

        def _createVerwalter(r: int) -> int:
            #################### Verwalter
            c = 0
            lbl = BaseLabel("Verwalter: ")
            self._layout.addWidget(lbl, r, c)
            c = 1
            self._layout.addWidget(self._lblVerwalter, r, c, 1, 3)
            # #################### WEG-Name
            c = 4
            lbl = BaseLabel("WEG-Name: ")
            self._layout.addWidget(lbl, r, c, 1, 1, alignment=Qt.AlignRight)
            c = 5
            self._layout.addWidget(self._lblWEG, r, c, 1, 4)
            # ######################## Button Edit Verwaltung
            c = 11
            btn = EditButton()
            btn.clicked.connect(self.edit_verwaltung.emit)
            self._layout.addWidget(btn, r, c, 1, 1, alignment=Qt.AlignRight)
            return r + 1

        def _createMasterHauswart(r: int) -> int:
            c = 0
            lbl = BaseLabel("Hauswart: ")
            l.addWidget(lbl, r, c)
            c = 1
            l.addWidget(self._beHauswart, r, c, 1, 3)
            c = 4
            l.addWidget(BaseLabel("Telefon: "),
                        r,
                        c,
                        1,
                        1,
                        alignment=Qt.AlignRight)
            c = 5
            l.addWidget(self._beHauswartTelefon, r, c, 1, 2)
            c = 7
            l.addWidget(BaseLabel("mailto:"),
                        r,
                        c,
                        1,
                        1,
                        alignment=Qt.AlignRight)
            c = 8
            l.addWidget(self._beHauswartMailto, r, c, 1, 4)
            return r

        def _createVeraeussertAm(r: int) -> int:
            c = 0
            l.addWidget(BaseLabel("veräußert am:"), r, c)
            c = 1
            self._sdVeraeussertAm.setMaximumWidth(90)
            l.addWidget(self._sdVeraeussertAm, r, c)
            return r

        r = _createMasterHeader(r)
        r = _createMasterAddress(r + 1)
        r = _createMasterMore(r + 1)
        r = _createVerwalter(r + 1)
        r = _createMasterHauswart(r + 1)
        r = _createVeraeussertAm(r + 1)
        r += 1
        self._meBemerkungMaster.setMaximumHeight(50)
        l.addWidget(self._meBemerkungMaster, r, 0, 1, self._anzCols)
        l.setRowStretch(r, 1)
        return r + 1

    def _createMietObjektDisplay(self, r: int):  #, x: XMietobjektExt ):
        self._createHLine(r, self._anzCols)
        r += 1
        wrapper = QWidget()
        wrapper.setStyleSheet("background: lightgray;")
        hbl = QHBoxLayout()
        wrapper.setLayout(hbl)
        self._layout.addWidget(wrapper, r, 0, 1, self._anzCols)
        #################### Mietobjekt
        lbl = LabelTimes12("Mietobjekt: ")
        hbl.addWidget(lbl, alignment=Qt.AlignRight)
        hbl.addWidget(self._lblMietobjekt, alignment=Qt.AlignLeft)
        #################### Wohnungsbezeichnung
        lbl = LabelTimes12("Bezeichnung: ")
        hbl.addWidget(lbl, alignment=Qt.AlignRight)
        #self._beWhgBez.setStyleSheet( "background: white;" )
        hbl.addWidget(self._beWhgBez, alignment=Qt.AlignLeft)
        r += 1
        self._createHLine(r)
        #################### Mieter
        r, c = r + 1, 0
        lbl = BaseLabel("Mieter: ")
        self._layout.addWidget(lbl, r, c)
        c += 1
        #self._lblMieter.setText()
        self._layout.addWidget(self._lblMieter, r, c, 1, 4)
        ############################# Telefon + mobil Mieter
        c += 5
        lbl = BaseLabel("Tel.: ")
        self._layout.addWidget(lbl, r, c, alignment=Qt.AlignRight)
        c += 1
        #self._lblTelefonMieter.setText( x.telefon_mieter )
        self._layout.addWidget(self._lblTelefonMieter, r, c)
        ############################## Mailto Mieter
        c += 1
        lbl = BaseLabel("mailto: ")
        self._layout.addWidget(lbl, r, c, 1, 1, alignment=Qt.AlignRight)
        c += 1
        #self._lblMailtoMieter.setText( x.mailto_mieter )
        self._layout.addWidget(self._lblMailtoMieter, r, c, 1, 2)
        ################################## Button Edit Mietverhältnis
        c = 11
        btn = EditButton()
        btn.clicked.connect(self.edit_mieter.emit)
        self._layout.addWidget(btn, r, c, 1, 1, alignment=Qt.AlignRight)
        #################### Netto-Miete und NKV
        r, c = r + 1, 0
        lbl = BaseLabel("Netto-Miete: ")
        self._layout.addWidget(lbl, r, c)
        c += 1
        #self._lblNettoMiete.setText( str( x.nettomiete ) )
        self._layout.addWidget(self._lblNettoMiete, r, c)
        c = 2  # NKV-Label soll linksbündig mit Tel.-Label des Master-Objekts sein
        lbl = BaseLabel("NKV: ")
        self._layout.addWidget(lbl, r, c, 1, 1, alignment=Qt.AlignRight)
        c = 3
        #self._lblNkv.setText( str( x.nkv ) )
        self._layout.addWidget(self._lblNkv, r, c)
        c = 4
        lbl = BaseLabel("Miete brutto: ")
        self._layout.addWidget(lbl, r, c, alignment=Qt.AlignRight)
        c = 5
        self._layout.addWidget(self._lblBruttoMiete, r, c)
        c = 8
        lbl = BaseLabel("Kaution: ")
        self._layout.addWidget(lbl, r, c, alignment=Qt.AlignRight)
        c = 9
        self._layout.addWidget(self._lblKaution, r, c)
        # ######################### Button Edit Miete
        c = 11
        btn = EditButton()
        btn.clicked.connect(self.edit_miete.emit)
        self._layout.addWidget(btn, r, c, 1, 1, alignment=Qt.AlignRight)
        # #################### HGV und RüZuFü
        r, c = r + 1, 0
        lbl = BaseLabel("HGV netto: ")
        self._layout.addWidget(lbl, r, c)
        c = 1
        #self._lblHgvNetto.setText( str( x.hgv_netto ) )
        self._layout.addWidget(self._lblHgvNetto, r, c)
        c = 2
        lbl = BaseLabel("RüZuFü: ")
        self._layout.addWidget(lbl, r, c, 1, 1, alignment=Qt.AlignRight)
        c = 3
        #self._lblRueZuFue.setText( str( x.ruezufue ) )
        self._layout.addWidget(self._lblRueZuFue, r, c)
        c = 4
        lbl = BaseLabel("HGV brutto: ")
        self._layout.addWidget(lbl, r, c, alignment=Qt.AlignRight)
        c = 5
        #self._lblHgvBrutto.setText( str( x.hgv_brutto ) )
        self._layout.addWidget(self._lblHgvBrutto, r, c)
        # ############################# Button Edit HGV
        c = 11
        btn = EditButton()
        btn.clicked.connect(self.edit_hausgeld.emit)
        self._layout.addWidget(btn, r, c, 1, 1, alignment=Qt.AlignRight)
        # #################### qm
        r, c = r + 1, 0
        lbl = LabelArial12("qm: ")
        self._layout.addWidget(lbl, r, c)
        c = 1
        self._bbeQm.setMaximumWidth(40)
        #self._bbeQm.setText( str( x.qm ) )
        self._bbeQm.setEnabled(False)
        self._layout.addWidget(self._bbeQm, r, c)
        #################### Container-Nr.
        c = 2
        lbl = LabelArial12("Container-Nr.:")
        self._layout.addWidget(lbl, r, c, alignment=Qt.AlignRight)
        c = 3
        self._layout.addWidget(self._beContainerNr, r, c, 1, 4)
        # ###################### Bemerkung zum Mietobjekt
        r, c = r + 1, 0
        #self._meBemerkungMobj.setText( x.bemerkung_mietobjekt )
        self._meBemerkungMobj.setPlaceholderText(
            "<Bemerkungen zur Wohnung (Mietobjekt)>")
        self._meBemerkungMobj.setMaximumHeight(46)
        self._layout.addWidget(self._meBemerkungMobj, r, c, 1, self._anzCols)
        self._layout.setRowStretch(r, 1)

    def setData(self, x: XMietobjektExt):
        self._dataToGui(x)

    def getMietobjektCopyWithChanges(self) -> XMietobjektExt:
        xcopy: XMietobjektExt = copy.copy(self._mietobjekt)
        self._guiToData(xcopy)
        return xcopy

    def _dataToGui(self, x: XMietobjektExt):
        # data für Masterobjekt
        self._lblMasterId.setText(str(x.master_id))
        self._bbeMasterName.setText(x.master_name)
        self._bbeStrHnr.setText(x.strasse_hnr)
        self._bbeStrHnr.setCursorPosition(0)
        self._bbePlz.setText(x.plz)
        self._bbeOrt.setText(x.ort)
        self._bbeAnzWhg.setText(str(x.anz_whg))
        self._bbeGesamtWfl.setText(str(x.gesamt_wfl))
        self._lblVerwalter.setText(x.verwalter)
        self._lblWEG.setText(x.weg_name)
        self._beHauswart.setText(x.hauswart)
        self._beHauswart.setCursorPosition(0)
        self._beHauswartTelefon.setText(x.hauswart_telefon)
        self._beHauswartMailto.setText(x.hauswart_mailto)
        self._beHauswartMailto.setCursorPosition(0)
        if x.veraeussert_am:
            self._sdVeraeussertAm.setDateFromIsoString(x.veraeussert_am)
        self._meBemerkungMaster.setText(x.bemerkung_masterobjekt)
        # data für Mietobjekt
        self._lblMietobjekt.setText(x.mobj_id)
        self._beWhgBez.setText(x.whg_bez)
        self._lblMieter.setText(x.mieter)
        self._lblTelefonMieter.setText(x.telefon_mieter)
        self._lblMailtoMieter.setText(x.mailto_mieter)
        self._lblNettoMiete.setText(str(x.nettomiete))
        self._lblNkv.setText(str(x.nkv))
        self._lblBruttoMiete.setText(str(x.nettomiete + x.nkv))
        self._lblKaution.setText(str(x.kaution))
        self._lblHgvNetto.setText(str(x.hgv_netto))
        self._lblRueZuFue.setText(str(x.ruezufue))
        self._lblHgvBrutto.setText(str(x.hgv_brutto))
        self._bbeQm.setText(str(x.qm))
        self._beContainerNr.setText(x.container_nr)
        self._meBemerkungMobj.setText(x.bemerkung_mietobjekt)

    def _guiToData(self, x: XMietobjektExt):
        # Masterobjekt
        x.strasse_hnr = self._bbeStrHnr.text()
        x.plz = self._bbePlz.text()
        x.ort = self._bbeOrt.text()
        x.verwalter = self._lblVerwalter.text()
        x.weg_name = self._lblWEG.text()
        x.veraeussert_am = self._sdVeraeussertAm.getDate()
        x.hauswart = self._beHauswart.text()
        x.hauswart_telefon = self._beHauswartTelefon.text()
        x.hauswart_mailto = self._beHauswartMailto.text()
        x.bemerkung_masterobjekt = self._meBemerkungMaster.toPlainText()
        # Mietobjekt
        x.whg_bez = self._beWhgBez.text()
        x.container_nr = self._beContainerNr.text()
        x.bemerkung_mietobjekt = self._meBemerkungMobj.toPlainText()

    def applyChanges(self):
        self._guiToData(self._mietobjekt)

    def onChange(self):
        self._btnSave.setEnabled(True)

    def onResetChangeFlag(self):
        self._btnSave.setEnabled(False)

    def getModel(self):
        return self._mietobjekt