当前位置: 首页>>代码示例>>Python>>正文


Python QSplitter.setStretchFactor方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QSplitter.setStretchFactor方法的典型用法代码示例。如果您正苦于以下问题:Python QSplitter.setStretchFactor方法的具体用法?Python QSplitter.setStretchFactor怎么用?Python QSplitter.setStretchFactor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QSplitter的用法示例。


在下文中一共展示了QSplitter.setStretchFactor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
    def __init__(self):
        super().__init__()

        # information widget
        self.plotWidget = VariantPlotWidget()
        self.infoWidget = VariantInfoWidget()

        # splitter settings
        splitter = QSplitter(Qt.Horizontal)
        splitter.addWidget(self.plotWidget)
        splitter.addWidget(self.infoWidget)
        splitter.setStretchFactor(0, 3)
        splitter.setStretchFactor(1, 1)

        # layout
        layout = QBoxLayout(QBoxLayout.TopToBottom)
        layout.addWidget(splitter)
        self.setLayout(layout)

        # connect signals
        self.plotWidget.curvePlotted.connect(self.infoWidget.updateResults)
        self.plotWidget.plotReady.connect(self.infoWidget.showResults)
        self.plotWidget.cleared.connect(self.infoWidget.clear)
        self.infoWidget.legendChanged.connect(self.plotWidget.paintCalculation)

        # translate the graphical user interface
        self.retranslateUi()
开发者ID:tobiashelfenstein,项目名称:wuchshuellenrechner,代码行数:29,代码来源:widget_plot.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
    def __init__(self, parent=None):
        super().__init__(parent)

        self.editor = PythonEditor(self)
        self.resize(650, 500)

        fileMenu = QMenu(self.tr("&File"), self)
        fileMenu.addAction(self.tr("&New…"), self.newFile, QKeySequence.New)
        fileMenu.addAction(self.tr("&Open…"), self.openFile, QKeySequence.Open)
        fileMenu.addAction(self.tr("&Save"), self.saveFile, QKeySequence.Save)
        fileMenu.addAction(self.tr("Save &As…"), self.saveFileAs, QKeySequence.SaveAs)
        fileMenu.addSeparator()
        fileMenu.addAction(self.tr("&Run…"), self.runScript, "Ctrl+R")
        fileMenu.addSeparator()
        fileMenu.addAction(self.tr("&Close"), self.close, platformSpecific.closeKeySequence())
        self.menuBar().addMenu(fileMenu)

        self.fileChooser = FileChooser(self)
        self.fileChooser.fileOpened.connect(self.openFile)
        splitter = QSplitter(self)
        splitter.addWidget(self.fileChooser)
        splitter.addWidget(self.editor)
        splitter.setStretchFactor(0, 2)
        splitter.setStretchFactor(1, 5)
        splitter.setSizes([0, 1])
        self.setCentralWidget(splitter)
        self.newFile()
        self.editor.modificationChanged.connect(self.setWindowModified)
开发者ID:madig,项目名称:trufont,代码行数:30,代码来源:scriptingWindow.py

示例3: setup_layout

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
    def setup_layout(self):
        main_widget = QWidget()
        main_layout = QHBoxLayout()
        main_layout_splitter = QSplitter(Qt.Horizontal, self)
        main_widget.setLayout(main_layout)

        main_layout.addWidget(main_layout_splitter)

        main_layout_splitter.addWidget(self.selection_list)
        main_layout_splitter.addWidget(self.view_tabs)
        main_layout_splitter.setStretchFactor(0, 1)
        main_layout_splitter.setStretchFactor(1, 10)

        self.setCentralWidget(main_widget)
开发者ID:0xFAIL,项目名称:lantern,代码行数:16,代码来源:lantern_gui.py

示例4: setupViews

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
    def setupViews(self):
        splitter = QSplitter()
        table = QTableView()
        self.pieChart = PieView()
        splitter.addWidget(table)
        splitter.addWidget(self.pieChart)
        splitter.setStretchFactor(0, 0)
        splitter.setStretchFactor(1, 1)

        table.setModel(self.model)
        self.pieChart.setModel(self.model)

        self.selectionModel = QItemSelectionModel(self.model)
        table.setSelectionModel(self.selectionModel)
        self.pieChart.setSelectionModel(self.selectionModel)

        table.horizontalHeader().setStretchLastSection(True)

        self.setCentralWidget(splitter)
开发者ID:PWilsonUofC,项目名称:VGenes,代码行数:21,代码来源:chart.py

