Python PyQt5.QtWidgets.QHBoxLayout() Examples

The following are code examples for showing how to use PyQt5.QtWidgets.QHBoxLayout(). 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: MeiTingTrunk   Author: Xunius   File: _MainFrame.py    GNU General Public License v3.0 7 votes vote down vote up
def createClearFilterFrame(self):

        frame=QtWidgets.QFrame()
        frame.setStyleSheet('background: rgb(235,225,190)')
        h_la=QtWidgets.QHBoxLayout()

        # clear fitlering button
        self.clear_filter_button=QtWidgets.QToolButton(self)
        self.clear_filter_button.setText('Clear')
        self.clear_filter_button.clicked.connect(self.clearFilterButtonClicked)

        self.clear_filter_label=QtWidgets.QLabel('  Clear current filtering')
        h_la.addWidget(self.clear_filter_label)
        h_la.addWidget(self.clear_filter_button)

        frame.setLayout(h_la)
        frame.setVisible(False)

        return frame 
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: 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, label='select path', FileDialogOptions=None):
        super(PathSelectWidget,self).__init__(parent=parent)
        self.dict_name = dict_name
        self.param_name = param_name

        self.parent = parent
        self.FileDialogOptions = FileDialogOptions

        self.Button = QtWidgets.QPushButton(self,label)
        self.PathDisplay = QtWidgets.QLineEdit(self)

        layout = QtWidgets.QHBoxLayout(self)
        layout.addWidget(self.Button)
        layout.addWidget(self.PathDisplay)

        self.path = None 
Example 4
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 5
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 6
Project: LeitnerEmulator   Author: lovac42   File: plan0.py    GNU General Public License v3.0 6 votes vote down vote up
def dconfsetupUi(self, Dialog):
    r=self.gridLayout_3.rowCount()

    self.sm0emu = QtWidgets.QCheckBox(self.tab_3)
    self.sm0emu.setObjectName(_fromUtf8("sm0emu"))
    self.sm0emu.setText(_('Use Custom Intervals'))
    self.gridLayout_3.addWidget(self.sm0emu, r, 0, 1, 3)
    self.sm0emu.toggled.connect(lambda:togglesm0emuCB(self))
    r+=1

    self.sm2HLayout = QtWidgets.QHBoxLayout()
    self.sm2HLayout.setObjectName(_fromUtf8("sm2HLayout"))
    self.sm0StepsLabel = QtWidgets.QLabel(Dialog)
    self.sm0StepsLabel.setObjectName(_fromUtf8("sm0StepsLabel"))
    self.sm0StepsLabel.setText(_("Ivl Steps:"))
    self.sm2HLayout.addWidget(self.sm0StepsLabel)

    self.sm0Steps = QtWidgets.QLineEdit(self.tab_3)
    self.sm0Steps.setObjectName(_fromUtf8("sm0Steps"))
    self.sm2HLayout.addWidget(self.sm0Steps)
    self.gridLayout_3.addLayout(self.sm2HLayout, r, 0, 1, 2) 
Example 7
Project: cct   Author: awacha   File: h5selector.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        if self.horizontal:
            self.hlayout = QtWidgets.QHBoxLayout()
            self.hlayout.setContentsMargins(0, 0, 0, 0)
            self.hlayout.addWidget(self.label)
            self.hlayout.addWidget(self.h5FileNameLineEdit)
            self.hlayout.addWidget(self.browseFilePushButton)
            self.hlayout.addWidget(self.label_2)
            self.hlayout.addWidget(self.sampleNameComboBox)
            self.hlayout.addWidget(self.label_3)
            self.hlayout.addWidget(self.distanceComboBox)
            self.hlayout.addWidget(self.reloadFilePushButton)
            self.reloadFilePushButton.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Maximum)
            self.reloadFilePushButton.setText('Reload file')
            self.hlayout.addSpacerItem(
                QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum))
            del self.gridLayout
            QtWidgets.QWidget().setLayout(self.layout())  # an ugly trick to get rid of the original layout
            self.setLayout(self.hlayout)
        self.browseFilePushButton.clicked.connect(self.onBrowseFile)
        self.reloadFilePushButton.clicked.connect(self.reloadFile)
        self.sampleNameComboBox.currentIndexChanged.connect(self.onSampleNameChanged)
        self.distanceComboBox.currentIndexChanged.connect(self.onDistanceChanged) 
