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-30 15:21:44 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-07-30 15:21:44 (GMT)
commitb1b2c2290e0186558370085cb0944905458caec1 (patch)
tree13a1d96dd734e2cdd397134e3115a6ae0353b032
parent1730609506825c5547bef659016eac6ddfa25d16 (diff)
clean up some problems with custom colors when sharing
-rw-r--r--GNUChessActivity.py30
-rw-r--r--chess.py4
-rw-r--r--icons/white-knight-custom.svg126
3 files changed, 142 insertions, 18 deletions
diff --git a/GNUChessActivity.py b/GNUChessActivity.py
index 9024e01..73ddf42 100644
--- a/GNUChessActivity.py
+++ b/GNUChessActivity.py
@@ -255,7 +255,7 @@ class GNUChessActivity(activity.Activity):
icon.show()
skin_button2.set_icon_widget(icon)
- self.skin_button3 = radio_factory('view-source',
+ self.skin_button3 = radio_factory('white-knight-custom',
self.view_toolbar,
self.do_custom_skin_cb,
tooltip=_('Custom pieces'),
@@ -439,27 +439,25 @@ class GNUChessActivity(activity.Activity):
'%s/icons/white-pawn.svg' % (activity.get_bundle_path()))
def _black_peices(self, colors):
- self._gnuchess.reskin_from_svg('black_king', colors)
- self._gnuchess.reskin_from_svg('black_queen', colors)
- self._gnuchess.reskin_from_svg('black_bishop', colors)
- self._gnuchess.reskin_from_svg('black_knight', colors)
- self._gnuchess.reskin_from_svg('black_rook', colors)
- self._gnuchess.reskin_from_svg('black_pawn', colors)
+ self._gnuchess.reskin_from_svg('black_king', colors, bw='#000000')
+ self._gnuchess.reskin_from_svg('black_queen', colors, bw='#000000')
+ self._gnuchess.reskin_from_svg('black_bishop', colors, bw='#000000')
+ self._gnuchess.reskin_from_svg('black_knight', colors, bw='#000000')
+ self._gnuchess.reskin_from_svg('black_rook', colors, bw='#000000')
+ self._gnuchess.reskin_from_svg('black_pawn', colors, bw='#000000')
def _white_peices(self, colors):
- self._gnuchess.reskin_from_svg('white_king', colors)
- self._gnuchess.reskin_from_svg('white_queen', colors)
- self._gnuchess.reskin_from_svg('white_bishop', colors)
- self._gnuchess.reskin_from_svg('white_knight', colors)
- self._gnuchess.reskin_from_svg('white_rook', colors)
- self._gnuchess.reskin_from_svg('white_pawn', colors)
+ self._gnuchess.reskin_from_svg('white_king', colors, bw='#ffffff')
+ self._gnuchess.reskin_from_svg('white_queen', colors, bw='#ffffff')
+ self._gnuchess.reskin_from_svg('white_bishop', colors, bw='#ffffff')
+ self._gnuchess.reskin_from_svg('white_knight', colors, bw='#ffffff')
+ self._gnuchess.reskin_from_svg('white_rook', colors, bw='#ffffff')
+ self._gnuchess.reskin_from_svg('white_pawn', colors, bw='#ffffff')
def do_sugar_skin_cb(self, button=None):
colors = self.colors
if not self._gnuchess.we_are_sharing:
- colors[1] = '#000000'
self._black_peices(colors)
- colors[1] = '#ffffff'
self._white_peices(colors)
else:
if self.playing_white:
@@ -927,7 +925,7 @@ params=%r state=%d' % (id, initiator, type, service, params, state))
def _receive_colors(self, payload):
_logger.debug('received_colors %s' % (payload))
- self.opponent_colors = payload
+ self.opponent_colors = payload.split(',')
xocolors = XoColor(payload)
icon = Icon(icon_name='human', xo_color=xocolors)
icon.show()
diff --git a/chess.py b/chess.py
index b3e4b93..ab20455 100644
--- a/chess.py
+++ b/chess.py
@@ -1549,7 +1549,7 @@ Black's turn." % (move))
y += self.scale
k += 1
- def reskin_from_svg(self, piece, colors):
+ def reskin_from_svg(self, piece, colors, bw='#ffffff'):
DICT = {'white_pawn': svg_pawn, 'black_pawn': svg_pawn,
'white_rook': svg_rook, 'black_rook': svg_rook,
'white_knight': svg_knight, 'black_knight': svg_knight,
@@ -1557,7 +1557,7 @@ Black's turn." % (move))
'white_queen': svg_queen, 'black_queen': svg_queen,
'white_king': svg_king, 'black_king': svg_king}
pixbuf = svg_str_to_pixbuf(
- svg_header(colors) + DICT[piece](colors[0]) + svg_footer(),
+ svg_header(colors) + DICT[piece](bw) + svg_footer(),
w=self.scale, h=self.scale)
self._reskin(piece, pixbuf)
diff --git a/icons/white-knight-custom.svg b/icons/white-knight-custom.svg
new file mode 100644
index 0000000..6525051
--- /dev/null
+++ b/icons/white-knight-custom.svg
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="55"
+ height="55"
+ id="svg3006">
+ <defs
+ id="defs3008" />
+ <metadata
+ id="metadata3011">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ transform="translate(-586.53246,-368.27837)"
+ id="layer1">
+ <g
+ transform="matrix(0.94339623,0,0,0.94339623,34.756552,22.402548)"
+ id="layer1-8"
+ style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
+ <path
+ d="m 600.51334,390.66189 c 1.38657,0 2.85634,-0.80423 4.4093,-2.41265 0.83195,-0.83194 1.24793,-1.55297 1.24793,-2.16306 0,-0.72103 -0.66556,-1.08154 -1.99668,-1.08154 -1.55296,0 -2.85634,0.69329 -3.91014,2.07987 -0.55464,0.66556 -0.83194,1.35885 -0.83194,2.07988 0,0.99833 0.3605,1.4975 1.08153,1.4975 m -1.41432,-18.21963 c 0.11093,0 0.38824,-0.0277 0.83195,-0.0832 2.49585,0 5.15806,0.83196 7.98668,2.49585 0.33278,0.22186 0.49918,0.33277 0.49918,0.33277 1.60842,-2.60676 2.82861,-3.91014 3.66055,-3.91014 1.77482,0.99834 2.93956,2.07987 3.49418,3.24459 0.27732,0.55464 0.6933,1.71935 1.24792,3.49418 0.44371,-0.11094 0.88741,-0.16639 1.33112,-0.16639 4.6589,0 9.09594,2.85635 13.31115,8.56905 5.04714,6.60011 7.57071,15.58512 7.57071,26.95506 0,2.55131 -0.11092,4.85302 -0.33277,6.90517 l -35.10816,0 c 0.11094,-3.71603 1.46977,-7.23794 4.07654,-10.56573 0.27732,-0.4437 0.66556,-0.94286 1.16473,-1.4975 2.05214,-2.60676 3.30005,-4.60343 3.74376,-5.99002 0.22185,-0.72101 0.38824,-1.46977 0.49917,-2.24625 -3.66057,1.44204 -6.406,3.57737 -8.23628,6.40599 -0.83195,1.38657 -1.74708,2.82862 -2.74543,4.32612 -0.27732,0.44371 -0.69329,0.66557 -1.24791,0.66557 -1.38657,0 -2.07986,-0.85969 -2.07986,-2.57905 -0.55465,0.72103 -1.19247,1.08153 -1.91348,1.08153 0,0 -0.55464,-0.13866 -1.66389,-0.41597 -2.38492,-0.61011 -4.07654,-1.6639 -5.07489,-3.16141 -0.33277,-0.49916 -0.69328,-1.16472 -1.08153,-1.99666 0.38825,-2.38492 2.30173,-7.12701 5.74044,-14.22629 2.49584,-5.10261 4.04881,-8.76318 4.65891,-10.98169 0.0555,-0.49917 0.0832,-1.22018 0.0832,-2.16307 0,-0.77648 -0.13866,-2.27398 -0.41597,-4.4925 m -4.99168,29.20132 c -1.33111,0 -2.21852,0.58235 -2.66223,1.74709 -0.11092,0.27731 -0.16639,0.55462 -0.16639,0.83194 0,0.22185 0.0832,0.49917 0.24959,0.83194 1.44204,0 2.32945,-0.61009 2.66222,-1.83027 0.0555,-0.16639 0.0832,-0.36052 0.0832,-0.58236 0,-0.11093 -0.0555,-0.4437 -0.16639,-0.99834 m 40.84857,12.81198 0,-3.0782 c 0,-9.0405 -2.30171,-16.44481 -6.90514,-22.21297 -3.99336,-4.99169 -7.62619,-7.48753 -10.8985,-7.48753 0,0 -0.33279,-0.0555 -0.99834,-0.16638 -0.11093,0.0555 -0.19413,0.11093 -0.2496,0.16638 -0.72101,0 -1.08151,0.30505 -1.08151,0.91513 0,0.22186 0.16639,0.49918 0.49916,0.83196 2.995,0.27731 6.26733,2.41264 9.81697,6.406 4.49251,5.21351 6.73877,12.7565 6.73877,22.62892 0,0 0,0.1664 0,0.49917 0,2.44039 0.52689,3.66058 1.58069,3.66058 0.88742,0 1.38659,-0.72103 1.4975,-2.16306"
+ id="path1726"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Bitstream Vera Sans" />
+ </g>
+ </g>
+ <g
+ transform="matrix(1.25,0,0,1.2480765,-12.375,-13.27783)"
+ id="g3005">
+ <g
+ transform="matrix(0.39216235,0,0,0.39160308,32.71828,32.756253)"
+ id="g3-2"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1">
+ <polygon
+ points="14.659,4.975 20.555,2.531 26.891,12.363 17.238,16.369 "
+ id="polygon5-2"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <polygon
+ points="50.04,14.654 52.477,20.55 42.646,26.88 38.649,17.228 "
+ id="polygon7-8"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <polygon
+ points="40.349,50.029 34.453,52.471 28.117,42.645 37.775,38.645 "
+ id="polygon9-4"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <polygon
+ points="34.394,2.439 40.295,4.882 37.824,16.315 28.171,12.309 "
+ id="polygon11-3"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <polygon
+ points="52.493,34.365 50.055,40.258 38.628,37.791 42.623,28.139 "
+ id="polygon13-1"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <polygon
+ points="2.515,34.34 4.953,40.234 16.385,37.76 12.391,28.105 "
+ id="polygon15-1"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <polygon
+ points="4.936,14.643 2.493,20.539 12.319,26.875 16.32,17.216 "
+ id="polygon17-1"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <polygon
+ points="14.719,50.018 20.609,52.461 26.939,42.623 17.287,38.629 "
+ id="polygon19-9"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-opacity:1" />
+ <path
+ d="m 39.925,22.352 c 2.845,6.863 -0.412,14.728 -7.274,17.574 -6.867,2.85 -14.734,-0.418 -17.578,-7.281 -2.84,-6.862 0.418,-14.733 7.279,-17.572 6.862,-2.845 14.734,0.417 17.573,7.279 z"
+ id="path21-0"
+ style="fill:#282828;fill-opacity:1;stroke:#282828;stroke-width:11.69439983;stroke-opacity:1" />
+ </g>
+ <g
+ transform="matrix(0.33333799,0,0,0.33286262,34.335538,34.368973)"
+ id="g3">
+ <polygon
+ points="20.555,2.531 26.891,12.363 17.238,16.369 14.659,4.975 "
+ id="polygon5"
+ style="fill:#ffffff" />
+ <polygon
+ points="52.477,20.55 42.646,26.88 38.649,17.228 50.04,14.654 "
+ id="polygon7"
+ style="fill:#ffffff" />
+ <polygon
+ points="34.453,52.471 28.117,42.645 37.775,38.645 40.349,50.029 "
+ id="polygon9"
+ style="fill:#ffffff" />
+ <polygon
+ points="40.295,4.882 37.824,16.315 28.171,12.309 34.394,2.439 "
+ id="polygon11"
+ style="fill:#ffffff" />
+ <polygon
+ points="50.055,40.258 38.628,37.791 42.623,28.139 52.493,34.365 "
+ id="polygon13"
+ style="fill:#ffffff" />
+ <polygon
+ points="4.953,40.234 16.385,37.76 12.391,28.105 2.515,34.34 "
+ id="polygon15"
+ style="fill:#ffffff" />
+ <polygon
+ points="2.493,20.539 12.319,26.875 16.32,17.216 4.936,14.643 "
+ id="polygon17"
+ style="fill:#ffffff" />
+ <polygon
+ points="20.609,52.461 26.939,42.623 17.287,38.629 14.719,50.018 "
+ id="polygon19"
+ style="fill:#ffffff" />
+ <path
+ d="m 39.925,22.352 c 2.845,6.863 -0.412,14.728 -7.274,17.574 -6.867,2.85 -14.734,-0.418 -17.578,-7.281 -2.84,-6.862 0.418,-14.733 7.279,-17.572 6.862,-2.845 14.734,0.417 17.573,7.279 z"
+ id="path21"
+ style="fill:none;stroke:#ffffff;stroke-width:11.69439983" />
+ </g>
+ </g>
+</svg>