def initUI(self):

        self.layout = QVBoxLayout()

        header = QLabel(self)
        header.setGeometry(0, 0, 655, 106)
        pixmap = QPixmap("./resources/ui/debriefing.png")
        header.setPixmap(pixmap)
        self.layout.addWidget(header)
        self.layout.addStretch()

        title = QLabel("<b>Casualty report</b>")
        self.layout.addWidget(title)

        # Player lost units
        lostUnits = QGroupBox(
            f"{self.debriefing.player_country}'s lost units:")
        lostUnitsLayout = QGridLayout()
        lostUnits.setLayout(lostUnitsLayout)

        row = 0
        player_air_losses = self.debriefing.air_losses.by_type(player=True)
        for unit_type, count in player_air_losses.items():
            try:
                lostUnitsLayout.addWidget(
                    QLabel(db.unit_get_expanded_info(self.debriefing.player_country, unit_type, 'name')), row, 0)
                lostUnitsLayout.addWidget(QLabel(str(count)), row, 1)
                row += 1
            except AttributeError:
                logging.exception(
                    f"Issue adding {unit_type} to debriefing information")

        front_line_losses = self.debriefing.front_line_losses_by_type(
            player=True
        )
        for unit_type, count in front_line_losses.items():
            try:
                lostUnitsLayout.addWidget(
                    QLabel(db.unit_type_name(unit_type)), row, 0)
                lostUnitsLayout.addWidget(QLabel(str(count)), row, 1)
                row += 1
            except AttributeError:
                logging.exception(
                    f"Issue adding {unit_type} to debriefing information")

        building_losses = self.debriefing.building_losses_by_type(player=True)
        for building, count in building_losses.items():
            try:
                lostUnitsLayout.addWidget(QLabel(building), row, 0)
                lostUnitsLayout.addWidget(QLabel(str(count)), row, 1)
                row += 1
            except AttributeError:
                logging.exception(
                    f"Issue adding {building} to debriefing information")

        self.layout.addWidget(lostUnits)

        # Enemy lost units
        enemylostUnits = QGroupBox(
            f"{self.debriefing.enemy_country}'s lost units:")
        enemylostUnitsLayout = QGridLayout()
        enemylostUnits.setLayout(enemylostUnitsLayout)

        enemy_air_losses = self.debriefing.air_losses.by_type(player=False)
        for unit_type, count in enemy_air_losses.items():
            try:
                enemylostUnitsLayout.addWidget(
                    QLabel(db.unit_get_expanded_info(self.debriefing.enemy_country, unit_type, 'name')), row, 0)
                enemylostUnitsLayout.addWidget(QLabel(str(count)), row, 1)
                row += 1
            except AttributeError:
                logging.exception(
                    f"Issue adding {unit_type} to debriefing information")

        front_line_losses = self.debriefing.front_line_losses_by_type(
            player=False
        )
        for unit_type, count in front_line_losses.items():
            if count == 0:
                continue
            enemylostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)), row, 0)
            enemylostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
            row += 1

        building_losses = self.debriefing.building_losses_by_type(player=False)
        for building, count in building_losses.items():
            try:
                enemylostUnitsLayout.addWidget(QLabel(building), row, 0)
                enemylostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
                row += 1
            except AttributeError:
                logging.exception(
                    f"Issue adding {building} to debriefing information")

        self.layout.addWidget(enemylostUnits)

        # TODO: Display dead ground object units and runways.

        # confirm button
        okay = QPushButton("Okay")
        okay.clicked.connect(self.close)
        self.layout.addWidget(okay)

        self.setLayout(self.layout)
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setFixedSize(500, 420)
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowTitle('About HwMonitorAlignment')

        self._layout = QGridLayout()
        self._read_libraries()

        self.header_label = QLabel(self)
        self.header_label.setPixmap(
            load_pixmap('icon.ico').scaled(125, 125, Qt.KeepAspectRatio))
        # self.header_label.setPixmap(QPixmap('doc/hma_logo_left.png').scaledToWidth(480))
        self._layout.addWidget(self.header_label, 0, 0)

        self.short_info = QLabel()
        self.short_info.setAlignment(Qt.AlignCenter)
        self.short_info.setText('<h2>{0} {1}</h2>'
                                '<p>{2}</p>'
                                '<a href="{3}">Project website</a>'.format(
                                    str(hwmonitor.__name__),
                                    str(hwmonitor.__version__),
                                    str(hwmonitor.__description__),
                                    str(hwmonitor.__website__)))
        self.short_info.setWordWrap(True)
        self.short_info.setOpenExternalLinks(True)
        self._layout.addWidget(self.short_info, 0, 1)

        # spacer
        self._layout.addWidget(QWidget(), 0, 2, 1, 1)

        # Info tabs
        self.tab_widget = QTabWidget(self)
        self._layout.addWidget(self.tab_widget, 2, 0, 1, 3)

        # Software Licenses Widget
        self.library_table = QTableWidget(len(self._libraries), 2,
                                          self.tab_widget)
        self.library_table.setHorizontalHeaderLabels(
            self.SOFTWARE_HEADER_NAMES)
        self.library_table.horizontalHeader().setStretchLastSection(True)
        self.library_table.setEditTriggers(QTableWidget.NoEditTriggers)
        self.library_table.setSelectionMode(QTableWidget.NoSelection)
        self.library_table.verticalHeader().hide()
        self.library_table.setColumnWidth(0, int(self.width() / 3 * 1.8))
        self.library_table.setShowGrid(False)
        self.tab_widget.addTab(self.library_table,
                               'Third-party software components')

        # Buttons
        self.dialog_buttons = QDialogButtonBox(Qt.Horizontal, self)
        self.dialog_buttons.setStyleSheet('* { button-layout: 2 }')
        self.close_button = self.dialog_buttons.addButton(
            "Close", QDialogButtonBox.AcceptRole)
        self.about_button = self.dialog_buttons.addButton(
            "About Qt", QDialogButtonBox.HelpRole)

        self.close_button.clicked.connect(self.accept)
        self.about_button.clicked.connect(qApp.aboutQt)

        self._layout.addWidget(self.dialog_buttons, 3, 0, 1, 3)

        self._layout.setColumnStretch(0, 1)
        self._layout.setColumnStretch(1, 3)

        self._layout.setRowStretch(0, 6)
        self._layout.setRowStretch(1, 1)
        self._layout.setRowStretch(2, 16)
        self._layout.setRowStretch(3, 3)

        self.setLayout(self._layout)
        self._populate_library_tree()
    def __init__(self, parent, metadata):
        """Groupbox for NWBFile fields filling form."""
        super().__init__(title="NWBFile", parent=parent)
        self.parent = parent
        self.metadata = metadata
        #self.setTitle('NWBFile')
        self.group_type = 'NWBFile'
        self.groups_list = []

        self.grid = QGridLayout()
        self.grid.setColumnStretch(2, 1)
        self.grid.setColumnStretch(4, 1)

        self.lbl_session_description = QLabel(
            'session_description<span style="color:' +
            required_asterisk_color + ';">*</span>:')
        self.form_session_description = QLineEdit("session_description")
        self.form_session_description.setToolTip(
            "A description of the session where this data was generated")
        self.grid.addWidget(self.lbl_session_description, 0, 0, 1, 2)
        self.grid.addWidget(self.form_session_description, 0, 2, 1, 4)

        self.lbl_identifier = QLabel('identifier<span style="color:' +
                                     required_asterisk_color + ';">*</span>:')
        self.form_identifier = QLineEdit("ABC123")
        self.form_identifier.setToolTip(
            "a unique text identifier for the file")
        self.grid.addWidget(self.lbl_identifier, 1, 0, 1, 2)
        self.grid.addWidget(self.form_identifier, 1, 2, 1, 4)

        self.lbl_session_start_time = QLabel(
            'session_start_time<span style="color:' + required_asterisk_color +
            ';">*</span>:')
        self.form_session_start_time1 = QLineEdit("")
        self.form_session_start_time1.setPlaceholderText("dd/mm/yyyy")
        self.form_session_start_time1.setToolTip(
            "the start date and time of the recording session")
        self.form_session_start_time2 = QLineEdit("")
        self.form_session_start_time2.setPlaceholderText("hh:mm")
        self.form_session_start_time2.setToolTip(
            "the start date and time of the recording session")
        self.grid.addWidget(self.lbl_session_start_time, 2, 0, 1, 2)
        self.grid.addWidget(self.form_session_start_time1, 2, 2, 1, 2)
        self.grid.addWidget(self.form_session_start_time2, 2, 4, 1, 2)

        self.lbl_experimenter = QLabel('experimenter:')
        self.form_experimenter = QLineEdit('')
        self.form_experimenter.setPlaceholderText(
            "Alan Lloyd Hodgkin, Andrew Fielding Huxley")
        self.form_experimenter.setToolTip(
            "Comma-separated list of names of persons who performed experiment"
        )
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_experimenter, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_experimenter, nWidgetsGrid, 2, 1, 4)

        self.lbl_experiment_description = QLabel('experiment_description:')
        self.form_experiment_description = QLineEdit('')
        self.form_experiment_description.setPlaceholderText(
            "propagation of action potentials in the squid giant axon")
        self.form_experiment_description.setToolTip(
            "general description of the experiment")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_experiment_description, nWidgetsGrid, 0,
                            1, 2)
        self.grid.addWidget(self.form_experiment_description, nWidgetsGrid, 2,
                            1, 4)

        self.lbl_session_id = QLabel('session_id:')
        self.form_session_id = QLineEdit('')
        self.form_session_id.setPlaceholderText("LAB 0123")
        self.form_session_id.setToolTip("lab-specific ID for the session")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_session_id, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_session_id, nWidgetsGrid, 2, 1, 4)

        self.lbl_institution = QLabel('institution:')
        self.form_institution = QLineEdit('')
        self.form_institution.setPlaceholderText("institution")
        self.form_institution.setToolTip(
            "institution(s) where experiment is performed")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_institution, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_institution, nWidgetsGrid, 2, 1, 4)

        self.lbl_lab = QLabel("lab:")
        self.form_lab = QLineEdit('')
        self.form_lab.setPlaceholderText("lab name")
        self.form_lab.setToolTip("lab where experiment was performed")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_lab, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_lab, nWidgetsGrid, 2, 1, 4)

        if 'lab_meta_data' in metadata.keys():
            self.lbl_lab_meta_data = QLabel("lab_meta_data:")
            self.lab_meta_data = GroupCustomExtension(
                parent=self, metadata=metadata['lab_meta_data'])
            self.lab_meta_data.setToolTip(
                "an extension that contains lab-specific meta-data")
            nWidgetsGrid = self.grid.rowCount()
            self.grid.addWidget(self.lbl_lab_meta_data, nWidgetsGrid, 0, 1, 2)
            self.grid.addWidget(self.lab_meta_data, nWidgetsGrid, 2, 1, 4)

        self.lbl_keywords = QLabel('keywords:')
        self.form_keywords = QLineEdit('')
        self.form_keywords.setPlaceholderText(
            "action potential, ion channels, mathematical model")
        self.form_keywords.setToolTip(
            "comma-separated list of terms to search over")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_keywords, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_keywords, nWidgetsGrid, 2, 1, 4)

        self.lbl_notes = QLabel("notes:")
        self.form_notes = QLineEdit('')
        self.form_notes.setPlaceholderText("")
        self.form_notes.setToolTip("Notes about the experiment")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_notes, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_notes, nWidgetsGrid, 2, 1, 4)

        self.lbl_pharmacology = QLabel("pharmacology:")
        self.form_pharmacology = QLineEdit('')
        self.form_pharmacology.setPlaceholderText("")
        self.form_pharmacology.setToolTip(
            "Description of drugs used, including how and when they were administered.\n"
            "Anesthesia(s), painkiller(s), etc., plus dosage, concentration, etc."
        )
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_pharmacology, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_pharmacology, nWidgetsGrid, 2, 1, 4)

        self.lbl_protocol = QLabel("protocol:")
        self.form_protocol = QLineEdit('')
        self.form_protocol.setPlaceholderText("")
        self.form_protocol.setToolTip(
            "Experimental protocol, if applicable. E.g. include IACUC protocol"
        )
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_protocol, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_protocol, nWidgetsGrid, 2, 1, 4)

        self.lbl_related_publications = QLabel("related publications:")
        self.form_related_publications = QLineEdit('')
        self.form_related_publications.setPlaceholderText("")
        self.form_related_publications.setToolTip(
            "Publication information. PMID, DOI, URL, etc. If multiple, concatenate "
            "together \nand describe which is which")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_related_publications, nWidgetsGrid, 0, 1,
                            2)
        self.grid.addWidget(self.form_related_publications, nWidgetsGrid, 2, 1,
                            4)

        self.lbl_slices = QLabel("slices:")
        self.form_slices = QLineEdit('')
        self.form_slices.setPlaceholderText("")
        self.form_slices.setToolTip(
            "Description of slices, including information about preparation thickness,"
            "\norientation, temperature and bath solution")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_slices, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_slices, nWidgetsGrid, 2, 1, 4)

        self.lbl_data_collection = QLabel("data_collection:")
        self.form_data_collection = QLineEdit('')
        self.form_data_collection.setPlaceholderText("")
        self.form_data_collection.setToolTip(
            "Notes about data collection and analysis")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_data_collection, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_data_collection, nWidgetsGrid, 2, 1, 4)

        self.lbl_surgery = QLabel("surgery:")
        self.form_surgery = QLineEdit('')
        self.form_surgery.setPlaceholderText("")
        self.form_surgery.setToolTip(
            "Narrative description about surgery/surgeries, including date(s) and who performed surgery."
        )
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_surgery, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_surgery, nWidgetsGrid, 2, 1, 4)

        self.lbl_virus = QLabel("virus:")
        self.form_virus = QLineEdit('')
        self.form_virus.setPlaceholderText("")
        self.form_virus.setToolTip(
            "Information about virus(es) used in experiments, including virus ID, source, "
            "date made, injection location, volume, etc.")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_virus, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_virus, nWidgetsGrid, 2, 1, 4)

        self.lbl_stimulus_notes = QLabel("stimulus_notes:")
        self.form_stimulus_notes = QLineEdit('')
        self.form_stimulus_notes.setPlaceholderText("")
        self.form_stimulus_notes.setToolTip(
            "Notes about stimuli, such as how and where presented.")
        nWidgetsGrid = self.grid.rowCount()
        self.grid.addWidget(self.lbl_stimulus_notes, nWidgetsGrid, 0, 1, 2)
        self.grid.addWidget(self.form_stimulus_notes, nWidgetsGrid, 2, 1, 4)
        #self.setLayout(self.grid)
        self.setContentLayout(self.grid)
 def init_ui(self):
     airport = self.game.theater.terrain.airport_by_id(self.cp.id)
     layout = QGridLayout()
     layout.addWidget(QBaseInformation(self.cp, airport, self.game))
     self.setLayout(layout)
