Python PyQt5.QtWidgets.QPushButton() Examples

The following are code examples for showing how to use PyQt5.QtWidgets.QPushButton(). 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: SpriteMator   Author: rafaelvasco   File: layer_manager_widget.py    Apache License 2.0 7 votes vote down vote up
def __init__(self, parent=None):

        super().__init__(parent)

        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self._listWidget = DraggableListWidget()
        self._listWidget.selectedItemChanged.connect(self._on_layer_selected_changed)
        self._listWidget.orderChanged.connect(self._on_layer_order_changed)

        self._addLayerBtn = QPushButton()
        self._addLayerBtn.setText('Add Layer')
        self._addLayerBtn.clicked.connect(self._on_add_layer_btn_clicked)

        self._layout = QVBoxLayout(self)
        self._layout.setAlignment(Qt.AlignBottom)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.addWidget(self._listWidget)
        self._layout.addWidget(self._addLayerBtn)

        self._sprite = None

        self.setAcceptDrops(True) 
Example 2
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 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, 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 4
Project: dcc   Author: amimo   File: renamewindow.py    Apache License 2.0 6 votes vote down vote up
def __init__(self, parent=None, win=None, element="", info=()):
        super(RenameDialog, self).__init__(parent)

        self.sourceWin = parent
        self.info = info
        self.element = element
        title = "Rename: " + element
        self.setWindowTitle(title)

        layout = QtWidgets.QGridLayout()
        question = QtWidgets.QLabel("Please enter new name:")
        layout.addWidget(question, 0, 0)
        self.lineEdit = QtWidgets.QLineEdit()
        layout.addWidget(self.lineEdit, 0, 1)
        self.buttonOK = QtWidgets.QPushButton("OK", self)
        layout.addWidget(self.buttonOK, 1, 1)
        self.buttonCancel = QtWidgets.QPushButton("Cancel", self)
        layout.addWidget(self.buttonCancel, 1, 0)

        self.lineEdit.setText(self.element)

        self.setLayout(layout)

        self.buttonCancel.clicked.connect(self.cancelClicked)
        self.buttonOK.clicked.connect(self.okClicked) 
Example 5
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 6
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 6 votes vote down vote up
def actionBox(self):
        action_box = QtWidgets.QGroupBox('Actions')
        action_layout = QtWidgets.QGridLayout()
        action_layout.setSpacing(2)
        action_layout.setContentsMargins(2, 2, 2, 2)
        action_box.setLayout(action_layout)

        duplicate_section = QtWidgets.QPushButton('dup')
        duplicate_section.clicked.connect(self.duplicateSection)
        action_layout.addWidget(duplicate_section, 0, 0)

        delete_section = QtWidgets.QPushButton('del')
        delete_section.clicked.connect(self.deleteSection)
        action_layout.addWidget(delete_section, 0, 1)

        generate = QtWidgets.QPushButton('gen')
        generate.clicked.connect(self.generateMeasures)
        action_layout.addWidget(generate, 1, 0)

        regenerate = QtWidgets.QPushButton('re-gen')
        regenerate.clicked.connect(lambda x: self.generateMeasures(gen_all=True))
        action_layout.addWidget(regenerate, 1, 1)

        return action_box 
Example 7
Project: mega.syno   Author: john-shine   File: tray.py    GNU General Public License v3.0 6 votes vote down vote up
def initUI(self): 
        width = QDesktopWidget().screenGeometry(-1).width()

        self.setWindowTitle('system tray')
        self.setWindowFlags(Qt.CustomizeWindowHint)
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setWindowFlag(Qt.WindowCloseButtonHint, False)
        self.setWindowFlag(Qt.WindowMinimizeButtonHint, False)     
        
        self.button = QPushButton('', self)
        self.button.setGeometry(QRect(width - self.icon_size - 1, 0, self.icon_size, self.icon_size))
        ico = QtGui.QPixmap(':/mega.ico')
        self.button.setIcon(QtGui.QIcon(ico))
        self.button.clicked.connect(self.launch_mega)
        
        self.setGeometry(0, 0, width, self.icon_size)
        self.setFixedSize(self.width(), self.height())

        self.show() 
Example 8
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 9
Project: SpriteMator   Author: rafaelvasco   File: options_bar_widget.py    Apache License 2.0 6 votes vote down vote up
def _initialize_style(self):

        style_sheet = """

            QPushButton
            {
                background: #222;
                border: none;
                font-size: 16px;
                color: white;
            }

            QPushButton:checked
            {
                background: #44859E;

            }

        """

        self.setStyleSheet(style_sheet)

        # --------------------------------------------- 
