예제 #1
0
class QW_FEMPoisson(QWidget):
    updated_cadmshfem = Signal()

    def __init__(self, fem: dfm2.FEM_ScalarPoisson):
        super(QW_FEMPoisson, self).__init__()
        self.fem = fem

        self.cb1 = QCheckBox("Sync FEM to Params")
        self.cb1.setChecked(True)
        self.cb1.stateChanged.connect(lambda: self.btnstate(self.b1))

        self.qui_sp = QW_SolveParam(self.fem)
        self.qui_sp.updated_cadmshfem.connect(
            lambda: self.updated_cadmshfem.emit())

        ####

        self.vs1 = QW_FemParams(["alpha", "source"], self.fem)
        self.vs1.valueChanged.connect(self.fem_param_changed)

        ####

        self.vl = QVBoxLayout()
        self.vl.addWidget(self.qui_sp, alignment=Qt.AlignLeft)
        self.vl.addWidget(self.vs1, alignment=Qt.AlignLeft)
        self.vl.addStretch()
        self.setLayout(self.vl)

    def fem_param_changed(self):
        if self.qui_sp.cb1.isChecked():
            self.fem.solve()
            self.updated_cadmshfem.emit()
 def __init__(self, layout_generator):
     super().__init__()
     self.setAttribute(Qt.WA_DeleteOnClose)
     inner_widget = QWidget(self)
     layout = QHBoxLayout(self)
     layout.addStretch()
     layout.addWidget(inner_widget)
     layout.addStretch()
     inner_layout = QVBoxLayout(inner_widget)
     label = QLabel()
     label.setStyleSheet(
         "QLabel{color:white; font-weight: bold; font-size:18px;}")
     label.setAlignment(Qt.AlignHCenter)
     progress_bar = QProgressBar()
     progress_bar.setRange(0, layout_generator.iterations - 1)
     progress_bar.setTextVisible(False)
     button_box = QDialogButtonBox()
     button_box.setCenterButtons(True)
     previews_button = button_box.addButton("Show previews",
                                            QDialogButtonBox.NoRole)
     previews_button.setCheckable(True)
     previews_button.toggled.connect(layout_generator.set_show_previews)
     previews_button.toggled.connect(
         lambda checked: previews_button.setText(
             f"{'Hide' if checked else 'Show'} previews"))
     cancel_button = button_box.addButton("Cancel", QDialogButtonBox.NoRole)
     cancel_button.clicked.connect(layout_generator.stop)
     inner_layout.addStretch()
     inner_layout.addWidget(label)
     inner_layout.addWidget(progress_bar)
     inner_layout.addWidget(button_box)
     inner_layout.addStretch()
     layout_generator.finished.connect(self.close)
     layout_generator.progressed.connect(progress_bar.setValue)
     layout_generator.msg.connect(label.setText)
예제 #3
0
    def init_ui(self):
        def make_cheat_callback(enemy_point: ControlPoint,
                                advance: bool) -> Callable[[], None]:
            def cheat() -> None:
                self.cheat_alter_front_line(enemy_point, advance)

            return cheat

        layout = QVBoxLayout()
        for enemy_cp in self.cp.connected_points:
            if not enemy_cp.captured:
                layout.addWidget(QLabel(enemy_cp.name))
                layout.addWidget(
                    QGroundForcesStrategySelector(self.cp, enemy_cp))
                if self.game.settings.enable_frontline_cheats:
                    advance_button = QPushButton("CHEAT: Advance")
                    advance_button.setProperty("style", "btn-danger")
                    layout.addWidget(advance_button)
                    advance_button.clicked.connect(
                        make_cheat_callback(enemy_cp, advance=True))

                    retreat_button = QPushButton("CHEAT: Retreat")
                    retreat_button.setProperty("style", "btn-danger")
                    layout.addWidget(retreat_button)
                    retreat_button.clicked.connect(
                        make_cheat_callback(enemy_cp, advance=False))

        layout.addStretch()
        self.setLayout(layout)
