[kupfer] core, and more: Print less debug output at launch



commit 48d5ccc822f0bf718b051333021f500785900b2b
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Mar 29 07:58:56 2010 +0200

    core, and more: Print less debug output at launch

 kupfer/core/data.py       |   18 +++++++++++++-----
 kupfer/core/plugins.py    |    2 --
 kupfer/core/sources.py    |    2 +-
 kupfer/plugin/triggers.py |    2 +-
 4 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/kupfer/core/data.py b/kupfer/core/data.py
index ef04c59..93b3bf7 100644
--- a/kupfer/core/data.py
+++ b/kupfer/core/data.py
@@ -447,13 +447,14 @@ class DataController (gobject.GObject, pretty.OutputMixin):
 		for action in actions:
 			for appl_type in action.item_types():
 				decorate_types.setdefault(appl_type, []).append(action)
+		if not decorate_types:
+			return
 		sc = GetSourceController()
 		sc.add_action_decorators(decorate_types)
-		self.output_debug("Action decorators:")
+		self.output_debug("Actions:")
 		for typ in decorate_types:
 			self.output_debug(typ.__name__)
-			for dec in decorate_types[typ]:
-				self.output_debug(type(dec).__module__, type(dec).__name__,sep=".")
+			self._list_plugin_objects(decorate_types[typ])
 
 	def register_content_decorators(self, contents):
 		"""
@@ -471,13 +472,20 @@ class DataController (gobject.GObject, pretty.OutputMixin):
 			except AttributeError:
 				continue
 			decorate_item_types.setdefault(applies, set()).add(c)
+		if not decorate_item_types:
+			return
 		sc = GetSourceController()
 		sc.add_content_decorators(decorate_item_types)
 		self.output_debug("Content decorators:")
 		for typ in decorate_item_types:
 			self.output_debug(typ.__name__)
-			for dec in decorate_item_types[typ]:
-				self.output_debug(dec.__module__, dec.__name__, sep=".")
+			self._list_plugin_objects(decorate_item_types[typ])
+
+	def _list_plugin_objects(self, objs):
+		"Print a list of plugin objects to debug output"
+		for o in objs:
+			typ = type(o) if hasattr(o, "__class__") else o
+			self.output_debug(" ", typ.__module__, ".", typ.__name__, sep="")
 
 	def _load(self, sched):
 		"""Load data from persistent store"""
diff --git a/kupfer/core/plugins.py b/kupfer/core/plugins.py
index 25be53a..129767b 100644
--- a/kupfer/core/plugins.py
+++ b/kupfer/core/plugins.py
@@ -310,8 +310,6 @@ def load_plugin_sources(plugin_name, attr=sources_attribute, instantiate=True):
 		return
 	for source in get_plugin_attributes(plugin_name, sources, warn=True):
 		if source:
-			pretty.print_debug(__name__, "Found %s.%s" % ( source.__module__,
-				source.__name__))
 			if instantiate:
 				yield source()
 			else:
diff --git a/kupfer/core/sources.py b/kupfer/core/sources.py
index ff7563e..e2c8295 100644
--- a/kupfer/core/sources.py
+++ b/kupfer/core/sources.py
@@ -213,7 +213,7 @@ class SourceDataPickler (pretty.OutputMixin):
 			data = conspickle.BasicUnpickler.loads(pfile.read())
 			sname = os.path.basename(pickle_file)
 			self.output_debug("Loaded configuration from", sname)
-			self.output_debug(data)
+			# self.output_debug(data)
 		except (pickle.PickleError, Exception), e:
 			data = None
 			self.output_error("Loading %s: %s" % (pickle_file, e))
diff --git a/kupfer/plugin/triggers.py b/kupfer/plugin/triggers.py
index 29165ff..d015d6e 100644
--- a/kupfer/plugin/triggers.py
+++ b/kupfer/plugin/triggers.py
@@ -54,7 +54,7 @@ class Triggers (Source):
 		keybindings.GetKeyboundObject().connect("keybinding", self._callback)
 		for target, (keystr, name, id_) in self.trigger_table.iteritems():
 			keybindings.bind_key(keystr, target)
-		self.output_debug(self.trigger_table)
+		self.output_debug("Loaded triggers, count:", len(self.trigger_table))
 
 	def _callback(self, keyobj, target, event_time):
 		self.perform_trigger(target)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]