CxFreeze/CxfreezeExecDialog.py

branch
eric7
changeset 134
7880b294d1d1
parent 131
86d810eea380
child 136
d9228f38cfe8
--- a/CxFreeze/CxfreezeExecDialog.py	Thu Jun 03 14:27:52 2021 +0200
+++ b/CxFreeze/CxfreezeExecDialog.py	Thu Jun 03 17:51:56 2021 +0200
@@ -12,10 +12,10 @@
 import fnmatch
 import os.path
 
-from PyQt5.QtCore import pyqtSlot, QProcess, QTimer, QThread, pyqtSignal
-from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton
+from PyQt6.QtCore import pyqtSlot, QProcess, QTimer, QThread, pyqtSignal
+from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton
 
-from E5Gui import E5MessageBox
+from EricWidgets import EricMessageBox
 
 from .Ui_CxfreezeExecDialog import Ui_CxfreezeExecDialog
 
@@ -39,8 +39,10 @@
         super().__init__(parent)
         self.setupUi(self)
         
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setDefault(True)
         
         self.process = None
         self.copyProcess = None
@@ -50,13 +52,16 @@
         """
         Public slot to start the packager command.
         
-        @param args commandline arguments for packager program (list of
-            strings)
-        @param parms parameters got from the config dialog (dict)
-        @param ppath project path (string)
+        @param args commandline arguments for packager program
+        @type list of str
+        @param parms parameters got from the config dialog
+        @type dict
+        @param ppath project path
+        @type str
         @param mainscript main script name to be processed by by the packager
-            (string)
+        @type str
         @return flag indicating the successful start of the process
+        @rtype bool
         """
         self.errorGroup.hide()
         script = os.path.join(ppath, mainscript)
@@ -89,7 +94,7 @@
         self.process.start(program, args)
         procStarted = self.process.waitForStarted()
         if not procStarted:
-            E5MessageBox.critical(
+            EricMessageBox.critical(
                 self,
                 self.tr('Process Generation Error'),
                 self.tr(
@@ -103,11 +108,16 @@
         """
         Private slot called by a button of the button box clicked.
         
-        @param button button that was clicked (QAbstractButton)
+        @param button button that was clicked
+        @type QAbstractButton
         """
-        if button == self.buttonBox.button(QDialogButtonBox.Close):
+        if button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close
+        ):
             self.accept()
-        elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
+        elif button == self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel
+        ):
             self.additionalFiles = []   # Skip copying additional files
             self.__finish()
     
@@ -115,8 +125,8 @@
         """
         Private slot called when the process finished.
         
-        It is called when the process finished or
-        the user pressed the cancel button.
+        It is called when the process finished or the user pressed the
+        cancel button.
         """
         if self.process is not None:
             self.process.disconnect(self.__finishedFreeze)
@@ -138,8 +148,8 @@
         """
         Private slot called when the process finished.
         
-        It is called when the process finished or
-        the user pressed the cancel button.
+        It is called when the process finished or the user pressed the
+        cancel button.
         """
         self.process = None
 
@@ -159,9 +169,12 @@
         the user pressed the cancel button.
         """
         self.copyProcess = None
-        self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
-        self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
-        self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setEnabled(True)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
+        self.buttonBox.button(
+            QDialogButtonBox.StandardButton.Close).setDefault(True)
         self.contents.ensureCursorVisible()
 
     def __readStdout(self):
@@ -171,7 +184,7 @@
         It reads the output of the process, formats it and inserts it into
         the contents pane.
         """
-        self.process.setReadChannel(QProcess.StandardOutput)
+        self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
         
         while self.process.canReadLine():
             s = str(self.process.readAllStandardOutput(),
@@ -187,7 +200,7 @@
         It reads the error output of the process and inserts it into the
         error pane.
         """
-        self.process.setReadChannel(QProcess.StandardError)
+        self.process.setReadChannel(QProcess.ProcessChannel.StandardError)
         
         while self.process.canReadLine():
             self.errorGroup.show()
@@ -225,20 +238,26 @@
        
         Wildcards allowed. Existing files are overwitten.
         
-        @param src source file or folder to copy. Wildcards allowed. (str)
-        @param dst destination (str)
-        @exception OSError raised if there is an issue writing the package
-        @exception OSError raised if the given source does not exist
-        """                                             # __IGNORE_WARNING__
+        @param src source file or folder to copy. Wildcards allowed.
+        @type str
+        @param dst destination
+        @type str
+        @exception OSError raised if there is an issue writing the package or
+            the given source does not exist
+        """
         def src2dst(srcname, base, dst):
             """
             Combines the relativ path of the source (srcname) with the
             destination folder.
             
             @param srcname actual file or folder to copy
+            @type str
             @param base basename of the source folder
+            @type str
             @param dst basename of the destination folder
+            @type str
             @return destination path
+            @rtype str
             """
             delta = srcname.split(base)[1]
             return os.path.join(dst, delta[1:])
@@ -247,7 +266,7 @@
         initDone = False
         for root, dirs, files in os.walk(base):
             copied = False
-            # remove all none matching directorynames, create all others
+            # remove all none matching directory names, create all others
             for directory in dirs[:]:
                 pathname = os.path.join(root, directory)
                 if initDone or fnmatch.fnmatch(pathname, src):

eric ide

mercurial