def popup(self, items = None): menu = _gtk.Menu() index = 0 if _util.humanbool(self.options.get('show-current-selection', 'yes')) and len(self.history): item = _gtk.MenuItem("") item.get_children()[0].set_markup( "<b>%s</b>" % (self._printable(self.history.top, True),), ) menu.append(item) menu.append(_gtk.SeparatorMenuItem()) index += 1 self._build_menu(menu, items or self.items()) menu.show_all() menu.popup( None, None, None, 1, _gtk.get_current_event_time(), ) menu.set_active(index) return True
def __init__(self, config_files): super(Klemmbrett, self).__init__() self._clipboard = _gtk.Clipboard.get(_gdk.SELECTION_CLIPBOARD) self._primary = _gtk.Clipboard.get(_gdk.SELECTION_PRIMARY) self.config = _config.Config() self.config.read(config_files) _keybinder.init() # configure klemmbrett self._plugins = dict() self._load_plugins() self._sync = _util.humanbool( self.config.get('klemmbrett', 'sync', True)) self.selection = None self._clipboard.connect('owner-change', self._clipboard_owner_changed) self._primary.connect('owner-change', self._clipboard_owner_changed) try: _notify.init("Klemmbrett") except _dbus.exceptions.DBusException: _log.error( "Could not register with notification interface, notifications will not work properly", exc_info=True)
def popup(self, keystr, items = None): self._ungrab_keyboard() menu = _gtk.Menu() index = 0 if _util.humanbool(self.options.get('show-current-selection', 'yes')) and len(self.history): item = _gtk.MenuItem("") item.get_children()[0].set_markup( "<b>%s</b>" % (self._printable(self.history.top, True),), ) menu.append(item) menu.append(_gtk.SeparatorMenuItem()) index += 1 self._build_menu(menu, items or self.items()) menu.show_all() menu.popup( None, None, None, None, 0, _keybinder.get_current_event_time(), ) menu.set_active(index) return True
def __init__(self, config_files): super(Klemmbrett, self).__init__() self._clipboard = _gtk.Clipboard(selection = "CLIPBOARD") self._primary = _gtk.Clipboard(selection = "PRIMARY") self.config = _config.Config() self.config.read(config_files) # configure klemmbrett self._plugins = dict() self._load_plugins() self._sync = _util.humanbool(self.config.get('klemmbrett', 'sync', True)) self.selection = None self._clipboard.connect('owner-change', self._clipboard_owner_changed) self._primary.connect('owner-change', self._clipboard_owner_changed) _notify.init("Klemmbrett")
def __init__(self, name, options, klemmbrett): Plugin.__init__(self, name, options, klemmbrett) self._history = _collections.deque(maxlen = self.maxlen) self._extend_detection = _util.humanbool(self.options.get('extend-detection', 'yes'))