Suppeampi näkymä, pikatiet ja mootoritiet

Sun, 03 Sep 2017 14:10:38 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 03 Sep 2017 14:10:38 +0300
changeset 55
0f1d046b3f78
parent 54
0b1e263674e8
child 56
e055b418fbf3

Suppeampi näkymä, pikatiet ja mootoritiet

busroute.py file | annotate | diff | comparison | revisions
regions.gmp file | annotate | diff | comparison | revisions
regions.ini file | annotate | diff | comparison | revisions
service.py file | annotate | diff | comparison | revisions
static/style.css file | annotate | diff | comparison | revisions
templates/cluster.html file | annotate | diff | comparison | revisions
templates/stop.html file | annotate | diff | comparison | revisions
templates/trip.html file | annotate | diff | comparison | revisions
tr/en.ini file | annotate | diff | comparison | revisions
tr/fi.ini file | annotate | diff | comparison | revisions
tr/sv.ini file | annotate | diff | comparison | revisions
--- a/busroute.py	Thu Aug 31 21:30:34 2017 +0300
+++ b/busroute.py	Sun Sep 03 14:10:38 2017 +0300
@@ -15,6 +15,8 @@
 	'kemiö': 'kemiönsaari',
 	'kasnäs': 'kemiönsaari',
 	'pernon telakka': 'perno',
+	'paimion sairaala': 'paimio',
+	'hanhijoki': 'paimio',
 }
 
 # nimiä joista voidaan joustaa tarvittaessa
@@ -128,6 +130,8 @@
 		'merimasku': 50,
 		'turkuhalli': 100,
 		'messukeskus': 100,
+		'naantalin pikatie': 150,
+		'helsingin valtatie': 500,
 	}
 
 	if 'kauppatori' not in reitti:
@@ -176,10 +180,11 @@
 	# muodostetaan sign..
 	sign = [paino[0] for paino in weights]
 	to_place = sign[-1]
+	nearby_municipalities = {'Turku', 'Raisio', 'Naantali', 'Kaarina', 'Lieto'}
 	if from_place != to_place:
 		municipality_from = municipalities_per_region.get(from_place)
 		municipality_to = municipalities_per_region.get(to_place)
-		if municipality_from and municipality_to and municipality_from not in ['Turku', municipality_to]:
+		if municipality_from and municipality_to and municipality_from not in nearby_municipalities | {municipality_to} and municipality_to not in nearby_municipalities:
 			def convert_region(region):
 				municipality = municipalities_per_region.get(region, region)
 				if municipality != municipality_from:
--- a/regions.gmp	Thu Aug 31 21:30:34 2017 +0300
+++ b/regions.gmp	Sun Sep 03 14:10:38 2017 +0300
@@ -1,6 +1,6 @@
-roadmap^60.45418756605041, 22.175387959995877^15@undefined^#FF0000,5,1,#ff8800,0.4^^60.3977,22.24465~60.40772,22.24046~60.40792,22.26057~60.40076,22.27409~60.3952,22.25642
+roadmap^60.421697646819375, 22.679868560352933^14@undefined^#FF0000,5,1,#ff8800,0.4^^60.3977,22.24465~60.40772,22.24046~60.40792,22.26057~60.40076,22.27409~60.3952,22.25642
 polygon^#FF0000,5,1,#ff8800,0.4^^60.3977,22.22706~60.38719,22.23676~60.38341,22.22466~60.38518,22.21205~60.39359,22.20706~60.39816,22.21341
-polygon^#FF0000,5,1,#ff8800,0.4^^60.39868,22.21599~60.39804,22.22852~60.38876,22.23916~60.38952,22.24843~60.39329,22.25135~60.40217,22.23474~60.4019,22.21689
+undefined^#FF0000,5,1,#ff8800,0.4^^60.39868,22.21599~60.39804,22.22852~60.38876,22.23916~60.38952,22.24843~60.39329,22.25135~60.40217,22.23474~60.4019,22.21689
 undefined^#FF0000,5,1,#ff8800,0.4^^60.38871,22.16432~60.39236,22.18483~60.39972,22.188~60.40171,22.1823~60.39919,22.15413~60.39151,22.15633
 undefined^#FF0000,5,1,#ff8800,0.4^^60.42123,22.17264~60.41472,22.15422~60.40622,22.14277~60.40003,22.15599~60.40577,22.17143~60.41357,22.18174
 undefined^#FF0000,5,1,#ff8800,0.4^^60.43275,22.20869~60.4239,22.21632~60.41889,22.19831~60.42495,22.19216~60.43033,22.19648
