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")
Esempio n. 2
0
    def __init__(self, flight: Flight, game: Game, planner, selected_tab):
        super(QFlightPlanner, self).__init__()

        print(selected_tab)

        self.tabCount = 0
        if flight:
            self.general_settings_tab = QGeneralFlightSettingsTab(
                flight, game, planner)
            self.general_settings_tab.on_flight_settings_changed.connect(
                lambda: self.on_planned_flight_changed.emit())
            self.payload_tab = QFlightPayloadTab(flight, game)
            self.waypoint_tab = QFlightWaypointTab(game, flight)
            self.waypoint_tab.on_flight_changed.connect(
                lambda: self.on_planned_flight_changed.emit())
            self.addTab(self.general_settings_tab, "General Flight settings")
            self.addTab(self.payload_tab, "Payload")
            self.addTab(self.waypoint_tab, "Waypoints")
            self.tabCount = 3
            self.setCurrentIndex(selected_tab)
        else:
            tabError = QFrame()
            l = QGridLayout()
            l.addWidget(QLabel("No flight selected"))
            tabError.setLayout(l)
            self.addTab(tabError, "No flight")
            self.tabCount = 1
Esempio n. 3
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)
Esempio n. 4
0
    def get_frame(
        self,
        value: Union[
            Component,
            ComponentInfo,
            Transformation,
            LinkTransformation,
            TransformationsList,
        ],
    ):
        frame = QFrame()
        frame.setAutoFillBackground(True)
        SizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        SizePolicy.setHorizontalStretch(0)
        SizePolicy.setVerticalStretch(0)
        frame.setSizePolicy(SizePolicy)
        frame.setLayout(QVBoxLayout())
        frame.layout().setContentsMargins(0, 0, 0, 0)

        if isinstance(value, Component):
            get_component_frame(frame, value)
        elif isinstance(value, TransformationsList):
            get_transformations_list_frame(frame)
        elif isinstance(value, ComponentInfo):
            get_component_info_frame(frame)
        elif isinstance(value, Transformation):
            get_transformation_frame(frame, self.instrument, value)
        elif isinstance(value, LinkTransformation):
            get_link_transformation_frame(frame, self.instrument, value)
        return frame
Esempio n. 5
0
class Current:
    def __init__(self):
        self.layout = QGridLayout()
        self.wrapper = QFrame()
        self.wrapper.setLayout(self.layout)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.time = QLabel()
        self.icon = QSvgWidget()
        self.temp = QLabel()
        self.precip = QLabel()
        self.wind = QLabel()

        self.layout.addWidget(self.time, 0, 0, 1, 2)
        self.layout.addWidget(self.icon, 1, 0, 3, 1)
        self.layout.addWidget(self.temp, 1, 1, 1, 1)
        self.layout.addWidget(self.wind, 2, 1, 1, 1)
        self.layout.addWidget(self.precip, 3, 1, 1, 1)

    def update(self, values):
        self.icon.load(values.icon)
        self.time.setText(values.time)
        self.temp.setText(values.temp)
        self.wind.setText(values.wind)
        self.precip.setText(values.precip)
    def __init__(self, cp: ControlPoint, game_model: GameModel):
        super(QBaseMenuTabs, self).__init__()
        self.cp = cp
        if cp:

            if not cp.captured:
                if not cp.is_carrier:
                    self.base_defenses_hq = QBaseDefensesHQ(cp, game_model.game)
                    self.addTab(self.base_defenses_hq, "Base Defenses")
                self.intel = QIntelInfo(cp, game_model.game)
                self.addTab(self.intel, "Intel")
            else:
                if cp.has_runway():
                    self.airfield_command = QAirfieldCommand(cp, game_model)
                    self.addTab(self.airfield_command, "Airfield Command")

                if not cp.is_carrier:
                    self.ground_forces_hq = QGroundForcesHQ(cp, game_model)
                    self.addTab(self.ground_forces_hq, "Ground Forces HQ")
                    self.base_defenses_hq = QBaseDefensesHQ(cp, game_model.game)
                    self.addTab(self.base_defenses_hq, "Base Defenses")
                else:
                    self.base_defenses_hq = QBaseDefensesHQ(cp, game_model.game)
                    self.addTab(self.base_defenses_hq, "Fleet")

        else:
            tabError = QFrame()
            l = QGridLayout()
            l.addWidget(QLabel("No Control Point"))
            tabError.setLayout(l)
            self.addTab(tabError, "No Control Point")
