diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2010-02-24 16:59:41 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2010-02-24 16:59:41 (GMT) |
commit | af891b8342d29a6f52ad7527862a607ae277c855 (patch) | |
tree | 42ec21b9f869390c8cb674f0ae133ac56f922ce4 | |
parent | 0741bf5614e511aba4cddf320bf7c3906dc528e8 (diff) |
added match highight
-rw-r--r-- | CardSortActivity.py | 2 | ||||
-rw-r--r-- | card.py | 15 | ||||
-rwxr-xr-x | cardsort.py | 2 | ||||
-rw-r--r-- | grid.py | 116 | ||||
-rw-r--r-- | images/card0.svg (renamed from images/card0x.svg) | 0 | ||||
-rw-r--r-- | images/card1.svg (renamed from images/card1x.svg) | 0 | ||||
-rw-r--r-- | images/card2.svg (renamed from images/card2x.svg) | 0 | ||||
-rw-r--r-- | images/card3.svg (renamed from images/card3x.svg) | 0 | ||||
-rw-r--r-- | images/card4.svg (renamed from images/card4x.svg) | 0 | ||||
-rw-r--r-- | images/card5.svg (renamed from images/card5x.svg) | 0 | ||||
-rw-r--r-- | images/card6.svg (renamed from images/card6x.svg) | 0 | ||||
-rw-r--r-- | images/card7.svg (renamed from images/card7x.svg) | 0 | ||||
-rw-r--r-- | images/card8.svg (renamed from images/card8x.svg) | 0 | ||||
-rw-r--r-- | images/mask0h.svg | 25 | ||||
-rw-r--r-- | images/mask0v.svg | 25 | ||||
-rw-r--r-- | images/mask1h.svg | 25 | ||||
-rw-r--r-- | images/mask1v.svg | 25 | ||||
-rw-r--r-- | images/mask2h.svg | 25 | ||||
-rw-r--r-- | images/mask2v.svg | 25 | ||||
-rw-r--r-- | images/mask3h.svg | 25 | ||||
-rw-r--r-- | images/mask3v.svg | 25 | ||||
-rw-r--r-- | window.py | 2 |
22 files changed, 320 insertions, 17 deletions
diff --git a/CardSortActivity.py b/CardSortActivity.py index 93fba29..48fd06e 100644 --- a/CardSortActivity.py +++ b/CardSortActivity.py @@ -137,7 +137,7 @@ class CardSortActivity(activity.Activity): # Initialize the canvas self.tw = window.new_window(canvas, \ os.path.join(activity.get_bundle_path(), \ - 'images/card'), \ + 'images'), \ self) # Read the mode from the Journal @@ -18,6 +18,9 @@ import os.path from sprites import Sprite +def load_image(file, w, h): + return gtk.gdk.pixbuf_new_from_file_at_size(file, int(w), int(h)) + # # class for defining individual cards # @@ -33,20 +36,16 @@ class Card: self.west = c[3] self.orientation = 0 self.images = [] - self.images.append(self.load_image(tw.path,i,tw.card_dim*tw.scale)) + file = "%s/card%d.svg" % (tw.path,i) + self.images.append(load_image(file, tw.card_dim*tw.scale, + tw.card_dim*tw.scale)) for j in range(3): self.images.append(self.images[j].rotate_simple(90)) # create sprite from svg file - self.spr = Sprite(tw.sprites, x, y,self.images[0]) + self.spr = Sprite(tw.sprites, x, y, self.images[0]) self.spr.set_label(i) self.spr.draw() - def load_image(self, file, i, wh): - return gtk.gdk.pixbuf_new_from_file_at_size(os.path.join(file + \ - str(i) + "x" + \ - '.svg'), \ - int(wh), int(wh)) - def reset_image(self, tw, i): while self.orientation != 0: self.rotate_ccw() diff --git a/cardsort.py b/cardsort.py index 596d180..bd3ddb0 100755 --- a/cardsort.py +++ b/cardsort.py @@ -85,7 +85,7 @@ class CardSortMain: # Start the activity self.tw = window.new_window(canvas, \ os.path.join(os.path.abspath('.'), \ - 'images/card')) + 'images')) self.tw.win = self.win self.tw.test = self.tw.grid.test2x2 self.tw.grid.reset2x2(self.tw) @@ -16,7 +16,8 @@ import gtk import gobject from random import uniform -from card import * +from sprites import Sprite +from card import Card, load_image CARD_DEFS = ((1,3,-2,-3),(2,3,-3,-2),(2,3,-4,-4), (2,1,-1,-4),(3,4,-4,-3),(4,2,-1,-2), @@ -35,23 +36,46 @@ class Grid: """ def __init__(self, tw): self.grid = [0,1,2,3,4,5,6,7,8] - self.card_table = {} + self.card_table = [] + self.mask_table = [] # Stuff to keep around for the graphics self.w = int(tw.width) self.h = int(tw.height) self.d = int(tw.card_dim*tw.scale) + self.s = tw.scale # Initialize the cards i = 0 # i is used as a label on the sprite for c in CARD_DEFS: x, y = self.i_to_xy(i) - self.card_table[i] = Card(tw,c,i,x,y) + self.card_table.append(Card(tw,c,i,x,y)) i += 1 + # Initialize the masks (We need up to 6 of each one.) + for i in range(4): + name = "%s/mask%dh.svg" % (tw.path, i) + bitmap = load_image(name, 120*tw.scale, 48*tw.scale) + for j in range(6): + x, y = self.mh_to_xy(j) + self.mask_table.append(Sprite(tw.sprites, x, y, bitmap)) + name = "%s/mask%dv.svg" % (tw.path, i) + bitmap = load_image(name, 48*tw.scale, 120*tw.scale) + for j in range(6): + x, y = self.mv_to_xy(j) + self.mask_table.append(Sprite(tw.sprites, x, y, bitmap)) + self.hide_masks() # Utility functions def i_to_xy(self, i): return int((self.w-(self.d*3))/2) + (i%3)*self.d,\ int((self.h-(self.d*3))/2) + int(i/3)*self.d + def mh_to_xy(self, i): + return int((self.w-(self.d*3))/2 + ((i%2)+1)*self.d - 60*self.s),\ + int((self.h-(self.d*3))/2 + (int(i/2)+.5)*self.d - 24*self.s) + + def mv_to_xy(self, i): + return int((self.w-(self.d*3))/2 + ((i%3)+.5)*self.d - 24*self.s),\ + int((self.h-(self.d*3))/2 + (int(i/3)+1)*self.d - 60*self.s) + def xy_to_i(self, x, y): return (x-int((self.w-(self.d*3))/2))/self.d +\ ((y-int((self.h-(self.d*3))/2))/self.d)*3 @@ -80,15 +104,23 @@ class Grid: for i in list: self.card_table[i].spr.hide() + def hide_masks(self): + for i in self.mask_table: + i.hide() + # Reset everything to initial layout def reset3x3(self, tw): self.show_all() + self.hide_masks() self.set_grid([0,1,2,3,4,5,6,7,8]) self.randomize_orientation() + self.hide_masks() + self.test3x3() # Two by two = ((7,5,0,3),(7,4,5,2),(1,3,5,8),(4,5,6,1)) def reset2x2(self, tw): self.show_all() + self.hide_masks() self.randomize_orientation() r = int(uniform(0,4)) if r == 0: @@ -103,10 +135,13 @@ class Grid: else: self.set_grid([4,5,0,6,1,2,3,7,8]) self.hide_list([0,2,3,7,8]) + self.hide_masks() + self.test2x2() # Three by two = ((7,5,0,2,4,3),(5,6,1,4,3,8)) def reset3x2(self, tw): self.show_all() + self.hide_masks() self.randomize_orientation() r = int(uniform(0,2)) if r == 0: @@ -115,11 +150,14 @@ class Grid: else: self.set_grid([5,6,1,4,3,8,0,2,7]) self.hide_list([0,2,7]) + self.hide_masks() + self.test3x2() # Two by three = ((5,2,4,6,1,7),(7,1,2,5,8,0)) # reset everything to initial layout def reset2x3(self, tw): self.show_all() + self.hide_masks() self.randomize_orientation() r = int(uniform(0,2)) if r == 0: @@ -128,6 +166,8 @@ class Grid: else: self.set_grid([7,1,3,2,5,4,8,0,6]) self.hide_list([3,4,6]) + self.hide_masks() + self.test2x3() # swap card a and card b # swap their entries in the grid and the position of their sprites @@ -163,8 +203,25 @@ class Grid: self.card_table[self.grid[8]].orientation return - # test all relevant borders, ignoring borders on the blank card + # Test all relevant borders, ignoring edges + # Highlight matches. def test3x3(self): + for m, i in enumerate([0,1,3,4,6,7]): + offset = abs(self.card_table[self.grid[i]].east) + offset = (offset-1)*12 + if self.card_table[self.grid[i]].east + \ + self.card_table[self.grid[i+1]].west == 0: + self.mask_table[m+offset].set_layer(2000) + else: + self.mask_table[m+offset].hide() + for m, i in enumerate([0,1,2,3,4,5]): + offset = abs(self.card_table[self.grid[i]].south) + offset = (offset-1)*12+6 + if self.card_table[self.grid[i]].south + \ + self.card_table[self.grid[i+3]].north == 0: + self.mask_table[m+offset].set_layer(2000) + else: + self.mask_table[m+offset].hide() for i in (0,1,3,4,6,7): if self.card_table[self.grid[i]].east + \ self.card_table[self.grid[i+1]].west != 0: @@ -175,8 +232,23 @@ class Grid: return False return True - # test all relevant borders, ignoring borders on the blank card def test2x3(self): + for m, i in enumerate([0,3,6]): + offset = abs(self.card_table[self.grid[i]].east) + offset = (offset-1)*12 + if self.card_table[self.grid[i]].east + \ + self.card_table[self.grid[i+1]].west == 0: + self.mask_table[m*2+offset].set_layer(2000) + else: + self.mask_table[m*2+offset].hide() + for m, i in enumerate([0,1,3,4]): + offset = abs(self.card_table[self.grid[i]].south) + offset = (offset-1)*12+6 + if self.card_table[self.grid[i]].south + \ + self.card_table[self.grid[i+3]].north == 0: + self.mask_table[i+offset].set_layer(2000) + else: + self.mask_table[i+offset].hide() for i in (0,3,6): if self.card_table[self.grid[i]].east + \ self.card_table[self.grid[i+1]].west != 0: @@ -187,8 +259,23 @@ class Grid: return False return True - # test all relevant borders, ignoring borders on the blank card def test3x2(self): + for m, i in enumerate([0,1,3,4]): + offset = abs(self.card_table[self.grid[i]].east) + offset = (offset-1)*12 + if self.card_table[self.grid[i]].east + \ + self.card_table[self.grid[i+1]].west == 0: + self.mask_table[m+offset].set_layer(2000) + else: + self.mask_table[m+offset].hide() + for m, i in enumerate([0,1,2]): + offset = abs(self.card_table[self.grid[i]].south) + offset = (offset-1)*12+6 + if self.card_table[self.grid[i]].south + \ + self.card_table[self.grid[i+3]].north == 0: + self.mask_table[m+offset].set_layer(2000) + else: + self.mask_table[m+offset].hide() for i in (0,1,3,4): if self.card_table[self.grid[i]].east + \ self.card_table[self.grid[i+1]].west != 0: @@ -199,8 +286,23 @@ class Grid: return False return True - # test all relevant borders, ignoring borders on the blank card def test2x2(self): + for m, i in enumerate([0,3]): + offset = abs(self.card_table[self.grid[i]].east) + offset = (offset-1)*12 + if self.card_table[self.grid[i]].east + \ + self.card_table[self.grid[i+1]].west == 0: + self.mask_table[m*2+offset].set_layer(2000) + else: + self.mask_table[m*2+offset].hide() + for m, i in enumerate([0,1]): + offset = abs(self.card_table[self.grid[i]].south) + offset = (offset-1)*12+6 + if self.card_table[self.grid[i]].south + \ + self.card_table[self.grid[i+3]].north == 0: + self.mask_table[m+offset].set_layer(2000) + else: + self.mask_table[m+offset].hide() for i in (0,3): if self.card_table[self.grid[i]].east + \ self.card_table[self.grid[i+1]].west != 0: diff --git a/images/card0x.svg b/images/card0.svg index 9777e36..9777e36 100644 --- a/images/card0x.svg +++ b/images/card0.svg diff --git a/images/card1x.svg b/images/card1.svg index 8454f2b..8454f2b 100644 --- a/images/card1x.svg +++ b/images/card1.svg diff --git a/images/card2x.svg b/images/card2.svg index c6c950d..c6c950d 100644 --- a/images/card2x.svg +++ b/images/card2.svg diff --git a/images/card3x.svg b/images/card3.svg index 9eea220..9eea220 100644 --- a/images/card3x.svg +++ b/images/card3.svg diff --git a/images/card4x.svg b/images/card4.svg index 3fca092..3fca092 100644 --- a/images/card4x.svg +++ b/images/card4.svg diff --git a/images/card5x.svg b/images/card5.svg index f95331b..f95331b 100644 --- a/images/card5x.svg +++ b/images/card5.svg diff --git a/images/card6x.svg b/images/card6.svg index e4699f1..e4699f1 100644 --- a/images/card6x.svg +++ b/images/card6.svg diff --git a/images/card7x.svg b/images/card7.svg index e69eab6..e69eab6 100644 --- a/images/card7x.svg +++ b/images/card7.svg diff --git a/images/card8x.svg b/images/card8.svg index 0a9b27d..0a9b27d 100644 --- a/images/card8x.svg +++ b/images/card8.svg diff --git a/images/mask0h.svg b/images/mask0h.svg new file mode 100644 index 0000000..976fc6a --- /dev/null +++ b/images/mask0h.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="120" + height="48" + id="svg2"> + <defs + id="defs6" /> + <g + transform="matrix(0,-1,1,0,52.999517,47.067589)" + id="g3614"> + <path + d="m 19.235605,60.757991 c -1.7583,-2.888858 -6.32031,-9.171387 -10.1377803,-13.961175 -3.81748,-4.789789 -7.44137,-10.144439 -8.05309,-11.899223 -3.11279,-8.929346 1.54108,-17.892072 9.2904003,-17.892072 2.23093,0 4.01899,1.139751 7.2775,4.638837 l 4.319882,4.638837 -0.02386,-3.888837 C 21.884977,18.53399 20.826486,13.113114 19.440777,9.7555213 18.820035,8.25145 19.310725,8.0055214 22.932514,8.0055214 c 3.621785,0 4.112481,0.2459286 3.491737,1.7499999 -1.385709,3.3575927 -2.444198,8.7784687 -2.46788,12.6388367 l -0.02386,3.888837 4.319887,-4.638837 c 3.258501,-3.499086 5.046564,-4.638837 7.277494,-4.638837 5.652098,0 10.402619,5.60825 10.402619,12.280863 0,4.653845 -3.251467,10.547647 -12.027455,21.80168 -4.1099,5.270398 -8.372545,10.784009 -9.472545,12.252469 l -2,2.669927 -3.196909,-5.252469 z" + id="path2818" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 19.235604,-46.747048 c -1.7583,2.888858 -6.32031,9.171387 -10.1377797,13.961175 -3.817479,4.789789 -7.441369,10.14444 -8.053089,11.899224 -3.11279,8.929346 1.54108,17.8920709 9.2903987,17.8920709 2.23093,0 4.01899,-1.139751 7.2775,-4.638837 l 4.319882,-4.6388359 -0.02386,3.8888359 c -0.02368,3.860368 -1.082171,9.2812435 -2.46788,12.6388365 -0.620742,1.504071 -0.130052,1.75 3.491737,1.75 3.621785,0 4.112481,-0.245929 3.491737,-1.75 -1.385709,-3.357593 -2.444198,-8.7784685 -2.46788,-12.6388365 l -0.02386,-3.8888359 4.319887,4.6388359 c 3.258501,3.499086 5.046564,4.638837 7.277494,4.638837 5.652098,0 10.402619,-5.60825 10.402619,-12.2808619 0,-4.653845 -3.251467,-10.547648 -12.027455,-21.801681 -4.1099,-5.270398 -8.372545,-10.784009 -9.472545,-12.252469 l -2,-2.669927 -3.196909,5.252469 z" + id="path2818-4" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> diff --git a/images/mask0v.svg b/images/mask0v.svg new file mode 100644 index 0000000..89c5897 --- /dev/null +++ b/images/mask0v.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="48" + height="120" + id="svg2"> + <defs + id="defs6" /> + <g + transform="translate(0.9999499,52.994528)" + id="g3614"> + <path + d="m 19.235605,60.757991 c -1.7583,-2.888858 -6.32031,-9.171387 -10.1377803,-13.961175 -3.81748,-4.789789 -7.44137,-10.144439 -8.05309,-11.899223 -3.11279,-8.929346 1.54108,-17.892072 9.2904003,-17.892072 2.23093,0 4.01899,1.139751 7.2775,4.638837 l 4.319882,4.638837 -0.02386,-3.888837 C 21.884977,18.53399 20.826486,13.113114 19.440777,9.7555213 18.820035,8.25145 19.310725,8.0055214 22.932514,8.0055214 c 3.621785,0 4.112481,0.2459286 3.491737,1.7499999 -1.385709,3.3575927 -2.444198,8.7784687 -2.46788,12.6388367 l -0.02386,3.888837 4.319887,-4.638837 c 3.258501,-3.499086 5.046564,-4.638837 7.277494,-4.638837 5.652098,0 10.402619,5.60825 10.402619,12.280863 0,4.653845 -3.251467,10.547647 -12.027455,21.80168 -4.1099,5.270398 -8.372545,10.784009 -9.472545,12.252469 l -2,2.669927 -3.196909,-5.252469 z" + id="path2818" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 19.235604,-46.747048 c -1.7583,2.888858 -6.32031,9.171387 -10.1377797,13.961175 -3.817479,4.789789 -7.441369,10.14444 -8.053089,11.899224 -3.11279,8.929346 1.54108,17.8920709 9.2903987,17.8920709 2.23093,0 4.01899,-1.139751 7.2775,-4.638837 l 4.319882,-4.6388359 -0.02386,3.8888359 c -0.02368,3.860368 -1.082171,9.2812435 -2.46788,12.6388365 -0.620742,1.504071 -0.130052,1.75 3.491737,1.75 3.621785,0 4.112481,-0.245929 3.491737,-1.75 -1.385709,-3.357593 -2.444198,-8.7784685 -2.46788,-12.6388365 l -0.02386,-3.8888359 4.319887,4.6388359 c 3.258501,3.499086 5.046564,4.638837 7.277494,4.638837 5.652098,0 10.402619,-5.60825 10.402619,-12.2808619 0,-4.653845 -3.251467,-10.547648 -12.027455,-21.801681 -4.1099,-5.270398 -8.372545,-10.784009 -9.472545,-12.252469 l -2,-2.669927 -3.196909,5.252469 z" + id="path2818-4" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> diff --git a/images/mask1h.svg b/images/mask1h.svg new file mode 100644 index 0000000..e07cb66 --- /dev/null +++ b/images/mask1h.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="120" + height="48" + id="svg2"> + <defs + id="defs6" /> + <g + transform="matrix(0,-1,1,0,19.200534,84.072653)" + id="g3793"> + <path + d="M 43.967939,87.184232 C 37.492729,84.505907 34.9199,76.41929 38.193757,69.03549 39.681819,65.679341 52.341551,49.462444 59.426941,41.836149 c 0.929421,-1.000374 19.897415,22.014111 22.31973,27.081253 4.004403,8.376653 -0.424746,17.760115 -8.92097,18.899698 -3.253592,0.436398 -4.500492,0.07194 -7.026912,-2.053902 -1.68929,-1.421443 -3.6559,-3.995463 -4.370244,-5.720045 l -1.298809,-3.135602 -1.808523,3.525173 c -3.351406,6.532564 -8.746851,9.070479 -14.353274,6.751508 z" + id="path3769" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 43.967989,-5.5753217 c -6.47521,2.678325 -9.048039,10.764942 -5.774182,18.1487427 1.488062,3.356149 14.147794,19.573045 21.233184,27.199341 0.929421,1.000374 19.897415,-22.014111 22.31973,-27.081253 4.004403,-8.3766537 -0.424746,-17.7601157 -8.92097,-18.8996984 -3.253592,-0.436398 -4.500492,-0.07194 -7.026912,2.0539017 -1.68929,1.421443 -3.6559,3.99546297 -4.370244,5.720045 l -1.298809,3.135602 -1.808523,-3.525173 c -3.351406,-6.532564 -8.746851,-9.0704787 -14.353274,-6.751508 z" + id="path3769-7" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> diff --git a/images/mask1v.svg b/images/mask1v.svg new file mode 100644 index 0000000..e3740f6 --- /dev/null +++ b/images/mask1v.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="48" + height="120" + id="svg2"> + <defs + id="defs6" /> + <g + transform="translate(-36.005115,19.195545)" + id="g3793"> + <path + d="M 43.967939,87.184232 C 37.492729,84.505907 34.9199,76.41929 38.193757,69.03549 39.681819,65.679341 52.341551,49.462444 59.426941,41.836149 c 0.929421,-1.000374 19.897415,22.014111 22.31973,27.081253 4.004403,8.376653 -0.424746,17.760115 -8.92097,18.899698 -3.253592,0.436398 -4.500492,0.07194 -7.026912,-2.053902 -1.68929,-1.421443 -3.6559,-3.995463 -4.370244,-5.720045 l -1.298809,-3.135602 -1.808523,3.525173 c -3.351406,6.532564 -8.746851,9.070479 -14.353274,6.751508 z" + id="path3769" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 43.967989,-5.5753217 c -6.47521,2.678325 -9.048039,10.764942 -5.774182,18.1487427 1.488062,3.356149 14.147794,19.573045 21.233184,27.199341 0.929421,1.000374 19.897415,-22.014111 22.31973,-27.081253 4.004403,-8.3766537 -0.424746,-17.7601157 -8.92097,-18.8996984 -3.253592,-0.436398 -4.500492,-0.07194 -7.026912,2.0539017 -1.68929,1.421443 -3.6559,3.99546297 -4.370244,5.720045 l -1.298809,3.135602 -1.808523,-3.525173 c -3.351406,-6.532564 -8.746851,-9.0704787 -14.353274,-6.751508 z" + id="path3769-7" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> diff --git a/images/mask2h.svg b/images/mask2h.svg new file mode 100644 index 0000000..bbbfd71 --- /dev/null +++ b/images/mask2h.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="120" + height="48" + id="svg2"> + <defs + id="defs6" /> + <g + transform="matrix(-1,0,0,-1,60.518965,84.005001)" + id="g3974"> + <path + d="m 1.5189652,59.466486 c 0,0 27.8907368,-21.13374 27.8907368,-21.13374 0,0 28.610176,20.79031 28.610176,20.79031 l -28.331114,22.5542 c 0,0 -28.1697988,-22.21077 -28.1697988,-22.21077 z" + id="path3950" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m -56.981948,59.466486 c 0,0 27.89074,-21.13374 27.89074,-21.13374 0,0 28.61017319,20.79031 28.61017319,20.79031 l -28.33111319,22.5542 c 0,0 -28.1698,-22.21077 -28.1698,-22.21077 z" + id="path3950-6" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> diff --git a/images/mask2v.svg b/images/mask2v.svg new file mode 100644 index 0000000..f1ddb74 --- /dev/null +++ b/images/mask2v.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="48" + height="120" + id="svg2"> + <defs + id="defs6" /> + <g + transform="matrix(0,-1,1,0,-36.005001,60.518965)" + id="g3974"> + <path + d="m 1.5189652,59.466486 c 0,0 27.8907368,-21.13374 27.8907368,-21.13374 0,0 28.610176,20.79031 28.610176,20.79031 l -28.331114,22.5542 c 0,0 -28.1697988,-22.21077 -28.1697988,-22.21077 z" + id="path3950" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m -56.981948,59.466486 c 0,0 27.89074,-21.13374 27.89074,-21.13374 0,0 28.61017319,20.79031 28.61017319,20.79031 l -28.33111319,22.5542 c 0,0 -28.1698,-22.21077 -28.1698,-22.21077 z" + id="path3950-6" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> diff --git a/images/mask3h.svg b/images/mask3h.svg new file mode 100644 index 0000000..020faa3 --- /dev/null +++ b/images/mask3h.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="120" + height="48" + id="svg2"> + <defs + id="defs6" /> + <g + transform="translate(148.73194,0)" + id="g4114"> + <path + d="m -77.966154,43.01182 c -2.80382,-2.505209 -3.26578,-3.577726 -3.26578,-7.582029 0,-4.049156 0.45184,-5.067778 3.42723,-7.726288 l 3.42723,-3.06223 -4.92723,0.523177 c -2.70998,0.287747 -5.71473,0.850808 -6.67723,1.251247 -1.45469,0.605211 -1.75,0.185719 -1.75,-2.485906 0,-2.671625 0.29531,-3.091117 1.75,-2.485906 0.9625,0.400439 3.96725,0.9635 6.67723,1.251247 l 4.92723,0.523177 -3.42723,-3.06223 c -2.94188,-2.628574 -3.42723,-3.699702 -3.42723,-7.563695 0,-5.3455384 3.06933,-9.3035714 7.92034,-10.2136264 6.98014,-1.3094833 11.96427,3.484722 11.96427,11.5083644 l 0,4.721388 3.44724,-2.339359 c 5.09618,-3.458356 9.59578,-3.111725 13.76815,1.06064 3.779557,3.779557 4.297402,6.963936 1.88965,11.620016 -2.89185,5.59222 -9.74439,6.839768 -16.07585,2.926711 -3.62854,-2.242565 -3.6427,-2.243274 -2.97805,-0.149166 1.20511,3.79697 -1.23727,10.110651 -4.73658,12.244308 -4.52242,2.757492 -8.09454,2.470175 -11.93339,-0.95984 z" + id="path4090" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m -99.497715,43.01182 c 2.80382,-2.505209 3.26578,-3.577726 3.26578,-7.582029 0,-4.049156 -0.45184,-5.067778 -3.42723,-7.726288 l -3.427225,-3.06223 4.927225,0.523177 c 2.70998,0.287747 5.714731,0.850808 6.677231,1.251247 1.45469,0.605211 1.75,0.185719 1.75,-2.485906 0,-2.671625 -0.29531,-3.091117 -1.75,-2.485906 -0.9625,0.400439 -3.967251,0.9635 -6.677231,1.251247 l -4.927225,0.523177 3.427225,-3.06223 c 2.94188,-2.628574 3.42723,-3.699702 3.42723,-7.563695 0,-5.3455384 -3.06933,-9.3035714 -7.920345,-10.2136264 -6.98014,-1.309483 -11.96427,3.484722 -11.96427,11.5083644 l 0,4.721388 -3.44724,-2.339359 c -5.09618,-3.458356 -9.59578,-3.111725 -13.76815,1.06064 -3.77956,3.779557 -4.2974,6.963936 -1.88965,11.620016 2.89185,5.59222 9.74439,6.839768 16.07585,2.926711 3.62854,-2.242565 3.6427,-2.243274 2.97805,-0.149166 -1.20511,3.79697 1.23727,10.110651 4.73658,12.244308 4.52242,2.757492 8.09454,2.470175 11.933395,-0.95984 z" + id="path4090-5" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> diff --git a/images/mask3v.svg b/images/mask3v.svg new file mode 100644 index 0000000..19229ca --- /dev/null +++ b/images/mask3v.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="48" + height="120" + id="svg2"> + <defs + id="defs6" /> + <g + transform="matrix(0,-1,1,0,-2.0974456e-7,-28.731937)" + id="g4114"> + <path + d="m -77.966154,43.01182 c -2.80382,-2.505209 -3.26578,-3.577726 -3.26578,-7.582029 0,-4.049156 0.45184,-5.067778 3.42723,-7.726288 l 3.42723,-3.06223 -4.92723,0.523177 c -2.70998,0.287747 -5.71473,0.850808 -6.67723,1.251247 -1.45469,0.605211 -1.75,0.185719 -1.75,-2.485906 0,-2.671625 0.29531,-3.091117 1.75,-2.485906 0.9625,0.400439 3.96725,0.9635 6.67723,1.251247 l 4.92723,0.523177 -3.42723,-3.06223 c -2.94188,-2.628574 -3.42723,-3.699702 -3.42723,-7.563695 0,-5.3455384 3.06933,-9.3035714 7.92034,-10.2136264 6.98014,-1.3094833 11.96427,3.484722 11.96427,11.5083644 l 0,4.721388 3.44724,-2.339359 c 5.09618,-3.458356 9.59578,-3.111725 13.76815,1.06064 3.779557,3.779557 4.297402,6.963936 1.88965,11.620016 -2.89185,5.59222 -9.74439,6.839768 -16.07585,2.926711 -3.62854,-2.242565 -3.6427,-2.243274 -2.97805,-0.149166 1.20511,3.79697 -1.23727,10.110651 -4.73658,12.244308 -4.52242,2.757492 -8.09454,2.470175 -11.93339,-0.95984 z" + id="path4090" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m -99.497715,43.01182 c 2.80382,-2.505209 3.26578,-3.577726 3.26578,-7.582029 0,-4.049156 -0.45184,-5.067778 -3.42723,-7.726288 l -3.427225,-3.06223 4.927225,0.523177 c 2.70998,0.287747 5.714731,0.850808 6.677231,1.251247 1.45469,0.605211 1.75,0.185719 1.75,-2.485906 0,-2.671625 -0.29531,-3.091117 -1.75,-2.485906 -0.9625,0.400439 -3.967251,0.9635 -6.677231,1.251247 l -4.927225,0.523177 3.427225,-3.06223 c 2.94188,-2.628574 3.42723,-3.699702 3.42723,-7.563695 0,-5.3455384 -3.06933,-9.3035714 -7.920345,-10.2136264 -6.98014,-1.309483 -11.96427,3.484722 -11.96427,11.5083644 l 0,4.721388 -3.44724,-2.339359 c -5.09618,-3.458356 -9.59578,-3.111725 -13.76815,1.06064 -3.77956,3.779557 -4.2974,6.963936 -1.88965,11.620016 2.89185,5.59222 9.74439,6.839768 16.07585,2.926711 3.62854,-2.242565 3.6427,-2.243274 2.97805,-0.149166 -1.20511,3.79697 1.23727,10.110651 4.73658,12.244308 4.52242,2.757492 8.09454,2.470175 11.933395,-0.95984 z" + id="path4090-5" + style="fill:none;stroke:#0000ff;stroke-width:2;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> +</svg> @@ -81,6 +81,7 @@ def _button_press_cb(win, event, tw): win.grab_focus() x, y = map(int, event.get_coords()) tw.start_drag = [x,y] + tw.grid.hide_masks() spr = tw.sprites.find_sprite((x,y)) if spr is None: tw.press = -1 @@ -95,6 +96,7 @@ def _button_press_cb(win, event, tw): # def _button_release_cb(win, event, tw): win.grab_focus() + tw.grid.hide_masks() x, y = map(int, event.get_coords()) spr = tw.sprites.find_sprite((x,y)) if spr is None: |