[gnome-games/applygsoc2009: 28/76] Rename method/variable/signal



commit 03daaeb03f4a807e55a7862bc091b114f6f26c7a
Author: Pablo Castellano <pablog src gnome org>
Date:   Thu Aug 26 12:50:41 2010 +0200

    Rename method/variable/signal

 gnome-sudoku/src/lib/main.py       |   43 +++++++++++++++++++++--------------
 gnome-sudoku/src/lib/number_box.py |   26 +++++++++++-----------
 2 files changed, 39 insertions(+), 30 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 10f6e14..8c0d41f 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -164,6 +164,13 @@ class UI (gconf_wrapper.GConfWrapper):
         self.setup_tracker_interface()
         self.setup_toggles()
 
+    def initialize_prefs (self):
+        for k, v in self.initial_prefs.items():
+            try:
+                self.gconf[k]
+            except:
+                self.gconf[k] = v
+
     def setup_main_window (self):
         gtk.window_set_default_icon_name('gnome-sudoku')
         self.builder = gtk.Builder()
@@ -174,6 +181,25 @@ class UI (gconf_wrapper.GConfWrapper):
         self.w.connect('configure-event', self.resize_cb)
         self.w.connect('delete-event', self.quit_cb)
         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
+        bgcol = self.gconf['bg_color']
+        if bgcol != '':
+        self.gsd.set_bg_color(bgcol)
 
     def _setup_actions (self):
 	    toggle_actions = [
@@ -227,20 +253,10 @@ class UI (gconf_wrapper.GConfWrapper):
                                        pre_change_signal = 'notes-about-to-change',
                                        )
 
-    def setup_color (self):
-        # setup background colors
-        bgcol = self.gconf['bg_color']
-        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)
 
-    def setup_main_boxes (self):
-        self.main_area = self.builder.get_object("main_area")
-        self.main_area.pack_start(self.gsd, padding = 6)
-
     def setup_toggles (self):
         # sync up toggles with gconf values...
         map(lambda tpl: self.gconf_wrap_toggle(*tpl),
@@ -313,13 +329,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
-
     def new_cb (self, *args):
         if self._close_current_game():
             choice = self.select_game()
diff --git a/gnome-sudoku/src/lib/number_box.py b/gnome-sudoku/src/lib/number_box.py
index 3d92978..4dfb484 100644
--- a/gnome-sudoku/src/lib/number_box.py
+++ b/gnome-sudoku/src/lib/number_box.py
@@ -24,7 +24,7 @@ NORMAL_LINE_WIDTH = 1 # The size of the line we draw around a box
 class NumberSelector (gtk.EventBox):
 
     __gsignals__ = {
-        'changed':(gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
+        'number-selected':(gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
         }
 
     def __init__ (self, default = None, upper = 9):
@@ -48,22 +48,22 @@ class NumberSelector (gtk.EventBox):
                 b.set_border_width(0)
                 l.set_padding(0, 0)
                 l.get_alignment()
-                b.connect('clicked', self.number_clicked, n)
+                b.connect('clicked', self._number_clicked, n)
                 self.table.attach(b, x, x+1, y, y+1)
                 n += 1
         if self.value:
-            db = gtk.Button()
-            l = gtk.Label()
-            l.set_markup_with_mnemonic('<span size="x-small">'+_('_Clear')+'</span>')
-            db.add(l)
-            l.show()
-            db.connect('clicked', self.number_clicked, 0)
-            self.table.attach(db, 0, side, side + 1, side + 2)
+            clear_button = gtk.Button()
+            label = gtk.Label()
+            label.set_markup_with_mnemonic('<span size="x-small">'+_('_Clear')+'</span>')
+            clear_button.add(label)
+            label.show()
+            clear_button.connect('clicked', self._number_clicked, 0)
+            self.table.attach(clear_button, 0, side, side + 1, side + 2)
         self.show_all()
 
-    def number_clicked (self, button, n):
+    def _number_clicked (self, button, n):
         self.value = n
-        self.emit('changed')
+        self.emit('number-selected')
 
     def get_value (self):
         return self.value
@@ -316,7 +316,7 @@ class NumberBox (gtk.Widget):
     def show_number_picker (self):
         w = gtk.Window(type = gtk.WINDOW_POPUP)
         ns = NumberSelector(upper = self.upper, default = self.get_value())
-        ns.connect('changed', self.number_changed_cb)
+        ns.connect('number-selected', self.number_changed_cb)
         w.grab_focus()
         w.add(ns)
         r = w.get_allocation()
@@ -810,7 +810,7 @@ if __name__ == '__main__':
         nselector = NumberSelector(default = 3)
         def tell_me (b):
             print 'value->', b.get_value()
-        nselector.connect('changed', tell_me)
+        nselector.connect('number-selected', tell_me)
         window.add(nselector)
 
     def test_number_box ():



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