Example 8
Project: cct   Author: awacha   File: subtractionparameterdelegate.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __init__(self, parent):
        super().__init__(parent, QtCore.Qt.Widget)
        self.layout = QtWidgets.QHBoxLayout(self)
        self.left = QtWidgets.QDoubleSpinBox(self)
        self.right = QtWidgets.QDoubleSpinBox(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('-')
        self.layout.addWidget(self.left, 1)
        self.layout.addWidget(label)
        self.layout.addWidget(self.right,1)
        self.count = QtWidgets.QSpinBox(self)
        self.count.setSuffix(' points')
        self.count.setRange(3, 1000)
        self.layout.addWidget(self.count,1)
        self.left.setRange(0, 9999)
        self.right.setRange(0, 9999)
        self.left.setDecimals(4)
        self.right.setDecimals(4)
        self.left.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
        self.right.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
        self.count.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
        label.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        self.setAutoFillBackground(True) 
Example 9
Project: MeiTingTrunk   Author: Xunius   File: _MainFrame.py    GNU General Public License v3.0 6 votes vote down vote up
def createConfirmReviewFrame(self):

        frame=QtWidgets.QFrame()
        frame.setStyleSheet('background: rgb(235,225,190)')
        h_la=QtWidgets.QHBoxLayout()

        # confirm button
        self.confirm_review_button=QtWidgets.QToolButton(self)
        self.confirm_review_button.setText('Confirm')
        self.confirm_review_button.clicked.connect(self.confirmReviewButtonClicked)

        label=QtWidgets.QLabel('Meta data is correct?')
        h_la.addWidget(label)
        h_la.addWidget(self.confirm_review_button)

        frame.setLayout(h_la)
        frame.setVisible(False)

        return frame 
Example 10
Project: MeiTingTrunk   Author: Xunius   File: export_dialog.py    GNU General Public License v3.0 6 votes vote down vote up
def createPathTypeGroup(self, export_type):
        '''Create radiobutton group for file path type selection'''

        groupbox=QtWidgets.QGroupBox('Use relative or absolute paths for files.')
        ha=QtWidgets.QHBoxLayout()
        path_type=self.settings.value('export/%s/path_type' %export_type,str)

        for ii in ['Relative', 'Absolute']:
            buttonii=QtWidgets.QRadioButton(ii)
            if ii.lower()==path_type:
                buttonii.setChecked(True)
            ha.addWidget(buttonii)

        groupbox.setLayout(ha)

        return groupbox 
Example 11
Project: MeiTingTrunk   Author: Xunius   File: preference_dialog.py    GNU General Public License v3.0 6 votes vote down vote up
def loadDisplayOptions(self):
        '''Load widgets for the Display category'''

        scroll,va=self.createFrame('Select Fonts')

        ha=QtWidgets.QHBoxLayout()
        #ha.addStretch()
        label=QtWidgets.QLabel('NOTE some changes requires re-booting.')
        ha.addWidget(label,0,Qt.AlignTop)

        text_list=QtWidgets.QListWidget()
        text_list.setSizePolicy(getXMinYExpandSizePolicy())
        text_list.addItems(self.font_dict.keys())

        ha.addWidget(text_list)

        text_list.itemDoubleClicked.connect(self.chooseFont)
        va.addLayout(ha)

        return scroll 
Example 12
Project: MeiTingTrunk   Author: Xunius   File: preference_dialog.py    GNU General Public License v3.0 6 votes vote down vote up
def createPathTypeGroup(self, export_type):
        '''Create radiobutton group for file path type selection'''

        groupbox=QtWidgets.QGroupBox('Use relative or absolute paths for files.')
        ha=QtWidgets.QHBoxLayout()
        path_type=self.settings.value('export/%s/path_type' %export_type,str)

        for ii in ['Relative', 'Absolute']:
            buttonii=QtWidgets.QRadioButton(ii)
            if ii.lower()==path_type:
                buttonii.setChecked(True)
            buttonii.toggled.connect(lambda on: self.pathTypeChanged(on, export_type))
            ha.addWidget(buttonii)

        groupbox.setLayout(ha)

        return groupbox 
Example 13
Project: Lector   Author: BasioMeusPuga   File: dockwidgets.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent):
        self.parent = parent
        self.parentTab = self.parent.parent

        self.searchThread = BackGroundTextSearch()
        self.searchOptionsLayout = QtWidgets.QHBoxLayout()
        self.searchTabLayout = QtWidgets.QVBoxLayout()
        self.searchTimer = QtCore.QTimer(self.parent)
        self.searchLineEdit = QtWidgets.QLineEdit(self.parent)
        self.searchBookButton = QtWidgets.QToolButton(self.parent)
        self.caseSensitiveSearchButton = QtWidgets.QToolButton(self.parent)
        self.matchWholeWordButton = QtWidgets.QToolButton(self.parent)
        self.searchResultsTreeView = QtWidgets.QTreeView(self.parent)

        self._translate = QtCore.QCoreApplication.translate
        self.search_string = self._translate('SideDock', 'Search')
        self.search_book_string = self._translate('SideDock', 'Search entire book')
        self.case_sensitive_string = self._translate('SideDock', 'Match case')
        self.match_word_string = self._translate('SideDock', 'Match word')

        self.create_widgets() 
Example 14
Project: SpriteMator   Author: rafaelvasco   File: options_bar_widget.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, canvas):
        super(OptionsBar, self).__init__()

        self._layout = QHBoxLayout()
        self._layout.setContentsMargins(0, 0, 0, 0)
        self.setContentsMargins(0, 0, 0, 0)
        self._layout.setAlignment(Qt.AlignLeft)
        self._backgroundColor = QColor(10, 10, 10)

        self._toggleGridButton = QPushButton()
        self._toggleOnionSkinButton = QPushButton()
        self._toggleLightsButton = QPushButton()

        self._initialize_components(canvas)
        self._initialize_style()

        self.setLayout(self._layout) 
