eric6_editor.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) 2007 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric5 Editor.
9
10 This is the main Python script that performs the necessary initialization
11 of the MiniEditor module and starts the Qt event loop. This is a standalone
12 version of the integrated MiniEditor module.
13 """
14
15 from __future__ import unicode_literals
16 try: # Only for Py2
17 import Utilities.compatibility_fixes # __IGNORE_WARNING__
18 except (ImportError):
19 pass
20
21 import sys
22 import os
23
24 for arg in sys.argv:
25 if arg.startswith("--config="):
26 import Globals
27 configDir = arg.replace("--config=", "")
28 Globals.setConfigDir(configDir)
29 sys.argv.remove(arg)
30 break
31
32 # make ThirdParty package available as a packages repository
33 sys.path.insert(2, os.path.join(os.path.dirname(__file__),
34 "ThirdParty", "Pygments"))
35
36 from Globals import AppInfo
37
38 from Toolbox import Startup
39
40
41 def createMainWidget(argv):
42 """
43 Function to create the main widget.
44
45 @param argv list of commandline parameters (list of strings)
46 @return reference to the main widget (QWidget)
47 """
48 from QScintilla.MiniEditor import MiniEditor
49 if len(argv) > 1:
50 return MiniEditor(argv[1])
51 else:
52 return MiniEditor()
53
54
55 def main():
56 """
57 Main entry point into the application.
58 """
59 options = [
60 ("--config=configDir",
61 "use the given directory as the one containing the config files"),
62 ("", "name of file to edit")
63 ]
64 appinfo = AppInfo.makeAppInfo(sys.argv,
65 "Eric5 Editor",
66 "",
67 "Simplified version of the eric5 editor",
68 options)
69 res = Startup.simpleAppStartup(sys.argv,
70 appinfo,
71 createMainWidget)
72 sys.exit(res)
73
74 if __name__ == '__main__':
75 main()

eric ide

mercurial