示例5: NetWorthView

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
class NetWorthView(AccountSheetView):
    def _setup(self):
        self._setupUi()
        self.sheet = self.nwsheet = NetWorthSheet(self.model.bsheet, view=self.treeView)
        self.graph = self.nwgraph = Chart(self.model.nwgraph, view=self.graphView)
        self.piechart = Chart(self.model.pie, view=self.pieChart)

    def _setupUi(self):
        self.resize(558, 447)
        self.mainLayout = QVBoxLayout(self)
        self.mainLayout.setSpacing(0)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.splitterView = QSplitter()
        self.splitterView.setChildrenCollapsible(False)
        self.splitterView.setOrientation(Qt.Vertical)
        self.subSplitterView = QSplitter()
        self.subSplitterView.setChildrenCollapsible(False)
        self.treeView = TreeView(self)
        self.treeView.setAcceptDrops(True)
        self.treeView.setFrameShape(QFrame.NoFrame)
        self.treeView.setFrameShadow(QFrame.Plain)
        self.treeView.setEditTriggers(QAbstractItemView.EditKeyPressed|QAbstractItemView.SelectedClicked)
        self.treeView.setDragEnabled(True)
        self.treeView.setDragDropMode(QAbstractItemView.InternalMove)
        self.treeView.setUniformRowHeights(True)
        self.treeView.setAllColumnsShowFocus(True)
        self.treeView.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.treeView.header().setStretchLastSection(False)
        self.subSplitterView.addWidget(self.treeView)
        self.pieChart = PieChartView(self)
        self.pieChart.setMinimumSize(300, 0)
        self.subSplitterView.addWidget(self.pieChart)
        self.splitterView.addWidget(self.subSplitterView)
        self.graphView = LineGraphView(self)
        self.graphView.setMinimumSize(0, 200)
        self.splitterView.addWidget(self.graphView)
        self.splitterView.setStretchFactor(0, 1)
        self.splitterView.setStretchFactor(1, 0)
        self.subSplitterView.setStretchFactor(0, 1)
        self.subSplitterView.setStretchFactor(1, 0)
        self.mainLayout.addWidget(self.splitterView)
开发者ID:brownnrl,项目名称:moneyguru,代码行数:43,代码来源:view.py

示例6: setupViews

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
    def setupViews(self):
        splitter = QSplitter()
        splitter.setHandleWidth(5)

        browsers = QTabWidget()

        label = QLabel('Placeholder')
        label.setAlignment(Qt.AlignCenter|Qt.AlignHCenter|Qt.AlignVCenter)

        layout = QHBoxLayout()
        layout.addWidget(label)

        rightPane = QWidget()
        rightPane.setLayout(layout)

        splitter.addWidget(browsers)
        splitter.addWidget(rightPane)
        splitter.setStretchFactor(0, 1)
        splitter.setStretchFactor(1, 1)

        self.setCentralWidget(splitter)
开发者ID:Dukeboys,项目名称:mbplayer,代码行数:23,代码来源:player.py

示例7: setupViews

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
    def setupViews(self):
        splitter = QSplitter()
        self.table = QTableView()
        self.pieChart = PieView()


        splitter.addWidget(self.pieChart)
        splitter.addWidget(self.table)
        splitter.setStretchFactor(0, 0)
        splitter.setStretchFactor(1, 0)

        self.table.setModel(self.model)
        self.pieChart.setModel(self.model2)

        self.selectionModel = QItemSelectionModel(self.model2)
        self.table.setSelectionModel(self.selectionModel)

        #self.pieChart.setSelectionModel(self.selectionModel)

        #table.setColumnWidth(0,100)
        self.setCentralWidget(splitter)
        self.table.doubleClicked.connect(self.ClickAction_table)
开发者ID:louisraccoon,项目名称:PyStudy,代码行数:24,代码来源:StudyPlan.py

