eric7/Plugins/WizardPlugins/QRegularExpressionWizard/QRegularExpressionWizardDialog.py

branch
eric7
changeset 8459
0ae07748dbe8
parent 8415
c6236bed1b50
child 8881
54e42bc2437a
equal deleted inserted replaced
8458:d3bedd175c99 8459:0ae07748dbe8
138 self.variableLine.hide() 138 self.variableLine.hide()
139 self.regexpTextEdit.setFocus() 139 self.regexpTextEdit.setFocus()
140 140
141 def __sendCommand(self, command, **kw): 141 def __sendCommand(self, command, **kw):
142 """ 142 """
143 Private method to send a command to the PyQt5 server. 143 Private method to send a command to the server.
144 144
145 @param command dictionary with command string and related 145 @param command dictionary with command string and related
146 data (dict) 146 data (dict)
147 @keyparam kw parameters for the command 147 @keyparam kw parameters for the command
148 @return flag indicating a successful transmission (boolean) 148 @return flag indicating a successful transmission (boolean)
157 result = self.__pyqt6Server.waitForBytesWritten(10000) 157 result = self.__pyqt6Server.waitForBytesWritten(10000)
158 return result 158 return result
159 159
160 def __receiveResponse(self): 160 def __receiveResponse(self):
161 """ 161 """
162 Private method to receive a response from the PyQt5 server. 162 Private method to receive a response from the server.
163 163
164 @return response dictionary (dict) 164 @return response dictionary (dict)
165 """ 165 """
166 responseDict = {} 166 responseDict = {}
167 if self.__pyqt6Server.waitForReadyRead(10000): 167 if self.__pyqt6Server.waitForReadyRead(10000):
170 responseDict = json.loads(responseStr) 170 responseDict = json.loads(responseStr)
171 if responseDict["error"]: 171 if responseDict["error"]:
172 EricMessageBox.critical( 172 EricMessageBox.critical(
173 self, 173 self,
174 self.tr("Communication Error"), 174 self.tr("Communication Error"),
175 self.tr("""<p>The PyQt5 backend reported""" 175 self.tr("""<p>The backend reported an error.</p>"""
176 """ an error.</p><p>{0}</p>""") 176 """<p>{0}</p>""")
177 .format(responseDict["error"])) 177 .format(responseDict["error"]))
178 responseDict = {} 178 responseDict = {}
179 179
180 return responseDict 180 return responseDict
181 181
182 def shutdown(self): 182 def shutdown(self):
183 """ 183 """
184 Public method to shut down the PyQt5 server part. 184 Public method to shut down the server part.
185 """ 185 """
186 self.__sendCommand("exit") 186 self.__sendCommand("exit")
187 self.__pyqt6Server.waitForFinished(5000) 187 self.__pyqt6Server.waitForFinished(5000)
188 188
189 def __insertString(self, s, steps=0): 189 def __insertString(self, s, steps=0):
527 return 527 return
528 else: 528 else:
529 EricMessageBox.critical( 529 EricMessageBox.critical(
530 self, 530 self,
531 self.tr("Communication Error"), 531 self.tr("Communication Error"),
532 self.tr("""Invalid response received from""" 532 self.tr("""Invalid response received from backend."""))
533 """ PyQt5 backend."""))
534 else: 533 else:
535 EricMessageBox.critical( 534 EricMessageBox.critical(
536 self, 535 self,
537 self.tr("Communication Error"), 536 self.tr("Communication Error"),
538 self.tr("""Communication with PyQt5 backend""" 537 self.tr("""Communication with backend failed."""))
539 """ failed."""))
540 else: 538 else:
541 EricMessageBox.critical( 539 EricMessageBox.critical(
542 self, 540 self,
543 self.tr("Error"), 541 self.tr("Error"),
544 self.tr("""A regular expression must be given.""")) 542 self.tr("""A regular expression must be given."""))
698 self.resultTable.horizontalHeader().hide() 696 self.resultTable.horizontalHeader().hide()
699 else: 697 else:
700 EricMessageBox.critical( 698 EricMessageBox.critical(
701 self, 699 self,
702 self.tr("Communication Error"), 700 self.tr("Communication Error"),
703 self.tr("""Invalid response received from""" 701 self.tr("""Invalid response received from backend."""))
704 """ PyQt5 backend."""))
705 else: 702 else:
706 EricMessageBox.critical( 703 EricMessageBox.critical(
707 self, 704 self,
708 self.tr("Communication Error"), 705 self.tr("Communication Error"),
709 self.tr("""Communication with PyQt5""" 706 self.tr("""Communication with backend failed."""))
710 """ backend failed."""))
711 else: 707 else:
712 EricMessageBox.critical( 708 EricMessageBox.critical(
713 self, 709 self,
714 self.tr("Error"), 710 self.tr("Error"),
715 self.tr("""A regular expression and a text must""" 711 self.tr("""A regular expression and a text must"""

eric ide

mercurial