Python PyQt5.QtWidgets.QVBoxLayout() Examples

The following are code examples for showing how to use PyQt5.QtWidgets.QVBoxLayout(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: Micchinetta   Author: SqrtPapere   File: DatabaseManager.py    MIT License 6 votes vote down vote up
def __init__(self):
        """Class constructor that sets up the window layout and allocates attributes"""
        super().__init__()
        self.title = 'Database Manager - Edit'
        self.vLayout = QVBoxLayout()
        self.model = QSqlTableModel(self, db)
        self.model.setTable('faces')
        self.model.select()
        self.table = QTableView(self)
        self.table.setModel(self.model)
        self.table.hideColumn(0)
        self.table.hideColumn(7)
        self.deleteButton = QPushButton("Delete")
        self.deleteButton.clicked.connect(self.delete_row)
        self.vLayout.addWidget(self.table)
        self.vLayout.addWidget(self.deleteButton)
        self.setLayout(self.vLayout)
        self.setFixedSize(600,400)
        self.show() 
Example 2
Project: Micchinetta   Author: SqrtPapere   File: DatabaseManager.py    MIT License 6 votes vote down vote up
def __init__(self, d):
        """Class constructor that sets up the window layout and allocates attributes"""
        super().__init__()
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                      | QDialogButtonBox.Cancel)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)

        self.vLayout = QVBoxLayout()

        self.le_dict = {}

        for key in d:
            h = QHBoxLayout()
            h.addWidget(QLabel(key))
            qe = QLineEdit()
            self.le_dict[key] = qe
            h.addWidget(qe)
            self.vLayout.addLayout(h)

        self.vLayout.addWidget(self.buttonBox)

        self.setLayout(self.vLayout) 
Example 3
Project: Micchinetta   Author: SqrtPapere   File: DatabaseManager.py    MIT License 6 votes vote down vote up
def initUI(self):
        """Method to set up the window layout and user interface"""
        self.setWindowTitle(self.title)
        self.setFixedSize(self.width, self.height)

        self.photo_button = QPushButton("Take Photo")
        self.label = CustomLabel('Drop here', self)
        self.label.setAlignment(Qt.AlignCenter)
        layout = QVBoxLayout()
        layout.addWidget(self.label)
        layout.addWidget(self.photo_button)
        self.setLayout(layout)
        self.show()
        self.photo_button.clicked.connect(self.take_photo)
        self.picture = GetPicture()
        self.picture.face_recognizer.person_identified.connect(self.photo_taken) 
Example 4
Project: openocd-svd   Author: esynr3z   File: ui_svd.py    MIT License 6 votes vote down vote up
def setupUi(self, SVDDialog):
        SVDDialog.setObjectName("SVDDialog")
        SVDDialog.resize(400, 500)
        self.verticalLayout = QtWidgets.QVBoxLayout(SVDDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.tree_svd = QtWidgets.QTreeWidget(SVDDialog)
        self.tree_svd.setObjectName("tree_svd")
        self.tree_svd.headerItem().setText(0, "1")
        self.verticalLayout.addWidget(self.tree_svd)
        self.btn_dialog = QtWidgets.QDialogButtonBox(SVDDialog)
        self.btn_dialog.setOrientation(QtCore.Qt.Horizontal)
        self.btn_dialog.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.btn_dialog.setObjectName("btn_dialog")
        self.verticalLayout.addWidget(self.btn_dialog)

        self.retranslateUi(SVDDialog)
        self.btn_dialog.accepted.connect(SVDDialog.accept)
        self.btn_dialog.rejected.connect(SVDDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(SVDDialog) 
Example 5
Project: ILTIS   Author: grg2rsr   File: Options_Control_Widget.py    GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, dict_name, param_name, rows, columns, dtype):
        super(StimRegionWidget,self).__init__(parent=parent)

        self.parent = parent
        self.dict_name = dict_name
        self.param_name = param_name

        self.StimTable = ArrayWidget(parent, dict_name, param_name, rows, columns, dtype)
        self.PlusButton = QtWidgets.QPushButton('+')
        self.MinusButton = QtWidgets.QPushButton('-')

        BtnLayout = QtWidgets.QHBoxLayout()
        BtnLayout.addWidget(self.PlusButton)
        BtnLayout.addWidget(self.MinusButton)
#
        AllLayout = QtWidgets.QVBoxLayout()
        AllLayout.addLayout(BtnLayout)
        AllLayout.addWidget(self.StimTable)

        self.setLayout(AllLayout) 
Example 6
Project: pywerami   Author: ondrolexa   File: mainapp.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, version, parent=None):
        """Display a dialog that shows application information."""
        super(AboutDialog, self).__init__(parent)

        self.setWindowTitle('About')
        self.resize(300, 100)

        about = QtWidgets.QLabel('PyWerami {}\nstand-alone program to make an countour/3D plot from a contour data'.format(version))
        about.setAlignment(QtCore.Qt.AlignCenter)

        author = QtWidgets.QLabel('Ondrej Lexa')
        author.setAlignment(QtCore.Qt.AlignCenter)

        github = QtWidgets.QLabel('GitHub: <a href="https://github.com/ondrolexa/pywerami">ondrolexa</a>')
        github.setAlignment(QtCore.Qt.AlignCenter)
        github.setOpenExternalLinks(True)

        self.layout = QtWidgets.QVBoxLayout()
        self.layout.setAlignment(QtCore.Qt.AlignVCenter)

        self.layout.addWidget(about)
        self.layout.addWidget(author)
        self.layout.addWidget(github)

        self.setLayout(self.layout) 
Example 7
Project: idasec   Author: RobinDavid   File: idasec.py    GNU Lesser General Public License v2.1 6 votes vote down vote up
def setupUi(self, Master):
        Master.setObjectName("Master")
        Master.resize(718, 477)
        self.verticalLayout = QtWidgets.QVBoxLayout(Master)
        self.verticalLayout.setObjectName("verticalLayout")
        self.splitter = QtWidgets.QSplitter(Master)
        self.splitter.setOrientation(QtCore.Qt.Vertical)
        self.splitter.setObjectName("splitter")
        self.tab_widget = QtWidgets.QTabWidget(self.splitter)
        self.tab_widget.setObjectName("tab_widget")

        self.docker = QtWidgets.QDockWidget(self.splitter)
        self.docker.setObjectName("docker")
        self.docker.setAllowedAreas(QtCore.Qt.BottomDockWidgetArea)

        self.log_widget = QtWidgets.QTreeWidget(self.docker)
        self.log_widget.setHeaderItem(QtWidgets.QTreeWidgetItem(["date", "origin", "type", "message"]))
        self.docker.setWidget(self.log_widget)

        self.verticalLayout.addWidget(self.splitter)
        self.tab_widget.setCurrentIndex(-1)
        QtCore.QMetaObject.connectSlotsByName(Master)
        Master.setWindowTitle("IDASec") 