Example 15
Project: pdash   Author: CPChain   File: home.py    GNU General Public License v3.0 6 votes vote down vote up
def ui(self):
        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        widget = QQuickWidget(self)
        widget.setContentsMargins(0, 0, 0, 0)
        widget.rootContext().setContextProperty('self', self.obj)
        widget.setSource(QtCore.QUrl(self.qml))
        layout.addWidget(widget)
        pdsWidget = ProductList(self.products)

        width = 750
        pdsWidget.setMinimumWidth(width)
        pdsWidget.setMaximumWidth(width)

        product_layout = QHBoxLayout(self)
        product_layout.setContentsMargins(0, 0, 0, 0)
        product_layout.addSpacing(30)
        product_layout.addWidget(pdsWidget)
        product_layout.addStretch(1)

        layout.addLayout(product_layout)
        layout.addStretch(1)
        return layout 
Example 16
Project: pdash   Author: CPChain   File: comment.py    GNU General Public License v3.0 6 votes vote down vote up
def gen_row(self, left_text, *widgets, **kw):
        row = QHBoxLayout()
        row.setContentsMargins(0, 0, 0, 0)
        row.setSpacing(0)
        row.addSpacing(32)
        left_widget = Builder().text(left_text).name('left').style("font-size: 14px;").build()
        width = kw.get('left_width', 66)
        left_widget.setMinimumWidth(width)
        left_widget.setMaximumWidth(width)
        left_widget.setMinimumHeight(34)
        left = QVBoxLayout()
        left.setContentsMargins(0, 0, 0, 0)
        left.addWidget(left_widget)
        left.addStretch(1)
        row.addLayout(left)
        row.addSpacing(8)
        for widget in widgets:
            if isinstance(widget, QWidget):
                row.addWidget(widget)
                row.addSpacing(5)
        row.addStretch(1)
        return row 
Example 17
Project: visma   Author: aerospaceresearch   File: window.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        self.textQVBoxLayout = QtWidgets.QVBoxLayout()
        self.textUpQLabel = QtWidgets.QLabel()
        self.textDownQLabel = QtWidgets.QLabel()
        self.textQVBoxLayout.addWidget(self.textUpQLabel)
        self.textQVBoxLayout.addWidget(self.textDownQLabel)
        self.allQHBoxLayout = QtWidgets.QHBoxLayout()
        self.allQHBoxLayout.addLayout(self.textQVBoxLayout, 1)
        self.setLayout(self.allQHBoxLayout)
        self.textUpQLabel.setStyleSheet('''
        color: black;
        ''')
        self.textDownQLabel.setStyleSheet('''
        color: black;
        ''') 
Example 18
Project: Micchinetta   Author: SqrtPapere   File: DatabaseManager.py    MIT License 5 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 - Take Photo'
        self.setFixedSize(600,400)

        self.face_recognizer = FaceRecogniser()
        self.video_widget = VideoWidget(self.face_recognizer)
        h = QHBoxLayout()
        h.addWidget(self.video_widget)
        self.setLayout(h) 
Example 19
Project: ILTIS   Author: grg2rsr   File: LUT_Controlers_Widget.py    GNU General Public License v2.0 5 votes vote down vote up
def init_UI(self):
        self.LUTwidgets = QtWidgets.QStackedWidget()
        self.LUTwidgets_dFF = QtWidgets.QStackedWidget()

        # layout
        self.Layout = QtWidgets.QHBoxLayout()
        self.Layout.addWidget(self.LUTwidgets)
        self.Layout.addWidget(self.LUTwidgets_dFF)
        self.Layout.setContentsMargins(0, 0, 0, 0)
        self.Layout.setSpacing(0)
        self.setLayout(self.Layout)
        pass 
Example 20
Project: ILTIS   Author: grg2rsr   File: Front_Control_Panel_Widget.py    GNU General Public License v2.0 5 votes vote down vote up
def init_UI(self):
        # ini
        self.Data_Selector = Data_Selector_Widget(self.Main,self)
        self.ROI_Manager = ROI_Manager_Widget(self.Main,self)

        # layout
        self.Container = QtWidgets.QHBoxLayout()
        Splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)
        Splitter.addWidget(self.Data_Selector)
        Splitter.addWidget(self.ROI_Manager)
        self.Container.addWidget(Splitter)
        self.setLayout(self.Container)
        pass 
Example 21
Project: ILTIS   Author: grg2rsr   File: Traces_Visualizer_Stimsorted_Widget.py    GNU General Public License v2.0 5 votes vote down vote up
def init_UI(self):
        self.plotWidget = pg.GraphicsLayoutWidget(self)
        self.plotWidget.wheelEvent = self.wheelEvent  # quite hacky ...
        self.Layout = QtWidgets.QHBoxLayout(self)
        self.Layout.setContentsMargins(0, 0, 0, 0)
        self.Layout.setSpacing(0)
        self.setLayout(self.Layout)
        pass 
