eric4-compare.py

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

eric ide

mercurial