Esempio n. 7
0
    def _create_status_lights(self, layout):
        # Create a frame to hold the register's bits
        status_frame = QFrame(self)
        layout.addWidget(status_frame)
        layout.setAlignment(status_frame, Qt.AlignBottom)
        status_layout = QGridLayout(status_frame)
        status_layout.setSpacing(0)
        status_layout.setMargin(0)
        status_frame.setLayout(status_layout)
        status_frame.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)

        # Add indicators for each status in the register, from MSB to LSB
        for col, stat in enumerate(STATUS_INDS.keys()):
            check = QCheckBox(status_frame)
            check.setFixedSize(30, 20)
            check.setStyleSheet(
                'QCheckBox::indicator{subcontrol-position:center;}')
            check.stateChanged.connect(lambda state: self._update_status())
            status_layout.addWidget(check, 0, col)
            status_layout.setAlignment(check, Qt.AlignCenter)
            self._status_cmp_switches[stat] = check

            check = QCheckBox(status_frame)
            check.setFixedSize(30, 20)
            check.setStyleSheet(
                'QCheckBox::indicator{subcontrol-position:center;}')
            check.stateChanged.connect(lambda state: self._update_status())
            status_layout.addWidget(check, 1, col)
            status_layout.setAlignment(check, Qt.AlignCenter)
            self._status_ign_switches[stat] = check
Esempio n. 8
0
    def add_tag_to_bar(self, text):
        tag = QFrame()
        tag.setStyleSheet(
            'border:1px solid rgb(192, 192, 192); border-radius: 4px;')
        tag.setContentsMargins(2, 2, 2, 2)
        tag.setFixedHeight(28)

        hbox = QHBoxLayout()
        hbox.setContentsMargins(4, 4, 4, 4)
        hbox.setSpacing(10)

        tag.setLayout(hbox)

        label = QLabel(text)
        label.setStyleSheet('border:0px')
        label.setFixedHeight(16)
        hbox.addWidget(label)

        x_button = QPushButton('x')
        x_button.setFixedSize(20, 20)
        x_button.setStyleSheet('border:0px; font-weight:bold')
        x_button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        x_button.clicked.connect(partial(self.delete_tag, text))
        hbox.addWidget(x_button)

        tag.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)

        self.hLayout.addWidget(tag)
Esempio n. 9
0
class Forecast:
    def __init__(self):
        self.layout = QGridLayout()
        self.wrapper = QFrame()
        self.wrapper.setLayout(self.layout)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.icon = QSvgWidget()
        self.day = QLabel()
        self.min_temp = QLabel()
        self.max_temp = QLabel()
        self.precip = QLabel()
        self.wind = QLabel()

        self.layout.addWidget(self.icon, 0, 0, 1, 1)
        self.layout.addWidget(self.day, 1, 0, 1, 1)
        self.layout.addWidget(self.min_temp, 1, 1, 1, 1)
        self.layout.addWidget(self.max_temp, 0, 1, 1, 1)
        self.layout.addWidget(self.wind, 0, 2, 1, 1)
        self.layout.addWidget(self.precip, 1, 2, 1, 1)

    def update(self, values):
        self.icon.load(values.icon)
        self.day.setText(values.day)
        self.min_temp.setText(values.min_temp)
        self.max_temp.setText(values.max_temp)
        self.precip.setText(values.precip)
        self.wind.setText(values.wind)