示例8: __init__

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
    def __init__(self, parent=None):
        super().__init__(parent)

        self.editor = PythonEditor(self)
        self.fileChooser = FileChooser(self)
        self.fileChooser.fileOpened.connect(self.openFile)
        self.outputEdit = OutputEdit(self)

        splitter = QSplitter(self)
        self.vSplitter = QSplitter(Qt.Vertical, splitter)
        self.vSplitter.addWidget(self.editor)
        self.vSplitter.addWidget(self.outputEdit)
        self.vSplitter.setStretchFactor(0, 1)
        self.vSplitter.setStretchFactor(1, 0)
        splitter.addWidget(self.fileChooser)
        splitter.addWidget(self.vSplitter)
        splitter.setStretchFactor(0, 0)
        splitter.setStretchFactor(1, 1)
        statusBar = ScriptingStatusBar(self)
        self.setCentralWidget(splitter)
        self.setStatusBar(statusBar)
        self.newFile()
        self.editor.modificationChanged.connect(self.setWindowModified)
        statusBar.setPosition(self.editor.textCursor())
        self.editor.cursorPositionChanged.connect(
            lambda: statusBar.setPosition(self.sender().textCursor()))
        statusBar.setIndent(self.editor.indent())
        self.editor.indentChanged.connect(statusBar.setIndent)
        statusBar.indentModified.connect(self.editor.setIndent)
        statusBar.positionClicked.connect(self.gotoLine)
        statusBar.clearButtonClicked.connect(self.outputEdit.clear)
        statusBar.runButtonClicked.connect(self.runScript)
        gotoLineShortcut = QShortcut(QKeySequence("Ctrl+G"), self)
        gotoLineShortcut.activated.connect(self.gotoLine)

        self.readSettings()
        splitter.splitterMoved.connect(self.writeSettings)
        self.vSplitter.splitterMoved.connect(self.writeSettings)
开发者ID:anthrotype,项目名称:trufont,代码行数:40,代码来源:scriptingWindow.py

示例9: WindowUI

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
class WindowUI(object):

    def widgetTraining(self):
        return TrainingWidget(self.classes_tree_view)

    def widgetRecognition(self):
        return RecognitionWidget(self.classes_tree_view)

    def widgetDataset(self):
        return DatasetWidget(self.classes_tree_view)

    def setupUI(self):
        """Create User Interface.
        """
        mainWidget = QWidget()
        mainLayout = QHBoxLayout()

        tabs = QTabWidget()
        self.classes_tree_view = ClassesTreeView(self)
        tabs.addTab(self.widgetDataset(), self.tr("Dataset"))
        tabs.addTab(self.widgetTraining(), self.tr("Training"))
        tabs.addTab(self.widgetRecognition(), self.tr("Recognition"))

        leftLayout, rightLayout = QHBoxLayout(), QHBoxLayout()
        leftLayout.addWidget(self.classes_tree_view)
        rightLayout.addWidget(tabs)
        left, right = QWidget(), QWidget()
        left.setLayout(leftLayout)
        right.setLayout(rightLayout)
        self.hsplitter = QSplitter(QtCore.Qt.Horizontal)
        self.hsplitter.addWidget(left)
        self.hsplitter.addWidget(right)
        self.hsplitter.setStretchFactor(1, 3)

        mainLayout.addWidget(self.hsplitter)
        mainWidget.setLayout(mainLayout)
        self.setCentralWidget(mainWidget)
开发者ID:xsyann,项目名称:mediocre,代码行数:39,代码来源:window_ui.py