Example 22
Project: idasec   Author: RobinDavid   File: static_opaque_analysis.py    GNU Lesser General Public License v2.1 5 votes vote down vote up
def make_progress_bar(self, parent):
        horizontalLayout_2 = QtWidgets.QHBoxLayout()
        horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.loading_stat = QtWidgets.QLabel(parent)
        horizontalLayout_2.addWidget(self.loading_stat)
        self.progressbar_loading = QtWidgets.QProgressBar(parent)
        horizontalLayout_2.addWidget(self.progressbar_loading)
        self.stop_button = QtWidgets.QPushButton(parent)
        self.stop_button.setMaximumSize(QtCore.QSize(50, 30))
        self.stop_button.setText("stop")
        horizontalLayout_2.addWidget(self.stop_button)
        self.stop_button.clicked.connect(self.stop_button_clicked)
        return horizontalLayout_2 
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,
                 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 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,
                 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 25
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 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: value_display_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,
                 parent: QWidget,
                 title: str,
                 placeholder_text: typing.Optional[str] = None,
                 with_comment: bool = False,
                 tooltip: typing.Optional[str] = None):
        super(ValueDisplayWidget, self).__init__(parent)

        self._placeholder_text = str(placeholder_text or '')

        self._value_display = QLabel(self)
        self._value_display.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
        bold_font = QFont()
        bold_font.setBold(True)
        self._value_display.setFont(bold_font)

        if with_comment:
            self._comment = _Comment(self)
        else:
            self._comment = None

        self._default_tooltip = str(tooltip or '')
        self.setToolTip(self._default_tooltip)
        self.setStatusTip(self.toolTip())

        title_label = QLabel(title)
        title_label.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)

        layout = QHBoxLayout()
        layout.addWidget(title_label, 1)
        layout.addWidget(self._value_display, 1)
        if self._comment is not None:
            layout.addWidget(self._comment)

        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self.reset() 
Example 29
Project: kucher   Author: Zubax   File: monitored_quantity.py    GNU General Public License v3.0 5 votes vote down vote up
def _unittest_monitored_quantity_presenter():
    import time
    from PyQt5.QtWidgets import QApplication, QMainWindow, QGroupBox, QHBoxLayout
    app = QApplication([])

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

    a = ValueDisplayWidget(container, 'Raskolnikov', 'N/A', tooltip='This is Rodion', with_comment=True)
    layout.addWidget(a)

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

    mqp = MonitoredQuantityPresenter(a, '%.1f \u00B0C',
                                     params_default=MonitoredQuantityPresenter.DisplayParameters(comment='OK',
                                                                                                 icon_name='ok'),
                                     params_when_low=MonitoredQuantityPresenter.DisplayParameters(comment='Cold',
                                                                                                  icon_name='cold'),
                                     params_when_high=MonitoredQuantityPresenter.DisplayParameters(comment='Hot',
                                                                                                   icon_name='fire'))

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

    run_a_bit()
    mqp.display(MonitoredQuantity(123.456, MonitoredQuantity.Alert.NONE))
    run_a_bit()
    mqp.display(MonitoredQuantity(123456, MonitoredQuantity.Alert.TOO_HIGH))
    run_a_bit()
    mqp.display(MonitoredQuantity(-123.456, MonitoredQuantity.Alert.TOO_LOW))
    run_a_bit()

    win.close() 
Example 30
Project: openeo-qgis-plugin   Author: Open-EO   File: temp_dialog.py    Apache License 2.0 5 votes vote down vote up
def add_temporal(self):
        QMainWindow.show(self)
        self.dateWindow = QWidget()

        self.start_calendar = QCalendarWidget(self)
        self.start_calendar.setMinimumDate(self.minimum_date)
        self.StartDateEdit.setMinimumDate(self.minimum_date)

        self.end_calendar = QCalendarWidget(self)
        if self.max_date == None:
            self.end_calendar.setMaximumDate(QDate.currentDate())
            self.EndDateEdit.setMaximumDate(QDate.currentDate())
        else:
            self.end_calendar.setMaximumDate(self.maximum_date)
            self.EndDateEdit.setMaximumDate(self.maximum_date)

        self.start_calendar.setSelectedDate(self.StartDateEdit.date())
        self.end_calendar.setSelectedDate(self.EndDateEdit.date())

        self.start_calendar.clicked[QDate].connect(self.pick_start)
        self.end_calendar.clicked[QDate].connect(self.pick_end)
        self.hbox = QHBoxLayout()
        self.hbox.addWidget(self.start_calendar)
        self.hbox.addWidget(self.end_calendar)
        self.dateWindow.setLayout(self.hbox)
        self.dateWindow.setGeometry(400, 400, 600, 350)
        self.dateWindow.setWindowTitle('Calendar')
        self.dateWindow.show() 
