454 self.tr("Delete Protocols"), |
454 self.tr("Delete Protocols"), |
455 self.tr("Do you really want to delete these protocol files from" |
455 self.tr("Do you really want to delete these protocol files from" |
456 " the project?"), |
456 " the project?"), |
457 files) |
457 files) |
458 |
458 |
459 if dlg.exec() == QDialog.Accepted: |
459 if dlg.exec() == QDialog.DialogCode.Accepted: |
460 for fn2, fn in zip(fullNames, files): |
460 for fn2, fn in zip(fullNames, files): |
461 self.closeSourceWindow.emit(fn2) |
461 self.closeSourceWindow.emit(fn2) |
462 self.project.deleteFile(fn) |
462 self.project.deleteFile(fn) |
463 |
463 |
464 ########################################################################### |
464 ########################################################################### |
502 if self.compileProc is None: |
502 if self.compileProc is None: |
503 return |
503 return |
504 |
504 |
505 ioEncoding = Preferences.getSystem("IOEncoding") |
505 ioEncoding = Preferences.getSystem("IOEncoding") |
506 |
506 |
507 self.compileProc.setReadChannel(QProcess.StandardOutput) |
507 self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
508 while self.compileProc and self.compileProc.canReadLine(): |
508 while self.compileProc and self.compileProc.canReadLine(): |
509 s = 'protoc: ' |
509 s = 'protoc: ' |
510 output = str(self.compileProc.readLine(), ioEncoding, 'replace') |
510 output = str(self.compileProc.readLine(), ioEncoding, 'replace') |
511 s += output |
511 s += output |
512 self.appendStdout.emit(s) |
512 self.appendStdout.emit(s) |
519 if self.compileProc is None: |
519 if self.compileProc is None: |
520 return |
520 return |
521 |
521 |
522 ioEncoding = Preferences.getSystem("IOEncoding") |
522 ioEncoding = Preferences.getSystem("IOEncoding") |
523 |
523 |
524 self.compileProc.setReadChannel(QProcess.StandardError) |
524 self.compileProc.setReadChannel(QProcess.ProcessChannel.StandardError) |
525 while self.compileProc and self.compileProc.canReadLine(): |
525 while self.compileProc and self.compileProc.canReadLine(): |
526 s = 'protoc: ' |
526 s = 'protoc: ' |
527 error = str(self.compileProc.readLine(), ioEncoding, 'replace') |
527 error = str(self.compileProc.readLine(), ioEncoding, 'replace') |
528 s += error |
528 s += error |
529 self.appendStderr.emit(s) |
529 self.appendStderr.emit(s) |
539 @param grpc flag indicating to compile as gRPC files |
539 @param grpc flag indicating to compile as gRPC files |
540 @type bool |
540 @type bool |
541 """ |
541 """ |
542 self.__compileRunning = False |
542 self.__compileRunning = False |
543 ui = e5App().getObject("UserInterface") |
543 ui = e5App().getObject("UserInterface") |
544 if exitStatus == QProcess.NormalExit and exitCode == 0: |
544 if exitStatus == QProcess.ExitStatus.NormalExit and exitCode == 0: |
545 path = os.path.dirname(self.__protoFile) |
545 path = os.path.dirname(self.__protoFile) |
546 fileList = glob.glob(os.path.join(path, "*_pb2.py")) |
546 fileList = glob.glob(os.path.join(path, "*_pb2.py")) |
547 if grpc: |
547 if grpc: |
548 fileList += glob.glob(os.path.join(path, "*_pb2_grpc.py")) |
548 fileList += glob.glob(os.path.join(path, "*_pb2_grpc.py")) |
549 for file in fileList: |
549 for file in fileList: |
667 progress.setValue(i) |
667 progress.setValue(i) |
668 if progress.wasCanceled(): |
668 if progress.wasCanceled(): |
669 break |
669 break |
670 proc = self.__compileProto(fn, True, progress, grpc=grpc) |
670 proc = self.__compileProto(fn, True, progress, grpc=grpc) |
671 if proc is not None: |
671 if proc is not None: |
672 while proc.state() == QProcess.Running: |
672 while proc.state() == QProcess.ProcessState.Running: |
673 QApplication.processEvents() |
673 QApplication.processEvents() |
674 QThread.msleep(300) |
674 QThread.msleep(300) |
675 QApplication.processEvents() |
675 QApplication.processEvents() |
676 else: |
676 else: |
677 break |
677 break |
705 progress.setValue(i) |
705 progress.setValue(i) |
706 if progress.wasCanceled(): |
706 if progress.wasCanceled(): |
707 break |
707 break |
708 proc = self.__compileProto(fn, True, progress, grpc=grpc) |
708 proc = self.__compileProto(fn, True, progress, grpc=grpc) |
709 if proc is not None: |
709 if proc is not None: |
710 while proc.state() == QProcess.Running: |
710 while proc.state() == QProcess.ProcessState.Running: |
711 QApplication.processEvents() |
711 QApplication.processEvents() |
712 QThread.msleep(300) |
712 QThread.msleep(300) |
713 QApplication.processEvents() |
713 QApplication.processEvents() |
714 else: |
714 else: |
715 break |
715 break |