示例10: EntryView

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
class EntryView(BaseTransactionView):
    def _setup(self):
        self._setupUi()
        self.etable = EntryTable(self.model.etable, view=self.tableView)
        self.efbar = EntryFilterBar(model=self.model.filter_bar, view=self.filterBar)
        self.bgraph = Chart(self.model.bargraph, view=self.barGraphView)
        self.lgraph = Chart(self.model.balgraph, view=self.lineGraphView)
        self._setupColumns() # Can only be done after the model has been connected

        self.reconciliationButton.clicked.connect(self.model.toggle_reconciliation_mode)

    def _setupUi(self):
        self.resize(483, 423)
        self.verticalLayout = QVBoxLayout(self)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setSpacing(0)
        self.filterBar = RadioBox(self)
        sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.filterBar.sizePolicy().hasHeightForWidth())
        self.filterBar.setSizePolicy(sizePolicy)
        self.horizontalLayout.addWidget(self.filterBar)
        self.horizontalLayout.addItem(horizontalSpacer())
        self.reconciliationButton = QPushButton(tr("Reconciliation"))
        self.reconciliationButton.setCheckable(True)
        self.horizontalLayout.addWidget(self.reconciliationButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.splitterView = QSplitter()
        self.splitterView.setOrientation(Qt.Vertical)
        self.splitterView.setChildrenCollapsible(False)
        self.tableView = TableView(self)
        self.tableView.setAcceptDrops(True)
        self.tableView.setEditTriggers(QAbstractItemView.DoubleClicked|QAbstractItemView.EditKeyPressed)
        self.tableView.setDragEnabled(True)
        self.tableView.setDragDropMode(QAbstractItemView.InternalMove)
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tableView.setSortingEnabled(True)
        self.tableView.horizontalHeader().setHighlightSections(False)
        self.tableView.horizontalHeader().setMinimumSectionSize(18)
        self.tableView.verticalHeader().setVisible(False)
        self.tableView.verticalHeader().setDefaultSectionSize(18)
        self.splitterView.addWidget(self.tableView)
        self.graphView = QStackedWidget(self)
        sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.graphView.sizePolicy().hasHeightForWidth())
        self.graphView.setSizePolicy(sizePolicy)
        self.graphView.setMinimumSize(0, 200)
        self.lineGraphView = LineGraphView()
        self.graphView.addWidget(self.lineGraphView)
        self.barGraphView = BarGraphView()
        self.graphView.addWidget(self.barGraphView)
        self.splitterView.addWidget(self.graphView)
        self.graphView.setCurrentIndex(1)
        self.splitterView.setStretchFactor(0, 1)
        self.splitterView.setStretchFactor(1, 0)
        self.verticalLayout.addWidget(self.splitterView)

    def _setupColumns(self):
        h = self.tableView.horizontalHeader()
        h.setSectionsMovable(True) # column drag & drop reorder

    # --- QWidget override
    def setFocus(self):
        self.etable.view.setFocus()

    # --- Public
    def fitViewsForPrint(self, viewPrinter):
        hidden = self.model.mainwindow.hidden_areas
        viewPrinter.fitTable(self.etable)
        if PaneArea.BottomGraph not in hidden:
            viewPrinter.fit(self.graphView.currentWidget(), 300, 150, expandH=True, expandV=True)

    def restoreSubviewsSize(self):
        graphHeight = self.model.graph_height_to_restore
        if graphHeight:
            splitterHeight = self.splitterView.height()
            sizes = [splitterHeight-graphHeight, graphHeight]
            self.splitterView.setSizes(sizes)

    # --- model --> view
    def refresh_reconciliation_button(self):
        if self.model.can_toggle_reconciliation_mode:
            self.reconciliationButton.setEnabled(True)
            self.reconciliationButton.setChecked(self.model.reconciliation_mode)
        else:
            self.reconciliationButton.setEnabled(False)
            self.reconciliationButton.setChecked(False)

    def show_bar_graph(self):
        self.graphView.setCurrentIndex(1)

    def show_line_graph(self):
        self.graphView.setCurrentIndex(0)

    def update_visibility(self):
#.........这里部分代码省略.........
开发者ID:brownnrl,项目名称:moneyguru,代码行数:103,代码来源:view.py

示例11: DatasetWidgetUI

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]

#.........这里部分代码省略.........
        widget = QWidget()
        layout = QHBoxLayout()
        prefixLabel = QLabel(self.tr("Prefix:"))
        self.prefixLine = QLineEdit()
        self.prefixLine.setPlaceholderText(self.tr("login_x-"))
        self.prefixLine.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum)
        layout.addWidget(prefixLabel)
        layout.addWidget(self.prefixLine)
        widget.setLayout(layout)
        return widget

    def sizeWidget(self):
        widget = QWidget()
        layout = QHBoxLayout()
        sizeLabel = QLabel(self.tr("x"))
        self.widthBox = QSpinBox()
        self.heightBox = QSpinBox()
        layout.addWidget(self.widthBox)
        layout.addWidget(sizeLabel)
        layout.addWidget(self.heightBox)
        widget.setLayout(layout)
        return widget

    def randomWidget(self):
        group = QGroupBox("Randomize")
        layout = QGridLayout()
        self.randomCount = QSpinBox()
        layout.addWidget(QLabel(self.tr("Count")), 0, 0)
        layout.addWidget(self.randomCount, 0, 1)
        self.minBrushSize = BrushSizeWidget(15)
        self.maxBrushSize = BrushSizeWidget(50)
        layout.addWidget(QLabel(self.tr("Min")), 1, 0)
        layout.addWidget(self.minBrushSize, 1, 1)
        layout.addWidget(QLabel(self.tr("Max")), 2, 0)
        layout.addWidget(self.maxBrushSize, 2, 1)
        self.xAngle = QSpinBox()
        self.yAngle = QSpinBox()
        self.zAngle = QSpinBox()
        layout.addWidget(QLabel(self.tr("Angle X")), 3, 0)
        layout.addWidget(self.xAngle, 3, 1)
        layout.addWidget(QLabel(self.tr("Angle Y")), 4, 0)
        layout.addWidget(self.yAngle, 4, 1)
        layout.addWidget(QLabel(self.tr("Angle Z")), 5, 0)
        layout.addWidget(self.zAngle, 5, 1)
        container = QVBoxLayout()
        container.addLayout(layout)
        container.addStretch(1)
        group.setLayout(container)
        group.setFixedWidth(150)
        return group

    def toolbarSpacer(self):
        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        return spacer

    def toolbarWidget(self):
        self.brushSizeWidget = BrushSizeWidget(self.brush_size, max_size=70)
        self.clearAction = QAction(QIcon("assets/clear.png"), "Clear", self)
        self.saveAction = QAction(QIcon("assets/save.png"), "Save", self)
        self.removeAction = QAction(QIcon("assets/remove.png"), "Remove", self)
        self.previewAction = QAction(QIcon("assets/preview.png"), "Preview", self)

        toolbar = QToolBar()
        toolbar.setIconSize(QSize(30, 30))
        toolbar.addWidget(self.brushSizeWidget)
        toolbar.addSeparator()
        toolbar.addAction(self.clearAction)
        toolbar.addAction(self.saveAction)
        toolbar.addAction(self.removeAction)
        toolbar.addAction(self.removeAction)
        toolbar.addAction(self.previewAction)
        toolbar.addSeparator()
        toolbar.addWidget(self.sizeWidget())
        toolbar.addWidget(self.prefixWidget())
        toolbar.addWidget(self.toolbarSpacer())
        return toolbar

    def setupUI(self):
        layout = QVBoxLayout()
        self.paintArea = PaintArea(self.brush_size)
        self.paintArea.installEventFilter(self)
        self.previewWidget = PreviewWidget()
        layout.addWidget(self.toolbarWidget())
        hbox = QHBoxLayout()
        hbox.addWidget(self.randomWidget())
        hbox.addWidget(self.paintArea)
        up = QWidget()
        up.setLayout(hbox)
        down = QWidget()
        hbox = QHBoxLayout()
        hbox.addWidget(self.previewWidget)
        down.setLayout(hbox)
        self.vsplitter = QSplitter(Qt.Vertical)
        self.vsplitter.addWidget(up)
        self.vsplitter.addWidget(down)
        self.vsplitter.setStretchFactor(1, 3)
        layout.addWidget(self.vsplitter)
        layout.addWidget(self.folderWidget())
        self.setLayout(layout)