Beispiel #5
0
    def initUI(self):
        '''
        Sets up major UI components
        '''

        # Create a rectengle from teh given outer dimensions
        textBoxRect = self.rect()
        # Shrink it for matiching textBox size
        textBoxRect.adjust(+30, +30, -12, -12)

        buttonRect = self.rect()
        buttonRect.adjust(+29, +30, +15, -20)

        self.row1Left = buttonRect.topLeft()
        self.row1Right = buttonRect.topRight()
        self.row2Left = QPoint(self.row1Left.x(), self.row1Left.y() + 35)
        self.row2Right = QPoint(self.row1Right.x(), self.row1Right.y() + 35)
        self.row3Left = QPoint(self.row2Left.x(), self.row2Left.y() + 35)
        self.row3Right = QPoint(self.row2Right.x(), self.row2Right.y() + 35)
        self.bottomLeft = QPoint(buttonRect.topLeft().x(),
                                 buttonRect.topLeft().y() + 140)
        self.bottomRight = QPoint(self.row1Right.x(), self.row1Right.y() + 140)
        self.bottomMiddle = QPoint(self.row1Left.x() + 65, self.row1Right.y())

        # We use a textEdit for making text boxes editable for user
        self.pTextEdit = QTextEdit(self)
        # Always enable line wrapping
        self.pTextEdit.setLineWrapMode(QTextEdit.WidgetWidth)
        self.pTextEdit.setAutoFormatting(QTextEdit.AutoAll)
        self.pTextEdit.setAcceptRichText(True)
        self.pTextEdit.setFontPointSize(10)
        self.pTextEdit.setPlaceholderText("Text Box Content")

        # Forward keypressevents from the textEdit to the parent toolBoxWidget
        self.keyPressEvent = self.pTextEdit.keyPressEvent
        self.keyReleaseEvent = self.pTextEdit.keyReleaseEvent

        # We need a layout to add the textBox to the toolBoxWidget
        widgetLayout = QGridLayout(self)
        widgetLayout.addWidget(self.pTextEdit)
        self.pTextEdit.setGeometry(textBoxRect)

        buttonSize = QSize(60, 30)

        # -----------------------------
        # Toolbuttons
        # -----------------------------

        self.textButton = QPushButton(self)
        self.textButton.setFixedSize(buttonSize)
        self.textButton.move(self.row1Right)
        self.textButton.setIcon(QIcon(":/assets/text.png"))
        self.textButton.setCheckable(True)
        self.buttons['textButton'] = self.textButton

        self.markerButton = QPushButton(self)
        self.markerButton.setFixedSize(buttonSize)
        self.markerButton.move(self.row1Left)
        self.markerButton.setIcon(QIcon(":/assets/marker.png"))
        self.markerButton.setCheckable(True)
        self.buttons['markerButton'] = self.markerButton

        self.freehandButton = QPushButton(self)
        self.freehandButton.setFixedSize(buttonSize)
        self.freehandButton.move(self.row2Left)
        self.freehandButton.setIcon(QIcon(":/assets/freehand.png"))
        self.freehandButton.setCheckable(True)
        self.buttons['freehandButton'] = self.freehandButton

        self.markdownButton = QPushButton(self)
        self.markdownButton.setFixedSize(buttonSize)
        self.markdownButton.move(self.row2Right)
        self.markdownButton.setIcon(QIcon(":/assets/markdown.png"))
        self.markdownButton.setCheckable(True)
        self.buttons['markdownButton'] = self.markdownButton

        self.formsButton = QPushButton(self)
        self.formsButton.setFixedSize(buttonSize)
        self.formsButton.move(self.row3Left)
        self.formsButton.setIcon(QIcon(":/assets/forms.png"))
        self.formsButton.setCheckable(True)
        self.buttons['formsButton'] = self.formsButton

        self.eraserButton = QPushButton(self)
        self.eraserButton.setFixedSize(buttonSize)
        self.eraserButton.move(self.row3Right)
        self.eraserButton.setIcon(QIcon(":/assets/eraser.png"))
        self.eraserButton.setCheckable(True)
        self.buttons['eraserButton'] = self.eraserButton

        self.okButton = QPushButton(self)
        self.okButton.setFixedSize(buttonSize)
        self.okButton.move(self.bottomLeft)
        self.okButton.setIcon(QIcon(":/assets/ok.png"))
        self.buttons['okButton'] = self.okButton

        self.cancelButton = QPushButton(self)
        self.cancelButton.setFixedSize(buttonSize)
        self.cancelButton.move(self.bottomRight)
        self.cancelButton.setIcon(QIcon(":/assets/cancel.png"))
        self.buttons['cancelButton'] = self.cancelButton

        self.deleteButton = QPushButton(self)
        self.deleteButton.setFixedSize(buttonSize)
        self.deleteButton.move(self.bottomRight)
        self.deleteButton.setIcon(QIcon(":/assets/delete.png"))
        self.buttons['deleteButton'] = self.deleteButton

        self.undoButton = QPushButton(self)
        self.undoButton.setFixedSize(buttonSize)
        self.undoButton.move(self.bottomLeft)
        self.undoButton.setIcon(QIcon(":/assets/undo.png"))
        self.buttons['undoButton'] = self.undoButton

        self.redoButton = QPushButton(self)
        self.redoButton.setFixedSize(buttonSize)
        self.redoButton.move(self.bottomRight)
        self.redoButton.setIcon(QIcon(":/assets/redo.png"))
        self.buttons['redoButton'] = self.redoButton

        # -----------------------------
        # Preference Buttons
        # -----------------------------

        self.sizeButton = QPushButton(self)
        self.sizeButton.setFixedSize(buttonSize)
        self.sizeButton.setIcon(QIcon(":/assets/size.png"))
        self.sizeButton.setCheckable(True)
        self.buttons['sizeButton'] = self.sizeButton

        self.colorButton = QPushButton(self)
        self.colorButton.setFixedSize(buttonSize)
        self.colorButton.setIcon(QIcon(":/assets/color.png"))
        self.colorButton.setCheckable(True)
        self.buttons['colorButton'] = self.colorButton

        # Set Shortcuts for the buttons
        self.textButton.setShortcut("Ctrl+T")
        self.markerButton.setShortcut("Ctrl+M")
        self.freehandButton.setShortcut("Ctrl+D")
        self.eraserButton.setShortcut("Ctrl+E")
        self.okButton.setShortcut("Ctrl+Return")
        self.cancelButton.setShortcut("Esc")
        self.deleteButton.setShortcut("Ctrl+Del")
        self.undoButton.setShortcut("Ctrl+Z")
        self.redoButton.setShortcut("Ctrl+Y")
        self.sizeButton.setShortcut("Ctrl+X")
        self.colorButton.setShortcut("Ctrl+L")

        # Connect Events for the buttons
        self.okButton.clicked.connect(self.handleOkButton)
        self.markerButton.clicked.connect(self.handleMarkerButton)
        self.textButton.clicked.connect(self.handleTextButton)
        self.formsButton.clicked.connect(self.handleFormsButton)
        self.freehandButton.clicked.connect(self.handleFreehandButton)
        self.eraserButton.clicked.connect(self.handleEraserButton)
        self.markdownButton.clicked.connect(self.handleMarkdownButton)
        self.cancelButton.clicked.connect(self.handleCancelButton)
        self.deleteButton.clicked.connect(self.handleDeleteButton)
        self.undoButton.clicked.connect(self.handleUndoButton)
        self.redoButton.clicked.connect(self.handleRedoButton)
        self.sizeButton.clicked.connect(self.handleSizeButton)
        self.colorButton.clicked.connect(self.handleColorButton)

        sliderSize = QSize(15, 140)

        self.slider = QSlider(Qt.Vertical, self)
        self.slider.setMinimum(50)
        self.slider.setMaximum(150)
        self.slider.setValue(100)
        self.slider.move(self.bottomMiddle)
        self.slider.setFixedSize(sliderSize)
        self.slider.setEnabled(False)
        self.slider.valueChanged.connect(self.handleSliderValueChange)
        self.slider.sliderReleased.connect(self.handleSliderValueChanged)
        self.slider.sliderMoved.connect(self.handleSliderDrag)

        self.setButtonState()
Beispiel #6
0
    def initDifficultyLayout(self):

        self.difficultyPage = QWidget()
        self.difficultyLayout = QVBoxLayout()
        self.difficultyLayout.setAlignment(Qt.AlignTop)
        self.difficultyPage.setLayout(self.difficultyLayout)

        # DCS AI difficulty settings
        self.aiDifficultySettings = QGroupBox("AI Difficulty")
        self.aiDifficultyLayout = QGridLayout()
        self.playerCoalitionSkill = QComboBox()
        self.enemyCoalitionSkill = QComboBox()
        self.enemyAASkill = QComboBox()
        for skill in CONST.SKILL_OPTIONS:
            self.playerCoalitionSkill.addItem(skill)
            self.enemyCoalitionSkill.addItem(skill)
            self.enemyAASkill.addItem(skill)

        self.playerCoalitionSkill.setCurrentIndex(
            CONST.SKILL_OPTIONS.index(self.game.settings.player_skill))
        self.enemyCoalitionSkill.setCurrentIndex(
            CONST.SKILL_OPTIONS.index(self.game.settings.enemy_skill))
        self.enemyAASkill.setCurrentIndex(
            CONST.SKILL_OPTIONS.index(self.game.settings.enemy_vehicle_skill))

        self.player_income = TenthsSpinSlider(
            "Player income multiplier",
            1,
            50,
            int(self.game.settings.player_income_multiplier * 10),
        )
        self.player_income.spinner.valueChanged.connect(self.applySettings)
        self.enemy_income = TenthsSpinSlider(
            "Enemy income multiplier",
            1,
            50,
            int(self.game.settings.enemy_income_multiplier * 10),
        )
        self.enemy_income.spinner.valueChanged.connect(self.applySettings)

        self.playerCoalitionSkill.currentIndexChanged.connect(
            self.applySettings)
        self.enemyCoalitionSkill.currentIndexChanged.connect(
            self.applySettings)
        self.enemyAASkill.currentIndexChanged.connect(self.applySettings)

        # Mission generation settings related to difficulty
        self.missionSettings = QGroupBox("Mission Difficulty")
        self.missionLayout = QGridLayout()

        self.manpads = QCheckBox()
        self.manpads.setChecked(self.game.settings.manpads)
        self.manpads.toggled.connect(self.applySettings)

        self.noNightMission = QCheckBox()
        self.noNightMission.setChecked(self.game.settings.night_disabled)
        self.noNightMission.toggled.connect(self.applySettings)

        # DCS Mission options
        self.missionRestrictionsSettings = QGroupBox("Mission Restrictions")
        self.missionRestrictionsLayout = QGridLayout()

        self.difficultyLabel = QComboBox()
        [self.difficultyLabel.addItem(t) for t in CONST.LABELS_OPTIONS]
        self.difficultyLabel.setCurrentIndex(
            CONST.LABELS_OPTIONS.index(self.game.settings.labels))
        self.difficultyLabel.currentIndexChanged.connect(self.applySettings)

        self.mapVisibiitySelection = QComboBox()
        self.mapVisibiitySelection.addItem("All", ForcedOptions.Views.All)
        if self.game.settings.map_coalition_visibility == ForcedOptions.Views.All:
            self.mapVisibiitySelection.setCurrentIndex(0)
        self.mapVisibiitySelection.addItem("Fog of War",
                                           ForcedOptions.Views.Allies)
        if self.game.settings.map_coalition_visibility == ForcedOptions.Views.Allies:
            self.mapVisibiitySelection.setCurrentIndex(1)
        self.mapVisibiitySelection.addItem("Allies Only",
                                           ForcedOptions.Views.OnlyAllies)
        if (self.game.settings.map_coalition_visibility ==
                ForcedOptions.Views.OnlyAllies):
            self.mapVisibiitySelection.setCurrentIndex(2)
        self.mapVisibiitySelection.addItem("Own Aircraft Only",
                                           ForcedOptions.Views.MyAircraft)
        if (self.game.settings.map_coalition_visibility ==
                ForcedOptions.Views.MyAircraft):
            self.mapVisibiitySelection.setCurrentIndex(3)
        self.mapVisibiitySelection.addItem("Map Only",
                                           ForcedOptions.Views.OnlyMap)
        if self.game.settings.map_coalition_visibility == ForcedOptions.Views.OnlyMap:
            self.mapVisibiitySelection.setCurrentIndex(4)
        self.mapVisibiitySelection.currentIndexChanged.connect(
            self.applySettings)

        self.ext_views = QCheckBox()
        self.ext_views.setChecked(self.game.settings.external_views_allowed)
        self.ext_views.toggled.connect(self.applySettings)

        self.aiDifficultyLayout.addWidget(QLabel("Player coalition skill"), 0,
                                          0)
        self.aiDifficultyLayout.addWidget(self.playerCoalitionSkill, 0, 1,
                                          Qt.AlignRight)
        self.aiDifficultyLayout.addWidget(QLabel("Enemy coalition skill"), 1,
                                          0)
        self.aiDifficultyLayout.addWidget(self.enemyCoalitionSkill, 1, 1,
                                          Qt.AlignRight)
        self.aiDifficultyLayout.addWidget(
            QLabel("Enemy AA and vehicles skill"), 2, 0)
        self.aiDifficultyLayout.addWidget(self.enemyAASkill, 2, 1,
                                          Qt.AlignRight)
        self.aiDifficultyLayout.addLayout(self.player_income, 3, 0)
        self.aiDifficultyLayout.addLayout(self.enemy_income, 4, 0)
        self.aiDifficultySettings.setLayout(self.aiDifficultyLayout)
        self.difficultyLayout.addWidget(self.aiDifficultySettings)

        self.missionLayout.addWidget(QLabel("Manpads on frontlines"), 0, 0)
        self.missionLayout.addWidget(self.manpads, 0, 1, Qt.AlignRight)
        self.missionLayout.addWidget(QLabel("No night missions"), 1, 0)
        self.missionLayout.addWidget(self.noNightMission, 1, 1, Qt.AlignRight)
        self.missionSettings.setLayout(self.missionLayout)
        self.difficultyLayout.addWidget(self.missionSettings)

        self.missionRestrictionsLayout.addWidget(QLabel("In Game Labels"), 0,
                                                 0)
        self.missionRestrictionsLayout.addWidget(self.difficultyLabel, 0, 1,
                                                 Qt.AlignRight)
        self.missionRestrictionsLayout.addWidget(
            QLabel("Map visibility options"), 1, 0)
        self.missionRestrictionsLayout.addWidget(self.mapVisibiitySelection, 1,
                                                 1, Qt.AlignRight)
        self.missionRestrictionsLayout.addWidget(
            QLabel("Allow external views"), 2, 0)
        self.missionRestrictionsLayout.addWidget(self.ext_views, 2, 1,
                                                 Qt.AlignRight)
        self.missionRestrictionsSettings.setLayout(
            self.missionRestrictionsLayout)
        self.difficultyLayout.addWidget(self.missionRestrictionsSettings)
