From 206ca048f6509844e440927275d2549eca9a555d Mon Sep 17 00:00:00 2001 From: Cristhofer Travieso Date: Thu, 05 Jul 2012 09:31:24 +0000 Subject: renplase el icono de la actividad y raduci a ingles las unidades que me faltaban --- diff --git a/activity.py b/activity.py index 9264e74..d6d9bc3 100644 --- a/activity.py +++ b/activity.py @@ -27,7 +27,7 @@ from sugar.activity.widgets import ActivityToolbarButton from sugar.graphics.toolbarbox import ToolbarBox from sugar.graphics.radiotoolbutton import RadioToolButton -class Activity(activity.Activity): +class ConvertActivity(activity.Activity): def __init__(self, handle): activity.Activity.__init__(self, handle, True) @@ -44,14 +44,14 @@ class Activity(activity.Activity): # RadioToolButton self._long_btn = RadioToolButton() - self._long_btn.connect("clicked", self.update_combo, "long") - self._long_btn.set_tooltip("long") - self._long_btn.props.icon_name = "long" + self._long_btn.connect("clicked", self.update_combo, "lenght") + self._long_btn.set_tooltip("lenght") + self._long_btn.props.icon_name = "lenght" self._vol_btn = RadioToolButton() - self._vol_btn.connect("clicked", self.update_combo, "vol") - self._vel_btn.set_tooltip("vol") - self._vol_btn.props.icon_name = "vol" + 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._area_btn = RadioToolButton() @@ -67,9 +67,9 @@ class Activity(activity.Activity): self._peso_btn.props.group = self._long_btn self._vel_btn = RadioToolButton() - self._vel_btn.connect("clicked", self.update_combo, "vel") - self._vel_btn.set_tooltip("vel") - self._vel_btn.props.icon_name = "vel" + 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._time_btn = RadioToolButton() @@ -110,6 +110,11 @@ class Activity(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): gtk.VBox.__init__(self) @@ -123,15 +128,11 @@ class Canvas(gtk.VBox): self.combo2 = gtk.ComboBox() self.table.attach(self.combo2, 3, 4, 0, 1) - adjustment = gtk.Adjustment(value=1.0, lower=0.0, upper=0.0, - step_incr=0.5, page_incr=1.0, - page_size=0.0) - self.spin_btn1 = gtk.SpinButton(adjustment, 1.0, 0) + 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_btn2 = gtk.SpinButton(adjustment, 1.0, 0) - self.table.attach(self.spin_btn2, 3, 4, 1, 2) + adjustment = gtk.Adjustment(1.0, 0.1, 1000, 0.1, 0.1, 0.1) - def update_combo(self, widget, data): - self.combo1.set_popdown_strings(convert.return_list(data)) - self.combo2.set_popdown_strings(convert.return_list(data)) + self.spin_btn2 = gtk.SpinButton(adjustment, 1.0, 1) + self.table.attach(self.spin_btn2, 3, 4, 1, 2) diff --git a/activity/activity.info b/activity/activity.info index 7c54ee4..e91d21f 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -3,6 +3,6 @@ name = Convert activity_version = 1 show_launcher = 1 bundle_id = org.ceibaljam.Convert -exec = sugar-activity Activity.Activity -s +exec = sugar-activity activity.ConvertActivity -s icon = icon license = GPLv3+ diff --git a/activity/activity.info~ b/activity/activity.info~ deleted file mode 100644 index cad9111..0000000 --- a/activity/activity.info~ +++ /dev/null @@ -1,8 +0,0 @@ -[Activity] -name = Converter -activity_version = 1 -show_launcher = 1 -bundle_id = org.ceibaljam.Converter -exec = sugar-activity Activity.Activity -s -icon = icon -license = GPLv3+ diff --git a/activity/icon.svg b/activity/icon.svg index 9c8942f..77d6a99 100644 --- a/activity/icon.svg +++ b/activity/icon.svg @@ -7,12 +7,84 @@ 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" - width="210mm" - height="297mm" - id="svg2"> + inkscape:version="0.47 r22583" + sodipodi:docname="convert.svg"> + id="defs4"> + + + + + + + + + @@ -21,53 +93,45 @@ image/svg+xml - + - + inkscape:label="Capa 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-997.36218)"> + sodipodi:type="arc" + style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="path3715" + sodipodi:cx="11.936339" + sodipodi:cy="32.453583" + sodipodi:rx="6.8965516" + sodipodi:ry="7.4270558" + d="m 18.832891,32.453583 c 0,4.101849 -3.087691,7.427056 -6.896552,7.427056 -3.8088599,0 -6.8965512,-3.325207 -6.8965512,-7.427056 0,-4.10185 3.0876913,-7.427056 6.8965512,-7.427056 3.808861,0 6.896552,3.325206 6.896552,7.427056 z" + transform="translate(-2.6525199,997.09693)" /> + transform="translate(33.822215,995.95722)" + sodipodi:type="arc" + style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + id="path3715-1" + sodipodi:cx="11.936339" + sodipodi:cy="32.453583" + sodipodi:rx="6.8965516" + sodipodi:ry="7.4270558" + d="m 18.832891,32.453583 c 0,4.101849 -3.087691,7.427056 -6.896552,7.427056 -3.8088599,0 -6.8965512,-3.325207 -6.8965512,-7.427056 0,-4.10185 3.0876913,-7.427056 6.8965512,-7.427056 3.808861,0 6.896552,3.325206 6.896552,7.427056 z" /> + style="fill:#ffffff;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" + d="M 9.5490721,18.129974 C 18.742165,16.843962 28.832408,11.371249 36.07427,19.190982 l -3.448275,3.713527 9.283819,10e-7 3.183024,-9.814324 -5.039787,3.713528 C 29.885058,8.2785342 19.717065,13.624849 9.5490721,18.129974 z" + id="path3739" + transform="translate(0,997.36218)" + sodipodi:nodetypes="ccccccc" /> - - - - + style="fill:#000000;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" + d="m 46.023806,1045.3826 c -9.193093,1.286 -19.283336,6.7587 -26.525198,-1.061 l 3.448275,-3.7135 -9.283819,0 -3.183024,9.8143 5.039787,-3.7135 c 10.167993,8.5251 20.335986,3.1788 30.503979,-1.3263 z" + id="path3739-9" + sodipodi:nodetypes="ccccccc" /> diff --git a/convert.py b/convert.py index 84efda4..dba63d5 100644 --- a/convert.py +++ b/convert.py @@ -15,47 +15,66 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# adic_long with this program; if not, write to the Free Software +# alenght with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA dic = {} -dic_long = {"Metro": 1, "Yarda": 1.09361, "Pie": 3.28084, "Brazas": 0.5468} -vol = {} +lenght = {"Metro": 1, "Yarda": 1.09361, "Pie": 3.28084, "Brazas": 0.5468} +speed = {} area = {} -peso = {} -vel = {} +weight = {} +volume = {} time = {} -def convert(number, uni1, uni2, type_u): - if type_u == "dic_long": - dic = dic_long - elif type_u == "vol": - dic = vol - elif type_u == "area": - dic = area - elif type_u == "peso": - dic = peso - elif type_u == "vel": - dic = vel - elif type_u == "time": - dic = time - unidad = number * dic[uni1] +def conver_lenght(number, unit, to_unit): + + _unit = number * lenght[unit] + return _unit * lenght[unit] + + +def conver_time(number, unit, to_unit): + + _unit = number * time[unit] + return _unit * time[unit] + + +def conver_volume(number, unit, to_unit): + + _unit = number * volume[unit] + return _unit * volume[unit] + + +def conver_area(number, unit, to_unit): + + _unit = number * area[unit] + return _unit * area[unit] + + +def conver_weight(number, unit, to_unit): + + _unit = number * weight[unit] + return _unit * weight[unit] + + +def conver_speed(number, unit, to_unit): + + _unit = number * speed[unit] + return _unit * speed[unit] - return unidad * dic[uni2] def return_list(type_u): - if type_u == "dic_long": - dic = dic_long - elif type_u == "vol": - dic = vol + if type_u == "lenght": + dic = lenght + elif type_u == "volume": + dic = volume elif type_u == "area": dic = area - elif type_u == "peso": - dic = peso - elif type_u == "vel": - dic = vel + elif type_u == "weight": + dic = weight + elif type_u == "speed": + dic = speed elif type_u == "time": dic = time -- cgit v0.9.1