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-08-22 00:18:52 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2012-08-22 00:18:52 (GMT)
commit10fa1420af78f82a0dbadc113d6f6b4bdb0fc9a6 (patch)
tree9ec62b57ec5b6e6291096a18b846b5a93afe6296
parent7ba762de6cb34b6a89e7f9a8dcd40e813f28ce03 (diff)
add time
-rw-r--r--activity.py8
-rw-r--r--convert.py8
-rw-r--r--icons/time.svg74
3 files changed, 90 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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"
+ version="1.0"
+ id="Icon"
+ width="45"
+ height="45"
+ viewBox="0 0 48.92 43.846"
+ overflow="visible"
+ enable-background="new 0 0 48.92 43.846"
+ xml:space="preserve"
+ sodipodi:version="0.32"
+ inkscape:version="0.48.2 r9819"
+ sodipodi:docname="time.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
+ id="metadata2238"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs2236" /><sodipodi:namedview
+ inkscape:window-height="801"
+ inkscape:window-width="1198"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="9.2824886"
+ inkscape:cx="23.598161"
+ inkscape:cy="22.892568"
+ inkscape:window-x="0"
+ inkscape:window-y="30"
+ inkscape:current-layer="Icon"
+ height="45px"
+ width="45px"
+ showgrid="false"
+ inkscape:window-maximized="0" />
+
+
+
+
+
+
+
+
+<path
+ sodipodi:type="arc"
+ style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.02743053000000018;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="path2186"
+ sodipodi:cx="21.976866"
+ sodipodi:cy="21.815269"
+ sodipodi:rx="19.606812"
+ sodipodi:ry="19.768406"
+ d="m 41.583677,21.815269 a 19.606812,19.768406 0 1 1 -39.2136228,0 19.606812,19.768406 0 1 1 39.2136228,0 z"
+ transform="matrix(0.9950145,0,0,0.9868809,2.0496201,0.5546025)" /><path
+ style="fill:none;fill-opacity:0.75000000000000000;fill-rule:evenodd;stroke:#ffffff;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 23.700541,22.623243 L 37.640481,32.017563"
+ id="path4130"
+ sodipodi:nodetypes="cc" /><rect
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:2.17422222999999981;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect2983"
+ width="8.4322214"
+ height="0.70268512"
+ x="19.323841"
+ y="0.12289593" /></svg> \ No newline at end of file