Python PyQt5.QtWidgets.QGroupBox() Examples

The following are 30 code examples of PyQt5.QtWidgets.QGroupBox(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .
Example #1
Source Project: Cura   Author: Ultimaker   File: CrashHandler.py    License: GNU Lesser General Public License v3.0 7 votes vote down vote up
def _logInfoWidget(self):
        group = QGroupBox()
        group.setTitle(catalog.i18nc("@title:groupbox", "Logs"))
        layout = QVBoxLayout()

        text_area = QTextEdit()
        tmp_file_fd, tmp_file_path = tempfile.mkstemp(prefix = "cura-crash", text = True)
        os.close(tmp_file_fd)
        with open(tmp_file_path, "w", encoding = "utf-8") as f:
            faulthandler.dump_traceback(f, all_threads=True)
        with open(tmp_file_path, "r", encoding = "utf-8") as f:
            logdata = f.read()

        text_area.setText(logdata)
        text_area.setReadOnly(True)

        layout.addWidget(text_area)
        group.setLayout(layout)

        self.data["log"] = logdata

        return group 
Example #2
Source Project: DevilYuan   Author: moyuanz   File: DyStockDataHistDaysManualUpdateDlg.py    License: MIT License 6 votes vote down vote up
def _createIndicatorGroupBox(self):
        indicatorGroupBox = QGroupBox('指标')

        grid = QGridLayout()
        grid.setSpacing(10)

        rowNbr = 4
        self._indicatorCheckBoxList = []
        for i, indicator in enumerate(DyStockDataCommon.dayIndicators):
            checkBox = QCheckBox(indicator)
            checkBox.setChecked(True)

            grid.addWidget(checkBox, i//rowNbr, i%rowNbr)

            self._indicatorCheckBoxList.append(checkBox)

        indicatorGroupBox.setLayout(grid)

        return indicatorGroupBox 
Example #3
Source Project: reaper   Author: ScriptSmith   File: keys.py    License: GNU General Public License v3.0 6 votes vote down vote up
def add_source(self, name, keys):
        if not self.sources.get(name):
            self.sources[name] = {}
            for key in keys:
                self.sources[name][key[1]] = ""

        sourceBox = QtWidgets.QGroupBox(name)
        sourceBox.layout = QtWidgets.QGridLayout()
        sourceBox.layout.setColumnMinimumWidth(0, 150)
        sourceBox.setLayout(sourceBox.layout)

        for count, key in enumerate(keys):
            keyLine = KeyLine(name, key[1], self.sources, self.write_keys)
            sourceBox.layout.addWidget(QtWidgets.QLabel(key[0]), count, 0)
            sourceBox.layout.addWidget(keyLine, count, 1)

        self.scrollWidget.layout.addWidget(sourceBox) 
Example #4
Source Project: imperialism-remake   Author: Trilarion   File: qt.py    License: GNU General Public License v3.0 6 votes vote down vote up
def wrap_in_groupbox(item, title) -> QtWidgets.QGroupBox:
    """
    Shortcut for putting a widget or a layout into a QGroupBox (with a title). Returns the group box.

    :param item: Widget or Layout to wrap.
    :param title: Title string of the group box.
    :return: Group box
    """
    box = QtWidgets.QGroupBox(title)
    if isinstance(item, QtWidgets.QWidget):
        # we use a standard BoxLayout
        layout = QtWidgets.QVBoxLayout(box)
        layout.addWidget(item)
    elif isinstance(item, QtWidgets.QLayout):
        box.setLayout(item)
    return box 
Example #5
Source Project: awesometts-anki-addon   Author: AwesomeTTS   File: configurator.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _ui_tabs_mp3gen_lame(self):
        """Returns the "LAME Transcoder" input group."""

        flags = QtWidgets.QLineEdit()
        flags.setObjectName('lame_flags')
        flags.setPlaceholderText("e.g. '-q 5' for medium quality")

        rtr = self._addon.router
        vert = QtWidgets.QVBoxLayout()
        vert.addWidget(Note("Specify flags passed to lame when making MP3s."))
        vert.addWidget(flags)
        vert.addWidget(Note("Affects %s. Changes are not retroactive to old "
                            "files." %
                            ', '.join(rtr.by_trait(rtr.Trait.TRANSCODING))))

        group = QtWidgets.QGroupBox("LAME Transcoder")
        group.setLayout(vert)
        return group 
Example #6
Source Project: awesometts-anki-addon   Author: AwesomeTTS   File: configurator.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _ui_tabs_advanced_presets(self):
        """Returns the "Presets" input group."""

        presets_button = QtWidgets.QPushButton("Manage Presets...")
        presets_button.clicked.connect(self._on_presets)

        groups_button = QtWidgets.QPushButton("Manage Groups...")
        groups_button.clicked.connect(self._on_groups)

        hor = QtWidgets.QHBoxLayout()
        hor.addWidget(presets_button)
        hor.addWidget(groups_button)
        hor.addStretch()

        vert = QtWidgets.QVBoxLayout()
        vert.addWidget(Note("Setup services for easy access, menu playback, "
                            "randomization, or fallbacks."))
        vert.addLayout(hor)

        group = QtWidgets.QGroupBox("Service Presets and Groups")
        group.setLayout(vert)
        return group 
Example #7
Source Project: linux-show-player   Author: FrancescoCeruti   File: preset_src.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.functionGroup = QGroupBox(self)
        self.functionGroup.setTitle(translate('PresetSrcSettings', 'Presets'))
        self.functionGroup.setLayout(QVBoxLayout())
        self.layout().addWidget(self.functionGroup)

        self.functionCombo = QComboBox(self.functionGroup)
        self.functionGroup.layout().addWidget(self.functionCombo)

        for function in sorted(PresetSrc.PRESETS.keys()):
            self.functionCombo.addItem(function)

        self.functionDuration = QTimeEdit(self.functionGroup)
        self.functionDuration.setDisplayFormat('HH.mm.ss.zzz')
        self.functionGroup.layout().addWidget(self.functionDuration) 
Example #8
Source Project: linux-show-player   Author: FrancescoCeruti   File: audio_pan.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.panBox = QGroupBox(self)
        self.panBox.setGeometry(0, 0, self.width(), 80)
        self.panBox.setLayout(QHBoxLayout(self.panBox))
        self.layout().addWidget(self.panBox)

        self.panSlider = QSlider(self.panBox)
        self.panSlider.setRange(-10, 10)
        self.panSlider.setPageStep(1)
        self.panSlider.setOrientation(Qt.Horizontal)
        self.panSlider.valueChanged.connect(self.pan_changed)
        self.panBox.layout().addWidget(self.panSlider)

        self.panLabel = QLabel(self.panBox)
        self.panLabel.setAlignment(Qt.AlignCenter)
        self.panBox.layout().addWidget(self.panLabel)

        self.panBox.layout().setStretch(0, 5)
        self.panBox.layout().setStretch(1, 1)

        self.retransaleUi() 
Example #9
Source Project: linux-show-player   Author: FrancescoCeruti   File: stop_all.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.group = QGroupBox(self)
        self.group.setLayout(QVBoxLayout(self.group))
        self.layout().addWidget(self.group)

        self.actionCombo = QComboBox(self.group)
        for action in [CueAction.Stop, CueAction.FadeOutStop, CueAction.Pause,
                       CueAction.FadeOutPause, CueAction.Interrupt,
                       CueAction.FadeOutInterrupt]:
            self.actionCombo.addItem(
                translate('CueAction', action.name), action.value)
        self.group.layout().addWidget(self.actionCombo)

        self.retranslateUi() 
Example #10
Source Project: linux-show-player   Author: FrancescoCeruti   File: command_cue.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.group = QGroupBox(self)
        self.group.setLayout(QVBoxLayout(self.group))
        self.layout().addWidget(self.group)

        self.commandLineEdit = QLineEdit(self.group)
        self.group.layout().addWidget(self.commandLineEdit)

        self.noOutputCheckBox = QCheckBox(self)
        self.layout().addWidget(self.noOutputCheckBox)

        self.noErrorCheckBox = QCheckBox(self)
        self.layout().addWidget(self.noErrorCheckBox)

        self.killCheckBox = QCheckBox(self)
        self.layout().addWidget(self.killCheckBox)

        self.retranslateUi() 
Example #11
Source Project: linux-show-player   Author: FrancescoCeruti   File: cue_app_settings.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        # Interrupt
        self.interruptGroup = QGroupBox(self)
        self.interruptGroup.setLayout(QVBoxLayout())
        self.layout().addWidget(self.interruptGroup)

        self.interruptFadeEdit = FadeEdit(self.interruptGroup)
        self.interruptGroup.layout().addWidget(self.interruptFadeEdit)

        # Action
        self.actionGroup = QGroupBox(self)
        self.actionGroup.setLayout(QVBoxLayout())
        self.layout().addWidget(self.actionGroup)

        self.fadeActionEdit = FadeEdit(self.actionGroup)
        self.actionGroup.layout().addWidget(self.fadeActionEdit)

        self.retranslateUi() 
Example #12
Source Project: Miyamoto   Author: aboood40091   File: dialogs.py    License: GNU General Public License v3.0 6 votes vote down vote up
def createType(self, z):
        self.Settings = QtWidgets.QGroupBox(globals.trans.string('ZonesDlg', 76))
        self.Zone_settings = []
        
        ZoneSettingsLeft = QtWidgets.QFormLayout()
        ZoneSettingsRight = QtWidgets.QFormLayout()
        settingsNames = globals.trans.stringList('ZonesDlg', 77)
        
        for i in range(0, 8):
            self.Zone_settings.append(QtWidgets.QCheckBox())
            self.Zone_settings[i].setChecked(z.type & (2 ** i))

            if i < 4:
                ZoneSettingsLeft.addRow(settingsNames[i], self.Zone_settings[i])
            else:
                ZoneSettingsRight.addRow(settingsNames[i], self.Zone_settings[i])
            
        ZoneSettingsLayout = QtWidgets.QHBoxLayout()
        ZoneSettingsLayout.addLayout(ZoneSettingsLeft)
        ZoneSettingsLayout.addStretch()
        ZoneSettingsLayout.addLayout(ZoneSettingsRight)
        
        self.Settings.setLayout(ZoneSettingsLayout) 
Example #13
Source Project: nanovna-saver   Author: NanoVNA-Saver   File: Widget.py    License: GNU General Public License v3.0 6 votes vote down vote up
def setScale(self, scale):
        self.group_box.setMaximumWidth(int(340 * scale))
        self.label['actualfreq'].setMinimumWidth(int(100 * scale))
        self.label['actualfreq'].setMinimumWidth(int(100 * scale))
        self.label['returnloss'].setMinimumWidth(int(80 * scale))
        if self.coloredText:
            color_string = QtCore.QVariant(self.color)
            color_string.convert(QtCore.QVariant.String)
            self.group_box.setStyleSheet(
                f"QGroupBox {{ color: {color_string.value()}; "
                f"font-size: {self._size_str()}}};"
            )
        else:
            self.group_box.setStyleSheet(
                f"QGroupBox {{ font-size: {self._size_str()}}};"
            ) 
Example #14
Source Project: nanovna-saver   Author: NanoVNA-Saver   File: Widget.py    License: GNU General Public License v3.0 6 votes vote down vote up
def setColor(self, color):
        if color.isValid():
            self.color = color
            p = self.btnColorPicker.palette()
            p.setColor(QtGui.QPalette.ButtonText, self.color)
            self.btnColorPicker.setPalette(p)
        if self.coloredText:
            color_string = QtCore.QVariant(color)
            color_string.convert(QtCore.QVariant.String)
            self.group_box.setStyleSheet(
                f"QGroupBox {{ color: {color_string.value()}; "
                f"font-size: {self._size_str()}}};"
            )
        else:
            self.group_box.setStyleSheet(
                f"QGroupBox {{ font-size: {self._size_str()}}};"
            ) 
Example #15
Source Project: payment-proto-interface   Author: achow101   File: gui.py    License: MIT License 6 votes vote down vote up
def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        self.uri_box = QLineEdit(self)
        go_button = QPushButton('Go!', self)
        go_button.clicked.connect(self.handle_entered_uri)
        
        self.main_box = QGroupBox("Bitcoin Payment Protocol Interface")
        main_layout = QGridLayout()
        main_layout.addWidget(QLabel("Bitcoin URI:"), 0, 0)
        main_layout.addWidget(self.uri_box, 0, 1)
        main_layout.addWidget(go_button, 0, 2)
        
        self.payment_data_box = QGroupBox()
        main_layout.addWidget(self.payment_data_box, 1, 1)
        
        self.main_box.setLayout(main_layout)
        
        windowLayout = QVBoxLayout()
        windowLayout.addWidget(self.main_box)
        self.setLayout(windowLayout)

        self.show() 
Example #16
Source Project: spinalcordtoolbox   Author: neuropoly   File: centerline.py    License: MIT License 6 votes vote down vote up
def _init_controls(self, parent):
        group = QtWidgets.QGroupBox()
        group.setFlat(True)
        layout = QtWidgets.QHBoxLayout()

        custom_mode = QtWidgets.QRadioButton('Mode Custom')
        custom_mode.setToolTip('Manually select the axis slice on sagittal plane')
        custom_mode.toggled.connect(self.on_toggle_mode)
        custom_mode.mode = 'CUSTOM'
        custom_mode.sagittal_title = 'Select an axial slice.\n{}'.format(self.params.subtitle)
        custom_mode.axial_title = 'Select the center of the spinal cord'
        layout.addWidget(custom_mode)

        auto_mode = QtWidgets.QRadioButton('Mode Auto')
        auto_mode.setToolTip('Automatically move down the axis slice on the sagittal plane')
        auto_mode.toggled.connect(self.on_toggle_mode)
        auto_mode.mode = 'AUTO'
        auto_mode.sagittal_title = 'The axial slice is automatically selected\n{}'.format(self.params.subtitle)
        auto_mode.axial_title = 'Click in the center of the spinal cord'
        layout.addWidget(auto_mode)

        group.setLayout(layout)
        parent.addWidget(group)
        auto_mode.click() 
Example #17
Source Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def selectFileLayout(self):

        self.select_file = QtWidgets.QGroupBox('')
        layout = QtWidgets.QGridLayout()

        tag_m2m = QtWidgets.QLabel('<b>m2m Folder:<\\b>')
        layout.addWidget(tag_m2m, 1, 0, 1, 3)

        self.m2m_folder_lineEdit = QtWidgets.QLineEdit()
        layout.addWidget(self.m2m_folder_lineEdit, 2, 0, 1, 3)
 
        file_browse_m2m = QtWidgets.QPushButton('Browse')
        file_browse_m2m.clicked.connect(self.m2mFolderDialog)
        layout.addWidget(file_browse_m2m,2,3,1,1)

        tag = QtWidgets.QLabel('<b>Head Mesh:<\\b>')
        layout.addWidget(tag,3,0,1,3)

        self.file_name = QtWidgets.QLineEdit()
        layout.addWidget(self.file_name, 4, 0, 1, 3)
 
        file_browse = QtWidgets.QPushButton('Browse')
        file_browse.clicked.connect(self.fileDialog)
        layout.addWidget(file_browse, 4, 3, 1, 1)

        tag_Out = QtWidgets.QLabel('<b>Output Folder:<\\b>')
        layout.addWidget(tag_Out,5,0,1,3)

        self.out_folder_lineEdit = QtWidgets.QLineEdit()
        layout.addWidget(self.out_folder_lineEdit,6,0,1,3)
 
        file_browse_out = QtWidgets.QPushButton('Browse')
        file_browse_out.clicked.connect(self.outFolderDialog)
        layout.addWidget(file_browse_out,6,3,1,1)



        self.select_file.setLayout(layout) 
Example #18
Source Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def poslistTabs(self):
        poslistsTabs = QtWidgets.QGroupBox("Position Lists:")
        layout = QtWidgets.QGridLayout()
        self.poslistTabWidget = QtWidgets.QTabWidget()
        #elc_table = ElcTable(0,3,self.headModelWidget.glHeadModel,self)
        #self.poslistTabWidget.addTab(elc_table.generateGroupBox(), "tDCS")
        layout.addWidget(self.poslistTabWidget,0,0,3,0)

        add_tDCS_button = QtWidgets.QPushButton("Add tDCS Poslist")
        add_tDCS_button.clicked.connect(self.addTdcsPoslistTab)
        layout.addWidget(add_tDCS_button,3,0)

        add_TMS_button = QtWidgets.QPushButton("Add TMS Poslist")
        add_TMS_button.clicked.connect(self.addTmsPoslistTab)
        layout.addWidget(add_TMS_button,3,1)

        copy_button = QtWidgets.QPushButton("Copy Poslist")
        copy_button.clicked.connect(self.copyPoslist)
        layout.addWidget(copy_button,3,2)

        self.poslistTabWidget.setTabsClosable(True)
        self.poslistTabWidget.tabCloseRequested.connect(self.removePoslistTab)

        self.poslistTabWidget.currentChanged.connect(self.changeGlStimulators)
        #self.pos

        poslistsTabs.setLayout(layout)

        return poslistsTabs

    #Adds a tdcs-type tab to the poslist tabs 
Example #19
Source Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def coilBox(self):
        box = QtWidgets.QGroupBox("Coil Definition File:")
        layout = QtWidgets.QGridLayout()

        coil_line_edit = QtWidgets.QLineEdit()
        coil_line_edit.textChanged.connect(self.set_coil_fn)
        layout.addWidget(coil_line_edit,0,0,1,3)

        file_browse_btn = QtWidgets.QPushButton('Browse')
        file_browse_btn.clicked.connect(self.coilDialog)
        layout.addWidget(file_browse_btn,0,3,1,1)

        box.setLayout(layout)

        return box, coil_line_edit 
Example #20
Source Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def set_direction_layout(self):
        box_text = "Direction Reference"
        self.direction_box = QtWidgets.QGroupBox(box_text)

        load_ref = self.reference is not None and len(self.reference) == 3

        Layout = QtWidgets.QGridLayout()

        self.check = QtWidgets.QCheckBox('Define Reference Coordinates')

        Layout.addWidget(self.check, 0,0,1,3)

        self.label_x2 = QtWidgets.QLabel("X:")
        Layout.addWidget(self.label_x2,1,1)
        self.ref_x = QtWidgets.QDoubleSpinBox()
        self.ref_x.setRange(-1000, 1000)
        if load_ref: self.ref_x.setValue(self.reference[0])
        #self.ref_x.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_x,2,1)

        self.label_y2 = QtWidgets.QLabel("Y:")
        Layout.addWidget(self.label_y2,1,2)
        self.ref_y = QtWidgets.QDoubleSpinBox()
        self.ref_y.setRange(-1000, 1000)
        if load_ref: self.ref_y.setValue(self.reference[1])
        #self.ref_y.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_y,2,2)

        self.label_z2 = QtWidgets.QLabel("Z:")
        Layout.addWidget(self.label_z2,1,3)
        self.ref_z = QtWidgets.QDoubleSpinBox()
        self.ref_z.setRange(-1000, 1000)
        if load_ref: self.ref_z.setValue(self.reference[2])
        #self.ref_z.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_z,2,3)

        self.direction_box.setLayout(Layout)

    #Returns the positions 
Example #21
Source Project: simnibs   Author: simnibs   File: simulation_menu.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, eeg_cap):
        super(EEGFileDialog, self).__init__(parent)

        self.fname = eeg_cap

        groupBox = QtWidgets.QGroupBox('EEG Cap File')
        layout = QtWidgets.QHBoxLayout()

        groupBox.lineEdit = QtWidgets.QLineEdit()
        if self.fname is not None:
            groupBox.lineEdit.setText(self.fname)
        layout.addWidget(groupBox.lineEdit)

        groupBox.selectFile = QtWidgets.QPushButton('&Browse')
        groupBox.selectFile.clicked.connect(self.selectFile)
        layout.addWidget(groupBox.selectFile)

        groupBox.setLayout(layout)
        self.group_box = groupBox

        self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Cancel)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)

        mainLayout = QtWidgets.QGridLayout()

        mainLayout.addWidget(self.group_box)
        mainLayout.addWidget(self.button_box)

        self.setLayout(mainLayout)  

        self.setWindowTitle('Tensor file names')
        self.resize(400,200) 