Beispiel #7
0
    def initGeneratorLayout(self):
        self.generatorPage = QWidget()
        self.generatorLayout = QVBoxLayout()
        self.generatorLayout.setAlignment(Qt.AlignTop)
        self.generatorPage.setLayout(self.generatorLayout)

        self.gameplay = QGroupBox("Gameplay")
        self.gameplayLayout = QGridLayout()
        self.gameplayLayout.setAlignment(Qt.AlignTop)
        self.gameplay.setLayout(self.gameplayLayout)

        self.supercarrier = QCheckBox()
        self.supercarrier.setChecked(self.game.settings.supercarrier)
        self.supercarrier.toggled.connect(self.applySettings)

        self.generate_marks = QCheckBox()
        self.generate_marks.setChecked(self.game.settings.generate_marks)
        self.generate_marks.toggled.connect(self.applySettings)

        self.never_delay_players = QCheckBox()
        self.never_delay_players.setChecked(
            self.game.settings.never_delay_player_flights)
        self.never_delay_players.toggled.connect(self.applySettings)
        self.never_delay_players.setToolTip(
            "When checked, player flights with a delayed start time will be "
            "spawned immediately. AI wingmen may begin startup immediately.")

        self.gameplayLayout.addWidget(QLabel("Use Supercarrier Module"), 0, 0)
        self.gameplayLayout.addWidget(self.supercarrier, 0, 1, Qt.AlignRight)
        self.gameplayLayout.addWidget(QLabel("Put Objective Markers on Map"),
                                      1, 0)
        self.gameplayLayout.addWidget(self.generate_marks, 1, 1, Qt.AlignRight)
        self.gameplayLayout.addWidget(QLabel("Never delay player flights"), 2,
                                      0)
        self.gameplayLayout.addWidget(self.never_delay_players, 2, 1,
                                      Qt.AlignRight)

        start_type_label = QLabel(
            "Default start type for AI aircraft:<br /><strong>Warning: " +
            "Any option other than Cold breaks OCA/Aircraft missions.</strong>"
        )
        start_type_label.setToolTip(START_TYPE_TOOLTIP)
        start_type = StartTypeComboBox(self.game.settings)
        start_type.setCurrentText(self.game.settings.default_start_type)

        self.gameplayLayout.addWidget(start_type_label, 3, 0)
        self.gameplayLayout.addWidget(start_type, 3, 1)

        self.performance = QGroupBox("Performance")
        self.performanceLayout = QGridLayout()
        self.performanceLayout.setAlignment(Qt.AlignTop)
        self.performance.setLayout(self.performanceLayout)

        self.smoke = QCheckBox()
        self.smoke.setChecked(self.game.settings.perf_smoke_gen)
        self.smoke.toggled.connect(self.applySettings)

        self.red_alert = QCheckBox()
        self.red_alert.setChecked(self.game.settings.perf_red_alert_state)
        self.red_alert.toggled.connect(self.applySettings)

        self.arti = QCheckBox()
        self.arti.setChecked(self.game.settings.perf_artillery)
        self.arti.toggled.connect(self.applySettings)

        self.moving_units = QCheckBox()
        self.moving_units.setChecked(self.game.settings.perf_moving_units)
        self.moving_units.toggled.connect(self.applySettings)

        self.infantry = QCheckBox()
        self.infantry.setChecked(self.game.settings.perf_infantry)
        self.infantry.toggled.connect(self.applySettings)

        self.destroyed_units = QCheckBox()
        self.destroyed_units.setChecked(
            self.game.settings.perf_destroyed_units)
        self.destroyed_units.toggled.connect(self.applySettings)

        self.culling = QCheckBox()
        self.culling.setChecked(self.game.settings.perf_culling)
        self.culling.toggled.connect(self.applySettings)

        self.culling_distance = QSpinBox()
        self.culling_distance.setMinimum(10)
        self.culling_distance.setMaximum(10000)
        self.culling_distance.setValue(
            self.game.settings.perf_culling_distance)
        self.culling_distance.valueChanged.connect(self.applySettings)

        self.culling_do_not_cull_carrier = QCheckBox()
        self.culling_do_not_cull_carrier.setChecked(
            self.game.settings.perf_do_not_cull_carrier)
        self.culling_do_not_cull_carrier.toggled.connect(self.applySettings)

        self.performanceLayout.addWidget(
            QLabel("Smoke visual effect on frontline"), 0, 0)
        self.performanceLayout.addWidget(self.smoke,
                                         0,
                                         1,
                                         alignment=Qt.AlignRight)
        self.performanceLayout.addWidget(
            QLabel("SAM starts in RED alert mode"), 1, 0)
        self.performanceLayout.addWidget(self.red_alert,
                                         1,
                                         1,
                                         alignment=Qt.AlignRight)
        self.performanceLayout.addWidget(QLabel("Artillery strikes"), 2, 0)
        self.performanceLayout.addWidget(self.arti,
                                         2,
                                         1,
                                         alignment=Qt.AlignRight)
        self.performanceLayout.addWidget(QLabel("Moving ground units"), 3, 0)
        self.performanceLayout.addWidget(self.moving_units,
                                         3,
                                         1,
                                         alignment=Qt.AlignRight)
        self.performanceLayout.addWidget(
            QLabel("Generate infantry squads along vehicles"), 4, 0)
        self.performanceLayout.addWidget(self.infantry,
                                         4,
                                         1,
                                         alignment=Qt.AlignRight)
        self.performanceLayout.addWidget(
            QLabel("Include destroyed units carcass"), 6, 0)
        self.performanceLayout.addWidget(self.destroyed_units,
                                         6,
                                         1,
                                         alignment=Qt.AlignRight)

        self.performanceLayout.addWidget(QHorizontalSeparationLine(), 7, 0, 1,
                                         2)
        self.performanceLayout.addWidget(
            QLabel("Culling of distant units enabled"), 8, 0)
        self.performanceLayout.addWidget(self.culling,
                                         8,
                                         1,
                                         alignment=Qt.AlignRight)
        self.performanceLayout.addWidget(QLabel("Culling distance (km)"), 9, 0)
        self.performanceLayout.addWidget(self.culling_distance,
                                         9,
                                         1,
                                         alignment=Qt.AlignRight)
        self.performanceLayout.addWidget(
            QLabel("Do not cull carrier's surroundings"), 10, 0)
        self.performanceLayout.addWidget(self.culling_do_not_cull_carrier,
                                         10,
                                         1,
                                         alignment=Qt.AlignRight)

        self.generatorLayout.addWidget(self.gameplay)
        self.generatorLayout.addWidget(
            QLabel(
                "Disabling settings below may improve performance, but will impact the overall quality of the experience."
            ))
        self.generatorLayout.addWidget(self.performance)
    def __init__(self, parent):
        """Groupbox for pynwb.misc.IntervalSeries fields filling form."""
        super().__init__()
        self.setTitle('IntervalSeries')
        self.parent = parent
        self.group_type = 'IntervalSeries'

        self.lbl_name = QLabel('name<span style="color:' +
                               required_asterisk_color + ';">*</span>:')
        self.form_name = QLineEdit('IntervalSeries')
        self.form_name.setToolTip(
            "The unique name of this IntervalSeries dataset")

        self.lbl_timestamps = QLabel('timestamps:')
        self.chk_timestamps = QCheckBox("Get from source file")
        self.chk_timestamps.setChecked(False)
        self.chk_timestamps.setToolTip(
            "Timestamps for samples stored in data.\n"
            "Check box if this data will be retrieved from source file.\n"
            "Uncheck box to ignore it.")

        self.lbl_comments = QLabel('comments:')
        self.form_comments = QLineEdit('')
        self.form_comments.setPlaceholderText("comments")
        self.form_comments.setToolTip(
            "Human-readable comments about this IntervalSeries dataset")

        self.lbl_description = QLabel('description:')
        self.form_description = QLineEdit('')
        self.form_description.setPlaceholderText("description")
        self.form_description.setToolTip(
            " Description of this IntervalSeries dataset")

        self.lbl_control = QLabel('control:')
        self.chk_control = QCheckBox("Get from source file")
        self.chk_control.setChecked(False)
        self.chk_control.setToolTip(
            "Numerical labels that apply to each element in data.\n"
            "Check box if this data will be retrieved from source file.\n"
            "Uncheck box to ignore it.")

        self.lbl_control_description = QLabel('control_description:')
        self.chk_control_description = QCheckBox("Get from source file")
        self.chk_control_description.setChecked(False)
        self.chk_control_description.setToolTip(
            "Description of each control value.\n"
            "Check box if this data will be retrieved from source file.\n"
            "Uncheck box to ignore it.")

        self.grid = QGridLayout()
        self.grid.setColumnStretch(2, 1)
        self.grid.addWidget(self.lbl_name, 0, 0, 1, 2)
        self.grid.addWidget(self.form_name, 0, 2, 1, 4)
        self.grid.addWidget(self.lbl_timestamps, 2, 0, 1, 2)
        self.grid.addWidget(self.chk_timestamps, 2, 2, 1, 2)
        self.grid.addWidget(self.lbl_comments, 3, 0, 1, 2)
        self.grid.addWidget(self.form_comments, 3, 2, 1, 4)
        self.grid.addWidget(self.lbl_description, 4, 0, 1, 2)
        self.grid.addWidget(self.form_description, 4, 2, 1, 4)
        self.grid.addWidget(self.lbl_control, 5, 0, 1, 2)
        self.grid.addWidget(self.chk_control, 5, 2, 1, 2)
        self.grid.addWidget(self.lbl_control_description, 6, 0, 1, 2)
        self.grid.addWidget(self.chk_control_description, 6, 2, 1, 2)
        self.setLayout(self.grid)
Beispiel #9
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Spot Extractor")

        menuBar = self.buildMenuBar()
        widget = QWidget(self)
        layout = QGridLayout(widget)

        # Main Image Window
        self.scrollArea = QScrollArea()
        self.imageLabel = ImageLabel(self)
        self.scrollArea.setWidget(self.imageLabel)

        # Text Label for Lot Name
        self.lotNameTextField = QLineEdit()
        self.lotNameTextField.setFixedWidth(300)

        # Spot List
        self.spotList = SpotListWidget(self)

        # Image Box Layout
        imageGroupBox = QGroupBox("Image")
        imageLayout = QHBoxLayout()
        imageLayout.addWidget(self.scrollArea)
        imageGroupBox.setLayout(imageLayout)

        # Spot List Box Layout
        rightGroupBox = QGroupBox()
        rightGroupBox.setMaximumWidth(300)
        rightGroupLayout = QVBoxLayout()

        lotNameGroupBox = QGroupBox("Lot Name")
        lotNameLayout = QHBoxLayout()
        lotNameLayout.addWidget(self.lotNameTextField)
        lotNameGroupBox.setLayout(lotNameLayout)

        spotsGroupBox = QGroupBox("Spot List")
        spotsLayout = QHBoxLayout()
        spotsLayout.addWidget(self.spotList)
        spotsGroupBox.setLayout(spotsLayout)

        rightGroupLayout.addWidget(lotNameGroupBox)
        rightGroupLayout.addWidget(spotsGroupBox)
        rightGroupBox.setLayout(rightGroupLayout)

        # Control Buttons Box Layout
        horizontalGroupBox = QGroupBox("Control Buttons")
        controlButtonLayout = QHBoxLayout()
        checkAllButton = QPushButton("Check All")
        uncheckAllButton = QPushButton("Uncheck All")
        deleteCheckedButton = QPushButton("Delete Checked")
        checkAllButton.clicked.connect(self.checkAll)
        uncheckAllButton.clicked.connect(self.uncheckAll)
        deleteCheckedButton.clicked.connect(self.deleteAllChecked)
        controlButtonLayout.addWidget(checkAllButton)
        controlButtonLayout.addWidget(uncheckAllButton)
        controlButtonLayout.addWidget(deleteCheckedButton)
        horizontalGroupBox.setLayout(controlButtonLayout)

        layout.addWidget(imageGroupBox, 0, 0)
        layout.addWidget(rightGroupBox, 0, 1)
        layout.addWidget(horizontalGroupBox, 1, 0, 1, 2)

        self.setMenuBar(menuBar)
        self.setLayout(layout)
        self.setCentralWidget(widget)
Beispiel #10
0
    YELLOW = auto()
    BLUE = auto()
    GREEN = YELLOW | BLUE
    ORANGE = RED | YELLOW
    PURPLE = RED | BLUE
    WHITE = RED | YELLOW | BLUE


def set_value(property_, value):
    print("Set Value of: %s" % (property_.propertyManager(), ))