Esempio n. 10
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')
Esempio n. 11
0
    def create_widget(self, parent=None):
        main_group_box = QGroupBox()
        main_layout = QHBoxLayout()

        top = QFrame()
        top_layout = QGridLayout()
        top_layout.setColumnStretch(0, 2)
        top_layout.setColumnStretch(1, 1)

        top_layout.addWidget(self.tips_label, 0, 0)
        top_layout.addWidget(self.path_label, 1, 0)

        self.button_folder_selection = QPushButton('Select directory')
        self.button_folder_selection.clicked.connect(
            lambda: self.on_dir_selection())
        top_layout.addWidget(self.button_folder_selection, 1, 1)

        top.setLayout(top_layout)
        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(top)

        gestures_group_box = self.create_gestures_group_box()
        splitter.addWidget(gestures_group_box)

        splitter.setSizes([50, 200])
        main_layout.addWidget(splitter)
        main_group_box.setLayout(main_layout)

        return main_group_box
Esempio n. 12
0
    def get_frame(
        self,
        value: Union[
            Component,
            ComponentInfo,
            Transformation,
            LinkTransformation,
            TransformationsList,
            FileWriterModule,
        ],
    ):
        frame = QFrame()
        frame.setAutoFillBackground(True)
        SizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        SizePolicy.setHorizontalStretch(0)
        SizePolicy.setVerticalStretch(0)
        frame.setSizePolicy(SizePolicy)
        frame.setLayout(QVBoxLayout())
        frame.layout().setContentsMargins(0, 0, 0, 0)

        if isinstance(value, Group):
            get_group_frame(frame, value)
        elif isinstance(value, TransformationsList):
            get_transformations_list_frame(frame)
        elif isinstance(value, ComponentInfo):
            get_group_info_frame(frame, value)
        elif isinstance(value, Transformation):
            get_transformation_frame(frame, self.model, value)
        elif isinstance(value, LinkTransformation):
            get_link_transformation_frame(frame, self.model, value)
        elif isinstance(value, FileWriterModule):
            get_module_frame(frame, self.model, value, self._use_simple_tree_view)
        return frame
Esempio n. 13
0
class FrameLayout(QFrame):
    """
    This class defines the FrameLayout which emulates the behaviour of the Maya Python API's maya.cmds.frameLayout function. 
     The only difference is that the render setup version also provides a color bar and background color to differentiate layers, 
     collections, and overrides.
    """
    def __init__(self, item, parent):
        super(FrameLayout, self).__init__(parent)
        self.item = weakref.ref(item)
        self.isCollapsed = False
        self.mainLayout = None
        self.titleFrame = None
        self.contentFrame = None
        self.contentLayout = None

        self.initFrameLayout()

    def addWidget(self, widget):
        self.contentLayout.addWidget(widget)

    def getWidget(self, index):
        return self.contentLayout.itemAt(
            index).widget() if self.contentLayout.count() > index else None

    def initMainLayout(self):
        self.mainLayout = QVBoxLayout()
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)
        self.setLayout(self.mainLayout)

    def initTitleFrame(self):
        self.titleFrame = TitleFrame(self.item(), self)
        self.mainLayout.addWidget(self.titleFrame)

    def initContentFrame(self):
        self.contentFrame = QFrame()
        self.contentFrame.setContentsMargins(0, 0, 0, 0)

        self.contentLayout = QVBoxLayout()
        self.contentLayout.setContentsMargins(0, 0, 0, 0)
        self.contentLayout.setSpacing(0)
        self.contentFrame.setLayout(self.contentLayout)
        self.mainLayout.addWidget(self.contentFrame)

    def toggleCollapsed(self):
        """ When the title frame is clicked, this function is called to toggle the collapsed state """
        self.isCollapsed = not self.isCollapsed
        self.contentFrame.setVisible(self.isCollapsed)
        self.titleFrame.arrowAndTitle.setArrow(self.isCollapsed)
        self.update()

    def initFrameLayout(self):
        self.setContentsMargins(0, 0, 0, 0)

        self.initMainLayout()
        self.initTitleFrame()
        self.initContentFrame()

        self.titleFrame.clicked.connect(self.toggleCollapsed)