开发者ID:xsyann,项目名称:mediocre,代码行数:104,代码来源:dataset.py

示例12: RunWidget

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
class RunWidget(QWidget):
    running = False
    device_list_signal = pyqtSignal(list, name="device_list_signal")
    cases = []

    def __init__(self, tester, *args, **kwargs):
        super().__init__(*args, **kwargs)
        ui_dir_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(ui_dir_path, 'case_run.ui')
        uic.loadUi(ui_file_path, self)

        # set icon
        run_icon = QIcon()
        self.tester = tester
        self.config = self.tester.get_config()

        run_icon.addPixmap(QPixmap(self.config.images + '/run.png'), QIcon.Normal, QIcon.Off)
        self.run_stop_btn.setIcon(run_icon)

        add_icon = QIcon()
        add_icon.addPixmap(QPixmap(self.config.images + '/add.png'), QIcon.Normal, QIcon.Off)
        self.addbtn.setIcon(add_icon)

        self.message_box = QMessageBox()

        self.dBCommandLineHelper = DBCommandLineHelper()

        self.addbtn.clicked.connect(self.click_add_case)
        self.run_stop_btn.clicked.connect(self.click_run_stop_btn)

        self.add_case_widget = None
        self.add_device_widget = None

        self.splitter = None
        self.case_widget = RunnerTableWidget([], [0])
        self.log_area = Console()
        self.splitter_setting()

        self.status_listener = CaseRunStatusListener()
        self.status_listener.listener_msg_signal.connect(self.update_case_name_color, Qt.QueuedConnection)
        self.tester.add_run_status_listener(self.status_listener)

    def splitter_setting(self):
        """
        set splitter
        :return:
        """
        if self.splitter:
            self.splitter = None
        self.splitter = QSplitter(Qt.Vertical)
        self.splitter.setHandleWidth(1)
        # add "case_widget" and "log_area" to splitter
        self.splitter.addWidget(self.case_widget)
        self.splitter.addWidget(self.log_area)

        # set the initial scale: 4:1
        self.splitter.setStretchFactor(0, 4)
        self.splitter.setStretchFactor(1, 1)
        self.case_table_layout.addWidget(self.splitter)

    def click_add_case(self):
        """
        click the button to show add case widget
        :return:
        """
        self.add_case_widget = AddCaseWidget()
        self.add_case_widget.select_case_signal.connect(self.show_cases, Qt.QueuedConnection)
        self.add_case_widget.setWindowModality(Qt.ApplicationModal)
        self.add_case_widget.show()

    def click_run_stop_btn(self):
        """
        start or stop to run case
        :return:
        """
        devices = []
        if self.running:
            self.stop_case()
            return
        if not self.cases:  # cases is null
            self.message_box.warning(self, "Message", "Please add cases first.", QMessageBox.Ok)
            return
        try:
            devices = self.tester.devices()
        except Exception as e:
            self.add_log("<font color='red'>" + str(e) + "</font>")
        if not devices:  # There is no device connected
            self.message_box.warning(self, "Message", "Please connect the device to your computer.", QMessageBox.Ok)
            return
        self.add_device_widget = AddDeviceWidget()
        self.add_device_widget.setWindowModality(Qt.ApplicationModal)
        self.add_device_widget.add_log_signal.connect(self.add_log, Qt.QueuedConnection)
        self.add_device_widget.run_case_signal.connect(self.run_case, Qt.QueuedConnection)
        self.device_list_signal.connect(self.add_device_widget.add_radio_to_widget, Qt.QueuedConnection)
        self.add_device_widget.show()
        try:
            self.device_list_signal.emit(devices)
        except Exception as e:
            self.add_log("<font color='red'><pre>" + str(e) + "</pre></font>")

