Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-07-31 05:22:37 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-07-31 05:22:37 (GMT)
commitbaad898616a60a5fbafbd37de3dfcb5c1c3c72b8 (patch)
tree4e2ef6fdbd431b26754b569c5709922bf5da6668
parent830b3d8d71dbd32201000c6ec1042634b670de28 (diff)
clean up before release
-rw-r--r--GNUChessActivity.py18
-rw-r--r--NEWS5
-rw-r--r--activity/activity.info2
-rw-r--r--chess.py12
-rw-r--r--utils.py15
5 files changed, 26 insertions, 26 deletions
diff --git a/GNUChessActivity.py b/GNUChessActivity.py
index a3b2701..4134a81 100644
--- a/GNUChessActivity.py
+++ b/GNUChessActivity.py
@@ -486,18 +486,16 @@ class GNUChessActivity(activity.Activity):
self._do_reskin(piece, jobject.file_path)
def _do_reskin(self, piece, file_path):
- _logger.debug('%s %s %s' % (
- piece, str(self._gnuchess.we_are_sharing),
- str(self.buddy)))
+ ''' If we are sharing, only reskin pieces of your color '''
if self._gnuchess.we_are_sharing and self.buddy is not None:
- pixbuf = self._gnuchess.reskin_from_file(
- piece, file_path, return_pixbuf= True)
if 'white' in piece and self.playing_white:
+ pixbuf = self._gnuchess.reskin_from_file(
+ piece, file_path, return_pixbuf= True)
self.send_piece(piece, pixbuf)
elif 'black' in piece and not self.playing_white:
+ pixbuf = self._gnuchess.reskin_from_file(
+ piece, file_path, return_pixbuf= True)
self.send_piece(piece, pixbuf)
- else:
- _logger.debug('skipping... opponent reskin')
else:
self._gnuchess.reskin_from_file(piece, file_path)
return
@@ -718,7 +716,6 @@ class GNUChessActivity(activity.Activity):
chooser.destroy()
del chooser
if name is not None:
- _logger.debug('foo: %s %s' % (str(jobject.object_id), jobject.file_path))
return jobject.object_id, jobject.file_path
else:
return None, None
@@ -838,7 +835,6 @@ class GNUChessActivity(activity.Activity):
self._gnuchess.set_sharing(True)
self.restoring = True
- _logger.debug('............... setting human button to active')
self.playing_robot = False
self.human_button.set_active(True)
self.restoring = False
@@ -896,8 +892,6 @@ params=%r state=%d' % (id, initiator, type, service, params, state))
except ValueError:
_logger.debug('Could not split event message %s' % (event_message))
return
- _logger.debug('%s: %s' % (self._processing_methods[command][1],
- payload))
self._processing_methods[command][0](payload)
def send_new_game(self):
@@ -998,7 +992,7 @@ params=%r state=%d' % (id, initiator, type, service, params, state))
def send_piece(self, piece, pixbuf):
_logger.debug('send_piece %s' % (piece))
- self.send_event('p|%s' % (self._dump(piece, pixbuf)))
+ gobject.idle_add(self.send_event, 'p|%s' % (self._dump(piece, pixbuf)))
def _receive_piece(self, payload):
piece, pixbuf = self._load(payload)
diff --git a/NEWS b/NEWS
index 7adcfda..5c038bb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+3
+
+ENHANCEMENT:
+* Support for ARM (e.g., XO 1.75)
+
2
ENHANCEMENT:
diff --git a/activity/activity.info b/activity/activity.info
index f501361..2a47609 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,6 +1,6 @@
[Activity]
name = SimpleGNUChess
-activity_version = 2
+activity_version = 3
license = GPLv3
bundle_id = org.sugarlabs.GNUChessActivity
exec = sugar-activity GNUChessActivity.GNUChessActivity
diff --git a/chess.py b/chess.py
index a2c29a9..a05f298 100644
--- a/chess.py
+++ b/chess.py
@@ -173,7 +173,6 @@ class Gnuchess():
def _process_output(self, output, my_move=None, hint=False):
''' process output from gnuchess command '''
- # _logger.debug(output)
self.check = False
self.checkmate = False
if 'White Black' in output: # processing show game
@@ -1411,12 +1410,8 @@ class Gnuchess():
if not self.we_are_sharing:
return
if self._activity.playing_white and len(self.move_list) % 2 == 0:
- _logger.debug("received a remote move (%s) from Black but it is \
-White's turn." % (move))
return
elif not self._activity.playing_white and len(self.move_list) % 2 == 1:
- _logger.debug("received a remote move (%s) from White but it is \
-Black's turn." % (move))
return
_logger.debug('Processing remote move (%s)' % (move))
self.move(move)
@@ -1568,17 +1563,16 @@ Black's turn." % (move))
pixbuf = svg_str_to_pixbuf(
svg_header(colors) + DICT[piece](bw) + svg_footer(),
w=self.scale, h=self.scale)
- self._reskin(piece, pixbuf)
+ self.reskin(piece, pixbuf)
def reskin_from_file(self, piece, file_path, return_pixbuf=False):
- _logger.debug('%s %s' % (piece, file_path))
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(
file_path, self.scale, self.scale)
- self._reskin(piece, pixbuf)
+ self.reskin(piece, pixbuf)
if return_pixbuf:
return pixbuf
- def _reskin(self, piece, pixbuf):
+ def reskin(self, piece, pixbuf):
DICT = {'white_pawn': WP, 'black_pawn': BP,
'white_rook': WR, 'black_rook': BR,
'white_knight': WN, 'black_knight': BN,
diff --git a/utils.py b/utils.py
index 3661c7f..285e6a7 100644
--- a/utils.py
+++ b/utils.py
@@ -10,6 +10,7 @@
# Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA
import os
+import gtk
import subprocess
from StringIO import StringIO
try:
@@ -34,7 +35,7 @@ UNKNOWN = 'unknown'
def get_hardware():
- """ Determine whether we are using XO 1.0, 1.5, or "unknown" hardware """
+ ''' Determine whether we are using XO 1.0, 1.5, or "unknown" hardware '''
product = _get_dmi('product_name')
if product is None:
if os.path.exists('/sys/devices/platform/lis3lv02d/position'):
@@ -66,11 +67,10 @@ def _get_dmi(node):
def json_load(text):
- """ Load JSON data using what ever resources are available. """
+ ''' Load JSON data using what ever resources are available. '''
if OLD_SUGAR_SYSTEM is True:
listdata = json.read(text)
else:
- # strip out leading and trailing whitespace, nulls, and newlines
io = StringIO(text)
try:
listdata = jload(io)
@@ -83,7 +83,7 @@ def json_load(text):
def json_dump(data):
- """ Save data using available JSON tools. """
+ ''' Save data using available JSON tools. '''
if OLD_SUGAR_SYSTEM is True:
return json.write(data)
else:
@@ -92,7 +92,13 @@ def json_dump(data):
return _io.getvalue()
+def get_path(activity, path):
+ ''' Find a Rainbow-approved place for temporary files. '''
+ return(os.path.join(activity.get_activity_root(), path))
+
+
def file_to_base64(activity, path):
+ ''' Given a file, convert its contents to base64 '''
base64 = os.path.join(get_path(activity, 'instance'), 'base64tmp')
cmd = 'base64 <' + path + ' >' + base64
subprocess.check_call(cmd, shell=True)
@@ -114,6 +120,7 @@ def pixbuf_to_base64(activity, pixbuf):
def base64_to_file(activity, data, path):
+ ''' Given a file, convert its contents from base64 '''
base64 = os.path.join(get_path(activity, 'instance'), 'base64tmp')
file_handle = open(base64, 'w')
file_handle.write(data)