Example 8
Project: dcc   Author: amimo   File: resourceswindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, session=None):
        super(ResourcesWindow, self).__init__(parent)
        self.mainwin = win
        self.session = session
        self.title = "Resources"

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter resource integer pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.resourceswindow = ResourcesValueWindow(self, win, session)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.resourceswindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 9
Project: dcc   Author: amimo   File: methodswindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, session=None):
        super(MethodsWindow, self).__init__(parent)
        self.mainwin = win
        self.session = session
        self.title = "Methods"

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter method name pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.methodswindow = MethodsValueWindow(self, win, session)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.methodswindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 10
Project: dcc   Author: amimo   File: apiwindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, session=None):
        super(APIWindow, self).__init__(parent)
        self.mainwin = win
        self.session = session
        self.title = "API"

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter method name pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.methodswindow = APIValueWindow(self, win, session)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.methodswindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 11
Project: Python_Master_Courses   Author: makelove   File: input_button_clear.py    GNU General Public License v3.0 6 votes vote down vote up
def initUI(self):
        self.inputLabel = QLabel("Input your text")
        self.editLine = QLineEdit()
        self.printButton = QPushButton("Print")
        self.clearButton = QPushButton("Clear")

        self.printButton.clicked.connect(self.printText)
        self.clearButton.clicked.connect(self.clearText)

        inputLayout = QHBoxLayout()
        inputLayout.addWidget(self.inputLabel)
        inputLayout.addWidget(self.editLine)

        buttonLayout = QHBoxLayout()
        buttonLayout.addWidget(self.printButton)
        buttonLayout.addWidget(self.clearButton)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(inputLayout)
        mainLayout.addLayout(buttonLayout)

        self.setLayout(mainLayout)
        self.setWindowTitle('FristWindow')
        self.show() 
Example 12
Project: kucher   Author: Zubax   File: active_alerts_widget.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent: QWidget):
        super(ActiveAlertsWidget, self).__init__(parent, 'Active alerts', _ICON_OK)

        self._content = QLabel()
        self._content.setWordWrap(True)
        self._content.setAlignment(Qt.AlignCenter)

        font = QFont()
        font.setBold(True)
        font.setPointSize(round(font.pointSize() * 0.8))
        self._content.setFont(font)

        layout = QVBoxLayout()
        layout.addStretch(1)
        layout.addWidget(self._content)
        layout.addStretch(1)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        self.reset() 
Example 13
Project: kucher   Author: Zubax   File: __init__.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent: QWidget):
        super(LogWidget, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)                  # This is required to stop background timers!

        self._clear_button = make_button(self, 'Clear', 'delete-document', on_clicked=self._do_clear)
        self._status_display = QLabel(self)

        self._model = _TableModel(self)
        self._model.layoutChanged.connect(self._on_model_changed)

        self._table_view = _TableView(self, self._model)

        # View setup
        controls_layout = QHBoxLayout()
        controls_layout.addWidget(self._clear_button)
        controls_layout.addStretch(1)
        controls_layout.addWidget(self._status_display)

        layout = QVBoxLayout()
        layout.addLayout(controls_layout)
        layout.addWidget(self._table_view, 1)
        self.setLayout(layout) 
Example 14
Project: QuantStudio   Author: Scorpi000   File: ResultDlg.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None, table_widget=None, timely_modified=False):
        super().__init__(parent)
        self.setObjectName("_TableDlg")
        self.resize(346, 472)
        self.setSizeGripEnabled(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(self)
        if table_widget is not None:
            self.MainTable = table_widget
            self.MainTable.setParent(self)
        else:
            self.MainTable = QtWidgets.QTableWidget(self)
        self.MainTable.TimelyModified = timely_modified
        self.MainTable.setObjectName("MainTable")
        self.verticalLayout.addWidget(self.MainTable)
        self.buttonBox = QtWidgets.QDialogButtonBox(self)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)
        self.isOK = False
        _translate = QtCore.QCoreApplication.translate
        self.setWindowTitle(_translate("_TableDlg", "_TableDlg", None))
        QtCore.QMetaObject.connectSlotsByName(self)
        return 
Example 15
Project: cct   Author: awacha   File: anisotropy.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def setupUi(self, MainWindow):
        super().setupUi(MainWindow)
        self.setWindowTitle('Anisotropy Evaluator [*]')
        self.plotimage = PlotImage(self, False)
        self.plotimage.figure.clf()
        self.plotimage.axes = self.plotimage.figure.add_subplot(2, 2, 1)
        self.plotimage.axes.set_facecolor('black')
        self.plotimage.axes.set_title('2D scattering pattern')
        self.axes_full = self.plotimage.figure.add_subplot(2, 2, 2)
        self.axes_azim = self.plotimage.figure.add_subplot(2, 2, 3)
        self.axes_slice = self.plotimage.figure.add_subplot(2, 2, 4)
        self.vboxLayout = QtWidgets.QVBoxLayout()
        self.vboxLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.vboxLayout)
        if self.credo is not None:
            self.fsnSelector = FSNSelector(self, credo=self.credo, horizontal=True)
            self.vboxLayout.addWidget(self.fsnSelector)
            self.fsnSelector.FSNSelected.connect(self.onFSNSelected)
        self.h5Selector = H5Selector(self, horizontal=True)
        self.vboxLayout.addWidget(self.h5Selector)
        self.h5Selector.H5Selected.connect(self.onH5Selected)
        self.vboxLayout.addWidget(self.plotimage, stretch=1)
        self.plotimage.figure.tight_layout()
        self.plotimage.canvas.draw() 