if __name__ == "__main__":
    app = QApplication(sys.argv)
    dialog = QDialog()
    layout = QGridLayout()
    group = [None] * 2

    tree_scroll_area = QScrollArea()
    tree_browser = QtTreePropertyBrowser()
    # tree_browser.setAttributes([BrowserCol.MINIMUM, BrowserCol.MAXIMUM])
    tree_browser.setAttributes(
        [BrowserCol.UNIT, BrowserCol.FORMAT, BrowserCol.CHECK])
    box_scroll_area = QScrollArea()
    box_browser = QtGroupBoxPropertyBrowser()
    # box_browser.setAttributes([BrowserCol.MINIMUM, BrowserCol.MAXIMUM])
    box_browser.setAttributes(
        [BrowserCol.UNIT, BrowserCol.FORMAT, BrowserCol.CHECK])
    button_scroll_area = QScrollArea()
    button_browser = QtButtonPropertyBrowser()
    # button_browser.setAttributes([BrowserCol.MINIMUM, BrowserCol.MAXIMUM])
    def __init__(self, parent):
        """Groupbox for pynwb.misc.DecompositionSeries fields filling form."""
        super().__init__()
        self.setTitle('DecompositionSeries')
        self.parent = parent
        self.group_type = 'DecompositionSeries'

        self.lbl_name = QLabel('name<span style="color:' +
                               required_asterisk_color + ';">*</span>:')
        self.form_name = QLineEdit('DecompositionSeries')
        self.form_name.setToolTip(
            "The unique name of this DecompositionSeries dataset")

        self.lbl_description = QLabel('description<span style="color:' +
                                      required_asterisk_color + ';">*</span>:')
        self.form_description = QLineEdit('description')
        self.form_description.setToolTip(
            "Description of this DecompositionSeries")

        self.lbl_metric = QLabel('metric<span style="color:' +
                                 required_asterisk_color + ';">*</span>:')
        self.form_metric = QLineEdit('amplitude')
        self.form_metric.setToolTip(
            "Metric of analysis. Recommended: ‘phase’, ‘amplitude’, ‘power’")

        self.lbl_unit = QLabel('unit:')
        self.form_unit = QLineEdit('')
        self.form_unit.setPlaceholderText("no unit")
        self.form_unit.setToolTip("SI unit of measurement")

        self.lbl_bands = QLabel('bands:')
        self.chk_bands = QCheckBox("Get from source file")
        self.chk_bands.setChecked(False)
        self.chk_bands.setToolTip(
            "A table for describing the frequency bands that the signal was decomposed into.\n"
            "Check box if this data will be retrieved from source file.\n"
            "Uncheck box to ignore it.")

        self.lbl_source_timeseries = QLabel('source_timeseries:')
        self.combo_source_timeseries = CustomComboBox()
        self.combo_source_timeseries.setToolTip(
            "The input TimeSeries from this analysis")

        self.lbl_conversion = QLabel('conversion:')
        self.form_conversion = QLineEdit('')
        self.form_conversion.setPlaceholderText("1.0")
        self.form_conversion.setToolTip(
            "Scalar to multiply each element by to convert to unit")

        self.lbl_resolution = QLabel('resolution:')
        self.form_resolution = QLineEdit('')
        self.form_resolution.setPlaceholderText("1.0")
        self.form_resolution.setToolTip(
            "The smallest meaningful difference (in specified unit) between values in data"
        )

        self.lbl_timestamps = QLabel('timestamps:')
        self.chk_timestamps = QCheckBox("Get from source file")
        self.chk_timestamps.setChecked(False)
        self.chk_timestamps.setToolTip(
            "Timestamps for samples stored in data.\n"
            "Check box if this data will be retrieved from source file.\n"
            "Uncheck box to ignore it.")

        self.lbl_starting_time = QLabel('starting_time:')
        self.form_starting_time = QLineEdit('')
        self.form_starting_time.setPlaceholderText("0.0")
        self.form_starting_time.setToolTip("The timestamp of the first sample")

        self.lbl_rate = QLabel('rate:')
        self.form_rate = QLineEdit('')
        self.form_rate.setPlaceholderText("0.0")
        self.form_rate.setToolTip("Sampling rate in Hz")

        self.lbl_comments = QLabel('comments:')
        self.form_comments = QLineEdit('')
        self.form_comments.setPlaceholderText("comments")
        self.form_comments.setToolTip(
            "Human-readable comments about this ElectricalSeries dataset")

        self.lbl_control = QLabel('control:')
        self.chk_control = QCheckBox("Get from source file")
        self.chk_control.setChecked(False)
        self.chk_control.setToolTip(
            "Numerical labels that apply to each element in data.\n"
            "Check box if this data will be retrieved from source file.\n"
            "Uncheck box to ignore it.")

        self.lbl_control_description = QLabel('control_description:')
        self.chk_control_description = QCheckBox("Get from source file")
        self.chk_control_description.setChecked(False)
        self.chk_control_description.setToolTip(
            "Description of each control value.\n"
            "Check box if this data will be retrieved from source file.\n"
            "Uncheck box to ignore it.")

        self.grid = QGridLayout()
        self.grid.setColumnStretch(2, 1)
        self.grid.addWidget(self.lbl_name, 0, 0, 1, 2)
        self.grid.addWidget(self.form_name, 0, 2, 1, 4)
        self.grid.addWidget(self.lbl_description, 2, 0, 1, 2)
        self.grid.addWidget(self.form_description, 2, 2, 1, 4)
        self.grid.addWidget(self.lbl_metric, 3, 0, 1, 2)
        self.grid.addWidget(self.form_metric, 3, 2, 1, 4)
        self.grid.addWidget(self.lbl_unit, 4, 0, 1, 2)
        self.grid.addWidget(self.form_unit, 4, 2, 1, 4)
        self.grid.addWidget(self.lbl_bands, 5, 0, 1, 2)
        self.grid.addWidget(self.chk_bands, 5, 2, 1, 2)
        self.grid.addWidget(self.lbl_source_timeseries, 6, 0, 1, 2)
        self.grid.addWidget(self.combo_source_timeseries, 6, 2, 1, 4)
        self.grid.addWidget(self.lbl_conversion, 7, 0, 1, 2)
        self.grid.addWidget(self.form_conversion, 7, 2, 1, 4)
        self.grid.addWidget(self.lbl_resolution, 8, 0, 1, 2)
        self.grid.addWidget(self.form_resolution, 8, 2, 1, 4)
        self.grid.addWidget(self.lbl_timestamps, 9, 0, 1, 2)
        self.grid.addWidget(self.chk_timestamps, 9, 2, 1, 2)
        self.grid.addWidget(self.lbl_starting_time, 10, 0, 1, 2)
        self.grid.addWidget(self.form_starting_time, 10, 2, 1, 4)
        self.grid.addWidget(self.lbl_rate, 11, 0, 1, 2)
        self.grid.addWidget(self.form_rate, 11, 2, 1, 4)
        self.grid.addWidget(self.lbl_comments, 12, 0, 1, 2)
        self.grid.addWidget(self.form_comments, 12, 2, 1, 4)
        self.grid.addWidget(self.lbl_control, 13, 0, 1, 2)
        self.grid.addWidget(self.chk_control, 13, 2, 1, 2)
        self.grid.addWidget(self.lbl_control_description, 14, 0, 1, 2)
        self.grid.addWidget(self.chk_control_description, 14, 2, 1, 2)
        self.setLayout(self.grid)
    def __init__(self, targetImage=None, axeSize=500, layer=None, parent=None):
        super().__init__(targetImage=targetImage,
                         axeSize=axeSize,
                         layer=layer,
                         parent=parent)
        # Brightness curve
        cubic = activeCubicSpline(axeSize)
        graphicsScene = self.scene()
        graphicsScene.addItem(cubic)
        graphicsScene.cubicRGB = cubic
        cubic.channel = channelValues.RGB
        cubic.histImg = self.scene().layer.inputImg().histogram(
            size=graphicsScene.axeSize,
            bgColor=graphicsScene.bgColor,
            chans=[],
            mode='Luminosity')
        cubic.initFixedPoints()
        # Red curve
        cubic = activeCubicSpline(axeSize)
        graphicsScene.addItem(cubic)
        graphicsScene.cubicR = cubic
        cubic.channel = channelValues.Red
        cubic.histImg = self.scene().layer.inputImg().histogram(
            size=graphicsScene.axeSize,
            bgColor=graphicsScene.bgColor,
            chans=channelValues.Red)
        cubic.initFixedPoints()
        # Green curve
        cubic = activeCubicSpline(axeSize)
        graphicsScene.addItem(cubic)
        graphicsScene.cubicG = cubic
        cubic.channel = channelValues.Green
        cubic.histImg = self.scene().layer.inputImg().histogram(
            size=graphicsScene.axeSize,
            bgColor=graphicsScene.bgColor,
            chans=channelValues.Green)
        cubic.initFixedPoints()
        # Blue curve
        cubic = activeCubicSpline(axeSize)
        graphicsScene.addItem(cubic)
        graphicsScene.cubicB = cubic
        cubic.channel = channelValues.Blue
        cubic.histImg = self.scene().layer.inputImg().histogram(
            size=graphicsScene.axeSize,
            bgColor=graphicsScene.bgColor,
            chans=channelValues.Blue)
        cubic.initFixedPoints()
        # set current curve to brightness
        graphicsScene.cubicItem = graphicsScene.cubicRGB
        graphicsScene.cubicItem.setVisible(True)

        # buttons
        pushButton1 = QbLUePushButton("Reset Current")
        pushButton1.clicked.connect(self.resetCurve)
        pushButton2 = QbLUePushButton("Reset R,G,B")
        pushButton2.clicked.connect(self.resetAllCurves)

        # options
        options = ['RGB', 'Red', 'Green', 'Blue']
        self.listWidget1 = optionsWidget(options=options, exclusive=True)
        self.listWidget1.setGeometry(
            0, 0,
            self.listWidget1.sizeHintForColumn(0) + 5,
            self.listWidget1.sizeHintForRow(0) * len(options) + 5)
        # selection changed handler
        curves = [
            graphicsScene.cubicRGB, graphicsScene.cubicR, graphicsScene.cubicG,
            graphicsScene.cubicB
        ]
        curveDict = dict(zip(options, curves))

        def onSelect1(item):
            self.scene().cubicItem.setVisible(False)
            self.scene().cubicItem = curveDict[item.text()]
            pushButton2.setEnabled(item.text() != 'RGB')
            self.scene().cubicItem.setVisible(True)
            l = self.scene().layer
            l.applyToStack()
            l.parentImage.onImageChanged()
            # Force redraw histogram
            self.scene().invalidate(
                QRectF(0.0, -self.scene().axeSize,
                       self.scene().axeSize,
                       self.scene().axeSize), QGraphicsScene.BackgroundLayer)

        self.listWidget1.onSelect = onSelect1
        # set initial selection to RGB
        item = self.listWidget1.items[options[0]]
        item.setCheckState(Qt.Checked)
        self.listWidget1.select(item)

        # layout
        gl = QGridLayout()
        gl.addWidget(self.listWidget1, 0, 0, 2, 1)
        for i, button in enumerate([pushButton1, pushButton2]):
            gl.addWidget(button, i, 1)
        self.addCommandLayout(gl)

        self.setWhatsThis("""<b>RGB curves</b><br>""" + self.whatsThis())

        def f():
            l = self.scene().layer
            l.applyToStack()
            l.parentImage.onImageChanged()

        self.scene().cubicRGB.curveChanged.sig.connect(f)
        self.scene().cubicR.curveChanged.sig.connect(f)
        self.scene().cubicG.curveChanged.sig.connect(f)
        self.scene().cubicB.curveChanged.sig.connect(f)
    def initUI(self):

        self.layout = QVBoxLayout()

        header = QLabel(self)
        header.setGeometry(0, 0, 655, 106)
        pixmap = QPixmap("./resources/ui/debriefing.png")
        header.setPixmap(pixmap)
        self.layout.addWidget(header)
        self.layout.addStretch()

        # Result
        #if self.gameEvent.is_successfull(self.debriefing):
        #    title = QLabel("<b>Operation end !</b>")
        #    title.setProperty("style", "title-success")
        #else:
        #    title = QLabel("<b>Operation end !</b>")
        #    title.setProperty("style", "title-danger")
        title = QLabel("<b>Casualty report</b>")
        self.layout.addWidget(title)

        # Player lost units
        lostUnits = QGroupBox(self.game.player_country + "'s lost units :")
        lostUnitsLayout = QGridLayout()
        lostUnits.setLayout(lostUnitsLayout)

        row = 0
        for unit_type, count in self.debriefing.player_dead_aircraft_dict.items(
        ):
            try:
                lostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)),
                                          row, 0)
                lostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
                row += 1
            except:
                print("Issue adding " + str(unit_type) +
                      " to debriefing information")

        for unit_type, count in self.debriefing.player_dead_units_dict.items():
            try:
                lostUnitsLayout.addWidget(QLabel(db.unit_type_name(unit_type)),
                                          row, 0)
                lostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
                row += 1
            except:
                print("Issue adding " + str(unit_type) +
                      " to debriefing information")

        for building, count in self.debriefing.player_dead_buildings_dict.items(
        ):
            try:
                lostUnitsLayout.addWidget(QLabel(building, row, 0))
                lostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
                row += 1
            except:
                print("Issue adding " + str(building) +
                      " to debriefing information")

        self.layout.addWidget(lostUnits)

        # Enemy lost units
        enemylostUnits = QGroupBox(self.game.enemy_country + "'s lost units :")
        enemylostUnitsLayout = QGridLayout()
        enemylostUnits.setLayout(enemylostUnitsLayout)

        #row = 0
        #if self.debriefing.destroyed_objects:
        #    enemylostUnitsLayout.addWidget(QLabel("Ground assets"), row, 0)
        #    enemylostUnitsLayout.addWidget(QLabel("{}".format(len(self.debriefing.destroyed_objects))), row, 1)
        #    row += 1

        for unit_type, count in self.debriefing.enemy_dead_aircraft_dict.items(
        ):
            if count == 0:
                continue
            try:
                enemylostUnitsLayout.addWidget(
                    QLabel(db.unit_type_name(unit_type)), row, 0)
                enemylostUnitsLayout.addWidget(QLabel("{}".format(count)), row,
                                               1)
                row += 1
            except:
                print("Issue adding " + str(unit_type) +
                      " to debriefing information")

        for unit_type, count in self.debriefing.enemy_dead_units_dict.items():
            if count == 0:
                continue
            enemylostUnitsLayout.addWidget(
                QLabel(db.unit_type_name(unit_type)), row, 0)
            enemylostUnitsLayout.addWidget(QLabel("{}".format(count)), row, 1)
            row += 1

        for building, count in self.debriefing.enemy_dead_buildings_dict.items(
        ):
            try:
                enemylostUnitsLayout.addWidget(QLabel(building), row, 0)
                enemylostUnitsLayout.addWidget(QLabel("{}".format(count)), row,
                                               1)
                row += 1
            except:
                print("Issue adding " + str(building) +
                      " to debriefing information")

        self.layout.addWidget(enemylostUnits)

        # confirm button
        okay = QPushButton("Okay")
        okay.clicked.connect(self.close)
        self.layout.addWidget(okay)

        self.setLayout(self.layout)
