Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
PD: [skip ci] in wizard shaft handle case where Plot module is not av…
…ailable
  • Loading branch information
wwmayer committed Dec 11, 2020
1 parent 1bc3954 commit be11a92
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Mod/PartDesign/WizardShaft/ShaftDiagram.py
Expand Up @@ -27,7 +27,7 @@
class Diagram:
def create(self, title, function, xlength, xname, xunit, xscale, yname, yunit, yscale, numxpoints):
# Initialize
import Plot
from freecad.plot import Plot
self.title = title
self.function = function # This is assumed to be always a SegmentFunction
self.xlength = xlength
Expand Down
49 changes: 30 additions & 19 deletions src/Mod/PartDesign/WizardShaft/WizardShaft.py
Expand Up @@ -22,6 +22,7 @@
# ******************************************************************************/

import FreeCAD, FreeCADGui
import traceback
from PySide import QtCore, QtGui
from .WizardShaftTable import WizardShaftTable
from .Shaft import Shaft
Expand Down Expand Up @@ -75,7 +76,7 @@ def __init__(self, doc):
self.shaft = Shaft(self)
# Create table widget
self.form = QtGui.QWidget()
self.table = WizardShaftTable(self, self.shaft)
self.table = WizardShaftTable(self, self.shaft)

# The top layout will contain the Shaft Wizard layout plus the elements of the FEM constraints dialog
layout = QtGui.QVBoxLayout()
Expand All @@ -90,48 +91,58 @@ def __init__(self, doc):
# Switch to feature window
mdi=FreeCADGui.getMainWindow().findChild(QtGui.QMdiArea)
cw.setActiveSubWindow(featureWindow)


def showDiagram(self, diagram):
try:
self.shaft.showDiagram(diagram)
except ImportError as e:
msgBox = QtGui.QMessageBox()
msgBox.setIcon(msgBox.Information)
msgBox.setWindowTitle("Missing module")
msgBox.setText("You may have to install the Plot add-on")
msgBox.setDetailedText(traceback.format_exc())
msgBox.exec_()
def slotAllx(self):
self.shaft.showDiagram("Allx")
self.showDiagram("Allx")
def slotAlly(self):
self.shaft.showDiagram("Ally")
self.showDiagram("Ally")
def slotAllz(self):
self.shaft.showDiagram("Allz")
self.showDiagram("Allz")

def slotFx(self):
self.shaft.showDiagram("Nx")
self.showDiagram("Nx")
def slotQy(self):
self.shaft.showDiagram("Qy")
self.showDiagram("Qy")
def slotQz(self):
self.shaft.showDiagram("Qz")
self.showDiagram("Qz")

def slotMx(self):
self.shaft.showDiagram("Mx")
self.showDiagram("Mx")
def slotMz(self):
self.shaft.showDiagram("Mz")
self.showDiagram("Mz")
def slotMy(self):
self.shaft.showDiagram("My")
self.showDiagram("My")

def slotNone(self):
pass
def slotWy(self):
self.shaft.showDiagram("wy")
self.showDiagram("wy")
def slotWz(self):
self.shaft.showDiagram("wz")
self.showDiagram("wz")

def slotSigmax(self):
self.shaft.showDiagram("sigmax")
self.showDiagram("sigmax")
def slotSigmay(self):
self.shaft.showDiagram("sigmay")
self.showDiagram("sigmay")
def slotSigmaz(self):
self.shaft.showDiagram("sigmaz")
self.showDiagram("sigmaz")

def slotTaut(self):
self.shaft.showDiagram("taut")
self.showDiagram("taut")
def slotSigmabz(self):
self.shaft.showDiagram("sigmabz")
self.showDiagram("sigmabz")
def slotSigmaby(self):
self.shaft.showDiagram("sigmaby")
self.showDiagram("sigmaby")

def updateButton(self, row, col, flag):
self.buttons[row][col].setEnabled(flag)
Expand Down

0 comments on commit be11a92

Please sign in to comment.