3 # Copyright (C) 2007 k.remmelzwaal@planet.nl
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 import wx
, sys
, os
, getopt
23 showhelp
= '''Wixi %s (c) 2006-2008 k.remmelzwaal@planet.nl
25 -r <dir> --repository=<dir> (repository containing wiki's)
26 -w <wiki> --wiki=<wiki> (start with a specific wiki)
27 -g <geom> --geometry=<geom> (window width and height, default=850x550)
28 -v --viewmode (view only mode)
30 --navpanel=<left|off|right> (disable or align category/search panel, default=left)
31 --iconsize=<small|large> (select the size for icons, default=large (gtk))
37 #for path in sys.path:
38 # if path[-14:] == "/site-packages":
39 # icondir = path + "/wixi/icons/"
41 icondir
= os
.getcwd() + "/wixi/icons/"
42 options
.update({'icondir': icondir
})
45 if options
.get('viewmode'):
46 app
= wx
.PySimpleApp()
47 main
= wixi
.MainFrame
.ViewFrame(None, -1, "Wixi - " +version
, options
)
50 app
= wx
.PySimpleApp()
51 main
= wixi
.MainFrame
.MainFrame(None, -1, "Wixi - " +version
, options
)
54 if __name__
== '__main__':
57 options
, needhelp
= {'navpanel':'left','iconsize':'22x22','viewmode':False}, False
60 optlist
, args
= getopt
.getopt(sys
.argv
[1:], 'r:w:g:v',['navpanel=','repository=','iconsize=','geometry=','wiki=','viewmode'])
62 for opt
, arg
in optlist
:
64 if opt
in ("-r","--repository"): options
.update({'repository': arg
})
65 if opt
in ("-v","--viewmode"): options
.update({'viewmode': True})
66 if opt
in ("-w","--wiki"): options
.update({'wiki': arg
})
67 if opt
in ("-g","--geometry"):
68 width
= int(arg
.split('x')[0])
69 height
= int(arg
.split('x')[1])
70 options
.update({'geometry': (width
,height
)})
71 if opt
== "--navpanel": options
.update({'navpanel':arg
})
72 if opt
== "--iconsize":
73 if arg
== "small": options
.update({'iconsize':'16x16'})
74 else: options
.update({'iconsize':'22x22'})
76 except: needhelp
= True
78 if needhelp
: print showhelp