Example 31
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 32
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 33
Project: cct   Author: awacha   File: devicestatusbar.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        self.layout = QtWidgets.QHBoxLayout(self)
        self.setLayout(self.layout)
        self.layout.setSpacing(0)
        self.layout.setContentsMargins(0, 0, 0, 0)
        for d in sorted(self.credo.devices):
            dev = self.credo.devices[d]
            self._statusindicators.append(DeviceStatus(self, dev))
            self.layout.addWidget(self._statusindicators[-1])
        self.layout.addStretch(1) 
Example 34
Project: cct   Author: awacha   File: optimizegeometry.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        self.progressBar.hide()
        self.pinholeList = SimpleEditableList(self.groupBox, float, lambda x:'{:.0f}'.format(x))
        self.pinholeList.setTitle('Apertures (\u03bcm):')
        l = self.groupBox.layout()
        assert isinstance(l, QtWidgets.QHBoxLayout)
        l.insertWidget(0, self.pinholeList)
        self.spacerList = SimpleEditableList(self.groupBox, float, lambda x:'{:.0f}'.format(x))
        self.spacerList.setTitle('Spacers (mm):')
        l.insertWidget(0, self.spacerList)
        self.pinholeList.addItems(self.credo.config['gui']['optimizegeometry']['pinholes'])
        self.spacerList.addItems(self.credo.config['gui']['optimizegeometry']['spacers'])
        self.resultsStore = PinholeConfigurationStore()
        self.treeView.setModel(self.resultsStore)
        self.optimizePushButton.clicked.connect(self.calculate)
        self.copyToClipboardPushButton.clicked.connect(self.copyToHTML)
        self.updateSetupParametersPushButton.clicked.connect(self.updateSetupParameters)
        self.sealingRingWidthdoubleSpinBox.setValue(self.credo.config['gui']['optimizegeometry']['sealingringwidth'])
        self.wavelengthDoubleSpinBox.setValue(self.credo.config['geometry']['wavelength'])
        self.L1WithoutSpacersDoubleSpinBox.setValue(self.credo.config['gui']['optimizegeometry']['L1withoutspacers'])
        self.L2WithoutSpacersDoubleSpinBox.setValue(self.credo.config['gui']['optimizegeometry']['L2withoutspacers'])
        self.sampleDetectorDistanceDoubleSpinBox.setValue(self.credo.config['geometry']['dist_sample_det'])
        self.detectorBeamstopDistanceDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['detector_beamstop_distance'])
        self.ph3SampleDistanceDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['ph3_sample_distance'])
        self.minPh1Ph2DistanceDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['minimum_ph1_ph2_distance'])
        self.minPh2Ph3DistanceDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['minimum_ph2_ph3_distance'])
        self.minSampleSizeDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['minimum_sample_diameter'])
        self.maxSampleSizeDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['maximum_sample_diameter'])
        self.minBeamStopSizeDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['minimum_beamstop_diameter'])
        self.maxBeamStopSizeDoubleSpinBox.setValue(
            self.credo.config['gui']['optimizegeometry']['maximum_beamstop_diameter'])
        self.pinholeList.listChanged.connect(self.onPinholeListChanged)
        self.spacerList.listChanged.connect(self.onSpacerListChanged) 
Example 35
Project: cct   Author: awacha   File: fsnselector.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        if self.horizontal:
            self.hlayout = QtWidgets.QHBoxLayout()
            self.hlayout.setContentsMargins(0, 0, 0, 0)
            self.hlayout.addWidget(self.label)
            self.hlayout.addWidget(self.prefixComboBox)
            self.hlayout.addWidget(self.label_2)
            self.hlayout.addWidget(self.FSNSpinBox)
            self.hlayout.addWidget(self.buttonContainer)
            self.hlayout.addSpacerItem(
                QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum))
            del self.formLayout
            QtWidgets.QWidget().setLayout(self.layout())  # an ugly trick to get rid of the original layout.
            self.setLayout(self.hlayout)
        self.prefixComboBox.clear()
        assert isinstance(self.credo, Instrument)
        fs = self.credo.services['filesequence']
        assert isinstance(fs, FileSequence)
        self.prefixComboBox.addItems(sorted(fs.get_prefixes()))
        self.prefixComboBox.setCurrentIndex(0)
        self.prefixComboBox.currentIndexChanged.connect(self.onPrefixChanged)
        self._fsconnections = [fs.connect('lastfsn-changed', self.onLastFSNChanged)]
        self.FSNSpinBox.valueChanged.connect(self.onFSNSpinBoxValueChanged)
        self.gotoLastPushButton.clicked.connect(self.onGotoLast)
        self.gotoFirstPushButton.clicked.connect(self.onGotoFirst)
        self.reloadPushButton.clicked.connect(self.onReload)
        self.onPrefixChanged() 
Example 36
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 37
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, engine, *args, **kwargs):
        super(SectionView, self).__init__(*args, **kwargs)

        self.section_layout = QtWidgets.QStackedLayout()

        null_view = QtWidgets.QLabel('No section selected...')
        null_view.setLayout(QtWidgets.QHBoxLayout())
        self.section_layout.insertWidget(0, null_view)

        self._section_paramters = SectionParameters(engine)
        self.section_layout.insertWidget(1, self._section_paramters)

        self.setLayout(self.section_layout) 