Example #22
Source Project: easygui_qt   Author: aroberge   File: utils.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_list_of_images_to_layout(layout, images):
    ''' adds a list of images shown in a horizontal layout to an
        already existing layout'''
    h_layout = qt_widgets.QHBoxLayout()
    h_box = qt_widgets.QGroupBox('')
    for image in images:
        add_image_to_layout(h_layout, image)
    h_box.setLayout(h_layout)
    layout.addWidget(h_box) 
Example #23
Source Project: easygui_qt   Author: aroberge   File: utils.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_list_of_images_with_captions_to_layout(layout, images):
    ''' adds a list of images shown in a horizontal layout with
        caption underneath to an already existing layout'''
    h_layout = qt_widgets.QHBoxLayout()
    h_box = qt_widgets.QGroupBox('')
    for image, caption in images:
        widget = qt_widgets.QWidget()
        v_layout = qt_widgets.QVBoxLayout()
        add_image_to_layout(v_layout, image)
        add_text_to_layout(v_layout, caption)
        widget.setLayout(v_layout)
        h_layout.addWidget(widget)
    h_box.setLayout(h_layout)
    layout.addWidget(h_box) 
Example #24
Source Project: easygui_qt   Author: aroberge   File: utils.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_list_of_images_with_buttons_to_layout(layout, images, parent):
    ''' adds a list of images shown in a horizontal layout with
        button underneath to an already existing layout'''
    h_layout = qt_widgets.QHBoxLayout()
    h_box = qt_widgets.QGroupBox('')
    for image, label in images:
        widget = qt_widgets.QWidget()
        v_layout = qt_widgets.QVBoxLayout()
        add_image_to_layout(v_layout, image)
        add_button(v_layout, label, parent)
        widget.setLayout(v_layout)
        h_layout.addWidget(widget)
    h_box.setLayout(h_layout)
    layout.addWidget(h_box) 
