def __init__(self): Source.__init__(self, _("Favorites")) ## these are default favorites for new users self.references = [ '<kupfer.plugin.core.contents.Help>', '<kupfer.plugin.core.contents.Preferences>', ]
def __init__(self): self.connections = [] self.active_ids = [] # dont query connection - state in short intervals < 10 secs self.last_update_con_state = 0 self.max_age_con_state_secs = 10 # available connections don't change often self.last_update_connections = 0 self.max_age_connections_secs = 120 Source.__init__(self, _("VPN - Connections"))
def get_leaves(self, force_update=False): starttime = time.time() # map (slot, value) -> group groups = {} non_group_leaves = [] for src in self.sources: leaves = Source.get_leaves(src, force_update) for leaf in leaves: try: slots = leaf.slots() except AttributeError: # Let through Non-grouping leaves non_group_leaves.append(leaf) continue slots = leaf.slots() for slot in leaf.grouping_slots: value = slots.get(slot) if value: groups.setdefault((slot, value), set()).add(leaf) if not leaf.grouping_slots: self.output_error("GroupingLeaf has no grouping slots", repr(leaf)) # Keep track of keys that are only duplicate references redundant_keys = set() def merge_groups(key1, key2): if groups[key1] is groups[key2]: return groups[key1].update(groups[key2]) groups[key2] = groups[key1] redundant_keys.add(key2) # Find all (slot, value) combinations that have more than one leaf # and merge those groups for (slot, value), leaves in groups.iteritems(): if len(leaves) <= 1: continue for leaf in list(leaves): for slot2 in leaf.grouping_slots: for value2 in leaf.all(slot2): if not value2: continue merge_groups((slot, value), (slot2, value2)) if self.should_sort_lexically(): sort_func = utils.locale_sort else: sort_func = lambda x: x keys = set(groups) keys.difference_update(redundant_keys) leaves = sort_func(self._make_group_leader(groups[K]) for K in keys) mergetime = time.time() - starttime if mergetime > 0.05: self.output_debug("Warning(?): merged in %s seconds" % mergetime) return itertools.chain(non_group_leaves, leaves)
def get_leaves(self, force_update=False): starttime = time.time() # map (slot, value) -> group groups = {} non_group_leaves = [] for src in self.sources: leaves = Source.get_leaves(src, force_update) for leaf in leaves: try: slots = leaf.slots() except AttributeError: # Let through Non-grouping leaves non_group_leaves.append(leaf) continue slots = leaf.slots() for slot in leaf.grouping_slots: value = slots.get(slot) if value: groups.setdefault((slot, value), set()).add(leaf) if not leaf.grouping_slots: self.output_error("GroupingLeaf has no grouping slots", repr(leaf)) # Keep track of keys that are only duplicate references redundant_keys = set() def merge_groups(key1, key2): if groups[key1] is groups[key2]: return groups[key1].update(groups[key2]) groups[key2] = groups[key1] redundant_keys.add(key2) # Find all (slot, value) combinations that have more than one leaf # and merge those groups for (slot, value), leaves in groups.items(): if len(leaves) <= 1: continue for leaf in list(leaves): for slot2 in leaf.grouping_slots: for value2 in leaf.all(slot2): if not value2: continue merge_groups((slot, value), (slot2, value2)) if self.should_sort_lexically(): sort_func = utils.locale_sort else: sort_func = lambda x: x keys = set(groups) keys.difference_update(redundant_keys) leaves = sort_func(self._make_group_leader(groups[K]) for K in keys) mergetime = time.time() - starttime if mergetime > 0.05: self.output_debug("Warning(?): merged in %s seconds" % mergetime) return itertools.chain(non_group_leaves, leaves)
def __init__(self): Source.__init__(self, _("Hamster Activities")) self.activities = get_hamster().GetActivities('')
def __init__(self): Source.__init__(self, _("Zim Notebooks"))
def __init__(self, query, search_results=None, **search_args): Source.__init__(self, name=_('Tracker Search for "%s"') % query) self.query = query self.search_args = search_args self.search_results = None
def __init__(self): Source.__init__(self, _("Signals"))
def __init__(self, leaf): Source.__init__(self, _("Emails")) self.ems = leaf.emails
def repr_key(self): # Distinguish when used as GroupingSource if type(self) is GroupingSource: return unicode(self) return Source.repr_key(self)
def __init__(self, query): Source.__init__(self, name=_('Results for "%s"') % query) self.query = query self.max_items = 50
def __init__(self, leaf): Source.__init__(self, str(leaf)) self._leaf = leaf
def repr_key(self): # Distinguish when used as GroupingSource if type(self) is GroupingSource: return str(self) return Source.repr_key(self)
def __init__(self): Source.__init__(self, _("Recursive Directories"))
def __init__(self): Source.__init__(self, _("Command Results"))
def __init__(self): Source.__init__(self, _("Internal Kupfer Objects"))
def __init__(self, leaf): Source.__init__(self, unicode(leaf)) self._leaf = leaf
def __init__(self): Source.__init__(self, _("Empathy Account Status"))
def __init__(self): Source.__init__(self, _("Workspaces")) screen = wnck.screen_get_default() screen.get_workspaces()
def __init__(self): Source.__init__(self, _("Tracker Tags"))
def __init__(self, name, sources): Source.__init__(self, name) self.sources = sources
def __init__(self): Source.__init__(self, _("Languages"))
def __init__(self): Source.__init__(self, _("Nemo"))
def __init__(self, trash_uri, name): Source.__init__(self, name) self._trash_uri = trash_uri
def __init__(self): Source.__init__(self, _("Kupfer Plugins"))
def __init__(self): Source.__init__(self, _("Trash"))
def __init__(self, query): Source.__init__(self, _('Results for "%s"') % query) self.query = query
def __init__(self, project): name = _("Timeline for %s") % project Source.__init__(self, name) self.project = project
def __init__(self): Source.__init__(self, _("MPRIS"))
def __init__(self, fil=None): """ All tags for file @fil or all tags known if None""" Source.__init__(self, _("Tracker tags")) self.for_file = fil
def __init__(self, name=_("Zim Pages")): Source.__init__(self, name) # path to file with list notebooks self._version = 2
def __init__(self): Source.__init__(self, _("Hamster"))
def __init__(self, tag): Source.__init__(self, _("Tag %s") % tag) self.tag = tag
def __init__(self): return Source.__init__(self, _("Standard Icon Names"))
def __init__(self, text, lang, language_name): Source.__init__(self, name=_("Translate into %s") % language_name) self._text = text self._lang = lang
def __init__(self, name=_("System Services")): Source.__init__(self, name) self._initd_path = None
def __init__(self, name=_("VirtualBox Machines")): Source.__init__(self, name)
def __init__(self): Source.__init__(self, _("Audacious"))
def __init__(self): Source.__init__(self, _("Search Engines"))
def __init__(self, library): Source.__init__(self, _("Playlist")) self.library = library
def __init__(self, name=_("OpenOffice/LibreOffice Recent Items")): Source.__init__(self, name)
def __init__(self): Source.__init__(self, _("Skype Statuses"))
def __init__(self, obj=None, fil=None): Source.__init__(self, _("Branch Source")) self.fil = fil or (lambda x: (y for y in x)) self.abs_path = obj.abs_path if obj else None
def __init__(self): Source.__init__(self, _("Clipboards")) self.clipboards = deque()
def __init__(self): Source.__init__(self, _("Keys")) self.resource = None
def __init__(self): Source.__init__(self, _("Running Applications")) self.all_apps = []
def __init__(self, name=_("Running Tasks")): Source.__init__(self, name) self._cache = [] self._version = 2
def __init__(self): Source.__init__(self, u"Evil Source")
def __init__(self, fileleaf, unarchive_func): Source.__init__(self, _("Content of %s") % fileleaf) self.path = fileleaf.object self.unarchiver = unarchive_func