Example 10
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 - 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 11
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, setting_params=None):
        super().__init__()
        self.setting_params = setting_params
        self.search_input = Qw.QLineEdit()
        self.table = AngryTableView(self.setting_params['angrysearch_lite'],
                                    self.setting_params['row_height'])
        self.upd_button = Qw.QPushButton('update')
        self.fts_checkbox = Qw.QCheckBox()

        grid = Qw.QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(self.search_input, 1, 1)
        grid.addWidget(self.fts_checkbox, 1, 3)
        grid.addWidget(self.upd_button, 1, 4)
        grid.addWidget(self.table, 2, 1, 4, 4)
        self.setLayout(grid)

        self.setTabOrder(self.search_input, self.table)
        self.setTabOrder(self.table, self.upd_button)


# THE MAIN APPLICATION WINDOW WITH THE STATUS BAR AND LOGIC
# LOADS AND SAVES QSETTINGS FROM ~/.config/angrysearch
# INITIALIZES AND SETS GUI, WAITING FOR USER INPUTS 
Example 12
Project: libView   Author: liyanqing1987   File: libView.py    GNU General Public License v2.0 5 votes vote down vote up
def initCellListFrame(self):
        """
        Init liberty-cell information on left sideBar.
        """
        # self.cellListFrame
        self.cellListFrame.setFrameShadow(QFrame.Raised)
        self.cellListFrame.setFrameShape(QFrame.Box)

        self.cellSelectLine = QLineEdit()
        cellSelectButton = QPushButton('Select', self.cellListFrame)
        cellSelectButton.clicked.connect(self.selectCell)

        self.cellListTree = QTreeWidget(self.cellListFrame)
        self.cellListTree.setColumnCount(1)
        self.cellListTree.setHeaderLabel('Lib->Cell')
        self.cellListTree.clicked.connect(self.cellListBeClicked)

        # self.cellListFrame - Grid
        cellListFrameGrid = QGridLayout()

        cellListFrameGrid.addWidget(self.cellSelectLine, 0, 0)
        cellListFrameGrid.addWidget(cellSelectButton, 0, 1)
        cellListFrameGrid.addWidget(self.cellListTree, 1, 0, 1, 2)

        cellListFrameGrid.setRowStretch(0, 1)
        cellListFrameGrid.setRowStretch(1, 20)
        cellListFrameGrid.setColumnStretch(0, 10)
        cellListFrameGrid.setColumnStretch(1, 1)

        self.cellListFrame.setLayout(cellListFrameGrid) 
Example 13
Project: ILTIS   Author: grg2rsr   File: Options_Control_Widget.py    GNU General Public License v2.0 5 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 14
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 15
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 16
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 17
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 18
Project: kucher   Author: Zubax   File: motor_identification_control_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self,
                 parent:    QWidget,
                 commander: Commander):
        super(MotorIdentificationControlWidget, self).__init__(parent)

        self._commander = commander

        self._mode_map = {
            _humanize(mid): mid for mid in MotorIdentificationMode
        }

        self._mode_selector = QComboBox(self)
        self._mode_selector.setEditable(False)
        # noinspection PyTypeChecker
        self._mode_selector.addItems(map(_humanize,
                                         sorted(MotorIdentificationMode,
                                                key=lambda x: x != MotorIdentificationMode.R_L_PHI)))

        go_button = QPushButton(get_icon('play'), 'Launch', self)
        go_button.clicked.connect(self._execute)

        self.setLayout(
            lay_out_vertically(
                lay_out_horizontally(
                    QLabel('Select parameters to estimate:', self),
                    self._mode_selector,
                    (None, 1),
                ),
                lay_out_horizontally(
                    QLabel('Then click', self),
                    go_button,
                    QLabel('and wait. The process will take a few minutes to complete.', self),
                    (None, 1),
                ),
                (None, 1)
            )
        ) 
