Commit 9debafde authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by Romain Bignon
Browse files

Remove Hildon support and Masstransit application

An unfortunate commit.

I am not aware of anyone still using a N900 or similar.
The Hildon library is not maintained anymore.

Blame Sephen Elop.
parent 896de792
......@@ -27,7 +27,6 @@
('geolooc', 'geolooc'),
('handjoob', 'handjisou'),
('havedate', 'havedate'),
('masstransit', 'masstransit'),
('monboob', 'monbisou'),
('parceloob', 'parcelisou'),
('pastoob', 'pastisou'),
......
[Desktop Entry]
Name=Masstransit
Comment=Search for train stations and departure times
Exec=masstransit
Icon=masstransit
Terminal=false
Type=Application
StartupNotify=true
Categories=Network;GTK;
Keywords=departures;train;stations;timetable;travel;
.\" -*- coding: utf-8 -*-
.\" This file was generated automatically by tools/make_man.sh.
.TH MASSTRANSIT 1 "08 January 2017" "masstransit 1\&.2"
.SH NAME
masstransit \- search for train stations and departures
.SH SYNOPSIS
.B masstransit
[\-h] [\-dqv] [\-b \fIbackends\fR] ...
.br
.B masstransit
[\-\-help] [\-\-version]
.SH DESCRIPTION
.LP
Maemo application allowing to search for train stations and get departure times.
.SH OPTIONS
.TP
\fB\-\-version\fR
show program's version number and exit
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-b BACKENDS\fR, \fB\-\-backends=BACKENDS\fR
what backend(s) to enable (comma separated)
.TP
\fB\-e EXCLUDE_BACKENDS\fR, \fB\-\-exclude\-backends=EXCLUDE_BACKENDS\fR
what backend(s) to exclude (comma separated)
.TP
\fB\-I\fR, \fB\-\-insecure\fR
do not validate SSL
.SH LOGGING OPTIONS
.TP
\fB\-d\fR, \fB\-\-debug\fR
display debug messages. Set up it twice to more verbosity
.TP
\fB\-q\fR, \fB\-\-quiet\fR
display only error messages
.TP
\fB\-v\fR, \fB\-\-verbose\fR
display info messages
.TP
\fB\-\-logging\-file=LOGGING_FILE\fR
file to save logs
.TP
\fB\-a\fR, \fB\-\-save\-responses\fR
save every response
.SH CONDITION
The \-c and \-\-condition is a flexible way to filter and get only interesting results. It supports conditions on numerical values, dates, durations and strings. Dates are given in YYYY\-MM\-DD or YYYY\-MM\-DD HH:MM format. Durations look like XhYmZs where X, Y and Z are integers. Any of them may be omitted. For instance, YmZs, XhZs or Ym are accepted.
The syntax of one expression is "\fBfield operator value\fR". The field to test is always the left member of the expression.
.LP
The field is a member of the objects returned by the command. For example, a bank account has "balance", "coming" or "label" fields.
.SS The following operators are supported:
.TP
=
Test if object.field is equal to the value.
.TP
!=
Test if object.field is not equal to the value.
.TP
>
Test if object.field is greater than the value. If object.field is date, return true if value is before that object.field.
.TP
<
Test if object.field is less than the value. If object.field is date, return true if value is after that object.field.
.TP
|
This operator is available only for string fields. It works like the Unix standard \fBgrep\fR command, and returns True if the pattern specified in the value is in object.field.
.SS Expression combination
.LP
You can make a expression combinations with the keywords \fB" AND "\fR, \fB" OR "\fR an \fB" LIMIT "\fR.
.LP
The \fBLIMIT\fR keyword can be used to limit the number of items upon which running the expression. \fBLIMIT\fR can only be placed at the end of the expression followed by the number of elements you want.
.SS Examples:
.nf
.B boobank ls \-\-condition 'label=Livret A'
.fi
Display only the "Livret A" account.
.PP
.nf
.B boobank ls \-\-condition 'balance>10000'
.fi
Display accounts with a lot of money.
.PP
.nf
.B boobank history account@backend \-\-condition 'label|rewe'
.fi
Get transactions containing "rewe".
.PP
.nf
.B boobank history account@backend \-\-condition 'date>2013\-12\-01 AND date<2013\-12\-09'
.fi
Get transactions betweens the 2th December and 8th December 2013.
.PP
.nf
.B boobank history account@backend \-\-condition 'date>2013\-12\-01 LIMIT 10'
.fi
Get transactions after the 2th December in the last 10 transactions
.SH COPYRIGHT
Copyright(C) 2010-2017 Julien Hébert
.LP
For full copyright information see the COPYING file in the weboob package.
.LP
.RE
.SH FILES
"~/.config/weboob/backends"
.SH SEE ALSO
Home page: http://weboob.org/applications/masstransit
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ft=python et softtabstop=4 cinoptions=4 shiftwidth=4 ts=4 ai
# Copyright(C) 2010-2011 Julien Hébert
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from weboob.applications.masstransit import Masstransit
if __name__ == '__main__':
Masstransit.run()
......@@ -63,7 +63,6 @@ def install_weboob():
scripts = set(os.listdir('scripts'))
packages = set(find_packages(exclude=['modules', 'modules.*']))
hildon_scripts = set(('masstransit',))
qt_scripts = set(('qboobmsg',
'qhavedate',
'qgalleroob',
......@@ -76,16 +75,11 @@ def install_weboob():
'qbooblyrics',
'qhandjoob'))
if not options.hildon:
scripts = scripts - hildon_scripts
if options.qt:
build_qt()
else:
scripts = scripts - qt_scripts
hildon_packages = set((
'weboob.applications.masstransit',
))
qt_packages = set((
'weboob.applications.qboobmsg',
'weboob.applications.qboobmsg.ui',
......@@ -111,8 +105,6 @@ def install_weboob():
'weboob.applications.qgalleroob.ui',
))
if not options.hildon:
packages = packages - hildon_packages
if not options.qt:
packages = packages - qt_packages
......@@ -187,20 +179,17 @@ def install_weboob():
class Options(object):
hildon = False
qt = False
xdg = True
deps = True
options = Options()
if os.getenv('WEBOOB_SETUP'):
args = os.getenv('WEBOOB_SETUP').split()
else:
args = sys.argv[1:]
if '--hildon' in args and '--no-hildon' in args:
print('--hildon and --no-hildon options are incompatible', file=sys.stderr)
sys.exit(1)
if '--qt' in args and '--no-qt' in args:
print('--qt and --no-qt options are incompatible', file=sys.stderr)
sys.exit(1)
......@@ -208,14 +197,6 @@ class Options(object):
print('--xdg and --no-xdg options are incompatible', file=sys.stderr)
sys.exit(1)
if '--hildon' in args or os.environ.get('HILDON') == 'true':
options.hildon = True
if '--hildon' in args:
args.remove('--hildon')
elif '--no-hildon' in args:
options.hildon = False
args.remove('--no-hildon')
if '--qt' in args:
options.qt = True
args.remove('--qt')
......
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from .masstransit import Masstransit
__all__ = ['Masstransit']
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Julien Hébert
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.travel import CapTravel
from weboob.tools.application.base import Application
from logging import warning
import gtk
class FakeConic(object):
STATUS_CONNECTED = None
STATUS_DISCONNECTED = None
CONNECT_FLAG_NONE = None
def Connection(self):
raise NotImplementedError()
try:
import hildon
except ImportError:
toolkit = gtk
else:
toolkit = hildon
try:
import conic
except ImportError:
warning("conic is not found")
conic = FakeConic()
from logging import debug
__all__ = ['Masstransit']
class MasstransitHildon(object):
"hildon interface"
def connect_event(self, connection, event=None, c=None, d=None):
debug("DBUS-DEBUG a: %s, b:%s, c:%s,d: %s" % (connection, event, c, d))
status = event.get_status()
if status == conic.STATUS_CONNECTED:
self.connected = True
if not self.touch_selector_entry_filled:
debug("connected, now fill")
self.fill_touch_selector_entry()
if self.refresh_in_progress:
self.refresh()
elif status == conic.STATUS_DISCONNECTED:
self.connected = False
def __init__(self, weboob):
self.touch_selector_entry_filled = False
self.refresh_in_progress = False
self.connected = False
self.weboob = weboob
try:
self.connection = conic.Connection()
self.connection.connect("connection-event", self.connect_event)
self.connection.set_property("automatic-connection-events", True)
self.connection.request_connection(conic.CONNECT_FLAG_NONE)
except NotImplementedError:
pass
horizontal_box = gtk.HBox()
self.main_window = toolkit.Window()
try:
self.refresh_button = toolkit.Button(
gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
hildon.BUTTON_ARRANGEMENT_HORIZONTAL,
"Actualiser"
)
self.retour_button = hildon.Button(
gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
hildon.BUTTON_ARRANGEMENT_HORIZONTAL,
"Retour"
)
self.combo_source = hildon.TouchSelectorEntry(text=True)
self.combo_dest = hildon.TouchSelectorEntry(text=True)
self.picker_button_source = hildon.PickerButton(
gtk.HILDON_SIZE_AUTO,
hildon.BUTTON_ARRANGEMENT_VERTICAL)
self.picker_button_dest = hildon.PickerButton(
gtk.HILDON_SIZE_AUTO,
hildon.BUTTON_ARRANGEMENT_VERTICAL
)
self.picker_button_source.set_sensitive(False)
self.picker_button_dest.set_sensitive(False)
self.picker_button_source.set_title("Gare de Depart")
self.picker_button_dest.set_title("Gare d'arrivee")
self.picker_button_source.set_selector(self.combo_source)
self.picker_button_dest.set_selector(self.combo_dest)
horizontal_box.pack_start(self.picker_button_source)
horizontal_box.pack_start(self.picker_button_dest)
except AttributeError:
self.refresh_button = gtk.Button("Actualiser")
self.retour_button = gtk.Button("Retour")
self.combo_source = gtk.combo_box_entry_new_text()
self.combo_dest = gtk.combo_box_entry_new_text()
horizontal_box.pack_start(self.combo_source)
horizontal_box.pack_start(self.combo_dest)
self.main_window.set_title("Horaires des Prochains Trains")
self.main_window.connect("destroy", self.on_main_window_destroy)
self.refresh_button.connect("clicked", self.on_refresh_button_clicked)
self.retour_button.set_sensitive(False)
self.retour_button.connect("clicked", self.on_retour_button_clicked)
self.treestore = gtk.TreeStore(str, str, str, str, str)
treeview = gtk.TreeView(self.treestore)
treeview.append_column(
gtk.TreeViewColumn(
'Train',
gtk.CellRendererText(),
text=0
))
treeview.append_column(
gtk.TreeViewColumn(
'Horaire',
gtk.CellRendererText(),
text=1
))
treeview.append_column(
gtk.TreeViewColumn(
'Destination',
gtk.CellRendererText(),
text=2
))
treeview.append_column(
gtk.TreeViewColumn(
'Voie',
gtk.CellRendererText(),
text=3
))
treeview.append_column(
gtk.TreeViewColumn(
'Information',
gtk.CellRendererText(),
text=4
))
vertical_box = gtk.VBox()
vertical_box.pack_start(horizontal_box)
horizontal_box.pack_start(self.retour_button)
vertical_box.pack_start(treeview)
vertical_box.pack_start(self.refresh_button)
self.main_window.add(vertical_box)
self.main_window.show_all()
self.fill_touch_selector_entry()
if toolkit != gtk:
self.picker_button_source.connect("value-changed",
self.check_station_input,
self.picker_button_source)
self.picker_button_dest.connect("value-changed",
self.check_station_input,
self.picker_button_dest)
def fill_touch_selector_entry(self):
liste = []
for backend in self.weboob.iter_backends():
for station in backend.iter_station_search(""):
liste.append(station.name.capitalize())
liste.sort()
for station in liste:
self.combo_source.append_text(station)
self.combo_dest.append_text(station)
self.touch_selector_entry_filled = True
if toolkit != gtk:
self.picker_button_source.set_sensitive(True)
def on_main_window_destroy(self, widget):
"exit application at the window close"
gtk.main_quit()
def on_main_window_show(self, param):
self.fill_touch_selector_entry()
def on_retour_button_clicked(self, widget):
"the button is clicked"
debug("on_retour_button_clicked")
self.refresh_in_progress = True
col_source = self.combo_source.get_active(0)
col_dest = self.combo_dest.get_active(0)
self.combo_source.set_active(0, col_dest)
self.combo_dest.set_active(0, col_source)
self.refresh()
def on_refresh_button_clicked(self, widget):
"the refresh button is clicked"
debug("on_refresh_button_clicked")
self.refresh_in_progress = True
try:
self.connection.request_connection(conic.CONNECT_FLAG_NONE)
except AttributeError:
if isinstance(conic, FakeConic):
self.refresh()
else:
raise
def check_station_input(self, widget, user_data):
if self.combo_source.get_current_text() is None:
self.picker_button_dest.set_sensitive(False)
self.refresh_button.set_sensitive(False)
self.retour_button.set_sensitive(False)
else:
self.picker_button_dest.set_sensitive(True)
if self.combo_dest.get_current_text() is None:
self.refresh_button.set_sensitive(False)
self.retour_button.set_sensitive(False)
else:
self.refresh_button.set_sensitive(True)
self.retour_button.set_sensitive(True)
def refresh(self):
"update departures"
banner = hildon.hildon_banner_show_information(self.main_window, "", "Chargement en cours")
banner.set_timeout(10000)
hildon.hildon_gtk_window_set_progress_indicator(self.main_window, 1)
self.treestore.clear()
try:
source_text = self.combo_source.get_current_text()
dest_text = self.combo_dest.get_current_text()
except AttributeError:
source_text = self.combo_source.child.get_text()
dest_text = self.combo_dest.child.get_text()
for backend in self.weboob.iter_backends():
for station in backend.iter_station_search(source_text):
for arrival in \
backend.iter_station_search(dest_text):
for departure in \
backend.iter_station_departures(station.id, arrival.id):
self.treestore.append(None,
[departure.type,
departure.time,
departure.arrival_station,
departure.plateform,
departure.information])
self.refresh_in_progress = False
banner.set_timeout(1)
hildon.hildon_gtk_window_set_progress_indicator(self.main_window, 0)
class Masstransit(Application):
"Application Class"
APPNAME = 'masstransit'
VERSION = '1.4'
COPYRIGHT = 'Copyright(C) 2010-YEAR Julien Hébert'
DESCRIPTION = "Maemo application allowing to search for train stations and get departure times."
SHORT_DESCRIPTION = "search for train stations and departures"
def main(self, argv):
self.load_backends(CapTravel)
MasstransitHildon(self.weboob)
gtk.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment