__kupfer_name__ = _("Pinboard") __kupfer_sources__ = ("PinboardBookmarkSource", ) __kupfer_actions__ = () __description__ = _("Manage and use bookmarks from Pinboard") __version__ = "2020-11-15" __author__ = "Peter Stuifzand <*****@*****.**>" from kupfer import plugin_support from kupfer.objects import Source from kupfer.objects import UrlLeaf import pinboard __kupfer_settings__ = plugin_support.PluginSettings( { "key": "token", "label": _("Pinboard API Token"), "type": str, "value": "", }, ) class PinboardBookmarkSource(Source): def __init__(self): super().__init__(_("Pinboard Bookmarks")) def get_items(self): token = __kupfer_settings__["token"] if token == "": return [] pb = pinboard.Pinboard(token) bookmarks = pb.posts.all(start=0, results=100)
from kupfer import plugin_support from kupfer.plugin import rhythmbox_support plugin_support.check_dbus_connection() __kupfer_settings__ = plugin_support.PluginSettings( { "key": "toplevel_artists", "label": _("Include artists in top level"), "type": bool, "value": True, }, { "key": "toplevel_albums", "label": _("Include albums in top level"), "type": bool, "value": False, }, { "key": "toplevel_songs", "label": _("Include songs in top level"), "type": bool, "value": False, }, ) _BUS_NAME = 'org.gnome.Rhythmbox3' _OBJ_PATH_MPRIS = '/org/mpris/MediaPlayer2' _OBJ_NAME_MPRIS_PLAYER = 'org.mpris.MediaPlayer2.Player' _OBJ_PATH_MEDIASERVC_ALL = '/org/gnome/UPnP/MediaServer2/Library/all' _OBJ_NAME_MEDIA_CONT = 'org.gnome.UPnP.MediaContainer2'
import sqlite3 from kupfer import plugin_support from kupfer.objects import Source from kupfer.objects import UrlLeaf, Leaf from kupfer.obj.apps import AppLeafContentMixin from kupfer.obj.helplib import FilesystemWatchMixin from kupfer.plugin import firefox_support __kupfer_settings__ = plugin_support.PluginSettings( { "key": "load_history", "label": _("Include visited sites"), "type": bool, "value": True, }, { "key": "load_tags", "label": _("Include tags"), "type": bool, "value": True, }, ) class Tag(Leaf): def __init__(self, name, bookmarks): Leaf.__init__(self, bookmarks, name) def has_content(self): return bool(self.object)
from kupfer.obj.grouping import ToplevelGroupingSource from kupfer.obj import contacts from kupfer import plugin_support, pretty, utils, icons, kupferstring plugin_support.check_keyring_support() __kupfer_settings__ = plugin_support.PluginSettings( { 'key': 'userpass', 'label': '', 'type': plugin_support.UserNamePassword, 'value': '', }, { 'key': 'loadicons', 'label': _("Load contacts' pictures"), 'type': bool, 'value': True, }, { 'key': 'loadadditional', 'label': _("Load additional information"), 'type': bool, 'value': True, }, ) GMAIL_NEW_MAIL_URL = \ "https://mail.google.com/mail/?view=cm&ui=2&tf=0&to=%(emails)s&fs=1" GMAIL_EDIT_CONTACT_URL = "https://mail.google.com/mail/#contact/%(contact)s"
__kupfer_name__ = _("Wikipedia") __kupfer_sources__ = () __kupfer_actions__ = ("WikipediaSearch", ) __description__ = _("Search in Wikipedia") __version__ = "" __author__ = "Ulrik Sverdrup <*****@*****.**>" import urllib from kupfer.objects import Action, TextLeaf from kupfer import utils, plugin_support __kupfer_settings__ = plugin_support.PluginSettings( { "key": "lang", "label": _("Wikipedia language"), "type": str, # TRANS: Default wikipedia language code "value": _("en"), }, ) class WikipediaSearch(Action): def __init__(self): Action.__init__(self, _("Search in Wikipedia")) def activate(self, leaf): # Send in UTF-8 encoding lang_code = __kupfer_settings__["lang"] search_url = "http://%s.wikipedia.org/w/index.php?title=Special:Search&go=Go" % lang_code # will encode search=text, where `text` is escaped query_url = search_url + "&" + urllib.urlencode(
from kupfer.objects import Action, Source from kupfer.objects import SourceLeaf, AppLeaf, FileLeaf, UrlLeaf from kupfer import icons from kupfer import launch from kupfer import plugin_support from kupfer.weaklib import gobject_connect_weakly __kupfer_settings__ = plugin_support.PluginSettings( { "key" : "max_days", "label": _("Max recent document days"), "type": int, "value": 28, }, { "key" : "check_doc_exist", "label": _("Show only existing documents"), "type": bool, "value": True, } ) ALIASES = { 'libreoffice': 'soffice', } # Libreoffice doesn't separate them out, so we'll hack that in manually SEPARATE_APPS = { 'libreoffice': {
from kupfer.objects import FileLeaf, RunnableLeaf, SourceLeaf from kupfer.obj.apps import AppLeafContentMixin from kupfer.weaklib import DbusWeakCallback from kupfer import icons, utils from kupfer import plugin_support from kupfer import kupferstring from kupfer import pretty __kupfer_settings__ = plugin_support.PluginSettings( { "key": "playlist_toplevel", "label": _("Include songs in top level"), "type": bool, "value": True, }, { "key": "client", "label": _("Preferred MPRIS client"), "type": str, "value": "Exaile", "alternatives": ("Exaile", "Audacious", "XMMS", "VLC") }, ) plugin_support.check_dbus_connection() MPRIS_RE = re.compile('^org\.mpris\.([^.]+)$') def _default_client(): return str.lower(__kupfer_settings__['client'])
from kupfer import config, utils, pretty, icons, plugin_support __kupfer_settings__ = plugin_support.PluginSettings( { "key": "page_name_starts_colon", "label": _("Page names start with :colon"), "type": bool, "value": False, }, { "key": "quicknote_basename", "label": _("Default page name for quick notes"), "type": str, "value": _("Note %x %X"), "tooltip": _("Strftime tags can be used: %H - hour, %M - minutes, etc\n" "Please check python documentation for details.\n" "NOTE: comma will be replaced by _"), }, { "key": "quicknote_namespace", "label": _("Default namespace for quick notes"), "type": str, "value": "", }, ) ''' Changes:
import urllib.parse from kupfer.objects import Action, TextLeaf from kupfer import utils, plugin_support, config _ALTERNATIVES = ( "german", "english", "spanish", ) __kupfer_settings__ = plugin_support.PluginSettings({ "key": "language", "label": _("Your language for the trailer"), "type": str, "value": "german", "alternatives": _ALTERNATIVES, }) class MovieTrailer(Action): def __init__(self): Action.__init__(self, _("Trailer")) def activate(self, leaf): language = __kupfer_settings__["language"] query_url = "https://www.youtube.com/results?search_query=" + leaf.object + "+trailer+" + language utils.show_url(query_url)
__version__ = "2010-02-03" __author__ = "Karol Będkowski <*****@*****.**>" import os import gio import glib from kupfer.objects import Leaf, Action, Source, TextLeaf, TextSource from kupfer.obj.apps import AppLeafContentMixin from kupfer import config, utils, pretty, icons, plugin_support __kupfer_settings__ = plugin_support.PluginSettings( { "key": "page_name_starts_colon", "label": _("Page names start with :colon"), "type": bool, "value": False, }, ) ''' TODO: use FilesystemWatchMixin (?) ''' def _start_zim(notebook, page): ''' Start zim and open given notebook and page. ''' utils.spawn_async(("zim", notebook, page.replace("'", "_"))) class ZimPage(Leaf):
from kupfer import pretty, plugin_support, icons, uiutils from kupfer.obj.apps import AppLeafContentMixin from kupfer.objects import OperationError from kupfer.weaklib import dbus_signal_connect_weakly from kupfer import utils import time __kupfer_settings__ = plugin_support.PluginSettings( { "key": "toplevel_activities", "label": _("Include activities in top level"), "type": bool, "value": True, }, { "key": "return_started_facts", "label": _("When starting an activity immediately re-open Kupfer with the new activity focused. " "This will let you easily further modify the start and endtime, tags and description." ), "type": bool, "value": True, }) HAMSTER_APPNAMES = ( "hamster-indicator", "hamster-time-tracker", ) plugin_support.check_dbus_connection()
"Supports both Sun VirtualBox and Open Source Edition.") __version__ = "0.3" __author__ = "Karol Będkowski <*****@*****.**>" from kupfer.objects import Leaf, Action, Source from kupfer import pretty from kupfer import plugin_support from kupfer.obj.apps import ApplicationSource from kupfer.plugin.virtualbox import ose_support from kupfer.plugin.virtualbox import constants as vbox_const __kupfer_settings__ = plugin_support.PluginSettings( { "key": "force_cli", "label": _("Force use CLI interface"), "type": bool, "value": False, }, ) def _get_vbox(): if __kupfer_settings__['force_cli']: pretty.print_info(__name__, 'Using cli...') return ose_support try: from kupfer.plugin.virtualbox import vboxapi4_support pretty.print_info(__name__, 'Using vboxapi4...') return vboxapi4_support except ImportError: pass
__kupfer_sources__ = ("SSHSession", ) __kupfer_actions__ = ("Connect", ) __description__ = _("Open SSH Session in yakuake") __version__ = "2018-2" __author__ = "thorko" import subprocess import os, re from kupfer.objects import Source, Action, TextLeaf from kupfer import utils, plugin_support __kupfer_settings__ = plugin_support.PluginSettings({ "key": "config_file", "label": _("Your ssh host file"), "type": str, "value": "~/sshhosts" }) class SSHSession(Source): source_use_cache = False source_user_reloadable = True def __init__(self): super().__init__(_("SSH")) self.mark_for_update() def finalize(self):
_ALTERNATIVES = ( "google-chrome-stable", "chromium", "firefox", "vivaldi-stable", ) __kupfer_settings__ = plugin_support.PluginSettings( { "key" : "browser_type", "label": _("Your browser to use"), "type": str, "value": "google-chrome-stable", "alternatives": _ALTERNATIVES, }, { "key": "config_file", "label": _("Your netflix series file"), "type": str, "value": "~/netflixseries" } ) class Netflix (Source): source_use_cache = False source_user_reloadable = True def __init__(self): super().__init__(__kupfer_name__) self.mark_for_update()
from kupfer.obj.contacts import ContactLeaf, NAME_KEY from kupfer.obj.special import PleaseConfigureLeaf plugin_support.check_keyring_support() __kupfer_settings__ = plugin_support.PluginSettings( { 'key': 'userpass', 'label': '', 'type': plugin_support.UserNamePassword, 'value': '', }, { 'key': 'loadicons', 'label': _("Load friends' pictures"), 'type': bool, 'value': True }, { 'key': 'loadtweets', 'label': _("Load friends' public tweets"), 'type': bool, 'value': False, }, { 'key': 'loadtimeline', 'label': _('Load timeline'), 'type': bool, 'value': False, }) MAX_STATUSES_COUNT = 10 MAX_TIMELINE_STATUSES_COUNT = MAX_STATUSES_COUNT * 2 TWITTER_USERNAME_KEY = 'twitter_username'
from kupfer import uiutils from kupfer import plugin_support from kupfer import commandexec from kupfer import task from kupfer.obj.base import Action from kupfer.obj.objects import TextLeaf import gnupg_support as support __kupfer_settings__ = plugin_support.PluginSettings( { "key": "ask_for_key", "label": _("Ask for key when signing files and text"), "type": bool, "value": False, }, { "key": "default_key", "label": _("Default private key"), "type": str, "value": '', "tooltip": _("Leave this field blank for use default GnuPG key."), }) class _GPGTask(task.ThreadTask): def __init__(self, cli, stdin, finish_callback): task.ThreadTask.__init__(self) self.cli = cli self.finish_callback = finish_callback self.stdin = stdin self.resutl = None
from kupfer import utils from kupfer import plugin_support dictionaries = { 'gnome-dictionary': ['gnome-dictionary', '--look-up='], 'mate-dictionary': ['mate-dictionary', '--look-up='], 'purple': ['purple', '--define='], 'xfce4-dict': ['xfce4-dict', '--dict', ''], } __kupfer_settings__ = plugin_support.PluginSettings({ "key": "dictionary", "label": _("Dictionary"), "type": str, "alternatives": list(dictionaries.keys()), "value": 'gnome-dictionary', }) class LookUp(Action): def __init__(self): Action.__init__(self, _("Look Up")) def activate(self, leaf): text = leaf.object dict_id = __kupfer_settings__["dictionary"] dict_argv = list(dictionaries[dict_id])
import gobject from kupfer.objects import TextSource, TextLeaf, Action, FileLeaf from kupfer.objects import OperationError from kupfer.obj.fileactions import Execute from kupfer import utils, icons from kupfer import kupferstring from kupfer import pretty from kupfer import plugin_support __kupfer_settings__ = plugin_support.PluginSettings( { "key": "aliases", "label": _("Include Bash aliases"), "type": bool, "value": False }, { "key": "functions", "label": _("Include Bash functions"), "type": bool, "value": False }) def finish_command(ctx, acommand, stdout, stderr, post_result=True): """Show async error if @acommand returns error output & error status. Else post async result if @post_result. """ max_error_msg = 512 pretty.print_debug(__name__, "Exited:", acommand) if acommand.exit_status != 0 and not stdout and stderr: errstr = kupferstring.fromlocale(stderr)[:max_error_msg]
from kupfer.objects import Source, TextLeaf, Action, SourceLeaf from kupfer.objects import FileLeaf from kupfer.obj.compose import MultipleLeaf from kupfer import plugin_support from kupfer import kupferstring, pretty __kupfer_settings__ = plugin_support.PluginSettings( { "key": "max", "label": _("Number of recent clipboards to remember"), "type": int, "value": 10, }, { "key": "use_selection", "label": _("Include selected text in clipboard history"), "type": bool, "value": False, }, { "key": "sync_selection", "label": _("Copy selected text to primary clipboard"), "type": bool, "value": False, }, ) class SelectedText(TextLeaf): qf_id = "selectedtext" def __init__(self, text):
__version__ = "" __author__ = "thorko" import subprocess from kupfer.objects import Action, Source from kupfer.objects import TextLeaf from kupfer import icons, plugin_support from kupfer import kupferstring from kupfer.obj.objects import ConstructFileLeaf __kupfer_settings__ = plugin_support.PluginSettings({ "key": "paths_to_search", "label": _("paths to search seperated by space"), "type": str, "value": "", }) class SearchNotes(Action): def __init__(self): Action.__init__(self, _("Search my notes")) def is_factory(self): return True def activate(self, leaf): return SearchMyNotes(leaf.object)
* fix: errors when no one configured directories exists ''' import os from kupfer.obj import sources from kupfer import plugin_support __kupfer_settings__ = plugin_support.PluginSettings( { 'key': 'dirs', 'label': _("Directories (;-separated):"), 'type': str, 'value': "~/Documents/", }, { 'key': 'depth', 'label': _("Depth (max 10):"), 'type': int, 'value': 2, }, ) MAX_DEPTH = 10 class DeepDirSource(sources.FileSource): def __init__(self, name=_("Deep Directories")): sources.FileSource.__init__( self, self._get_dirs() or [''],
from kupfer.objects import Action, FileLeaf from kupfer import utils from kupfer import plugin_support from kupfer import runtimehelper __kupfer_settings__ = plugin_support.PluginSettings( { "key": "archive_type", "label": _("Compressed archive type for 'Create Archive In'"), "type": str, "value": ".tar.gz", "alternatives": ( ".7z", ".rar", ".tar", ".tar.gz", ".tar.bz2", ".tar.xz", ".zip", ) }, ) class UnpackHere(Action): def __init__(self): Action.__init__(self, _("Extract Here")) self.extensions_set = set((
import xml.sax.saxutils import dbus import xdg.BaseDirectory as base from kupfer.objects import Action, Source, Leaf, TextLeaf from kupfer.obj.apps import ApplicationSource from kupfer import icons, plugin_support from kupfer import pretty, textutils PROGRAM_IDS = ["gnote", "tomboy", "kzrnote"] __kupfer_settings__ = plugin_support.PluginSettings( { "key": "notes_application", "label": _("Work with application"), "type": str, "value": "", "alternatives": [ "", ] + PROGRAM_IDS }, ) plugin_support.check_dbus_connection() def unicode_strftime(fmt, time_tuple=None): enc = locale.getpreferredencoding(False) return unicode(time.strftime(fmt, time_tuple), enc, "replace") ## Tuples of service name, object name, interface name PROGRAM_SERIVCES = {
OauthGui(self.object.yuri, callback) def defined(self): try: # pretty.print_debug(__name__, 'Validating config:', self.object.token_leg, # ', verifier:', self.time, # 'valid:', bool(self.object and self.object.token_leg)) return self.object and self.object.token_leg except: return False __kupfer_settings__ = plugin_support.PluginSettings( { 'key': 'tripod', 'label': 'Get authorization', 'type': Oauth, 'value': None, }, ) from kupfer.objects import Action, TextLeaf class MemeAction(Action): def __init__(self, name): Action.__init__(self, name) self.tripod = None self.cfg = None def valid_for_item(self, item): if not self.cfg:
import signal import operator from kupfer.objects import Action, Source, Leaf from kupfer import scheduler from kupfer import plugin_support from kupfer import utils __kupfer_settings__ = plugin_support.PluginSettings( { "key": "sort_order", "label": _("Sort Order"), "type": str, "value": _("Commandline"), "alternatives": [ _("Commandline"), _("CPU usage (descending)"), _("Memory usage (descending)") ] }, ) class Task(Leaf): def __init__(self, path, name, description=None): Leaf.__init__(self, path, name) self._description = description def get_description(self):
__version__ = "2011-07-07" __author__ = "Karol Będkowski <*****@*****.**>" import os import re from kupfer.objects import Source, Action, TextLeaf, Leaf from kupfer import icons from kupfer import plugin_support import pystardict __kupfer_settings__ = plugin_support.PluginSettings( { 'key': 'dictdirs', 'label': _("Dictionaries location (;-separated):"), 'type': str, 'value': "/usr/share/stardict/dic/", }, ) class Lookup(Action): def __init__(self): Action.__init__(self, _("Lookup In...")) def activate(self, leaf, iobj): text = unicode(leaf.object) return _LookupSource(text, iobj) def is_factory(self): return True
import time from kupfer import icons from kupfer import plugin_support from kupfer import pretty from kupfer.objects import Leaf, Action, Source, AppLeaf from kupfer.weaklib import dbus_signal_connect_weakly from kupfer.obj.helplib import PicklingHelperMixin from kupfer.obj.apps import AppLeafContentMixin from kupfer.obj.grouping import ToplevelGroupingSource from kupfer.obj.contacts import ContactLeaf, JabberContact, JABBER_JID_KEY __kupfer_settings__ = plugin_support.PluginSettings( { "key": "show_offline", "label": _("Show offline contacts"), "type": bool, "value": False, }, ) plugin_support.check_dbus_connection() _STATUSES = { 'available': _('Available'), 'away': _('Away'), 'dnd': _('Busy'), 'xa': _('Not Available'), 'hidden': _('Invisible'), 'offline': _('Offline') }
__kupfer_sources__ = () __kupfer_text_sources__ = () __kupfer_actions__ = ("AddTask", ) __description__ = _("A plugin to integrate Gina Trapani's Todo.txt into Kupfer") __version__ = "1.0" __author__ = "Manuel Kehl" import gio from kupfer.objects import Action, TextLeaf from kupfer import plugin_support __kupfer_settings__ = plugin_support.PluginSettings( { "key" : "path_to_file", "label": _("Path to your Todo.txt"), "type": str, "value": "", }, ) class AddTask (Action): def __init__(self): Action.__init__(self, _("Add to Todo.txt")) def item_types(self): yield TextLeaf def get_description(self): return _("Adds a task to your Todo.txt file") def get_icon_name(self):
from kupfer.objects import Leaf, Source, Action from kupfer.objects import RunnableLeaf, SourceLeaf from kupfer.obj.apps import AppLeafContentMixin from kupfer import icons, utils, uiutils from kupfer import plugin_support from kupfer import kupferstring from kupfer.weaklib import dbus_signal_connect_weakly plugin_support.check_dbus_connection() import dbus __kupfer_settings__ = plugin_support.PluginSettings( { "key": "playlist_toplevel", "label": _("Include songs in top level"), "type": bool, "value": True, }, ) AUDTOOL = "audtool" AUDACIOUS = "audacious" _BUS_NAME = "org.atheme.audacious" def enqueue_song(info): utils.spawn_async((AUDTOOL, "playqueue-add", "%d" % info)) def dequeue_song(info): utils.spawn_async((AUDTOOL, "playqueue-remove", "%d" % info))
from os import path import gio from gtk import recent_manager_get_default from kupfer.objects import Source, AppLeaf, FileLeaf, UrlLeaf from kupfer import icons from kupfer import launch from kupfer import plugin_support from kupfer.weaklib import gobject_connect_weakly __kupfer_settings__ = plugin_support.PluginSettings( { "key": "max_days", "label": _("Max recent document days"), "type": int, "value": 28, }, ) class RecentsSource(Source): def __init__(self, name=None): if not name: name = _("Recent Items") super(RecentsSource, self).__init__(name) def initialize(self): """Set up change callback""" manager = recent_manager_get_default() gobject_connect_weakly(manager, "changed", self._recent_changed)