[gnome-games/sudoku-tube] Refactor trackerbox a little
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Refactor trackerbox a little
- Date: Wed, 22 Jul 2009 03:22:06 +0000 (UTC)
commit 3f9bd50d2bb365593bcfa2956cb011f042cdb002
Author: Zhang Sen <zh jesse gmail com>
Date: Wed Jul 22 09:57:06 2009 +0800
Refactor trackerbox a little
gnome-sudoku/src/lib/main.py | 10 +++++-----
gnome-sudoku/src/lib/tracker_box.py | 14 ++++++++++++--
2 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 1c44835..a25788f 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -232,9 +232,9 @@ class UI (gconf_wrapper.GConfWrapper):
self._main_grid_vew.connect('puzzle-finished', self.you_win_callback)
main_grid_container.pack_start(self._main_grid_vew, padding=6)
- self.tracker_ui = tracker_box.TrackerBox(self._main_grid_vew)
- self.tracker_ui.hide()
- tracker_ui_container.pack_start(self.tracker_ui)
+ self._tracker = tracker_box._ViewController(self._main_grid_vew)
+ self._tracker.hide()
+ tracker_ui_container.pack_start(self._tracker.get_view())
self._setup_side_view()
side_grid_container.add(self._side_grid_vew)
@@ -515,9 +515,9 @@ class UI (gconf_wrapper.GConfWrapper):
def tracker_toggle_cb (self, widg):
if widg.get_active():
- self.tracker_ui.show_all()
+ self._tracker.show()
else:
- self.tracker_ui.hide()
+ self._tracker.hide()
def toggle_toolbar_cb (self, widg):
if widg.get_active():
diff --git a/gnome-sudoku/src/lib/tracker_box.py b/gnome-sudoku/src/lib/tracker_box.py
index 749b5d9..6565a94 100644
--- a/gnome-sudoku/src/lib/tracker_box.py
+++ b/gnome-sudoku/src/lib/tracker_box.py
@@ -46,11 +46,11 @@ def _pixbuf_transform_color(pixbuf, color):
class TrackerBox (gtk.VBox):
- def __init__ (self, main_ui):
+ def __init__(self, controller):
gtk.VBox.__init__(self)
self.builder = gtk.Builder()
self.builder.add_from_file(os.path.join(defaults.UI_DIR, 'tracker.ui'))
- self._view_controller = _ViewController(main_ui)
+ self._view_controller = controller
vbox = self.builder.get_object('vbox1')
vbox.unparent()
self.pack_start(vbox, expand = True, fill = True)
@@ -175,6 +175,7 @@ class _ViewController:
self._sudoku_view = sudoku_view
self._trackers = {}
self.__trackers_tracking__ = {}
+ self._tracker_box_view = TrackerBox(self)
sudoku_view.connect("view-updated", self._view_updated_cb)
@@ -234,3 +235,12 @@ class _ViewController:
for tracker_id in self._trackers:
if not identifier == tracker_id:
self.delete_by_tracker(tracker_id)
+
+ def get_view(self):
+ return self._tracker_box_view
+
+ def hide(self):
+ self._tracker_box_view.hide()
+
+ def show(self):
+ self._tracker_box_view.show_all()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]