2 # -*- coding: utf-8 -*-
6 The server is called 'systematikid.py'.
8 This client, once fully implemented, is intended to completely expose the
9 full potential of Systematiki. For actual day-to-day use, smaller clients
10 with a more limited set of features might be more suitable and friendly to
14 # Copyright (C) 2007 Felix Rabe <public@felixrabe.textdriven.com>
16 # This library is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU Lesser General Public
18 # License as published by the Free Software Foundation; either
19 # version 2.1 of the License, or (at your option) any later version.
21 # This library is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 # Lesser General Public License for more details.
26 # You should have received a copy of the GNU Lesser General Public License
27 # along with this library; if not, write to the Free Software Foundation,
28 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
30 # Recommended line length or text width: 75 characters.
32 from PyGTKShell
.RawConsole
import *
34 from Systematiki
.Database
.Proxy
import Database
35 from Systematiki
.Networking
.GObjectStringProtocol
import StringProtocol
38 class ClientConfig(object):
40 Client configuration class.
42 TODO: Proper configuration using either command-line arguments,
43 configuration files, or a GUI.
46 def __init__(self
, argv
):
47 self
.host
= "localhost"
49 self
.database_class
= Database
51 self
.str_proto_class
= StringProtocol
54 class ObjectView(Window
):
56 def __init__(self
, obj
):
57 super(ObjectView
, self
).__init
__()
58 self
.set_title("Systematiki Object")
62 database
= config
.database_class(config
)
63 database
.connect_client()(gtk_ui_cb_1
)
67 def gtk_ui_cb_1(database
):
72 print "calling retrieve_object..."
73 database
.retrieve_object("docroot")(gtk_ui_cb_2
)
76 def gtk_ui_cb_2(database
, obj
):
78 print "I got %r" % obj
82 config
= ClientConfig(argv
) # Might run and quit a gobject.MainLoop
83 if config
.ui
== "gtk":
85 # TODO: Command-line interface, web interface, brain interface, ...
89 if __name__
== "__main__":
91 sys
.exit(main(sys
.argv
))