Example 16
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 6 votes vote down vote up
def leadBox(self):
        lead_box = QtWidgets.QGroupBox('Lead')
        lead_layout = QtWidgets.QVBoxLayout()
        lead_layout.setSpacing(2)
        lead_layout.setContentsMargins(2, 2, 2, 2)
        lead_box.setLayout(lead_layout)

        self.parameters['lead'] = QtWidgets.QComboBox()
        self.parameters['lead'].addItem("None")
        self.parameters['lead'].setToolTip("Lead instrument to follow")
        self.parameters['lead'].setFrame(False)
        self.parameters['lead'].currentIndexChanged.connect(self.parameterChanged)
        lead_layout.addWidget(self.parameters['lead'])

        self.parameters['lead_mode'] = QtWidgets.QComboBox()
        self.parameters['lead_mode'].addItems(['both', 'melody'])
        self.parameters['lead_mode'].setVisible(False)
        self.parameters['lead_mode'].setToolTip("Take either 'melody' from lead instrument or 'both' melody and rhythm")
        self.parameters['lead_mode'].currentIndexChanged.connect(self.parameterChanged)
        lead_layout.addWidget(self.parameters['lead_mode'])

        return lead_box 
Example 17
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 6 votes vote down vote up
def sampleBox(self):
        sample_box = QtWidgets.QGroupBox('Sample')
        sample_layout = QtWidgets.QVBoxLayout()
        sample_layout.setSpacing(2)
        sample_layout.setContentsMargins(2, 2, 2, 2)
        sample_box.setLayout(sample_layout)

        self.parameters['sample_mode'] = QtWidgets.QComboBox()
        self.parameters['sample_mode'].addItems(['best', 'top', 'dist'])
        self.parameters['sample_mode'].setToolTip("Either take the most likely ('best'), from the top 5 best ('top'), or draw from the full distribution of possible notes and rhythms ('dist')")
        self.parameters['sample_mode'].setCurrentText('dist')
        self.parameters['sample_mode'].currentIndexChanged.connect(self.parameterChanged)
        sample_layout.addWidget(self.parameters['sample_mode'])

        self.parameters['chord_mode'] = QtWidgets.QSpinBox()
        self.parameters['chord_mode'].setRange(0, 4)
        self.parameters['chord_mode'].setSpecialValueText('auto')
        self.parameters['chord_mode'].setToolTip('Chord mode')
        self.parameters['chord_mode'].valueChanged.connect(self.parameterChanged)
        sample_layout.addWidget(self.parameters['chord_mode'])

        return sample_box 
Example 18
Project: PyLSS   Author: gmrandazzo   File: chromanalyzer.py    GNU Lesser General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super(ChromAnalyzer, self).__init__(parent)
        self.setupUi(self)

        self.openChromButton.clicked.connect(self.openchrom)
        self.analyzeButton.clicked.connect(self.analyze)
        self.aboutButton.clicked.connect(self.about)
        self.quitButton.clicked.connect(self.quit)

        self.tablemodel = TableModel(self)
        self.tableView.setModel(self.tablemodel)
        self.tableView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.tableView.customContextMenuRequested.connect(self.openTableMenu)

        # Add plot
        self.figure = plt.figure(dpi=100)
        self.ax = self.figure.add_subplot(111)
        self.canvas = FigureCanvas(self.figure)
        self.toolbar = NavigationToolbar(self.canvas, self)
        self.toolbar.hide()

        # set the layout
        layout_chormatogram = QtWidgets.QVBoxLayout()
        layout_chormatogram.addWidget(self.canvas)
        self.plotterBox.setLayout(layout_chormatogram) 
