src/eric7/EricWidgets/EricSingleApplication.py

branch
eric7
changeset 10301
b4299b82fe37
parent 9653
e67609152c5e
child 10303
ee1aadab1215
equal deleted inserted replaced
10300:60e8f2175b3b 10301:b4299b82fe37
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from eric7.EricWidgets.EricApplication import ericApp 12 from eric7.EricWidgets.EricApplication import ericApp
13 from eric7.SystemUtilities import OSUtilities
14 from eric7.Toolbox.SingleApplication import ( 13 from eric7.Toolbox.SingleApplication import (
15 SingleApplicationClient, 14 SingleApplicationClient,
16 SingleApplicationServer, 15 SingleApplicationServer,
17 ) 16 )
18 17
117 """ 116 """
118 # no args, return 117 # no args, return
119 if args is None: 118 if args is None:
120 return 119 return
121 120
122 # holds space delimited list of command args, if any 121 if "--" in args:
123 argsStr = None 122 # store args after a '--' as a space delimited list of command args, if any
124 # flag indicating '--' options was found 123 ddindex = args.index("--")
125 ddseen = False 124 argsStr = " ".join(args[ddindex + 1:])
126 125 args = args[:ddindex]
127 argChars = ["-", "/"] if OSUtilities.isWindowsPlatform() else ["-"] 126 else:
127 argsStr = None
128 128
129 for arg in args: 129 for arg in args:
130 if arg == "--" and not ddseen: 130 ext = os.path.normcase(os.path.splitext(arg)[1])
131 ddseen = True
132 continue
133
134 if arg[0] in argChars or ddseen:
135 if argsStr is None:
136 argsStr = arg
137 else:
138 argsStr = "{0} {1}".format(argsStr, arg)
139 continue
140
141 ext = os.path.splitext(arg)[1]
142 ext = os.path.normcase(ext)
143 131
144 if ext in (".epj", ".e4p"): 132 if ext in (".epj", ".e4p"):
145 self.__openProject(arg) 133 self.__openProject(arg)
146 elif ext in (".emj", ".e4m", ".e5m"): 134 elif ext in (".emj", ".e4m", ".e5m"):
147 self.__openMultiProject(arg) 135 self.__openMultiProject(arg)

eric ide

mercurial