def test_GIVEN_translation_WHEN_getting_transformation_frame_THEN_frame_type_is_edit_translation(
    qtbot, ):
    frame = QFrame()
    frame.setLayout(QVBoxLayout())
    value = create_transformation(TransformationType.TRANSLATION)
    qtbot.addWidget(frame)
    get_transformation_frame(frame, None, value)
    assert isinstance(frame.transformation_frame, EditTranslation)
def test_GIVEN_invalid_transformation_type_WHEN_getting_transformation_frame_THEN_runtime_error_is_thrown(
    qtbot, ):
    frame = QFrame()
    frame.setLayout(QVBoxLayout())
    value = create_transformation("asdf")
    qtbot.addWidget(frame)
    with pytest.raises(RuntimeError):
        get_transformation_frame(frame, None, value)
    def _init_simgrs_tab(self, tab):
        # simgrs list

        simgrs_label = QLabel(self)
        simgrs_label.setText('Simulation Manager')

        simgrs_list = QComboBox(self)
        self._simgrs_list = simgrs_list
        simgrs_list.currentIndexChanged.connect(self._on_simgr_selection)

        pg_layout = QHBoxLayout()
        pg_layout.addWidget(simgrs_label)
        pg_layout.addWidget(simgrs_list)

        # simulation manager information
        viewer = QSimulationManagerViewer(self.simgr)
        self._simgr_viewer = viewer
        viewer.currentItemChanged.connect(self._on_state_selection)

        #
        # Buttons
        #

        # step button
        step_button = QPushButton()
        step_button.setText('Step actives')
        step_button.released.connect(self._on_step_clicked)

        # step until branch
        step_until_branch_button = QPushButton('Step actives until branch')
        step_until_branch_button.released.connect(
            self._on_step_until_branch_clicked)

        # explore button
        explore_button = QPushButton('Explore')
        explore_button.released.connect(self._on_explore_clicked)

        # buttons layout
        buttons_layout = QVBoxLayout()
        layout = QHBoxLayout()
        layout.addWidget(explore_button)
        buttons_layout.addLayout(layout)

        layout = QHBoxLayout()
        layout.addWidget(step_button)
        layout.addWidget(step_until_branch_button)
        buttons_layout.addLayout(layout)

        simgrs_layout = QVBoxLayout()
        simgrs_layout.addLayout(pg_layout)
        simgrs_layout.addWidget(viewer)
        simgrs_layout.addLayout(buttons_layout)

        frame = QFrame()
        frame.setLayout(simgrs_layout)

        tab.addTab(frame, 'General')