Example 19
Project: openocd-svd   Author: esynr3z   File: ui_about.py    MIT License 5 votes vote down vote up
def setupUi(self, AboutDialog):
        AboutDialog.setObjectName("AboutDialog")
        AboutDialog.setWindowModality(QtCore.Qt.NonModal)
        AboutDialog.resize(350, 200)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(AboutDialog.sizePolicy().hasHeightForWidth())
        AboutDialog.setSizePolicy(sizePolicy)
        AboutDialog.setMinimumSize(QtCore.QSize(350, 200))
        AboutDialog.setMaximumSize(QtCore.QSize(350, 200))
        AboutDialog.setModal(False)
        self.verticalLayout = QtWidgets.QVBoxLayout(AboutDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.lab_version = QtWidgets.QLabel(AboutDialog)
        self.lab_version.setAlignment(QtCore.Qt.AlignCenter)
        self.lab_version.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
        self.lab_version.setObjectName("lab_version")
        self.verticalLayout.addWidget(self.lab_version)
        self.label_2 = QtWidgets.QLabel(AboutDialog)
        self.label_2.setAlignment(QtCore.Qt.AlignCenter)
        self.label_2.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.label_3 = QtWidgets.QLabel(AboutDialog)
        self.label_3.setAlignment(QtCore.Qt.AlignCenter)
        self.label_3.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
        self.label_3.setObjectName("label_3")
        self.verticalLayout.addWidget(self.label_3)
        self.buttonBox = QtWidgets.QDialogButtonBox(AboutDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(AboutDialog)
        self.buttonBox.clicked['QAbstractButton*'].connect(AboutDialog.close)
        QtCore.QMetaObject.connectSlotsByName(AboutDialog) 
Example 20
Project: pywerami   Author: ondrolexa   File: mainapp.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(OptionsForm, self).__init__(parent)
        settings = QtCore.QSettings("LX", "pywerami")
        layout = QtWidgets.QVBoxLayout(self)
        form = QtWidgets.QWidget()
        formlayout = QtWidgets.QFormLayout(form)

        ## scale
        #self.scale = QLineEdit(repr(settings.value("scale", 1, type=float)), self)
        #self.scale.setValidator(QDoubleValidator(self.scale))
        #formlayout.addRow('Scale', self.scale)

        # not-a-number
        self.nan = QtWidgets.QLineEdit(settings.value("nan", "NaN", type=str), self)
        formlayout.addRow('Not a number', self.nan)

        form.setLayout(formlayout)
        buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        layout.addWidget(form)
        layout.addWidget(buttonBox)
        self.setLayout(layout)

        buttonBox.accepted.connect(self.check)
        buttonBox.rejected.connect(self.reject)

        self.setWindowTitle("PyWerami options") 
Example 21
Project: dcc   Author: amimo   File: xrefwindow.py    Apache License 2.0 5 votes vote down vote up
def __init__(self,
                 parent=None,
                 win=None,
                 method_analysis=None):
        super(XrefDialogMethod, self).__init__(parent)
        self.method_analysis = method_analysis

        title = "Xrefs for the method %s" % self.method_analysis.method

        self.setWindowTitle(title)

        xrefs_list = []

        xrefs_from = self.method_analysis.get_xref_from()
        for ref_class, ref_method, _ in xrefs_from:
            xrefs_list.append(('From', ref_method, ref_class.get_vm_class()))

        xrefs_to = self.method_analysis.get_xref_to()
        for ref_class, ref_method, _ in xrefs_to:
            xrefs_list.append(('To', ref_method, ref_class.get_vm_class()))

        closeButton = QtWidgets.QPushButton("Close")
        closeButton.clicked.connect(self.close)

        xreflayout = QtWidgets.QGridLayout()
        xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
        xreflayout.addWidget(xrefwin, 0, 0)

        buttonsLayout = QtWidgets.QHBoxLayout()
        buttonsLayout.addStretch(1)
        buttonsLayout.addWidget(closeButton)

        mainLayout = QtWidgets.QVBoxLayout()
        mainLayout.addLayout(xreflayout)
        mainLayout.addLayout(buttonsLayout)

        self.setLayout(mainLayout) 
Example 22
Project: dcc   Author: amimo   File: xrefwindow.py    Apache License 2.0 5 votes vote down vote up
def __init__(self,
                 parent=None,
                 win=None,
                 current_class=None,
                 class_analysis=None,
                 field_analysis=None):
        super(XrefDialogField, self).__init__(parent)
        self.current_class = current_class
        self.class_analysis = class_analysis
        self.field_analysis = field_analysis

        title = "Xrefs for the field %s" % self.field_analysis.field

        self.setWindowTitle(title)

        xrefs_list = []

        xrefs_read = self.field_analysis.get_xref_read()
        for ref_class, ref_method in xrefs_read:
            xrefs_list.append(('Read', ref_method, ref_class.get_vm_class()))

        xrefs_write = self.field_analysis.get_xref_write()
        for ref_class, ref_method in xrefs_write:
            xrefs_list.append(('Write', ref_method, ref_class.get_vm_class()))

        closeButton = QtWidgets.QPushButton("Close")
        closeButton.clicked.connect(self.close)

        xreflayout = QtWidgets.QGridLayout()
        xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
        xreflayout.addWidget(xrefwin, 0, 0)

        buttonsLayout = QtWidgets.QHBoxLayout()
        buttonsLayout.addStretch(1)
        buttonsLayout.addWidget(closeButton)

        mainLayout = QtWidgets.QVBoxLayout()
        mainLayout.addLayout(xreflayout)
        mainLayout.addLayout(buttonsLayout)

        self.setLayout(mainLayout) 
Example 23
Project: dcc   Author: amimo   File: xrefwindow.py    Apache License 2.0 5 votes vote down vote up
def __init__(self, parent=None, win=None, string_analysis=None):
        super(XrefDialogString, self).__init__(parent)
        self.string_analysis = string_analysis

        title = "Xrefs for the string %s" % self.string_analysis.value

        self.setWindowTitle(title)

        xrefs_list = []

        xrefs_from = self.string_analysis.get_xref_from()
        for ref_class, ref_method in xrefs_from:
            xrefs_list.append(('From', ref_method, ref_class.get_vm_class()))

        closeButton = QtWidgets.QPushButton("Close")
        closeButton.clicked.connect(self.close)

        xreflayout = QtWidgets.QGridLayout()
        xrefwin = XrefListView(self, win=win, xrefs=xrefs_list)
        xreflayout.addWidget(xrefwin, 0, 0)

        buttonsLayout = QtWidgets.QHBoxLayout()
        buttonsLayout.addStretch(1)
        buttonsLayout.addWidget(closeButton)

        mainLayout = QtWidgets.QVBoxLayout()
        mainLayout.addLayout(xreflayout)
        mainLayout.addLayout(buttonsLayout)

        self.setLayout(mainLayout) 
Example 24
Project: dcc   Author: amimo   File: xrefwindow.py    Apache License 2.0 5 votes vote down vote up
def __init__(self,
                 parent=None,
                 win=None,
                 xrefs=None,
                 headers=["Origin", "Method"]):
        super(XrefListView, self).__init__(parent)
        self.parent = parent
        self.mainwin = win
        self.xrefs = xrefs
        self.headers = headers

        self.setMinimumSize(600, 400)

        self.filterPatternLineEdit = QtWidgets.QLineEdit()
        self.filterPatternLabel = QtWidgets.QLabel("&Filter origin pattern:")
        self.filterPatternLabel.setBuddy(self.filterPatternLineEdit)
        self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged)

        self.xrefwindow = XrefValueWindow(self, win, self.xrefs, self.headers)

        sourceLayout = QtWidgets.QVBoxLayout()
        sourceLayout.addWidget(self.xrefwindow)
        sourceLayout.addWidget(self.filterPatternLabel)
        sourceLayout.addWidget(self.filterPatternLineEdit)

        self.setLayout(sourceLayout) 
Example 25
Project: pyqimageview   Author: nevion   File: viewer.py    MIT License 5 votes vote down vote up
def __init__(self, image, input_path):
        QMainWindow.__init__(self)
        self.image = image
        self.input_path = input_path
        self.image_view = AppImageView(self)
        self.image_view.main_widget = self
        self.statusBar().showMessage("")

        #self.resize(image.size())
        padding = self.frameGeometry().size() - self.geometry().size()
        self.resize(image.size() + padding)
        #self.resize(797, 615)

        central = QWidget(self)
        central.setObjectName("MainWindow")

        self.verticalLayout = QtWidgets.QVBoxLayout(central)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        #self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
        self.verticalLayout.setObjectName("verticalLayout")
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(1)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.image_view.sizePolicy().hasHeightForWidth())
        self.image_view.setSizePolicy(sizePolicy)
        self.image_view.setMouseTracking(True)
        self.image_view.setFocusPolicy(QtCore.Qt.NoFocus)
        self.image_view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.image_view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.image_view.setObjectName("image_view")
        self.verticalLayout.addWidget(self.image_view)

        self.setCentralWidget(central)
        self.layout().setContentsMargins(0, 0, 0, 0)

        screen = QDesktopWidget().screenGeometry(self)
        size = self.geometry()
        self.move((screen.width()-size.width())/4, (screen.height()-size.height())/4)

        self.update_view()
        self.image_view.reset() 
Example 26
Project: pymovie   Author: bob-anderson-ok   File: aperturesFileTagDialog.py    MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(600, 102)
        Dialog.setMinimumSize(QtCore.QSize(400, 0))
        Dialog.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.apertureGroupTagEdit = QtWidgets.QLineEdit(Dialog)
        font = QtGui.QFont()
        font.setPointSize(13)
        self.apertureGroupTagEdit.setFont(font)
        self.apertureGroupTagEdit.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.apertureGroupTagEdit.setMaxLength(80)
        self.apertureGroupTagEdit.setObjectName("apertureGroupTagEdit")
        self.verticalLayout.addWidget(self.apertureGroupTagEdit)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Vertical)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setCenterButtons(True)
        self.buttonBox.setObjectName("buttonBox")
        self.horizontalLayout.addWidget(self.buttonBox)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 27
