just small format changes
authorFlorian Schweikert <kelvan@logic.at>
Sun, 16 Oct 2011 17:19:09 +0000 (19:19 +0200)
committerFlorian Schweikert <kelvan@logic.at>
Sun, 16 Oct 2011 17:19:09 +0000 (19:19 +0200)
gotovienna/routing.py
images/background.svg
scotty

index 11149db..e70b757 100644 (file)
@@ -163,18 +163,22 @@ class sParser:
         places_destination = self.soup.find('select', {'id': 'placeList_destination'})
         
 
-        if names_origin or names_destination or places_origin or places_destination:
+        if any([names_origin, names_destination, places_origin, places_destination]):
             dict = {}
             
             if names_origin:
-                dict['origin'] = map(lambda x: x.text, names_origin.findAll('option'))
+                dict['origin'] = map(lambda x: x.text, 
+                                     names_origin.findAll('option'))
             if names_destination:
-                dict['destination'] = map(lambda x: x.text, names_destination.findAll('option'))
+                dict['destination'] = map(lambda x: x.text, 
+                                          names_destination.findAll('option'))
                 
             if places_origin:
-                dict['place_origin'] = map(lambda x: x.text, names_origin.findAll('option'))
+                dict['place_origin'] = map(lambda x: x.text, 
+                                           names_origin.findAll('option'))
             if names_destination:
-                dict['place_destination'] = map(lambda x: x.text, names_destination.findAll('option'))
+                dict['place_destination'] = map(lambda x: x.text, 
+                                                names_destination.findAll('option'))
     
             return dict
         