Beispiel #14
0
    def __init__(self, parent=None, toolbar=False):
        flags = Qt.Window | Qt.WindowTitleHint | Qt.CustomizeWindowHint | Qt.WindowCloseButtonHint
        super().__init__(parent=parent, f=flags)
        self.setWindowTitle(self.tr("SSU Typical Component Chart"))
        self.figure = plt.figure(figsize=(6, 3))
        self.clustering_axes = self.figure.add_subplot(1, 2, 1)
        self.component_axes = self.figure.add_subplot(1, 2, 2)
        self.canvas = FigureCanvas(self.figure)
        self.toolbar = NavigationToolbar(self.canvas, self)
        self.main_layout = QGridLayout(self)
        self.main_layout.addWidget(self.toolbar, 0, 0, 1, 4)
        self.main_layout.addWidget(self.canvas, 1, 0, 1, 4)
        if not toolbar:
            self.toolbar.hide()
        self.supported_scales = [("log-linear", self.tr("Log-linear")),
                                 ("log", self.tr("Log")),
                                 ("phi", self.tr("φ")),
                                 ("linear", self.tr("Linear"))]
        self.AXIS_LIST = [
            self.tr("Mean [φ]"),
            self.tr("Standard deviation [φ]"),
            self.tr("Skewness"),
            self.tr("Kurtosis")
        ]
        self.x_axis_label = QLabel(self.tr("X Axis"))
        self.x_axis_combo_box = QComboBox()
        self.x_axis_combo_box.addItems(self.AXIS_LIST)
        self.y_axis_label = QLabel(self.tr("Y Axis"))
        self.y_axis_combo_box = QComboBox()
        self.y_axis_combo_box.addItems(self.AXIS_LIST)
        self.y_axis_combo_box.setCurrentIndex(1)
        self.main_layout.addWidget(self.x_axis_label, 2, 0)
        self.main_layout.addWidget(self.x_axis_combo_box, 2, 1)
        self.main_layout.addWidget(self.y_axis_label, 3, 0)
        self.main_layout.addWidget(self.y_axis_combo_box, 3, 1)
        self.scale_label = QLabel(self.tr("Scale"))
        self.scale_combo_box = QComboBox()
        self.scale_combo_box.addItems(
            [name for key, name in self.supported_scales])
        self.main_layout.addWidget(self.scale_label, 2, 2)
        self.main_layout.addWidget(self.scale_combo_box, 2, 3)
        self.min_samples_label = QLabel(self.tr("Minimum Samples"))
        self.min_samples_input = QDoubleSpinBox()
        self.min_samples_input.setRange(0.0001, 0.9999)
        self.min_samples_input.setDecimals(4)
        self.min_samples_input.setSingleStep(0.001)
        self.min_samples_input.setValue(0.03)
        self.min_cluster_size_label = QLabel(self.tr("Minimum Cluster Size"))
        self.min_cluster_size_input = QDoubleSpinBox()
        self.min_cluster_size_input.setRange(0.0001, 0.9999)
        self.min_cluster_size_input.setDecimals(4)
        self.min_cluster_size_input.setSingleStep(0.001)
        self.min_cluster_size_input.setValue(0.1)
        self.xi_label = QLabel(self.tr("xi"))
        self.xi_input = QDoubleSpinBox()
        self.xi_input.setRange(0.0001, 0.9999)
        self.xi_input.setDecimals(4)
        self.xi_input.setSingleStep(0.001)
        self.xi_input.setValue(0.05)
        self.main_layout.addWidget(self.min_samples_label, 3, 2)
        self.main_layout.addWidget(self.min_samples_input, 3, 3)
        self.main_layout.addWidget(self.min_cluster_size_label, 4, 0)
        self.main_layout.addWidget(self.min_cluster_size_input, 4, 1)
        self.main_layout.addWidget(self.xi_label, 4, 2)
        self.main_layout.addWidget(self.xi_input, 4, 3)
        self.update_chart_button = QPushButton(self.tr("Update Chart"))
        self.update_chart_button.clicked.connect(self.update_chart)
        self.save_typical_button = QPushButton(self.tr("Save Typical"))
        self.save_typical_button.setEnabled(False)
        self.save_typical_button.clicked.connect(self.on_save_clicked)
        self.main_layout.addWidget(self.update_chart_button, 5, 0, 1, 2)
        self.main_layout.addWidget(self.save_typical_button, 5, 2, 1, 2)

        self.last_results = None  # type: list[SSUResult]
        self.data_to_clustering = None
        self.stacked_components = None
        self.normal_msg = QMessageBox(self)
        self.file_dialog = QFileDialog(parent=self)
    def setCustKnowArea(self):
        form_box = FormGroupBox(
            "Customer Knowledge / Satisfaction (Select 1 - 5, 1 being the least satisfied)",
            self)
        fix_and_app = QWidget(self)
        fix_and_app_lay = QGridLayout(fix_and_app)

        # ROW 1
        interest_box = FormGroupBox("Interest / Enthusiasm:", self)
        interest_box.frame_layout.addRow(CustomerKnowledge.INTEREST.value)
        fix_and_app_lay.addWidget(interest_box, 0, 0)
        neigh_box = FormGroupBox("Neighborhood:", self)
        neigh_box.frame_layout.addRow(CustomerKnowledge.NEIGHBORHOOD.value)
        fix_and_app_lay.addWidget(neigh_box, 0, 1)
        # ROW 2
        sat_price_box = FormGroupBox("Satisfaction with the Device Price:",
                                     self)
        sat_price_box.frame_layout.addRow(CustomerKnowledge.SAT_PRICE.value)
        fix_and_app_lay.addWidget(sat_price_box, 1, 0)
        know_dev_box = FormGroupBox("Knowledge About the Device:", self)
        know_dev_box.frame_layout.addRow(CustomerKnowledge.KNOW_DEVICE.value)
        fix_and_app_lay.addWidget(know_dev_box, 1, 1)
        # ROW 3
        sat_install_box = FormGroupBox("Satisfaction with the Installation:",
                                       self)
        sat_install_box.frame_layout.addRow(
            CustomerKnowledge.SAT_INSTALL.value)
        fix_and_app_lay.addWidget(sat_install_box, 2, 0)
        know_water_box = FormGroupBox("Knowledge About Water Use:", self)
        know_water_box.frame_layout.addRow(
            CustomerKnowledge.KNOW_WATER_USE.value)
        fix_and_app_lay.addWidget(know_water_box, 2, 1)

        # ROW 4 (BLANK ROW)
        fix_and_app_lay.addWidget(QLabel(""), 3, 0)

        # ROW 5
        sat_dev_box = FormGroupBox("Satisfaction with the Device:", self)
        sat_dev_box.frame_layout.addRow(CustomerKnowledge.SAT_DEVICE.value)
        fix_and_app_lay.addWidget(sat_dev_box, 4, 0)
        know_snwa_box = FormGroupBox("Knowledge About SNWA:", self)
        know_snwa_box.frame_layout.addRow(CustomerKnowledge.KNOW_SNWA.value)
        fix_and_app_lay.addWidget(know_snwa_box, 4, 1)
        # ROW 6
        sat_retail_box = FormGroupBox("Satisfaction with the Retailer/Mfr:",
                                      self)
        sat_retail_box.frame_layout.addRow(
            CustomerKnowledge.SAT_RETAILER.value)
        fix_and_app_lay.addWidget(sat_retail_box, 5, 0)
        sat_snwa_box = FormGroupBox("Satisfaction with SNWA:", self)
        sat_snwa_box.frame_layout.addRow(CustomerKnowledge.SAT_SNWA.value)
        fix_and_app_lay.addWidget(sat_snwa_box, 5, 1)
        fix_and_app_lay.addWidget(HorizontalFiller(self), 5, 2)
        # ROW 7
        prop_box = FormGroupBox("Condition of Property:", self)
        prop_box.frame_layout.addRow(CustomerKnowledge.PROP_COND.value)
        fix_and_app_lay.addWidget(prop_box, 6, 0)

        form_box.frame_layout.addRow(fix_and_app)

        form_box.frame_layout.addRow("General Notes:",
                                     CustomerKnowledge.NOTES.value)
        self._scroll_layout.addRow(form_box)
    def _create_ammo_pickup_boxes(self, size_policy,
                                  item_database: ItemDatabase):
        """
        Creates the GroupBox with SpinBoxes for selecting the pickup count of all the ammo
        :param item_database:
        :return:
        """

        self._ammo_maximum_spinboxes = collections.defaultdict(list)
        self._ammo_pickup_widgets = {}

        resource_database = default_database.resource_database_for(self.game)
        broad_to_category = {
            ItemCategory.BEAM_RELATED: ItemCategory.BEAM,
            ItemCategory.MORPH_BALL_RELATED: ItemCategory.MORPH_BALL,
            ItemCategory.MISSILE_RELATED: ItemCategory.MISSILE,
        }

        for ammo in item_database.ammo.values():
            category_box, category_layout, _ = self._boxes_for_category[
                broad_to_category[ammo.broad_category]]

            pickup_box = QGroupBox(category_box)
            pickup_box.setSizePolicy(size_policy)
            pickup_box.setTitle(ammo.name + "s")
            layout = QGridLayout(pickup_box)
            layout.setObjectName(f"{ammo.name} Box Layout")
            current_row = 0

            for ammo_item in ammo.items:
                item = resource_database.get_by_type_and_index(
                    ResourceType.ITEM, ammo_item)

                target_count_label = QLabel(pickup_box)
                target_count_label.setText(f"{item.long_name} Target" if len(
                    ammo.items) > 1 else "Target count")

                maximum_spinbox = QSpinBox(pickup_box)
                maximum_spinbox.setMaximum(ammo.maximum)
                maximum_spinbox.valueChanged.connect(
                    partial(self._on_update_ammo_maximum_spinbox, ammo_item))
                self._ammo_maximum_spinboxes[ammo_item].append(maximum_spinbox)

                layout.addWidget(target_count_label, current_row, 0)
                layout.addWidget(maximum_spinbox, current_row, 1)
                current_row += 1

            count_label = QLabel(pickup_box)
            count_label.setText("Pickup Count")
            count_label.setToolTip(
                "How many instances of this expansion should be placed.")

            pickup_spinbox = QSpinBox(pickup_box)
            pickup_spinbox.setMaximum(AmmoState.maximum_pickup_count())
            pickup_spinbox.valueChanged.connect(
                partial(self._on_update_ammo_pickup_spinbox, ammo))

            layout.addWidget(count_label, current_row, 0)
            layout.addWidget(pickup_spinbox, current_row, 1)
            current_row += 1

            if ammo.temporaries:
                require_major_item_check = QCheckBox(pickup_box)
                require_major_item_check.setText(
                    "Requires the major item to work?")
                require_major_item_check.stateChanged.connect(
                    partial(self._on_update_ammo_require_major_item, ammo))
                layout.addWidget(require_major_item_check, current_row, 0, 1,
                                 2)
                current_row += 1
            else:
                require_major_item_check = None

            expected_count = QLabel(pickup_box)
            expected_count.setWordWrap(True)
            expected_count.setText(_EXPECTED_COUNT_TEXT_TEMPLATE)
            expected_count.setToolTip(
                "Some expansions may provide 1 extra, even with no variance, if the total count "
                "is not divisible by the pickup count.")
            layout.addWidget(expected_count, current_row, 0, 1, 2)
            current_row += 1

            self._ammo_pickup_widgets[ammo] = AmmoPickupWidgets(
                pickup_spinbox, expected_count, pickup_box,
                require_major_item_check)
            category_layout.addWidget(pickup_box)
Beispiel #17
0
    def initUi(self):
        self.layout = QGridLayout()

        self.categoryList = QListView()
        self.right_layout = QStackedLayout()

        self.categoryList.setMaximumWidth(175)

        self.categoryModel = QStandardItemModel(self.categoryList)

        self.categoryList.setIconSize(QSize(32, 32))

        self.initDifficultyLayout()
        difficulty = QStandardItem("Difficulty")
        difficulty.setIcon(CONST.ICONS["Missile"])
        difficulty.setEditable(False)
        difficulty.setSelectable(True)
        self.categoryModel.appendRow(difficulty)
        self.right_layout.addWidget(self.difficultyPage)

        self.init_campaign_management_layout()
        campaign_management = QStandardItem("Campaign Management")
        campaign_management.setIcon(CONST.ICONS["Money"])
        campaign_management.setEditable(False)
        campaign_management.setSelectable(True)
        self.categoryModel.appendRow(campaign_management)
        self.right_layout.addWidget(self.campaign_management_page)

        self.initGeneratorLayout()
        generator = QStandardItem("Mission Generator")
        generator.setIcon(CONST.ICONS["Generator"])
        generator.setEditable(False)
        generator.setSelectable(True)
        self.categoryModel.appendRow(generator)
        self.right_layout.addWidget(self.generatorPage)

        self.initCheatLayout()
        cheat = QStandardItem("Cheat Menu")
        cheat.setIcon(CONST.ICONS["Cheat"])
        cheat.setEditable(False)
        cheat.setSelectable(True)
        self.categoryModel.appendRow(cheat)
        self.right_layout.addWidget(self.cheatPage)

        self.pluginsPage = PluginsPage()
        plugins = QStandardItem("LUA Plugins")
        plugins.setIcon(CONST.ICONS["Plugins"])
        plugins.setEditable(False)
        plugins.setSelectable(True)
        self.categoryModel.appendRow(plugins)
        self.right_layout.addWidget(self.pluginsPage)

        self.pluginsOptionsPage = PluginOptionsPage()
        pluginsOptions = QStandardItem("LUA Plugins Options")
        pluginsOptions.setIcon(CONST.ICONS["PluginsOptions"])
        pluginsOptions.setEditable(False)
        pluginsOptions.setSelectable(True)
        self.categoryModel.appendRow(pluginsOptions)
        self.right_layout.addWidget(self.pluginsOptionsPage)

        self.categoryList.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.categoryList.setModel(self.categoryModel)
        self.categoryList.selectionModel().setCurrentIndex(
            self.categoryList.indexAt(QPoint(1, 1)),
            QItemSelectionModel.Select)
        self.categoryList.selectionModel().selectionChanged.connect(
            self.onSelectionChanged)

        self.layout.addWidget(self.categoryList, 0, 0, 1, 1)
        self.layout.addLayout(self.right_layout, 0, 1, 5, 1)

        self.setLayout(self.layout)
Beispiel #18
0
    def __init__(self, parent):
        super().__init__()
        self.setParent(parent)
        self.setLayout(QGridLayout())
        self.setWindowModality(Qt.WindowModal)
        self.setModal(True)
        self.minimum_spinbox_value = 0
        self.maximum_spinbox_value = 100_000_000
        self.advanced_options_enabled = False

        self.hs00_unimplemented_label = QLabel(
            "hs00 (Event histograms) has not yet been fully implemented.")

        self.schema_label = QLabel("Schema: ")
        self.schema_combo = QComboBox()

        self.topic_label = QLabel("Topic: ")
        self.topic_line_edit = QLineEdit()
        self.topic_line_edit.setPlaceholderText(
            "[broker][:port, default=9092]/topic")

        self.source_label = QLabel("Source: ")
        self.source_line_edit = QLineEdit()

        self.array_size_label = QLabel("Array size")
        self.array_size_spinbox = QSpinBox()
        self.array_size_spinbox.setMaximum(np.iinfo(np.int32).max)

        self.type_label = QLabel("Type: ")
        self.type_combo = QComboBox()
        self.type_combo.addItems(F142_TYPES)
        self.type_combo.setCurrentText("double")

        self.value_units_edit = QLineEdit()
        self.value_units_label = QLabel("Value Units:")

        self.show_advanced_options_button = QPushButton(
            text="Show/hide advanced options")
        self.show_advanced_options_button.setCheckable(True)
        self.show_advanced_options_button.clicked.connect(
            self.advanced_options_button_clicked)

        self._set_up_f142_group_box()
        self._set_up_ev42_group_box()

        self.scalar_radio = QRadioButton(text="Scalar")
        self.scalar_radio.clicked.connect(partial(self._show_array_size,
                                                  False))
        self.scalar_radio.setChecked(True)
        self.scalar_radio.clicked.emit()

        self.array_radio = QRadioButton(text="Array")
        self.array_radio.clicked.connect(partial(self._show_array_size, True))

        self.schema_combo.currentTextChanged.connect(self._schema_type_changed)
        self.schema_combo.addItems([e.value for e in WriterModules])

        self.ok_button = QPushButton("OK")
        self.ok_button.clicked.connect(self.parent().close)

        self.layout().addWidget(self.schema_label, 0, 0)
        self.layout().addWidget(self.schema_combo, 0, 1)

        self.layout().addWidget(self.topic_label, 1, 0)
        self.layout().addWidget(self.topic_line_edit, 1, 1)

        self.layout().addWidget(self.source_label, 2, 0)
        self.layout().addWidget(self.source_line_edit, 2, 1)

        self.layout().addWidget(self.value_units_label, 3, 0)
        self.layout().addWidget(self.value_units_edit, 3, 1)
        self.value_units_label.setVisible(False)
        self.value_units_edit.setVisible(False)

        self.layout().addWidget(self.type_label, 4, 0)
        self.layout().addWidget(self.type_combo, 4, 1)

        self.layout().addWidget(self.scalar_radio, 5, 0)
        self.layout().addWidget(self.array_radio, 5, 1)

        self.layout().addWidget(self.array_size_label, 6, 0)
        self.layout().addWidget(self.array_size_spinbox, 6, 1)

        self.layout().addWidget(self.hs00_unimplemented_label, 7, 0, 1, 2)

        # Spans both rows
        self.layout().addWidget(self.show_advanced_options_button, 8, 0, 1, 2)
        self.layout().addWidget(self.f142_advanced_group_box, 9, 0, 1, 2)

        self.layout().addWidget(self.ev42_advanced_group_box, 10, 0, 1, 2)

        self.layout().addWidget(self.ok_button, 11, 0, 1, 2)

        self._schema_type_changed(self.schema_combo.currentText())
