def __init__(self, parent, bottomOffset): self.window = parent self.bottomOffset = bottomOffset QToolButton.__init__(self, parent) # set the fullsize icon from Maemo's theme self.setIcon(QIcon.fromTheme("general_fullsize")); # ensure that our size is fixed to our ideal size self.setFixedSize(self.sizeHint()); # set the background to 0.5 alpha pal = self.palette(); backgroundColor = pal.color(self.backgroundRole()); backgroundColor.setAlpha(128); pal.setColor(self.backgroundRole(), backgroundColor); self.setPalette(pal); # ensure that we're painting our background self.setAutoFillBackground(True); # when we're clicked, tell the parent to exit fullscreen self.connect(self, QtCore.SIGNAL("clicked()"), parent.showNormal); # install an event filter to listen for the parent's events parent.installEventFilter(self);
def __init__(self, parent=None, **kwargs): QToolButton.__init__(self, parent, **kwargs) self.setToolButtonStyle(Qt.ToolButtonIconOnly) self.setCheckable(True) self.__flat = True self.__showMenuIndicator = False
def __init__(self, parent): QToolButton.__init__(self, parent) pixmap = QPixmap(":/search_clear_13") self.setIcon(QIcon(pixmap)) self.setIconSize(pixmap.size()) self.setCursor(Qt.ArrowCursor) self.setPopupMode(QToolButton.InstantPopup) stylesheet = "QToolButton { border: none; padding: 0px; }" self.setStyleSheet(stylesheet)
def __init__(self, parent): QToolButton.__init__(self, parent) self.setToolTip(self.tr("Cursor position")) self.setEnabled(False) self._setCursorPosition(-1, -1) minWidth = QFontMetrics(self.font()).width("Line: xxxxx Column: xxx") minWidth += 30 # for the button borders self.setMinimumWidth(minWidth) # Avoid flickering when text width changed core.workspace().currentDocumentChanged.connect(self._onCurrentDocumentChanged)
def __init__(self, parent): QToolButton.__init__(self, parent) pixmap = QPixmap(':/search_clear_13') self.setIcon(QIcon(pixmap)) self.setIconSize(pixmap.size()) self.setCursor(Qt.ArrowCursor) self.setPopupMode(QToolButton.InstantPopup) stylesheet = "QToolButton { border: none; padding: 0px; }" self.setStyleSheet(stylesheet)
def __init__(self, colorOrParent, *args): if isinstance(colorOrParent, QColor): QToolButton.__init__(self, *args) self.setColor(colorOrParent) else: QToolButton.__init__(self, colorOrParent, *args) self.setColor(QColor()) self.clicked.connect(self._onClicked) self.setIconSize(QSize(16, 16))
def __init__(self, parent=None): QToolButton.__init__(self, parent) self.badge_counter = 0 self.badge_size = 5 self.redGradient = QRadialGradient( 0.0, 0.0, 17.0, self.badge_size - 3, self.badge_size - 3) self.redGradient.setColorAt(0.0, QColor(0xe0, 0x84, 0x9b)) self.redGradient.setColorAt(0.5, QColor(0xe9, 0x34, 0x43)) self.redGradient.setColorAt(1.0, QColor(0xdc, 0x0c, 0x00))
def __init__(self, parent): QToolButton.__init__(self, parent) self.setText(self.tr("Tabs")) self.setEnabled(False) self.setToolTip(self.tr("Indentation mode. Click to change")) self.clicked.connect(self._onClicked) core.workspace().currentDocumentChanged.connect(self._onCurrentDocumentChanged) core.workspace().indentUseTabsChanged.connect(self._onIndentSettingsChanged) core.workspace().indentWidthChanged.connect(self._onIndentSettingsChanged)
def __init__(self, *args): QToolButton.__init__(self, *args) self.storedSettingsWidget = QStoredSettingsWidget(self.parent(), self) self.storedSettingsWidget.setParent(self.parent()) storedSettingsWidgetUi = Ui_StoredSettingsWidget() storedSettingsWidgetUi.setupUi(self.storedSettingsWidget) self.storedSettingsWidget.initSubWidgets() self.storedSettingsWidget.move(self.x() - self.storedSettingsWidget.width(), self.y()) self.toggleWidget(False)
def __init__(self, plot, attr_name, attr_value, callback, parent): QToolButton.__init__(self, parent) self.setMinimumSize(30, 30) self.plot = plot if type(callback) == str: callback = getattr(plot, callback, None) if callback: QObject.connect(self, SIGNAL("clicked(bool)"), callback) if attr_name: self.attr_name = attr_name self.attr_value = attr_value QObject.connect(self, SIGNAL("clicked(bool)"), self.set_attribute)
def __init__(self, *args, **kwargs): QToolButton.__init__(self, *args, **kwargs) # set maximum and mimium size self.setMaximumSize(100, 60) # width, height self.setMinimumSize(80, 60) # width, height # make menu button auto exclusive like QRadioButton self.setAutoExclusive(True) # make button checkable. this is required for css functions like checked ... self.setCheckable(True)
def __init__(self, parent): QToolButton.__init__(self, parent) self.setText(self.tr("Tabs")) self.setEnabled(False) self.setToolTip(self.tr("Indentation mode. Click to change")) self.clicked.connect(self._onClicked) core.workspace().currentDocumentChanged.connect( self._onCurrentDocumentChanged) core.workspace().indentUseTabsChanged.connect( self._onIndentSettingsChanged) core.workspace().indentWidthChanged.connect( self._onIndentSettingsChanged)
def __init__(self, base, image, text=None, tooltip=None): QToolButton.__init__(self) icon = QIcon(base.get_image_path(image)) self.setIcon(icon) self.setCheckable(True) if text: self.setText(text) self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.setMaximumHeight(24) else: self.setMaximumSize(24, 24) if tooltip: self.setToolTip(tooltip)
def __init__(self, parent): QToolButton.__init__(self, parent) self.setEnabled(False) self.setToolTip(self.tr("Line endings. Click for convert")) self.setIconSize(QSize(16, 16)) self.setIcon(QIcon(':/enkiicons/unixEol.png')) self.setPopupMode(QToolButton.InstantPopup) menu = QMenu(self) # menu filled on popup. Performance optimisation for quicker start up self.setMenu(menu) menu.aboutToShow.connect(self._onMenuAboutToShow) menu.triggered.connect(self._onEolActionTriggered) core.workspace().currentDocumentChanged.connect(self._onCurrentDocumentChanged)
def __init__(self, parent): QToolButton.__init__(self) self.parent = parent self.setAutoRaise(True) self.mode_normal() self.menu = menu = QMenu(self) self.setMenu(menu) for mode, titre in self.modes: nom = "mode_" + mode action = menu.addAction(QIcon(png(nom)), titre) action.setIconVisibleInMenu(True) action.triggered.connect(getattr(self, nom)) self.clicked.connect(self.mode_occupe)
def __init__(self, panel, name, title, symbol=None, icon=None, tooltip=None, size=22): QToolButton.__init__(self) self.panel = panel self.name = name self.title = title self.symbol = symbol self.icon = icon if symbol: panel.toolbox.addSymbol(self, symbol, size) elif icon: self.setIcon(KIcon(icon)) self.clicked.connect(self.fire) self.setAutoRaise(True) self.setIconSize(QSize(size, size)) self.setToolTip(tooltip if tooltip else title)
def __init__( self, items, parent = None ): QToolButton.__init__( self, parent ) self.setText( "All categories" ) self.setPopupMode( QToolButton.InstantPopup ) self.menu = QMenu( self ) self.setMenu( self.menu ) self.items = items self.actions = map( self.createAction, self.items ) self.menu.addSeparator() self.menu.addAction( "Select All" ) self.menu.addAction( "Select None" ) self.connect( self.menu, SIGNAL( 'aboutToShow()' ), self.slotMenuAboutToShow )
def __init__(self, parent): QToolButton.__init__(self, parent) self.setToolTip(self.tr("Cursor position")) self.setEnabled(False) self._setCursorPosition(-1, -1) minWidth = QFontMetrics(self.font()).width("Line: xxxxx Column: xxx") minWidth += 30 # for the button borders self.setMinimumWidth(minWidth) # Avoid flickering when text width changed core.workspace().currentDocumentChanged.connect(self._onCurrentDocumentChanged) core.workspace().cursorPositionChanged.connect(self._onCursorPositionChanged) self._timer = QTimer() self._timer.setInterval(200) self._timer.setSingleShot(True) self._timer.timeout.connect(self._onUpdatePositionTimer) self._passedUpdate = False
def __init__(self, items, parent=None): QToolButton.__init__(self, parent) self.setText("All categories") self.setPopupMode(QToolButton.InstantPopup) self.menu = QMenu(self) self.setMenu(self.menu) self.items = items self.actions = map(self.createAction, self.items) self.menu.addSeparator() self.menu.addAction("Select All") self.menu.addAction("Select None") self.connect(self.menu, SIGNAL('aboutToShow()'), self.slotMenuAboutToShow)
def __init__(self, parent): QToolButton.__init__(self, parent) self.setEnabled(False) self.setToolTip(self.tr("Line endings. Click for convert")) self.setIconSize(QSize(16, 16)) self.setIcon(QIcon(':/enkiicons/unixEol.png')) self.setPopupMode(QToolButton.InstantPopup) menu = QMenu( self ) # menu filled on popup. Performance optimisation for quicker start up self.setMenu(menu) menu.aboutToShow.connect(self._onMenuAboutToShow) menu.triggered.connect(self._onEolActionTriggered) core.workspace().currentDocumentChanged.connect( self._onCurrentDocumentChanged) core.workspace().eolChanged.connect( lambda document, eol: self._setEolMode(eol))
def __init__(self, parent): QToolButton.__init__(self, parent) self.setToolTip(self.tr("Cursor position")) self.setEnabled(False) self._setCursorPosition(-1, -1) minWidth = QFontMetrics(self.font()).width("Line: xxxxx Column: xxx") minWidth += 30 # for the button borders self.setMinimumWidth( minWidth) # Avoid flickering when text width changed core.workspace().currentDocumentChanged.connect( self._onCurrentDocumentChanged) core.workspace().cursorPositionChanged.connect( self._onCursorPositionChanged) self._timer = QTimer() self._timer.setInterval(200) self._timer.setSingleShot(True) self._timer.timeout.connect(self._onUpdatePositionTimer) self._passedUpdate = False
def __init__(self, parent=None): QToolButton.__init__(self, parent) #TESTO ALTERNATIVO #Spesso se il pulsante ha icona troppo grossa e quando per ragioni di spazio o altro non si può spostare #o ridimensionare il pulsante stesso, la label ha posizioni assurde e schifose. Aggiungerne una "+ controllabile" #è l'unico modo.. self.__fixed_label = QLabel("alternative label", self) self.__fixed_label.move(0, self.geometry().height() - 35) self.__fixed_label.resize(self.geometry().width(), self.__fixed_label.geometry().height()) self.__fixed_label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.__font = QtGui.QFont("Arial", 10) self.__fixed_label.setFont(self.__font) self.__fixed_label.show() #INDICATORE STILE iOS self.__indicator = QLabel("0", self) self.__indicator.setStyleSheet("border-image: url(':/images/backgrounds/indicator.png'); padding-right:1px; color: white;") self.__indicator.geometry().setWidth(25) self.__indicator.geometry().setHeight(20) self.__indicator.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.__indicator.setVisible(False) self.setIndicatorPos(QPoint(self.width() - self.__indicator.width(), 0)) #default top-right corner #Quando il pulsante viene ridimensionato (designer o meno) devo anche sistemare la label di conseguenza self.resizeEvent = self.__onResize self.__indicator.resizeEvent = self.__on_indicator_Resize self.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self.clicked.connect(self.stopAllAnimations) #BLINK self.__blink_timer = QTimer(parent) self.__blink_timer.timeout.connect(self.__on_blink_timer) self.__blink_timer_interval = 1000 #FADING self.__opacity_effect = QGraphicsOpacityEffect() self.__fading_timer = QTimer(parent) self.__fading_timer.timeout.connect(self.__on_fading_timer) self.__FADE_TYPE = Enum("IN", "OUT") self.__fade_time = 20 self.__opacity = 1.0 self.__opacity_fading_coefficient = 0.02 self.__selected_fade_type = self.__FADE_TYPE.IN # ANIMAZIONI GROW self.__animationGrow = QPropertyAnimation(self, "iconSize", self) self.__animationGrow.setDuration(1000) self.__animationGrow.setEasingCurve(QEasingCurve.Linear) self.__animationGrow.finished.connect(self.__on_growed) self.__animationShrink = QPropertyAnimation(self, "iconSize", self) self.__animationShrink.setDuration(1000) self.__animationShrink.setEasingCurve(QEasingCurve.Linear) self.__animationShrink.finished.connect(self.__on_shrinked) self.__defaultIconDimension = 60 self.__iconGrowsBy = 40 self.__growing = False # ANIMAZIONI BOUNCE self.__animationUp = QPropertyAnimation(self, "pos", self) self.__animationUp.setDuration(200) self.__animationUp.setEasingCurve(QEasingCurve.Linear) self.__animationUp.finished.connect(self.__on_top_reached) self.__animationBounce = QPropertyAnimation(self, "pos", self) self.__animationBounce.setDuration(1000) self.__animationBounce.setEasingCurve(QEasingCurve.OutBounce) self.__animationBounce.finished.connect(self.__on_bounce_finished) self.__bouncing = False self.__startPos = QPoint(self.pos().x(), self.pos().y()) #PIXMAP & MASCHERA self.__pmap = QPixmap(self.size()) self.__pmap_fname = "" self.__show_mask_preview = False
def __init__(self, *args, **kwargs): QToolButton.__init__(self, *args, **kwargs) self.__text = ""
def __init__(self, parent, logger): QToolButton.__init__(self, parent) HiddenWidgetBase.__init__(self, logger) self.setFocusPolicy(Qt.NoFocus)
def __init__(self, parent, direction): QToolButton.__init__(self, parent) self.direction = None self.setDirection(direction)
def __init__(self, text, ilastikIcon, tooltip=""): QToolButton.__init__(self) self.setText(text) self.setIcon(QIcon(ilastikIcon)) self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.setToolTip(tooltip)
def __init__(self, parent): """ Close all button """ QToolButton.__init__(self, parent)
def __init__(self, *args): QToolButton.__init__(self, *args) self._color = QColor() self.connect(self, SIGNAL("clicked()"), self.selectColor)
def __init__(self, parent=None, flat=True, **kwargs): QToolButton.__init__(self, parent, **kwargs) self.__flat = flat
def __init__(self, parent=None): QToolButton.__init__(self, parent) #TESTO ALTERNATIVO #Spesso se il pulsante ha icona troppo grossa e quando per ragioni di spazio o altro non si può spostare #o ridimensionare il pulsante stesso, la label ha posizioni assurde e schifose. Aggiungerne una "+ controllabile" #è l'unico modo.. self.__fixed_label = QLabel("alternative label", self) self.__fixed_label.move(0, self.geometry().height() - 35) self.__fixed_label.resize(self.geometry().width(), self.__fixed_label.geometry().height()) self.__fixed_label.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.__font = QtGui.QFont("Arial", 10) self.__fixed_label.setFont(self.__font) self.__fixed_label.show() #INDICATORE STILE iOS self.__indicator = QLabel("0", self) self.__indicator.setStyleSheet( "border-image: url(':/images/backgrounds/indicator.png'); padding-right:1px; color: white;" ) self.__indicator.geometry().setWidth(25) self.__indicator.geometry().setHeight(20) self.__indicator.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter) self.__indicator.setVisible(False) self.setIndicatorPos(QPoint(self.width() - self.__indicator.width(), 0)) #default top-right corner #Quando il pulsante viene ridimensionato (designer o meno) devo anche sistemare la label di conseguenza self.resizeEvent = self.__onResize self.__indicator.resizeEvent = self.__on_indicator_Resize self.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self.clicked.connect(self.stopAllAnimations) #BLINK self.__blink_timer = QTimer(parent) self.__blink_timer.timeout.connect(self.__on_blink_timer) self.__blink_timer_interval = 1000 #FADING self.__opacity_effect = QGraphicsOpacityEffect() self.__fading_timer = QTimer(parent) self.__fading_timer.timeout.connect(self.__on_fading_timer) self.__FADE_TYPE = Enum("IN", "OUT") self.__fade_time = 20 self.__opacity = 1.0 self.__opacity_fading_coefficient = 0.02 self.__selected_fade_type = self.__FADE_TYPE.IN # ANIMAZIONI GROW self.__animationGrow = QPropertyAnimation(self, "iconSize", self) self.__animationGrow.setDuration(1000) self.__animationGrow.setEasingCurve(QEasingCurve.Linear) self.__animationGrow.finished.connect(self.__on_growed) self.__animationShrink = QPropertyAnimation(self, "iconSize", self) self.__animationShrink.setDuration(1000) self.__animationShrink.setEasingCurve(QEasingCurve.Linear) self.__animationShrink.finished.connect(self.__on_shrinked) self.__defaultIconDimension = 60 self.__iconGrowsBy = 40 self.__growing = False # ANIMAZIONI BOUNCE self.__animationUp = QPropertyAnimation(self, "pos", self) self.__animationUp.setDuration(200) self.__animationUp.setEasingCurve(QEasingCurve.Linear) self.__animationUp.finished.connect(self.__on_top_reached) self.__animationBounce = QPropertyAnimation(self, "pos", self) self.__animationBounce.setDuration(1000) self.__animationBounce.setEasingCurve(QEasingCurve.OutBounce) self.__animationBounce.finished.connect(self.__on_bounce_finished) self.__bouncing = False self.__startPos = QPoint(self.pos().x(), self.pos().y()) #PIXMAP & MASCHERA self.__pmap = QPixmap(self.size()) self.__pmap_fname = "" self.__show_mask_preview = False
def __init__(self, parent=None): QToolButton.__init__(self, parent)
def __init__(self, *args, **kwargs): QToolButton.__init__(self, *args, **kwargs) self.setIcon(icons.get("edit-clear-locationbar-rtl"))
def __init__(self, action=None, parent=None): QToolButton.__init__(self, parent) self.setMinimumSize(30, 30) if action: self.setDefaultAction(action)
def __init__(self, texto, parent=None): QToolButton.__init__(self, parent) self.setObjectName("dock_button") self.setText(texto) self.setCheckable(True) self.setAutoRaise(True)
def __init__(self, base, image, tooltip): QToolButton.__init__(self) icon = QIcon(base.get_image_path(image)) self.setIcon(icon) self.setToolTip(tooltip) self.setMaximumSize(24, 24)
def __init__(self, *args, **kwargs): self.__nativeStyling = False self.position = QStyleOptionToolBoxV2.OnlyOneTab self.selected = QStyleOptionToolBoxV2.NotAdjacent QToolButton.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): QToolButton.__init__(self, *args, **kwargs) baseIcon = QIcon(":go-next.svg") secondIcon = QIcon(":go-previous.svg") self.__icons__ = [baseIcon, secondIcon] self.setIcon(baseIcon)