How to use the pyface.qt.QtGui.QVBoxLayout function in pyface

To help you get started, we’ve selected a few pyface examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpteague / cytoflow / cytoflowgui / flow_task_pane.py View on Github external
def create(self, parent):
        if self.canvas is not None:
            return
        
        # create a layout for the tab widget and the main view
        self.layout = layout = QtGui.QVBoxLayout()          # @UndefinedVariable
        self.control = QtGui.QWidget()                      # @UndefinedVariable
        self.control.setLayout(layout)
        
        tabs_ui = self.model.edit_traits(view = 'plot_view',
                                         kind = 'subpanel',
                                         parent = parent)
        self.layout.addWidget(tabs_ui.control) 
        
        # add the main plot
        self.canvas = FigureCanvasQTAggLocal(Figure(), 
                                             self.model.child_matplotlib_conn, 
                                             self.waiting_image.create_image(size = (1000, 1000)))
        self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding,  # @UndefinedVariable
                                  QtGui.QSizePolicy.Expanding)  # @UndefinedVariable
        
        layout.addWidget(self.canvas)
github enthought / traitsui / traitsui / qt4 / table_editor.py View on Github external
if self.factory.sortable and not self.factory.reorderable:
            self.model.sort(0, QtCore.Qt.AscendingOrder)

        # Connect to the mode specific selection handler and select the first
        # row/column/cell. Do this before creating the edit_view to make sure
        # that it has a valid item to use when constructing its view.
        smodel = self.table_view.selectionModel()
        signal = QtCore.SIGNAL('selectionChanged(QItemSelection, QItemSelection)')
        mode_slot = getattr(self, '_on_%s_selection' % factory.selection_mode)
        QtCore.QObject.connect(smodel, signal, mode_slot)
        self.table_view.setCurrentIndex(self.model.index(0, 0))

        # Create the toolbar if necessary
        if factory.show_toolbar and len(factory.filters) > 0:
            main_view = QtGui.QWidget()
            layout = QtGui.QVBoxLayout(main_view)
            layout.setContentsMargins(0, 0, 0, 0)
            self.toolbar_ui = self.edit_traits(
                parent = parent,
                kind = 'subpanel',
                view = View(Group(Item('filter{View}',
                                       editor = factory._filter_editor ),
                                  Item('filter_summary{Results}',
                                       style = 'readonly'),
                                  spring,
                                  orientation='horizontal'),
                            resizable = True))
            self.toolbar_ui.parent = self.ui
            layout.addWidget(self.toolbar_ui.control)
            layout.addWidget(self.table_view)
        else:
            main_view = self.table_view
github JannickWeisshaupt / OpenDFT / main.py View on Github external
self.sub_main_widget = QtGui.QWidget(self)
        self.main_layout.addWidget(self.sub_main_widget)
        self.sub_main_layout = QtGui.QHBoxLayout(self.sub_main_widget)

        self.structure_visualization = MayaviQWidget(self.crystal_structure,parent=self)
        self.sub_main_layout.addWidget(self.structure_visualization)

        self.structure_widget = QtGui.QWidget(self)
        self.sub_main_layout.addWidget(self.structure_widget)

        self.verticalLayout = QtGui.QVBoxLayout(self.structure_widget)
        self.unit_cell_box = QtGui.QGroupBox(self.structure_widget)
        self.unit_cell_box.setTitle('Unit Cell')
        self.verticalLayout.addWidget(self.unit_cell_box)

        self.unit_cell_layout = QtGui.QVBoxLayout(self.unit_cell_box)
        self.unit_cell_layout.setAlignment(QtCore.Qt.AlignTop)

        unit_cell_option_widget = QtGui.QWidget(self.unit_cell_box)
        # unit_cell_option_widget.setFixedHeight(10)
        self.unit_cell_option_layout = QtGui.QHBoxLayout(unit_cell_option_widget)
        self.unit_cell_option_layout.setAlignment(QtCore.Qt.AlignLeft)
        self.unit_cell_layout.addWidget(unit_cell_option_widget)

        self.scale_entry = EntryWithLabel(self, 'Scale')
        self.scale_entry.setFixedHeight(50)
        self.unit_cell_option_layout.addWidget(self.scale_entry)
        self.scale_entry.set_text('1.0')
        self.scale_entry.connect_editFinished(self.handle_change)

        self.periodic_checkbox = QtGui.QCheckBox('Periodic', parent=self)
        self.periodic_checkbox.toggle()
