Esempio n. 1
0
 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"))
Esempio n. 3
0
	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)
Esempio n. 4
0
    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)
Esempio n. 5
0
 def __init__(self):
     Source.__init__(self, _("Hamster Activities"))
     self.activities = get_hamster().GetActivities('')
Esempio n. 6
0
 def __init__(self):
     Source.__init__(self, _("Zim Notebooks"))
Esempio n. 7
0
 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
Esempio n. 8
0
 def __init__(self):
     Source.__init__(self, _("Signals"))
Esempio n. 9
0
 def __init__(self, leaf):
     Source.__init__(self, _("Emails"))
     self.ems = leaf.emails
Esempio n. 10
0
	def repr_key(self):
		# Distinguish when used as GroupingSource
		if type(self) is GroupingSource:
			return unicode(self)
		return Source.repr_key(self)
Esempio n. 11
0
	def __init__(self, query):
		Source.__init__(self, name=_('Results for "%s"') % query)
		self.query = query
		self.max_items = 50
Esempio n. 12
0
 def __init__(self, leaf):
     Source.__init__(self, str(leaf))
     self._leaf = leaf
Esempio n. 13
0
 def repr_key(self):
     # Distinguish when used as GroupingSource
     if type(self) is GroupingSource:
         return str(self)
     return Source.repr_key(self)
Esempio n. 14
0
 def __init__(self):
     Source.__init__(self, _("Recursive Directories"))
Esempio n. 15
0
 def __init__(self):
     Source.__init__(self, _("Command Results"))
Esempio n. 16
0
 def __init__(self):
     Source.__init__(self, _("Internal Kupfer Objects"))
Esempio n. 17
0
	def __init__(self, leaf):
		Source.__init__(self, unicode(leaf))
		self._leaf = leaf
 def __init__(self):
     Source.__init__(self, _("Empathy Account Status"))
Esempio n. 19
0
 def __init__(self):
     Source.__init__(self, _("Workspaces"))
     screen = wnck.screen_get_default()
     screen.get_workspaces()
Esempio n. 20
0
	def __init__(self):
		Source.__init__(self, _("Tracker Tags"))
Esempio n. 21
0
 def __init__(self, name, sources):
     Source.__init__(self, name)
     self.sources = sources
Esempio n. 22
0
	def __init__(self):
		Source.__init__(self, _("Languages"))
Esempio n. 23
0
 def __init__(self):
     Source.__init__(self, _("Nemo"))
Esempio n. 24
0
	def __init__(self, name, sources):
		Source.__init__(self, name)
		self.sources = sources
Esempio n. 25
0
	def __init__(self, trash_uri, name):
		Source.__init__(self, name)
		self._trash_uri = trash_uri
Esempio n. 26
0
	def __init__(self):
		Source.__init__(self, _("Kupfer Plugins"))
Esempio n. 27
0
	def __init__(self):
		Source.__init__(self, _("Trash"))
Esempio n. 28
0
 def __init__(self, query):
     Source.__init__(self, _('Results for "%s"') % query)
     self.query = query
Esempio n. 29
0
 def __init__(self, project):
     name = _("Timeline for %s") % project
     Source.__init__(self, name)
     self.project = project
Esempio n. 30
0
	def __init__(self):
		Source.__init__(self, _("MPRIS"))
Esempio n. 31
0
 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
Esempio n. 32
0
 def __init__(self, name=_("Zim Pages")):
     Source.__init__(self, name)
     # path to file with list notebooks
     self._version = 2
Esempio n. 33
0
 def __init__(self):
     Source.__init__(self, _("Tracker Tags"))
Esempio n. 34
0
 def __init__(self):
     Source.__init__(self, _("Hamster"))
Esempio n. 35
0
 def __init__(self, tag):
     Source.__init__(self, _("Tag %s") % tag)
     self.tag = tag
Esempio n. 36
0
	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
Esempio n. 37
0
 def __init__(self, query):
     Source.__init__(self, name=_('Results for "%s"') % query)
     self.query = query
     self.max_items = 50
Esempio n. 38
0
	def __init__(self, tag):
		Source.__init__(self, _("Tag %s") % tag)
		self.tag = tag
Esempio n. 39
0
	def __init__(self):
		return Source.__init__(self, _("Standard Icon Names"))
Esempio n. 40
0
	def __init__(self, text, lang, language_name):
		Source.__init__(self, name=_("Translate into %s") % language_name)
		self._text = text
		self._lang = lang
Esempio n. 41
0
 def __init__(self, name=_("System Services")):
     Source.__init__(self, name)
     self._initd_path = None
Esempio n. 42
0
	def __init__(self, name=_("VirtualBox Machines")):
		Source.__init__(self, name)
Esempio n. 43
0
	def __init__(self):
		Source.__init__(self, _("Audacious"))
Esempio n. 44
0
	def __init__(self, leaf):
		Source.__init__(self, unicode(leaf))
		self._leaf = leaf
Esempio n. 45
0
 def __init__(self):
     Source.__init__(self, _("Search Engines"))
Esempio n. 46
0
	def __init__(self):
		Source.__init__(self, _("Zim Notebooks"))
Esempio n. 47
0
 def __init__(self):
     Source.__init__(self, _("Workspaces"))
     screen = wnck.screen_get_default()
     screen.get_workspaces()
Esempio n. 48
0
	def __init__(self, library):
		Source.__init__(self, _("Playlist"))
		self.library = library
Esempio n. 49
0
	def __init__(self, name=_("Zim Pages")):
		Source.__init__(self, name)
		# path to file with list notebooks
		self._version = 2
Esempio n. 50
0
	def __init__(self, name=_("OpenOffice/LibreOffice Recent Items")):
		Source.__init__(self, name)
Esempio n. 51
0
	def __init__(self):
		Source.__init__(self, _("Skype Statuses"))
Esempio n. 52
0
 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
Esempio n. 53
0
 def __init__(self):
     Source.__init__(self, _("Clipboards"))
     self.clipboards = deque()
Esempio n. 54
0
 def __init__(self):
     Source.__init__(self, _("Keys"))
     self.resource = None
Esempio n. 55
0
 def __init__(self):
     Source.__init__(self, _("Running Applications"))
     self.all_apps = []
Esempio n. 56
0
 def __init__(self, name=_("Running Tasks")):
     Source.__init__(self, name)
     self._cache = []
     self._version = 2
Esempio n. 57
0
	def __init__(self):
		Source.__init__(self, u"Evil Source")
Esempio n. 58
0
 def __init__(self, fileleaf, unarchive_func):
     Source.__init__(self, _("Content of %s") % fileleaf)
     self.path = fileleaf.object
     self.unarchiver = unarchive_func
Esempio n. 59
0
	def __init__(self):
		Source.__init__(self, _("Search Engines"))