2 # -*- coding: utf-8 -*-
6 The client is called 'systematiki.py'.
9 # Copyright (C) 2007 Felix Rabe <public@felixrabe.textdriven.com>
11 # This library is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU Lesser General Public
13 # License as published by the Free Software Foundation; either
14 # version 2.1 of the License, or (at your option) any later version.
16 # This library is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # Lesser General Public License for more details.
21 # You should have received a copy of the GNU Lesser General Public License
22 # along with this library; if not, write to the Free Software Foundation,
23 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 # Recommended line length or text width: 75 characters.
27 from Systematiki
.Database
.Dummy
import Database
28 from Systematiki
.Networking
.BlockingStringProtocol
import StringProtocol
29 from Systematiki
.Networking
.XDRRPC
import XDRRPC
32 class ServerConfig(object):
34 Server configuration class.
36 TODO: Proper configuration using either command-line arguments,
37 configuration files, or a GUI.
40 def __init__(self
, argv
):
41 self
.host
= "localhost"
43 self
.database_class
= Database
48 database
= config
.database_class(config
)
49 server_proto
= StringProtocol()
50 server_proto
.listen((config
.host
, config
.port
))
51 cb
= lambda p
: cli_ui_cb_1(p
, database
)
52 server_proto
.accept(cb
)
55 def cli_ui_cb_1(client_proto
, database
):
56 rpc
= XDRRPC(client_proto
, database
)
60 config
= ServerConfig(argv
) # Might run and quit a gobject.MainLoop
61 if config
.ui
== "cli":
63 # TODO: GTK interface, web interface, brain interface, ...
67 if __name__
== "__main__":
69 sys
.exit(main(sys
.argv
))