E5Gui/E5SingleApplication.py

branch
maintenance
changeset 6646
51eefa621de4
parent 6645
ad476851d7e0
equal deleted inserted replaced
6603:77189681b787 6646:51eefa621de4
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 2
3 # Copyright (c) 2004 - 2018 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2004 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """ 6 """
7 Module implementing the single application server and client. 7 Module implementing the single application server and client.
8 """ 8 """
17 SingleApplicationServer 17 SingleApplicationServer
18 18
19 import Utilities 19 import Utilities
20 20
21 ########################################################################### 21 ###########################################################################
22 # define some module global stuff 22 ## define some module global stuff
23 ########################################################################### 23 ###########################################################################
24 24
25 SAFile = "eric6" 25 SAFile = "eric6"
26 26
27 # define the protocol tokens 27 # define the protocol tokens
28 SAOpenFile = '>OpenFile<' 28 SAOpenFile = 'OpenFile'
29 SAOpenProject = '>OpenProject<' 29 SAOpenProject = 'OpenProject'
30 SAOpenMultiProject = '>OpenMultiProject<' 30 SAOpenMultiProject = 'OpenMultiProject'
31 SAArguments = '>Arguments<' 31 SAArguments = 'Arguments'
32 32
33 33
34 class E5SingleApplicationServer(SingleApplicationServer): 34 class E5SingleApplicationServer(SingleApplicationServer):
35 """ 35 """
36 Class implementing the single application server embedded within the IDE. 36 Class implementing the single application server embedded within the IDE.
39 """ 39 """
40 Constructor 40 Constructor
41 """ 41 """
42 SingleApplicationServer.__init__(self, SAFile) 42 SingleApplicationServer.__init__(self, SAFile)
43 43
44 def handleCommand(self, cmd, params): 44 def handleCommand(self, command, arguments):
45 """ 45 """
46 Public slot to handle the command sent by the client. 46 Public slot to handle the command sent by the client.
47 47
48 @param cmd commandstring (string) 48 @param command command sent by the client
49 @param params parameterstring (string) 49 @type str
50 @param arguments list of command arguments
51 @type list of str
50 """ 52 """
51 if cmd == SAOpenFile: 53 if command == SAOpenFile:
52 self.__saOpenFile(params) 54 self.__saOpenFile(arguments[0])
53 return 55 return
54 56
55 if cmd == SAOpenProject: 57 if command == SAOpenProject:
56 self.__saOpenProject(params) 58 self.__saOpenProject(arguments[0])
57 return 59 return
58 60
59 if cmd == SAOpenMultiProject: 61 if command == SAOpenMultiProject:
60 self.__saOpenMultiProject(params) 62 self.__saOpenMultiProject(arguments[0])
61 return 63 return
62 64
63 if cmd == SAArguments: 65 if command == SAArguments:
64 self.__saArguments(params) 66 self.__saArguments(arguments[0])
65 return 67 return
66 68
67 def __saOpenFile(self, fname): 69 def __saOpenFile(self, fname):
68 """ 70 """
69 Private method used to handle the "Open File" command. 71 Private method used to handle the "Open File" command.
159 """ 161 """
160 Private method to open a file in the application server. 162 Private method to open a file in the application server.
161 163
162 @param fname name of file to be opened (string) 164 @param fname name of file to be opened (string)
163 """ 165 """
164 cmd = "{0}{1}\n".format(SAOpenFile, Utilities.normabspath(fname)) 166 self.sendCommand(SAOpenFile, [Utilities.normabspath(fname)])
165 self.sendCommand(cmd)
166 167
167 def __openProject(self, pfname): 168 def __openProject(self, pfname):
168 """ 169 """
169 Private method to open a project in the application server. 170 Private method to open a project in the application server.
170 171
171 @param pfname name of the projectfile to be opened (string) 172 @param pfname name of the projectfile to be opened (string)
172 """ 173 """
173 cmd = "{0}{1}\n".format(SAOpenProject, Utilities.normabspath(pfname)) 174 self.sendCommand(SAOpenProject, [Utilities.normabspath(pfname)])
174 self.sendCommand(cmd)
175 175
176 def __openMultiProject(self, pfname): 176 def __openMultiProject(self, pfname):
177 """ 177 """
178 Private method to open a project in the application server. 178 Private method to open a project in the application server.
179 179
180 @param pfname name of the projectfile to be opened (string) 180 @param pfname name of the projectfile to be opened (string)
181 """ 181 """
182 cmd = "{0}{1}\n".format(SAOpenMultiProject, 182 self.sendCommand(SAOpenMultiProject, [Utilities.normabspath(pfname)])
183 Utilities.normabspath(pfname))
184 self.sendCommand(cmd)
185 183
186 def __sendArguments(self, argsStr): 184 def __sendArguments(self, argsStr):
187 """ 185 """
188 Private method to set the command arguments in the application server. 186 Private method to set the command arguments in the application server.
189 187
190 @param argsStr space delimited list of command args (string) 188 @param argsStr space delimited list of command args (string)
191 """ 189 """
192 cmd = "{0}{1}\n".format(SAArguments, argsStr) 190 self.sendCommand(SAArguments, [argsStr])
193 self.sendCommand(cmd)

eric ide

mercurial