Beispiel #19
0
    def init_campaign_management_layout(self) -> None:
        campaign_layout = QVBoxLayout()
        campaign_layout.setAlignment(Qt.AlignTop)
        self.campaign_management_page.setLayout(campaign_layout)

        general = QGroupBox("General")
        campaign_layout.addWidget(general)

        general_layout = QGridLayout()
        general.setLayout(general_layout)

        def set_restict_weapons_by_date(value: bool) -> None:
            self.game.settings.restrict_weapons_by_date = value

        restrict_weapons = QCheckBox()
        restrict_weapons.setChecked(
            self.game.settings.restrict_weapons_by_date)
        restrict_weapons.toggled.connect(set_restict_weapons_by_date)

        tooltip_text = (
            "Restricts weapon availability based on the campaign date. Data is "
            "extremely incomplete so does not affect all weapons.")
        restrict_weapons.setToolTip(tooltip_text)
        restrict_weapons_label = QLabel("Restrict weapons by date (WIP)")
        restrict_weapons_label.setToolTip(tooltip_text)

        general_layout.addWidget(restrict_weapons_label, 0, 0)
        general_layout.addWidget(restrict_weapons, 0, 1, Qt.AlignRight)

        automation = QGroupBox("HQ Automation")
        campaign_layout.addWidget(automation)

        automation_layout = QGridLayout()
        automation.setLayout(automation_layout)

        def set_runway_automation(value: bool) -> None:
            self.game.settings.automate_runway_repair = value

        def set_front_line_automation(value: bool) -> None:
            self.game.settings.automate_front_line_reinforcements = value

        def set_aircraft_automation(value: bool) -> None:
            self.game.settings.automate_aircraft_reinforcements = value

        runway_repair = QCheckBox()
        runway_repair.setChecked(self.game.settings.automate_runway_repair)
        runway_repair.toggled.connect(set_runway_automation)

        automation_layout.addWidget(QLabel("Automate runway repairs"), 0, 0)
        automation_layout.addWidget(runway_repair, 0, 1, Qt.AlignRight)

        front_line = QCheckBox()
        front_line.setChecked(
            self.game.settings.automate_front_line_reinforcements)
        front_line.toggled.connect(set_front_line_automation)

        automation_layout.addWidget(QLabel("Automate front-line purchases"), 1,
                                    0)
        automation_layout.addWidget(front_line, 1, 1, Qt.AlignRight)

        aircraft = QCheckBox()
        aircraft.setChecked(
            self.game.settings.automate_aircraft_reinforcements)
        aircraft.toggled.connect(set_aircraft_automation)

        automation_layout.addWidget(QLabel("Automate aircraft purchases"), 2,
                                    0)
        automation_layout.addWidget(aircraft, 2, 1, Qt.AlignRight)
Beispiel #20
0
 try:
     print("1")
     ua = UserAgent()
     ua.update()
     userAgent = ua.random
 except FakeUserAgentError:
     print("2")
     userAgent = "Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML, как Gecko) Chrome / " \
                 "72.0.3626.121 Safari / 537.36"
 app = QApplication(sys.argv)
 proxy = QNetworkProxy()
 proxy.setType(QNetworkProxy.HttpProxy)
 proxy.setHostName("109.173.124.250")
 proxy.setPort(7793)
 QNetworkProxy.setApplicationProxy(proxy)
 grid = QGridLayout()
 # browser = QWebEngineView()
 browser = Browser()
 # url_input = UrlInput(browser)
 list_view = QListView()
 list_view.setFixedWidth(300)
 #  interceptor = WebEngineUrlRequestInterceptor()
 profile = QWebEngineProfile()
 profile.setHttpUserAgent(userAgent)
 page = MyWebEnginePage(profile, browser)
 page.setUrl(QUrl("https://www.instagram.com/"))
 # page.setUrl(QUrl("https://2ip.ru"))
 browser.setPage(page)
 page_proxy = browser.page()
 page_proxy.proxyAuthenticationRequired.connect(handleProxyAuthReq)
 grid.addWidget(list_view, 0, 1)
Beispiel #21
0
    def initUi(self):
        self.layout = QGridLayout()

        header = QLabel(self)
        header.setGeometry(0, 0, 655, 106)
        pixmap = QPixmap("./resources/ui/conflict.png")
        header.setPixmap(pixmap)
        self.layout.addWidget(header, 0, 0)

        self.gridLayout = QGridLayout()

        jinja = Environment(
            loader=FileSystemLoader("resources/ui/templates"),
            autoescape=select_autoescape(
                disabled_extensions=("", ),
                default_for_string=True,
                default=True,
            ),
            trim_blocks=True,
            lstrip_blocks=True,
        )
        self.instructions_text = QTextBrowser()
        self.instructions_text.setHtml(
            jinja.get_template("mission_start_EN.j2").render())
        self.instructions_text.setOpenExternalLinks(True)
        self.gridLayout.addWidget(self.instructions_text, 1, 0)

        progress = QLabel("")
        progress.setAlignment(QtCore.Qt.AlignCenter)
        progress_bar = QMovie("./resources/ui/loader.gif")
        progress.setMovie(progress_bar)

        self.actions = QGroupBox("Actions :")
        self.actions_layout = QHBoxLayout()
        self.actions.setLayout(self.actions_layout)

        self.manually_submit = QPushButton("Manually Submit [Advanced users]")
        self.manually_submit.clicked.connect(self.submit_manually)
        self.actions_layout.addWidget(self.manually_submit)
        self.cancel = QPushButton("Abort mission")
        self.cancel.clicked.connect(self.close)
        self.actions_layout.addWidget(self.cancel)
        self.gridLayout.addWidget(self.actions, 2, 0)

        self.actions2 = QGroupBox("Actions :")
        self.actions2_layout = QHBoxLayout()
        self.actions2.setLayout(self.actions2_layout)
        self.manually_submit2 = QPushButton("Manually Submit [Advanced users]")
        self.manually_submit2.clicked.connect(self.submit_manually)
        self.actions2_layout.addWidget(self.manually_submit2)
        self.cancel2 = QPushButton("Abort mission")
        self.cancel2.clicked.connect(self.close)
        self.actions2_layout.addWidget(self.cancel2)
        self.proceed = QPushButton("Accept results")
        self.proceed.setProperty("style", "btn-success")
        self.proceed.clicked.connect(self.process_debriefing)
        self.actions2_layout.addWidget(self.proceed)

        progress_bar.start()
        self.layout.addLayout(self.gridLayout, 1, 0)
        self.setLayout(self.layout)
Beispiel #22
0
    def __init__(self, image, parent=None):
        super(AdjustWidget, self).__init__(parent)

        self.bright_slider = ParamSlider([-255, +255], 16, 0)
        self.sat_slider = ParamSlider([-255, +255], 16, 0)
        self.hue_slider = ParamSlider([0, 180], 10, 0, '°')
        self.gamma_slider = ParamSlider([1, 50], 10, 10)
        self.shadow_slider = ParamSlider([-100, +100], 10, 0, '%')
        self.high_slider = ParamSlider([-100, +100], 10, 0, '%')
        self.sweep_slider = ParamSlider([0, 255], 8, 127)
        self.width_slider = ParamSlider([0, 255], 8, 255)
        self.sharpen_slider = ParamSlider([0, 100], 10, 0, '%')
        self.thr_slider = ParamSlider([0, 255],
                                      16,
                                      255,
                                      special=self.tr('Auto'))
        self.equalize_combo = QComboBox()
        self.equalize_combo.addItems([
            self.tr('No EQ'),
            self.tr('Hist EQ'),
            self.tr('CLAHE L1'),
            self.tr('CLAHE L2'),
            self.tr('CLAHE L3'),
            self.tr('CLAHE L4')
        ])
        self.equalize_combo.setToolTip(self.tr('Histogram equalization mode'))
        self.invert_check = QCheckBox(self.tr('Invert values'))
        self.invert_check.setToolTip(self.tr('Apply bitwise complement'))
        self.reset_button = QPushButton(self.tr('Reset'))

        self.image = image
        self.viewer = ImageViewer(self.image, self.image)
        self.reset()

        self.bright_slider.valueChanged.connect(self.process)
        self.sat_slider.valueChanged.connect(self.process)
        self.hue_slider.valueChanged.connect(self.process)
        self.gamma_slider.valueChanged.connect(self.process)
        self.shadow_slider.valueChanged.connect(self.process)
        self.high_slider.valueChanged.connect(self.process)
        self.sweep_slider.valueChanged.connect(self.process)
        self.width_slider.valueChanged.connect(self.process)
        self.thr_slider.valueChanged.connect(self.process)
        self.sharpen_slider.valueChanged.connect(self.process)
        self.equalize_combo.currentIndexChanged.connect(self.process)
        self.invert_check.stateChanged.connect(self.process)
        self.reset_button.clicked.connect(self.reset)

        params_layout = QGridLayout()
        params_layout.addWidget(QLabel(self.tr('Brightness')), 0, 0)
        params_layout.addWidget(QLabel(self.tr('Saturation')), 1, 0)
        params_layout.addWidget(QLabel(self.tr('Hue')), 2, 0)
        params_layout.addWidget(QLabel(self.tr('Gamma')), 3, 0)
        params_layout.addWidget(self.bright_slider, 0, 1)
        params_layout.addWidget(self.sat_slider, 1, 1)
        params_layout.addWidget(self.hue_slider, 2, 1)
        params_layout.addWidget(self.gamma_slider, 3, 1)
        params_layout.addWidget(QLabel(self.tr('Shadows')), 0, 2)
        params_layout.addWidget(QLabel(self.tr('Highlights')), 1, 2)
        params_layout.addWidget(QLabel(self.tr('Sweep')), 2, 2)
        params_layout.addWidget(QLabel(self.tr('Width')), 3, 2)
        params_layout.addWidget(self.shadow_slider, 0, 3)
        params_layout.addWidget(self.high_slider, 1, 3)
        params_layout.addWidget(self.sweep_slider, 2, 3)
        params_layout.addWidget(self.width_slider, 3, 3)
        params_layout.addWidget(QLabel(self.tr('Sharpen')), 0, 4)
        params_layout.addWidget(self.sharpen_slider, 0, 5)
        params_layout.addWidget(QLabel(self.tr('Threshold')), 1, 4)
        params_layout.addWidget(self.thr_slider, 1, 5)
        params_layout.addWidget(self.equalize_combo, 2, 4)
        params_layout.addWidget(self.invert_check, 2, 5)
        params_layout.addWidget(self.reset_button, 3, 4, 1, 2)

        main_layout = QVBoxLayout()
        main_layout.addLayout(params_layout)
        main_layout.addWidget(self.viewer)
        self.setLayout(main_layout)
Beispiel #23
0
    def init_ui(self):

        self.captured_cp = [
            cp for cp in self.game.theater.controlpoints if cp.captured
        ]

        self.layout = QGridLayout()
        self.left_bar_layout = QVBoxLayout()

        self.select_airbase = QChooseAirbase(self.game)
        self.select_airbase.selected_airbase_changed.connect(
            self.on_departure_cp_changed)
        self.planned_flight_view = QPlannedFlightsView(None)
        self.available_aircraft_at_selected_location = {}
        if self.captured_cp[0].id in self.game.planners.keys():
            self.planner = self.game.planners[self.captured_cp[0].id]
            self.planned_flight_view.set_flight_planner(self.planner)
            self.selected_cp = self.captured_cp[0]
            self.available_aircraft_at_selected_location = self.planner.get_available_aircraft(
            )

        self.planned_flight_view.selectionModel().setCurrentIndex(
            self.planned_flight_view.indexAt(QPoint(1, 1)),
            QItemSelectionModel.Rows)
        self.planned_flight_view.selectionModel().selectionChanged.connect(
            self.on_flight_selection_change)

        if len(self.planned_flight_view.flight_planner.flights) > 0:
            self.flight_planner = QFlightPlanner(
                self.planned_flight_view.flight_planner.flights[0], self.game,
                self.planned_flight_view.flight_planner, 0)
            self.flight_planner.on_planned_flight_changed.connect(
                self.update_planned_flight_view)
        else:
            self.flight_planner = QFlightPlanner(
                None, self.game, self.planned_flight_view.flight_planner, 0)
            self.flight_planner.on_planned_flight_changed.connect(
                self.update_planned_flight_view)

        self.add_flight_button = QPushButton("Add Flight")
        self.add_flight_button.clicked.connect(self.on_add_flight)
        self.delete_flight_button = QPushButton("Delete Selected")
        self.delete_flight_button.setProperty("style", "btn-danger")
        self.delete_flight_button.clicked.connect(self.on_delete_flight)

        self.button_layout = QHBoxLayout()
        self.button_layout.addStretch()
        self.button_layout.addWidget(self.delete_flight_button)
        self.button_layout.addWidget(self.add_flight_button)

        self.mission_start_button = QPushButton("Take Off")
        self.mission_start_button.setProperty("style", "start-button")
        self.mission_start_button.clicked.connect(self.on_start)

        self.left_bar_layout.addWidget(self.select_airbase)
        self.left_bar_layout.addWidget(self.planned_flight_view)
        self.left_bar_layout.addLayout(self.button_layout)

        self.layout.addLayout(self.left_bar_layout, 0, 0)
        self.layout.addWidget(self.flight_planner, 0, 1)
        self.layout.addWidget(self.mission_start_button,
                              1,
                              1,
                              alignment=Qt.AlignRight)

        self.setLayout(self.layout)
Beispiel #24
0
    def initUI(self):
        """
        Initialize the user interface.

        """
        # Main window
        self.win = QWidget()

        # Figure out the GUI size
        self.AR = float(self.imageReader.width) / self.imageReader.height
        self.win.resize(self.gui_size*1.5, self.gui_size)
        L_main = QGridLayout(self.win)

        # A subwindow on the left for widgets, and a subwindow
        # on the right for the image
        self.win_right = QWidget(self.win)
        self.win_left = QWidget(self.win)
        L_right = QGridLayout(self.win_right)
        L_left = QGridLayout(self.win_left)
        L_main.addWidget(self.win_right, 0, 1, 1, 3)
        L_main.addWidget(self.win_left, 0, 0, 1, 1)

        ## IMAGES / OVERLAYS

        # ImageView, for rendering image
        self.imageView = ImageView(parent=self.win_right)
        L_right.addWidget(self.imageView, 0, 0)

        # ScatterPlotItem, for overlaying localizations
        self.scatterPlotItem = ScatterPlotItem()
        self.scatterPlotItem.setParentItem(self.imageView.imageItem)

        # GraphItem, for overlaying trajectory histories when
        # desired
        self.graphItem = GraphItem()
        self.graphItem.setParentItem(self.imageView.imageItem)

        # # Make spots clickable
        self.lastClicked = []
        self.scatterPlotItem.sigClicked.connect(self.spot_clicked)

        ## WIDGETS
        widget_align = Qt.AlignTop

        # Frame slider
        self.frame_slider = IntSlider(minimum=0, interval=1, 
            maximum=self.imageReader.n_frames-1, init_value=self.start_frame,
            name='Frame', parent=self.win_left)
        L_left.addWidget(self.frame_slider, 0, 0, rowSpan=2, 
            alignment=widget_align)
        self.frame_slider.assign_callback(self.frame_slider_callback)

        # Button to toggle spot overlays
        self.B_overlay_state = True 
        self.B_overlay = QPushButton("Overlay spots", parent=self.win_left)
        self.B_overlay.clicked.connect(self.B_overlay_callback)
        L_left.addWidget(self.B_overlay, 1, 0, alignment=widget_align)

        # Button to toggle trajectory trails
        self.B_overlay_trails_state = False 
        self.B_overlay_trails = QPushButton("Overlay histories", parent=self.win_left)
        self.B_overlay_trails.clicked.connect(self.B_overlay_trails_callback)
        L_left.addWidget(self.B_overlay_trails, 1, 1, alignment=widget_align)
        self.B_overlay_trails.stackUnder(self.B_overlay)

        # Menu to select current overlay symbol
        symbol_options = keys_to_str(symbol_sizes.keys())
        self.M_symbol = LabeledQComboBox(symbol_options, "Overlay symbol",
            init_value="o", parent=self.win_left)
        self.M_symbol.assign_callback(self.M_symbol_callback)
        L_left.addWidget(self.M_symbol, 2, 0, alignment=widget_align)

        # Menu to select how the spots are colored
        color_by_options = ["None", "Trajectory", "Quantitative attribute", "Boolean attribute"]
        self.M_color_by = LabeledQComboBox(color_by_options, 
            "Color spots by", init_value="None", parent=self.win_left)
        self.M_color_by.assign_callback(self.M_color_by_callback)
        L_left.addWidget(self.M_color_by, 3, 0, alignment=widget_align)

        # Create a new binary spot condition
        self.B_create_condition = QPushButton("Create Boolean attribute", 
            parent=self.win_left)
        self.B_create_condition.clicked.connect(self.B_create_condition_callback)
        L_left.addWidget(self.B_create_condition, 4, 0, alignment=widget_align)

        # Select the binary column that determines color when "condition"
        # is selected as the color-by attribute
        condition_options = [c for c in self.locs.columns if self.locs[c].dtype == 'bool']
        self.M_condition = LabeledQComboBox(condition_options, "Boolean attribute",
            init_value="None", parent=self.win_left)
        L_left.addWidget(self.M_condition, 3, 1, alignment=widget_align)
        self.M_condition.assign_callback(self.M_condition_callback)

        # Compare spots in a separate window that shows a grid of spots
        self.B_compare_spots = QPushButton("Compare spots", parent=self)
        L_left.addWidget(self.B_compare_spots, 2, 1, alignment=widget_align)
        self.B_compare_spots.clicked.connect(self.B_compare_spot_callback)

        # Some placeholder widgets, for better formatting
        for j in range(6, 18):
            q = QLabel(parent=self.win_left)
            L_left.addWidget(q, j, 0, alignment=widget_align)


        ## KEYBOARD SHORTCUTS - tab right/left through frames
        self.left_shortcut = QShortcut(QKeySequence(QtGui_Qt.Key_Left), self.win)
        self.right_shortcut = QShortcut(QKeySequence(QtGui_Qt.Key_Right), self.win)
        self.left_shortcut.activated.connect(self.tab_prev_frame)
        self.right_shortcut.activated.connect(self.tab_next_frame)


        ## DISPLAY
        self.update_image(autoRange=True, autoLevels=True, autoHistogramRange=True)
        self.overlay_spots()
        if "trajectory" in self.locs.columns:
            self.M_color_by.setCurrentText("Trajectory")
            self.M_color_by_callback()
        self.win.show()
