1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2006 - 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric5 Diff |
|
9 |
|
10 This is the main Python script that performs the necessary initialization |
|
11 of the Diff module and starts the Qt event loop. This is a standalone |
|
12 version of the integrated Diff module. |
|
13 """ |
|
14 |
|
15 import sys |
|
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 UI.DiffDialog import DiffWindow |
|
35 return DiffWindow() |
|
36 |
|
37 def main(): |
|
38 """ |
|
39 Main entry point into the application. |
|
40 """ |
|
41 options = [\ |
|
42 ("--config=configDir", |
|
43 "use the given directory as the one containing the config files"), |
|
44 ] |
|
45 appinfo = Startup.makeAppInfo(sys.argv, |
|
46 "Eric5 Diff", |
|
47 "", |
|
48 "Simple graphical diff tool", |
|
49 options) |
|
50 res = Startup.simpleAppStartup(sys.argv, |
|
51 appinfo, |
|
52 createMainWidget) |
|
53 sys.exit(res) |
|
54 |
|
55 if __name__ == '__main__': |
|
56 main() |
|