From 7e830159e2c873fa9f1d3a7b8d244451cfa8f56b Mon Sep 17 00:00:00 2001 From: Cristhofer Travieso Date: Thu, 05 Jul 2012 11:37:18 +0000 Subject: Canbie un spinbtn por una label y agrege un btn para invertir --- 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 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + -- cgit v0.9.1