Example #25
Source Project: easygui_qt   Author: aroberge   File: utils.py    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_list_of_buttons_to_layout(layout, button_labels, parent):
    ''' adds a list of buttons shown in a horizontal layout to an
        already existing layout'''
    h_layout = qt_widgets.QHBoxLayout()
    h_box = qt_widgets.QGroupBox('')
    for label in button_labels:
        add_button(h_layout, label, parent)
    h_box.setLayout(h_layout)
    layout.addWidget(h_box) 
Example #26
Source Project: pyleecan   Author: Eomys   File: MachinePlotWidget.py    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, parent, label="", *args, **kwargs):
        QtWidgets.QGroupBox.__init__(self, label, *args, **kwargs)
        self.parent = parent
        self.setLayout(QtWidgets.QGridLayout())

        self.fig, self.axes = subplots()
        self.canvas = FigureCanvas(self.fig)

        self.layout().addWidget(self.canvas, 0, 0, 1, 1)

        self.axes.axis("equal") 
Example #27
Source Project: dash-masternode-tool   Author: Bertrand256   File: hw_common.py    License: MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("SelectHWDevice")
        self.lay_main = QtWidgets.QVBoxLayout(Form)
        self.lay_main.setContentsMargins(-1, 3, -1, 3)
        self.lay_main.setObjectName("lay_main")
        self.gb_devices = QtWidgets.QGroupBox(Form)
        self.gb_devices.setFlat(False)
        self.gb_devices.setCheckable(False)
        self.gb_devices.setObjectName("gb_devices")
        self.lay_main.addWidget(self.gb_devices)

        self.lay_devices = QtWidgets.QVBoxLayout(self.gb_devices)
        for idx, dev in enumerate(self.device_list):
            rb = QRadioButton(self.gb_devices)
            rb.setText(dev)
            rb.toggled.connect(partial(self.on_item_toggled, idx))
            self.device_radiobutton_list.append(rb)
            self.lay_devices.addWidget(rb)

        self.btn_main = QtWidgets.QDialogButtonBox(Form)
        self.btn_main.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        self.btn_main.setObjectName("btn_main")
        self.lay_main.addWidget(self.btn_main)
        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
        self.setFixedSize(self.sizeHint()) 
