From 10fa1420af78f82a0dbadc113d6f6b4bdb0fc9a6 Mon Sep 17 00:00:00 2001 From: Cristhofer Travieso Date: Wed, 22 Aug 2012 00:18:52 +0000 Subject: add time --- diff --git a/activity.py b/activity.py index 8973e2d..f6a4809 100644 --- a/activity.py +++ b/activity.py @@ -123,11 +123,19 @@ class ConvertActivity(activity.Activity): self._speed_btn.props.icon_name = 'speed' self._speed_btn.props.group = self._lenght_btn + self._time_btn = RadioToolButton() + self._time_btn.connect('clicked', + lambda w: self._update_combo(convert.time)) + self._time_btn.set_tooltip('Time') + self._time_btn.props.icon_name = 'time' + self._time_btn.props.group = self._lenght_btn + 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._weight_btn, -1) toolbarbox.toolbar.insert(self._speed_btn, -1) + toolbarbox.toolbar.insert(self._time_btn, -1) separator = gtk.SeparatorToolItem() separator.set_expand(True) diff --git a/convert.py b/convert.py index 8fe8fd4..d35039a 100644 --- a/convert.py +++ b/convert.py @@ -80,6 +80,14 @@ speed = {'Kilometers/Hour': (1, 1), 'Meter/Second': (3.59712230216, 0.278), } +time = {'day': (1, 1), 'Week': (7, 0.14285714285714285), + 'Month': (30.4375, 0.03285420944558522), + 'Year': (365.25, 0.0027378507871321013), + 'Hour': (0.041666666666666664, 24), + 'Minute': (0.0006944444444444445, 1440), + 'Second': (0.000011574074074074073, 86400) + } + def convert(number, unit, to_unit, dic): main_unit = number * dic[unit][0] diff --git a/icons/time.svg b/icons/time.svg new file mode 100644 index 0000000..932b3c3 --- /dev/null +++ b/icons/time.svg @@ -0,0 +1,74 @@ + +image/svg+xml + + + + + + + + + \ No newline at end of file -- cgit v0.9.1