src/eric7/EricWidgets/EricSingleApplication.py

branch
eric7
changeset 10303
ee1aadab1215
parent 10301
b4299b82fe37
child 10423
299802979277
equal deleted inserted replaced
10302:8cb0dabf852f 10303:ee1aadab1215
35 35
36 def __init__(self): 36 def __init__(self):
37 """ 37 """
38 Constructor 38 Constructor
39 """ 39 """
40 SingleApplicationServer.__init__(self, SAFile) 40 super().__init__(SAFile)
41 41
42 def handleCommand(self, command, arguments): 42 def handleCommand(self, command, arguments):
43 """ 43 """
44 Public slot to handle the command sent by the client. 44 Public slot to handle the command sent by the client.
45 45
104 104
105 def __init__(self): 105 def __init__(self):
106 """ 106 """
107 Constructor 107 Constructor
108 """ 108 """
109 SingleApplicationClient.__init__(self, SAFile) 109 super().__init__(SAFile)
110 110
111 def processArgs(self, args): 111 def processArgs(self, args):
112 """ 112 """
113 Public method to process the command line args passed to the UI. 113 Public method to process the command line args passed to the UI.
114 114
115 @param args list of files to open 115 @param args namespace object containing the parsed command line parameters
116 @type argparse.Namespace
116 """ 117 """
117 # no args, return 118 for filename in args.file_or_project:
118 if args is None: 119 ext = os.path.normcase(os.path.splitext(filename)[1])
119 return
120
121 if "--" in args:
122 # store args after a '--' as a space delimited list of command args, if any
123 ddindex = args.index("--")
124 argsStr = " ".join(args[ddindex + 1:])
125 args = args[:ddindex]
126 else:
127 argsStr = None
128
129 for arg in args:
130 ext = os.path.normcase(os.path.splitext(arg)[1])
131 120
132 if ext in (".epj", ".e4p"): 121 if ext in (".epj", ".e4p"):
133 self.__openProject(arg) 122 self.__openProject(filename)
134 elif ext in (".emj", ".e4m", ".e5m"): 123 elif ext in (".emj", ".e4m", ".e5m"):
135 self.__openMultiProject(arg) 124 self.__openMultiProject(filename)
136 else: 125 else:
137 self.__openFile(arg) 126 self.__openFile(filename)
138 127
139 # send any args we had 128 if args.dd_args:
140 if argsStr is not None: 129 # send any args we had
130 argsStr = " ".join(args.dd_args)
141 self.__sendArguments(argsStr) 131 self.__sendArguments(argsStr)
142 132
143 self.disconnect() 133 self.disconnect()
144 134
145 def __openFile(self, fname): 135 def __openFile(self, fname):

eric ide

mercurial