예제 #4
0
 def __init__(self, parent, name, data):
     global instance_id
     QWidget.__init__(self, parent)
     DockContextHandler.__init__(self, self, name)
     self.actionHandler = UIActionHandler()
     self.actionHandler.setupActionHandler(self)
     offset_layout = QHBoxLayout()
     offset_layout.addWidget(QLabel("Offset: "))
     self.offset = QLabel(hex(0))
     offset_layout.addWidget(self.offset)
     offset_layout.setAlignment(QtCore.Qt.AlignCenter)
     datatype_layout = QHBoxLayout()
     datatype_layout.addWidget(QLabel("Data Type: "))
     self.datatype = QLabel("")
     datatype_layout.addWidget(self.datatype)
     datatype_layout.setAlignment(QtCore.Qt.AlignCenter)
     layout = QVBoxLayout()
     title = QLabel(name, self)
     title.setAlignment(QtCore.Qt.AlignCenter)
     instance = QLabel("Instance: " + str(instance_id), self)
     instance.setAlignment(QtCore.Qt.AlignCenter)
     layout.addStretch()
     layout.addWidget(title)
     layout.addWidget(instance)
     layout.addLayout(datatype_layout)
     layout.addLayout(offset_layout)
     layout.addStretch()
     self.setLayout(layout)
     instance_id += 1
     self.data = data
예제 #5
0
    def initUI(self):

        formlayout = QFormLayout()
        formlayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
        formlayout.setVerticalSpacing(20)

        explain = QLabel("推送小工具请粘贴微博文章详情页链接,并选择类型,提交。")
        url = QLabel('微博链接:')
        data_type = QLabel('选择类型:')

        self.url_edit = QLineEdit()
        self.data_type_edit = QComboBox()
        self.data_type_edit.addItems(['负面', '中性', '正面'])

        button = QPushButton('提交', self)
        button.setStyleSheet("background-color: rgb(255, 255, 255);")

        formlayout.addRow(explain)
        formlayout.addRow(url, self.url_edit)
        formlayout.addRow(data_type, self.data_type_edit)

        hbox = QHBoxLayout()
        hbox.addStretch(0)
        hbox.addWidget(button)
        vbox = QVBoxLayout()
        vbox.addStretch(0)
        vbox.addLayout(hbox)
        formlayout.addRow(vbox)
        self.setLayout(formlayout)
        # x y 宽 高
        self.setGeometry(500, 200, 600, 400)
        self.setWindowTitle('推送小工具')
        self.show()
        # self.data_type_edit.currentIndexChanged[str].connect(self.print_value)  # 条目发生改变,发射信号,传递条目内容
        button.clicked.connect(self.but_click)
예제 #6
0
 def __init__(self, layout_generator, parent):
     super().__init__(parent)
     self.setAttribute(Qt.WA_DeleteOnClose)
     inner_widget = QWidget(self)
     layout = QHBoxLayout(self)
     layout.addStretch()
     layout.addWidget(inner_widget)
     layout.addStretch()
     inner_layout = QVBoxLayout(inner_widget)
     label = QLabel("Generating layout...")
     label.setStyleSheet(
         "QLabel{color:white; font-weight: bold; font-size:18px;}")
     label.setAlignment(Qt.AlignHCenter)
     progress_bar = QProgressBar()
     progress_bar.setRange(0, layout_generator.iterations - 1)
     progress_bar.setTextVisible(False)
     button_box = QDialogButtonBox()
     button_box.setCenterButtons(True)
     button = button_box.addButton("Cancel", QDialogButtonBox.NoRole)
     button.clicked.connect(layout_generator.cancel)
     inner_layout.addStretch()
     inner_layout.addWidget(label)
     inner_layout.addWidget(progress_bar)
     inner_layout.addWidget(button_box)
     inner_layout.addStretch()
     self.setFixedSize(parent.size())
     layout_generator.done.connect(self.close)
     layout_generator.progressed.connect(progress_bar.setValue)