Example #28
Source Project: kite   Author: pyrocko   File: qt_utils.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("QRangeSlider")
        Form.resize(300, 30)
        Form.setStyleSheet(DEFAULT_CSS)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        # self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")

        self._splitter = QtWidgets.QSplitter(Form)
        self._splitter.setMinimumSize(QtCore.QSize(0, 0))
        self._splitter.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self._splitter.setOrientation(QtCore.Qt.Horizontal)
        self._splitter.setObjectName("splitter")

        self._head = QtWidgets.QGroupBox(self._splitter)
        self._head.setTitle("")
        self._head.setObjectName("Head")
        self._handle = QtWidgets.QGroupBox(self._splitter)
        self._handle.setTitle("")
        self._handle.setObjectName("Span")

        self._tail = QtWidgets.QGroupBox(self._splitter)
        self._tail.setTitle("")
        self._tail.setObjectName("Tail")
        self.gridLayout.addWidget(self._splitter, 0, 0, 1, 1)

        # self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example #29
Source Project: 3d-nii-visualizer   Author: adamkwolf   File: MainWindow.py    License: MIT License 5 votes vote down vote up
def add_vtk_window_widget(self):
        base_brain_file = os.path.basename(self.app.BRAIN_FILE)
        base_mask_file = os.path.basename(self.app.MASK_FILE)
        object_title = "Brain: {0} (min: {1:.2f}, max: {2:.2f})        Mask: {3}".format(base_brain_file,
                                                                                         self.brain.scalar_range[0],
                                                                                         self.brain.scalar_range[1],
                                                                                         base_mask_file)
        object_group_box = QtWidgets.QGroupBox(object_title)
        object_layout = QtWidgets.QVBoxLayout()
        object_layout.addWidget(self.vtk_widget)
        object_group_box.setLayout(object_layout)
        self.grid.addWidget(object_group_box, 0, 2, 5, 5)
        # must manually set column width for vtk_widget to maintain height:width ratio
        self.grid.setColumnMinimumWidth(2, 700) 