Example 19
Project: MovieHeavens   Author: lt94   File: movies.py    GNU General Public License v2.0 5 votes vote down vote up
def init_widgets(self):
        self.setWindowTitle(self.tr("Search Movies"))
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.movie_name_label = QLabel(self.tr("电影名称:"))
        self.movie_name_line_edit = QLineEdit()

        self.movie_source_label = QLabel(self.tr("选择片源:"))
        self.movie_source_combobox = QComboBox()
        self.movie_source_combobox.addItem(self.tr('电影天堂'))

        self.search_push_button = QPushButton(self.tr("查询"))

        self.tip_label = QLabel(self.tr("未开始查询..."))
        self.search_content_label = QLabel(self.tr("查询内容:"))
        self.search_content_text_list = QListWidget()

        self.menu_bar = self.menuBar()

        return self 
Example 20
Project: CT-Marker   Author: OoO256   File: qt.py    MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()

        self.buttons = {}
        self.buttons['mark'] = QPushButton('mark', self)
        self.buttons['mark'].clicked.connect(self.mark)
        self.lines = {}
        self.inputs = []

        self.filepaths = []
        self.path_solution = ''

        self.init_UI() 
Example 21
Project: CT-Marker   Author: OoO256   File: qt.py    MIT License 5 votes vote down vote up
def addLine(self, idx, name, text, box = 'line', button = None, callback = None):
        self.grid.addWidget(QLabel(text), idx, 0)

        if box is 'line':
            self.lines[name] = QLineEdit()
            self.grid.addWidget(self.lines[name], idx, 1)
        elif box is 'text':
            self.inputs.append(QTextEdit())
            self.grid.addWidget(self.inputs[len(self.inputs) - 1], idx, 1)

        if button is not None:
            self.buttons[name] = QPushButton(button, self)
            self.grid.addWidget(self.buttons[name], idx, 2)

            self.buttons[name].clicked.connect(callback) 
Example 22
Project: rainbow6-siege-danmu-request   Author: fy-meng   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, font, font_size, font_color):
        super().__init__()

        self.setGeometry(550, 350, 100, 100)
        self.setWindowTitle('Control')
        self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
        self.setAttribute(Qt.WA_TranslucentBackground)

        grid = QGridLayout()
        self.setLayout(grid)

        self.button_attacker = QPushButton('Next Attacker', self)
        self.button_attacker.clicked.connect(self.handle_button_attacker)
        self.button_attacker.setFont((QFont(font, font_size, QFont.Bold)))
        self.button_attacker.setStyleSheet('QPushButton {background-color: rgba(255, 255, 255, 55); color: '
                                           + font_color + ';}')

        self.button_defender = QPushButton('Next Defender', self)
        self.button_defender.clicked.connect(self.handle_button_defender)
        self.button_defender.setFont((QFont(font, font_size, QFont.Bold)))
        self.button_defender.setStyleSheet('QPushButton {background-color: rgba(255, 255, 255, 55); color: '
                                           + font_color + ';}')

        grid.addWidget(self.button_attacker, 0, 0)
        grid.addWidget(self.button_defender, 1, 0)

        self._offset = None

        self.show() 
Example 23
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 24
Project: Python-GUI   Author: arpitj07   File: New.py    MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(100, 40, 201, 81))
        font = QtGui.QFont()
        font.setPointSize(9)
        font.setBold(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")

        
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(150, 190, 111, 28))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")
        
        self.lineEdit = QtWidgets.QLineEdit(Form)
        self.lineEdit.setGeometry(QtCore.QRect(100, 140, 201, 22))
        self.lineEdit.setObjectName("lineEdit")

        
        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 25