Example 38
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 39
Project: PyQt-multifunctional-uart-helper   Author: IronSublimate   File: Ui_piano.py    MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setObjectName("gridLayout")
        self.groupBox_settings = QtWidgets.QGroupBox(Form)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.groupBox_settings.sizePolicy().hasHeightForWidth())
        self.groupBox_settings.setSizePolicy(sizePolicy)
        self.groupBox_settings.setObjectName("groupBox_settings")
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.groupBox_settings)
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.label_10 = QtWidgets.QLabel(self.groupBox_settings)
        self.label_10.setObjectName("label_10")
        self.horizontalLayout_6.addWidget(self.label_10)
        self.comboBox_transpose = QtWidgets.QComboBox(self.groupBox_settings)
        self.comboBox_transpose.setObjectName("comboBox_transpose")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.comboBox_transpose.addItem("")
        self.horizontalLayout_6.addWidget(self.comboBox_transpose)
        self.gridLayout.addWidget(self.groupBox_settings, 0, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(219, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(375, 208, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem1, 1, 0, 1, 2)

        self.retranslateUi(Form)
        self.comboBox_transpose.setCurrentIndex(3)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 40
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: snd.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent = None):
	
		QWidget.__init__(self, parent)

		self.format = None
		self.output = None
		self.buffer = QBuffer()
		
		self.volumeSlider = QSlider(Qt.Horizontal)
		self.volumeSlider.setMaximum(10)
		self.volumeSlider.setPageStep(1)
		self.volumeSlider.setValue(5)
		
		self.playButton = QPushButton()
		self.playButton.setIcon(QIcon("icons/play.png"))

		self.stopButton = QPushButton()
		self.stopButton.setIcon(QIcon("icons/stop.png"))
		
		self.volumeSlider.valueChanged.connect(self.change_volume)
		self.playButton.clicked.connect(self.play_pause)
		self.stopButton.clicked.connect(self.stop)
		
		layout = QHBoxLayout(self)
		layout.addWidget(self.playButton)
		layout.addWidget(self.stopButton)
		layout.addWidget(self.volumeSlider)
		layout.addStretch() 
Example 41
Project: tf-pose   Author: SrikanthVelpuri   File: TransformGuiTemplate_pyqt5.py    Apache License 2.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(224, 117)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
        Form.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout.setContentsMargins(0, 0, 0, 0)
        self.verticalLayout.setSpacing(1)
        self.verticalLayout.setObjectName("verticalLayout")
        self.translateLabel = QtWidgets.QLabel(Form)
        self.translateLabel.setObjectName("translateLabel")
        self.verticalLayout.addWidget(self.translateLabel)
        self.rotateLabel = QtWidgets.QLabel(Form)
        self.rotateLabel.setObjectName("rotateLabel")
        self.verticalLayout.addWidget(self.rotateLabel)
        self.scaleLabel = QtWidgets.QLabel(Form)
        self.scaleLabel.setObjectName("scaleLabel")
        self.verticalLayout.addWidget(self.scaleLabel)
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.mirrorImageBtn = QtWidgets.QPushButton(Form)
        self.mirrorImageBtn.setToolTip("")
        self.mirrorImageBtn.setObjectName("mirrorImageBtn")
        self.horizontalLayout.addWidget(self.mirrorImageBtn)
        self.reflectImageBtn = QtWidgets.QPushButton(Form)
        self.reflectImageBtn.setObjectName("reflectImageBtn")
        self.horizontalLayout.addWidget(self.reflectImageBtn)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 42
Project: MeiTingTrunk   Author: Xunius   File: _MainFrame.py    GNU General Public License v3.0 5 votes vote down vote up
def createBiBTab(self):

        frame=QtWidgets.QWidget()
        scroll=QtWidgets.QScrollArea(self)
        scroll.setWidgetResizable(True)
        scroll.setWidget(frame)
        v_layout=QtWidgets.QVBoxLayout()

        self.copy_bib_button=QtWidgets.QToolButton(self)
        self.copy_bib_button.setText('Copy')
        self.copy_bib_button.setIcon(QIcon.fromTheme('edit-copy',
                self.style().standardIcon(QStyle.SP_FileDialogDetailedView)))
        self.copy_bib_button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

        h_layout=QtWidgets.QHBoxLayout()
        h_layout.addWidget(self.copy_bib_button)
        h_layout.addStretch()

        self.bib_textedit=QtWidgets.QTextEdit(self)
        self.bib_textedit.setReadOnly(True)
        self.bib_textedit.setFont(self.settings.value('/display/fonts/bibtex',QFont))
        v_layout.addLayout(h_layout)
        v_layout.addWidget(self.bib_textedit)
        frame.setLayout(v_layout)
        self.copy_bib_button.clicked.connect(self.copyBibButtonClicked)

        return scroll 
Example 43
Project: MeiTingTrunk   Author: Xunius   File: search_res_frame.py    GNU General Public License v3.0 5 votes vote down vote up
def createClearSearchFrame(self):
        '''Create a header frame showing search term, results count and control
        buttons'''

        frame=QtWidgets.QFrame()
        frame.setStyleSheet('background: rgb(235,225,190)')
        ha=QtWidgets.QHBoxLayout()

        # create folder button
        self.create_folder_button=QtWidgets.QToolButton(self)
        self.create_folder_button.setText('Create Folder From Selection')
        self.create_folder_button.clicked.connect(self.createFolder)

        # hide doc table button
        #self.hide_doc_table_button=QtWidgets.QToolButton(self)
        #self.hide_doc_table_button.setText('Hide Document Table')
        #self.hide_doc_table_button.clicked.connect(lambda: self.hide_doc_sig.emit())

        # clear button
        self.clear_searchres_button=QtWidgets.QToolButton(self)
        self.clear_searchres_button.setText('Close')

        self.label=QtWidgets.QLabel('Search results')
        ha.addWidget(self.label)
        ha.addWidget(self.create_folder_button)
        #ha.addWidget(self.hide_doc_table_button)
        ha.addWidget(self.clear_searchres_button)

        frame.setLayout(ha)

        return frame 
Example 44
Project: MeiTingTrunk   Author: Xunius   File: choose_app_dialog.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, title, app_type, settings, parent=None):

        super(self.__class__,self).__init__(parent=parent)

        self.settings=settings

        self.setWindowTitle(title)
        self.resize(300,100)

        va=QtWidgets.QVBoxLayout(self)

        label=QtWidgets.QLabel('Give the command to launch editor (E.g. vim)')
        va.addWidget(label)


        default=self.settings.value(app_type, type=str)
        self.le=QtWidgets.QLineEdit(self)
        self.le.setText(default)

        #self.choose_button=QtWidgets.QPushButton('Choose')
        #self.choose_button.clicked.connect(self.chooseButtonClicked)

        ha=QtWidgets.QHBoxLayout()
        ha.addWidget(self.le)
        #ha.addWidget(self.choose_button)

        va.addLayout(ha)

        self.buttons=QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
                Qt.Horizontal, self)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        va.addWidget(self.buttons) 
