src/eric7/eric7_testing.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 9066
a219ade50f7c
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2002 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 eric testing.
9
10 This is the main Python script that performs the necessary initialization
11 of the testing module and starts the Qt event loop. This is a standalone
12 version of the integrated testing module.
13 """
14
15 import sys
16 import os
17
18 sys.path.insert(1, os.path.dirname(__file__))
19
20 for arg in sys.argv[:]:
21 if arg.startswith("--config="):
22 import Globals
23 configDir = arg.replace("--config=", "")
24 Globals.setConfigDir(configDir)
25 sys.argv.remove(arg)
26 elif arg.startswith("--settings="):
27 from PyQt6.QtCore import QSettings
28 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
29 if not os.path.isdir(settingsDir):
30 os.makedirs(settingsDir)
31 QSettings.setPath(
32 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir)
33 sys.argv.remove(arg)
34
35 from Globals import AppInfo
36
37 from Toolbox import Startup
38
39
40 def createMainWidget(argv):
41 """
42 Function to create the main widget.
43
44 @param argv list of commandline parameters
45 @type list of str
46 @return reference to the main widget
47 @rtype QWidget
48 """
49 from Testing.TestingWidget import TestingWindow
50 try:
51 fn = argv[1]
52 except IndexError:
53 fn = None
54 return TestingWindow(fn)
55
56
57 def main():
58 """
59 Main entry point into the application.
60 """
61 from PyQt6.QtGui import QGuiApplication
62 QGuiApplication.setDesktopFileName("eric7_testing.desktop")
63
64 options = [
65 ("--config=configDir",
66 "use the given directory as the one containing the config files"),
67 ("--settings=settingsDir",
68 "use the given directory to store the settings files"),
69 ]
70 appinfo = AppInfo.makeAppInfo(sys.argv,
71 "eric Testing",
72 "file",
73 "Graphical test application",
74 options)
75 res = Startup.simpleAppStartup(sys.argv,
76 appinfo,
77 createMainWidget)
78 sys.exit(res)
79
80 if __name__ == '__main__':
81 main()

eric ide

mercurial