Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2009-11-04 02:08:27 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2009-11-04 02:08:27 (GMT)
commit32b0c012d52ad574371f4a496e9bf5fa952e1ace (patch)
tree66c2b82d62ca15750f80b6359e13a05bccc2edc6
parentd1af87966cca28ead97433c31c6a92a15cf532fc (diff)
fixed testers
-rw-r--r--CardSortActivity.py46
-rw-r--r--NEWS4
-rwxr-xr-xcardsort.py28
-rw-r--r--grid.py9
-rw-r--r--icons/blank-in.svg83
-rw-r--r--icons/blank-out.svg87
-rw-r--r--window.py1
7 files changed, 49 insertions, 209 deletions
diff --git a/CardSortActivity.py b/CardSortActivity.py
index f3a1e3b..1f10c38 100644
--- a/CardSortActivity.py
+++ b/CardSortActivity.py
@@ -148,50 +148,80 @@ class CardSortActivity(activity.Activity):
'images/card'), \
self)
+ # Read the mode from the Journal
+ try:
+ if self.metadata['grid'] == '2x2':
+ self.show_grid2x2()
+ elif self.metadata['grid'] == '3x2':
+ self.show_grid3x2()
+ elif self.metadata['grid'] == '2x3':
+ self.show_grid2x3()
+ elif self.metadata['grid'] == '3x3':
+ self.show_grid3x3()
+ except:
+ self.metadata['grid'] = "3x3"
+
#
# Grid resize callbacks
#
def _grid2x2_cb(self, button):
+ self.show_grid2x2()
+ return True
+
+ def show_grid2x2(self):
self.grid2x2.set_icon("2x2on")
self.grid3x2.set_icon("3x2off")
self.grid2x3.set_icon("2x3off")
self.grid3x3.set_icon("3x3off")
- self.tw.mode = "2x2"
self.tw.test = self.tw.grid.test2x2
self.tw.grid.reset2x2(self.tw)
- return True
+ self.metadata['grid'] = "2x2"
def _grid3x2_cb(self, button):
+ self.show_grid3x2()
+ return True
+
+ def show_grid3x2(self):
self.grid2x2.set_icon("2x2off")
self.grid3x2.set_icon("3x2on")
self.grid2x3.set_icon("2x3off")
self.grid3x3.set_icon("3x3off")
- self.tw.mode = "3x2"
self.tw.test = self.tw.grid.test3x2
self.tw.grid.reset3x2(self.tw)
- return True
+ self.metadata['grid'] = "3x2"
def _grid2x3_cb(self, button):
+ self.show_grid2x3()
+ return True
+
+ def show_grid2x3(self):
self.grid2x2.set_icon("2x2off")
self.grid3x2.set_icon("3x2off")
self.grid2x3.set_icon("2x3on")
self.grid3x3.set_icon("3x3off")
- self.tw.mode = "2x3"
self.tw.test = self.tw.grid.test2x3
self.tw.grid.reset2x3(self.tw)
- return True
+ self.metadata['grid'] = "2x3"
def _grid3x3_cb(self, button):
+ self.show_grid3x3()
+ return True
+
+ def show_grid3x3(self):
self.grid2x2.set_icon("2x2off")
self.grid3x2.set_icon("3x2off")
self.grid2x3.set_icon("2x3off")
self.grid3x3.set_icon("3x3on")
- self.tw.mode = "3x3"
self.tw.test = self.tw.grid.test3x3
self.tw.grid.reset3x3(self.tw)
- return True
+ self.metadata['grid'] = "3x3"
+ """
+ Write the grid status to the Journal
+ """
+ def write_file(self, file_path):
+ pass
#
# Project toolbar for pre-0.86 toolbars
diff --git a/NEWS b/NEWS
index 513782f..331a02c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+4
+
+* 2x2, 3x2, 2x3 and 3x3 grids
+
3
* better handling of command-line version
diff --git a/cardsort.py b/cardsort.py
index a9c6d80..fa8e7e6 100755
--- a/cardsort.py
+++ b/cardsort.py
@@ -45,14 +45,6 @@ class CardSortMain:
self.win.connect("delete_event", lambda w,e: gtk.main_quit())
menu = gtk.Menu()
- """
- menu_items = gtk.MenuItem(_("Toggle blank card"))
- menu.append(menu_items)
- menu_items.connect("activate", self._toggle_card_cb)
- """
- menu_items = gtk.MenuItem(_("Apply rotation sets"))
- menu.append(menu_items)
- menu_items.connect("activate", self._apply_rotation_sets_cb)
menu_items = gtk.MenuItem(_("Solve it"))
menu.append(menu_items)
menu_items.connect("activate", self._solve_cb)
@@ -86,26 +78,6 @@ class CardSortMain:
def set_title(self, title):
self.win.set_title(title)
- """
- def _toggle_card_cb(self, widget):
- self.tw.grid.toggle_blank()
- sprites.redrawsprites(self.tw)
- """
-
- def _apply_rotation_sets_cb(self, widget):
- self.rotation_sets = get_rotation_sets()
- i = self.r
- for j in range(9):
- try:
- self.tw.grid.card_table[self.tw.grid.grid.index(j)]\
- .set_orientation(self.rotation_sets[i][j])
- except ValueError:
- pass
- sprites.redrawsprites(self.tw)
- self.r += 1
- if self.r == 64:
- self.r = 0
-
def _solve_cb(self, widget):
self.rotation_sets = get_rotation_sets()
counter = 0
diff --git a/grid.py b/grid.py
index bac391b..db3ccb2 100644
--- a/grid.py
+++ b/grid.py
@@ -65,6 +65,7 @@ class Grid:
self.set_orientation([0,0,0,0,0,0,0,0,0])
for i in range(9):
self.card_table[i].reload_image(tw, i)
+ self.print_grid()
# TWO_BY_TWO = ((7,5,0,3),(7,4,5,2),(1,3,5,8),(4,5,6,1))
# reset everything to initial layout
@@ -75,6 +76,7 @@ class Grid:
self.card_table[i].reload_image(tw, i)
for i in (0,2,3,7,8):
hide(self.card_table[i].spr)
+ self.print_grid()
# THREE_BY_TWO = ((7,5,0,2,4,3),(5,6,1,4,3,8))
# reset everything to initial layout
@@ -85,6 +87,7 @@ class Grid:
self.card_table[i].reload_image(tw, i)
for i in (1,6,8):
hide(self.card_table[i].spr)
+ self.print_grid()
# TWO_BY_THREE = ((5,2,4,6,1,7),(7,1,2,5,8,0))
# reset everything to initial layout
@@ -95,11 +98,13 @@ class Grid:
self.card_table[i].reload_image(tw, i)
for i in (0,3,8):
hide(self.card_table[i].spr)
+ self.print_grid()
# force a specific layout
def set_grid(self, newgrid):
x = int((self.w-(self.d*3*self.s))/2)
y = int((self.h-(self.d*3*self.s))/2)
+ j = 0
for c in newgrid:
for i in range(9):
if self.card_table[i].spr.label == c:
@@ -110,6 +115,8 @@ class Grid:
if x > (self.w+(self.d*2*self.s))/2:
x = int((self.w-(self.d*3*self.s))/2)
y += int(self.d*self.s)
+ self.grid[j] = c
+ j+=1
def set_orientation(self, neworientation):
for c in range(9):
@@ -119,8 +126,6 @@ class Grid:
# swap card a and card b
# swap their entries in the grid and the position of their sprites
def swap(self, a, b):
- self.print_grid()
- print a, b
# swap grid elements and x,y positions of sprites
# print "swapping cards " + str(a) + " and " + str(b)
ai = self.grid.index(a)
diff --git a/icons/blank-in.svg b/icons/blank-in.svg
deleted file mode 100644
index 9310287..0000000
--- a/icons/blank-in.svg
+++ /dev/null
@@ -1,83 +0,0 @@
-<?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.0"
- width="55"
- height="55"
- id="svg2">
- <defs
- id="defs4" />
- <rect
- width="55"
- height="55"
- x="0"
- y="1.4305115e-06"
- id="rect3165"
- style="opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <g
- transform="matrix(0.4284825,0,0,0.4284621,3.714231,27.720343)"
- id="g2565"
- style="fill:#eeeeee;stroke:#000000;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round">
- <path
- d="M 0.5,54.5 L 0.5,0.5 L 54.5,0.5 L 54.5,54.5 L 0.5,54.5 z"
- id="path2395"
- style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <text
- x="-41.835938"
- y="-0.50000381"
- transform="scale(-1,-1)"
- id="text3172"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#eeeeee;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="-41.835938"
- y="-0.50000381"
- id="tspan3174"
- style="fill:#eeeeee">♠</tspan></text>
- <text
- x="-41.828125"
- y="54.5"
- transform="matrix(0,-1,1,0,0,0)"
- id="text3176"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#eeeeee;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="-41.828125"
- y="54.5"
- id="tspan3178"
- style="fill:#eeeeee">♦</tspan></text>
- <text
- x="15.839355"
- y="54.500008"
- id="text3184"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="15.839355"
- y="54.500008"
- id="tspan3186"
- style="font-size:26px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans">♥</tspan></text>
- <text
- x="-41.828125"
- y="23.8125"
- transform="matrix(0,-1,1,0,0,0)"
- id="text3189"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="-41.828125"
- y="23.8125"
- id="tspan3191"
- style="fill:#000000;fill-opacity:1">♦</tspan></text>
- </g>
- <path
- d="M 27.92862,27.071429 L 27.92862,3.9285715 L 51.071478,3.9285715 L 51.071478,27.071429 L 27.92862,27.071429 z"
- id="path2578"
- style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.85714275;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 9.9762878,24.49699 C 10.225675,9.8839789 23.75674,10.566101 23.75674,10.566101"
- id="path2605"
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.01709199;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 17.314792,5.6425727 L 23.512279,10.381879 L 17.314792,5.6425727 z M 23.68133,10.546728 L 19.44832,17.277372 L 23.68133,10.546728 z"
- id="path2607"
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
-</svg>
diff --git a/icons/blank-out.svg b/icons/blank-out.svg
deleted file mode 100644
index 2db258b..0000000
--- a/icons/blank-out.svg
+++ /dev/null
@@ -1,87 +0,0 @@
-<?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.0"
- width="55"
- height="55"
- id="svg2">
- <defs
- id="defs4" />
- <rect
- width="55"
- height="55"
- x="0"
- y="0"
- id="rect3165"
- style="opacity:1;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <g
- transform="matrix(0.4284825,0,0,0.4284621,3.714231,27.720343)"
- id="g2565"
- style="fill:#eeeeee;stroke:#000000;stroke-width:3.5;stroke-linecap:round;stroke-linejoin:round">
- <path
- d="M 0.5,54.5 L 0.5,0.5 L 54.5,0.5 L 54.5,54.5 L 0.5,54.5 z"
- id="path2395"
- style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <text
- x="-41.835938"
- y="-0.50000381"
- transform="scale(-1,-1)"
- id="text3172"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#eeeeee;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="-41.835938"
- y="-0.50000381"
- id="tspan3174"
- style="fill:#eeeeee">♠</tspan></text>
- <text
- x="-41.828125"
- y="54.5"
- transform="matrix(0,-1,1,0,0,0)"
- id="text3176"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#eeeeee;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="-41.828125"
- y="54.5"
- id="tspan3178"
- style="fill:#eeeeee">♦</tspan></text>
- <text
- x="15.839355"
- y="54.500008"
- id="text3184"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="15.839355"
- y="54.500008"
- id="tspan3186"
- style="font-size:26px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans">♥</tspan></text>
- <text
- x="-41.828125"
- y="23.8125"
- transform="matrix(0,-1,1,0,0,0)"
- id="text3189"
- xml:space="preserve"
- style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:DejaVu Sans;-inkscape-font-specification:DejaVu Sans"><tspan
- x="-41.828125"
- y="23.8125"
- id="tspan3191"
- style="fill:#000000;fill-opacity:1">♦</tspan></text>
- </g>
- <path
- d="M 27.92862,27.071429 L 27.92862,3.9285715 L 51.071478,3.9285715 L 51.071478,27.071429 L 27.92862,27.071429 z"
- id="path2578"
- style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.85714275;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <g
- transform="matrix(-1,0,0,-1,54.580213,54.598511)"
- id="g3406">
- <path
- d="M 9.9762878,24.49699 C 10.225675,9.8839789 23.75674,10.566101 23.75674,10.566101"
- id="path2605"
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.01709199;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 17.314792,5.6425727 L 23.512279,10.381879 L 17.314792,5.6425727 z M 23.68133,10.546728 L 19.44832,17.277372 L 23.68133,10.546728 z"
- id="path2607"
- style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/window.py b/window.py
index de7b30e..e4d4160 100644
--- a/window.py
+++ b/window.py
@@ -76,7 +76,6 @@ def new_window(canvas, path, parent=None):
# Initialize the grid
tw.grid = Grid(tw)
- tw.mode = "3x3"
tw.test = tw.grid.test3x3
# Start solving the puzzle