Esempio n. 17
0
class ThumbsWidget(QScrollArea):
    """Widget displaying scan thumbnails in a column."""
    def __init__(self, app):
        QScrollArea.__init__(self)
        self.app = app

        self.wrapper = QFrame()
        self.wrapper.setLayout(QVBoxLayout())
        self.wrapper.layout().setContentsMargins(5, 0, 0, 5)
        self.wrapper.layout().addStretch()

        self.thumbs = []

        self.setSizePolicy(QSizePolicy.Policy.Fixed,
                           QSizePolicy.Policy.MinimumExpanding)

        # Hide horizontal scollbar
        self.horizontalScrollBar().setStyleSheet("QScrollBar { height: 0 }")

        self.setWidgetResizable(True)
        self.setWidget(self.wrapper)

    def add_thumb(self, pixmap):
        """Add the thumbnail in *pixmap* to the widget."""
        pixmap = pixmap.scaledToWidth(int(settings["ui"]["thumb_size"]))

        thumb = QLabel()
        thumb.setPixmap(pixmap)
        thumb.mousePressEvent = partial(self._thumb_clicked, len(self.thumbs))
        thumb.setProperty("role", "scan_thumb")
        thumb.setMaximumWidth(int(settings["ui"]["thumb_size"]) + 2)

        self.thumbs.append(thumb)
        self.wrapper.layout().insertWidget(self.wrapper.layout().count() - 1,
                                           thumb)

        self.updateGeometry()

    def clear(self):
        """Remove all thumbnails."""
        for thumb in self.thumbs:
            thumb.deleteLater()
        self.thumbs = []

    def _thumb_clicked(self, thumb, event):  # pylint: disable=W0613
        """Trigger *app.select_scan* when a thumbnail is clicked."""
        self.app.select_scan(thumb)

    def minimumSizeHint(self):  # pylint: disable=C0103
        """Return widget size; width should be *thumb_size + scrollbar_width*
        or 0 if there are no thumbnails."""
        if self.thumbs:
            return QSize(int(settings["ui"]["thumb_size"]) + 25, 0)

        return QSize(0, 0)
    def _init_widgets(self):
        if self._state.am_none():
            return

        if self._state.arch.name not in self.ARCH_REGISTERS:
            l.error(
                "Architecture %s is not listed in QRegisterViewer.ARCH_REGISTERS.",
                self._state.arch.name)
            return

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

        regs = self.ARCH_REGISTERS[self._state.arch.name]

        # common ones
        common_regs = regs['common']

        for reg_name in common_regs:
            sublayout = QHBoxLayout()

            lbl_reg_name = QLabel(self)
            lbl_reg_name.setProperty('class', 'reg_viewer_label')
            lbl_reg_name.setText(reg_name)
            lbl_reg_name.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
            sublayout.addWidget(lbl_reg_name)

            sublayout.addSpacing(10)
            reg_value = QASTViewer(None, parent=self, workspace=self.workspace)
            self._registers[reg_name] = reg_value
            sublayout.addWidget(reg_value)

            layout.addLayout(sublayout)

        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)
    def _init_avoids_tab(self, tab):
        avoids_list = QListWidget()
        self._avoids_list = avoids_list

        layout = QVBoxLayout()
        layout.addWidget(avoids_list)

        frame = QFrame()
        frame.setLayout(layout)

        tab.addTab(frame, 'Avoids')
Esempio n. 20
0
    def _reset_ui(self):
        """Remove all metadata rows and reset the layout."""
        table = QFrame()
        table.setLayout(QFormLayout())
        self.table = table.layout()

        self.setWidgetResizable(True)
        self.setWidget(table)

        self.setSizePolicy(QSizePolicy.Policy.Fixed,
                           QSizePolicy.Policy.MinimumExpanding)

        self.updateGeometry()
    def _init_finds_tab(self, tab):
        finds_list = QListWidget()
        self._finds_list = finds_list

        layout = QVBoxLayout()
        layout.addWidget(finds_list)

        frame = QFrame()
        frame.setLayout(layout)

        tab.addTab(frame, 'Finds')

        self._finds_list.itemChanged.connect(self._on_explore_addr_changed)
    def _init_settings_tab(self, tab):
        oneactive_checkbox = QCheckBox("Keep at most one active path")
        oneactive_checkbox.setChecked(False)
        self._oneactive_checkbox = oneactive_checkbox

        settings_layout = QVBoxLayout()
        settings_layout.addWidget(oneactive_checkbox)
        settings_layout.addStretch(0)

        frame = QFrame()
        frame.setLayout(settings_layout)

        tab.addTab(frame, 'Settings')
Esempio n. 23
0
    def make_ui(self):
        hbox = QHBoxLayout()

        value_table = QTableView()
        self.widgets['value_table'] = value_table

        value_table.setModel(self.model)

        hbox.addWidget(value_table)

        main_widget = QFrame()
        main_widget.setLayout(hbox)

        return main_widget
