☆LucidのGnome-Sudokuにパッチをあてる

Lucid(Ubuntu 10.04)のGnome数独(Gnome-sudoku 2.30)はKarmicで悪化した経過時間の表示が修正されています。
Karmicの時はセルの上側にメモ用の数字を入力すると経過時間がやたら増えたのですが、これも直っているようです。
(完全ではないようで、多少修正されています。)
しかし、残念ながら特定の場合にコンフリクトした値が赤くならないバグと終了判定が正しくないバグが残っています。
(すでにGnomeの新しいリビジョンでは修正されているので次のリリースでは修正されているはずです。)
これを修正するパッチを用意しました。

gnome-sudoku.2.30.0-0ubuntu6.patchをダウンロードして下記の要領でパッチしてください。
ファイルは ~/Download ディレクトリにダウンロードした前提で記述しています。

$ cd /usr/lib/python2.6/dist-packages/gnome_sudoku
$ sudo patch -p1 < ~/Download/gnome-sudoku.2.30.0-0ubuntu6.patch

注意点はgnome-games-commonとgnome-sudokuパッケージの両方にダブってsduoku.py,timer.pyが含まれていることです。
実際に使われているのはgnome-games-commonの方のsduoku.py,timer.pyですのでパッチを当てるファイルを間違わないように気をつけてください。

suoku.pyに対するパッチの内容はGnomeで実際に適用されたものではなく、私が書いたものです。
gitの使い方を多少学んだのですが、2.30からいくつかコミットが行われていてどれが該当するのかわからなかったのでorz.
(Gnomeで実際に適用されたパッチの方が良かった気がするのですが)
timer.pyの方の修正はGnomeで行われた修正を取り込みました。
こちらは変更が少ないのでgitで変更したコミットが簡単に特定でしました。

gnome-games$ find ./ -name 'timer.py'
../gnome-sudoku/src/lib/timer.py
gnome-games$ git blame -L '/^        if currently_timing:/,+1' -- ./gnome-sudoku/src/lib/timer.py
f235e03e (Jim Ross 2010-03-31 03:53:55 -0400 142)         if currently_timing:
gnome-games$ git log f235e03e^..f235e03e
commit f235e03e98e960a69627f5b4afacb9f14d599bad
Author: Jim Ross <jimbo@dimensia.com>
Date:   Wed Mar 31 03:53:55 2010 -0400

    sudoku: Fixed mark timing
    
    The problem is, when the main window is not active(timer paused) and
    the auto-save kicks in - the timer always gets restarted in mark_timing().
    
    This patch fixes it by storing the current value of self.is_timing at the st
    of mark_timing() and then checking it before calling resume_timing().
    
    Fixes bug #562782
gnome-games$ git show f235e03e
commit f235e03e98e960a69627f5b4afacb9f14d599bad
Author: Jim Ross 
Date:   Wed Mar 31 03:53:55 2010 -0400

    sudoku: Fixed mark timing
    
    The problem is, when the main window is not active(timer paused) and
    the auto-save kicks in - the timer always gets restarted in mark_timing().
    
    This patch fixes it by storing the current value of self.is_timing at the st
    of mark_timing() and then checking it before calling resume_timing().
    
    Fixes bug #562782

diff --git a/gnome-sudoku/src/lib/timer.py b/gnome-sudoku/src/lib/timer.py
index bd5e2de..c37511a 100644
--- a/gnome-sudoku/src/lib/timer.py
+++ b/gnome-sudoku/src/lib/timer.py
@@ -132,13 +132,15 @@ class ActiveTimer (gobject.GObject):
         self.resume_timing()
 
     def mark_timing(self):
+        currently_timing = self.is_timing
         self.pause_timing()
         if self.active_time < 1:
             self.active_time = 1
         # dirty hack: never let total time be less than active time
         if self.active_time > self.total_time:
             self.total_time = self.active_time
-        self.resume_timing()
+        if currently_timing:
+            self.resume_timing()
 
     def finish_timing (self):
         self.mark_timing()

0 件のコメント:

コメントを投稿