Example 45
Project: MeiTingTrunk   Author: Xunius   File: export_dialog.py    GNU General Public License v3.0 5 votes vote down vote up
def loadExportRISOptions(self):
        '''Load widgets for the Export RIS category'''

        scroll,va=self.createFrame('Export to RIS')
        self.current_task='ris_export'

        #self.ris_settings={}

        #--------------Folder choice section--------------
        label=QtWidgets.QLabel('Choose folder(s) to export.')
        va.addWidget(label)

        if self.folder_tree:
            self.folder_tree.setMinimumHeight(300)
            self.clearFolderTreeState()
            va.addWidget(self.folder_tree)
        else:
            va.addWidget(QtWidgets.QLabel('Library empty'))
            self.export_button.setEnabled(False)

        #--------------Export manner section--------------
        self.radio_groupbox=QtWidgets.QGroupBox('Saving manner')
        ha2=QtWidgets.QHBoxLayout()
        self.radio_groupbox.setLayout(ha2)

        choices=['All in one', 'Per folder', 'Per document']
        for ii in choices:
            radioii=QtWidgets.QRadioButton(ii)
            if ii=='Per folder':
                radioii.setChecked(True)
            ha2.addWidget(radioii)

        va.addWidget(self.radio_groupbox)

        #--------------File path type section--------------
        self.path_type_groupbox=self.createPathTypeGroup('bib')
        va.addWidget(self.path_type_groupbox)

        return scroll 
Example 46
Project: MeiTingTrunk   Author: Xunius   File: meta_tab.py    GNU General Public License v3.0 5 votes vote down vote up
def createMultiLineField(self, label, key, font_name):
        '''Create a label and a foldable textedit in 2 rows

        Args:
            label (str): text to display in the label.
            key (str): field name for the textedit, this is also the key in
                       the DocMeta dict.
            font_name (str): string specifying the font used in the textedit.
        '''

        te=AdjustableTextEditWithFold(key)
        te.setFrameStyle(QtWidgets.QFrame.NoFrame)
        self.fold_dict[key]=te.is_fold
        te.fold_change_signal.connect(self.foldChanged)

        te.setFont(self.settings.value('display/fonts/%s' %font_name, QFont))

        # set tooltip texts
        if key=='authors_l':
            te.label_enabled=True
            te.tooltip_text='lastname, firstname\nlastname, firstname\n...'
        elif key=='tags_l':
            te.label_enabled=True
            te.tooltip_text='tag1; tag2; tag3 ...'
        elif key=='keywords_l':
            te.label_enabled=True
            te.tooltip_text='keyword1; keyword2; keyword3 ...'
        self.fields_dict[key]=te

        h_layout=QtWidgets.QHBoxLayout()
        h_layout.addWidget(self.createLabel(label))
        h_layout.addWidget(te.fold_button)

        self.v_layout.addLayout(h_layout)
        self.v_layout.addWidget(te)

        return te 