Esempio n. 24
0
class MainWindow(QMainWindow):
    def __init__(self, args, parent=None):
        super().__init__(parent=parent)
        self.resize(int(width_factor * 1100), int(height_factor * 635))
        self.setWindowTitle("MKV Muxing Batch GUI v" + str(Version))
        self.setWindowIcon(GlobalFiles.AppIcon)
        self.tabs = TabsManager()
        self.tabs_frame = QFrame()
        self.tabs_layout = QVBoxLayout()
        self.setup_tabs_layout()
        self.setCentralWidget(self.tabs_frame)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.show_window()
        self.tabs.set_default_directories()
        self.task_bar_progress = TaskBarProgress(
            window_handle=self.windowHandle())
        self.connect_signals()

    def connect_signals(self):
        self.tabs.currentChanged.connect(self.update_minimum_size)
        self.tabs.task_bar_start_muxing_signal.connect(
            self.task_bar_progress.start_muxing)
        self.tabs.update_task_bar_progress_signal.connect(
            self.task_bar_progress.update_progress)
        self.tabs.update_task_bar_paused_signal.connect(
            self.task_bar_progress.pause_progress)
        self.tabs.update_task_bar_clear_signal.connect(
            self.task_bar_progress.hide_progress)

    def show_window(self):
        self.showNormal()
        self.raise_()
        self.activateWindow()

    def setup_tabs_layout(self):
        self.tabs_frame.setContentsMargins(0, 0, 0, 0)
        self.tabs_layout.setContentsMargins(9, 9, 9, 12)
        self.tabs_layout.addWidget(self.tabs)
        self.tabs_frame.setLayout(self.tabs_layout)

    def update_minimum_size(self):
        self.setMinimumSize(self.minimumSizeHint())

    def closeEvent(self, event: PySide2.QtGui.QCloseEvent):
        want_to_exit = check_if_exit_when_muxing_on()
        if want_to_exit:
            super().closeEvent(event)
        else:
            event.ignore()
Esempio n. 25
0
    def __init__(self, alignment_info: AlignmentInfo):
        """
        Constructor
        :param alignment_info: The AlignmentInfo to Display
        """
        QFrame.__init__(self)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        title_label = QLabel(alignment_info.getName())
        title_label.setFont(QFont("SansSerif", 16))
        title_label.setAlignment(Qt.AlignCenter)
        title_label.setMinimumHeight(20)
        stacker = BarFrameStacker(alignment_info)
        scroll_thing = BarFrameStackerScrollArea(stacker)
        zoom_thing = ZoomButtons(scroll_thing.zoomIn, scroll_thing.zoomOut)
        scroll_button_thing = ScrollButtons(scroll_thing.scroll_start,
                                            scroll_thing.scroll_backward,
                                            scroll_thing.scroll_forward,
                                            scroll_thing.scroll_end)

        blank_space = QFrame()
        all_the_buttons = QFrame()

        button_layout = QHBoxLayout()
        button_layout.addWidget(zoom_thing, stretch=1)
        button_layout.addWidget(blank_space)
        button_layout.addWidget(scroll_button_thing, stretch=2)
        all_the_buttons.setLayout(button_layout)

        box_layout3 = QVBoxLayout()
        box_layout3.addWidget(title_label)
        box_layout3.addWidget(scroll_thing, stretch=1)
        box_layout3.addWidget(all_the_buttons, stretch=1)

        self.setLayout(box_layout3)

        # The below is a very bad way to appropriately size the bar graph on initialization
        # This zooms in until you can't zoom in anymore
        # TODO - Make a nicer way to do this
        prev_zoom_level = 0
        while scroll_thing.getCurrentZoomLevel() != prev_zoom_level:
            prev_zoom_level = scroll_thing.getCurrentZoomLevel()
            scroll_thing.zoomIn()
        # This zooms out until you can't zoom  out anymore
        # This will not zoom out more than it should
        prev_zoom_level = 0
        while scroll_thing.getCurrentZoomLevel() != prev_zoom_level:
            prev_zoom_level = scroll_thing.getCurrentZoomLevel()
            scroll_thing.zoomOut()
