Tools/TRSingleApplication.py

changeset 6622
3dfcbe478fd3
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
equal deleted inserted replaced
6621:db2ec0feca8a 6622:3dfcbe478fd3
15 15
16 from Toolbox.SingleApplication import SingleApplicationClient, \ 16 from Toolbox.SingleApplication import SingleApplicationClient, \
17 SingleApplicationServer 17 SingleApplicationServer
18 18
19 ########################################################################### 19 ###########################################################################
20 # define some module global stuff 20 ## define some module global stuff
21 ########################################################################### 21 ###########################################################################
22 22
23 SAFile = "eric6_trpreviewer" 23 SAFile = "eric6_trpreviewer"
24 24
25 # define the protocol tokens 25 # define the protocol tokens
26 SALoadForm = '>LoadForm<' 26 SALoadForm = 'LoadForm'
27 SALoadTranslation = '>LoadTranslation<' 27 SALoadTranslation = 'LoadTranslation'
28 28
29 29
30 class TRSingleApplicationServer(SingleApplicationServer): 30 class TRSingleApplicationServer(SingleApplicationServer):
31 """ 31 """
32 Class implementing the single application server embedded within the 32 Class implementing the single application server embedded within the
46 """ 46 """
47 SingleApplicationServer.__init__(self, SAFile) 47 SingleApplicationServer.__init__(self, SAFile)
48 48
49 self.parent = parent 49 self.parent = parent
50 50
51 def handleCommand(self, cmd, params): 51 def handleCommand(self, command, arguments):
52 """ 52 """
53 Public slot to handle the command sent by the client. 53 Public slot to handle the command sent by the client.
54 54
55 @param cmd commandstring (string) 55 @param command command sent by the client
56 @param params parameterstring (string) 56 @type str
57 @param arguments list of command arguments
58 @type list of str
57 """ 59 """
58 if cmd == SALoadForm: 60 if command == SALoadForm:
59 self.__saLoadForm(eval(params)) 61 self.__saLoadForm(arguments)
60 return
61 62
62 if cmd == SALoadTranslation: 63 elif command == SALoadTranslation:
63 self.__saLoadTranslation(eval(params)) 64 self.__saLoadTranslation(arguments)
64 return
65 65
66 def __saLoadForm(self, fnames): 66 def __saLoadForm(self, fnames):
67 """ 67 """
68 Private method used to handle the "Load Form" command. 68 Private method used to handle the "Load Form" command.
69 69
116 if ext == '.ui': 116 if ext == '.ui':
117 uiFiles.append(arg) 117 uiFiles.append(arg)
118 elif ext == '.qm': 118 elif ext == '.qm':
119 qmFiles.append(arg) 119 qmFiles.append(arg)
120 120
121 cmd = "{0}{1}\n".format(SALoadForm, str(uiFiles)) 121 self.sendCommand(SALoadForm, uiFiles)
122 self.sendCommand(cmd) 122 self.sendCommand(SALoadTranslation, qmFiles)
123 cmd = "{0}{1}\n".format(SALoadTranslation, str(qmFiles))
124 self.sendCommand(cmd)
125 123
126 self.disconnect() 124 self.disconnect()

eric ide

mercurial