|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric5 Snap |
|
9 |
|
10 This is the main Python script that performs the necessary initialization |
|
11 of the snapshot module and starts the Qt event loop. |
|
12 """ |
|
13 |
|
14 import sys |
|
15 |
|
16 for arg in sys.argv: |
|
17 if arg.startswith("--config="): |
|
18 import Utilities |
|
19 configDir = arg.replace("--config=", "") |
|
20 Utilities.setConfigDir(configDir) |
|
21 sys.argv.remove(arg) |
|
22 break |
|
23 |
|
24 from Utilities import Startup |
|
25 |
|
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 Snapshot.SnapWidget import SnapWidget |
|
35 return SnapWidget() |
|
36 |
|
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 "Eric5 Snap", |
|
48 "", |
|
49 "Simple utility to do snapshots of the screen.", |
|
50 options) |
|
51 res = Startup.simpleAppStartup(sys.argv, |
|
52 appinfo, |
|
53 createMainWidget) |
|
54 sys.exit(res) |
|
55 |
|
56 if __name__ == '__main__': |
|
57 main() |