setOverrideCursor and restoreOverrideCursor

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

setOverrideCursor and restoreOverrideCursor

Post by PrzemoF »

I think that current (4e41e535ff01d39b650add123f42629e1a8d6b05 [1]) arrangement of setOverrideCursor and restoreOverrideCursor is incorrect. Cursor should be set (Wait) on CalculiX run and restored on calculixFinished, as below. I'll make patch if someone confirm that it makes sense. That doesn't solve the cursor error that I experience anyway [2]

Code: Select all

diff --git a/src/Mod/Fem/MechanicalAnalysis.py b/src/Mod/Fem/MechanicalAnalysis.py
index 412f20f..ddfdf8e 100644
--- a/src/Mod/Fem/MechanicalAnalysis.py
+++ b/src/Mod/Fem/MechanicalAnalysis.py
@@ -268,6 +268,8 @@ class _JobControlTaskPanel:
         
         
     def calculixFinished(self,exitCode):
+
+        QApplication.restoreOverrideCursor()
         print "calculixFinished()",exitCode
         print self.Calculix.state()
         out = self.Calculix.readAllStandardOutput()
@@ -536,10 +538,8 @@ class _JobControlTaskPanel:
 
         # run Claculix
         print 'run Calclulix at: ', self.CalculixBinary , '  with: ', self.Basename
+        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
         self.Calculix.start(self.CalculixBinary, ['-i',self.Basename])
-        
-        
-        QApplication.restoreOverrideCursor()
     
 class _ResultControlTaskPanel:
     '''The control for the displacement post-processing'''
[1] https://github.com/FreeCAD/FreeCAD_sf_m ... nalysis.py
[2]

Code: Select all

X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3
X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3
X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3
X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 2 (X_ChangeWindowAttributes)
  Resource id:  0x3
X Error: BadCursor (invalid Cursor parameter) 6
  Major opcode: 95 (X_FreeCursor)
  Resource id:  0x3
Post Reply