github enthought / traitsui / traitsui / qt4 / ui_base.py View on Github external
def __init__(self, ui, parent):
        """Initialise the dialog."""

        QtGui.QDialog.__init__(self, parent)

        # Create the main window so we can add toolbars etc.
        self._mw = QtGui.QMainWindow()
        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._mw)
        self.setLayout(layout)

        # Set the dialog's window flags and properties.
        if ui.view.resizable:
            flags = QtCore.Qt.Window
        else:
            flags = QtCore.Qt.Dialog | QtCore.Qt.WindowSystemMenuHint
            layout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
            if ui.view.resizable:
                flags |= QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowMaximizeButtonHint
        try:
            flags |= QtCore.Qt.WindowCloseButtonHint
            if ui.view.resizable:
                flags |= (QtCore.Qt.WindowMinimizeButtonHint |
github enthought / pyface / pyface / ui / qt4 / about_dialog.py View on Github external
# Set the page contents.
        label.setText(self._create_html())

        # Create the button.
        buttons = QtGui.QDialogButtonBox()

        if self.ok_label:
            buttons.addButton(self.ok_label, QtGui.QDialogButtonBox.AcceptRole)
        else:
            buttons.addButton(QtGui.QDialogButtonBox.Ok)

        buttons.accepted.connect(parent.accept)
        self._connections_to_remove.append((buttons.accepted, parent.accept))

        lay = QtGui.QVBoxLayout()
        lay.addWidget(label)
        lay.addWidget(buttons)

        parent.setLayout(lay)
github bpteague / cytoflow / cytoflowgui / vertical_notebook.py View on Github external
# The current open status of the notebook page:
    is_open = Bool(False)

    # The minimum size for the page:
    min_size = Property

    #-- Private Traits -------------------------------------------------------

    # The notebook this page is associated with:
    notebook = Instance('VerticalNotebook')

    # The control representing the open page:
    control = Property
    
    # The layout for the controls
    layout = Instance(QtGui.QVBoxLayout)
    
    # the control representing the command button.  need to keep it around
    # so we can update its name, desc, and icon dynamaically
    cmd_button = Instance(QtGui.QCommandLinkButton)
    
    # the control representing the "delete" button, if the notebook has them
    del_button = Instance(QtGui.QPushButton)

    #-- Public Methods -------------------------------------------------------


    def dispose(self):
        """ Removes this notebook page. """
 
        if self.name_object is not None:
            self.name_object.on_trait_change(self._name_updated,
github enthought / pyface / pyface / ui / qt4 / wizard / wizard_page.py View on Github external
def create_page(self, parent):
        """ Creates the wizard page. """

        content = self._create_page_content(parent)

        # We allow some flexibility with the sort of control we are given.
        if not isinstance(content, QtGui.QWizardPage):
            wp = _WizardPage(self)

            if isinstance(content, QtGui.QLayout):
                wp.setLayout(content)
            else:
                assert isinstance(content, QtGui.QWidget)

                lay = QtGui.QVBoxLayout()
                lay.addWidget(content)

                wp.setLayout(lay)

            content = wp

        # Honour any requested page size.
        if self.size:
            width, height = self.size

            if width > 0:
                content.setMinimumWidth(width)

            if height > 0:
                content.setMinimumHeight(height)
github JannickWeisshaupt / OpenDFT / visualization.py View on Github external
self.last_dos = None
        self.canvas = FigureCanvas(self.figure)

        self.toolbar = NavigationToolbar(self.canvas, self)

        color = self.palette().color(QtGui.QPalette.Base)
        self.figure.patch.set_facecolor([color.red() / 255, color.green() / 255, color.blue() / 255])

        if sum([color.red(), color.blue(), color.green()]) / 3 < 100:
            self.dark_mode = True
            self.bg_color = [color.red() / 255, color.green() / 255, color.blue() / 255]
        else:
            self.dark_mode = False
            self.bg_color = None

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.toolbar)
        layout.addWidget(self.canvas)

        option_widget = QtGui.QWidget()
        option_widget.setFixedHeight(60)
        option_layout = QtGui.QHBoxLayout(option_widget)
        option_layout.setAlignment(QtCore.Qt.AlignLeft)
        layout.addWidget(option_widget)
        from main import EntryWithLabel

        width_text = 70
        width_label = 40

        self.Emin_entry = EntryWithLabel(option_widget, 'Emin', width_text=width_text, width_label=width_label)
        self.Emin_entry.setValidator(QtGui.QDoubleValidator())
        self.Emin_entry.connect_editFinished(lambda: self.plot(self.last_dos))
github NMGRL / pychron / launchers / helpers.py View on Github external
isinstance(parent, QtGui.QTabWidget)):
            title = ""

        # ============ Monkey Patch ===============
        if isinstance(parent, QtGui.QTabWidget):
            bar = parent.tabBar()
            if not isinstance(bar, myQTabBar):
                parent.setTabBar(myQTabBar())
        # =========================================

        # Panels must be widgets as it is only the TraitsUI PyQt code that can
        # handle them being layouts as well.  Therefore create a widget if the
        # panel is not a widget or if we need a title or buttons.
        if not isinstance(self.control, QtGui.QWidget) or title != "" or has_buttons:
            w = QtGui.QWidget()
            layout = QtGui.QVBoxLayout(w)
            layout.setContentsMargins(0, 0, 0, 0)

            # Handle any view title.
            if title != "":
                layout.addWidget(heading_text(None, text=view.title).control)

            if isinstance(self.control, QtGui.QWidget):
                layout.addWidget(self.control)
            elif isinstance(self.control, QtGui.QLayout):
                layout.addLayout(self.control)

            self.control = w

            # Add any buttons.
            if has_buttons: