def __init__(self, text=None, color_caption="#F0F0FF", icon="", config=None): """ text - text in caption and tooltip icon - filename for icon of button """ QToolButton.__init__(self, None) self.setAutoRaise(True) self._cfg = config self._text = self.tr("Table") if text is None else text self._color_caption = color_caption # ------------------------------------------------------ self._colors_widget = InsertTableWidget(color_caption=color_caption) self._colors_widget.select_size.connect(self.select_size_) self._colors_widget.hide_form.connect(self.hide_form) self._colors_widget.other_size.connect(self.other_size) self._action = QAction(self._text, None) self._action.setIcon(QIcon(img(icon))) self._action.triggered.connect(self.show_form) self.setDefaultAction(self._action)
def __init__(self, color, parent=None): QToolButton.__init__(self, parent) self.setIconSize(QSize(50, 25)) self.pix = QPixmap(self.iconSize()) self._color = QColor('#' + color) self.pix.fill(self._color) self.setIcon(QIcon(self.pix)) self.clicked.connect(self.choose_color)
def __init__(self, *args): QToolButton.__init__(self, *args) self.animation = QPropertyAnimation(self, 'iconSize', self) self.animation.setDuration(60/72.*1000) self.animation.setLoopCount(4) self.normal_icon_size = QSize(64, 64) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, *args): QToolButton.__init__(self, *args) self.animation = QPropertyAnimation(self, 'iconSize', self) self.animation.setDuration(60 / 72. * 1000) self.animation.setLoopCount(4) self.normal_icon_size = QSize(64, 64) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, *args): QToolButton.__init__(self, *args) self._icon_size = -1 QToolButton.setIcon(self, QIcon(I('donate.png'))) self.setText('\xa0') self.animation = QPropertyAnimation(self, b'icon_size', self) self.animation.setDuration(60/72.*1000) self.animation.setLoopCount(4) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, icon, text, splitter=None, parent=None, shortcut=None): QToolButton.__init__(self, parent) self.label = text self.setIcon(QIcon(icon)) self.setCheckable(True) self.icname = os.path.basename(icon).rpartition('.')[0] self.splitter = splitter if splitter is not None: splitter.state_changed.connect(self.update_state) self.setCursor(Qt.PointingHandCursor) self.shortcut = shortcut or ''
def __init__(self, text=None, color_caption="#F0F0FF", icon="", config=None): """ text - text in caption and tooltip icon - filename for icon of button list_colors - list colors for select """ QToolButton.__init__(self, None) self.setAutoRaise(True) self._text = self.tr("Color") if text is None else text self._color_caption = color_caption # --- list of colors ----------------------------------- lst = [] if config: lst = [ c for c in config.get("TextEditor/Colors", "").split(";") if c ] if not lst: lst = [ "#99cc00", "#e2fbfe", "#fee5e2", "#fa8072", "#f5f7a8", "#fef65b", "#ff9a00", "#ff00f4", "#f6f900", "#914285", "#c0d6e4", "#f5f5dc", "#3d40a2", "#acd2cd", "#ff9966", "#a4c73c", "#ff7373", "#50d4ee", "#8d5959", "#104022", "#000000", "#160042", "#6e57d2", "#4c9828", "#444193", "#0000ff", "#ff0000", "white", "#AA0000", "#00AA00", "#0040C2", "#550000", "#004100", "#BF4040" ] if config: config["TextEditor/Colors"] = ";".join(lst) lst.append(color_caption) # the list must contain a background color self._colors = lst # ------------------------------------------------------ self._colors_widget = ColorsWidget(text=self._text, colors=self._colors, color_caption=color_caption) self._colors_widget.select_color.connect(self.select_color_) self._colors_widget.hide_form.connect(self.hide_color_form) self._colors_widget.other_color.connect(self.other_color) self._action = QAction(self._text, None) self._action.setIcon(QIcon(img(icon))) self._action.triggered.connect(self.show_form_colors) self.setDefaultAction(self._action)
def __init__(self, icon, text, splitter=None, parent=None, shortcut=None): QToolButton.__init__(self, parent) self.label = text self.setIcon(QIcon(icon)) self.setCheckable(True) self.splitter = splitter if splitter is not None: splitter.state_changed.connect(self.update_state) self.setCursor(Qt.PointingHandCursor) self.shortcut = '' if shortcut: self.shortcut = shortcut
def __init__(self, *args): QToolButton.__init__(self, *args) # vertically size policy must be expanding for it to align inside a # toolbar self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self._icon_size = -1 QToolButton.setIcon(self, QIcon(I('donate.png'))) self.setText('\xa0') self.animation = QPropertyAnimation(self, b'icon_size', self) self.animation.setDuration(60/72.*1000) self.animation.setLoopCount(4) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, *args): QToolButton.__init__(self, *args) # vertically size policy must be expanding for it to align inside a # toolbar self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) self._icon_size = -1 QToolButton.setIcon(self, QIcon(I('donate.png'))) self.setText('\xa0') self.animation = QPropertyAnimation(self, b'icon_size', self) self.animation.setDuration(60 / 72. * 1000) self.animation.setLoopCount(4) self.animation.valueChanged.connect(self.value_changed) self.setCursor(Qt.PointingHandCursor) self.animation.finished.connect(self.animation_finished)
def __init__(self, text=None, color_caption="#F0F0FF", icon=""): """ text - text in caption and tooltip icon - filename for icon of button """ QToolButton.__init__(self, None) self.setAutoRaise(True) self._text = self.tr("Alignment") if text is None else text self._color_caption = color_caption # ------------------------------------------------------ self._colors_widget = AlignTextWidget(color_caption=color_caption) self._colors_widget.select_align.connect(self.select_align_) self._colors_widget.hide_form.connect(self.hide_form) self._action = QAction(self._text, None) self._action.setIcon(QIcon(img(icon))) self._action.triggered.connect(self.show_form) self.setDefaultAction(self._action)