Beispiel #25
0
    def __init__(self, parent):
        super(LevelSelector, self).__init__(parent)

        self.setWindowTitle("Level Selector")
        self.setModal(True)

        self.selected_world = 1
        self.selected_level = 1
        self.object_set = 0
        self.object_data_offset = 0x0
        self.enemy_data_offset = 0x0

        self.world_label = QLabel(parent=self, text="World")
        self.world_list = QListWidget(parent=self)
        self.world_list.addItems(WORLD_ITEMS)

        self.world_list.itemDoubleClicked.connect(self.on_ok)
        self.world_list.itemSelectionChanged.connect(self.on_world_click)

        self.level_label = QLabel(parent=self, text="Level")
        self.level_list = QListWidget(parent=self)

        self.level_list.itemDoubleClicked.connect(self.on_ok)
        self.level_list.itemSelectionChanged.connect(self.on_level_click)

        self.enemy_data_label = QLabel(parent=self, text="Enemy Data")
        self.enemy_data_spinner = Spinner(parent=self)

        self.object_data_label = QLabel(parent=self, text="Object Data")
        self.object_data_spinner = Spinner(self)

        self.object_set_label = QLabel(parent=self, text="Object Set")
        self.object_set_dropdown = QComboBox(self)
        self.object_set_dropdown.addItems(OBJECT_SET_ITEMS)

        self.button_ok = QPushButton("Ok", self)
        self.button_ok.clicked.connect(self.on_ok)
        self.button_cancel = QPushButton("Cancel", self)
        self.button_cancel.clicked.connect(self.close)

        self.window_layout = QGridLayout(self)

        self.window_layout.addWidget(self.world_label, 0, 0)
        self.window_layout.addWidget(self.level_label, 0, 1)

        self.window_layout.addWidget(self.world_list, 1, 0)
        self.window_layout.addWidget(self.level_list, 1, 1)

        self.window_layout.addWidget(self.enemy_data_label, 2, 0)
        self.window_layout.addWidget(self.object_data_label, 2, 1)
        self.window_layout.addWidget(self.enemy_data_spinner, 3, 0)
        self.window_layout.addWidget(self.object_data_spinner, 3, 1)

        self.window_layout.addWidget(self.object_set_label, 4, 0)
        self.window_layout.addWidget(self.object_set_dropdown, 4, 1)

        self.window_layout.addWidget(self.button_ok, 5, 0)
        self.window_layout.addWidget(self.button_cancel, 5, 1)

        self.setLayout(self.window_layout)

        self.world_list.setCurrentRow(1)  # select Level 1-1
        self.on_world_click()
Beispiel #26
0
	def __init__(self, alid=0, db=0, mode=0, parent=None):
		super().__init__(parent)

		self.db = db
		self.alid = int(alid)		
		self.curindex = 0
		self.viewWidget = QLabel()
		layout = QGridLayout()
		self.layout = layout


		#event = db.get_event_data(self.alid, self.eid) if db else 0
		self.photo_ids = db.get_all_albums_photos(self.alid)
		print('self.photo_ids')
		print(self.photo_ids)
		
		self.setPhoto()
		self.mode = mode
		
		def openMenu(position):
			# Создание PopupMenu
			menu = QMenu()			
			if mode > 0:				
				addAction = menu.addAction('Добавить фото')
				addAction2 = menu.addAction('Добавить видео')
				#menu.addSeparator()
				nextAction = menu.addAction('Следующий')
				#menu.addSeparator()
				delAction = menu.addAction('Удалить фото')
				delAllAction = menu.addAction('Удалить все фото')
				menu.addSeparator()
			else:
				addAction, addAction2, delAction, delAllAction = QAction(), QAction(), QAction(), QAction()
			quitAction = menu.addAction('Выход')
			action = menu.exec_(self.mapToGlobal(position))
			
			# Привязка событий к Actions					
			if action == addAction:
				res = []
				dialog = QFileDialog()
				dialog.setFileMode(QFileDialog.ExistingFiles)
				img_filter = 'Изображения (*.png *.bmp *.jpg);'
				dialog.setNameFilter(img_filter)
				fileNames = []
				if (dialog.exec()):
					  fileNames = dialog.selectedFiles()
				if len(fileNames) > 0:
					#print(fileNames)
					last_len = len(self.photo_ids) if type(self.photo_ids) == type([]) else 0
					for i, f in enumerate(fileNames):
						if os.path.isfile(f):
							data = self.db.add_album({'alid': self.alid, 'oldpath': f})
							if data:
								if self.photo_ids:
									self.photo_ids.append( data[0]['imid'] )
								else:
									self.photo_ids = [ data[0]['imid'] ]							
					print(self.photo_ids)					
					if self.photo_ids and type(self.photo_ids) == type([]) and len(self.photo_ids) > 0:
						if last_len < len(self.photo_ids):
							self.curindex = last_len
						else:
							self.curindex = 0
						self.setPhoto()

			if action == addAction2:
				res = []
				dialog = QFileDialog()
				dialog.setFileMode(QFileDialog.ExistingFiles)
				img_filter = 'Видео (*.mp4 *.avi *.3gp *.mpeg *.mpg);'
				dialog.setNameFilter(img_filter)
				fileNames = []
				if (dialog.exec()):
					  fileNames = dialog.selectedFiles()
				if len(fileNames) > 0:
					#print(fileNames)
					last_len = len(self.photo_ids) if type(self.photo_ids) == type([]) else 0
					for i, f in enumerate(fileNames):
						if os.path.isfile(f):
							data = self.db.add_album({'alid': self.alid, 'oldpath': f, 'video': True})
							if data:
								if self.photo_ids:
									self.photo_ids.append( data[0]['imid'] )
								else:
									self.photo_ids = [ data[0]['imid'] ]							
					print(self.photo_ids)					
					if self.photo_ids and type(self.photo_ids) == type([]) and len(self.photo_ids) > 0:
						if last_len < len(self.photo_ids):
							self.curindex = last_len
						else:
							self.curindex = 0
						self.setPhoto()
				
			if action == nextAction:
				self.setFocus()
				self.next_show()

			if action == delAction:
				if self.photo_ids and type(self.photo_ids) == type([]) and len(self.photo_ids) > 0:
					self.db.del_photo_from_album({'alid': self.alid, 'imid': self.photo_ids[self.curindex]})
					self.photo_ids = db.get_all_albums_photos(self.alid)	
					if self.photo_ids and type(self.photo_ids) == type([]) and len(self.photo_ids) > 0:
						if self.curindex >= len(self.photo_ids):
							self.curindex = len(self.photo_ids) - 1
						self.setPhoto()							
					else:
						self.viewWidget.setPixmap(QPixmap( os.path.join( 'images', 'no-photo.jpg') ).scaled(400, 400, Qt.KeepAspectRatio))						
				else:
					self.viewWidget.setPixmap(QPixmap( os.path.join( 'images', 'no-photo.jpg') ).scaled(400, 400, Qt.KeepAspectRatio))
						

			if action == delAllAction:
				for imid in self.photo_ids:									
					self.db.del_photo_from_album({'alid': self.alid, 'imid': imid})	
				self.viewWidget.setPixmap(QPixmap( os.path.join( 'images', 'no-photo.jpg') ).scaled(400, 400, Qt.KeepAspectRatio))				
				self.photo_ids = db.get_all_albums_photos(self.alid)


			if action == quitAction:
				self.accept()

		self.setContextMenuPolicy(Qt.CustomContextMenu)		  
		self.customContextMenuRequested.connect(openMenu)

		layout.addWidget(self.viewWidget, 0, 0)
		#layout.addWidget(self.dictAlbum, 0, 1)
		
		self.setLayout(layout)
