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-09 20:44:43 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2012-07-09 20:44:43 (GMT)
commit05487f0d9aa81449c830a5337d4a0d4a6c9263a8 (patch)
tree7ae46ac47884ae9b58a1b65f0cd368deee145800
parent2e4b6d3c260f152c139ccf2a53215c6682515d97 (diff)
hize que se muestre la imagen del boton flip_btn y agregue una label nueva llamada label_info
-rw-r--r--activity.py39
-rw-r--r--to.svg (renamed from icons/to.svg)0
2 files changed, 21 insertions, 18 deletions
diff --git a/activity.py b/activity.py
index ed5086f..7d14b3c 100644
--- a/activity.py
+++ b/activity.py
@@ -25,7 +25,6 @@ from sugar.activity import activity
from sugar.activity.widgets import StopButton
from sugar.activity.widgets import ActivityToolbarButton
from sugar.graphics.toolbarbox import ToolbarBox
-from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.radiotoolbutton import RadioToolButton
dic = {}
@@ -37,7 +36,7 @@ area = {}
weight = {}
volume = {}
time = {}
-
+temp = {}
class ConvertActivity(activity.Activity):
def __init__(self, handle):
@@ -56,42 +55,42 @@ class ConvertActivity(activity.Activity):
# RadioToolButton
self._lenght_btn = RadioToolButton()
- self._lenght_btn.connect("clicked", self.update_combo, "lenght")
+ self._lenght_btn.connect("clicked", Canvas.update_combo, lenght)
self._lenght_btn.set_tooltip("lenght")
self._lenght_btn.props.icon_name = "lenght"
self._volume_btn = RadioToolButton()
- self._volume_btn.connect("clicked", self.update_combo, "volume")
+ self._volume_btn.connect("clicked", Canvas.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.connect("clicked", Canvas.update_combo, area)
self._area_btn.set_tooltip("area")
self._area_btn.props.icon_name = "area"
self._area_btn.props.group = self._lenght_btn
self._weight_btn = RadioToolButton()
- self._weight_btn.connect("clicked", self.update_combo, "peso")
+ self._weight_btn.connect("clicked", Canvas.update_combo, weight)
self._weight_btn.set_tooltip("peso")
self._weight_btn.props.icon_name = "weight"
self._weight_btn.props.group = self._lenght_btn
self._speed_btn = RadioToolButton()
- self._speed_btn.connect("clicked", self.update_combo, "speed")
+ self._speed_btn.connect("clicked", Canvas.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.connect("clicked", Canvas.update_combo, time)
self._time_btn.set_tooltip("time")
self._time_btn.props.icon_name = "time"
self._time_btn.props.group = self._lenght_btn
self._temp_btn = RadioToolButton()
- self._temp_btn.connect("clicked", self.update_combo, "temp")
+ self._temp_btn.connect("clicked", Canvas.update_combo, temp)
self._temp_btn.props.icon_name = "temp"
self._temp_btn.props.group = self._lenght_btn
self._temp_btn.set_tooltip("temperature")
@@ -121,10 +120,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))
-
class Canvas(gtk.VBox):
def __init__(self):
@@ -136,7 +131,7 @@ class Canvas(gtk.VBox):
hbox.pack_start(self.combo1, False, True, 2)
flip_btn = gtk.Button()
flip_image = gtk.Image()
- flip_image.set_from_file("/icon/to")
+ flip_image.set_from_file("to.svg")
flip_btn.add(flip_image)
hbox.pack_start(flip_btn, True, False)
self.combo2 = gtk.ComboBox()
@@ -148,11 +143,19 @@ class Canvas(gtk.VBox):
spin_box.pack_start(self.spin_btn, True, False)
self.pack_start(spin_box, False, False, 5)
- label = gtk.Label("000")
- label.modify_font(pango.FontDescription('120'))
+ label = gtk.Label(str(self.spin_btn.get_value()) + " ~ 000")
+ label.modify_font(pango.FontDescription('80'))
self.pack_start(label, True, True, 5)
+ label_info = gtk.Label(" Convert \n000 x 000 = 000")
+ self.pack_start(label_info, True, True, 5)
+
+ def update_combo(self, wifget, data):
+ for x in data.key():
+ self.combo1.append_text(x)
+ self.combo2.append_text(x)
+
-def convert(number, unit, to_unit):
- _unit = number * dic[unit]
+def convert(_number, unit, to_unit):
+ _unit = _number * dic[unit]
return _unit * dic[to_unit]
diff --git a/icons/to.svg b/to.svg
index 7f310a6..7f310a6 100644
--- a/icons/to.svg
+++ b/to.svg