예제 #7
0
    def init_ui(self):
        main_layout = QVBoxLayout()

        units = {
            PinpointStrike:
            db.find_unittype(PinpointStrike, self.game.player_name),
        }

        scroll_content = QWidget()
        task_box_layout = QGridLayout()
        scroll_content.setLayout(task_box_layout)
        row = 0

        for task_type in units.keys():
            units_column = list(set(units[task_type]))
            if len(units_column) == 0: continue
            units_column.sort(key=lambda x: db.PRICES[x])
            for unit_type in units_column:
                row = self.add_purchase_row(unit_type, task_box_layout, row)
            stretch = QVBoxLayout()
            stretch.addStretch()
            task_box_layout.addLayout(stretch, row, 0)

        scroll_content.setLayout(task_box_layout)
        scroll = QScrollArea()
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        scroll.setWidgetResizable(True)
        scroll.setWidget(scroll_content)
        main_layout.addWidget(scroll)
        self.setLayout(main_layout)
예제 #8
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.file_label = QLabel()
        self.progress = QProgressBar()
        self.info_label = QLabel()
        self.btn_box = QDialogButtonBox(QDialogButtonBox.Ok
                                        | QDialogButtonBox.Cancel)
        self.net = QNetworkAccessManager()

        font = QFont()
        font.setBold(True)
        self.file_label.setFont(font)

        v_layout = QVBoxLayout()
        v_layout.addWidget(self.file_label)
        v_layout.addWidget(self.progress)
        v_layout.addWidget(self.info_label)
        v_layout.addStretch()
        v_layout.addWidget(self.btn_box)

        self.btn_box.accepted.connect(self.close)
        self.btn_box.rejected.connect(self.cancel)
        self.btn_box.button(QDialogButtonBox.Ok).setVisible(False)

        self.setLayout(v_layout)

        self.setFixedSize(450, 150)
        self.setWindowTitle(self.tr("Download file"))
예제 #9
0
    def initUi(self):
        main_layout = QVBoxLayout()
        layout = QGridLayout()
        layout.addWidget(QLabel("<strong>DCS saved game directory:</strong>"),
                         0,
                         0,
                         alignment=Qt.AlignLeft)
        layout.addWidget(self.edit_saved_game_dir,
                         1,
                         0,
                         alignment=Qt.AlignRight)
        layout.addWidget(self.browse_saved_game, 1, 1, alignment=Qt.AlignRight)
        layout.addWidget(
            QLabel("<strong>DCS installation directory:</strong>"),
            2,
            0,
            alignment=Qt.AlignLeft)
        layout.addWidget(self.edit_dcs_install_dir,
                         3,
                         0,
                         alignment=Qt.AlignRight)
        layout.addWidget(self.browse_install_dir,
                         3,
                         1,
                         alignment=Qt.AlignRight)
        layout.addWidget(QLabel("<strong>Theme (Requires Restart)</strong>"),
                         4, 0)
        layout.addWidget(self.themeSelect, 4, 1, alignment=Qt.AlignRight)
        self.themeSelect.setCurrentIndex(get_theme_index())

        main_layout.addLayout(layout)
        main_layout.addStretch()

        self.setLayout(main_layout)
