How to use the qtpy.QtWidgets function in QtPy

To help you get started, we’ve selected a few QtPy 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 VIDA-NYU / reprozip / reprounzip-qt / reprounzip_qt / gui / run.py View on Github external
def __init__(self):
        super(DockerOptions, self).__init__()

        self.x11 = QtWidgets.QCheckBox("enabled", checked=False)
        self.tunneled_x11 = QtWidgets.QCheckBox("use tunnel", checked=False)
        row = QtWidgets.QHBoxLayout()
        row.addWidget(self.x11)
        row.addWidget(self.tunneled_x11)
        row.addStretch(1)
        self.add_row_layout("X11 display:", row)

        self.detach = QtWidgets.QCheckBox("start background container and "
                                          "leave it running",
                                          checked=False)
        self.add_row("Detach:", self.detach)

        self.raw_options = QtWidgets.QLineEdit('')
        self.add_row("Raw Docker options:", self.raw_options)

        self.ports = QtWidgets.QLineEdit(
github ScopeFoundry / ScopeFoundry / helper_funcs.py View on Github external
def eventFilter(self, obj, event):
        """
        Listens for QtCore.QEvent.Close signal and asks the user whether to
        close the app in a pop-up dialog."""
        if event.type() == QtCore.QEvent.Close:
            # eat close event
            logging.debug("close")
            reply = QtWidgets.QMessageBox.question(None, 
                                               self.title, 
                                               self.message,
                                               QtWidgets.QMessageBox.Yes, 
                                               QtWidgets.QMessageBox.No)
            if reply == QtWidgets.QMessageBox.Yes:
                logging.debug("closing")
                if self.func_on_close:
                    self.func_on_close()
                QtWidgets.QApplication.quit()
                event.accept()
            else:
                event.ignore()
            return True
        else:
            # standard event processing            
            return QtCore.QObject.eventFilter(self,obj, event)
github hydrusnetwork / hydrus / hydrus / client / gui / lists / ClientGUIListBoxes.py View on Github external
def __init__( self, parent, height_num_chars, data_to_pretty_callable, add_callable, edit_callable ):
        
        self._data_to_pretty_callable = data_to_pretty_callable
        self._add_callable = add_callable
        self._edit_callable = edit_callable
        
        QW.QWidget.__init__( self, parent )
        
        self._listbox = BetterQListWidget( self )
        self._listbox.setSelectionMode( QW.QListWidget.ExtendedSelection )
        
        self._add_button = ClientGUICommon.BetterButton( self, 'add', self._Add )
        self._edit_button = ClientGUICommon.BetterButton( self, 'edit', self._Edit )
        self._delete_button = ClientGUICommon.BetterButton( self, 'delete', self._Delete )
        
        self._enabled_only_on_selection_buttons = []
        
        self._permitted_object_types = []
        
        #
        
        vbox = QP.VBoxLayout()
        
        self._buttons_hbox = QP.HBoxLayout()
        
        QP.AddToLayout( self._buttons_hbox, self._add_button, CC.FLAGS_EXPAND_BOTH_WAYS )
github flika-org / flika / flika / app / plugin_manager.py View on Github external
def removePlugin(plugin):
        PluginManager.gui.statusBar.showMessage("Uninstalling {}".format(plugin.name))
        if os.path.isdir(os.path.join(plugin_dir, plugin.directory, '.git')):
            g.alert("This plugin's directory is managed by git. To remove, manually delete the directory")
            return False
        try:
            shutil.rmtree(os.path.join(plugin_dir, plugin.directory), ignore_errors=True)
            plugin.version = ''
            plugin.menu = None
            plugin.listWidget.setIcon(QtGui.QIcon())
            PluginManager.gui.statusBar.showMessage('{} successfully uninstalled'.format(plugin.name))
        except Exception as e:
            g.alert(title="Plugin Uninstall Failed", msg="Unable to remove the folder at %s\n%s\nDelete the folder manually to uninstall the plugin" % (plugin.name, e), icon=QtWidgets.QMessageBox.Warning)

        PluginManager.gui.pluginSelected(plugin.listWidget)
        plugin.installed = False
github Ulm-IQO / qudi / gui / nuclear_operations / nuclear_operations.py View on Github external
Copyright (c) the Qudi Developers. See the COPYRIGHT.txt file at the
top-level directory of this distribution and at 
"""

import datetime
import os
import pyqtgraph as pg
import pyqtgraph.exporters

from core.connector import Connector
from gui.guibase import GUIBase
from qtpy import QtGui, QtWidgets, QtCore, uic


class NuclearOperationsMainWindow(QtWidgets.QMainWindow):
    def __init__(self):
        # Get the path to the *.ui file
        this_dir = os.path.dirname(__file__)
        ui_file = os.path.join(this_dir, 'ui_nuclear_operations_gui.ui')

        # Load it
        super(NuclearOperationsMainWindow, self).__init__()
        uic.loadUi(ui_file, self)
        self.show()


class NuclearOperationsGui(GUIBase):
    """ This is the main GUI Class for Nuclear Operations. """

    # declare connectors
    nuclearoperationslogic = Connector(interface='NuclearOperationsLogic')
github mantidproject / mantid / scripts / Muon / GUI / Common / load_widget / load_view.py View on Github external
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
#     NScD Oak Ridge National Laboratory, European Spallation Source
#     & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import absolute_import

from qtpy import QtWidgets, QtCore

from mantidqt.widgets import manageuserdirectories


class LoadView(QtWidgets.QWidget):
    sig_loading_finished = QtCore.Signal()

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

        self.browse_button = QtWidgets.QPushButton("User Dirs", self)
        self.browse_button.clicked.connect(self.show_directory_manager)

        self.co_button = QtWidgets.QPushButton("Co-Add", self)
        self.load_button = QtWidgets.QPushButton("Load", self)

        self.spinbox = QtWidgets.QSpinBox(self)
        self.spinbox.setRange(0, 99999)
        self.spinbox.setValue(0)
        self.last_spinbox_val = 0
github scikit-rf / scikit-rf / qtapps / skrf_qtwidgets / widgets.py View on Github external
def showEvent(self, event):
        self.resize(self.width() * 1.25, self.height())
        qr = self.frameGeometry()
        cp = QtWidgets.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIPages.py View on Github external
self._controller = controller
        
        self._page_key = self._controller.AcquirePageKey()
        
        self._management_controller = management_controller
        
        self._initial_hashes = initial_hashes
        
        self._management_controller.SetKey( 'page', self._page_key )
        
        self._initialised = False
        
        self._pretty_status = ''
        
        self._search_preview_split = QW.QSplitter( self )
        
        self._done_split_setups = False
        
        self._management_panel = ClientGUIManagement.CreateManagementPanel( self._search_preview_split, self, self._controller, self._management_controller )
        
        self._preview_panel = QW.QFrame( self._search_preview_split )
        self._preview_panel.setFrameStyle( QW.QFrame.Panel | QW.QFrame.Sunken )
        self._preview_panel.setLineWidth( 2 )
        
        self._preview_canvas = ClientGUICanvas.CanvasPanel( self._preview_panel, self._page_key )
        
        self._media_panel = self._management_panel.GetDefaultEmptyMediaPanel()
        
        vbox = QP.VBoxLayout( margin = 0 )
        
        QP.AddToLayout( vbox, self._preview_canvas, CC.FLAGS_EXPAND_SIZER_BOTH_WAYS )
github Fluorescence-Tools / chisurf / chisurf / gui / tools / structure / save_topology / __init__.py View on Github external
def onSaveTopology(self):
        target_filename = str(QtWidgets.QFileDialog.getSaveFileName(None, 'Save PDB-file', '', 'PDB-files (*.pdb)'))[0]
        filename = self.trajectory_filename
        # Make empty trajectory
        frame_0 = md.load_frame(filename, 0)
        frame_0.save(target_filename)
github glue-viz / glue / glue / dialogs / common / qt / component_tree_widget.py View on Github external
from __future__ import absolute_import, division, print_function

from qtpy import QtWidgets, QtCore
from qtpy.QtCore import Qt

__all__ = ['ComponentTreeWidget']


class ComponentTreeWidget(QtWidgets.QTreeWidget):

    order_changed = QtCore.Signal()

    def select_cid(self, cid):
        for item in self:
            if item.data(0, Qt.UserRole) is cid:
                self.select_item(item)
                return
        raise ValueError("Could not find find cid {0} in list".format(cid))

    def select_item(self, item):
        self.selection = self.selectionModel()
        self.selection.select(QtCore.QItemSelection(self.indexFromItem(item, 0),
                                                    self.indexFromItem(item, self.columnCount() - 1)),
                              QtCore.QItemSelectionModel.ClearAndSelect)