#.........这里部分代码省略.........
开发者ID:IfengAutomation,项目名称:uitester,代码行数:103,代码来源:case_run.py

示例13: initUI

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]

#.........这里部分代码省略.........
        self.update_file_path_button.clicked.connect(
            self.batch_recognize_all_images)

        self.update_file_path_layout = QHBoxLayout()
        self.update_file_path_layout.addWidget(self.check_box)
        self.update_file_path_layout.addWidget(self.update_file_path_button)
        self.update_file_path_layout.addStretch()

        self.bottom_layout = QVBoxLayout()
        self.bottom_layout.addLayout(self.location_layout)
        self.bottom_layout.addLayout(self.update_file_path_layout)
        bottom_widget = QWidget()
        bottom_widget.setLayout(self.bottom_layout)

        license_plate_iamge_label = QLabel("车牌图")
        self.license_plate_widget = QLabel("")

        block_image_label = QLabel("分割图")
        self.block_plate_widget = QLabel("")

        filename_label = QLabel("文件名:")
        self.filename_edit = QLineEdit()

        segmentation_recognition_label = QLabel("分割识别:")
        self.segmentation_recognition_edit = QLineEdit()
        self.segmentation_recognition_edit.setFont(QFont("黑体", 24, QFont.Bold))
        self.segmentation_recognition_edit.setStyleSheet("color:red")

        confidence_label = QLabel("置信度")
        self.confidence_edit = QLineEdit()
        self.confidence_edit.setFont(QFont("黑体", 24, QFont.Bold))
        self.confidence_edit.setStyleSheet("color:red")

        plate_color_label = QLabel("车牌颜色")
        self.plate_color_edit = QLineEdit()
        self.plate_color_edit.setFont(QFont("黑体", 24, QFont.Bold))
        self.plate_color_edit.setStyleSheet("color:red")

        e2e_recognization_label = QLabel("e2e识别:")
        self.e2e_recognization_edit = QLineEdit()
        self.e2e_recognization_edit.setFont(QFont("黑体", 24, QFont.Bold))
        self.e2e_recognization_edit.setStyleSheet("color:red")

        e2e_confidence_label = QLabel("e2e置信度")
        self.e2e_confidence_edit = QLineEdit()
        self.e2e_confidence_edit.setFont(QFont("黑体", 24, QFont.Bold))
        self.e2e_confidence_edit.setStyleSheet("color:red")

        info_gridlayout = QGridLayout()
        info_gridlayout.addWidget(filename_label, 0, 0)
        info_gridlayout.addWidget(self.filename_edit, 0, 1)
        info_gridlayout.addWidget(license_plate_iamge_label, 1, 0)
        info_gridlayout.addWidget(self.license_plate_widget, 1, 1)
        info_gridlayout.addWidget(block_image_label, 2, 0)
        info_gridlayout.addWidget(self.block_plate_widget, 2, 1)
        info_gridlayout.addWidget(segmentation_recognition_label, 3, 0)
        info_gridlayout.addWidget(self.segmentation_recognition_edit, 3, 1)
        info_gridlayout.addWidget(confidence_label, 4, 0)
        info_gridlayout.addWidget(self.confidence_edit, 4, 1)
        info_gridlayout.addWidget(plate_color_label, 5, 0)
        info_gridlayout.addWidget(self.plate_color_edit, 5, 1)
        info_gridlayout.addWidget(e2e_recognization_label, 6, 0)
        info_gridlayout.addWidget(self.e2e_recognization_edit, 6, 1)
        info_gridlayout.addWidget(e2e_confidence_label, 7, 0)
        info_gridlayout.addWidget(self. e2e_confidence_edit, 7, 1)

        info_widget = QWidget()

        info_widget.setLayout(info_gridlayout)

        right_splitter = QSplitter(Qt.Vertical)
        right_splitter.addWidget(bottom_widget)
        right_splitter.addWidget(self.hyperlpr_tableview)
        right_splitter.addWidget(info_widget)
        right_splitter.setStretchFactor(1, 3)
        right_splitter.setStretchFactor(2, 2)

        main_splitter = QSplitter(Qt.Horizontal)
        main_splitter.addWidget(self.image_window_view)
        main_splitter.addWidget(right_splitter)
        main_splitter.setStretchFactor(0, 1)

        self.image_filename_list = []
        self.hyperlpr_dir_path = ""
        self.segmentation_recognition_correct_number = 0
        self.color_correct_number = 0
        self.e2e_recognization_correct_number = 0

        self.batch_recognization_thread = LicenseRecognizationThread()
        self.batch_recognization_thread.recognization_done_signal.connect(
            self.recognization_done_slot)
        self.batch_recognization_thread.start()

        self.start_init_signal.connect(self.read_path_and_show_one_image)

        self.setCentralWidget(main_splitter)

        self.setWindowTitle("HyperLPR车牌识别软件v1.0")

        self.start_init_signal.emit()