Esempio n. 26
0
    def __init__(self, parent=None):
        super(CloseDialog, self).__init__(parent)

        self.setLayout(QVBoxLayout())
        self.layout().addWidget(QLabel('Are you sure you want to quit?'))

        button_panel = QFrame()
        button_panel.setLayout(QHBoxLayout())

        yes_button = QPushButton('Yes')
        no_button = QPushButton('No')

        button_panel.layout().addWidget(yes_button)
        button_panel.layout().addWidget(no_button)
        self.layout().addWidget(button_panel)
Esempio n. 27
0
 def createBoard(self):
     wid = QFrame(self)
     gridlayout = QGridLayout()
     gridlayout.setSpacing(0)
     box_list = []
     for i in range(3):
         for j in range(3):
             box_list.append(self.createSBoard())
             #box_list[-1].setFixedSize(50,50)
             #label_list[-1].setAlignment(Qt.AlignCenter)
             #label_list[-1].setFrameStyle(QFrame.Box)
             #label_list[-1].setLineWidth(1)
             gridlayout.addWidget(box_list[-1], i, j)
     #self.setLayout(gridlayout)
     wid.setLayout(gridlayout)
     return wid
Esempio n. 28
0
    def make_ui(self):
        """Create and lay out UI elements."""

        filter = QSpinBox()
        filter.setRange(1, 6)
        self.widgets['filter'] = filter

        btn_start = QPushButton()
        btn_start.setText('Start')
        btn_start.clicked.connect(self.run)
        self.widgets['btn_start'] = btn_start

        side_panel = QGridLayout()
        side_panel.setColumnStretch(0, 0)
        side_panel.setColumnStretch(1, 1)
        side_panel.setColumnStretch(2, 1)
        side_panel.setRowStretch(6, 1)  # shove everything to the top

        side_panel.addWidget(QLabel('<h2>Controls</h2>'), 0, 0, 1, 2)
        side_panel.addWidget(QLabel('Filter:'), 1, 0)
        side_panel.addWidget(filter, 1, 1)
        side_panel.addWidget(btn_start, 2, 0, 1, 2)

        graph = FigureCanvas(Figure(tight_layout=True))
        graph_toolbar = NavigationToolBar(graph, None)
        graph_toolbar.setObjectName('GraphToolBar')
        self.widgets['graph'] = graph
        axis = graph.figure.subplots()
        axis.grid()
        axis.set_xlim(0, 100)
        axis.set_ylim(0, 10)

        self.widgets['axis'] = axis

        vbox = QVBoxLayout()
        vbox.addWidget(graph)
        vbox.addWidget(graph_toolbar)

        hbox = QHBoxLayout()
        hbox.addLayout(side_panel)
        hbox.addLayout(vbox, 1)

        main_widget = QFrame()
        main_widget.setLayout(hbox)

        return main_widget
    def _init_settings_tab(self, tab):
        oneactive_checkbox = QCheckBox("Keep at most one active path")
        oneactive_checkbox.setChecked(False)
        self._oneactive_checkbox = oneactive_checkbox

        addstrategy_button = QPushButton("Add Strategy...")
        addstrategy_button.released.connect(self._popup_add_strategy)

        settings_layout = QVBoxLayout()
        settings_layout.addWidget(oneactive_checkbox)
        settings_layout.addStretch(0)
        settings_layout.addWidget(addstrategy_button)

        frame = QFrame()
        frame.setLayout(settings_layout)

        tab.addTab(frame, 'Settings')
Esempio n. 30
0
    def _init_plugin_list(self):
        plugin_group = QGroupBox("Plugins")
        self._installed_plugin_list = QListWidget(self)

        sublayout = QVBoxLayout()
        sublayout.addWidget(self._installed_plugin_list)
        plugin_group.setLayout(sublayout)

        layout = QVBoxLayout()
        # layout.addWidget(auto_load_libs)
        layout.addWidget(plugin_group)
        layout.addStretch(0)

        frame = QFrame(self)
        frame.setLayout(layout)

        self.main_layout.addWidget(frame)