Tools/TRSingleApplication.py

branch
maintenance
changeset 6646
51eefa621de4
parent 6645
ad476851d7e0
--- a/Tools/TRSingleApplication.py	Sat Dec 01 11:45:24 2018 +0100
+++ b/Tools/TRSingleApplication.py	Thu Jan 10 14:22:59 2019 +0100
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2004 - 2018 Detlev Offenbach <detlev@die-offenbachs.de>
+# Copyright (c) 2004 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
 #
 
 """
@@ -17,14 +17,14 @@
     SingleApplicationServer
 
 ###########################################################################
-# define some module global stuff
+## define some module global stuff
 ###########################################################################
 
 SAFile = "eric6_trpreviewer"
 
 # define the protocol tokens
-SALoadForm = '>LoadForm<'
-SALoadTranslation = '>LoadTranslation<'
+SALoadForm = 'LoadForm'
+SALoadTranslation = 'LoadTranslation'
 
 
 class TRSingleApplicationServer(SingleApplicationServer):
@@ -48,20 +48,20 @@
         
         self.parent = parent
 
-    def handleCommand(self, cmd, params):
+    def handleCommand(self, command, arguments):
         """
         Public slot to handle the command sent by the client.
         
-        @param cmd commandstring (string)
-        @param params parameterstring (string)
+        @param command command sent by the client
+        @type str
+        @param arguments list of command arguments
+        @type list of str
         """
-        if cmd == SALoadForm:
-            self.__saLoadForm(eval(params))
-            return
+        if command == SALoadForm:
+            self.__saLoadForm(arguments)
 
-        if cmd == SALoadTranslation:
-            self.__saLoadTranslation(eval(params))
-            return
+        elif command == SALoadTranslation:
+            self.__saLoadTranslation(arguments)
 
     def __saLoadForm(self, fnames):
         """
@@ -118,9 +118,7 @@
             elif ext == '.qm':
                 qmFiles.append(arg)
         
-        cmd = "{0}{1}\n".format(SALoadForm, str(uiFiles))
-        self.sendCommand(cmd)
-        cmd = "{0}{1}\n".format(SALoadTranslation, str(qmFiles))
-        self.sendCommand(cmd)
+        self.sendCommand(SALoadForm, uiFiles)
+        self.sendCommand(SALoadTranslation, qmFiles)
         
         self.disconnect()

eric ide

mercurial