@@ -58,7 +58,7 @@
 undefined^#FF0000,5,1,#ff8800,0.4^^60.48884,22.18543~60.48132,22.18556~60.47867,22.1974~60.47689,22.20328~60.48104,22.21122~60.48704,22.20809~60.48823,22.19436
 undefined^#FF0000,5,1,#ff8800,0.4^^60.48122,22.18547~60.47853,22.19719~60.47645,22.20365~60.47299,22.19482
 undefined^#FF0000,5,1,#ff8800,0.4^^60.49404,22.26856~60.49248,22.28712~60.48973,22.30216~60.48271,22.29808~60.47627,22.28925~60.47537,22.27866~60.47564,22.26596~60.48309,22.27138~60.48695,22.27301
-undefined^#FF0000,5,1,#ff8800,0.4^^60.43241,22.32263~60.4233,22.33585~60.42025,22.32107~60.42818,22.31196~60.43215,22.31439~60.43258,22.31667
+undefined^#FF0000,5,1,#ff8800,0.4^^60.43241,22.32263~60.42835,22.32737~60.4233,22.33585~60.42025,22.32107~60.42818,22.31196~60.43215,22.31439~60.43258,22.31667
 undefined^#FF0000,5,1,#ff8800,0.4^^60.42961,22.26392~60.4343,22.28456~60.43499,22.29225~60.43245,22.29564~60.42894,22.29349~60.42506,22.27929~60.42531,22.26699
 undefined^#FF0000,5,1,#ff8800,0.4^^60.42521,22.26577~60.42195,22.26877~60.41579,22.26733~60.41625,22.27877~60.42052,22.2783~60.42469,22.2762
 undefined^#FF0000,5,1,#ff8800,0.4^^60.42288,22.24603~60.42536,22.26349~60.4219,22.26787~60.4157,22.26641~60.41536,22.2713~60.40943,22.26612~60.41382,22.25849
@@ -249,4 +249,5 @@
 undefined^#FF0000,5,1,#ff8800,0.4^^60.50991,21.79688~60.50553,21.82198~60.49879,21.82486~60.48869,21.81559~60.48873,21.80606~60.50384,21.79046
 undefined^#FF0000,5,1,#ff8800,0.4^^60.45598,22.18232~60.45588,22.18356~60.4531,22.18826~60.45288,22.18644~60.45144,22.18341~60.45199,22.18199
 undefined^#FF0000,5,1,#ff8800,0.4^^60.45617,22.1823~60.45768,22.18238~60.45749,22.18878~60.45545,22.18951~60.45384,22.19146~60.45318,22.18846~60.45605,22.18388
+undefined^#FF0000,5,1,#ff8800,0.4^^60.43436,22.32058~60.43439,22.32183~60.43321,22.32286~60.43207,22.32394~60.43124,22.3248~60.43008,22.32702~60.4292,22.32844~60.42856,22.32923~60.42741,22.33048~60.42576,22.33362~60.42437,22.33808~60.42352,22.34186~60.42279,22.34868~60.42235,22.35496~60.42233,22.36175~60.42285,22.36895~60.4238,22.37793~60.42438,22.38664~60.4246,22.39398~60.42425,22.40649~60.42464,22.42052~60.4258,22.42968~60.42737,22.43592~60.43075,22.44551~60.43544,22.45807~60.43798,22.46386~60.4401,22.47229~60.44153,22.48229~60.44484,22.49588~60.44721,22.51468~60.4474,22.5242~60.44547,22.54412~60.44581,22.5598~60.44596,22.56922~60.44384,22.57978~60.44321,22.58862~60.44287,22.60699~60.44183,22.61746~60.43726,22.63527~60.43535,22.64608~60.42779,22.66312~60.4261,22.67222~60.42447,22.67829~60.42382,22.68591~60.42422,22.69638~60.42824,22.71893~60.42838,22.72384~60.42741,22.72839~60.42671,22.72444~60.42682,22.71627~60.42488,22.70509~60.42352,22.69706~60.42302,22.68542~60.42353,22.67789~60.42438,22.67115~60.43058,22.6542~60.43428,22.64493~60.43859,22.6252~60.44178,22.60719~60.44291,22.57907~60.44441,22.56282~60.44428,22.5444~60.44597,22.52369~60.4463,22.51513~60.44392,22.49678~60.44103,22.4841~60.4393,22.47249~60.43715,22.46483~60.43517,22.45975~60.42683,22.437~60.42511,22.4297~60.42377,22.42051~60.42343,22.40694~60.42392,22.39391~60.42351,22.38226~60.42159,22.36168~60.42299,22.34173~60.42516,22.3333~60.42731,22.32928~60.42832,22.32754~60.42946,22.32621
 @@@@@@