Example 47
Project: MeiTingTrunk   Author: Xunius   File: meta_tab.py    GNU General Public License v3.0 5 votes vote down vote up
def createFileField(self,text=None,font_name='meta_keywords'):
        '''Create lineedit for an attachment file and a associated del button

        Kwargs:
            text (str or None): file path.
            font_name (str): string specifying the font used in the textedit.
        '''

        h_layout=QtWidgets.QHBoxLayout()

        le=FileLineEdit(self.settings.value('saving/current_lib_folder',
            type=str), parent=self)
        #le.setReadOnly(True)
        le.setFont(self.settings.value('display/fonts/%s' %font_name, QFont))

        if text is not None:
            le.setText(text)

        if le not in self.fields_dict['files_l']:
            self.fields_dict['files_l'].append(le)

        # create a del file button
        button=QtWidgets.QPushButton()
        font_height=le.fm.height()
        button=createDelButton(font_height)
        button.clicked.connect(lambda: self.delFileButtonClicked(
            self.fields_dict['files_l'].index(le)))

        le.del_button=button
        h_layout.addWidget(le.type_label)
        h_layout.addWidget(le)
        h_layout.addWidget(button)

        LOGGER.debug('Insert file %s entry at %s' %(text,self.file_insert_idx))

        # keep a record of the current idx in the vertical layout
        self.v_layout.insertLayout(self.file_insert_idx,h_layout)
        self.file_insert_idx+=1

        return 
Example 48
Project: MeiTingTrunk   Author: Xunius   File: duplicate_frame.py    GNU General Public License v3.0 5 votes vote down vote up
def createClearDuplicateFrame(self):

        frame=QtWidgets.QFrame()
        frame.setStyleSheet('background: rgb(235,225,190)')
        ha=QtWidgets.QHBoxLayout()
        self.current_view='table'  # 'table' | 'merge'

        # del button
        self.del_duplicate_button=QtWidgets.QToolButton(self)
        self.del_duplicate_button.setText('Delete Selected')
        self.del_duplicate_button.clicked.connect(self.delDocs)

        # change to merge/table view button
        self.change_view_button=QtWidgets.QToolButton(self)
        self.change_view_button.setText('Change to Merge View')
        self.change_view_button.clicked.connect(self.changeView)

        # clear button
        self.clear_duplicate_button=QtWidgets.QToolButton(self)
        self.clear_duplicate_button.setText('Exit')

        self.clear_duplicate_label=QtWidgets.QLabel()
        ha.addWidget(self.clear_duplicate_label)
        tip_label=QtWidgets.QLabel()
        tip_icon=QIcon.fromTheme('help-about',
            self.style().standardIcon(QStyle.SP_MessageBoxInformation)).pixmap(
                    QSize(16,16))
        tip_label.setPixmap(tip_icon)
        tip_label.setToolTip('''Change "Mininimum Similary Score" in "Preferences" to change the filtering of matching results.''')

        ha.addWidget(tip_label)
        ha.addWidget(self.del_duplicate_button)
        ha.addWidget(self.change_view_button)
        ha.addWidget(self.clear_duplicate_button)

        frame.setLayout(ha)

        return frame 
Example 49
Project: eddy   Author: obdasystems   File: dock.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, title, icon, parent=None):
        """
        Initialize the widget.
        :type title: str
        :type icon: QIcon
        :type parent: QDockWidget
        """
        super().__init__(parent)
        # CREATE TITLEBAR ICON AND TITLE
        self.imageLabel = QtWidgets.QLabel(self)
        self.imageLabel.setPixmap(icon.pixmap(18))
        self.imageLabel.setAlignment(QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.imageLabel.setContentsMargins(0, 0, 0, 0)
        self.imageLabel.setFixedSize(18, 18)
        self.titleLabel = QtWidgets.QLabel(title, self)
        self.titleLabel.setAlignment(QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.titleLabel.setContentsMargins(4, 0, 0, 0)
        self.titleLabel.setFont(Font('Roboto', 13))
        # CREATE STANDARD BUTTONS
        close = QtWidgets.QPushButton(self)
        close.setIcon(QtGui.QIcon(':/icons/18/ic_close_black'))
        close.setFixedSize(18, 18)
        connect(close.clicked, parent.close)
        self.buttons = [close]
        # CONFIGURE LAYOUT
        self.mainLayout = QtWidgets.QHBoxLayout(self)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)
        self.setContentsMargins(6, 4, 6, 4)
        self.setContextMenuPolicy(QtCore.Qt.PreventContextMenu)
        self.setFont(Font('Roboto', 13))
        self.updateLayout()

    #############################################
    #   INTERFACE
    ################################# 
Example 50
Project: pdash   Author: CPChain   File: comment.py    GNU General Public License v3.0 5 votes vote down vote up
def ui(self):
        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setAlignment(Qt.AlignLeft)
        layout.setSpacing(4)
        self.stars = [Star(i + 1, self.listener) for i in range(5)]
        for star in self.stars:
            layout.addWidget(star)
        text = Builder().model(self.star_text).style("color: #777; font-size: 14px").build()
        text.setMinimumHeight(40)
        layout.addSpacing(4)
        layout.addWidget(text)
        layout.addStretch(1)
        return layout