[gnome-games/sudoku-tube] Rearrange the sequence of methods



commit f7d1cd6577cef66d31acc6d5ab38e5e909efafdc
Author: Zhang Sen <zh jesse gmail com>
Date:   Sat Jul 4 10:46:11 2009 +0800

    Rearrange the sequence of methods

 gnome-sudoku/src/lib/main.py |   63 ++++++++++++++++++++---------------------
 1 files changed, 31 insertions(+), 32 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 2fda8c8..68a989d 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -162,6 +162,14 @@ class UI (gconf_wrapper.GConfWrapper):
 #        self.w.add_accel_group(self.uimanager.get_accel_group())
         self.setup_toggles()
 
+    def initialize_prefs (self):
+        for k, v in self.initial_prefs.items():
+            try:
+                self.gconf[k]
+            except:
+                self.gconf[k] = v
+        self.player = self.gconf['player']
+
     def setup_main_window (self):
         gtk.window_set_default_icon_name('gnome-sudoku')
         self.builder = gtk.Builder()
@@ -174,6 +182,29 @@ class UI (gconf_wrapper.GConfWrapper):
         self.statusbar = self.builder.get_object("statusbar")
         self.toolbar = self.builder.get_object("toolbar")
 
+    def _setup_main_boxes(self):
+        main_area = self.builder.get_object("main_area")
+
+        self.gsd = gsudoku.SudokuGameDisplay()
+        self.gsd.connect('puzzle-finished', self.you_win_callback)
+        main_area.pack_start(self.gsd, padding = 6)
+
+        self.tracker_ui = tracker_box.TrackerBox(self)
+        self.tracker_ui.show_all()
+        self.tracker_ui.hide()
+        main_area.pack_start(self.tracker_ui, expand=False)
+
+    def setup_color (self):
+        # setup background colors
+        if self.gconf['bg_custom_color']:
+            bgcol = self.gconf['bg_custom_color']
+        elif self.gconf['bg_black']:
+            bgcol = 'black'
+        else:
+            bgcol = None
+        if bgcol:
+            self.gsd.set_bg_color(bgcol)
+
     def setup_actions (self):
         toggle_actions = [
                 ("AlwaysShowPossible", self.auto_hint_cb),
@@ -223,17 +254,6 @@ class UI (gconf_wrapper.GConfWrapper):
                                        pre_change_signal = 'value-about-to-change',
                                        )
 
-    def setup_color (self):
-        # setup background colors
-        if self.gconf['bg_custom_color']:
-            bgcol = self.gconf['bg_custom_color']
-        elif self.gconf['bg_black']:
-            bgcol = 'black'
-        else:
-            bgcol = None
-        if bgcol:
-            self.gsd.set_bg_color(bgcol)
-
     def setup_autosave (self):
         gobject.timeout_add_seconds(self.gconf['auto_save_interval'] or 60, # in seconds...
                             self.autosave)
@@ -306,14 +326,6 @@ class UI (gconf_wrapper.GConfWrapper):
                                    sublabel = sublabel
                                    )
 
-    def initialize_prefs (self):
-        for k, v in self.initial_prefs.items():
-            try:
-                self.gconf[k]
-            except:
-                self.gconf[k] = v
-        self.player = self.gconf['player']
-
     def _get_server(self, bus):
         return bus.get_object(object_path="/Game")
 
@@ -479,18 +491,6 @@ class UI (gconf_wrapper.GConfWrapper):
     def auto_fill_current_square_cb (self, *args):
         self.gsd.auto_fill_current_entry()
 
-    def _setup_main_boxes(self):
-        main_area = self.builder.get_object("main_area")
-
-        self.gsd = gsudoku.SudokuGameDisplay()
-        self.gsd.connect('puzzle-finished', self.you_win_callback)
-        main_area.pack_start(self.gsd, padding = 6)
-
-        self.tracker_ui = tracker_box.TrackerBox(self)
-        self.tracker_ui.show_all()
-        self.tracker_ui.hide()
-        main_area.pack_start(self.tracker_ui, expand=False)
-
     def tracker_toggle_cb (self, widg):
         if widg.get_active():
             self.tracker_ui.show_all()
@@ -509,7 +509,6 @@ class UI (gconf_wrapper.GConfWrapper):
         self.statusbar.pop(self.sbid)
         self.statusbar.push(self.sbid, status)
 
-
     def update_statusbar (self, *args):
         if not self.gsd.grid:
             self.set_statusbar_value(" ")



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