开发者ID:zhxf2012,项目名称:HyperLPR,代码行数:104,代码来源:HyperLprGUI.py

示例14: SubTabWidget

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]
class SubTabWidget(QWidget):
    _tabChanged = pyqtSignal(int, name = "tabChanged")

    def __init__(self, subtitleData, videoWidget, parent = None):
        super(SubTabWidget, self).__init__(parent)
        self._subtitleData = subtitleData
        self.__initTabWidget(videoWidget)

    def __initTabWidget(self, videoWidget):
        settings = SubSettings()

        mainLayout = QVBoxLayout(self)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.setSpacing(0)

        #TabBar
        self.tabBar = QTabBar(self)

        # Splitter (bookmarks + pages)
        self.splitter = QSplitter(self)
        self.splitter.setObjectName("sidebar_splitter")

        self._toolbox = ToolBox(self._subtitleData, self)
        self._toolbox.setObjectName("sidebar")
        self._toolbox.setMinimumWidth(100)

        self._toolbox.addTool(Details(self._subtitleData, self))
        self._toolbox.addTool(Synchronizer(videoWidget, self._subtitleData, self))
        self._toolbox.addTool(History(self))

        self.rightWidget = QWidget()
        rightLayout = QGridLayout()
        rightLayout.setContentsMargins(0, 0, 0, 0)
        self.rightWidget.setLayout(rightLayout)

        self._mainTab = FileList(_("Subtitles"), self._subtitleData, self)

        self.pages = QStackedWidget(self)
        rightLayout.addWidget(self.pages, 0, 0)

        self.tabBar.addTab(self._mainTab.name)
        self.pages.addWidget(self._mainTab)

        self.splitter.addWidget(self._toolbox)
        self.splitter.addWidget(self.rightWidget)
        self.__drawSplitterHandle(1)

        # Setting widgets
        mainLayout.addWidget(self.tabBar)
        mainLayout.addWidget(self.splitter)

        # Widgets settings
        self.tabBar.setMovable(True)
        self.tabBar.setTabsClosable(True)
        self.tabBar.setExpanding(False)

        # Don't resize left panel if it's not needed
        leftWidgetIndex = self.splitter.indexOf(self._toolbox)
        rightWidgetIndex = self.splitter.indexOf(self.rightWidget)

        self.splitter.setStretchFactor(leftWidgetIndex, 0)
        self.splitter.setStretchFactor(rightWidgetIndex, 1)
        self.splitter.setCollapsible(leftWidgetIndex, False)
        self.splitter.setSizes([250])

        # Some signals
        self.tabBar.currentChanged.connect(self.showTab)
        self.tabBar.tabCloseRequested.connect(self.closeTab)
        self.tabBar.tabMoved.connect(self.moveTab)
        self._mainTab.requestOpen.connect(self.openTab)
        self._mainTab.requestRemove.connect(self.removeFile)

        self.tabChanged.connect(lambda i: self._toolbox.setContentFor(self.tab(i)))

        self.setLayout(mainLayout)

    def __addTab(self, filePath):
        """Returns existing tab index. Creates a new one if it isn't opened and returns its index
        otherwise."""
        for i in range(self.tabBar.count()):
            widget = self.pages.widget(i)
            if not widget.isStatic and filePath == widget.filePath:
                return i
        tab = SubtitleEditor(filePath, self._subtitleData, self)
        newIndex = self.tabBar.addTab(self._createTabName(tab.name, tab.history.isClean()))
        tab.history.cleanChanged.connect(
            lambda clean: self._cleanStateForFileChanged(filePath, clean))
        self.pages.addWidget(tab)
        return newIndex

    def __drawSplitterHandle(self, index):
        splitterHandle = self.splitter.handle(index)

        splitterLayout = QVBoxLayout(splitterHandle)
        splitterLayout.setSpacing(0)
        splitterLayout.setContentsMargins(0, 0, 0, 0)

        line = QFrame(splitterHandle)
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)
#.........这里部分代码省略.........
开发者ID:mgoral,项目名称:subconvert,代码行数:103,代码来源:SubtitleWindow.py