--- a/regions.ini	Thu Aug 31 21:30:34 2017 +0300
+++ b/regions.ini	Sun Sep 03 14:10:38 2017 +0300
@@ -23,6 +23,7 @@
 Paimion sairaala = 6664
 Hanhijoki = 6657
 Naskarla = 6638
+Helsingin valtatie = 6753
 
 [Lieto]
 Lieto = 5021
@@ -244,7 +245,6 @@
 Uittamo = 920
 Urusvuori = 1587
 Vaala = 1500
-Vanha Suurtori = 219
 Vasaramäki = 1967
 Varissuo = 828
 Verkahovi = 1601
--- a/service.py	Thu Aug 31 21:30:34 2017 +0300
+++ b/service.py	Sun Sep 03 14:10:38 2017 +0300
@@ -10,6 +10,7 @@
 import buses
 
 app = Flask(__name__)
+suffix_regions = {'naantalin pikatie', 'helsingin valtatie'}
 
 # Varmista ettei järjestelmän kieliasetukset sotke muotoiluja
 def reset_locale():
@@ -65,8 +66,8 @@
 	trip_length = schedule_entry['trip'].length - schedule_entry['stop'].traveled_distance
 	sign = reduce_schedule(schedule_entry['trip'].concise_schedule(schedule_entry['stop']), trip_length = trip_length)
 	if sign:
-		sign = [tr(place, 'paikat') for place in sign]
-		sign_representation = ' - '.join(sign)
+		sign_representation = ' - '.join(tr(place, 'paikat') for place in sign if place not in suffix_regions)
+		sign_representation += ''.join(' ' + tr(place, 'suffix-places') for place in sign if place in suffix_regions)
 		#if len(sign_representation) > 25:
 		#	k = ceil(len(sign) / 2)
 		#	sign_representation = ' - '.join(sign[:k]) + '\n' + ' - '.join(sign[k:])
--- a/static/style.css	Thu Aug 31 21:30:34 2017 +0300
+++ b/static/style.css	Sun Sep 03 14:10:38 2017 +0300
@@ -44,20 +44,20 @@
 	margin: auto;
 	margin-bottom: 30pt;
 	min-width: 50%;
-	/*min-width: 85%;*/
+	border-radius: 30px 30px 0 0;
+	background: #ffd90f;
 	border: 1px solid gray;
-	border-radius: 30px 30px 0 0;
 	box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
 }
 
-.aikataulu th:first-child
+.aikataulu tr:first-child th:first-child
 {
-	border-radius: 30px 0 0 0;
+	border-top-left-radius: 30px;
 }
 
-.aikataulu th:last-child
+.aikataulu tr:first-child th:last-child
 {
-	border-radius: 0 30px 0 0;
+	border-top-right-radius: 0 30px;
 }
 
 .sarake-linja
@@ -83,18 +83,18 @@
 	padding-top: 10px;
 }
 
+.aikataulu tbody
+{
+	background: white;
+}
+
 .aikataulu tr td
 {
 	border-top: 1px solid gray;
 	background-color: rgba(0, 0, 0, 0.04);
 }
 
-.aikataulu tr:first-child td
-{
-	border-top: none;
-}
-
-.aikataulu tr:nth-child(even)
+.aikataulu tbody tr:nth-child(even)
 {
 	background-color: rgba(0, 0, 0, 0.08);
 }
@@ -111,11 +111,6 @@
 	*/
 }
 
-.aikataulu th
-{
-	background: #ffd90f;
-}
-
 #pysäkki-info
 {
 	text-align: center
@@ -202,3 +197,62 @@
 		opacity: 1;
 	}
 }