Beispiel #27
0
    def initUI(self):
        """Функция инициализации всех виджетов
        (вызывать её не надо)"""

        # showMaximized() изменяет размер окна на максимальный.
        self.showMaximized()
        # Присваиваем названию окна строку "SERGEY APP!!!".
        self.setWindowTitle("SERGEY APP!!!")
        # Должно менять иконку приложения (Почему-то не работает).
        self.setWindowIcon(QIcon("icon.ico"))

        # QWebEngineView - класс библиотеки, с помощью которого можно
        # отображать Web страницы (сайты из интернета или
        # просто локальные файлы HTML).
        # Иницилиализируем его, передавая обьект нашего главного класса.
        self.web = QWebEngineView(self)
        # Получаем абсолютный путь файла
        # map2.html (почему-то QWebEngineView
        # загружает только абсолютные пути файла).
        file_path = os.path.abspath(
            os.path.join(os.path.dirname(__file__), "index.html"))
        self.web.setPage(WebPage(self.web))
        self.web.load(QUrl.fromLocalFile(file_path))

        def ready(retVal):
            print("Returned:", retVal)

        def loadFinished(ok):
            if ok:
                #self.web.page().runJavaScript("bruhmoment()", ready)
                pass

        self.web.loadFinished.connect(loadFinished)

        self.jsChannel = QWebChannel()
        self.jsHandler = CallHandler()
        self.jsChannel.registerObject("jsHandler", self.jsHandler)
        self.web.page().setWebChannel(self.jsChannel)

        input_frame = QFrame(self)
        input_frame.setFrameStyle(QFrame.Box)

        inputgrid = QGridLayout(input_frame)

        inputButtonTexts = ["Привет!", "Квест", "Пока!"]
        buttons = []
        for i in range(len(inputButtonTexts)):
            buttons.append(InputButton(inputButtonTexts[i], input_frame, self))
            inputgrid.addWidget(buttons[i], 0, i, 1, 1)

        self.inputbox = QLineEdit(input_frame)
        self.inputbox.returnPressed.connect(self.sendMsg)
        inputgrid.addWidget(self.inputbox, 1, 0, 1, -1)

        self.chat = Chat()

        # QGridLayout - один из макетных классов, которые помогает управлять
        # положением виджетов. Этот класс управляет положениями виджетов
        # с помощью "таблицы", например как в Excel.
        # Виджеты могут занимать несколько "клеток" в таблице.
        # Пример макета:
        # +------------+----------------+
        # |   Кнопка   |                |
        # +------------+  Что-то еще... |
        # |            |                |
        # | Поле ввода +----------------+
        # |            | Какой-то текст |
        # +------------+----------------+
        main_layout = QGridLayout(self)

        # Добавляем все наши виджеты (кнопки, веб страницы и т.д.)
        main_layout.addWidget(self.chat, 0, 0, 80, 60)
        main_layout.addWidget(input_frame, 80, 0, 20, 60)
        main_layout.addWidget(self.web, 0, 60, 100, 40)
    def _set_labels_and_layout(self):
        """
        Creates this Widget's content and layout
        """
        # --- Content ---

        # Lecluse DevCorp. Logo
        logo = QLabel()
        logo.setPixmap(QPixmap("assets/LDC-dark.png"))
        logo.setFixedSize(QSize(
            512, 222))  # Original dimension is 2048x888, we divided by 4
        logo.setScaledContents(True)

        # App credo
        lab_app = QLabel(f'<b>{tr("app_title")}</b> {tr("about_sdc")}')

        # Devs
        features_lab = QLabel(tr("about_features"))
        ihm_lab = QLabel(tr("about_ihm"))
        web_lab = QLabel(tr("about_web"))
        features_dev = QLabel(
            f'{self.links_style}<a href="https://www.lecluse.fr">Olivier Lécluse</a>'
        )
        features_dev.setOpenExternalLinks(True)
        ihm_dev = QLabel(
            f'{self.links_style}<a href="https://www.linkedin.com/in/thomas-lécluse-62130395/">Thomas Lécluse</a>'
        )
        ihm_dev.setOpenExternalLinks(True)
        web_dev = QLabel(
            f'{self.links_style}<a href="https://www.linkedin.com/in/nicolas-lecluse-a3488752/">Nicolas Lécluse</a>'
        )
        web_dev.setOpenExternalLinks(True)

        # Documentation link
        lab_link_doc = QLabel(
            f'{tr("link_to")} {self.links_style}<a href="https://sdc.lecluse.fr">{tr("about_doc")}</a>'
        )
        lab_link_doc.setOpenExternalLinks(True)

        # Github link
        lab_link_git = QLabel(
            f'{tr("link_to")} {self.links_style}<a href="https://github.com/wawachief/SalleDeClasse">{tr("about_github")}</a>'
        )
        lab_link_git.setOpenExternalLinks(True)

        # Contact
        lab_contact = QLabel(
            f'{tr("about_contact")} {self.links_style}<a href="mailto:[email protected]">[email protected]</a>'
        )
        lab_contact.setOpenExternalLinks(True)

        # License
        lab_license = QLabel(
            f'{self.links_style}<a href="https://www.gnu.org/licenses/gpl-3.0.fr.html">GPL-3.0 License</a>'
        )
        lab_license.setOpenExternalLinks(True)

        # Version
        lab_app_version = QLabel(tr("app_version"))
        lab_bdd_version = QLabel(tr("bdd_version"))
        app_version = QLabel(AssetManager.getInstance().config(
            'main', 'version'))
        bdd_version = QLabel(str(self.bdd_version))

        # --- Layout ---
        box = QVBoxLayout()
        box.setMargin(0)
        box.setSpacing(0)

        # Logo
        box.addWidget(logo, alignment=Qt.AlignCenter)

        Separator(self.width(), box)  # ----

        # 'Salle de Classe' credo
        box.addWidget(lab_app, alignment=Qt.AlignCenter)
        box.addSpacing(SPACING_SIZE)

        # Devs roles
        dev_grid = QGridLayout()
        dev_grid.setContentsMargins(0, 0, 0, 0)
        dev_grid.addWidget(features_lab, 0, 0, alignment=Qt.AlignRight)
        dev_grid.addWidget(ihm_lab, 1, 0, alignment=Qt.AlignRight)
        dev_grid.addWidget(web_lab, 2, 0, alignment=Qt.AlignRight)
        dev_grid.addWidget(features_dev, 0, 1, alignment=Qt.AlignLeft)
        dev_grid.addWidget(ihm_dev, 1, 1, alignment=Qt.AlignLeft)
        dev_grid.addWidget(web_dev, 2, 1, alignment=Qt.AlignLeft)
        box.addLayout(dev_grid)

        # Contact
        box.addSpacing(SPACING_SIZE)
        box.addWidget(lab_contact, alignment=Qt.AlignCenter)

        Separator(self.width(), box)  # ----

        # Links of doc, git and license
        box.addWidget(lab_link_doc, alignment=Qt.AlignCenter)
        box.addWidget(lab_link_git, alignment=Qt.AlignCenter)
        box.addSpacing(SPACING_SIZE)
        box.addWidget(lab_license, alignment=Qt.AlignCenter)

        Separator(self.width(), box)  # ----

        # Version
        grid_version = QGridLayout()
        grid_version.addWidget(lab_app_version, 0, 0, alignment=Qt.AlignRight)
        grid_version.addWidget(lab_bdd_version, 1, 0, alignment=Qt.AlignRight)
        grid_version.addWidget(app_version, 0, 1, alignment=Qt.AlignLeft)
        grid_version.addWidget(bdd_version, 1, 1, alignment=Qt.AlignLeft)
        box.addLayout(grid_version)
        box.addSpacing(SPACING_SIZE)

        self.setLayout(box)
    def __init__(self, parent):
        """Groupbox for 'pynwb.file.Subject' fields filling form."""
        super().__init__(title="Subject", parent=parent)
        #self.setTitle('Subject')
        self.group_type = 'Subject'

        self.lbl_age = QLabel('age:')
        self.form_age = QLineEdit('')
        self.form_age.setPlaceholderText("age")
        self.form_age.setToolTip("the age of the subject")

        self.lbl_description = QLabel('description:')
        self.form_description = QLineEdit('')
        self.form_description.setPlaceholderText("description")
        self.form_description.setToolTip("a description of the subject")

        self.lbl_genotype = QLabel('genotype:')
        self.form_genotype = QLineEdit('')
        self.form_genotype.setPlaceholderText("genotype")
        self.form_genotype.setToolTip("the genotype of the subject")

        self.lbl_sex = QLabel('sex:')
        self.form_sex = QLineEdit('')
        self.form_sex.setPlaceholderText("sex")
        self.form_sex.setToolTip("the sex of the subject")

        self.lbl_species = QLabel('species:')
        self.form_species = QLineEdit('')
        self.form_species.setPlaceholderText("species")
        self.form_species.setToolTip("the species of the subject")

        self.lbl_subject_id = QLabel('subject_id:')
        self.form_subject_id = QLineEdit('')
        self.form_subject_id.setPlaceholderText("subject_id")
        self.form_subject_id.setToolTip("a unique identifier for the subject")

        self.lbl_weight = QLabel('weight:')
        self.form_weight = QLineEdit('')
        self.form_weight.setPlaceholderText("weight")
        self.form_weight.setToolTip("the weight of the subject")

        self.lbl_date_of_birth = QLabel('date_of_birth:')
        self.form_date_of_birth = QLineEdit('')
        self.form_date_of_birth.setPlaceholderText(
            datetime.now().strftime("%d/%m/%Y"))
        self.form_date_of_birth.setToolTip(
            "datetime of date of birth. May be supplied instead of age.")

        self.grid = QGridLayout()
        self.grid.setColumnStretch(2, 1)
        self.grid.addWidget(self.lbl_age, 0, 0, 1, 2)
        self.grid.addWidget(self.form_age, 0, 2, 1, 4)
        self.grid.addWidget(self.lbl_description, 1, 0, 1, 2)
        self.grid.addWidget(self.form_description, 1, 2, 1, 4)
        self.grid.addWidget(self.lbl_genotype, 2, 0, 1, 2)
        self.grid.addWidget(self.form_genotype, 2, 2, 1, 4)
        self.grid.addWidget(self.lbl_sex, 3, 0, 1, 2)
        self.grid.addWidget(self.form_sex, 3, 2, 1, 4)
        self.grid.addWidget(self.lbl_species, 4, 0, 1, 2)
        self.grid.addWidget(self.form_species, 4, 2, 1, 4)
        self.grid.addWidget(self.lbl_subject_id, 5, 0, 1, 2)
        self.grid.addWidget(self.form_subject_id, 5, 2, 1, 4)
        self.grid.addWidget(self.lbl_weight, 6, 0, 1, 2)
        self.grid.addWidget(self.form_weight, 6, 2, 1, 4)
        self.grid.addWidget(self.lbl_date_of_birth, 7, 0, 1, 2)
        self.grid.addWidget(self.form_date_of_birth, 7, 2, 1, 4)

        #self.setLayout(self.grid)
        self.setContentLayout(self.grid)
Beispiel #30
0
    def __init__(self, model):
        super().__init__()

        self.setWindowTitle("OpenHRV")
        self.setWindowIcon(QIcon(":/logo.png"))
        self.setGeometry(50, 50, 1750, 850)

        self.model = model
        self.signals = ViewSignals()

        self.scanner = SensorScanner()
        self.scanner_thread = QThread(self)
        self.scanner.moveToThread(self.scanner_thread)
        self.scanner.mac_update.connect(self.model.set_mac_addresses)

        self.sensor = SensorClient()
        self.sensor_thread = QThread(self)
        self.sensor.moveToThread(self.sensor_thread)
        self.sensor.ibi_update.connect(self.model.set_ibis_buffer)
        self.sensor_thread.started.connect(self.sensor.run)

        self.redis_publisher = RedisPublisher()
        self.redis_publisher_thread = QThread(self)
        self.redis_publisher.moveToThread(self.redis_publisher_thread)
        self.model.ibis_buffer_update.connect(self.redis_publisher.publish)
        self.model.mean_hrv_update.connect(self.redis_publisher.publish)
        self.model.mac_addresses_update.connect(self.redis_publisher.publish)
        self.model.pacer_rate_update.connect(self.redis_publisher.publish)
        self.model.hrv_target_update.connect(self.redis_publisher.publish)
        self.model.biofeedback_update.connect(self.redis_publisher.publish)
        self.signals.annotation.connect(self.redis_publisher.publish)
        self.redis_publisher_thread.started.connect(
            self.redis_publisher.monitor.start)

        self.redis_logger = RedisLogger()
        self.redis_logger_thread = QThread(self)
        self.redis_logger.moveToThread(self.redis_logger_thread)
        self.redis_logger_thread.finished.connect(
            self.redis_logger.save_recording)
        self.redis_logger.recording_status.connect(self.show_recording_status)

        self.ibis_plot = pg.PlotWidget()
        self.ibis_plot.setBackground("w")
        self.ibis_plot.setLabel("left", "Inter-Beat-Interval (msec)",
                                **{"font-size": "25px"})
        self.ibis_plot.setLabel("bottom", "Seconds", **{"font-size": "25px"})
        self.ibis_plot.showGrid(y=True)
        self.ibis_plot.setYRange(300, 1500, padding=0)
        self.ibis_plot.setMouseEnabled(x=False, y=False)

        self.ibis_signal = pg.PlotCurveItem()
        pen = pg.mkPen(color=(0, 191, 255), width=7.5)
        self.ibis_signal.setPen(pen)
        self.ibis_signal.setData(self.model.ibis_seconds,
                                 self.model.ibis_buffer)
        self.ibis_plot.addItem(self.ibis_signal)

        self.mean_hrv_plot = pg.PlotWidget()
        self.mean_hrv_plot.setBackground("w")
        self.mean_hrv_plot.setLabel("left", "HRV (msec)",
                                    **{"font-size": "25px"})
        self.mean_hrv_plot.setLabel("bottom", "Seconds",
                                    **{"font-size": "25px"})
        self.mean_hrv_plot.showGrid(y=True)
        self.mean_hrv_plot.setYRange(0, 600, padding=0)
        self.mean_hrv_plot.setMouseEnabled(x=False, y=False)
        colorgrad = QLinearGradient(0, 0, 0, 1)  # horizontal gradient
        colorgrad.setCoordinateMode(QGradient.ObjectMode)
        colorgrad.setColorAt(0, pg.mkColor("g"))
        colorgrad.setColorAt(.5, pg.mkColor("y"))
        colorgrad.setColorAt(1, pg.mkColor("r"))
        brush = QBrush(colorgrad)
        self.mean_hrv_plot.getViewBox().setBackgroundColor(brush)

        self.mean_hrv_signal = pg.PlotCurveItem()
        pen = pg.mkPen(color="w", width=7.5)
        self.mean_hrv_signal.setPen(pen)
        self.mean_hrv_signal.setData(self.model.mean_hrv_seconds,
                                     self.model.mean_hrv_buffer)
        self.mean_hrv_plot.addItem(self.mean_hrv_signal)

        self.pacer_plot = pg.PlotWidget()
        self.pacer_plot.setBackground("w")
        self.pacer_plot.setAspectLocked(lock=True, ratio=1)
        self.pacer_plot.setMouseEnabled(x=False, y=False)
        self.pacer_plot.disableAutoRange()
        self.pacer_plot.setXRange(-1, 1, padding=0)
        self.pacer_plot.setYRange(-1, 1, padding=0)
        self.pacer_plot.hideAxis("left")
        self.pacer_plot.hideAxis("bottom")

        self.pacer_disc = pg.PlotCurveItem()
        brush = pg.mkBrush(color=(135, 206, 250))
        self.pacer_disc.setBrush(brush)
        self.pacer_disc.setFillLevel(1)
        self.pacer_plot.addItem(self.pacer_disc)

        self.pacer_rate = QSlider(Qt.Horizontal)
        self.pacer_rate.setTracking(False)
        self.pacer_rate.setRange(
            0, 6)  # transformed to bpm [4, 7], step .5 by model
        self.pacer_rate.valueChanged.connect(self.model.set_breathing_rate)
        self.pacer_rate.setSliderPosition(4)  # corresponds to 6 bpm
        self.pacer_label = QLabel(f"Rate: {self.model.breathing_rate}")

        self.pacer_toggle = QCheckBox("Show pacer", self)
        self.pacer_toggle.setChecked(True)
        self.pacer_toggle.stateChanged.connect(self.toggle_pacer)

        self.hrv_target_label = QLabel(f"Target: {self.model.hrv_target}")

        self.hrv_target = QSlider(Qt.Horizontal)
        self.hrv_target.setRange(50, 600)
        self.hrv_target.setSingleStep(10)
        self.hrv_target.valueChanged.connect(self.model.set_hrv_target)
        self.hrv_target.setSliderPosition(self.model.hrv_target)
        self.mean_hrv_plot.setYRange(0, self.model.hrv_target, padding=0)

        self.scan_button = QPushButton("Scan")
        self.scan_button.clicked.connect(self.scanner.scan)

        self.mac_menu = QComboBox()

        self.connect_button = QPushButton("Connect")
        self.connect_button.clicked.connect(self.connect_sensor)

        self.start_recording_button = QPushButton("Start")
        self.start_recording_button.clicked.connect(
            self.redis_logger.start_recording)

        self.save_recording_button = QPushButton("Save")
        self.save_recording_button.clicked.connect(
            self.redis_logger.save_recording)

        self.annotation = QComboBox()
        self.annotation.setEditable(True)
        self.annotation.setDuplicatesEnabled(False)
        self.annotation.addItems([
            "start_baseline", "end_baseline", "start_bf", "end_bf",
            "start_nobf", "end_nobf"
        ])
        self.annotation.setMaxCount(
            10)  # user can configure up to 4 additional custom annotations
        self.annotation_button = QPushButton("Annotate")
        self.annotation_button.clicked.connect(self.emit_annotation)
        self.central_widget = QWidget()
        self.setCentralWidget(self.central_widget)

        self.recording_status_label = QLabel("Status:")
        self.recording_statusbar = QProgressBar()
        self.recording_statusbar.setRange(0, 1)

        self.vlayout0 = QVBoxLayout(self.central_widget)

        self.hlayout0 = QHBoxLayout()
        self.hlayout0.addWidget(self.ibis_plot, stretch=80)
        self.hlayout0.addWidget(self.pacer_plot, stretch=20)
        self.vlayout0.addLayout(self.hlayout0)

        self.vlayout0.addWidget(self.mean_hrv_plot)

        self.hlayout1 = QHBoxLayout()

        self.device_config = QFormLayout()
        self.device_config.addRow(self.scan_button, self.mac_menu)
        self.device_config.addRow(self.connect_button)
        self.device_panel = QGroupBox("ECG Devices")
        self.device_panel.setLayout(self.device_config)
        self.hlayout1.addWidget(self.device_panel, stretch=25)

        self.hrv_config = QFormLayout()
        self.hrv_config.addRow(self.hrv_target_label, self.hrv_target)
        self.hrv_panel = QGroupBox("HRV Settings")
        self.hrv_panel.setLayout(self.hrv_config)
        self.hlayout1.addWidget(self.hrv_panel, stretch=25)

        self.pacer_config = QFormLayout()
        self.pacer_config.addRow(self.pacer_label, self.pacer_rate)
        self.pacer_config.addRow(self.pacer_toggle)
        self.pacer_panel = QGroupBox("Breathing Pacer")
        self.pacer_panel.setLayout(self.pacer_config)
        self.hlayout1.addWidget(self.pacer_panel, stretch=25)

        self.recording_config = QGridLayout()
        self.recording_config.addWidget(self.start_recording_button, 0, 0)
        self.recording_config.addWidget(self.save_recording_button, 0, 1)
        self.recording_config.addWidget(self.recording_statusbar, 0, 2)
        self.recording_config.addWidget(self.annotation, 1, 0, 1,
                                        2)  # row, column, rowspan, columnspan
        self.recording_config.addWidget(self.annotation_button, 1, 2)

        self.recording_panel = QGroupBox("Recording")
        self.recording_panel.setLayout(self.recording_config)
        self.hlayout1.addWidget(self.recording_panel, stretch=25)

        self.vlayout0.addLayout(self.hlayout1)

        self.model.ibis_buffer_update.connect(self.plot_ibis)
        self.model.mean_hrv_update.connect(self.plot_hrv)
        self.model.mac_addresses_update.connect(self.list_macs)
        self.model.pacer_disk_update.connect(self.plot_pacer_disk)
        self.model.pacer_rate_update.connect(self.update_pacer_label)
        self.model.hrv_target_update.connect(self.update_hrv_target)

        self.scanner_thread.start()
        self.sensor_thread.start()
        self.redis_publisher_thread.start()
        self.redis_logger_thread.start()