Project: kucher   Author: Zubax   File: __init__.py    GNU General Public License v3.0 5 votes vote down vote up
def _init_overlay_widgets(self):
        # Main widget
        operational = WidgetBase(self)

        operational_layout_top = QHBoxLayout()
        operational_layout_top.addWidget(QLabel('Port:'))
        operational_layout_top.addWidget(self._port_combo, stretch=1)
        operational_layout_top.addWidget(self._connect_button)

        operational_layout_bottom = QHBoxLayout()
        operational_layout_bottom.addWidget(self._status_text)

        operational_layout = QVBoxLayout()
        operational_layout.addLayout(operational_layout_top)
        operational_layout.addLayout(operational_layout_bottom)
        operational_layout.addWidget(self._device_info_widget, 1)

        operational.setLayout(operational_layout)
        self._overlay.addWidget(operational)

        # Progress widget - shown while connecting/disconnecting
        progress = WidgetBase(self)
        progress_layout = QVBoxLayout()
        progress_layout.addStretch(1)
        progress_layout.addWidget(self._connection_progress_bar)
        progress_layout.addStretch(1)
        progress.setLayout(progress_layout)
        self._overlay.addWidget(progress) 
Example 28
Project: kucher   Author: Zubax   File: little_bobby_tables_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(LittleBobbyTablesWidget, self).__init__(parent)

        self._table = QTableWidget(self)
        self._table.setColumnCount(1)
        self._table.horizontalHeader().hide()
        self._table.setFont(get_monospace_font())
        self._table.horizontalHeader().setSectionResizeMode(self._table.horizontalHeader().ResizeToContents)
        self._table.horizontalHeader().setStretchLastSection(True)
        self._table.verticalHeader().setSectionResizeMode(self._table.verticalHeader().ResizeToContents)

        lay_on_macduff = QVBoxLayout()
        lay_on_macduff.addWidget(self._table)
        lay_on_macduff.setContentsMargins(0, 0, 0, 0)
        self.setLayout(lay_on_macduff) 
Example 29
Project: kucher   Author: Zubax   File: placeholder_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent: QWidget):
        super(PlaceholderWidget, self).__init__(parent)

        label = QLabel(self)
        label.setText('Task-specific status information is not available')
        label.setWordWrap(True)
        label.setAlignment(Qt.AlignCenter)

        font: QFont = label.font()
        font.setItalic(True)
        label.setFont(font)

        layout = QVBoxLayout()
        layout.addWidget(label)
        self.setLayout(layout) 
Example 30
Project: kucher   Author: Zubax   File: value_display_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def _unittest_value_display_widget_main():
    import time
    from PyQt5.QtWidgets import QApplication, QMainWindow, QGroupBox
    app = QApplication([])

    win = QMainWindow()
    container = QGroupBox(win)
    layout = QVBoxLayout()

    a = ValueDisplayWidget(container, 'Vladimir', 'N/A', tooltip='This is Vladimir')
    layout.addWidget(a)

    b = ValueDisplayWidget(container, 'Dmitri', with_comment=True)
    b.set('123.4 \u00B0C', comment='Init', icon_name='info')
    layout.addWidget(b)

    container.setLayout(layout)
    win.setCentralWidget(container)
    win.show()

    def run_a_bit():
        for _ in range(1000):
            time.sleep(0.005)
            app.processEvents()

    run_a_bit()
    b.set('12.3 \u00B0C', comment='OK', icon_name='ok')
    run_a_bit()
    b.set('123.4 \u00B0C')
    run_a_bit()
    b.set('-45.6 \u00B0C', comment='Cold', icon_name='cold')
    run_a_bit()

    win.close() 
Example 31
Project: MovieHeavens   Author: lt94   File: movies.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, resources, title):
        super(ImageWindow, self).__init__()
        self.setWindowTitle(title)

        self.central_widget = QWidget()
        self.setCentralWidget(self.central_widget)
        layout = QVBoxLayout(self.central_widget)

        image = QImage(resources)
        pixmap = QPixmap(resources)
        image_label = QLabel(self)
        image_label.setPixmap(pixmap)
        image_label.resize(pixmap.width(), pixmap.height())
        layout.addWidget(image_label) 
Example 32
Project: bssrdf-estimate   Author: tatsy   File: curve_plot_widget.py    MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(CurvePlotWidget, self).__init__(parent)

        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

        self.mplCanvas = MplCanvas()
        self.layout.addWidget(self.mplCanvas) 
Example 33
Project: bssrdf-estimate   Author: tatsy   File: console_widget.py    MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(ConsoleWidget, self).__init__(parent)

        self.textEdit = QTextEdit()
        self.textEdit.setFont(QFont('Consolas'))
        self.clearButton = QPushButton()
        self.clearButton.setText('Clear')

        self.vboxLayout = QVBoxLayout()
        self.vboxLayout.addWidget(self.textEdit)
        self.vboxLayout.addWidget(self.clearButton)
        self.setLayout(self.vboxLayout)

        self.clearButton.clicked.connect(self.clearConsoleTexts) 
Example 34
Project: straditize   Author: Chilipp   File: progress_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, straditizer_widgets, item):
        super().__init__()
        self.init_straditizercontrol(straditizer_widgets, item)

        self.combo_display = QtWidgets.QComboBox()
        self.combo_display.setEditable(False)

        for state in [TASK_TODO, DONE, NOTYET]:
            self.combo_display.addItem(QtGui.QIcon(icons[state]), state)
        self.combo_display.addItem(ALL_TASKS)

        self.progress_list = QtWidgets.QListWidget()
        self.info_label = QtWidgets.QLabel()
        self.info_label.setWordWrap(True)
        self.info_label.setStyleSheet('border: 1px solid black')

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.combo_display)
        vbox.addWidget(self.progress_list)
        vbox.addWidget(self.info_label)
        self.setLayout(vbox)

        self.populate_list()
        self.setup_menu()
        self.refresh()
        self.combo_display.currentIndexChanged.connect(self.refresh)
        self.progress_list.itemDoubleClicked.connect(self.show_rst)
        self.progress_list.currentItemChanged.connect(self.show_rst)
        self.progress_list.currentItemChanged.connect(self.update_info_label) 