+
+.primary-heading span
+{
+	font-size: 32pt;
+}
+
+.primary-heading-symbols
+{
+	font-weight: normal;
+}
+
+.primary-heading
+{
+	margin: 0;
+	padding-top: 10pt;
+	padding-bottom: 20pt;
+	height: 60px;
+}
+
+.primary-heading img, .primary-heading span
+{
+	vertical-align: middle;
+}
+
+.aikataulu
+{
+	margin-top: 20pt;
+}
+
+.actions
+{
+	float: right;
+}
+
+.headings
+{
+	vertical-align: bottom;
+}
+
+.actions a
+{
+	border: 1px solid rgba(0,0,0, 0.5);
+	border-radius: 20px;
+	width: 40px;
+	height: 40px;
+	text-align: center;
+	vertical-align: middle;
+	display: table-cell;
+	margin: 2px;
+	font-weight: normal;
+	background: #ffe766;
+	box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.5);
+}
+
+.actions a:hover
+{
+	background: #fff3b3;
+	text-decoration: none;
+}
--- a/templates/cluster.html	Thu Aug 31 21:30:34 2017 +0300
+++ b/templates/cluster.html	Sun Sep 03 14:10:38 2017 +0300
@@ -36,10 +36,7 @@
 	</style>
 </head>
 <body>
-	<h1><img src="../static/pysäkki.png" height="96" /> <span>{{name}}</span></h1>
-	<p id="pysäkki-info">
-		<a class="pysäkki-sijainti" href="{{link_to_map}}" target="_blank">📌 ({{location}})</a>
-	</p>
+<!--
 	<div class="stops-in-cluster">
 	<ul>
 	{% for stop in stops_in_cluster %}
@@ -47,13 +44,29 @@
 	{% endfor %}
 	</ul>
 	</div>
+-->
 	<table class='aikataulu' cellspacing="0">
+	<thead>
+		<tr>
+			<th class='primary-heading' colspan='5'>
+			<span>{{name}}</span>
+			</th>
+		</tr>
 		<tr>
 			<th class='sarake-aika'>{{tr('time', 'headings')}}</th>
+			<th class='sarake-pysäkki'>{{tr('bus-stop', 'headings')}}</th>
 			<th class='sarake-linja'>{{tr('route', 'headings')}}</th>
 			<th class='sarake-määränpää'>{{tr('destination', 'headings')}}</th>
-			<th class='sarake-pysäkki'>{{tr('bus-stop', 'headings')}}</th>
+			<th>
+				<span class='actions'>
+				<a class="pysäkki-sijainti" href="{{link_to_map}}" target="_blank">📌</a>
+				{% if cluster %}
+				<a href="../stop_cluster/{{cluster}}">🞊</a>
+				{% endif %}
+			</th>
 		</tr>
+	</thead>
+	<tbody>
 		{% for halt in schedule %}
 		<tr class="{% if halt['night'] %} yö {% endif %}">
 			<td class='sarake-aika'>
@@ -62,17 +75,18 @@
 				{% endif %}
 				{{halt['time']}}
 			</td>
+			<td class='sarake-pysäkki'>
+				<a href="../stop/{{halt['stop_id']}}"><img src="../static/pysäkki.png" height="24" /> {{halt['stop_code']}}</a>
+			</td>
 			<td class='sarake-linja linja'>
 				<a href="../trip/{{halt['trip']}}">{{halt['route']}}</a>
 			</td>
-			<td class='sarake-määränpää'>
+			<td class='sarake-määränpää' colspan='2'>
 				<a href="../trip/{{halt['trip']}}">{{halt['sign']}}</a>
 			</td>
-			<td class='sarake-pysäkki'>
-				<a href="../stop/{{halt['stop_id']}}"><img src="../static/pysäkki.png" height="24" /> {{halt['stop_code']}}</a>
-			</td>
 		</tr>
 		{% endfor %}
+	</tbody>
 	</table>
 </body>
 </html>
--- a/templates/stop.html	Thu Aug 31 21:30:34 2017 +0300
+++ b/templates/stop.html	Sun Sep 03 14:10:38 2017 +0300
@@ -22,23 +22,27 @@
 	{% endif %}
 </head>
 <body>
-	<h1><img src="../static/pysäkki.png" height="96" /> <span>{{name}}</span></h1>
-	<p id="pysäkki-info">
-	{{region or ""}}
-	—
-	<a class="pysäkki-sijainti" href="{{link_to_map}}" target="_blank">📌 ({{location}})</a>
-	</p>
-	{% if cluster %}
-	<p>
-	<a href="../stop_cluster/{{cluster}}">{{tr('nearby-area-schedule', 'misc-text')}}</a>
-	</p>
-	{% endif %}
 	<table class='aikataulu' cellspacing="0">
+	<thead>
 		<tr>
+			<th colspan='4' class='primary-heading'>
+			<span><img src="../static/pysäkki.png" height="96" /> {{name}}</span>
+			</th>
+		</tr>
+		<tr class='headings'>
 			<th class='sarake-aika'>{{tr('time', 'headings')}}</th>
 			<th class='sarake-linja'>{{tr('route', 'headings')}}</th>
 			<th class='sarake-määränpää'>{{tr('destination', 'headings')}}</th>
