Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2012-07-05 11:37:18 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2012-07-05 11:37:18 (GMT)
commit7e830159e2c873fa9f1d3a7b8d244451cfa8f56b (patch)
treec347357382e44e564eebb902974c61180ea9ec2e
parentb9c22c8e1d80aa9f2f9ecfd029184a849f01c8a7 (diff)
Canbie un spinbtn por una label y agrege un btn para invertir
-rw-r--r--activity.py65
-rw-r--r--convert.py29
-rw-r--r--icons/to.svg78
3 files changed, 125 insertions, 47 deletions
diff --git a/activity.py b/activity.py
index d6d9bc3..415df70 100644
--- a/activity.py
+++ b/activity.py
@@ -43,52 +43,52 @@ class ConvertActivity(activity.Activity):
toolbarbox.toolbar.insert(separator, -1)
# RadioToolButton
- self._long_btn = RadioToolButton()
- self._long_btn.connect("clicked", self.update_combo, "lenght")
- self._long_btn.set_tooltip("lenght")
- self._long_btn.props.icon_name = "lenght"
+ self._lenght_btn = RadioToolButton()
+ self._lenght_btn.connect("clicked", self.update_combo, "lenght")
+ self._lenght_btn.set_tooltip("lenght")
+ self._lenght_btn.props.icon_name = "lenght"
- self._vol_btn = RadioToolButton()
- self._vol_btn.connect("clicked", self.update_combo, "volume")
- self._vol_btn.set_tooltip("volume")
- self._vol_btn.props.icon_name = "volume"
- self._vol_btn.props.group = self._long_btn
+ self._volume_btn = RadioToolButton()
+ self._volume_btn.connect("clicked", self.update_combo, "volume")
+ self._volume_btn.set_tooltip("volume")
+ self._volume_btn.props.icon_name = "volume"
+ self._volume_btn.props.group = self._lenght_btn
self._area_btn = RadioToolButton()
self._area_btn.connect("clicked", self.update_combo, "area")
self._area_btn.set_tooltip("area")
self._area_btn.props.icon_name = "area"
- self._area_btn.props.group = self._long_btn
+ self._area_btn.props.group = self._lenght_btn
- self._peso_btn = RadioToolButton()
- self._peso_btn.connect("clicked", self.update_combo, "peso")
- self._peso_btn.set_tooltip("peso")
- self._peso_btn.props.icon_name = "peso"
- self._peso_btn.props.group = self._long_btn
+ self._weight_btn = RadioToolButton()
+ self._weight_btn.connect("clicked", self.update_combo, "peso")
+ self._weight_btn.set_tooltip("peso")
+ self._weight_btn.props.icon_name = "weight"
+ self._weight_btn.props.group = self._lenght_btn
- self._vel_btn = RadioToolButton()
- self._vel_btn.connect("clicked", self.update_combo, "speed")
- self._vel_btn.set_tooltip("speed")
- self._vel_btn.props.icon_name = "speed"
- self._vel_btn.props.group = self._long_btn
+ self._speed_btn = RadioToolButton()
+ self._speed_btn.connect("clicked", self.update_combo, "speed")
+ self._speed_btn.set_tooltip("speed")
+ self._speed_btn.props.icon_name = "speed"
+ self._speed_btn.props.group = self._lenght_btn
self._time_btn = RadioToolButton()
self._time_btn.connect("clicked", self.update_combo, "time")
self._time_btn.set_tooltip("time")
self._time_btn.props.icon_name = "time"
- self._time_btn.props.group = self._long_btn
+ self._time_btn.props.group = self._lenght_btn
self._temp_btn = RadioToolButton()
self._temp_btn.connect("clicked", self.update_combo, "temp")
self._temp_btn.props.icon_name = "temp"
- self._temp_btn.props.group = self._long_btn
- self._temp_btn.set_tooltip("temp")
+ self._temp_btn.props.group = self._lenght_btn
+ self._temp_btn.set_tooltip("temperature")
- toolbarbox.toolbar.insert(self._long_btn, -1)
- toolbarbox.toolbar.insert(self._vol_btn, -1)
+ toolbarbox.toolbar.insert(self._lenght_btn, -1)
+ toolbarbox.toolbar.insert(self._volume_btn, -1)
toolbarbox.toolbar.insert(self._area_btn, -1)
- toolbarbox.toolbar.insert(self._peso_btn, -1)
- toolbarbox.toolbar.insert(self._vel_btn, -1)
+ toolbarbox.toolbar.insert(self._weight_btn, -1)
+ toolbarbox.toolbar.insert(self._speed_btn, -1)
toolbarbox.toolbar.insert(self._time_btn, -1)
#
@@ -109,7 +109,6 @@ class ConvertActivity(activity.Activity):
self.show_all()
-
def update_combo(self, widget, data):
self.combo1.set_popdown_strings(convert.return_list(data))
self.combo2.set_popdown_strings(convert.return_list(data))
@@ -129,10 +128,10 @@ class Canvas(gtk.VBox):
self.table.attach(self.combo2, 3, 4, 0, 1)
adjustment = gtk.Adjustment(1.0, 0.1, 1000, 0.1, 0.1, 0.1)
- self.spin_btn1 = gtk.SpinButton(adjustment, 1.0, 1)
- self.table.attach(self.spin_btn1, 1, 2, 1, 2)
+ self.spin_btn = gtk.SpinButton(adjustment, 1.0, 1)
+ self.table.attach(self.spin_btn, 1, 2, 1, 2)
- adjustment = gtk.Adjustment(1.0, 0.1, 1000, 0.1, 0.1, 0.1)
+ self.Flip_btn = gtk.Button()
+ self.table.attach(self.Flit_btn, 2, 3, 1, 2)
- self.spin_btn2 = gtk.SpinButton(adjustment, 1.0, 1)
- self.table.attach(self.spin_btn2, 3, 4, 1, 2)
+ self.table.attach(gtk.Label("x"), 3, 4, 1, 2)
diff --git a/convert.py b/convert.py
index dba63d5..484daa6 100644
--- a/convert.py
+++ b/convert.py
@@ -20,7 +20,8 @@
dic = {}
-lenght = {"Metro": 1, "Yarda": 1.09361, "Pie": 3.28084, "Brazas": 0.5468}
+lenght = {"Metro": 1, "Km": 1000, "cm": 0.01, "Yarda": 1.09361, "Pie": 3.28084,
+ "Brazas": 0.5468}
speed = {}
area = {}
weight = {}
@@ -28,40 +29,40 @@ volume = {}
time = {}
-def conver_lenght(number, unit, to_unit):
+def convert_lenght(number, unit, to_unit):
_unit = number * lenght[unit]
- return _unit * lenght[unit]
+ return _unit * lenght[to_unit]
-def conver_time(number, unit, to_unit):
+def convert_time(number, unit, to_unit):
_unit = number * time[unit]
- return _unit * time[unit]
+ return _unit * time[to_unit]
-def conver_volume(number, unit, to_unit):
+def convert_volume(number, unit, to_unit):
_unit = number * volume[unit]
- return _unit * volume[unit]
+ return _unit * volume[to_unit]
-def conver_area(number, unit, to_unit):
+def convert_area(number, unit, to_unit):
_unit = number * area[unit]
- return _unit * area[unit]
+ return _unit * area[to_unit]
-def conver_weight(number, unit, to_unit):
+def convert_weight(number, unit, to_unit):
_unit = number * weight[unit]
- return _unit * weight[unit]
+ return _unit * weight[to_unit]
-def conver_speed(number, unit, to_unit):
+def convert_speed(number, unit, to_unit):
- _unit = number * speed[unit]
- return _unit * speed[unit]
+ _unit = number * speed[to_unit]
+ return _unit * speed[to_unit]
def return_list(type_u):
diff --git a/icons/to.svg b/icons/to.svg
new file mode 100644
index 0000000..7f310a6
--- /dev/null
+++ b/icons/to.svg
@@ -0,0 +1,78 @@
+<?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"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="55"
+ height="55"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:docname="New document 1">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.634649"
+ inkscape:cx="-31.223896"
+ inkscape:cy="30.590147"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1200"
+ inkscape:window-height="804"
+ inkscape:window-x="0"
+ inkscape:window-y="30"
+ inkscape:window-maximized="1" />
+ <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"
+ transform="translate(0,-997.36218)">
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 11.766273,18.182952 34.160148,0 -4.934244,-4.554686"
+ id="path2985"
+ inkscape:connector-curvature="0"
+ transform="translate(0,997.36218)" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 46.305978,18.562509 -5.313801,3.795572"
+ id="path2997"
+ inkscape:connector-curvature="0"
+ transform="translate(0,997.36218)" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 47.254871,1034.7128 -34.160148,0 4.934244,-4.5547"
+ id="path2985-6"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 12.715166,1035.0923 5.313801,3.7956"
+ id="path2997-9"
+ inkscape:connector-curvature="0" />
+ </g>
+</svg>