Example 35
Project: QuantStudio   Author: Scorpi000   File: ResultDlg.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None, fig=None):
        super(_MatplotlibWidget, self).__init__(parent)
        self.Layout = QtWidgets.QVBoxLayout(self)
        self.Mpl = _MplCanvas(self, fig=fig)
        self.MplNTB = NavigationToolbar(self.Mpl, self)
        self.Layout.addWidget(self.Mpl)
        self.Layout.addWidget(self.MplNTB)
        self.setLayout(self.Layout) 
Example 36
Project: openeo-qgis-plugin   Author: Open-EO   File: band_dialog.py    Apache License 2.0 5 votes vote down vote up
def multiple_bands(self):
        """
        Produces a checkable QListWidget
        :return: Of all bands, only the selected bands are returned.
        """
        self.allBandBtn.setStyleSheet("background-color: white")
        self.multipleBandBtn.setStyleSheet("background-color: white")
        if self.multipleBandBtn.clicked:
            self.multipleBandBtn.setStyleSheet("background-color: lightgray")

        #self.processgraphBands.clear()
        self.band_window = QDialog(parent=self)
        self.hbox4 = QVBoxLayout()
        self.bandBox = QListWidget()

        for band in self.all_bands:
            # Set Checkbox before band
            self.item = QListWidgetItem(self.bandBox)
            self.item.setFlags(self.item.flags() | QtCore.Qt.ItemIsUserCheckable)
            self.item.setCheckState(Qt.Unchecked)
            self.item.setText(str(band))

        self.bandBox.sortItems()
        self.bandBox.setMinimumWidth(150)
        self.bandBox.setMinimumHeight(200)
        self.band_window.setWindowTitle('Select Multiple Bands')
        self.takeBandsButton = QPushButton('Save Choice of Bands')

        self.hbox4.addWidget(self.bandBox)
        self.hbox4.addWidget(self.takeBandsButton)
        self.band_window.setLayout(self.hbox4)
        #self.band_window.setGeometry(400, 400, 600, 450)

        self.takeBandsButton.setMinimumWidth(100)
        self.takeBandsButton.setMinimumWidth(50)
        self.takeBandsButton.clicked.connect(self.save_band_choice2)
        #self.takeBandsButton.setGeometry(420, 25, 150, 31)
        self.band_window.show() 
Example 37
Project: ems   Author: mtils   File: table_manager.py    MIT License 5 votes vote down vote up
def _setupUi(self):
        self.setLayout(QHBoxLayout())
        self.view = QTableView(self)
        self.view.setSelectionMode(self.view.ContiguousSelection)
        self.layout().addWidget(self.view)

        self.buttonContainer = QWidget(self)
        self.layout().addWidget(self.buttonContainer)

        self.buttonContainer.setLayout(QVBoxLayout())
        self.saveButton = QPushButton('&Save')
        self.buttonContainer.layout().addWidget(self.saveButton)

        self.cancelButton = QPushButton('&Cancel')
        self.buttonContainer.layout().addWidget(self.cancelButton)

        self.addButton = QPushButton('&Add')
        self.buttonContainer.layout().addWidget(self.addButton)

        self.removeButton = QPushButton('&Remove')
        self.buttonContainer.layout().addWidget(self.removeButton)

        self.buttonContainer.layout().addSpacerItem(QSpacerItem(20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding))

        self.addButton.clicked.connect(self.addAfterLastSelected)
        self.removeButton.clicked.connect(self.removeSelected) 
Example 38
Project: pyweed   Author: iris-edu   File: LoggingDialog.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupUi(self, LoggingDialog):
        LoggingDialog.setObjectName("LoggingDialog")
        LoggingDialog.resize(697, 474)
        self.verticalLayout = QtWidgets.QVBoxLayout(LoggingDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.loggingPlainTextEdit = QtWidgets.QPlainTextEdit(LoggingDialog)
        self.loggingPlainTextEdit.setObjectName("loggingPlainTextEdit")
        self.verticalLayout.addWidget(self.loggingPlainTextEdit)

        self.retranslateUi(LoggingDialog)
        QtCore.QMetaObject.connectSlotsByName(LoggingDialog) 
Example 39
Project: pyweed   Author: iris-edu   File: SpinnerWidget.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupUi(self, SpinnerWidget):
        SpinnerWidget.setObjectName("SpinnerWidget")
        SpinnerWidget.resize(306, 207)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(SpinnerWidget.sizePolicy().hasHeightForWidth())
        SpinnerWidget.setSizePolicy(sizePolicy)
        SpinnerWidget.setStyleSheet("QFrame { background-color: rgba(224,224,224,192)} \n"
"QLabel { background-color: transparent }")
        self.verticalLayout = QtWidgets.QVBoxLayout(SpinnerWidget)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.icon = QtWidgets.QLabel(SpinnerWidget)
        self.icon.setText("")
        self.icon.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignHCenter)
        self.icon.setObjectName("icon")
        self.verticalLayout.addWidget(self.icon)
        self.label = QtWidgets.QLabel(SpinnerWidget)
        self.label.setText("")
        self.label.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.cancelButton = QtWidgets.QPushButton(SpinnerWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cancelButton.sizePolicy().hasHeightForWidth())
        self.cancelButton.setSizePolicy(sizePolicy)
        self.cancelButton.setObjectName("cancelButton")
        self.horizontalLayout.addWidget(self.cancelButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout.setStretch(0, 1)
        self.verticalLayout.setStretch(1, 1)

        self.retranslateUi(SpinnerWidget)
        QtCore.QMetaObject.connectSlotsByName(SpinnerWidget) 
Example 40
Project: pyweed   Author: iris-edu   File: ConsoleDialog.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, pyweed, parent=None):
        super(ConsoleDialog, self).__init__(parent=parent)
        self.widget = EmbedIPython(pyweed=pyweed)
        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(self.widget) 