+			<th>
+				<span class='actions'>
+				<a class="pysäkki-sijainti" href="{{link_to_map}}" target="_blank">📌</a>
+				{% if cluster %}
+				<a href="../stop_cluster/{{cluster}}">🞊</a>
+				{% endif %}
+			</th>
 		</tr>
+	</thead>
+	<tbody>
 		{% for halt in schedule %}
 		<tr class="{% if halt['night'] %} yö {% endif %}">
 			<td class='sarake-aika'>
@@ -49,11 +53,12 @@
 			<td class='sarake-linja linja'>
 				<a href="../trip/{{halt['trip']}}">{{halt['route']}}</a>
 			</td>
-			<td class='sarake-määränpää'>
+			<td class='sarake-määränpää' colspan='2'>
 				<a href="../trip/{{halt['trip']}}">{{halt['sign']}}</a>
 			</td>
 		</tr>
 		{% endfor %}
+	</tbody>
 	</table>
 </body>
 </html>
--- a/templates/trip.html	Thu Aug 31 21:30:34 2017 +0300
+++ b/templates/trip.html	Sun Sep 03 14:10:38 2017 +0300
@@ -23,6 +23,10 @@
 	}
 	.nested-schedule td
 	{
+		background: rgba(0, 0, 0, 0.25)
+	}
+	.nested-schedule td
+	{
 		margin-left: 0;
 		margin-right: 0;
 		padding-left: 5px;
@@ -38,11 +42,6 @@
 	{
 		text-align: right;
 	}
-	
-	.aikataulu
-	{
-		margin-top: 30pt;
-	}
 	</style>
 	<script>
 	function toggle_fold(id)
@@ -57,17 +56,26 @@
 	<title>{{route}} {{description}}</title>
 </head>
 <body>
-	<h1>
-	{% if night %}
-	&#127769;&nbsp;
-	{% endif %}
-	🚍 {{route}} {{description}}</h1>
 	<table class='aikataulu' cellspacing='0'>
+	<thead>
+		<tr>
+			<th class='primary-heading' colspan='3'>
+			<span class='primary-heading-symbols'>
+			{% if night %}
+			&#127769;&nbsp;
+			{% endif %}
+			🚍
+			</span>
+			<span>{{route}} {{description}}</span>
+			</th>
+		</tr>
 		<tr>
 			<th class='sarake-aika'>Aika</th>
 			<th class='sarake-alue'>Alue</th>
 			<th class='sarake-matkapituus'>{{'%.1f' % length}}km</th>
 		</tr>
+	</thead>
+	<tbody>
 		{% for entry in schedule %}
 		<tr>
 			<td class='sarake-aika' style='vertical-align: top'>{{entry['time']}}</td>
@@ -85,6 +93,7 @@
 			</td>
 		</tr>
 		{% endfor %}
+	</tbody>
 	</table>
 </body>
 </html>
--- a/tr/en.ini	Thu Aug 31 21:30:34 2017 +0300
+++ b/tr/en.ini	Sun Sep 03 14:10:38 2017 +0300
@@ -17,6 +17,10 @@
 nearby-area-schedule = Nearby area schedule
 stops-in-cluster = Bus stops in this group
 
+[suffix-places]
+naantalin pikatie = by expressway
+helsingin valtatie = by motorway
+
 [other]
 locale = en_US.utf8
 
--- a/tr/fi.ini	Thu Aug 31 21:30:34 2017 +0300
+++ b/tr/fi.ini	Sun Sep 03 14:10:38 2017 +0300
@@ -22,5 +22,9 @@
 stops-in-cluster = Pysäkit ryhmässä
 nearby-area-schedule = Lähialueen aikataulu
 
+[suffix-places]
+naantalin pikatie = pikatietä
+helsingin valtatie = moottoritietä
+
 [other]
 locale = fi_FI.utf8
--- a/tr/sv.ini	Thu Aug 31 21:30:34 2017 +0300
+++ b/tr/sv.ini	Sun Sep 03 14:10:38 2017 +0300
@@ -1741,5 +1741,9 @@
 stops-in-cluster = Hållplatser runt här
 nearby-area-schedule = Schema för närliggande hållplatser
 
+[suffix-places]
+naantalin pikatie = på snabbväg
+helsingin valtatie = på motorväg
+
 [other]
 locale = sv_SE.utf8

mercurial