eric5-sqlbrowser.py

changeset 15
f6ccc31d6e72
child 18
3b1f5d872fd7
equal deleted inserted replaced
14:092aa8fafa4e 15:f6ccc31d6e72
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2009 - 2010 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric4 SQL Browser
9
10 This is the main Python script that performs the necessary initialization
11 of the SQL browser and starts the Qt event loop.
12 """
13
14 import sys, os
15 import os
16
17 for arg in sys.argv:
18 if arg.startswith("--config="):
19 import Utilities
20 configDir = arg.replace("--config=", "")
21 Utilities.setConfigDir(configDir)
22 sys.argv.remove(arg)
23 break
24
25 from Utilities import Startup
26
27 def createMainWidget(argv):
28 """
29 Function to create the main widget.
30
31 @param argv list of commandline parameters (list of strings)
32 @return reference to the main widget (QWidget)
33 """
34 from SqlBrowser.SqlBrowser import SqlBrowser
35
36 if len(argv) > 1:
37 connections = argv[1:]
38 else:
39 connections = []
40
41 browser = SqlBrowser(connections)
42 return browser
43
44 def main():
45 """
46 Main entry point into the application.
47 """
48 options = [\
49 ("--config=configDir",
50 "use the given directory as the one containing the config files"),
51 ]
52 appinfo = Startup.makeAppInfo(sys.argv,
53 "Eric4 SQL Browser",
54 "connection",
55 "SQL browser",
56 options)
57 res = Startup.simpleAppStartup(sys.argv,
58 appinfo,
59 createMainWidget)
60 sys.exit(res)
61
62 if __name__ == '__main__':
63 main()

eric ide

mercurial