def __init__ (self): QAbstractItemModel.__init__ (self) self.list = list() self.folderIcon = KIconLoader.global_().loadIcon("folder", KIconLoader.NoGroup, KIconLoader.SizeSmall) self.textplainIcon = KIconLoader.global_().loadIcon("text-plain", KIconLoader.NoGroup, KIconLoader.SizeSmall)
def show_touchpad(self, touchpad): """ Show information about the given ``touchpad`` in this widget. ``touchpad`` is a :class:`~synaptiks.touchpad.Touchpad` object. """ self.nameLabel.setText(i18nc( '@info touchpad name', '<title><resources>%1</resource></title>', touchpad.name)) pixmaps = {True: 'dialog-ok', False: 'dialog-cancel'} for key in pixmaps: pixmaps[key] = KIconLoader.global_().loadIcon( pixmaps[key], KIconLoader.Small) button_widgets = ('left', 'middle', 'right') for widget_name, is_supported in zip(button_widgets, touchpad.buttons): widget = getattr(self, '{0}Button'.format(widget_name)) widget.setPixmap(pixmaps[is_supported]) self.fingerDetection.setValue(touchpad.finger_detection) # disable the emulation box, if the touchpad natively supports two # fingers natively. if touchpad.finger_detection > 2: self.twoFingerEmulationBox.setEnabled(False) # nonetheless always assign proper pixmaps self.fingerWidthDetection.setPixmap( pixmaps[touchpad.has_finger_width_detection]) self.pressureDetection.setPixmap( pixmaps[touchpad.has_pressure_detection]) self.twoFingerEmulation.setPixmap( pixmaps[touchpad.has_two_finger_emulation])
def _icon_data(self, obj, col): if col == 2 and obj.isLocked(): #print "object locked" #return QVariant("blah") return QVariant(KIconLoader.global_() .loadIcon('object-locked', KIconLoader.Small)) else: return QVariant()
def notify_touchpad_state(self, is_off=None): if is_off is None: is_off = self.touchpad.off # show a notification if is_off: event_id = 'touchpadOff' text = i18nc('touchpad switched notification', 'Touchpad switched off') else: event_id = 'touchpadOn' text = i18nc('touchpad switched notification', 'Touchpad switched on') icon = KIconLoader.global_().loadIcon('synaptiks', KIconLoader.Panel) KNotification.event(event_id, text, icon)
def __init__(self, error, component_data, parent=None): SynaptiksKCMBase.__init__(self, component_data, parent) if isinstance(error, basestring): error_message = error else: from synaptiks.kde.error import get_localized_error_message error_message = get_localized_error_message(error) self.setLayout(QHBoxLayout(self)) icon = QLabel('foobar', self) icon.setPixmap(KIconLoader.global_().loadIcon( 'dialog-warning', KIconLoader.Desktop, KIconLoader.SizeLarge)) icon.setAlignment(Qt.AlignTop | Qt.AlignLeft) # do not expand the icon horizontally, to avoid a wide empty space # between icon and text, and to given as much space as possible to the # text contents icon.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Expanding) self.layout().addWidget(icon) message = QLabel(error_message, self) message.setAlignment(Qt.AlignTop | Qt.AlignLeft) message.setWordWrap(True) message.setOpenExternalLinks(True) self.layout().addWidget(message) self.setButtons(self.Help)
def load(self): configurePixmap = KIconLoader.global_().loadIcon(self.iconName, KIconLoader.NoGroup, self.height()) self.setPixmap(configurePixmap)