示例15: WindowUI

# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import setStretchFactor [as 别名]

#.........这里部分代码省略.........
    def widgetGlobalParam(self):
        """Create global parameters widget.
        """
        hbox = QHBoxLayout()
        self.displayCBox = QComboBox(self)
        self.bgCBox = QComboBox(self)
        self.bgColorPicker = QPushButton('')
        self.bgColorPicker.setMaximumSize(QtCore.QSize(16, 16))
        self.bgPathButton = QPushButton('...')
        self.bgPathButton.setMaximumWidth(45)
        hbox.addWidget(QLabel(self.tr('Display')))
        hbox.addWidget(self.displayCBox)
        hbox.addStretch(1)
        hbox.addWidget(QLabel(self.tr('Background')))
        hbox.addWidget(self.bgCBox)
        hbox.addWidget(self.bgColorPicker)
        hbox.addWidget(self.bgPathButton)

        self.equalizeHist = QCheckBox(self.tr('Equalize histogram'))

        vbox = QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addWidget(self.equalizeHist)
        return vbox

    def widgetParameters(self):
        """Create parameters widget.
        """
        globalParamBox = QGroupBox(self.tr('Global parameters'))
        objects = self.widgetGlobalParam()
        globalParamBox.setLayout(objects)

        detectBox = QGroupBox(self.tr('Detect'))
        objects = self.widgetObjectList()
        detectBox.setLayout(objects)

        self.displayBox = QGroupBox(self.tr('Classifier Display'))
        display = self.widgetClassifierDisplay()
        self.displayBox.setLayout(display)

        self.parametersBox = QGroupBox(self.tr('Classifier Parameters'))
        parameters = self.widgetClassifierParameters()
        self.parametersBox.setLayout(parameters)

        vbox = QVBoxLayout()
        vbox.addWidget(globalParamBox)
        vbox.addWidget(detectBox)
        vbox.addWidget(self.displayBox)
        vbox.addWidget(self.parametersBox)
        return vbox

    def widgetDebug(self):
        """Create debug infos widget.
        """
        self.debugText = QTextEdit(self)
        vbox = QVBoxLayout()
        hbox = QHBoxLayout()
        self.showDetails = QPushButton(self.tr('Details >>>'))
        self.showDetails.setCheckable(True)
        self.showDetails.setChecked(1)
        hbox.addWidget(self.showDetails)
        hbox.addStretch(1)

        vbox.addLayout(hbox)
        vbox.addWidget(self.debugText)
        vbox.addStretch(1)

        return vbox

    def setupUI(self):
        """Create User Interface.
        """
        sourceWidget = self.widgetSource()
        frameWidget = self.widgetFrame()
        parametersWidget = self.widgetParameters()

        leftSide = QWidget()
        leftSide.setLayout(parametersWidget)
        rightSide = QWidget()
        rightSide.setLayout(frameWidget)
        self.hsplitter = QSplitter(QtCore.Qt.Horizontal)
        self.hsplitter.addWidget(leftSide)
        self.hsplitter.addWidget(rightSide)
        self.hsplitter.setStretchFactor(0, 1)
        self.hsplitter.setStretchFactor(1, 10)

        downSide = QWidget()
        downSide.setLayout(self.widgetDebug())
        self.vsplitter = QSplitter(QtCore.Qt.Vertical)
        self.vsplitter.addWidget(self.hsplitter)
        self.vsplitter.addWidget(downSide)
        self.vsplitter.setStretchFactor(0, 10)
        self.vsplitter.setStretchFactor(1, 1)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(sourceWidget)
        mainLayout.addWidget(self.vsplitter)
        self.setLayout(mainLayout)
        self.setGeometry(300, 300, 800, 600)
        self.show()
开发者ID:smajida,项目名称:detection,代码行数:104,代码来源:window_ui.py


注:本文中的PyQt5.QtWidgets.QSplitter.setStretchFactor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。