[gnome-games] Always Sudoku generate puzzles in the background, they don't cost any significant CPU and there is n



commit dd7c7650faf02dbecd20b5a39ae8d95aaeeec71a
Author: Robert Ancell <robert ancell gmail com>
Date:   Tue Apr 20 19:40:03 2010 +1000

    Always Sudoku generate puzzles in the background, they don't cost any significant CPU and there is no need to prompt the user

 gnome-sudoku/data/Makefile.am                |    1 -
 gnome-sudoku/data/gnome-sudoku.schemas.in    |   12 -
 gnome-sudoku/data/puzzle_generator.ui        |  553 --------------------------
 gnome-sudoku/src/lib/Makefile.am             |    1 -
 gnome-sudoku/src/lib/main.py                 |   30 +--
 gnome-sudoku/src/lib/sudoku_generator_gui.py |  230 -----------
 6 files changed, 3 insertions(+), 824 deletions(-)
---
diff --git a/gnome-sudoku/data/Makefile.am b/gnome-sudoku/data/Makefile.am
index bed1ac0..5049082 100644
--- a/gnome-sudoku/data/Makefile.am
+++ b/gnome-sudoku/data/Makefile.am
@@ -8,7 +8,6 @@ puzzle_DATA = \
 uidir = $(datadir)/gnome-sudoku
 ui_DATA = \
 	print_games.ui \
-	puzzle_generator.ui \
 	select_game.ui \
 	tracker.ui
 
diff --git a/gnome-sudoku/data/gnome-sudoku.schemas.in b/gnome-sudoku/data/gnome-sudoku.schemas.in
index 221f696..aecabda 100644
--- a/gnome-sudoku/data/gnome-sudoku.schemas.in
+++ b/gnome-sudoku/data/gnome-sudoku.schemas.in
@@ -158,18 +158,6 @@
     </schema>
 
     <schema>
-      <key>/schemas/apps/gnome-sudoku/generate_puzzles_in_background</key>
-      <applyto>/apps/gnome-sudoku/generate_puzzles_in_background</applyto>
-      <owner>gnome-sudoku</owner>
-      <type>bool</type>
-      <default>TRUE</default>
-      <locale name="C">
-        <short>Generate new puzzles in the background</short>
-        <long>Generate new puzzles in the background</long>
-      </locale>
-    </schema>
-
-    <schema>
       <key>/schemas/apps/gnome-sudoku/minimum_number_of_new_puzzles</key>
       <applyto>/apps/gnome-sudoku/minimum_number_of_new_puzzles</applyto>
       <owner>gnome-sudoku</owner>
diff --git a/gnome-sudoku/src/lib/Makefile.am b/gnome-sudoku/src/lib/Makefile.am
index 093fb22..061a1b9 100644
--- a/gnome-sudoku/src/lib/Makefile.am
+++ b/gnome-sudoku/src/lib/Makefile.am
@@ -21,7 +21,6 @@ gnomesudoku_PYTHON = \
 	printing.py	\
 	saver.py	\
 	simple_debug.py	\
-	sudoku_generator_gui.py	\
 	sudoku_maker.py	\
 	sudoku_thumber.py \
 	sudoku.py	\
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index e5327ee..b337901 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -18,7 +18,6 @@ import game_selector
 import gsudoku
 import printing
 import saver
-import sudoku_generator_gui
 import sudoku_maker
 import timer
 from defaults import (APPNAME, APPNAME_SHORT, AUTHORS, COPYRIGHT, DESCRIPTION, DOMAIN, 
@@ -114,9 +113,6 @@ class UI (gconf_wrapper.GConfWrapper):
         <menuitem action="AlwaysShowPossible"/>
         <menuitem action="ShowImpossibleImplications"/>
         <separator/>
-        <menuitem action="Generator"/>
-        <menuitem action="BackgroundGenerator"/>
-        <separator/>
         <menuitem action="Tracker"/>
         </menu>
       <menu action="Help">
@@ -182,10 +178,9 @@ class UI (gconf_wrapper.GConfWrapper):
                 self.quit = True
             else:
                 self.quit = False
-                # Generate puzzles in background...
-                if self.gconf['generate_puzzles_in_background']:
-                    gobject.timeout_add_seconds(1, lambda *args: self.start_worker_thread() and True)
 
+        # Generate puzzles in background...
+        gobject.timeout_add_seconds(1, lambda *args: self.start_worker_thread() and True)
 
     @inactivate_new_game_etc
     def select_game (self):
@@ -260,8 +255,6 @@ class UI (gconf_wrapper.GConfWrapper):
              self.auto_fill_cb),
             ('FullScreen', gtk.STOCK_FULLSCREEN, None,
              'F11', None, self.full_screen_cb),
-            ('Generator', None, _('_Generate new puzzles'), None, _('Generate new puzzles.'),
-              self.generate_puzzle_gui, ),
             ('PuzzleInfo', gtk.STOCK_ABOUT, _('Puzzle _Statistics'),
              None, _('Show statistics about current puzzle'),
              self.show_info_cb),
@@ -291,11 +284,7 @@ class UI (gconf_wrapper.GConfWrapper):
              self.tracker_toggle_cb, False),
             ('ToggleToolbar', None, _('Show _Toolbar'), None, None, self.toggle_toolbar_cb, True),
             ('ToggleHighlight', gtk.STOCK_SELECT_COLOR, _('_Highlighter'),
-             None, _('Highlight the current row, column and box'), self.toggle_highlight_cb, False),
-            ('BackgroundGenerator', None, _('Generate new puzzles _while you play'),
-             None,
-             _('Generate new puzzles in the background while you play. This will automatically pause when the game goes into the background.'),
-             self.toggle_generator_cb, True),
+             None, _('Highlight the current row, column and box'), self.toggle_highlight_cb, False)
             ])
 
         self.edit_actions = gtk.ActionGroup('EditActions')
@@ -367,8 +356,6 @@ class UI (gconf_wrapper.GConfWrapper):
               self.main_actions.get_action('AlwaysShowPossible')),
              ('show_impossible_implications',
               self.main_actions.get_action('ShowImpossibleImplications')),
-             ('generate_puzzles_in_background',
-              self.main_actions.get_action('BackgroundGenerator')),
              ('show_toolbar',
               self.main_actions.get_action('ToggleToolbar')),
              ('highlight',
@@ -673,13 +660,6 @@ class UI (gconf_wrapper.GConfWrapper):
                                    sublabel = information)
 
     @simple_debug
-    def toggle_generator_cb (self, toggle):
-        if toggle.get_active():
-            self.start_worker_thread()
-        else:
-            self.stop_worker_thread()
-
-    @simple_debug
     def autosave (self):
         # this is called on a regular loop and will autosave if we
         # have reason to...
@@ -722,10 +702,6 @@ class UI (gconf_wrapper.GConfWrapper):
         gp = printing.GamePrinter(self.sudoku_maker, self.gconf)
         gp.run_dialog()
 
-    @simple_debug
-    def generate_puzzle_gui (self, *args):
-        sudoku_generator_gui.GameGenerator(self, self.gconf)
-
 class TrackerBox (gtk.VBox):
 
     @simple_debug



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