index e90f4e5..498d80a 100644 (file)
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="80px" height="80px" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve">
-<g id="DO_NOT_EDIT_-_BOUNDING_BOX">
-       <rect id="BOUNDING_BOX" fill="none" width="80" height="80"/>
-</g>
-<g id="PLACE_YOUR_BACKGROUND_HERE">
-       <g id="INDIVIDUAL_BACKGROUND_1_">
-               <defs>
-                       <path id="CLIPPING_PATH__x28_MASK_x29__2_" d="M79,40c0,28.893-10.105,39-39,39S1,68.893,1,40C1,11.106,11.105,1,40,1     S79,11.106,79,40z"/>
-               </defs>
-               <clipPath id="CLIPPING_PATH__x28_MASK_x29__1_">
-                       <use xlink:href="#CLIPPING_PATH__x28_MASK_x29__2_" overflow="visible"/>
-               </clipPath>
-               <rect id="INVISIVLE_PATH_2_" clip-path="url(#CLIPPING_PATH__x28_MASK_x29__1_)" fill="none" width="80" height="80"/>
-       </g>
-</g>
-<g id="PLACE_YOUR_GLYPH_HERE">
-</g>
-<g id="DO_NOT_EDIT_-_FOCAL_ZONE_GUIDES">
-</g>
-<g id="DO_NOT_EDIT_-_HIGHLIGHT">
-       <defs>
-               <filter id="Adobe_OpacityMaskFilter" filterUnits="userSpaceOnUse" x="1.023" y="1" width="77.953" height="78">
-                       <feFlood style="flood-color:white;flood-opacity:1" result="back"/>
-                       <feBlend in="SourceGraphic" in2="back" mode="normal"/>
-               </filter>
-       </defs>
-       <mask maskUnits="userSpaceOnUse" x="1.023" y="1" width="77.953" height="78" id="OVERLAY_2_">
-               <g filter="url(#Adobe_OpacityMaskFilter)">
-                       <defs>
-                               <filter id="Adobe_OpacityMaskFilter_1_" filterUnits="userSpaceOnUse" x="1.023" y="1" width="77.953" height="78">
-                                       <feFlood style="flood-color:white;flood-opacity:1" result="back"/>
-                                       <feBlend in="SourceGraphic" in2="back" mode="normal"/>
-                               </filter>
-                       </defs>
-                       <mask maskUnits="userSpaceOnUse" x="1.023" y="1" width="77.953" height="78" id="OVERLAY_2_">
-                               <g filter="url(#Adobe_OpacityMaskFilter_1_)">
-                               </g>
-                       </mask>
-                       <linearGradient id="OVERLAY_3_" gradientUnits="userSpaceOnUse" x1="39.9995" y1="5.1816" x2="39.9995" y2="58.8019">
-                               <stop offset="0" style="stop-color:#FFFFFF"/>
-                               <stop offset="1" style="stop-color:#D6D6D6"/>
-                       </linearGradient>
-                       <path id="OVERLAY_4_" mask="url(#OVERLAY_2_)" fill="url(#OVERLAY_3_)" d="M78.977,40c0,28.893-10.1,39-38.977,39     S1.023,68.893,1.023,40c0-28.894,10.1-39,38.977-39S78.977,11.106,78.977,40z"/>
-               </g>
-       </mask>
-       <linearGradient id="OVERLAY_5_" gradientUnits="userSpaceOnUse" x1="39.9995" y1="5.1816" x2="39.9995" y2="58.8019">
-               <stop offset="0" style="stop-color:#FFFFFF"/>
-               <stop offset="1" style="stop-color:#000000"/>
-       </linearGradient>
-       <path id="OVERLAY_1_" opacity="0.5" fill="url(#OVERLAY_5_)" d="M78.977,40c0,28.893-10.1,39-38.977,39S1.023,68.893,1.023,40   c0-28.894,10.1-39,38.977-39S78.977,11.106,78.977,40z"/>
-       <defs>
-               <filter id="Adobe_OpacityMaskFilter_2_" filterUnits="userSpaceOnUse" x="1" y="1" width="78" height="78">
-                       <feFlood style="flood-color:white;flood-opacity:1" result="back"/>
-                       <feBlend in="SourceGraphic" in2="back" mode="normal"/>
-               </filter>
-       </defs>
-       <mask maskUnits="userSpaceOnUse" x="1" y="1" width="78" height="78" id="HIGHLIGHT_2_">
-               <g filter="url(#Adobe_OpacityMaskFilter_2_)">
-                       <defs>
-                               <filter id="Adobe_OpacityMaskFilter_3_" filterUnits="userSpaceOnUse" x="1" y="1" width="78" height="78">
-                                       <feFlood style="flood-color:white;flood-opacity:1" result="back"/>
-                                       <feBlend in="SourceGraphic" in2="back" mode="normal"/>
-                               </filter>
-                       </defs>
-                       <mask maskUnits="userSpaceOnUse" x="1" y="1" width="78" height="78" id="HIGHLIGHT_2_">
-                               <g filter="url(#Adobe_OpacityMaskFilter_3_)">
-                               </g>
-                       </mask>
-                       <linearGradient id="HIGHLIGHT_3_" gradientUnits="userSpaceOnUse" x1="39.9995" y1="1.2471" x2="39.9995" y2="78.5111">
-                               <stop offset="0" style="stop-color:#FFFFFF"/>
-                               <stop offset="1" style="stop-color:#000000"/>
-                       </linearGradient>
-                       <path id="HIGHLIGHT_4_" mask="url(#HIGHLIGHT_2_)" fill="url(#HIGHLIGHT_3_)" d="M39.999,1C11.105,1,1,11.106,1,40     c0,28.893,10.105,39,38.999,39C68.896,79,79,68.893,79,40C79,11.106,68.896,1,39.999,1z M39.999,78.025     C11.57,78.025,1.976,68.43,1.976,40c0-28.429,9.595-38.024,38.023-38.024c28.43,0,38.024,9.596,38.024,38.024     C78.023,68.43,68.429,78.025,39.999,78.025z"/>
-               </g>
-       </mask>
-       <linearGradient id="HIGHLIGHT_5_" gradientUnits="userSpaceOnUse" x1="39.9995" y1="1.2471" x2="39.9995" y2="78.5111">
-               <stop offset="0" style="stop-color:#FFFFFF"/>
-               <stop offset="1" style="stop-color:#FFFFFF"/>
-       </linearGradient>
-       <path id="HIGHLIGHT_1_" opacity="0.25" fill="url(#HIGHLIGHT_5_)" d="M39.999,1C11.105,1,1,11.106,1,40   c0,28.893,10.105,39,38.999,39C68.896,79,79,68.893,79,40C79,11.106,68.896,1,39.999,1z M39.999,78.025   C11.57,78.025,1.976,68.43,1.976,40c0-28.429,9.595-38.024,38.023-38.024c28.43,0,38.024,9.596,38.024,38.024   C78.023,68.43,68.429,78.025,39.999,78.025z"/>
-</g>
-</svg>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<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:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="80"
+   height="80"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.1 r9760"
+   sodipodi:docname="gotovienna_qml.svg"
+   inkscape:export-filename="/home/kelvan/workspace/python/pyqt/gotoVienna/gotovienna/gotovienna_qml/gotovienna_qml64.png"
+   inkscape:export-xdpi="72"
+   inkscape:export-ydpi="72">
+  <defs
+     id="defs4">
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#OVERLAY_5_"
+       id="linearGradient3526"
+       gradientUnits="userSpaceOnUse"
+       x1="39.9995"
+       y1="5.1816001"
+       x2="39.9995"
+       y2="58.801899" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#HIGHLIGHT_5_"
+       id="linearGradient3528"
+       gradientUnits="userSpaceOnUse"
+       x1="39.9995"
+       y1="1.2471"
+       x2="39.9995"
+       y2="78.511101" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="3.959798"
+     inkscape:cx="-34.650237"
+     inkscape:cy="17.438846"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1440"
+     inkscape:window-height="843"
+     inkscape:window-x="0"
+     inkscape:window-y="26"
+     inkscape:window-maximized="1"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0"
+     showguides="true"
+     inkscape:guide-bbox="true" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-55.714287,-24.108724)">
+    <g
+       inkscape:groupmode="layer"
+       id="layer2"
+       inkscape:label="Layer">
+      <g
+         id="g3418"
+         transform="translate(55.714287,24.108724)">
+        <g
+           id="DO_NOT_EDIT_-_HIGHLIGHT">
+          <defs
+             id="defs3346">
+            <filter
+               height="78"
+               width="77.953003"
+               y="1"
+               x="1.023"
+               filterUnits="userSpaceOnUse"
+               id="Adobe_OpacityMaskFilter"
+               color-interpolation-filters="sRGB">
+              <feFlood
+                 id="feFlood3349"
+                 result="back" />
+              <feBlend
+                 id="feBlend3351"
+                 mode="normal"
+                 in2="back"
+                 in="SourceGraphic" />
+            </filter>
+          </defs>
+          <mask
+             id="OVERLAY_2_"
+             height="78"
+             width="77.953"
+             y="1"
+             x="1.023"
+             maskUnits="userSpaceOnUse">
+            <g
+               id="g3354"
+               style="filter:url(#Adobe_OpacityMaskFilter)">
+              <defs
+                 id="defs3356">
+                <filter
+                   height="78"
+                   width="77.953003"
+                   y="1"
+                   x="1.023"
+                   filterUnits="userSpaceOnUse"
+                   id="Adobe_OpacityMaskFilter_1_"
+                   color-interpolation-filters="sRGB">
+                  <feFlood
+                     id="feFlood3359"
+                     result="back" />
+                  <feBlend
+                     id="feBlend3361"
+                     mode="normal"
+                     in2="back"
+                     in="SourceGraphic" />
+                </filter>
+              </defs>
+              <mask
+                 id="mask3363"
+                 height="78"
+                 width="77.953"
+                 y="1"
+                 x="1.023"
+                 maskUnits="userSpaceOnUse">
+                <g
+                   id="g3365"
+                   style="filter:url(#Adobe_OpacityMaskFilter_1_)" />
+              </mask>
+              <linearGradient
+                 y2="58.801899"
+                 x2="39.9995"
+                 y1="5.1816001"
+                 x1="39.9995"
+                 gradientUnits="userSpaceOnUse"
+                 id="OVERLAY_3_">
+                <stop
+                   id="stop3368"
+                   style="stop-color:#FFFFFF"
+                   offset="0" />
+                <stop
+                   id="stop3370"
+                   style="stop-color:#D6D6D6"
+                   offset="1" />
+              </linearGradient>
+              <path
+                 d="M 78.977,40 C 78.977,68.893 68.877,79 40,79 11.123,79 1.023,68.893 1.023,40 1.023,11.106 11.123,1 40,1 68.877,1 78.977,11.106 78.977,40 z"
+                 mask="url(#OVERLAY_2_)"
+                 id="OVERLAY_4_"
+                 inkscape:connector-curvature="0"
+                 style="fill:url(#OVERLAY_3_)" />
+            </g>
+          </mask>
+          <linearGradient
+             y2="58.801899"
+             x2="39.9995"
+             y1="5.1816001"
+             x1="39.9995"
+             gradientUnits="userSpaceOnUse"
+             id="OVERLAY_5_">
+            <stop
+               id="stop3374"
+               style="stop-color:#c8c8c8;stop-opacity:1;"
+               offset="0" />
+            <stop
+               id="stop3376"
+               style="stop-color:#000000;stop-opacity:1;"
+               offset="1" />
+          </linearGradient>
+          <path
+             d="M 78.977,40 C 78.977,68.893 68.877,79 40,79 11.123,79 1.023,68.893 1.023,40 1.023,11.106 11.123,1 40,1 68.877,1 78.977,11.106 78.977,40 z"
+             id="OVERLAY_1_"
+             inkscape:connector-curvature="0"
+             style="opacity:0.5;fill:url(#linearGradient3526)" />
+          <defs
+             id="defs3379">
+            <filter
+               height="78"
+               width="78"
+               y="1"
+               x="1"
+               filterUnits="userSpaceOnUse"
+               id="Adobe_OpacityMaskFilter_2_"
+               color-interpolation-filters="sRGB">
+              <feFlood
+                 id="feFlood3382"
+                 result="back" />
+              <feBlend
+                 id="feBlend3384"
+                 mode="normal"
+                 in2="back"
+                 in="SourceGraphic" />
+            </filter>
+          </defs>
+          <mask
+             id="HIGHLIGHT_2_"
+             height="78"
+             width="78"
+             y="1"
+             x="1"
+             maskUnits="userSpaceOnUse">
+            <g
+               id="g3387"
+               style="filter:url(#Adobe_OpacityMaskFilter_2_)">
+              <defs
+                 id="defs3389">
+                <filter
+                   height="78"
+                   width="78"
+                   y="1"
+                   x="1"
+                   filterUnits="userSpaceOnUse"
+                   id="Adobe_OpacityMaskFilter_3_"
+                   color-interpolation-filters="sRGB">
+                  <feFlood
+                     id="feFlood3392"
+                     result="back" />
+                  <feBlend
+                     id="feBlend3394"
+                     mode="normal"
+                     in2="back"
+                     in="SourceGraphic" />
+                </filter>
+              </defs>
+              <mask
+                 id="mask3396"
+                 height="78"
+                 width="78"
+                 y="1"
+                 x="1"
+                 maskUnits="userSpaceOnUse">
+                <g
+                   id="g3398"
+                   style="filter:url(#Adobe_OpacityMaskFilter_3_)" />
+              </mask>
+              <linearGradient
+                 y2="78.511101"
+                 x2="39.9995"
+                 y1="1.2471"
+                 x1="39.9995"
+                 gradientUnits="userSpaceOnUse"
+                 id="HIGHLIGHT_3_">
+                <stop
+                   id="stop3401"
+                   style="stop-color:#FFFFFF"
+                   offset="0" />
+                <stop
+                   id="stop3403"
+                   style="stop-color:#000000"
+                   offset="1" />
+              </linearGradient>
+              <path
+                 d="M 39.999,1 C 11.105,1 1,11.106 1,40 1,68.893 11.105,79 39.999,79 68.896,79 79,68.893 79,40 79,11.106 68.896,1 39.999,1 z m 0,77.025 C 11.57,78.025 1.976,68.43 1.976,40 c 0,-28.429 9.595,-38.024 38.023,-38.024 28.43,0 38.024,9.596 38.024,38.024 0,28.43 -9.594,38.025 -38.024,38.025 z"
+                 mask="url(#HIGHLIGHT_2_)"
+                 id="HIGHLIGHT_4_"
+                 inkscape:connector-curvature="0"
+                 style="fill:url(#HIGHLIGHT_3_)" />
+            </g>
+          </mask>
+          <linearGradient
+             y2="78.511101"
+             x2="39.9995"
+             y1="1.2471"
+             x1="39.9995"
+             gradientUnits="userSpaceOnUse"
+             id="HIGHLIGHT_5_">
+            <stop
+               id="stop3407"
+               style="stop-color:#FFFFFF"
+               offset="0" />
+            <stop
+               id="stop3409"
+               style="stop-color:#FFFFFF"
+               offset="1" />
+          </linearGradient>
+          <path
+             d="M 39.999,1 C 11.105,1 1,11.106 1,40 1,68.893 11.105,79 39.999,79 68.896,79 79,68.893 79,40 79,11.106 68.896,1 39.999,1 z m 0,77.025 C 11.57,78.025 1.976,68.43 1.976,40 c 0,-28.429 9.595,-38.024 38.023,-38.024 28.43,0 38.024,9.596 38.024,38.024 0,28.43 -9.594,38.025 -38.024,38.025 z"
+             id="HIGHLIGHT_1_"
+             inkscape:connector-curvature="0"
+             style="opacity:0.25;fill:url(#linearGradient3528)" />
+        </g>
+        <g
+           id="DO_NOT_EDIT_-_BOUNDING_BOX">
+          <rect
+             height="80"
+             width="80"
+             id="BOUNDING_BOX"
+             x="0"
+             y="0"
+             style="fill:none" />
+        </g>
+        <g
+           id="PLACE_YOUR_BACKGROUND_HERE">
+          <g
+             id="INDIVIDUAL_BACKGROUND_1_">
+            <defs
+               id="defs3336">
+              <path
+                 d="M 79,40 C 79,68.893 68.895,79 40,79 11.105,79 1,68.893 1,40 1,11.106 11.105,1 40,1 68.895,1 79,11.106 79,40 z"
+                 id="CLIPPING_PATH__x28_MASK_x29__2_"
+                 inkscape:connector-curvature="0" />
+            </defs>
+            <clipPath
+               id="CLIPPING_PATH__x28_MASK_x29__1_">
+              <use
+                 id="use3340"
+                 overflow="visible"
+                 xlink:href="#CLIPPING_PATH__x28_MASK_x29__2_"
+                 style="overflow:visible"
+                 x="0"
+                 y="0"
+                 width="1"
+                 height="1" />
+            </clipPath>
+            <rect
+               height="80"
+               width="80"
+               clip-path="url(#CLIPPING_PATH__x28_MASK_x29__1_)"
+               id="INVISIVLE_PATH_2_"
+               x="0"
+               y="0"
+               style="fill:none" />
+          </g>
+        </g>
+        <g
+           id="PLACE_YOUR_GLYPH_HERE" />
+        <g
+           id="DO_NOT_EDIT_-_FOCAL_ZONE_GUIDES" />
+      </g>
+    </g>
+    <text
+       xml:space="preserve"
+       style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+       x="41.289986"
+       y="81.858124"
+       id="text3269"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan3271"
+         x="41.289986"
+         y="81.858124" /></text>
+  </g>
+</svg>
diff --git a/scotty b/scotty
index d198087..ca7922c 100755 (executable)
--- a/scotty
+++ b/scotty
@@ -8,10 +8,16 @@ from gotovienna.utils import *
 from gotovienna.routing import *
 
 parser = argparse.ArgumentParser(description='Get public transport route for Vienna')