예제 #10
0
    def __init__(self, flight: Flight, game: Game) -> None:
        super().__init__("Use custom loadout")
        self.flight = flight
        self.game = game
        self.setCheckable(True)
        self.setChecked(flight.use_custom_loadout)

        self.toggled.connect(self.on_toggle)

        hboxLayout = QVBoxLayout(self)
        layout = QGridLayout(self)

        for i, pylon in enumerate(Pylon.iter_pylons(self.flight.unit_type)):
            label = QLabel(f"<b>{pylon.number}</b>")
            label.setSizePolicy(
                QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
            layout.addWidget(label, i, 0)
            layout.addWidget(QPylonEditor(game, flight, pylon), i, 1)

        hboxLayout.addLayout(layout)
        hboxLayout.addStretch()
        self.setLayout(hboxLayout)

        if not self.isChecked():
            for i in self.findChildren(QPylonEditor):
                i.default_loadout()
예제 #11
0
    def __init__(self, window_title, parent):
        """Initializes class.

        Args:
            window_title (str)
            parent (QMainWindow)
        """
        super().__init__(window_title, parent)
        self.setObjectName(window_title)
        self.label_msg = QLabel(self)
        self.label_msg.setFont(QFont("arial,helvetica", 12))
        self.label_msg.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.label_msg.setWordWrap(True)
        self.button_left = QPushButton(self)
        self.button_right = QPushButton(self)
        button_container = QWidget(self)
        button_layout = QHBoxLayout(button_container)
        button_layout.addStretch()
        button_layout.addWidget(self.button_left)
        button_layout.addWidget(self.button_right)
        button_layout.addStretch()
        widget = QWidget(self)
        layout = QVBoxLayout(widget)
        layout.addStretch()
        layout.addWidget(self.label_msg)
        layout.addStretch()
        layout.addWidget(button_container)
        self.setWidget(widget)
        self.hide()
        self.machine = None
        self.run = None
예제 #12
0
    def initUI(self):
        vb = QVBoxLayout()
        hbMid = QHBoxLayout()

        vb.addStretch()
        vb.addLayout(hbMid)
        vb.addStretch()

        gl = QGridLayout()
        hbMid.addStretch()
        hbMid.addLayout(gl)
        hbMid.addStretch()

        gl.setSpacing(100)
        x = 0
        y = 0
        z = 0
        r = 0
        d = 0

        self.text = "X:{0}, Y:{1}, R:{2}, G:{3}, B:{4}".format(x, y, z, r, d)
        self.lbl = QLabel(self.text, self)
        gl.addWidget(self.lbl, 0, 0, Qt.AlignTop)

        self.setLayout(vb)

        self.resize(350, 200)
        self.show()
        self.MouseTracking()
    def __init__(self, menus=None, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.setAttribute(Qt.WA_StyledBackground, True)
        self.menus = menus if menus is not None else [
            'Devices', 'Control', 'Setpoints', 'PID', 'Plotting', 'Logging'
        ]
        self.menu_buttons = {
            key: QPushButton(parent=self, objectName=key)
            for key in self.menus
        }
        self.buttongroup = QButtonGroup()
        elchicon = QLabel()
        elchicon.setPixmap(QPixmap('Icons/ElchiHead.png'))

        vbox = QVBoxLayout()
        vbox.addWidget(elchicon, alignment=Qt.AlignHCenter)
        for key in self.menus:
            vbox.addWidget(self.menu_buttons[key])
            self.buttongroup.addButton(self.menu_buttons[key])
            self.menu_buttons[key].setCheckable(True)
            self.menu_buttons[key].setFixedSize(150, 100)

        vbox.addStretch()
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        self.setMinimumWidth(150)
        self.setLayout(vbox)
예제 #14
0
    def initUI(self):
        self.setGeometry(300, 300, 350, 450)
        self.setWindowTitle("Rename some stuff")

        contentMargin = [38, 0, 0, 0]
        self.baseNameGui = CheckBoxWithLineEdit("Base Name:", "Spine")
        self.prefixGui = CheckBoxWithLineEdit("Prefix:", "JNT", contentMargin=contentMargin)
        self.suffixGui = CheckBoxWithLineEdit("Suffix:", "GEO", contentMargin=contentMargin)
        button = QPushButton("Rename", self)
        button.setFont(medium_text_font)
        button.setFixedHeight(50)

        # button action
        button.clicked.connect(self.renameStuff)

        # layout
        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.baseNameGui)
        mainLayout.addWidget(self.prefixGui)
        mainLayout.addWidget(self.suffixGui)
        mainLayout.addStretch(1)
        mainLayout.addWidget(button)

        self.setLayout(mainLayout)
        self.show()
예제 #15
0
    def __init__(self, flight, game):
        super(QLoadoutEditor, self).__init__("Use custom loadout")
        self.flight = flight
        self.game = game
        self.setCheckable(True)
        self.setChecked(flight.use_custom_loadout)

        self.toggled.connect(self.on_toggle)

        hboxLayout = QVBoxLayout(self)
        layout = QGridLayout(self)

        pylons = [
            v for v in self.flight.unit_type.__dict__.values()
            if inspect.isclass(v) and v.__name__.startswith("Pylon")
        ]
        for i, pylon in enumerate(pylons):
            label = QLabel("<b>{}</b>".format(pylon.__name__[len("Pylon"):]))
            label.setSizePolicy(
                QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
            layout.addWidget(label, i, 0)
            try:
                pylon_number = int(pylon.__name__.split("Pylon")[1])
            except:
                pylon_number = i + 1
            layout.addWidget(QPylonEditor(flight, pylon, pylon_number), i, 1)

        hboxLayout.addLayout(layout)
        hboxLayout.addStretch()
        self.setLayout(hboxLayout)
    def __init__(self, cp: ControlPoint, game_model: GameModel) -> None:
        super().__init__()
        self.cp = cp
        self.game_model = game_model
        self.transfers: Dict[Type[UnitType, int]] = defaultdict(int)

        main_layout = QVBoxLayout()

        scroll_content = QWidget()
        task_box_layout = QGridLayout()

        unit_types = set(
            self.game_model.game.faction_for(player=True).ground_units)
        sorted_units = sorted(
            {u
             for u in unit_types if self.cp.base.total_units_of_type(u)},
            key=lambda u: u.name,
        )
        for row, unit_type in enumerate(sorted_units):
            self.add_unit_row(unit_type, task_box_layout, row)
        stretch = QVBoxLayout()
        stretch.addStretch()
        task_box_layout.addLayout(stretch, task_box_layout.count(), 0)

        scroll_content.setLayout(task_box_layout)
        scroll = QScrollArea()
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        scroll.setWidgetResizable(True)
        scroll.setWidget(scroll_content)
        main_layout.addWidget(scroll)
        self.setLayout(main_layout)
예제 #17
0
    def __init__(self, debriefing: Debriefing):
        super(QDebriefingWindow, self).__init__()
        self.debriefing = debriefing

        self.setModal(True)
        self.setWindowTitle("Debriefing")
        self.setMinimumSize(300, 200)
        self.setWindowIcon(QIcon("./resources/icon.png"))

        layout = QVBoxLayout()
        self.setLayout(layout)

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

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

        player_lost_units = QGroupBox(
            f"{self.debriefing.player_country}'s lost units:")
        player_lost_units.setLayout(LossGrid(debriefing, player=True))
        layout.addWidget(player_lost_units)

        enemy_lost_units = QGroupBox(
            f"{self.debriefing.enemy_country}'s lost units:")
        enemy_lost_units.setLayout(LossGrid(debriefing, player=False))
        layout.addWidget(enemy_lost_units)

        okay = QPushButton("Okay")
        okay.clicked.connect(self.close)
        layout.addWidget(okay)
    def __init__(self, cp: ControlPoint, game_model: GameModel):
        super().__init__(self)
        self.cp = cp
        self.game_model = game_model

        self.bought_amount_labels = {}
        self.existing_units_labels = {}

        main_layout = QVBoxLayout()
        self.setLayout(main_layout)

        scroll_content = QWidget()
        task_box_layout = QGridLayout()
        scroll_content.setLayout(task_box_layout)

        units_column = sorted(cp.base.armor, key=lambda u: u.name)

        count = 0
        for count, unit_type in enumerate(units_column):
            self.add_purchase_row(unit_type, task_box_layout, count)
        stretch = QVBoxLayout()
        stretch.addStretch()
        task_box_layout.addLayout(stretch, count, 0)

        scroll_content.setLayout(task_box_layout)
        scroll = QScrollArea()
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        scroll.setWidgetResizable(True)
        scroll.setWidget(scroll_content)
        main_layout.addWidget(scroll)
예제 #19
0
    def _init_widgets(self):
        if self._state.am_none():
            return

        layout = QVBoxLayout()
        area = QScrollArea()
        area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
        area.setWidgetResizable(True)

        table = QTableWidget(0, 0)
        table.setColumnCount(len(self.COLUMNS))
        table.setHorizontalHeaderLabels(self.COLUMNS)

        self.table = table
        layout.addWidget(table)

        # common ones
        layout.setSpacing(0)
        layout.addStretch(0)
        layout.setContentsMargins(2, 2, 2, 2)

        # the container
        container = QFrame()
        container.setAutoFillBackground(True)
        palette = container.palette()
        palette.setColor(container.backgroundRole(), Qt.white)
        container.setPalette(palette)
        container.setLayout(layout)

        area.setWidget(container)

        base_layout = QVBoxLayout()
        base_layout.addWidget(area)
        self.setLayout(base_layout)
예제 #20
0
    def create_layout_right(self):
        right_layout = QVBoxLayout()

        if config.PLUGIN_PHYSIO_ACTIVE:
            physio_label = QLabel("Psycho-Physiological Data")
            physio_label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
            right_layout.addWidget(physio_label)

            physio_label_layout = QHBoxLayout()
            physio_plot_layout = QHBoxLayout()

            self.physioHeartRate.create_view(physio_label_layout, physio_plot_layout, self.experiment_data['participant'])
            self.physioRespiration.create_view(physio_label_layout, physio_plot_layout, self.experiment_data['participant'])
            self.physioPupilDilation.create_view(physio_label_layout, physio_plot_layout, self.experiment_data['participant'])

            right_layout.addLayout(physio_label_layout)
            right_layout.addLayout(physio_plot_layout)

        if config.PLUGIN_FMRI_ACTIVE:
            self.fMRIRoiView.create_view(right_layout, self.experiment_data)
            self.fMRIFullView.create_view(right_layout, self.experiment_data)

        right_layout.addStretch(1)

        return right_layout
예제 #21
0
class PreferencesDocumentsPage(QWidget):

    preferencesChanged = Signal()

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

        # Title
        title = QLabel(
            self.tr("<strong style=\"font-size:large;\">{0}</strong>").format(
                self.title()))

        #
        # Content

        # Main layout
        self._layout = QVBoxLayout(self)
        self._layout.addWidget(title)
        self._layout.addStretch(1)

    def setZeroMargins(self):

        self._layout.setContentsMargins(0, 0, 0, 0)

    def title(self):

        return self.tr("Documents")

    def _onPreferencesChanged(self):

        self.preferencesChanged.emit()
예제 #22
0
    def create_layout_left(self):
        left_layout = QVBoxLayout()
        self.participant_label = QLabel("Participant: " + self.experiment_data['participant'])
        self.participant_label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
        self.participant_label.setTextInteractionFlags(Qt.TextBrowserInteraction)

        left_layout.addWidget(self.participant_label)
        left_stimuli_layout = QHBoxLayout()
        stimuli_label = QLabel("Stimuli: ")
        stimuli_label.setFont(QtGui.QFont("Times", 16, QtGui.QFont.Bold))
        left_stimuli_layout.addWidget(stimuli_label)

        self.stimuli_selection_box = QComboBox()
        self.stimuli_selection_box.setFont(QtGui.QFont("Times", 14, QtGui.QFont.Normal))
        for condition in self.experiment_data['conditions']:
            self.stimuli_selection_box.addItem(condition)

        self.stimuli_selection_box.currentIndexChanged[int].connect(self.stimuli_changed)
        left_stimuli_layout.addWidget(self.stimuli_selection_box)
        left_stimuli_layout.addStretch()
        left_layout.addLayout(left_stimuli_layout)
        left_layout.addStretch()

        if config.PLUGIN_EYETRACKING_ACTIVE:
            self.eyetrackingView.create_view(left_layout)
            left_layout.addStretch()

        if config.PLUGIN_BEHAVORIAL_ACTIVE:
            self.behavioralView.create_view(left_layout)

        return left_layout
예제 #23
0
    def __init__(self):
        super().__init__()
        self.setWindowTitle('YOLOv5 Object Detection')
        self.setMinimumSize(1200, 800)

        GLOBAL.init_config()

        self.camera = WidgetCamera()  # 摄像头
        self.config = WidgetConfig()  # Yolo配置界面

        self.btn_camera = QPushButton('开启/关闭摄像头')  # 开启或关闭摄像头
        self.btn_camera.setFixedHeight(60)
        vbox1 = QVBoxLayout()
        vbox1.addWidget(self.config)
        vbox1.addStretch()
        vbox1.addWidget(self.btn_camera)

        self.btn_camera.clicked.connect(self.oc_camera)

        hbox = QHBoxLayout()
        hbox.addWidget(self.camera, 3)
        hbox.addLayout(vbox1, 1)

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)

        self.central_widget = QWidget()
        self.central_widget.setLayout(vbox)

        self.setCentralWidget(self.central_widget)
        self.show()
예제 #24
0
    def __init__(self, parent=None):
        super().__init__(parent)
        label = QLabel("Find &what:")
        self.lineEdit = QLineEdit()
        label.setBuddy(self.lineEdit)

        self.caseCheckBox = QCheckBox("Match &case")
        self.backwardCheckBox = QCheckBox("Search &backward")
        self.findButton = QPushButton("&Find")
        self.findButton.setDefault(True)
        self.findButton.setEnabled(False)
        closeButton = QPushButton("Close")

        self.lineEdit.textChanged.connect(self.enableFindButton)
        self.findButton.clicked.connect(self.findClicked)
        closeButton.clicked.connect(self.close)

        topLeftLayout = QHBoxLayout()
        topLeftLayout.addWidget(label)
        topLeftLayout.addWidget(self.lineEdit)
        leftLayout = QVBoxLayout()
        leftLayout.addLayout(topLeftLayout)
        leftLayout.addWidget(self.caseCheckBox)
        leftLayout.addWidget(self.backwardCheckBox)
        rightLayout = QVBoxLayout()
        rightLayout.addWidget(self.findButton)
        rightLayout.addWidget(closeButton)
        rightLayout.addStretch()
        mainLayout = QHBoxLayout()
        mainLayout.addLayout(leftLayout)
        mainLayout.addLayout(rightLayout)
        self.setLayout(mainLayout)

        self.setWindowTitle("Find")
        self.setFixedHeight(self.sizeHint().height())
예제 #25
0
    def init_ui(self):
        layout = QVBoxLayout()

        type_layout = QHBoxLayout()
        type_layout.addWidget(QLabel("Type of Aircraft : "))
        type_layout.addStretch()
        type_layout.addWidget(self.select_type_aircraft, alignment=Qt.AlignRight)

        count_layout = QHBoxLayout()
        count_layout.addWidget(QLabel("Count : "))
        count_layout.addStretch()
        count_layout.addWidget(self.select_count_of_aircraft, alignment=Qt.AlignRight)

        flight_type_layout = QHBoxLayout()
        flight_type_layout.addWidget(QLabel("Task : "))
        flight_type_layout.addStretch()
        flight_type_layout.addWidget(self.select_flight_type, alignment=Qt.AlignRight)

        layout.addLayout(type_layout)
        layout.addLayout(count_layout)
        layout.addLayout(flight_type_layout)
        layout.addStretch()
        layout.addWidget(self.add_button, alignment=Qt.AlignRight)

        self.setLayout(layout)
예제 #26
0
    def _init_cfg_options_tab(self, tab):
        resolve_indirect_jumps = QCheckBox(self)
        resolve_indirect_jumps.setText('Resolve indirect jumps')
        resolve_indirect_jumps.setChecked(True)
        self.option_widgets['resolve_indirect_jumps'] = resolve_indirect_jumps

        collect_data_refs = QCheckBox(self)
        collect_data_refs.setText(
            'Collect data references (one per data item) and guess data types')
        collect_data_refs.setChecked(True)
        self.option_widgets['data_references'] = collect_data_refs

        xrefs = QCheckBox(self)
        xrefs.setText('Collect cross references')
        xrefs.setChecked(True)
        self.option_widgets['cross_references'] = xrefs

        layout = QVBoxLayout()
        layout.addWidget(resolve_indirect_jumps)
        layout.addWidget(collect_data_refs)
        layout.addWidget(xrefs)
        layout.addStretch(0)
        frame = QFrame(self)
        frame.setLayout(layout)
        tab.addTab(frame, 'CFG Options')
예제 #27
0
    def initUI(self):

        OVER_CAPACITY = 750

        sld = QSlider(Qt.Horizontal, self)
        sld.setFocusPolicy(Qt.NoFocus)
        sld.setRange(1, OVER_CAPACITY)
        sld.setValue(75)
        sld.setGeometry(30, 40, 150, 30)        # 绝对布局与布局盒子相互独立
        sld.valueChanged[int].connect(self.changeValue)

        self.wid = BurningWidget()

        self.c = Communicate()
        self.c.updateBW[int].connect(self.wid.setValue)

        hbox = QHBoxLayout()
        hbox.addWidget(self.wid)
        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addLayout(hbox)
        
        self.setLayout(vbox)
        self.setGeometry(300, 300, 600, 400)
        self.setWindowTitle("Burning widget")
        self.show()
    def init_ui(self):
        main_layout = QVBoxLayout()

        units = {
            CAP: db.find_unittype(CAP, self.game.player_name),
            CAS: db.find_unittype(CAS, self.game.player_name),
        }

        scroll_content = QWidget()
        task_box_layout = QGridLayout()
        row = 0

        for task_type in units.keys():
            units_column = list(set(units[task_type]))
            if len(units_column) == 0: continue
            units_column.sort(key=lambda x: db.PRICES[x])
            for unit_type in units_column:
                if self.cp.is_carrier and not unit_type in db.CARRIER_CAPABLE:
                    continue
                if self.cp.is_lha and not unit_type in db.LHA_CAPABLE:
                    continue
                row = self.add_purchase_row(unit_type, task_box_layout, row)
            stretch = QVBoxLayout()
            stretch.addStretch()
            task_box_layout.addLayout(stretch, row, 0)

        scroll_content.setLayout(task_box_layout)
        scroll = QScrollArea()
        scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        scroll.setWidgetResizable(True)
        scroll.setWidget(scroll_content)
        main_layout.addWidget(scroll)
        self.setLayout(main_layout)
예제 #29
0
    def _init_load_options_tab(self, tab):

        # load debug symbols
        load_debug_info = QCheckBox()
        load_debug_info.setText("Load debug information if available")
        load_debug_info.setChecked(True)
        self.option_widgets['load_debug_info'] = load_debug_info

        # auto load libs

        auto_load_libs = QCheckBox()
        auto_load_libs.setText("Automatically load all libraries")
        auto_load_libs.setChecked(False)
        self.option_widgets['auto_load_libs'] = auto_load_libs

        # dependencies list

        dep_group = QGroupBox("Dependencies")
        dep_list = QListWidget()
        self.option_widgets['dep_list'] = dep_list

        sublayout = QVBoxLayout()
        sublayout.addWidget(dep_list)
        dep_group.setLayout(sublayout)

        layout = QVBoxLayout()
        layout.addWidget(load_debug_info)
        layout.addWidget(auto_load_libs)
        layout.addWidget(dep_group)
        layout.addStretch(0)

        frame = QFrame(self)
        frame.setLayout(layout)
        tab.addTab(frame, "Loading Options")
예제 #30
0
파일: rswidget.py 프로젝트: sung3r/ret-sync
    def __init__(self, parent, name, data):
        QWidget.__init__(self, parent)
        DockContextHandler.__init__(self, self, name)
        self.actionHandler = UIActionHandler()
        self.actionHandler.setupActionHandler(self)

        status_layout = QHBoxLayout()
        status_layout.addWidget(QLabel('Status: '))
        self.status = QLabel('idle')
        status_layout.addWidget(self.status)
        status_layout.setAlignment(QtCore.Qt.AlignCenter)

        client_dbg_layout = QHBoxLayout()
        client_dbg_layout.addWidget(QLabel('Client debugger: '))
        self.client_dbg = QLabel('n/a')
        client_dbg_layout.addWidget(self.client_dbg)
        client_dbg_layout.setAlignment(QtCore.Qt.AlignCenter)

        client_pgm_layout = QHBoxLayout()
        client_pgm_layout.addWidget(QLabel('Client program: '))
        self.client_pgm = QLabel('n/a')
        client_pgm_layout.addWidget(self.client_pgm)
        client_pgm_layout.setAlignment(QtCore.Qt.AlignCenter)

        layout = QVBoxLayout()
        layout.addStretch()
        layout.addLayout(status_layout)
        layout.addLayout(client_dbg_layout)
        layout.addLayout(client_pgm_layout)
        layout.addStretch()
        self.setLayout(layout)