change copyrights and translate to english
This commit is contained in:
parent
07033e1033
commit
ec7aa7a4e7
2 changed files with 38 additions and 41 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
|
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright(C) 2010 Romain Bignon
|
Copyright(C) 2010 Julien Hébert
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Copyright(C) 2010 Romain Bignon
|
Copyright(C) 2010 Julien Hébert
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -23,31 +23,28 @@ from weboob.tools.application import BaseApplication
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import hildon
|
import hildon
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError("erreur d'importation de hildon http://maemo.org/packages/view/python-hildon/")
|
raise ImportError("Unable to import hildon http://maemo.org/packages/view/python-hildon/")
|
||||||
|
|
||||||
try :
|
import gtk
|
||||||
import gtk
|
|
||||||
except ImportError:
|
|
||||||
raise ImportError("erreur d'importation de gtk")
|
|
||||||
|
|
||||||
class TransilienUI():
|
class TransilienUI():
|
||||||
"interface hildon"
|
"hildon interface"
|
||||||
def __init__(self, weboob):
|
def __init__(self, weboob):
|
||||||
self.weboob = weboob
|
self.weboob = weboob
|
||||||
self.main_window = hildon.Window()
|
self.main_window = hildon.Window()
|
||||||
self.main_window.set_title("Horaires des Prochains Trains")
|
self.main_window.set_title("Horaires des Prochains Trains")
|
||||||
self.main_window.connect("destroy", self.on_main_window_destroy)
|
self.main_window.connect("destroy", self.on_main_window_destroy)
|
||||||
|
|
||||||
|
|
||||||
refresh_button = hildon.Button(
|
refresh_button = hildon.Button(
|
||||||
gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
|
gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
|
||||||
hildon.BUTTON_ARRANGEMENT_HORIZONTAL,
|
hildon.BUTTON_ARRANGEMENT_HORIZONTAL,
|
||||||
"Actualiser"
|
"Actualiser"
|
||||||
)
|
)
|
||||||
retour_button = hildon.Button(
|
retour_button = hildon.Button(
|
||||||
gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
|
gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
|
||||||
hildon.BUTTON_ARRANGEMENT_HORIZONTAL,
|
hildon.BUTTON_ARRANGEMENT_HORIZONTAL,
|
||||||
"Retour"
|
"Retour"
|
||||||
)
|
)
|
||||||
refresh_button.connect("clicked", self.on_refresh_button_clicked)
|
refresh_button.connect("clicked", self.on_refresh_button_clicked)
|
||||||
|
|
@ -57,63 +54,63 @@ class TransilienUI():
|
||||||
self.treeview = gtk.TreeView(self.treestore)
|
self.treeview = gtk.TreeView(self.treestore)
|
||||||
|
|
||||||
self.treeview.append_column(
|
self.treeview.append_column(
|
||||||
gtk.TreeViewColumn(
|
gtk.TreeViewColumn(
|
||||||
'Train',
|
'Train',
|
||||||
gtk.CellRendererText(),
|
gtk.CellRendererText(),
|
||||||
text=0
|
text=0
|
||||||
))
|
))
|
||||||
|
|
||||||
self.treeview.append_column(
|
self.treeview.append_column(
|
||||||
gtk.TreeViewColumn(
|
gtk.TreeViewColumn(
|
||||||
'Horaire',
|
'Horaire',
|
||||||
gtk.CellRendererText(),
|
gtk.CellRendererText(),
|
||||||
text=1
|
text=1
|
||||||
))
|
))
|
||||||
|
|
||||||
self.treeview.append_column(
|
self.treeview.append_column(
|
||||||
gtk.TreeViewColumn(
|
gtk.TreeViewColumn(
|
||||||
'Destination',
|
'Destination',
|
||||||
gtk.CellRendererText(),
|
gtk.CellRendererText(),
|
||||||
text=2
|
text=2
|
||||||
))
|
))
|
||||||
self.treeview.append_column(
|
self.treeview.append_column(
|
||||||
gtk.TreeViewColumn(
|
gtk.TreeViewColumn(
|
||||||
'Voie',
|
'Voie',
|
||||||
gtk.CellRendererText(),
|
gtk.CellRendererText(),
|
||||||
text=3
|
text=3
|
||||||
))
|
))
|
||||||
|
|
||||||
self.combo_source = hildon.TouchSelectorEntry(text=True)
|
self.combo_source = hildon.TouchSelectorEntry(text=True)
|
||||||
self.combo_dest = hildon.TouchSelectorEntry(text=True)
|
self.combo_dest = hildon.TouchSelectorEntry(text=True)
|
||||||
|
|
||||||
liste = []
|
liste = []
|
||||||
|
|
||||||
#liste = ConfFile('/opt/masstransit/masstransit.cfg').config.items('ListeDesGares')
|
#liste = ConfFile('/opt/masstransit/masstransit.cfg').config.items('ListeDesGares')
|
||||||
for name, backend in self.weboob.iter_backends():
|
for name, backend in self.weboob.iter_backends():
|
||||||
for station in backend.iter_station_search(""):
|
for station in backend.iter_station_search(""):
|
||||||
liste.append(station)
|
liste.append(station)
|
||||||
|
|
||||||
liste.sort()
|
liste.sort()
|
||||||
for station in liste:
|
for station in liste:
|
||||||
print station
|
print station
|
||||||
self.combo_source.append_text(station.name.capitalize())
|
self.combo_source.append_text(station.name.capitalize())
|
||||||
self.combo_dest.append_text(station.name.capitalize())
|
self.combo_dest.append_text(station.name.capitalize())
|
||||||
|
|
||||||
picker_button_source = hildon.PickerButton(
|
picker_button_source = hildon.PickerButton(
|
||||||
gtk.HILDON_SIZE_AUTO,
|
gtk.HILDON_SIZE_AUTO,
|
||||||
hildon.BUTTON_ARRANGEMENT_VERTICAL)
|
hildon.BUTTON_ARRANGEMENT_VERTICAL)
|
||||||
|
|
||||||
picker_button_dest = hildon.PickerButton(
|
picker_button_dest = hildon.PickerButton(
|
||||||
gtk.HILDON_SIZE_AUTO,
|
gtk.HILDON_SIZE_AUTO,
|
||||||
hildon.BUTTON_ARRANGEMENT_VERTICAL
|
hildon.BUTTON_ARRANGEMENT_VERTICAL
|
||||||
)
|
)
|
||||||
|
|
||||||
picker_button_source.set_title("Gare de Depart")
|
picker_button_source.set_title("Gare de Depart")
|
||||||
picker_button_dest.set_title("Gare d'arrivee")
|
picker_button_dest.set_title("Gare d'arrivee")
|
||||||
|
|
||||||
picker_button_source.set_selector(self.combo_source)
|
picker_button_source.set_selector(self.combo_source)
|
||||||
picker_button_dest.set_selector(self.combo_dest)
|
picker_button_dest.set_selector(self.combo_dest)
|
||||||
|
|
||||||
vertical_box = gtk.VBox()
|
vertical_box = gtk.VBox()
|
||||||
horizontal_box = gtk.HBox()
|
horizontal_box = gtk.HBox()
|
||||||
vertical_box.pack_start(horizontal_box)
|
vertical_box.pack_start(horizontal_box)
|
||||||
|
|
@ -127,24 +124,24 @@ class TransilienUI():
|
||||||
self.main_window.show_all()
|
self.main_window.show_all()
|
||||||
|
|
||||||
def on_main_window_destroy(self, widget):
|
def on_main_window_destroy(self, widget):
|
||||||
"quitte l'application à la fermeture de la fenetre"
|
"exit application at the window close"
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
|
|
||||||
def on_retour_button_clicked(self, widget):
|
def on_retour_button_clicked(self, widget):
|
||||||
"le bouton retour est clicked"
|
"the button is clicked"
|
||||||
col_source = self.combo_source.get_active(0)
|
col_source = self.combo_source.get_active(0)
|
||||||
col_dest = self.combo_dest.get_active(0)
|
col_dest = self.combo_dest.get_active(0)
|
||||||
self.combo_source.set_active(0, col_dest)
|
self.combo_source.set_active(0, col_dest)
|
||||||
self.combo_dest.set_active(0, col_source)
|
self.combo_dest.set_active(0, col_source)
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
def on_refresh_button_clicked(self, widget):
|
def on_refresh_button_clicked(self, widget):
|
||||||
"le bouton refresh est clicked"
|
"the refresh button is clicked"
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
def refresh(self):
|
def refresh(self):
|
||||||
"met a jour les horaires"
|
"update departures"
|
||||||
for name, backend in self.weboob.iter_backends():
|
for name, backend in self.weboob.iter_backends():
|
||||||
for station in backend.iter_station_search(self.combo_source.get_current_text()):
|
for station in backend.iter_station_search(self.combo_source.get_current_text()):
|
||||||
for name, backend in self.weboob.iter_backends():
|
for name, backend in self.weboob.iter_backends():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue