Python PyQt5.QtWidgets.QToolButton() Examples
The following are 30
code examples of PyQt5.QtWidgets.QToolButton().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets
, or try the search function
.
Example #1
Source File: reqlist.py From guppy-proxy with MIT License | 7 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) layout = QHBoxLayout() confirm = QToolButton() confirm.setText("OK") confirm.setToolTip("Apply the entered filter") self.field_entry = get_field_entry() # stack containing widgets for string, k/v, date, daterange self.str_cmp_entry = StringCmpWidget() self.kv_cmp_entry = StringKVWidget() self.inv_entry = QCheckBox("inv") # date # daterange self.entry_layout = QStackedLayout() self.entry_layout.setContentsMargins(0, 0, 0, 0) self.current_entry = 0 self.entry_layout.addWidget(self.str_cmp_entry) self.entry_layout.addWidget(self.kv_cmp_entry) # add date # 2 # add daterange # 3 confirm.clicked.connect(self.confirm_entry) self.str_cmp_entry.returnPressed.connect(self.confirm_entry) self.kv_cmp_entry.returnPressed.connect(self.confirm_entry) self.field_entry.currentIndexChanged.connect(self._display_value_widget) layout.addWidget(confirm) layout.addWidget(self.inv_entry) layout.addWidget(self.field_entry) layout.addLayout(self.entry_layout) self.setLayout(layout) self.setContentsMargins(0, 0, 0, 0) self._display_value_widget()
Example #2
Source File: custom_widgets.py From idasec with GNU Lesser General Public License v2.1 | 6 votes |
def __init__(self, items, parent=None): super(ButtonLineEdit, self).__init__(parent) self.menu = QtWidgets.QMenu() for i in items: self.menu.addAction(i) self.button = QtWidgets.QToolButton(self) self.button.setStyleSheet('border: 0px; padding: 0px;') self.button.setCursor(QtCore.Qt.ArrowCursor) self.button.triggered.connect(self.menu_action_triggered) self.button.setPopupMode(QtWidgets.QToolButton.InstantPopup) self.button.setMenu(self.menu) frameWidth = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth) buttonSize = self.button.sizeHint() self.setAlignment(QtCore.Qt.Alignment(QtCore.Qt.AlignHCenter)) self.setStyleSheet('QLineEdit {padding-right: %dpx; }' % (buttonSize.width() + frameWidth + 1)) self.setMinimumSize(max(self.minimumSizeHint().width(), buttonSize.width() + frameWidth*2 + 2), max(self.minimumSizeHint().height(), buttonSize.height() + frameWidth*2 + 2)) self.setMaximumWidth(100)
Example #3
Source File: find_toolbar.py From pandasgui with MIT License | 6 votes |
def add_button(self, button): ''' Adds a button to the right side of the QLineEdit. Args: button: Type QtWidgets.QPushButton or QtWidgets.QToolButton ''' self.buttons.append(button) # makes sure text doesn't type behind the buttons totalWidth = sum([b.sizeHint().width() for b in self.buttons]) frameWidth = self.style().pixelMetric(QtWidgets.QStyle.PM_DefaultFrameWidth) right_padding = int(totalWidth + frameWidth + 1) self.setStyleSheet(f'QLineEdit {{padding-right: {right_padding}px; }}') # makes sure the typing area doesn't get too small if toolbar is shrunk. maxHeight = max([b.sizeHint().height() for b in self.buttons]) self.setMinimumSize(max(self.minimumSizeHint().width(), totalWidth + frameWidth * 2 + 2), max(self.minimumSizeHint().height(), maxHeight + frameWidth * 2 + 2))
Example #4
Source File: reqlist.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.current_entry = 0 self.max_entries = 2 self.text_entry = TextFilterEntry() dropdown_entry = DropdownFilterEntry() self.text_entry.filterEntered.connect(self.filterEntered) dropdown_entry.filterEntered.connect(self.filterEntered) self.entry_layout = QStackedLayout() self.entry_layout.addWidget(dropdown_entry) self.entry_layout.addWidget(self.text_entry) swap_button = QToolButton() swap_button.setText(">") swap_button.setToolTip("Switch between dropdown and text entry") swap_button.clicked.connect(self.next_entry) hlayout = QHBoxLayout() hlayout.addWidget(swap_button) hlayout.addLayout(self.entry_layout) self.setLayout(hlayout) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().setSpacing(0)
Example #5
Source File: reqlist.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.str2_shown = False self.str1 = StringCmpWidget() self.str2 = StringCmpWidget() self.str1.returnPressed.connect(self.returnPressed) self.str2.returnPressed.connect(self.returnPressed) self.toggle_button = QToolButton() self.toggle_button.setText("+") self.toggle_button.clicked.connect(self._show_hide_str2) layout = QHBoxLayout() layout.addWidget(self.str1) layout.addWidget(self.str2) layout.addWidget(self.toggle_button) self.str2.setVisible(self.str2_shown) self.setLayout(layout) self.layout().setContentsMargins(0, 0, 0, 0)
Example #6
Source File: widgets.py From pychemqt with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent=None): super(DragButton, self).__init__(parent) # def mouseMoveEvent(self, event): # self.startDrag() # QtWidgets.QToolButton.mouseMoveEvent(self, event) # def startDrag(self): # if self.icon().isNull(): # return # data = QtCore.QByteArray() # stream = QtCore.QDataStream(data, QtCore.QIODevice.WriteOnly) # stream << self.icon() # mimeData = QtCore.QMimeData() # mimeData.setData("application/x-equipment", data) # drag = QtGui.QDrag(self) # drag.setMimeData(mimeData) # pixmap = self.icon().pixmap(24, 24) # drag.setHotSpot(QtCore.QPoint(12, 12)) # drag.setPixmap(pixmap) # drag.exec_(QtCore.Qt.CopyAction)
Example #7
Source File: reqview.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.setLayout(QVBoxLayout()) self.taglist = TagList() self.taglist.tagsUpdated.connect(self.tagsUpdated) self.layout().addWidget(self.taglist) self.taginput = QLineEdit() self.taginput.returnPressed.connect(self.add_tag) self.addbutton = QToolButton() self.addbutton.setText("+") self.removebutton = QToolButton() self.removebutton.setText("-") editbar = QHBoxLayout() editbar.addWidget(self.addbutton) editbar.addWidget(self.removebutton) editbar.addWidget(self.taginput) self.removebutton.clicked.connect(self.taglist.delete_selected) self.addbutton.clicked.connect(self.add_tag) self.layout().addLayout(editbar)
Example #8
Source File: auxilary_utils.py From peakonly with MIT License | 6 votes |
def __init__(self, extension, default_file, parent): super().__init__(parent) self.extension = extension button = QtWidgets.QToolButton() button.setText('...') button.clicked.connect(self.set_file) self.lineEdit = QtWidgets.QToolButton() self.lineEdit.setText(default_file) layout = QtWidgets.QHBoxLayout() layout.addWidget(self.lineEdit, 85) layout.addWidget(button, 15) self.setLayout(layout)
Example #9
Source File: auxilary_utils.py From peakonly with MIT License | 6 votes |
def __init__(self, label, parent=None): super().__init__(parent) button = QtWidgets.QToolButton() button.setText('...') button.clicked.connect(self.add_folder) self.lineEdit = QtWidgets.QToolButton() self.lineEdit.setText(label) folder_getter_layout = QtWidgets.QHBoxLayout() folder_getter_layout.addWidget(self.lineEdit, 85) folder_getter_layout.addWidget(button, 15) self.list_widget = QtWidgets.QListWidget() self.list_widget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) main_layout = QtWidgets.QVBoxLayout() main_layout.addLayout(folder_getter_layout) main_layout.addWidget(self.list_widget) self.setLayout(main_layout)
Example #10
Source File: auxilary_utils.py From peakonly with MIT License | 6 votes |
def __init__(self, default_directory='', parent=None): super().__init__(parent) button = QtWidgets.QToolButton() button.setText('...') button.clicked.connect(self.set_folder) if not default_directory: default_directory = os.getcwd() self.lineEdit = QtWidgets.QToolButton() self.lineEdit.setText(default_directory) layout = QtWidgets.QHBoxLayout() layout.addWidget(self.lineEdit, 85) layout.addWidget(button, 15) self.setLayout(layout)
Example #11
Source File: collapsiblebox.py From asammdf with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, title="", parent=None): super(CollapsibleBox, self).__init__(parent) self.toggle_button = QtWidgets.QToolButton( text=title, checkable=True, checked=False ) self.toggle_button.setStyleSheet("QToolButton { border: none; }") self.toggle_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.toggle_button.setArrowType(QtCore.Qt.RightArrow) self.toggle_button.pressed.connect(self.on_pressed) self.toggle_animation = QtCore.QParallelAnimationGroup(self) self.content_area = QtWidgets.QScrollArea(maximumHeight=0, minimumHeight=0) self.content_area.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed ) self.content_area.setFrameShape(QtWidgets.QFrame.NoFrame) lay = QtWidgets.QVBoxLayout(self) lay.setSpacing(0) lay.setContentsMargins(0, 0, 0, 0) lay.addWidget(self.toggle_button) lay.addWidget(self.content_area) self.toggle_animation.addAnimation( QtCore.QPropertyAnimation(self, b"minimumHeight") ) self.toggle_animation.addAnimation( QtCore.QPropertyAnimation(self, b"maximumHeight") ) self.toggle_animation.addAnimation( QtCore.QPropertyAnimation(self.content_area, b"maximumHeight") )
Example #12
Source File: ui_messagetype_options.py From urh with GNU General Public License v3.0 | 5 votes |
def setupUi(self, DialogMessageType): DialogMessageType.setObjectName("DialogMessageType") DialogMessageType.resize(471, 359) self.gridLayout = QtWidgets.QGridLayout(DialogMessageType) self.gridLayout.setObjectName("gridLayout") self.cbRulesetMode = QtWidgets.QComboBox(DialogMessageType) self.cbRulesetMode.setObjectName("cbRulesetMode") self.cbRulesetMode.addItem("") self.cbRulesetMode.addItem("") self.cbRulesetMode.addItem("") self.gridLayout.addWidget(self.cbRulesetMode, 1, 0, 1, 2) self.tblViewRuleset = QtWidgets.QTableView(DialogMessageType) self.tblViewRuleset.setShowGrid(False) self.tblViewRuleset.setObjectName("tblViewRuleset") self.gridLayout.addWidget(self.tblViewRuleset, 2, 0, 3, 2) self.btnRemoveRule = QtWidgets.QToolButton(DialogMessageType) icon = QtGui.QIcon.fromTheme("list-remove") self.btnRemoveRule.setIcon(icon) self.btnRemoveRule.setObjectName("btnRemoveRule") self.gridLayout.addWidget(self.btnRemoveRule, 3, 2, 1, 1) self.rbAssignManually = QtWidgets.QRadioButton(DialogMessageType) self.rbAssignManually.setObjectName("rbAssignManually") self.gridLayout.addWidget(self.rbAssignManually, 0, 0, 1, 1) self.rbAssignAutomatically = QtWidgets.QRadioButton(DialogMessageType) self.rbAssignAutomatically.setObjectName("rbAssignAutomatically") self.gridLayout.addWidget(self.rbAssignAutomatically, 0, 1, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 145, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 4, 2, 1, 1) self.btnAddRule = QtWidgets.QToolButton(DialogMessageType) icon = QtGui.QIcon.fromTheme("list-add") self.btnAddRule.setIcon(icon) self.btnAddRule.setObjectName("btnAddRule") self.gridLayout.addWidget(self.btnAddRule, 2, 2, 1, 1) self.buttonBox = QtWidgets.QDialogButtonBox(DialogMessageType) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2) self.retranslateUi(DialogMessageType)
Example #13
Source File: Ui_popUp.py From PhyloSuite with GNU General Public License v3.0 | 5 votes |
def setupUi(self, pop): pop.setObjectName("pop") pop.resize(442, 379) self.gridLayout = QtWidgets.QGridLayout(pop) self.gridLayout.setObjectName("gridLayout") self.textEdit = QtWidgets.QTextEdit(pop) self.textEdit.setObjectName("textEdit") self.gridLayout.addWidget(self.textEdit, 1, 0, 1, 2) self.pushButton = QtWidgets.QPushButton(pop) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/picture/resourses/btn_ok.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.pushButton.setObjectName("pushButton") self.gridLayout.addWidget(self.pushButton, 2, 0, 1, 1) self.pushButton_2 = QtWidgets.QPushButton(pop) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/picture/resourses/if_Delete_1493279.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton_2.setIcon(icon1) self.pushButton_2.setObjectName("pushButton_2") self.gridLayout.addWidget(self.pushButton_2, 2, 1, 1, 1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label = QtWidgets.QLabel(pop) self.label.setObjectName("label") self.horizontalLayout_2.addWidget(self.label) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.toolButton = QtWidgets.QToolButton(pop) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/picture/resourses/interface-controls-text-wrap-512.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon2) self.toolButton.setCheckable(True) self.toolButton.setObjectName("toolButton") self.horizontalLayout_2.addWidget(self.toolButton) self.gridLayout.addLayout(self.horizontalLayout_2, 0, 0, 1, 2) self.retranslateUi(pop) QtCore.QMetaObject.connectSlotsByName(pop)
Example #14
Source File: settings.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.listenerlist = ListenerList() self.listenerlist.listenersUpdated.connect(self.listenersUpdated) self.layout().addWidget(self.listenerlist) self.hostinput = QLineEdit() self.hostinput.setText("127.0.0.1") self.hostinput.returnPressed.connect(self.add_listener) self.portinput = QLineEdit() self.portinput.setMaxLength(5) self.portinput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) self.portinput.returnPressed.connect(self.add_listener) self.addbutton = QToolButton() self.addbutton.setText("+") self.removebutton = QToolButton() self.removebutton.setText("-") editbar = QHBoxLayout() editbar.addWidget(self.addbutton) editbar.addWidget(self.removebutton) editbar.addWidget(QLabel("Interface:")) editbar.addWidget(self.hostinput) editbar.addWidget(QLabel("Port:")) editbar.addWidget(self.portinput) self.removebutton.clicked.connect(self.listenerlist.delete_selected) self.addbutton.clicked.connect(self.add_listener) self.layout().addLayout(editbar)
Example #15
Source File: zoom.py From eddy with GNU General Public License v3.0 | 5 votes |
def start(self): """ Perform initialization tasks for the plugin. """ # INITIALIZE THE WIDGETS self.debug('Creating zoom control widgets') self.addWidget(QtWidgets.QToolButton( icon=QtGui.QIcon(':/icons/24/ic_zoom_in_black'), enabled=False, checkable=False, clicked=self.doZoomIn, objectName='button_zoom_in')) self.addWidget(QtWidgets.QToolButton( icon=QtGui.QIcon(':/icons/24/ic_zoom_out_black'), enabled=False, checkable=False, clicked=self.doZoomOut, objectName='button_zoom_out')) self.addWidget(QtWidgets.QToolButton( icon=QtGui.QIcon(':/icons/24/ic_zoom_reset_black'), enabled=False, checkable=False, clicked=self.doZoomReset, objectName='button_zoom_reset')) # CONFIGURE SIGNALS/SLOTS self.debug('Configuring session and MDI area specific signals/slots') connect(self.session.mdi.subWindowActivated, self.onSubWindowActivated) connect(self.session.sgnUpdateState, self.doUpdateState) # CREATE VIEW TOOLBAR BUTTONS self.debug('Installing zoom controls in "view" toolbar') self.afwset.add(self.session.widget('view_toolbar').addSeparator()) self.afwset.add(self.session.widget('view_toolbar').addWidget(self.widget('button_zoom_out'))) self.afwset.add(self.session.widget('view_toolbar').addWidget(self.widget('button_zoom_in'))) self.afwset.add(self.session.widget('view_toolbar').addWidget(self.widget('button_zoom_reset')))
Example #16
Source File: session.py From eddy with GNU General Public License v3.0 | 5 votes |
def initWidgets(self): """ Configure application built-in widgets. """ button = QtWidgets.QToolButton(objectName='button_set_brush') button.setIcon(QtGui.QIcon(':/icons/24/ic_format_color_fill_black')) button.setMenu(self.menu('brush')) button.setPopupMode(QtWidgets.QToolButton.InstantPopup) button.setStatusTip('Change the background color of the selected predicate nodes') button.setEnabled(False) self.addWidget(button) combobox = ComboBox(objectName='profile_switch') combobox.setEditable(False) combobox.setFont(Font('Roboto', 12)) combobox.setFocusPolicy(QtCore.Qt.StrongFocus) combobox.setScrollEnabled(False) combobox.setStatusTip('Change the profile of the active project') combobox.addItems(self.profileNames()) connect(combobox.activated, self.doSetProfile) self.addWidget(combobox) progressBar = QtWidgets.QProgressBar(objectName='progress_bar') progressBar.setContentsMargins(0, 0, 0, 0) progressBar.setFixedSize(222, 14) progressBar.setRange(0, 0) progressBar.setVisible(False) self.addWidget(progressBar) ############################################# # SLOTS #################################
Example #17
Source File: dockwidgets.py From Lector with GNU General Public License v3.0 | 5 votes |
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 #18
Source File: combobox.py From dunya-desktop with GNU General Public License v3.0 | 5 votes |
def _set_cancel_button(self): self.cancel_button = QToolButton(self) self.cancel_button.setIcon(QIcon(ICON_PATH_CANCEL)) self.cancel_button.setVisible(False)
Example #19
Source File: costIndex.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def __init__(self, equipment, parent=None): """constructor equipment: equipment class where the widget have to be put, define indiceCostos as a index in costIndex""" super(CostData, self).__init__(parent) self.indice = equipment.indiceCostos factor = equipment.kwargs["f_install"] gridLayout = QtWidgets.QGridLayout(self) gridLayout.addItem(QtWidgets.QSpacerItem( 20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding), 1, 0, 1, 7) gridLayout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate( "pychemqt", "Instalation factor:")), 2, 0, 1, 1) self.factorInstalacion = Entrada_con_unidades( float, spinbox=True, decimales=1, step=0.1, width=50, value=factor) self.factorInstalacion.valueChanged.connect(partial( self.valueChanged.emit, "f_install")) gridLayout.addWidget(self.factorInstalacion, 2, 1, 1, 1) gridLayout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate( "pychemqt", "Base index:")), 2, 4, 1, 1) self.indiceBase = Entrada_con_unidades( float, readOnly=True, value=indiceBase[self.indice], decimales=1) gridLayout.addWidget(self.indiceBase, 2, 5, 1, 1) gridLayout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate( "pychemqt", "Current index:")), 3, 4, 1, 1) self.indiceActual = Entrada_con_unidades( float, readOnly=True, colorReadOnly="white", value=indiceActual[self.indice], decimales=1) gridLayout.addWidget(self.indiceActual, 3, 5, 1, 1) self.costIndex = QtWidgets.QToolButton() self.costIndex.setFixedSize(QtCore.QSize(24, 24)) self.costIndex.clicked.connect(self.on_costIndex_clicked) self.costIndex.setText("...") self.costIndex.setVisible(False) gridLayout.addWidget(self.costIndex, 3, 5, 1, 1) gridLayout.addItem(QtWidgets.QSpacerItem( 20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding), 4, 0, 1, 7)
Example #20
Source File: widgets.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def __init__(self, text="", font=None, color="#000000", parent=None): """ text: Initial txt for widget font: QFont instance to initialize widget color: Inicial color to widget, in code #rrggbb """ super(InputFont, self).__init__(parent) layout = QtWidgets.QHBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.lineEdit = QtWidgets.QLineEdit() self.lineEdit.setSizePolicy( QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) layout.addWidget(self.lineEdit) self.fontButton = QtWidgets.QPushButton(QtGui.QIcon(QtGui.QPixmap( os.environ["pychemqt"] + os.path.join("images", "button", "font.png"))), "") self.fontButton.setFixedSize(24, 24) self.fontButton.setIconSize(QtCore.QSize(24, 24)) self.fontButton.clicked.connect(self.fontButtonClicked) layout.addWidget(self.fontButton) self.colorButton = QtWidgets.QToolButton() self.colorButton.setFixedSize(24, 24) self.colorButton.clicked.connect(self.colorButtonClicked) layout.addWidget(self.colorButton) self.font = font self.setRGB(color) self.setText(text) self.lineEdit.textChanged.connect(self.textChanged.emit)
Example #21
Source File: widgets.py From pychemqt with GNU General Public License v3.0 | 5 votes |
def __init__(self, color="#ffffff", alpha=255, isAlpha=False, parent=None): super(ColorSelector, self).__init__(parent) lyt = QtWidgets.QHBoxLayout(self) lyt.setContentsMargins(0, 0, 0, 0) lyt.setSpacing(0) self.RGB = QtWidgets.QLineEdit() self.RGB.editingFinished.connect(self.rgbChanged) self.RGB.setFixedSize(80, 24) lyt.addWidget(self.RGB) self.button = QtWidgets.QToolButton() self.button.setFixedSize(24, 24) self.button.clicked.connect(self.ColorButtonClicked) lyt.addWidget(self.button) lyt.addItem(QtWidgets.QSpacerItem( 20, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)) if isAlpha: self.isAlpha = QtGui.QColor.HexArgb else: self.isAlpha = QtGui.QColor.HexRgb r = int(color[1:3], 16) g = int(color[3:5], 16) b = int(color[5:7], 16) color = QtGui.QColor(r, g, b, alpha) self.setColor(color)
Example #22
Source File: pagination_widget.py From execution-trace-viewer with MIT License | 5 votes |
def init_ui(self): layout = QHBoxLayout(self) self.first_page_btn = QToolButton(self) self.first_page_btn.clicked.connect(self._on_first_page_btn_clicked) self.first_page_btn.setArrowType(Qt.LeftArrow) self.first_page_btn.setToolTip("First page") layout.addWidget(self.first_page_btn) self.prev_page_btn = QToolButton(self) self.prev_page_btn.clicked.connect(self._on_prev_page_btn_clicked) self.prev_page_btn.setArrowType(Qt.LeftArrow) self.prev_page_btn.setToolTip("Previous page") layout.addWidget(self.prev_page_btn) self.page_edit = QLineEdit("1") self.page_edit.setMaximumSize(45, 24) self.page_edit.returnPressed.connect( lambda: self.set_current_page(self.page_edit.text()) ) layout.addWidget(self.page_edit) self.next_page_btn = QToolButton(self) self.next_page_btn.clicked.connect(self._on_next_page_btn_clicked) self.next_page_btn.setArrowType(Qt.RightArrow) self.next_page_btn.setToolTip("Next page") layout.addWidget(self.next_page_btn) self.last_page_btn = QToolButton(self) self.last_page_btn.clicked.connect(self._on_last_page_btn_clicked) self.last_page_btn.setArrowType(Qt.RightArrow) self.last_page_btn.setToolTip("Last page") layout.addWidget(self.last_page_btn) self.status_label = QLabel("") layout.addWidget(self.status_label)
Example #23
Source File: sources_dock.py From kite with GNU General Public License v3.0 | 5 votes |
def __init__(self, sandbox, parent=None): QtWidgets.QToolButton.__init__(self, parent) menu = self.SourcesAddMenu(sandbox, self, 'Availables sources') self.setText('Add Source') self.setMenu(menu) self.setIcon(self.style().standardIcon( QtGui.QStyle.SP_FileDialogDetailedView)) self.setPopupMode(QtGui.QToolButton.InstantPopup) self.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
Example #24
Source File: stats.py From opensnitch with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent=None, address=None): QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint) self.setupUi(self) self.daemon_connected = False self._lock = threading.Lock() self._address = address self._stats = None self._trigger.connect(self._on_update_triggered) self._save_button = self.findChild(QtWidgets.QToolButton, "saveButton") self._save_button.clicked.connect(self._on_save_clicked) self._tabs = self.findChild(QtWidgets.QTabWidget, "tabWidget") self._status_label = self.findChild(QtWidgets.QLabel, "statusLabel") self._version_label = self.findChild(QtWidgets.QLabel, "daemonVerLabel") self._uptime_label = self.findChild(QtWidgets.QLabel, "uptimeLabel") self._rules_label = self.findChild(QtWidgets.QLabel, "rulesLabel") self._cons_label = self.findChild(QtWidgets.QLabel, "consLabel") self._dropped_label = self.findChild(QtWidgets.QLabel, "droppedLabel") self._events_table = self._setup_table("eventsTable", ("Time", "Action", "Process", "Destination", "Protocol", "Rule" )) self._addrs_table = self._setup_table("addrTable", ("IP", "Connections")) self._hosts_table = self._setup_table("hostsTable", ("Hostname", "Connections")) self._ports_table = self._setup_table("portsTable", ("Port", "Connections")) self._users_table = self._setup_table("usersTable", ("User", "Connections")) self._procs_table = self._setup_table("procsTable", ("Executable", "Connections")) self._tables = ( \ self._events_table, self._hosts_table, self._procs_table, self._addrs_table, self._ports_table, self._users_table ) self._file_names = ( \ 'events.csv', 'hosts.csv', 'procs.csv', 'addrs.csv', 'ports.csv', 'users.csv' ) if address is not None: self.setWindowapply_Title("OpenSnitch Network Statistics for %s" % address)
Example #25
Source File: qspoiler.py From track with Apache License 2.0 | 4 votes |
def __init__(self, parent=None, title: str = "", expanded: bool = False) -> None: """Improvise a collapsable QFrame""" def set_widget_properties(checked: bool) -> None: self._content_area.setVisible(checked) self._toggle_button.setArrowType( QtCore.Qt.DownArrow if checked else QtCore.Qt.RightArrow) super().__init__(parent=parent) self._content_area = QtWidgets.QWidget() self._header_line = QtWidgets.QFrame() self._toggle_button = QtWidgets.QToolButton() self._main_layout = QtWidgets.QGridLayout() self._toggle_button.setStyleSheet("QToolButton { border: none; }") self._toggle_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.setTitle(title) self._toggle_button.setCheckable(True) self._toggle_button.setChecked(expanded) set_widget_properties(self._toggle_button.isChecked()) self._header_line.setFrameShape(QtWidgets.QFrame.HLine) self._header_line.setFrameShadow(QtWidgets.QFrame.Sunken) self._header_line.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) self._content_area.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) self._main_layout.setVerticalSpacing(0) self._main_layout.setHorizontalSpacing(0) self._main_layout.setContentsMargins(0, 0, 0, 0) self._main_layout.addWidget(self._toggle_button, 0, 0, 1, 1, QtCore.Qt.AlignLeft) self._main_layout.addWidget(self._header_line, 0, 2, 1, 1) self._main_layout.addWidget(self._content_area, 1, 0, 1, 3) super().setLayout(self._main_layout) default_layout = QtWidgets.QVBoxLayout() default_layout.setContentsMargins(10, 0, 0, 0) self.setLayout(default_layout) self._toggle_button.toggled.connect(set_widget_properties)
Example #26
Source File: ui_columns_cfg_dlg.py From dash-masternode-tool with MIT License | 4 votes |
def setupUi(self, ColumnsConfigDlg): ColumnsConfigDlg.setObjectName("ColumnsConfigDlg") ColumnsConfigDlg.resize(262, 412) self.verticalLayout = QtWidgets.QVBoxLayout(ColumnsConfigDlg) self.verticalLayout.setContentsMargins(8, 8, 8, 8) self.verticalLayout.setSpacing(8) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSpacing(3) self.horizontalLayout.setObjectName("horizontalLayout") self.tableWidget = QtWidgets.QTableWidget(ColumnsConfigDlg) self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.tableWidget.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(1) self.tableWidget.setRowCount(0) item = QtWidgets.QTableWidgetItem() self.tableWidget.setHorizontalHeaderItem(0, item) self.tableWidget.horizontalHeader().setVisible(False) self.tableWidget.horizontalHeader().setStretchLastSection(True) self.horizontalLayout.addWidget(self.tableWidget) self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.btnMoveBegin = QtWidgets.QToolButton(ColumnsConfigDlg) self.btnMoveBegin.setText("") self.btnMoveBegin.setObjectName("btnMoveBegin") self.verticalLayout_2.addWidget(self.btnMoveBegin) self.btnMoveUp = QtWidgets.QToolButton(ColumnsConfigDlg) self.btnMoveUp.setText("") self.btnMoveUp.setObjectName("btnMoveUp") self.verticalLayout_2.addWidget(self.btnMoveUp) self.btnMoveDown = QtWidgets.QToolButton(ColumnsConfigDlg) self.btnMoveDown.setText("") self.btnMoveDown.setObjectName("btnMoveDown") self.verticalLayout_2.addWidget(self.btnMoveDown) self.btnMoveEnd = QtWidgets.QToolButton(ColumnsConfigDlg) self.btnMoveEnd.setText("") self.btnMoveEnd.setObjectName("btnMoveEnd") self.verticalLayout_2.addWidget(self.btnMoveEnd) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout.addLayout(self.horizontalLayout) self.buttonBox = QtWidgets.QDialogButtonBox(ColumnsConfigDlg) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(ColumnsConfigDlg) self.buttonBox.accepted.connect(ColumnsConfigDlg.accept) self.buttonBox.rejected.connect(ColumnsConfigDlg.reject) QtCore.QMetaObject.connectSlotsByName(ColumnsConfigDlg)
Example #27
Source File: ui_wallet_dlg_options1.py From dash-masternode-tool with MIT License | 4 votes |
def setupUi(self, WdgOptions1): WdgOptions1.setObjectName("WdgOptions1") WdgOptions1.resize(243, 76) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(WdgOptions1.sizePolicy().hasHeightForWidth()) WdgOptions1.setSizePolicy(sizePolicy) WdgOptions1.setStyleSheet("") self.horizontalLayout_2 = QtWidgets.QHBoxLayout(WdgOptions1) self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_2.setSpacing(0) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.frame = QtWidgets.QFrame(WdgOptions1) self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.verticalLayout = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout.setContentsMargins(6, 6, 6, 6) self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName("verticalLayout") self.chbShowAddresses = QtWidgets.QCheckBox(self.frame) self.chbShowAddresses.setObjectName("chbShowAddresses") self.verticalLayout.addWidget(self.chbShowAddresses) self.chbShowZeroBalanceAddresses = QtWidgets.QCheckBox(self.frame) self.chbShowZeroBalanceAddresses.setObjectName("chbShowZeroBalanceAddresses") self.verticalLayout.addWidget(self.chbShowZeroBalanceAddresses) self.chbShowNotUsedAddresses = QtWidgets.QCheckBox(self.frame) self.chbShowNotUsedAddresses.setObjectName("chbShowNotUsedAddresses") self.verticalLayout.addWidget(self.chbShowNotUsedAddresses) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.btnApply = QtWidgets.QToolButton(self.frame) self.btnApply.setObjectName("btnApply") self.horizontalLayout.addWidget(self.btnApply) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2.addWidget(self.frame) self.retranslateUi(WdgOptions1) QtCore.QMetaObject.connectSlotsByName(WdgOptions1)
Example #28
Source File: Ui_NmlPoPup.py From PhyloSuite with GNU General Public License v3.0 | 4 votes |
def setupUi(self, NmlPoPup): NmlPoPup.setObjectName("NmlPoPup") NmlPoPup.resize(267, 248) self.gridLayout_3 = QtWidgets.QGridLayout(NmlPoPup) self.gridLayout_3.setObjectName("gridLayout_3") self.groupBox = QtWidgets.QGroupBox(NmlPoPup) self.groupBox.setTitle("") self.groupBox.setObjectName("groupBox") self.gridLayout = QtWidgets.QGridLayout(self.groupBox) self.gridLayout.setContentsMargins(2, 2, 2, 2) self.gridLayout.setObjectName("gridLayout") self.toolButton = QtWidgets.QToolButton(self.groupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.toolButton.sizePolicy().hasHeightForWidth()) self.toolButton.setSizePolicy(sizePolicy) self.toolButton.setStyleSheet("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/picture/resourses/circle.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon) self.toolButton.setIconSize(QtCore.QSize(60, 60)) self.toolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.toolButton.setObjectName("toolButton") self.gridLayout.addWidget(self.toolButton, 0, 0, 1, 1) self.gridLayout_3.addWidget(self.groupBox, 0, 0, 1, 1) self.groupBox_2 = QtWidgets.QGroupBox(NmlPoPup) self.groupBox_2.setTitle("") self.groupBox_2.setObjectName("groupBox_2") self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2) self.gridLayout_2.setContentsMargins(2, 2, 2, 2) self.gridLayout_2.setObjectName("gridLayout_2") self.toolButton_2 = QtWidgets.QToolButton(self.groupBox_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.toolButton_2.sizePolicy().hasHeightForWidth()) self.toolButton_2.setSizePolicy(sizePolicy) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/picture/resourses/images.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton_2.setIcon(icon1) self.toolButton_2.setIconSize(QtCore.QSize(60, 60)) self.toolButton_2.setToolButtonStyle(QtCore.Qt.ToolButtonTextUnderIcon) self.toolButton_2.setAutoRaise(False) self.toolButton_2.setObjectName("toolButton_2") self.gridLayout_2.addWidget(self.toolButton_2, 0, 0, 1, 1) self.gridLayout_3.addWidget(self.groupBox_2, 1, 0, 1, 1) self.retranslateUi(NmlPoPup) QtCore.QMetaObject.connectSlotsByName(NmlPoPup)
Example #29
Source File: Ui_seqViewSetting.py From PhyloSuite with GNU General Public License v3.0 | 4 votes |
def setupUi(self, seqViewSetting): seqViewSetting.setObjectName("seqViewSetting") seqViewSetting.resize(444, 357) self.verticalLayout = QtWidgets.QVBoxLayout(seqViewSetting) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setSpacing(2) self.horizontalLayout.setObjectName("horizontalLayout") self.label_2 = QtWidgets.QLabel(seqViewSetting) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setObjectName("label_2") self.horizontalLayout.addWidget(self.label_2) self.lineEdit_fontSet = QtWidgets.QLineEdit(seqViewSetting) self.lineEdit_fontSet.setStyleSheet("QLineEdit {\n" " border: 1px solid gray; \n" " border-radius: 3px; \n" " background: white; \n" " selection-background-color: green; \n" "}\n" "\n" "QLineEdit:hover {\n" " border: 1px solid blue; \n" "}") self.lineEdit_fontSet.setReadOnly(True) self.lineEdit_fontSet.setObjectName("lineEdit_fontSet") self.horizontalLayout.addWidget(self.lineEdit_fontSet) self.toolButton = QtWidgets.QToolButton(seqViewSetting) self.toolButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/picture/resourses/if_font_173018.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon) self.toolButton.setAutoRaise(True) self.toolButton.setObjectName("toolButton") self.horizontalLayout.addWidget(self.toolButton) self.verticalLayout.addLayout(self.horizontalLayout) self.label = QtWidgets.QLabel(seqViewSetting) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.tableView = QtWidgets.QTableView(seqViewSetting) self.tableView.setStyleSheet("QTableView {\n" " selection-background-color: none;\n" " outline: 0;\n" "}") self.tableView.setObjectName("tableView") self.verticalLayout.addWidget(self.tableView) self.retranslateUi(seqViewSetting) QtCore.QMetaObject.connectSlotsByName(seqViewSetting)
Example #30
Source File: Ui_nexViewer.py From PhyloSuite with GNU General Public License v3.0 | 4 votes |
def setupUi(self, nexViewer): nexViewer.setObjectName("nexViewer") nexViewer.resize(825, 764) self.gridLayout = QtWidgets.QGridLayout(nexViewer) self.gridLayout.setObjectName("gridLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtWidgets.QLabel(nexViewer) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.toolButton = QtWidgets.QToolButton(nexViewer) self.toolButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/picture/resourses/interface-controls-text-wrap-512.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.toolButton.setIcon(icon) self.toolButton.setCheckable(True) self.toolButton.setObjectName("toolButton") self.horizontalLayout.addWidget(self.toolButton) self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) self.textEdit = QtWidgets.QTextEdit(nexViewer) self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.NoWrap) self.textEdit.setObjectName("textEdit") self.gridLayout.addWidget(self.textEdit, 1, 0, 1, 1) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.pushButton_2 = QtWidgets.QPushButton(nexViewer) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/picture/resourses/if_start_60207.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton_2.setIcon(icon1) self.pushButton_2.setObjectName("pushButton_2") self.horizontalLayout_2.addWidget(self.pushButton_2) self.pushButton = QtWidgets.QPushButton(nexViewer) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/picture/resourses/Save-icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon2) self.pushButton.setObjectName("pushButton") self.horizontalLayout_2.addWidget(self.pushButton) self.pushButton_cancel = QtWidgets.QPushButton(nexViewer) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/picture/resourses/if_Delete_1493279.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton_cancel.setIcon(icon3) self.pushButton_cancel.setObjectName("pushButton_cancel") self.horizontalLayout_2.addWidget(self.pushButton_cancel) self.gridLayout.addLayout(self.horizontalLayout_2, 2, 0, 1, 1) self.retranslateUi(nexViewer) QtCore.QMetaObject.connectSlotsByName(nexViewer)