Project: Python-GUI   Author: arpitj07   File: openWindow.py    MIT License 5 votes vote down vote up
def setupUi(self, OpenWindow):
        OpenWindow.setObjectName("OpenWindow")
        OpenWindow.resize(535, 389)
        self.centralwidget = QtWidgets.QWidget(OpenWindow)
        self.centralwidget.setObjectName("centralwidget")
        
        self.OpenTeam = QtWidgets.QLabel(self.centralwidget)
        self.OpenTeam.setGeometry(QtCore.QRect(150, 120, 231, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.OpenTeam.setFont(font)
        self.OpenTeam.setObjectName("OpenTeam")

        
        self.OpenTheTeam = QtWidgets.QLineEdit(self.centralwidget)
        self.OpenTheTeam.setGeometry(QtCore.QRect(180, 160, 151, 22))
        self.OpenTheTeam.setObjectName("OpenTheTeam")
        
        self.openButton = QtWidgets.QPushButton(self.centralwidget)
        self.openButton.setGeometry(QtCore.QRect(210, 210, 93, 28))
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.openButton.setFont(font)
        self.openButton.setObjectName("openButton")
        
        OpenWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(OpenWindow)
        self.statusbar.setObjectName("statusbar")
        OpenWindow.setStatusBar(self.statusbar)

        self.retranslateUi(OpenWindow)
        QtCore.QMetaObject.connectSlotsByName(OpenWindow) 
Example 26
Project: HippMapp3r   Author: mgoubran   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def fun_button(nested_dictionary, module, btn_num, hyper_home):
    fun_name = nested_dictionary[module]['functions'][btn_num]['name']
    btn = QtWidgets.QPushButton(fun_name)
    btn.clicked.connect(lambda: run_func(nested_dictionary, module, btn_num, hyper_home))
    btn.setToolTip(nested_dict[module]['functions'][btn_num]['helpmsg'])

    return btn 
Example 27
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 28
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 29
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 30
Project: cct   Author: awacha   File: configeditor.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def editorValue(self):
        if isinstance(self._editorwidget, QtWidgets.QPushButton):
            return self._editorwidget.isChecked()
        elif isinstance(self._editorwidget, QtWidgets.QLineEdit):
            return self._editorwidget.text()
        elif isinstance(self._editorwidget, (QtWidgets.QDoubleSpinBox, QtWidgets.QSpinBox)):
            return self._editorwidget.value()
        else:
            raise TypeError(self._editorwidget) 
Example 31
Project: cct   Author: awacha   File: connections.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        assert isinstance(self.credo, Instrument)
        self.layout = QtWidgets.QGridLayout(self)
        for i, d in enumerate(sorted(self.credo.devices)):
            dev = self.credo.devices[d]
            assert isinstance(dev, Device)
            self.layout.addWidget(QtWidgets.QLabel(dev.name, self), i, 0)
            self._connectbuttons[d] = QtWidgets.QPushButton('Connect', self)
            self.layout.addWidget(self._connectbuttons[d], i, 1)
            self._connectbuttons[d].clicked.connect(self.onButtonClicked)
            self._disconnectbuttons[d] = QtWidgets.QPushButton('Disconnect', self)
            self.layout.addWidget(self._disconnectbuttons[d], i, 2)
            self._disconnectbuttons[d].clicked.connect(self.onButtonClicked)
        self.setWindowTitle('Connect/disconnect devices')
        self.setWindowIcon(QtGui.QIcon.fromTheme('network-idle')) 
Example 32
Project: musaic   Author: al165   File: elements.py    GNU General Public License v3.0 5 votes vote down vote up
def injectionBox(self):
        injection_box = QtWidgets.QGroupBox('Style')
        injection_layout = QtWidgets.QGridLayout()
        injection_layout.setSpacing(2)
        injection_layout.setContentsMargins(2, 2, 2, 2)
        injection_box.setLayout(injection_layout)

        self.parameters['context_mode'] = QtWidgets.QComboBox()
        self.parameters['context_mode'].addItems(['real', 'inject'])
        self.parameters['context_mode'].setToolTip("Use the 'real' previous measures or 'inject' new measures")
        self.parameters['context_mode'].currentIndexChanged.connect(self.parameterChanged)
        injection_layout.addWidget(self.parameters['context_mode'], 0, 0, 1, 3)

        self.injection_params = {
            'scale': QtWidgets.QComboBox(),
            'qb': QtWidgets.QPushButton(),
            'eb': QtWidgets.QPushButton(),
            'lb': QtWidgets.QPushButton(),
            'fb': QtWidgets.QPushButton(),
            'tb': QtWidgets.QPushButton()
        }

        sp = QtWidgets.QSizePolicy()
        sp.setRetainSizeWhenHidden(True)
        sp.setHorizontalStretch(2)

        self.injection_params['scale'].addItems(['maj', 'min', 'pen', '5th'])
        self.injection_params['scale'].setSizePolicy(sp)
        injection_layout.addWidget(self.injection_params['scale'], 0, 3, 1, 2)

        for i, cb in enumerate(['qb', 'eb', 'lb', 'fb', 'tb']):
            button = self.injection_params[cb]
            button.setSizePolicy(sp)
            button.setText(cb)
            button.setCheckable(True)
            button.clicked[bool].connect(self.parameterChanged)
            injection_layout.addWidget(button, 1, i)

        return injection_box 
Example 33
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 34
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 35
Project: PyLSS   Author: gmrandazzo   File: gui_plotmaps.py    GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupUi(self, PlotMaps):
        PlotMaps.setObjectName("PlotMaps")
        PlotMaps.resize(811, 654)
        self.gridLayout = QtWidgets.QGridLayout(PlotMaps)
        self.gridLayout.setObjectName("gridLayout")
        self.label_4 = QtWidgets.QLabel(PlotMaps)
        self.label_4.setObjectName("label_4")
        self.gridLayout.addWidget(self.label_4, 0, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(358, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
        self.modelBox = QtWidgets.QComboBox(PlotMaps)
        self.modelBox.setMinimumSize(QtCore.QSize(260, 26))
        self.modelBox.setObjectName("modelBox")
        self.gridLayout.addWidget(self.modelBox, 0, 2, 1, 1)
        self.plotterBox = QtWidgets.QGroupBox(PlotMaps)
        self.plotterBox.setMinimumSize(QtCore.QSize(551, 311))
        self.plotterBox.setObjectName("plotterBox")
        self.gridLayout.addWidget(self.plotterBox, 1, 0, 1, 4)
        spacerItem1 = QtWidgets.QSpacerItem(932, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem1, 2, 0, 1, 3)
        self.closeButton = QtWidgets.QPushButton(PlotMaps)
        self.closeButton.setMaximumSize(QtCore.QSize(110, 32))
        self.closeButton.setObjectName("closeButton")
        self.gridLayout.addWidget(self.closeButton, 2, 3, 1, 1)
        self.closeButton.raise_()
        self.plotterBox.raise_()

        self.retranslateUi(PlotMaps)
        QtCore.QMetaObject.connectSlotsByName(PlotMaps) 
Example 36
Project: PyQt5-Wamp   Author: icefo   File: PyQt5_GUI.py    MIT License 5 votes vote down vote up
def __init__(self, parent):
        # this allow the use of the parent's methods when needed
        super(MainWidget, self).__init__(parent=parent)

        self.number_1 = QLineEdit()
        self.number_2 = QLineEdit()

        self.addition_button = QPushButton("push to add !")
        self.addition_result = QLineEdit()

        self.widget_init() 
Example 37
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 38
Project: tf-pose   Author: SrikanthVelpuri   File: exportDialogTemplate_pyqt5.py    Apache License 2.0 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(241, 367)
        self.gridLayout = QtWidgets.QGridLayout(Form)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
        self.itemTree = QtWidgets.QTreeWidget(Form)
        self.itemTree.setObjectName("itemTree")
        self.itemTree.headerItem().setText(0, "1")
        self.itemTree.header().setVisible(False)
        self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
        self.label_2 = QtWidgets.QLabel(Form)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
        self.formatList = QtWidgets.QListWidget(Form)
        self.formatList.setObjectName("formatList")
        self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
        self.exportBtn = QtWidgets.QPushButton(Form)
        self.exportBtn.setObjectName("exportBtn")
        self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
        self.closeBtn = QtWidgets.QPushButton(Form)
        self.closeBtn.setObjectName("closeBtn")
        self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
        self.paramTree = ParameterTree(Form)
        self.paramTree.setObjectName("paramTree")
        self.paramTree.headerItem().setText(0, "1")
        self.paramTree.header().setVisible(False)
        self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
        self.label_3 = QtWidgets.QLabel(Form)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
        self.copyBtn = QtWidgets.QPushButton(Form)
        self.copyBtn.setObjectName("copyBtn")
        self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form) 
Example 39
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 40
Project: MeiTingTrunk   Author: Xunius   File: tools.py    GNU General Public License v3.0 5 votes vote down vote up
def createDelButton(font_height=12):
    '''Create a circular button with a symbol x

    Kwargs:
        font_height (int): font height. Determines button size.
    '''

    button=QtWidgets.QPushButton()
    button.setFixedWidth(int(font_height))
    button.setFixedHeight(int(font_height))
    button.setText('\u2715')
    button.setStyleSheet('''
    QPushButton {
        border: 1px solid rgb(190,190,190);
        background-color: rgb(190,190,190);
        border-radius: %dpx;
        font: bold %dpx;
        color: white;
        text-align: center;
        }

    QPushButton:pressed {
        border-style: inset;
        }
    ''' %(int(font_height/2), max(1,font_height-2))
    )

    return button 
Example 41
Project: MeiTingTrunk   Author: Xunius   File: zim_dialog.py    GNU General Public License v3.0 5 votes vote down vote up
def loadUpdateFromZimOptions(self):

        scroll,va=self.createFrame('Update document notes from Zim')

        va.addWidget(getHLine())
        self.use_zim_default_cb=QtWidgets.QCheckBox('Use zim notes as default note source?')
        if self.settings.value('saving/use_zim_default', type=bool):
            self.use_zim_default_cb.setChecked(True)

        va.addWidget(self.use_zim_default_cb)
        label=QtWidgets.QLabel('''Zim notes saved in %s will be first examined
                when loading the "Notes" tab. If a zim file is not found, it
                will then load data saved in the sqlite database. Changes
                made to the zim files are reflected inside MTT, and also
                get saved into sqlite database.''')
        label.setTextFormat(Qt.RichText)
        label.setWordWrap(True)
        va.addWidget(label)

        self.update_from_zim_button=QtWidgets.QPushButton('Save')
        self.update_from_zim_button.clicked.connect(self.doUpdate)
        va.addWidget(self.update_from_zim_button, 0, Qt.AlignRight)

        va.addStretch()
        self.current_task='update'

        return scroll 
Example 42
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 43
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 44
Project: Spyce   Author: imec-myhdl   File: SendPars.py    GNU Lesser General Public License v2.1 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(440, 413)
        self.gridLayoutWidget = QtWidgets.QWidget(Dialog)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(20, 60, 391, 271))
        self.gridLayoutWidget.setObjectName("gridLayoutWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
        self.gridLayout.setObjectName("gridLayout")
        self.pbSend = QtWidgets.QPushButton(Dialog)
        self.pbSend.setGeometry(QtCore.QRect(160, 350, 83, 24))
        self.pbSend.setObjectName("pbSend")
        self.spVars = QtWidgets.QSpinBox(Dialog)
        self.spVars.setGeometry(QtCore.QRect(220, 11, 121, 31))
        self.spVars.setMinimum(1)
        self.spVars.setMaximum(12)
        self.spVars.setObjectName("spVars")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(100, 20, 91, 16))
        self.label.setObjectName("label")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example 45
Project: eddy   Author: obdasystems   File: dock.py    GNU General Public License v3.0 5 votes vote down vote up
def addTitleBarButton(self, button):
        """
        Add a button to the right side of the titlebar of this widget.
        :type button: T <= QPushButton|QToolButton
        """
        widget = self.titleBarWidget()
        widget.addButton(button)
        widget.updateLayout() 
Example 46
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 47
Project: eddy   Author: obdasystems   File: dock.py    GNU General Public License v3.0 5 votes vote down vote up
def addButton(self, button):
        """
        Add a button to the right side of the titlebar, before the close button.
        :type button: T <= QPushButton|QToolButton
        """
        self.buttons.insert(0, button) 
Example 48
Project: pdash   Author: CPChain   File: button.py    GNU General Public License v3.0 5 votes vote down vote up
def primary_style(self):
        # background:rgb(22,124,233)
        return self.blank_style() + """
            QPushButton {
                background: #167ce9;
                color: #fff;
            }
            QPushButton:hover, QPushButton:pressed {
                background: #187def;
                color: #fff;
            }
        """ 
Example 49
Project: pdash   Author: CPChain   File: button.py    GNU General Public License v3.0 5 votes vote down vote up
def blank_style(self):
        return """
            QPushButton{{
                padding-left: 10px;
                padding-right: 10px;
                padding-top: 1px;
                padding-bottom: 1px;
                border:1px solid #0073df;
                border-radius:5px;
                min-height: {height}px;
                max-height: {height}px;
                background: #ffffff;
                min-width: {width}px;
                max-width: {width}px;
                font-size:15px;
                color:#0073df;
                text-align:center;
            }}

            QPushButton:hover{{
                border: 1px solid #3984f7; 
                color: #3984f6;
            }}

            QPushButton:pressed{{
                border: 1px solid #2e6dcd; 
                color: #2e6dcd;
                background: #e5ecf4;
            }}

            QPushbutton:disabled{{
                border: 1px solid #8cb8ea; 
                color: #8cb8ea;
            }}
        """.format(height=self.height, width=self.width) 
Example 50
Project: dockerizeme   Author: dockerizeme   File: snippet.py    Apache License 2.0 5 votes vote down vote up
def main():
    app = QtWidgets.QApplication(sys.argv)
    window = QtWidgets.QMainWindow()
    button = QtWidgets.QPushButton("Hello, PyQt!")
    window.setCentralWidget(button)
    window.show()
    app.exec_()