[kupfer: 54/67] Make 'display' a new startup phase



commit 505dce6885d462839f839ea63f4c96b45e6432c1
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Mar 19 01:53:39 2011 +0100

    Make 'display' a new startup phase
    
    Separate 'load' and 'display' to let all plugins load in the 'load'
    phase and information from plugins can be used in the 'loaded' signal,
    and set up before 'display' runs.

 kupfer/core/data.py  |    6 +++++-
 kupfer/scheduler.py  |    5 +++++
 kupfer/ui/browser.py |    1 +
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/core/data.py b/kupfer/core/data.py
index 9ece885..f9f3bf9 100644
--- a/kupfer/core/data.py
+++ b/kupfer/core/data.py
@@ -448,6 +448,7 @@ class DataController (gobject.GObject, pretty.OutputMixin):
 
 		sch = scheduler.GetScheduler()
 		sch.connect("load", self._load)
+		sch.connect("display", self._display)
 		sch.connect("finish", self._finish)
 
 	def register_text_sources(self, plugin_id, srcs):
@@ -509,8 +510,11 @@ class DataController (gobject.GObject, pretty.OutputMixin):
 		sc.add(None, D_s, toplevel=True)
 		sc.add(None, d_s, toplevel=False)
 		sc.initialize()
-		self._reload_source_root()
 		learn.load()
+
+	def _display(self, sched):
+		sc = GetSourceController()
+		self._reload_source_root()
 		self._save_data_timer.set(DATA_SAVE_INTERVAL_S, self._save_data)
 
 	def _get_directory_sources(self):
diff --git a/kupfer/scheduler.py b/kupfer/scheduler.py
index eaf821f..fab93f6 100644
--- a/kupfer/scheduler.py
+++ b/kupfer/scheduler.py
@@ -22,12 +22,17 @@ class Scheduler (gobject.GObject, pretty.OutputMixin):
 		self.emit("load")
 		self.emit("loaded")
 		self.output_debug("Loaded")
+	def display(self):
+		self.output_debug("Display")
+		self.emit("display")
 	def finish(self):
 		self.emit("finish")
 gobject.signal_new("load", Scheduler, gobject.SIGNAL_RUN_LAST,
 		gobject.TYPE_BOOLEAN, ())
 gobject.signal_new("loaded", Scheduler, gobject.SIGNAL_RUN_LAST,
 		gobject.TYPE_BOOLEAN, ())
+gobject.signal_new("display", Scheduler, gobject.SIGNAL_RUN_LAST,
+		gobject.TYPE_BOOLEAN, ())
 gobject.signal_new("finish", Scheduler, gobject.SIGNAL_RUN_LAST,
 		gobject.TYPE_BOOLEAN, ())
 
diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index e6df81c..7aea9ac 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -2004,6 +2004,7 @@ class WindowController (pretty.OutputMixin):
 		# Load data and present UI
 		sch = scheduler.GetScheduler()
 		sch.load()
+		sch.display()
 
 		if not quiet:
 			self.activate()



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