-parser.add_argument('-ot', metavar='type', type=str, help='origin type: %s' % ' | '.join(POSITION_TYPES), default=None, choices=POSITION_TYPES)
-parser.add_argument('-dt', metavar='type', type=str, help='destination type: %s' % ' | '.join(POSITION_TYPES), default=None, choices=POSITION_TYPES)
-parser.add_argument('origin', nargs='?', help='origin station name')
-parser.add_argument('destination', nargs='?', help='destination station name')
+parser.add_argument('-ot', metavar='type', type=str, 
+                    help='origin type: %s' % ' | '.join(POSITION_TYPES), 
+                    default=None, choices=POSITION_TYPES)
+parser.add_argument('-dt', metavar='type', type=str, 
+                    help='destination type: %s' % ' | '.join(POSITION_TYPES), 
+                    default=None, choices=POSITION_TYPES)
+parser.add_argument('origin', nargs='?', 
+                    help='origin station name')
+parser.add_argument('destination', nargs='?', 
+                    help='destination station name')
 
 args = parser.parse_args()
 
@@ -90,8 +96,11 @@ if parser.state == PageType.RESULT:
         if l.isdigit() and int(l) <= len(details):
             for detail in details[int(l) - 1]:
                 if detail['timespan'] and detail['station']:
-                    time = '%s - %s' % (detail['timespan'][0].strftime(TIMEFORMAT), detail['timespan'][1].strftime(TIMEFORMAT))
-                    print '[%s] %s\n%s' % (time, ' -> '.join(detail['station']), '\n'.join(detail['info']))
+                    time = '%s - %s' % (detail['timespan'][0].strftime(TIMEFORMAT), 
+                                        detail['timespan'][1].strftime(TIMEFORMAT))
+                    print '[%s] %s\n%s' % (time, 
+                                           ' -> '.join(detail['station']), 
+                                           '\n'.join(detail['info']))
                 else:
                     print '\n'.join(detail['info'])
                 print '-' * 79