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 |
63 # set default values for capabilities of clients |
63 # set default values for capabilities of clients |
64 self.clientCapabilities = ClientDefaultCapabilities |
64 self.clientCapabilities = ClientDefaultCapabilities |
65 |
65 |
66 # set translation function |
66 # set translation function |
67 self.translate = self.__identityTranslation |
67 self.translate = self.__identityTranslation |
68 |
|
69 self.codec = QTextCodec.codecForName( |
|
70 str(Preferences.getSystem("StringEncoding"))) |
|
71 |
68 |
72 if passive: |
69 if passive: |
73 # set translation function |
70 # set translation function |
74 if Preferences.getDebugger("PathTranslation"): |
71 if Preferences.getDebugger("PathTranslation"): |
75 self.translateRemote = Preferences.getDebugger( |
72 self.translateRemote = Preferences.getDebugger( |
1325 @param sock reference to the socket to read data from |
1322 @param sock reference to the socket to read data from |
1326 @type QTcpSocket |
1323 @type QTcpSocket |
1327 """ |
1324 """ |
1328 while sock and sock.canReadLine(): |
1325 while sock and sock.canReadLine(): |
1329 qs = sock.readLine() |
1326 qs = sock.readLine() |
1330 if self.codec is not None: |
1327 line = bytes(qs).decode( |
1331 line = self.codec.toUnicode(qs) |
1328 encoding=Preferences.getSystem("StringEncoding")) |
1332 else: |
|
1333 line = bytes(qs).decode() |
|
1334 |
1329 |
1335 logging.debug("<Debug-Server> %s", line) |
1330 logging.debug("<Debug-Server> %s", line) |
1336 ## print("Server: ", line) ##debug |
1331 ## print("Server: ", line) ##debug |
1337 |
1332 |
1338 self.__handleJsonCommand(line, sock) |
1333 self.__handleJsonCommand(line, sock) |