eric6_sqlbrowser.py

changeset 3669
ac84ac3c0f05
parent 3656
441956d8fce5
child 3670
f0cb7579c0b4
equal deleted inserted replaced
3668:0e83d06e5429 3669:ac84ac3c0f05
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2009 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric5 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 from __future__ import unicode_literals
15 try: # Only for Py2
16 import Utilities.compatibility_fixes # __IGNORE_WARNING__
17 except (ImportError):
18 pass
19
20 import sys
21
22 for arg in sys.argv:
23 if arg.startswith("--config="):
24 import Globals
25 configDir = arg.replace("--config=", "")
26 Globals.setConfigDir(configDir)
27 sys.argv.remove(arg)
28 break
29
30 from Globals import AppInfo
31
32 from Toolbox import Startup
33
34
35 def createMainWidget(argv):
36 """
37 Function to create the main widget.
38
39 @param argv list of commandline parameters (list of strings)
40 @return reference to the main widget (QWidget)
41 """
42 from SqlBrowser.SqlBrowser import SqlBrowser
43
44 if len(argv) > 1:
45 connections = argv[1:]
46 else:
47 connections = []
48
49 browser = SqlBrowser(connections)
50 return browser
51
52
53 def main():
54 """
55 Main entry point into the application.
56 """
57 options = [
58 ("--config=configDir",
59 "use the given directory as the one containing the config files"),
60 ]
61 appinfo = AppInfo.makeAppInfo(sys.argv,
62 "Eric5 SQL Browser",
63 "connection",
64 "SQL browser",
65 options)
66 res = Startup.simpleAppStartup(sys.argv,
67 appinfo,
68 createMainWidget)
69 sys.exit(res)
70
71 if __name__ == '__main__':
72 main()

eric ide

mercurial