Example #30
Source Project: 3d-nii-visualizer   Author: adamkwolf   File: MainWindow.py    License: MIT License 5 votes vote down vote up
def add_brain_settings_widget(self):
        brain_group_box = QtWidgets.QGroupBox("Brain Settings")
        brain_group_layout = QtWidgets.QGridLayout()
        brain_group_layout.addWidget(QtWidgets.QLabel("Brain Threshold"), 0, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Brain Opacity"), 1, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Brain Smoothness"), 2, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Image Intensity"), 3, 0)
        brain_group_layout.addWidget(self.brain_threshold_sp, 0, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_opacity_sp, 1, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_smoothness_sp, 2, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_lut_sp, 3, 1, 1, 2)
        brain_group_layout.addWidget(self.brain_projection_cb, 4, 0)
        brain_group_layout.addWidget(self.brain_slicer_cb, 4, 1)
        brain_group_layout.addWidget(self.create_new_separator(), 5, 0, 1, 3)
        brain_group_layout.addWidget(QtWidgets.QLabel("Axial Slice"), 6, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Coronal Slice"), 7, 0)
        brain_group_layout.addWidget(QtWidgets.QLabel("Sagittal Slice"), 8, 0)

        # order is important
        slicer_funcs = [self.axial_slice_changed, self.coronal_slice_changed, self.sagittal_slice_changed]
        current_label_row = 6
        # data extent is array [xmin, xmax, ymin, ymax, zmin, zmax)
        # we want all the max values for the range
        extent_index = 5
        for func in slicer_funcs:
            slice_widget = QtWidgets.QSlider(Qt.Qt.Horizontal)
            slice_widget.setDisabled(True)
            self.slicer_widgets.append(slice_widget)
            brain_group_layout.addWidget(slice_widget, current_label_row, 1, 1, 2)
            slice_widget.valueChanged.connect(func)
            slice_widget.setRange(self.brain.extent[extent_index - 1], self.brain.extent[extent_index])
            slice_widget.setValue(self.brain.extent[extent_index] / 2)
            current_label_row += 1
            extent_index -= 2

        brain_group_box.setLayout(brain_group_layout)
        self.grid.addWidget(brain_group_box, 0, 0, 1, 2)