diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-08-24 14:27:38 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-09-25 12:11:07 (GMT) |
commit | 69b9e20d446097e6e8b8370acb322cbace96904a (patch) | |
tree | 9c1656db1c5933a06d76a312c37b7c0ea0d6a672 | |
parent | 79fab7939ce2c50d54a9ba25f1bda1ff4204aff8 (diff) |
Use RadioMenuButton instead ComboBox to change the board size
ComboBox doesn't work properly and this have a bad impact on touch
screen. We decided to use RadioMenuButton instead of ComboBox because
it make easier changing the board size.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
-rw-r--r-- | icons/4 X 4.svg | 88 | ||||
-rw-r--r-- | icons/5 X 5.svg | 88 | ||||
-rw-r--r-- | icons/6 X 6.svg | 88 | ||||
-rw-r--r-- | icons/change_size.svg | 88 | ||||
-rw-r--r-- | memorizetoolbar.py | 16 |
5 files changed, 361 insertions, 7 deletions
diff --git a/icons/4 X 4.svg b/icons/4 X 4.svg new file mode 100644 index 0000000..68c8551 --- /dev/null +++ b/icons/4 X 4.svg @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<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" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="42" + height="42" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + version="1.0" + sodipodi:docname="4 X 4.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="8.65364" + inkscape:cx="1.7881141" + inkscape:cy="16.282349" + inkscape:document-units="px" + inkscape:current-layer="layer1" + width="42px" + height="42px" + inkscape:window-width="1152" + inkscape:window-height="740" + inkscape:window-x="151" + inkscape:window-y="307" + showgrid="false" + inkscape:window-maximized="0" /> + <metadata + id="metadata7"> + <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 + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect7017" + width="30.046175" + height="30.046175" + x="9.9769115" + y="1.9769124" + ry="4.5299301" /> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect3133" + width="30.046175" + height="30.046175" + x="1.9769125" + y="9.9769125" + ry="4.5299301" /> + <text + xml:space="preserve" + style="font-size:28.78175545px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" + x="7.9494867" + y="35.491005" + id="text3009" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3011" + x="7.9494867" + y="35.491005" + style="fill:#ffffff;stroke:none">4</tspan></text> + </g> +</svg> diff --git a/icons/5 X 5.svg b/icons/5 X 5.svg new file mode 100644 index 0000000..b5cff16 --- /dev/null +++ b/icons/5 X 5.svg @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<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" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="42" + height="42" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + version="1.0" + sodipodi:docname="4 X 4.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="8.65364" + inkscape:cx="1.7881141" + inkscape:cy="16.282349" + inkscape:document-units="px" + inkscape:current-layer="layer1" + width="42px" + height="42px" + inkscape:window-width="1152" + inkscape:window-height="740" + inkscape:window-x="151" + inkscape:window-y="307" + showgrid="false" + inkscape:window-maximized="0" /> + <metadata + id="metadata7"> + <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 + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect7017" + width="30.046175" + height="30.046175" + x="9.9769115" + y="1.9769124" + ry="4.5299301" /> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect3133" + width="30.046175" + height="30.046175" + x="1.9769125" + y="9.9769125" + ry="4.5299301" /> + <text + xml:space="preserve" + style="font-size:28.78175545px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" + x="7.9494867" + y="35.491005" + id="text3009" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3011" + x="7.9494867" + y="35.491005" + style="fill:#ffffff;stroke:none">5</tspan></text> + </g> +</svg> diff --git a/icons/6 X 6.svg b/icons/6 X 6.svg new file mode 100644 index 0000000..cda5de9 --- /dev/null +++ b/icons/6 X 6.svg @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<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" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="42" + height="42" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + version="1.0" + sodipodi:docname="5 X 5.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="8.65364" + inkscape:cx="1.7881141" + inkscape:cy="16.282349" + inkscape:document-units="px" + inkscape:current-layer="layer1" + width="42px" + height="42px" + inkscape:window-width="1152" + inkscape:window-height="740" + inkscape:window-x="151" + inkscape:window-y="307" + showgrid="false" + inkscape:window-maximized="0" /> + <metadata + id="metadata7"> + <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 + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect7017" + width="30.046175" + height="30.046175" + x="9.9769115" + y="1.9769124" + ry="4.5299301" /> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect3133" + width="30.046175" + height="30.046175" + x="1.9769125" + y="9.9769125" + ry="4.5299301" /> + <text + xml:space="preserve" + style="font-size:28.78175545px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" + x="7.9494867" + y="35.491005" + id="text3009" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3011" + x="7.9494867" + y="35.491005" + style="fill:#ffffff;stroke:none">6</tspan></text> + </g> +</svg> diff --git a/icons/change_size.svg b/icons/change_size.svg new file mode 100644 index 0000000..0336d4b --- /dev/null +++ b/icons/change_size.svg @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<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" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="42" + height="42" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + version="1.0" + sodipodi:docname="change_size.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10000" + guidetolerance="10" + objecttolerance="10" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="8.65364" + inkscape:cx="2.1138261" + inkscape:cy="16.282349" + inkscape:document-units="px" + inkscape:current-layer="layer1" + width="42px" + height="42px" + inkscape:window-width="1152" + inkscape:window-height="740" + inkscape:window-x="151" + inkscape:window-y="307" + showgrid="false" + inkscape:window-maximized="0" /> + <metadata + id="metadata7"> + <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 + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect7017" + width="30.046175" + height="30.046175" + x="9.9769115" + y="1.9769124" + ry="4.5299301" /> + <rect + style="fill:#4c4d4f;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:3.5;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="rect3133" + width="30.046175" + height="30.046175" + x="1.9769125" + y="9.9769125" + ry="4.5299301" /> + <text + xml:space="preserve" + style="font-size:28.78175545px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" + x="9.333766" + y="35.680729" + id="text3009" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan3011" + x="9.333766" + y="35.680729" + style="fill:#ffffff;stroke:none">?</tspan></text> + </g> +</svg> diff --git a/memorizetoolbar.py b/memorizetoolbar.py index c7e4366..916c0d4 100644 --- a/memorizetoolbar.py +++ b/memorizetoolbar.py @@ -67,14 +67,16 @@ class MemorizeToolbarBuilder(gobject.GObject): self.toolbar.insert(self._demo_games, -1) # Change size combobox - self._size_combo = ToolComboBox() + self._size_combo = RadioMenuButton(icon_name='change_size') + self._size_combo.props.tooltip = _('Change size') self._sizes = ['4 X 4', '5 X 5', '6 X 6'] + for i, f in enumerate(self._sizes): - self._size_combo.combo.append_item(i, f) - self.size_handle_id = self._size_combo.combo.connect( \ - 'changed', self._game_size_cb) + menu_item = MenuItem(f, icon_name=self._sizes[i]) + menu_item.connect('activate', self._game_size_cb, i) + self._size_combo.props.palette.menu.append(menu_item) + menu_item.show() self.toolbar.insert(self._size_combo, -1) - self._size_combo.combo.set_active(0) # Reset Button self._restart_button = ToolButton('game-new') @@ -92,8 +94,8 @@ class MemorizeToolbarBuilder(gobject.GObject): self._demo_games.set_sensitive(active) self._restart_button.set_sensitive(active) - def _game_size_cb(self, widget): - game_size = int(self._sizes[self._size_combo.combo.get_active()][0]) + def _game_size_cb(self, widget, i): + game_size = int(self._sizes[i][0]) self.emit('game_changed', None, game_size, 'size', None, None) def __activate_game_cb(self, menu, i): |