[gnome-games/applygsoc2009: 32/76] FIX: Fix indentation issues
- From: Pablo Castellano <pablog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/applygsoc2009: 32/76] FIX: Fix indentation issues
- Date: Mon, 6 Sep 2010 02:49:54 +0000 (UTC)
commit 855e76aef956622d68c86d349bf8c2a0da64ffc3
Author: Pablo Castellano <pablog src gnome org>
Date: Thu Aug 26 14:16:52 2010 +0200
FIX: Fix indentation issues
gnome-sudoku/src/lib/gsudoku.py | 6 ++--
gnome-sudoku/src/lib/main.py | 63 +++++++++++++++++------------------
gnome-sudoku/src/lib/number_box.py | 2 +-
gnome-sudoku/src/lib/tracker_box.py | 13 ++++---
4 files changed, 42 insertions(+), 42 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index dba341b..391cc6c 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -163,8 +163,8 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
def _highlight_cells (self):
focused = self.get_focus()
- if not focused: # no need to do anything if no box has focus
- return
+ if not focused: # no need to do anything if no box has focus
+ return
if not self.do_highlight_cells:
return
self._unhighlight_cells() # first clear all the cells
@@ -572,7 +572,7 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
return retval
def auto_fill_current_entry (self):
- focused = self.get_focus()
+ focused = self.get_focus()
if not focused:
return
filled = self.grid.auto_fill_for_xy(focused.x, focused.y)
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 3a5f0b1..cf25f32 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -68,8 +68,8 @@ class UI (gconf_wrapper.GConfWrapper):
self._auto_open_game()
self.show()
- # generate puzzles while our use is working...
- self._run_background_generator()
+ # generate puzzles while our use is working...
+ self._run_background_generator()
def _auto_open_game(self):
game = self._auto_load_saved() or self._auto_load_new()
@@ -98,11 +98,10 @@ class UI (gconf_wrapper.GConfWrapper):
# TODO should use preconfigured level
level = self.gconf['game-level']
new_puzzle = self.sudoku_maker.get_puzzles(1, [level])
- if new_puzzle:
- # get_puzzles returns a list of (<puzzle>, <difficulty>)
- logger.info("%s game generated" % level)
- return (game_selector.NewOrSavedGameSelector.NEW_GAME,
- new_puzzle[0][0])
+ if new_puzzle:
+ # get_puzzles returns a list of (<puzzle>, <difficulty>)
+ logger.info("%s game generated" % level)
+ return (game_selector.NewOrSavedGameSelector.NEW_GAME, new_puzzle[0][0])
else:
logger.warning("failed to genereate new puzzle")
return None
@@ -115,7 +114,7 @@ class UI (gconf_wrapper.GConfWrapper):
saver.open_game(self, puzzle)
self._post_open_setup()
- def _post_open_setup(self):
+ def _post_open_setup(self):
"""Properly do the setup after entering game
Like show highlight, update hints, start timer, etc."""
@@ -134,15 +133,15 @@ class UI (gconf_wrapper.GConfWrapper):
gobject.timeout_add_seconds(1, lambda *args: self.start_worker_thread() and True)
def _select_game (self):
- """Run the game-selector
+ """Run the game-selector
Return (chosen-game-type, chosen-puzzle),
Return None if user cancels."""
- self.update_statusbar() # make the statusbar empty
+ self.update_statusbar() # make the statusbar empty
selector = game_selector.NewOrSavedGameSelector()
choice = selector.run_dialog()
selector.dialog.destroy()
- return choice
+ return choice
def show (self):
self.gsd.show()
@@ -199,10 +198,10 @@ class UI (gconf_wrapper.GConfWrapper):
# setup background colors
bgcol = self.gconf['bg_color']
if bgcol != '':
- self.gsd.set_bg_color(bgcol)
+ self.gsd.set_bg_color(bgcol)
def _setup_actions (self):
- toggle_actions = [
+ toggle_actions = [
("AlwaysShowPossible", self.auto_hint_cb),
("ShowImpossibleImplications", self.impossible_implication_cb),
("ToggleTracker", self.tracker_toggle_cb),
@@ -234,8 +233,8 @@ class UI (gconf_wrapper.GConfWrapper):
action.connect("activate", callback)
def setup_undo (self):
- #TODO
- return
+ #TODO
+ return
self.cleared = [] # used for Undo memory
self.cleared_notes = [] # used for Undo memory
# Set up our UNDO stuff
@@ -334,26 +333,26 @@ class UI (gconf_wrapper.GConfWrapper):
def new_cb (self, *args):
if self._close_current_game():
choice = self.select_game()
- if choice:
- self._open_game(choice[0], choice[1])
+ if choice:
+ self._open_game(choice[0], choice[1])
def _close_current_game (self):
"""Close current running game
Return True if game is closed, or else return False"""
- if (self.gsd.grid and self.gsd.grid.is_changed() and not self.won):
- try:
- if dialog_extras.getBoolean(
- label = _("Save current game?"),
- custom_yes = _("_Save"),
- custom_no = _("_Abandon"),
- ):
- self.save_game()
- else:
- self.sudoku_tracker.abandon_game(self)
- except dialog_extras.UserCancelledError:
- # User cancelled; current game is not closed
- return False
+ if (self.gsd.grid and self.gsd.grid.is_changed() and not self.won):
+ try:
+ if dialog_extras.getBoolean(
+ label = _("Save current game?"),
+ custom_yes = _("_Save"),
+ custom_no = _("_Abandon"),
+ ):
+ self.save_game()
+ else:
+ self.sudoku_tracker.abandon_game(self)
+ except dialog_extras.UserCancelledError:
+ # User cancelled; current game is not closed
+ return False
return True # also return True if game is not changed at all
def do_stop (self):
@@ -589,7 +588,7 @@ class UI (gconf_wrapper.GConfWrapper):
def start_game (debug=False):
if debug:
print 'Starting GNOME Sudoku in debug mode'
- logger.setLevel(logging.DEBUG)
+ logger.setLevel(logging.DEBUG)
else:
logger.setLevel(logging.INFO)
@@ -598,7 +597,7 @@ def start_game (debug=False):
gobject.threads_init()
u = UI()
- try:
+ try:
gtk.main()
except KeyboardInterrupt:
# properly quit on a keyboard interrupt...
diff --git a/gnome-sudoku/src/lib/number_box.py b/gnome-sudoku/src/lib/number_box.py
index 99e409f..f9ea537 100644
--- a/gnome-sudoku/src/lib/number_box.py
+++ b/gnome-sudoku/src/lib/number_box.py
@@ -302,7 +302,7 @@ class _NumberBox (gtk.Widget):
def _number_changed_cb (self, num_selector, new_number):
self.destroy_npicker()
- self._emit_number_changed_signal(new_number)
+ self._emit_number_changed_signal(new_number)
def show_number_picker (self):
w = gtk.Window(type = gtk.WINDOW_POPUP)
diff --git a/gnome-sudoku/src/lib/tracker_box.py b/gnome-sudoku/src/lib/tracker_box.py
index 83c7be0..5f3345a 100644
--- a/gnome-sudoku/src/lib/tracker_box.py
+++ b/gnome-sudoku/src/lib/tracker_box.py
@@ -13,7 +13,8 @@ ICON_FACTORY = gtk.IconFactory()
STOCK_PIXBUFS = {}
for filename, stock_id in [('footprints.png', 'tracks'), ]:
try:
- pb = gtk.gdk.pixbuf_new_from_file(os.path.join(IMAGE_DIR, filename))
+ pb = gtk.gdk.pixbuf_new_from_file(os.path.join(defaults.IMAGE_DIR,
+ filename))
except gobject.GError, e:
print 'Failed to load pixbuf: %s' % e
continue
@@ -154,7 +155,7 @@ class TrackerBox (gtk.VBox):
track_row = self.find_tracker(tracker_id)
if track_row:
self.tracker_tree.get_selection().select_iter(track_row.iter)
- self.tinfo.set_tracker(tracker_id)
+ self.tinfo.set_tracker(tracker_id)
def redraw_row(self, tracker_id):
track_row = self.find_tracker(tracker_id)
@@ -220,7 +221,7 @@ class TrackerBox (gtk.VBox):
)
applyer.perform()
- def do_apply_tracker(self):
+ def do_apply_tracker(self):
'''Apply the showing tracker to untracked
All of the values and notes will be transferred to untracked and
@@ -234,14 +235,14 @@ class TrackerBox (gtk.VBox):
# Apply the values
for x, y, val, tid in cleared_values:
self.main_ui.gsd.set_value(x, y, val)
- # Then apply the notes
+ # Then apply the notes
self.main_ui.gsd.apply_notelist(cleared_notes, True)
# Store the undo counts
self.main_ui.cleared.append(len(cleared_values))
self.main_ui.cleared_notes.append(len(cleared_notes))
def undo_apply_tracker(self):
- '''Undo a previous tracker apply
+ '''Undo a previous tracker apply
The number of cleared values and notes are stored during the apply.
The undo is called for each of them, then the tracker delete is
@@ -250,7 +251,7 @@ class TrackerBox (gtk.VBox):
# Undo all of the applied values and notes
value_count = self.main_ui.cleared.pop()
note_count = self.main_ui.cleared_notes.pop()
- count = 0
+ count = 0
while count < (value_count + note_count):
self.main_ui.history.undo()
count += 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]