summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-10-11 14:20:25 (GMT)
committerWalter Bender <walter.bender@gmail.com>2011-10-11 14:20:25 (GMT)
commitfb75fd1b14f73c4c22a63ccad0b8de5f78e95876 (patch)
treefcdb6b3bbdf6fc6f368072617990bdeb21a68d02
parentabc1e42a3daf2b7756a03a3b48fafe82b5df086e (diff)
downloadabacus-gtk3-fb75fd1b14f73c4c22a63ccad0b8de5f78e95876.tar.gz
abacus-gtk3-fb75fd1b14f73c4c22a63ccad0b8de5f78e95876.tar.xz
added button for custom abacus; added colors for custom abacus
-rw-r--r--AbacusActivity.py35
-rw-r--r--icons/custom.svg203
2 files changed, 225 insertions, 13 deletions
diff --git a/AbacusActivity.py b/AbacusActivity.py
index d00aac1..4c58412 100644
--- a/AbacusActivity.py
+++ b/AbacusActivity.py
@@ -265,6 +265,13 @@ class AbacusActivity(activity.Activity):
cb_arg='cuisenaire',
tooltip=_('Rods'), group=self.decimal)
+ _separator_factory(abacus_toolbar)
+
+ self.custom = _radio_factory('custom', abacus_toolbar,
+ self._radio_cb,
+ cb_arg='custom',
+ tooltip=_('Custom'), group=self.decimal)
+
# TRANS: Number of rods on the abacus
self._rods_label = _label_factory(_('Rods:') + ' ', custom_toolbar)
self._rods_spin = _spin_factory(15, 1, 20, self._rods_spin_cb,
@@ -289,9 +296,9 @@ class AbacusActivity(activity.Activity):
_separator_factory(custom_toolbar, False, False)
- self.custom = _button_factory('new-abacus', custom_toolbar,
- self._custom_cb,
- tooltip=_('Custom'))
+ self.custom_maker = _button_factory('new-abacus', custom_toolbar,
+ self._custom_cb,
+ tooltip=_('Custom'))
copy = _button_factory('edit-copy', edit_toolbar, self._copy_cb,
tooltip=_('Copy'), accelerator='<Ctrl>c')
@@ -359,7 +366,8 @@ class AbacusActivity(activity.Activity):
self._select_abacus('decimal')
self.decimal.set_active(True)
elif self.metadata['abacus'] == 'custom':
- self._custom_cb()
+ self._select_abacus('custom')
+ self.custom.set_active(True)
if 'value' in self.metadata:
_logger.debug('restoring value %s', self.metadata['value'])
self.abacus.mode.set_value(self.metadata['value'])
@@ -376,6 +384,8 @@ class AbacusActivity(activity.Activity):
''' Display the selected abacus; hide the others '''
if not hasattr(self, 'abacus'):
return
+ if abacus == 'custom' and self.abacus.custom is None:
+ self._custom_cb()
self.abacus.select_abacus(abacus)
def _rods_spin_cb(self, button=None):
@@ -399,15 +409,14 @@ class AbacusActivity(activity.Activity):
if self.abacus.custom is not None:
self.abacus.custom.hide()
self.abacus.custom = Custom(self.abacus,
- self._rods_spin.get_value_as_int(),
- self._top_spin.get_value_as_int(),
- self._bottom_spin.get_value_as_int(),
- self._value_spin.get_value_as_int(),
- self._base_spin.get_value_as_int())
- self._select_abacus(self.abacus.custom)
- self.abacus.mode.reset_abacus()
- self.abacus.mode.set_value_from_number(value)
- self.abacus.mode.label(self.abacus.generate_label())
+ self._rods_spin.get_value_as_int(),
+ self._top_spin.get_value_as_int(),
+ self._bottom_spin.get_value_as_int(),
+ self._value_spin.get_value_as_int(),
+ self._base_spin.get_value_as_int(),
+ self.bead_colors)
+
+ self.abacus.select_abacus('custom')
def _copy_cb(self, arg=None):
''' Copy a number to the clipboard from the active abacus. '''
diff --git a/icons/custom.svg b/icons/custom.svg
new file mode 100644
index 0000000..90c21f2
--- /dev/null
+++ b/icons/custom.svg
@@ -0,0 +1,203 @@
+<?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="45"
+ height="45"
+ id="svg2">
+ <metadata
+ id="metadata44">
+ <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>
+ <defs
+ id="defs41" />
+ <rect
+ width="37.959229"
+ height="43"
+ x="-41.479614"
+ y="1"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="rect4"
+ style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2" />
+ <line
+ y1="16.5"
+ y2="16.5"
+ x1="44.18692"
+ x2="1.2540125"
+ style="fill:#aaaaaa;stroke:#000000;stroke-width:2"
+ id="line10-4" />
+ <g
+ transform="translate(0,0.06685352)"
+ id="g2971">
+ <line
+ id="line10-68"
+ style="fill:#aaaaaa;stroke:#000000;stroke-width:2;stroke-miterlimit:0;stroke-dasharray:none"
+ x2="6.7392497"
+ x1="6.7392497"
+ y2="4.2606754"
+ y1="40.605618" />
+ <path
+ d="m 10.73925,26.747115 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,30.676521 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,34.605927 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-5-6"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,38.535333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,6.1059274 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2-7"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,10.035333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6-6"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,22.816439 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49-6"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ </g>
+ <g
+ transform="translate(10.448677,0.06685352)"
+ id="g2971-9">
+ <line
+ id="line10-68-3"
+ style="fill:#aaaaaa;stroke:#000000;stroke-width:2;stroke-miterlimit:0;stroke-dasharray:none"
+ x2="6.7392497"
+ x1="6.7392497"
+ y2="4.2606754"
+ y1="40.605618" />
+ <path
+ d="m 10.73925,26.747115 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2-74"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,30.676521 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6-5"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,34.605927 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-5-6-2"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,38.535333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49-5"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,6.1059274 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2-7-4"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,10.035333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6-6-7"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,22.816439 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49-6-4"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ </g>
+ <g
+ transform="translate(20.897353,0.06685352)"
+ id="g2971-3">
+ <line
+ id="line10-68-0"
+ style="fill:#aaaaaa;stroke:#000000;stroke-width:2;stroke-miterlimit:0;stroke-dasharray:none"
+ x2="6.7392497"
+ x1="6.7392497"
+ y2="4.2606754"
+ y1="40.605618" />
+ <path
+ d="m 10.73925,26.747115 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2-78"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,30.676521 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6-68"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,34.605927 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-5-6-8"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,38.535333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49-4"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,6.1059274 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2-7-3"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,10.035333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6-6-1"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,22.816439 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49-6-49"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ </g>
+ <g
+ transform="translate(31.346028,0.06685352)"
+ id="g2971-0">
+ <line
+ id="line10-68-6"
+ style="fill:#aaaaaa;stroke:#000000;stroke-width:2;stroke-miterlimit:0;stroke-dasharray:none"
+ x2="6.7392497"
+ x1="6.7392497"
+ y2="4.2606754"
+ y1="40.605618" />
+ <path
+ d="m 10.73925,26.747115 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2-8"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,30.676521 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6-9"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,34.605927 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-5-6-26"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,38.535333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49-64"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,6.1059274 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-2-7-9"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,10.035333 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-7-6-6-5"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ <path
+ d="m 10.73925,22.816439 a 4,1.9646672 0 0 1 -8,0 4,1.9646672 0 1 1 8,0 z"
+ id="path3633-3-49-6-0"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
+ </g>
+ <path
+ d="m 22.51346,10.993068 c -1.10877,0 -2.018763,0.909992 -2.018763,2.018761 l 0,4.629689 -3.283849,-3.283849 c -0.784855,-0.783184 -2.043082,-0.78485 -2.826264,0 -0.783183,0.784854 -0.784823,2.069998 0,2.85318 l 3.310766,3.28385 -4.683521,0 c -1.10877,0 -2.018762,0.909991 -2.018762,2.018762 0,1.108769 0.909992,1.991843 2.018762,1.991843 l 4.656605,0 -3.28385,3.283849 c -0.783182,0.784854 -0.784823,2.069999 0,2.85318 0.784855,0.783182 2.07,0.757938 2.85318,-0.02692 l 3.256933,-3.283849 0,4.683524 c 0,1.10877 0.909993,1.991844 2.018763,1.991844 1.108769,0 1.991843,-0.883074 1.991843,-1.991844 l 0,-4.71044 3.337682,3.310765 c 0.784853,0.783182 2.043082,0.784855 2.826262,0 0.783182,-0.784853 0.784858,-2.043082 0,-2.826262 l -3.310765,-3.28385 4.656607,0 c 1.10877,0 1.991844,-0.883074 1.991844,-1.991843 0,-1.108771 -0.883074,-2.018763 -1.991844,-2.018763 l -4.683523,0 3.310765,-3.337683 c 0.783182,-0.784854 0.784857,-2.016165 0,-2.799347 -0.784854,-0.78318 -2.043082,-0.811775 -2.826263,-0.02691 l -3.310766,3.337682 0,-4.656604 c 0,-1.10877 -0.883074,-2.018763 -1.991843,-2.018763 z"
+ id="rect3894"
+ style="fill:#ffffff;fill-opacity:1;stroke:#282828;stroke-width:1.72267997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+</svg>