10 import sys |
10 import sys |
11 import os |
11 import os |
12 import logging |
12 import logging |
13 |
13 |
14 from PyQt5.QtCore import ( |
14 from PyQt5.QtCore import ( |
15 QObject, QTextCodec, QProcess, QProcessEnvironment, QTimer |
15 QObject, QProcess, QProcessEnvironment, QTimer |
16 ) |
16 ) |
17 from PyQt5.QtWidgets import QInputDialog |
17 from PyQt5.QtWidgets import QInputDialog |
18 |
18 |
19 from E5Gui.E5Application import e5App |
19 from E5Gui.E5Application import e5App |
20 from E5Gui import E5MessageBox |
20 from E5Gui import E5MessageBox |
60 # set default values for capabilities of clients |
60 # set default values for capabilities of clients |
61 self.clientCapabilities = ClientDefaultCapabilities |
61 self.clientCapabilities = ClientDefaultCapabilities |
62 |
62 |
63 # set translation function |
63 # set translation function |
64 self.translate = self.__identityTranslation |
64 self.translate = self.__identityTranslation |
65 |
|
66 self.codec = QTextCodec.codecForName( |
|
67 str(Preferences.getSystem("StringEncoding"))) |
|
68 |
65 |
69 if passive: |
66 if passive: |
70 # set translation function |
67 # set translation function |
71 if Preferences.getDebugger("PathTranslation"): |
68 if Preferences.getDebugger("PathTranslation"): |
72 self.translateRemote = Preferences.getDebugger( |
69 self.translateRemote = Preferences.getDebugger( |
1036 """ |
1033 """ |
1037 Private method to handle data from the client. |
1034 Private method to handle data from the client. |
1038 """ |
1035 """ |
1039 while self.qsock and self.qsock.canReadLine(): |
1036 while self.qsock and self.qsock.canReadLine(): |
1040 qs = self.qsock.readLine() |
1037 qs = self.qsock.readLine() |
1041 if self.codec is not None: |
1038 line = bytes(qs).decode( |
1042 line = self.codec.toUnicode(qs) |
1039 encoding=Preferences.getSystem("StringEncoding")) |
1043 else: |
|
1044 line = bytes(qs).decode() |
|
1045 |
1040 |
1046 logging.debug("<Debug-Server> %s", line) |
1041 logging.debug("<Debug-Server> %s", line) |
1047 ## print("Server: ", line) ##debug |
1042 ## print("Server: ", line) ##debug |
1048 |
1043 |
1049 self.__handleJsonCommand(line) |
1044 self.__handleJsonCommand(line) |