src/eric7/eric7_diff.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 sys.path.insert(1, os.path.dirname(__file__)) 18 sys.path.insert(1, os.path.dirname(__file__))
19 19
20 for arg in sys.argv[:]: 20 for arg in sys.argv[:]:
21 if arg.startswith("--config="): 21 if arg.startswith("--config="):
22 import Globals 22 import Globals
23
23 configDir = arg.replace("--config=", "") 24 configDir = arg.replace("--config=", "")
24 Globals.setConfigDir(configDir) 25 Globals.setConfigDir(configDir)
25 sys.argv.remove(arg) 26 sys.argv.remove(arg)
26 elif arg.startswith("--settings="): 27 elif arg.startswith("--settings="):
27 from PyQt6.QtCore import QSettings 28 from PyQt6.QtCore import QSettings
29
28 settingsDir = os.path.expanduser(arg.replace("--settings=", "")) 30 settingsDir = os.path.expanduser(arg.replace("--settings=", ""))
29 if not os.path.isdir(settingsDir): 31 if not os.path.isdir(settingsDir):
30 os.makedirs(settingsDir) 32 os.makedirs(settingsDir)
31 QSettings.setPath( 33 QSettings.setPath(
32 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir) 34 QSettings.Format.IniFormat, QSettings.Scope.UserScope, settingsDir
35 )
33 sys.argv.remove(arg) 36 sys.argv.remove(arg)
34 37
35 from Globals import AppInfo 38 from Globals import AppInfo
36 39
37 from Toolbox import Startup 40 from Toolbox import Startup
38 41
39 42
40 def createMainWidget(argv): 43 def createMainWidget(argv):
41 """ 44 """
42 Function to create the main widget. 45 Function to create the main widget.
43 46
44 @param argv list of commandline parameters (list of strings) 47 @param argv list of commandline parameters (list of strings)
45 @return reference to the main widget (QWidget) 48 @return reference to the main widget (QWidget)
46 """ 49 """
47 from UI.DiffDialog import DiffWindow 50 from UI.DiffDialog import DiffWindow
51
48 return DiffWindow() 52 return DiffWindow()
49 53
50 54
51 def main(): 55 def main():
52 """ 56 """
53 Main entry point into the application. 57 Main entry point into the application.
54 """ 58 """
55 from PyQt6.QtGui import QGuiApplication 59 from PyQt6.QtGui import QGuiApplication
60
56 QGuiApplication.setDesktopFileName("eric7_diff.desktop") 61 QGuiApplication.setDesktopFileName("eric7_diff.desktop")
57 62
58 options = [ 63 options = [
59 ("--config=configDir", 64 (
60 "use the given directory as the one containing the config files"), 65 "--config=configDir",
61 ("--settings=settingsDir", 66 "use the given directory as the one containing the config files",
62 "use the given directory to store the settings files"), 67 ),
68 (
69 "--settings=settingsDir",
70 "use the given directory to store the settings files",
71 ),
63 ] 72 ]
64 appinfo = AppInfo.makeAppInfo(sys.argv, 73 appinfo = AppInfo.makeAppInfo(
65 "eric Diff", 74 sys.argv, "eric Diff", "", "Simple graphical diff tool", options
66 "", 75 )
67 "Simple graphical diff tool", 76 res = Startup.simpleAppStartup(sys.argv, appinfo, createMainWidget)
68 options)
69 res = Startup.simpleAppStartup(sys.argv,
70 appinfo,
71 createMainWidget)
72 sys.exit(res) 77 sys.exit(res)
73 78
74 if __name__ == '__main__': 79
80 if __name__ == "__main__":
75 main() 81 main()

eric ide

mercurial