|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2006 - 2010 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric4 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 import os |
|
17 |
|
18 for arg in sys.argv: |
|
19 if arg.startswith("--config="): |
|
20 import Utilities |
|
21 configDir = arg.replace("--config=", "") |
|
22 Utilities.setConfigDir(configDir) |
|
23 sys.argv.remove(arg) |
|
24 break |
|
25 |
|
26 from Utilities import Startup |
|
27 |
|
28 def createMainWidget(argv): |
|
29 """ |
|
30 Function to create the main widget. |
|
31 |
|
32 @param argv list of commandline parameters (list of strings) |
|
33 @return reference to the main widget (QWidget) |
|
34 """ |
|
35 from UI.DiffDialog import DiffWindow |
|
36 return DiffWindow() |
|
37 |
|
38 def main(): |
|
39 """ |
|
40 Main entry point into the application. |
|
41 """ |
|
42 options = [\ |
|
43 ("--config=configDir", |
|
44 "use the given directory as the one containing the config files"), |
|
45 ] |
|
46 appinfo = Startup.makeAppInfo(sys.argv, |
|
47 "Eric4 Diff", |
|
48 "", |
|
49 "Simple graphical diff tool", |
|
50 options) |
|
51 res = Startup.simpleAppStartup(sys.argv, |
|
52 appinfo, |
|
53 createMainWidget) |
|
54 sys.exit(res) |
|
55 |
|
56 if __name__ == '__main__': |
|
57 main() |