def __init__(self, qpart): QWidget.__init__(self, qpart) self._qpart = qpart qpart.blockCountChanged.connect(self.update) defaultSizePixmap = QPixmap(qutepart.getIconPath('bookmark.png')) iconSize = self._qpart.cursorRect().height() self._bookmarkPixmap = defaultSizePixmap.scaled(iconSize, iconSize)
def _createAction(self, widget, iconFileName, text, shortcut, slot): """Create QAction with given parameters and add to the widget """ icon = QIcon(qutepart.getIconPath(iconFileName)) action = QAction(icon, text, widget) action.setShortcut(QKeySequence(shortcut)) action.setShortcutContext(Qt.WidgetShortcut) action.triggered.connect(slot) widget.addAction(action) return action
def _loadIcon(self, fileName): defaultSizePixmap = QPixmap(qutepart.getIconPath(fileName)) iconSize = self._qpart.cursorRect().height() return defaultSizePixmap.scaled(iconSize, iconSize, transformMode=Qt.SmoothTransformation)