Example 41
Project: cct   Author: awacha   File: capillarymeasurement.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        layout = QtWidgets.QVBoxLayout(self.figureContainerWidget)
        self.figureContainerWidget.setLayout(layout)
        self.figure = Figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.figureToolbar = NavigationToolbar2QT(self.canvas, self.figureContainerWidget)
        self.axes = self.figure.add_subplot(1, 1, 1)
        self.axes.grid(True, which='both')
        layout.addWidget(self.canvas)
        layout.addWidget(self.figureToolbar)
        self.browsePushButton.clicked.connect(self.browse)
        self.scanIndexSpinBox.valueChanged.connect(self.loadScan)
        self.reloadPushButton.clicked.connect(self.loadScan)
        self.signalNameComboBox.currentTextChanged.connect(self.plotSignal)
        self.derivativeCheckBox.toggled.connect(self.plotSignal)
        self.fitNegativePushButton.clicked.connect(self.fitNegative)
        self.fitPositivePushButton.clicked.connect(self.fitPositive)
        self.updateCenterPushButton.clicked.connect(self.updateCenter)
        self.updateThicknessPushButton.clicked.connect(self.updateThickness)
        self.updateBothPushButton.clicked.connect(self.updateBoth)
        self.positiveErrDoubleSpinBox.valueChanged.connect(self.calculatePositionAndThickness)
        self.positiveValDoubleSpinBox.valueChanged.connect(self.calculatePositionAndThickness)
        self.negativeErrDoubleSpinBox.valueChanged.connect(self.calculatePositionAndThickness)
        self.negativeValDoubleSpinBox.valueChanged.connect(self.calculatePositionAndThickness)
        scanfile = self.credo.services['filesequence'].get_scanfile()
        self.scanFileNameLineEdit.setText(scanfile)
        self.loadScanFile()
        self._samplestoreconnections = [
            self.credo.services['samplestore'].connect('list-changed', self.onSampleListChanged)]
        self._filesequenceconnections = [
            self.credo.services['filesequence'].connect('nextscan-changed', self.onNextScanChanged)]
        self.onSampleListChanged(self.credo.services['samplestore'])
        self.updateCenterPushButton.setEnabled(False)
        self.updateThicknessPushButton.setEnabled(False)
        self.updateBothPushButton.setEnabled(False)
        self.sampleNameComboBox.currentIndexChanged.connect(self.onSampleChanged)
        self.canvas.mpl_connect('resize_event', self.onCanvasResize) 
Example 42
Project: cct   Author: awacha   File: plotcurve.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        self.figure = Figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.axes = self.figure.add_subplot(1, 1, 1)
        self.figureContainer.setLayout(QtWidgets.QVBoxLayout())
        self.figureContainer.layout().addWidget(self.canvas)
        self.figureToolbar = NavigationToolbar2QT(self.canvas, self.figureContainer)
        self.figureContainer.layout().addWidget(self.figureToolbar)
        assert isinstance(self.figureToolbar, QtWidgets.QToolBar)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/legend.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.legendAction = QtWidgets.QAction(icon, 'Show legend', None)
        self.legendAction.setCheckable(True)
        self.legendAction.setChecked(True)
        self.legendAction.triggered.connect(self.onLegendTriggered)
        icon = QtGui.QIcon.fromTheme("edit-clear-all")
        self.clearAxesAction = QtWidgets.QAction(icon, 'Clear all curves', None)
        self.clearAxesAction.triggered.connect(self.onClearAxes)
        toolbutton = QtWidgets.QToolButton()
        toolbutton.setDefaultAction(self.legendAction)
        self.figureToolbar.insertWidget(self.figureToolbar.actions()[0], toolbutton)
        toolbutton = QtWidgets.QToolButton()
        toolbutton.setDefaultAction(self.clearAxesAction)
        self.figureToolbar.insertWidget(self.figureToolbar.actions()[0], toolbutton)
        self.legendAction.setVisible(True)
        self.clearAxesAction.setVisible(True)
        self.figureToolbar.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
        self.canvas.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        self.canvas.mpl_connect('resize_event', self.onCanvasResize) 
Example 43
Project: cct   Author: awacha   File: plotimage.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        #self.colourScaleComboBox.addItems(['linear', 'logarithmic', 'square', 'square root'])
        self.colourScaleComboBox.setCurrentIndex(self.colourScaleComboBox.findText('logarithmic'))
        self.paletteComboBox.addItems(get_colormaps())
        self.paletteComboBox.setCurrentIndex(self.paletteComboBox.findText(matplotlib.rcParams['image.cmap']))
        #self.axesComboBox.addItems(['abs. pixel', 'rel. pixel', 'detector radius', 'twotheta', 'q'])
        self.axesComboBox.setCurrentIndex(self.axesComboBox.findText('q'))
        layout = QtWidgets.QVBoxLayout(self.figureContainer)
        self.figure = Figure()
        self.canvas = FigureCanvasQTAgg(self.figure)
        self.axes = self.figure.add_subplot(1, 1, 1)
        assert isinstance(self.axes, Axes)
        self.axes.set_facecolor('black')
        layout.addWidget(self.canvas)
        self.figtoolbar = NavigationToolbar2QT(self.canvas, self.figureContainer)
        layout.addWidget(self.figtoolbar)
        assert isinstance(self.figtoolbar, QtWidgets.QToolBar)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/plotimage_config.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.showToolbarButton = QtWidgets.QToolButton(self.figtoolbar)
        self.showToolbarButton.setIcon(icon)
        self.showToolbarButton.setText('Plot setup')
        self.showToolbarButton.setCheckable(True)
        self.showToolbarButton.setChecked(False)
        self.toolbar.setVisible(False)
        self.showToolbarButton.toggled.connect(self.toolbarVisibility)
        self.figtoolbar.insertWidget(self.figtoolbar.actions()[-1], self.showToolbarButton).setVisible(True)
        self.colourScaleComboBox.currentIndexChanged.connect(self.colourScaleChanged)
        self.axesComboBox.currentIndexChanged.connect(self.axesTypeChanged)
        self.paletteComboBox.currentIndexChanged.connect(self.paletteChanged)
        self.showColourBarToolButton.toggled.connect(self.showColourBarChanged)
        self.showMaskToolButton.toggled.connect(self.showMaskChanged)
        self.showBeamToolButton.toggled.connect(self.showBeamChanged)
        self.equalAspectToolButton.toggled.connect(self.replot)
        self._testimage()
        self.figtoolbar.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum)
        self.canvas.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        self.canvas.mpl_connect('resize_event', self.onCanvasResize) 
Example 44
Project: musaic   Author: al165   File: main.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, engine, *args, **kwargs):
        super().__init__(*args, **kwargs)

        print('[ClientOptions]', 'init')

        self._engine = engine

        self.setWindowTitle('musAIc options...')

        layout = QtWidgets.QVBoxLayout()
        form_layout = QtWidgets.QFormLayout()
        layout.addLayout(form_layout)

        self._addr = QtWidgets.QLineEdit(str(self._engine.clientOptions['addr']))
        self._addr.setInputMask('000.000.000.000')
        self._port = QtWidgets.QSpinBox()# str(self._engine.clientOptions['port']))
        self._port.setRange(1024, 65535)
        self._port.setValue(self._engine.clientOptions['port'])
        self._clock = QtWidgets.QCheckBox()
        self._clock.setChecked(self._engine.clientOptions['clock'])

        form_layout.addRow('Address:', self._addr)
        form_layout.addRow('Port:', self._port)
        form_layout.addRow('Send clock:', self._clock)


        buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        layout.addWidget(buttons)

        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)

        self.setLayout(layout) 
Example 45
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 5 votes vote down vote up
def metaBox(self):
        meta_box = QtWidgets.QGroupBox('Meta')
        main_layout = QtWidgets.QVBoxLayout()
        meta_layout = QtWidgets.QHBoxLayout()
        main_layout.addLayout(meta_layout)
        meta_layout.setSpacing(4)
        meta_layout.setContentsMargins(4, 4, 4, 4)
        meta_box.setLayout(main_layout)

        self.meta_params = {
            'span': Knob(1, 30),
            'jump': Knob(0, 12),
            'cDens': Knob(0, 1),
            'cDepth': Knob(1, 5),
            'tCent': Knob(40, 80),
            'rDens': Knob(0, 8),
            'pos': Knob(0, 1),
        }

        for k, v in self.meta_params.items():
            meta_layout.addWidget(v)
            v.setFixedHeight(30)
            v.setFixedWidth(30)
            v.valueChanged.connect(self.parameterChanged)

        random_button = QtWidgets.QPushButton('random')
        random_button.clicked.connect(self.randomMetaData)
        main_layout.addWidget(random_button)

        return meta_box 
Example 46
Project: reporta   Author: jbentham   File: rp_pyqt.py    Apache License 2.0 5 votes vote down vote up
def __init__(self, parent=None):
        super(MyWidget, self).__init__(parent)
        self.parent = parent
        self.text = QtWidgets.QTextEdit()
        self.scene = QGraphicsScene()
        self.view = MyView(self.scene)
        self.view.setRenderHint(QPainter.Antialiasing)
        self.sigpins = {}
        self.measure_text()
        self.scene.addRect(0, 0, *FRAME_SIZE, pen=FRAME_PEN, brush=FRAME_BRUSH)
        self.draw_rect(BOARD_GPOS, BOARD_GSIZE, BOARD_PEN, BOARD_BRUSH)
        self.draw_pin_labels(BOARD_GPOS, BOARD_GSIZE)
        self.draw_part_pins(BOARD_GPOS, BOARD_GSIZE, BOARDPINS, PIN_SIZE, True)
        self.draw_rect(SEGDISP_GPOS, SEGDISP_GSIZE, SEGDISP_PEN, SEGDISP_BRUSH)
        self.draw_part_pins(SEGDISP_GPOS, SEGDISP_GSIZE, SEG_IDENTS, SMALLPIN_SIZE, True)
        self.draw_part_segs(SEGDISP_GPOS)
        self.draw_button()
        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.view, 30)
        layout.addWidget(self.text, 10)
        self.setLayout(layout)
        self.text_updater.connect(self.update_text)
        sys.stdout = self

    # Convert x,y grid position to graphics position 
Example 47
Project: PyLSS   Author: gmrandazzo   File: gui_aboutdialog.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupUi(self, AboutDialog):
        AboutDialog.setObjectName("AboutDialog")
        AboutDialog.resize(339, 106)
        self.gridLayout = QtWidgets.QGridLayout(AboutDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(AboutDialog)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.label_2 = QtWidgets.QLabel(AboutDialog)
        self.label_2.setOpenExternalLinks(True)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.closeButton = QtWidgets.QPushButton(AboutDialog)
        self.closeButton.setMaximumSize(QtCore.QSize(110, 32))
        self.closeButton.setObjectName("closeButton")
        self.horizontalLayout.addWidget(self.closeButton)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(AboutDialog)
        QtCore.QMetaObject.connectSlotsByName(AboutDialog) 
Example 48
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: widgets.py    GNU General Public License v2.0 5 votes vote down vote up
def vbox(parent, grid):
	vbox = QtWidgets.QVBoxLayout(parent)
	vbox.addLayout(grid)
	vbox.addStretch(1.0)
	vbox.setSpacing(0)
	vbox.setContentsMargins(0,0,0,0) 
Example 49
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: widgets.py    GNU General Public License v2.0 5 votes vote down vote up
def vbox2(parent, buttons):
	vbox = QtWidgets.QVBoxLayout(parent)
	for w in buttons: vbox.addWidget(w)
	vbox.addStretch(1.0) 
Example 50
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: widgets.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, ):
		QtWidgets.QWidget.__init__(self,)
		
		resampling_l = QtWidgets.QLabel("\nResampling")
		resampling_l.setFont(myFont)
		mode_l = QtWidgets.QLabel("Mode")
		self.mode_c = QtWidgets.QComboBox(self)
		self.mode_c.addItems(("Linear", "Sinc"))
		self.mode_c.currentIndexChanged.connect(self.toggle_resampling_quality)
		self.sinc_quality_l = QtWidgets.QLabel("Quality")
		self.sinc_quality_s = QtWidgets.QSpinBox()
		self.sinc_quality_s.setRange(1, 100)
		self.sinc_quality_s.setSingleStep(1)
		self.sinc_quality_s.setValue(50)
		self.sinc_quality_s.setToolTip("Number of input samples that contribute to each output sample.\nMore samples = more quality, but slower. Only for sinc mode.")
		self.toggle_resampling_quality()
		
		
		self.mygroupbox = QtWidgets.QGroupBox('Channels')
		self.mygroupbox.setToolTip("Only selected channels will be resampled.")
		self.channel_layout = QtWidgets.QVBoxLayout()
		self.channel_layout.setSpacing(0)
		self.mygroupbox.setLayout(self.channel_layout)
		self.scroll = QtWidgets.QScrollArea()
		self.scroll.setWidget(self.mygroupbox)
		self.scroll.setWidgetResizable(True)
		self.channel_checkboxes = [ ]
		
		buttons = ((resampling_l,), (mode_l, self.mode_c,), (self.sinc_quality_l, self.sinc_quality_s), (self.scroll,))
		vbox(self, grid(buttons))