def __init__(self,object):
        # the panel has a tree widget that contains categories
        # for the subcomponents, such as additions, subtractions.
        # the categories are shown only if they are not empty.
        form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")
        
        self.CalculixBinary = FreeCAD.getHomePath() +'bin/ccx.exe'
        self.TempDir = FreeCAD.ActiveDocument.TransientDir.replace('\\','/') + '/FemAnl_'+ object.Uid[-4:]
        if not os.path.isdir(self.TempDir):
            os.mkdir(self.TempDir)

        self.obj = object
        self.formUi = form_class()
        self.form = QtGui.QWidget()
        self.formUi.setupUi(self.form)
        #self.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
        self.Calculix = QtCore.QProcess()
        self.Timer = QtCore.QTimer()
        self.Timer.start(300)
        
        self.OutStr = ''
        
        #Connect Signals and Slots
        QtCore.QObject.connect(self.formUi.toolButton_chooseOutputDir, QtCore.SIGNAL("clicked()"), self.chooseOutputDir)
        QtCore.QObject.connect(self.formUi.pushButton_generate, QtCore.SIGNAL("clicked()"), self.run)

        QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("started()"), self.calculixStarted)
        QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("finished(int)"), self.calculixFinished)

        QtCore.QObject.connect(self.Timer, QtCore.SIGNAL("timeout()"), self.UpdateText)
        
        self.update()
    def __init__(self,object):
        # the panel has a tree widget that contains categories
        # for the subcomponents, such as additions, subtractions.
        # the categories are shown only if they are not empty.
        form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/ShowDisplacement.ui")

        self.obj = object
        self.formUi = form_class()
        self.form = QtGui.QWidget()
        self.formUi.setupUi(self.form)

        #Connect Signals and Slots
        QtCore.QObject.connect(self.formUi.radioButton_Displacement, QtCore.SIGNAL("clicked(bool)"), self.displacementClicked)
        QtCore.QObject.connect(self.formUi.radioButton_Stress, QtCore.SIGNAL("clicked(bool)"), self.stressClicked)
        QtCore.QObject.connect(self.formUi.radioButton_NoColor, QtCore.SIGNAL("clicked(bool)"), self.noColorClicked)
        QtCore.QObject.connect(self.formUi.checkBox_ShowDisplacement, QtCore.SIGNAL("clicked(bool)"), self.showDisplacementClicked)

        QtCore.QObject.connect(self.formUi.verticalScrollBar_Factor, QtCore.SIGNAL("valueChanged(int)"), self.sliderValue)

        QtCore.QObject.connect(self.formUi.spinBox_SliderFactor, QtCore.SIGNAL("valueChanged(double)"), self.sliderMaxValue)
        QtCore.QObject.connect(self.formUi.spinBox_DisplacementFactor, QtCore.SIGNAL("valueChanged(double)"), self.displacementFactorValue)

        self.DisplacementObject = None
        self.StressObject = None

        self.update()
示例#3
0
 def __init__(self, parent, label, default):
     super(StringWidget, self).__init__()
     self.ui = uic.loadUi(join(bolts_path, "value_widget.ui"))
     self.ui.label.setText(label)
     self.ui.valueEdit.setText(default)
     layout = QtGui.QHBoxLayout()
     layout.addWidget(self.ui)
     self.setLayout(layout)
示例#4
0
 def __init__(self, parent, prop, value):
     super(PropertyWidget, self).__init__()
     self.ui = uic.loadUi(join(bolts_path, "property_widget.ui"))
     self.ui.prop.setTextFormat(QtCore.Qt.RichText)
     self.ui.prop.setText("<b>%s:</b>" % prop)
     self.ui.value.setText(value)
     layout = QtGui.QHBoxLayout()
     layout.addWidget(self.ui)
     self.setLayout(layout)
示例#5
0
 def __init__(self, parent, label, default):
     super(BoolWidget, self).__init__()
     self.ui = uic.loadUi(join(bolts_path, "bool_widget.ui"))
     self.ui.checkBox.setText(label)
     if default == "True":
         self.ui.checkBox.setChecked(True)
     else:
         self.ui.checkBox.setChecked(False)
     layout = QtGui.QHBoxLayout()
     layout.addWidget(self.ui)
     self.setLayout(layout)
示例#6
0
    def __init__(self, parent, label, default):
        super(LengthWidget, self).__init__()
        self.ui = uic.loadUi(join(bolts_path, "value_widget.ui"))
        self.ui.label.setText(label)
        self.ui.valueEdit.setText(default)

        self.validator = QtGui.QDoubleValidator(0, sys.float_info.max, 4, self)
        self.ui.valueEdit.setValidator(self.validator)
        layout = QtGui.QHBoxLayout()
        layout.addWidget(self.ui)
        self.setLayout(layout)
示例#7
0
    def __init__(self, parent, label, keys, default):
        super(TableIndexWidget, self).__init__()
        self.ui = uic.loadUi(join(bolts_path, "tableindex_widget.ui"))
        self.ui.label.setText(label)

        for key, i in zip(keys, range(len(keys))):
            self.ui.comboBox.addItem(key)
            if key == default:
                self.ui.comboBox.setCurrentIndex(i)

        layout = QtGui.QHBoxLayout()
        layout.addWidget(self.ui)
        self.setLayout(layout)
示例#8
0
    def __init__(self, parent, label, default):
        super(AngleWidget, self).__init__()
        self.ui = uic.loadUi(join(bolts_path, "value_widget.ui"))
        self.ui.label.setText(label)
        self.ui.valueEdit.setText(default)

        self.validator = QtGui.QDoubleValidator(self)
        self.validator.setRange(-360., 360., 2)
        self.ui.valueEdit.setValidator(self.validator)

        layout = QtGui.QHBoxLayout()
        layout.addWidget(self.ui)
        self.setLayout(layout)
 def __init__(self):
     import os
     self.form = uic.loadUi(
         os.path.dirname(__file__) + '/ui/TaskPlacementShooter.ui')
     self.form.setWindowTitle("Placement Shooter")
     self.modeRadios = [
         (self.form.oriOrigin, 'origin'),
         (self.form.oriCamera, 'camera'),
         (self.form.oriSurface, 'surface'),
         (self.form.oriSurfaceU, 'surfaceU'),
         (self.form.oriSurfaceV, 'surfaceV'),
     ]
     QtCore.QObject.connect(self.form.btnUnedit, QtCore.SIGNAL('clicked()'),
                            self.uneditButtonClicked)
    def __init__(self,object):
        # the panel has a tree widget that contains categories
        # for the subcomponents, such as additions, subtractions.
        # the categories are shown only if they are not empty.
        form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")

        self.obj = object
        self.formUi = form_class()
        self.form = QtGui.QWidget()
        self.formUi.setupUi(self.form)
        self.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Machining_Distortion")

        #Connect Signals and Slots
        QtCore.QObject.connect(self.formUi.toolButton_chooseOutputDir, QtCore.SIGNAL("clicked()"), self.chooseOutputDir)
        QtCore.QObject.connect(self.formUi.pushButton_generate, QtCore.SIGNAL("clicked()"), self.run)

        self.update()
示例#11
0
    def __init__(self,obj):
        # the panel has a tree widget that contains categories
        # for the subcomponents, such as additions, subtractions.
        # the categories are shown only if they are not empty.
        form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/MechanicalMaterial.ui")

        self.obj = obj
        self.formUi = form_class()
        self.form = QtGui.QWidget()
        self.formUi.setupUi(self.form)
        self.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")


        QtCore.QObject.connect(self.formUi.pushButton_MatWeb, QtCore.SIGNAL("clicked()"), self.goMatWeb)
        QtCore.QObject.connect(self.formUi.comboBox_MaterialsInDir, QtCore.SIGNAL("currentIndexChanged(int)"), self.chooseMat)
        
        self.update()
示例#12
0
    def __init__(self, replacements, doc, message= "Replacing..."):
        QtCore.QObject.__init__(self)
        
        import os
        self.form = uic.loadUi(os.path.dirname(__file__) + os.path.sep + 'TaskReplace.ui')
        self.form.setWindowIcon(QtGui.QIcon(':/icons/PartOMagic_ReplaceObject.svg'))
        self.form.setWindowTitle("Replace object")

        self.replacements = replacements
        self.form.message.setText(message)
        
        #debug
        global instance
        instance = self
        
        if replacements:
            self.openTask()
示例#13
0
    def __init__(self, replacements, doc, message="Replacing..."):
        QtCore.QObject.__init__(self)

        import os
        self.form = uic.loadUi(
            os.path.dirname(__file__) + os.path.sep + 'TaskReplace.ui')
        self.form.setWindowIcon(
            QtGui.QIcon(':/icons/PartOMagic_ReplaceObject.svg'))
        self.form.setWindowTitle("Replace object")

        self.replacements = replacements
        self.form.message.setText(message)

        #debug
        global instance
        instance = self

        if replacements:
            self.openTask()
示例#14
0
    def __init__(self, object):
        # the panel has a tree widget that contains categories
        # for the subcomponents, such as additions, subtractions.
        # the categories are shown only if they are not empty.
        form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() +
                                                "Mod/Fem/ShowDisplacement.ui")

        self.obj = object
        self.formUi = form_class()
        self.form = QtGui.QWidget()
        self.formUi.setupUi(self.form)

        #Connect Signals and Slots
        QtCore.QObject.connect(self.formUi.radioButton_Displacement,
                               QtCore.SIGNAL("clicked(bool)"),
                               self.displacementClicked)
        QtCore.QObject.connect(self.formUi.radioButton_Stress,
                               QtCore.SIGNAL("clicked(bool)"),
                               self.stressClicked)
        QtCore.QObject.connect(self.formUi.radioButton_NoColor,
                               QtCore.SIGNAL("clicked(bool)"),
                               self.noColorClicked)
        QtCore.QObject.connect(self.formUi.checkBox_ShowDisplacement,
                               QtCore.SIGNAL("clicked(bool)"),
                               self.showDisplacementClicked)

        QtCore.QObject.connect(self.formUi.verticalScrollBar_Factor,
                               QtCore.SIGNAL("valueChanged(int)"),
                               self.sliderValue)

        QtCore.QObject.connect(self.formUi.spinBox_SliderFactor,
                               QtCore.SIGNAL("valueChanged(double)"),
                               self.sliderMaxValue)
        QtCore.QObject.connect(self.formUi.spinBox_DisplacementFactor,
                               QtCore.SIGNAL("valueChanged(double)"),
                               self.displacementFactorValue)

        self.DisplacementObject = None
        self.StressObject = None

        self.update()
    def __init__(self, object):
        # the panel has a tree widget that contains categories
        # for the subcomponents, such as additions, subtractions.
        # the categories are shown only if they are not empty.
        form_class, base_class = uic.loadUiType(
            FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")

        self.CalculixBinary = FreeCAD.getHomePath() + 'bin/ccx.exe'
        self.TempDir = FreeCAD.ActiveDocument.TransientDir.replace(
            '\\', '/') + '/FemAnl_' + object.Uid[-4:]
        if not os.path.isdir(self.TempDir):
            os.mkdir(self.TempDir)

        self.obj = object
        self.formUi = form_class()
        self.form = QtGui.QWidget()
        self.formUi.setupUi(self.form)
        #self.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
        self.Calculix = QtCore.QProcess()
        self.Timer = QtCore.QTimer()
        self.Timer.start(300)

        self.OutStr = ''

        #Connect Signals and Slots
        QtCore.QObject.connect(self.formUi.toolButton_chooseOutputDir,
                               QtCore.SIGNAL("clicked()"),
                               self.chooseOutputDir)
        QtCore.QObject.connect(self.formUi.pushButton_generate,
                               QtCore.SIGNAL("clicked()"), self.run)

        QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("started()"),
                               self.calculixStarted)
        QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("finished(int)"),
                               self.calculixFinished)

        QtCore.QObject.connect(self.Timer, QtCore.SIGNAL("timeout()"),
                               self.UpdateText)

        self.update()
示例#16
0
    def __init__(self, object):
        # the panel has a tree widget that contains categories
        # for the subcomponents, such as additions, subtractions.
        # the categories are shown only if they are not empty.
        form_class, base_class = uic.loadUiType(
            FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")

        self.obj = object
        self.formUi = form_class()
        self.form = QtGui.QWidget()
        self.formUi.setupUi(self.form)
        self.params = FreeCAD.ParamGet(
            "User parameter:BaseApp/Preferences/Mod/Machining_Distortion")

        #Connect Signals and Slots
        QtCore.QObject.connect(self.formUi.toolButton_chooseOutputDir,
                               QtCore.SIGNAL("clicked()"),
                               self.chooseOutputDir)
        QtCore.QObject.connect(self.formUi.pushButton_generate,
                               QtCore.SIGNAL("clicked()"), self.run)

        self.update()
	def __init__(self):
		# Get the user's home directory.
		self.homeDir = os.path.expanduser("~")

		# Load the qt uic form. It _must_ be in ~/.FreeCAD/Mod/FreeCAD-CuraEngine-Plugin, Perhaps there is a better way...
		self.form = uic.loadUi(self.homeDir + "/.FreeCAD/Mod/FreeCAD-CuraEngine-Plugin/MachineDef.ui")

		self.form.doubleSpinBox_1.setValue(readSetting("machinex"))
		self.form.doubleSpinBox_2.setValue(readSetting("machiney"))
		self.form.doubleSpinBox_3.setValue(readSetting("machinez"))
		self.form.doubleSpinBox_6.setValue(readSetting("offsetx"))
		self.form.doubleSpinBox_7.setValue(readSetting("offsety"))
		self.form.doubleSpinBox_4.setValue(readSetting("bedx"))
		self.form.doubleSpinBox_5.setValue(readSetting("bedy"))

		self.form.doubleSpinBox_1.valueChanged.connect(self._machineXStroke)
		self.form.doubleSpinBox_2.valueChanged.connect(self._machineYStroke)
		self.form.doubleSpinBox_3.valueChanged.connect(self._machineZStroke)
		self.form.doubleSpinBox_6.valueChanged.connect(self._bedXOffset)
		self.form.doubleSpinBox_7.valueChanged.connect(self._bedYOffset)
		self.form.doubleSpinBox_4.valueChanged.connect(self._bedXSize)
		self.form.doubleSpinBox_5.valueChanged.connect(self._bedYSize)
示例#18
0
    def __init__(self):
        # Get the user's home directory.
        self.homeDir = os.path.expanduser("~")

        # Load the qt uic form. It _must_ be in ~/.FreeCAD/Mod/FreeCAD-CuraEngine-Plugin, Perhaps there is a better way...
        self.form = uic.loadUi(
            self.homeDir +
            "/.FreeCAD/Mod/FreeCAD-CuraEngine-Plugin/MachineDef.ui")

        self.form.doubleSpinBox_1.setValue(readSetting("machinex"))
        self.form.doubleSpinBox_2.setValue(readSetting("machiney"))
        self.form.doubleSpinBox_3.setValue(readSetting("machinez"))
        self.form.doubleSpinBox_6.setValue(readSetting("offsetx"))
        self.form.doubleSpinBox_7.setValue(readSetting("offsety"))
        self.form.doubleSpinBox_4.setValue(readSetting("bedx"))
        self.form.doubleSpinBox_5.setValue(readSetting("bedy"))

        self.form.doubleSpinBox_1.valueChanged.connect(self._machineXStroke)
        self.form.doubleSpinBox_2.valueChanged.connect(self._machineYStroke)
        self.form.doubleSpinBox_3.valueChanged.connect(self._machineZStroke)
        self.form.doubleSpinBox_6.valueChanged.connect(self._bedXOffset)
        self.form.doubleSpinBox_7.valueChanged.connect(self._bedYOffset)
        self.form.doubleSpinBox_4.valueChanged.connect(self._bedXSize)
        self.form.doubleSpinBox_5.valueChanged.connect(self._bedYSize)
示例#19
0
import FreeCADGui

from ..bolttools import freecad
from ..bolttools.blt import Collection
from ..bolttools.blt import ClassName
from ..bolttools.blt import ClassStandard

from .. import USE_PYSIDE
if USE_PYSIDE:
    from PySide import QtCore
    from PySide import QtGui
    from FreeCADGui import PySideUic as uic

    try:
        bolts_path = dirname(__file__)
        Ui_BoltsWidget, QBoltsWidget = uic.loadUiType(
            join(bolts_path, 'bolts_widget.ui'))
        Ui_ValueWidget, QValueWidget = uic.loadUiType(
            join(bolts_path, 'value_widget.ui'))
        Ui_BoolWidget, QBoolWidget = uic.loadUiType(
            join(bolts_path, 'bool_widget.ui'))
        Ui_TableIndexWidget, QTableIndexWidget = uic.loadUiType(
            join(bolts_path, 'tableindex_widget.ui'))
        Ui_PropertyWidget, QPropertyWidget = uic.loadUiType(
            join(bolts_path, 'property_widget.ui'))
    except ImportError:
        FreeCAD.Console.PrintError(
            "uic import failed. Make sure that the pyside tools are installed")
        raise
    from PySide.QtCore import Slot

    def unpack(x):
示例#20
0
    def __init__(self, obj_to_attach,
                       take_selection = False,
                       create_transaction = True,
                       callback_OK        = None,
                       callback_Cancel    = None,
                       callback_Apply     = None):

        self.__define_attributes()

        self.create_transaction = create_transaction
        self.callback_OK        = callback_OK
        self.callback_Cancel    = callback_Cancel
        self.callback_Apply     = callback_Apply

        self.obj = obj_to_attach
        if hasattr(obj_to_attach,'Attacher'):
            self.attacher = obj_to_attach.Attacher
        elif hasattr(obj_to_attach,'AttacherType'):
            self.attacher = Part.AttachEngine(obj_to_attach.AttacherType)
        else:
            movable = True
            if not hasattr(self.obj, "Placement"):
                movable = False
            if 'Hidden' in self.obj.getEditorMode("Placement") or 'ReadOnly' in self.obj.getEditorMode("Placement"):
                movable = False
            if not movable:
                if self.callback_Cancel:
                    self.callback_Cancel()
                raise ValueError(_translate('AttachmentEditor',"Object {name} is neither movable nor attachable, can't edit attachment",None)
                                 .format(name= self.obj.Label))

            self.obj_is_attachable = False
            self.attacher = Part.AttachEngine()

            mb = QtGui.QMessageBox()
            mb.setIcon(mb.Icon.Warning)
            mb.setText(_translate('AttachmentEditor',
                         "{obj} is not attachable. You can still use attachment editor dialog to align the object, but the attachment won't be parametric."
                         ,None)
                       .format(obj= obj_to_attach.Label))
            mb.setWindowTitle(_translate('AttachmentEditor',"Attachment",None))
            btnAbort = mb.addButton(QtGui.QMessageBox.StandardButton.Abort)
            btnOK = mb.addButton(_translate('AttachmentEditor',"Continue",None),QtGui.QMessageBox.ButtonRole.ActionRole)
            mb.setDefaultButton(btnOK)
            mb.exec_()
            if mb.clickedButton() is btnAbort:
                if self.callback_Cancel:
                    self.callback_Cancel()
                raise CancelError()

        import os
        self.form=uic.loadUi(os.path.dirname(__file__) + os.path.sep + 'TaskAttachmentEditor.ui')
        self.form.setWindowIcon(QtGui.QIcon(':/icons/Part_Attachment.svg'))
        self.form.setWindowTitle(_translate('AttachmentEditor',"Attachment",None))

        self.refLines = [self.form.lineRef1,
                         self.form.lineRef2,
                         self.form.lineRef3,
                         self.form.lineRef4]
        self.refButtons = [self.form.buttonRef1,
                           self.form.buttonRef2,
                           self.form.buttonRef3,
                           self.form.buttonRef4]
        self.attachmentOffsetEdits = [self.form.attachmentOffsetX,
                                    self.form.attachmentOffsetY,
                                    self.form.attachmentOffsetZ,
                                    self.form.attachmentOffsetYaw,
                                    self.form.attachmentOffsetPitch,
                                    self.form.attachmentOffsetRoll]

        self.block = False

        for i in range(len(self.refLines)):
            QtCore.QObject.connect(self.refLines[i], QtCore.SIGNAL('textEdited(QString)'), lambda txt, i=i: self.lineRefChanged(i,txt))

        for i in range(len(self.refLines)):
            QtCore.QObject.connect(self.refButtons[i], QtCore.SIGNAL('clicked()'), lambda i=i: self.refButtonClicked(i))

        for i in range(len(self.attachmentOffsetEdits)):
            QtCore.QObject.connect(self.attachmentOffsetEdits[i], QtCore.SIGNAL('valueChanged(double)'), lambda val, i=i: self.attachmentOffsetChanged(i,val))

        QtCore.QObject.connect(self.form.checkBoxFlip, QtCore.SIGNAL('clicked()'), self.checkBoxFlipClicked)

        QtCore.QObject.connect(self.form.listOfModes, QtCore.SIGNAL('itemSelectionChanged()'), self.modeSelected)

        if self.create_transaction:
            self.obj.Document.openTransaction(_translate('AttachmentEditor',"Edit attachment of {feat}",None).format(feat= self.obj.Name))


        self.readParameters()


        if len(self.attacher.References) == 0 and take_selection:
            sel = GetSelectionAsLinkSubList()
            for i in range(len(sel))[::-1]:
                if sel[i][0] is obj_to_attach:
                    sel.pop(i)
            self.attacher.References = sel
            # need to update textboxes
            self.fillAllRefLines()

        if len(self.attacher.References) == 0:
            self.i_active_ref = 0
            self.auto_next = True
        else:
            self.i_active_ref = -1
            self.auto_next = False

        Gui.Selection.addObserver(self)

        self.updatePreview()
        self.updateRefButtons()

        self.tv = TempoVis(self.obj.Document, tag= "PartGui.TaskAttachmentEditor")
        if self.tv: # tv will still be None if Show module is unavailable
            self.tv.hide_all_dependent(self.obj)
            self.tv.show(self.obj)
            self.tv.setUnpickable(self.obj)
            self.tv.modifyVPProperty(self.obj, "Transparency", 70)
            self.tv.show([obj for (obj,subname) in self.attacher.References])
示例#21
0
    def __init__(self, obj_to_attach,
                       take_selection = False,
                       create_transaction = True,
                       callback_OK        = None,
                       callback_Cancel    = None,
                       callback_Apply     = None):

        self.__define_attributes()

        self.create_transaction = create_transaction
        self.callback_OK        = callback_OK
        self.callback_Cancel    = callback_Cancel
        self.callback_Apply     = callback_Apply

        self.obj = obj_to_attach
        if hasattr(obj_to_attach,'Attacher'):
            self.attacher = obj_to_attach.Attacher
        elif hasattr(obj_to_attach,'AttacherType'):
            self.attacher = Part.AttachEngine(obj_to_attach.AttacherType)
        else:
            movable = True
            if not hasattr(self.obj, "Placement"):
                movable = False
            if 'Hidden' in self.obj.getEditorMode("Placement") or 'ReadOnly' in self.obj.getEditorMode("Placement"):
                movable = False
            if not movable:
                if self.callback_Cancel:
                    self.callback_Cancel()
                raise ValueError(_translate('AttachmentEditor',"Object {name} is neither movable nor attachable, can't edit attachment",None)
                                 .format(name= self.obj.Label))

            self.obj_is_attachable = False
            self.attacher = Part.AttachEngine()

            mb = QtGui.QMessageBox()
            mb.setIcon(mb.Icon.Warning)
            mb.setText(_translate('AttachmentEditor',
                         "{obj} is not attachable. You can still use attachment editor dialog to align the object, but the attachment won't be parametric."
                         ,None)
                       .format(obj= obj_to_attach.Label))
            mb.setWindowTitle(_translate('AttachmentEditor',"Attachment",None))
            btnAbort = mb.addButton(QtGui.QMessageBox.StandardButton.Abort)
            btnOK = mb.addButton(_translate('AttachmentEditor',"Continue",None),QtGui.QMessageBox.ButtonRole.ActionRole)
            mb.setDefaultButton(btnOK)
            mb.exec_()
            if mb.clickedButton() is btnAbort:
                if self.callback_Cancel:
                    self.callback_Cancel()
                raise CancelError()

        import os
        self.form=uic.loadUi(os.path.dirname(__file__) + os.path.sep + 'TaskAttachmentEditor.ui')
        self.form.setWindowIcon(QtGui.QIcon(':/icons/Part_Attachment.svg'))
        self.form.setWindowTitle(_translate('AttachmentEditor',"Attachment",None))

        self.refLines = [self.form.lineRef1,
                         self.form.lineRef2,
                         self.form.lineRef3,
                         self.form.lineRef4]
        self.refButtons = [self.form.buttonRef1,
                           self.form.buttonRef2,
                           self.form.buttonRef3,
                           self.form.buttonRef4]
        self.attachmentOffsetEdits = [self.form.attachmentOffsetX,
                                    self.form.attachmentOffsetY,
                                    self.form.attachmentOffsetZ,
                                    self.form.attachmentOffsetYaw,
                                    self.form.attachmentOffsetPitch,
                                    self.form.attachmentOffsetRoll]

        self.block = False

        for i in range(len(self.refLines)):
            QtCore.QObject.connect(self.refLines[i], QtCore.SIGNAL('textEdited(QString)'), lambda txt, i=i: self.lineRefChanged(i,txt))

        for i in range(len(self.refLines)):
            QtCore.QObject.connect(self.refButtons[i], QtCore.SIGNAL('clicked()'), lambda i=i: self.refButtonClicked(i))

        for i in range(len(self.attachmentOffsetEdits)):
            QtCore.QObject.connect(self.attachmentOffsetEdits[i], QtCore.SIGNAL('valueChanged(double)'), lambda val, i=i: self.attachmentOffsetChanged(i,val))

        QtCore.QObject.connect(self.form.checkBoxFlip, QtCore.SIGNAL('clicked()'), self.checkBoxFlipClicked)

        QtCore.QObject.connect(self.form.listOfModes, QtCore.SIGNAL('itemSelectionChanged()'), self.modeSelected)

        if self.create_transaction:
            self.obj.Document.openTransaction(_translate('AttachmentEditor',"Edit attachment of {feat}",None).format(feat= self.obj.Name))


        self.readParameters()


        if len(self.attacher.References) == 0 and take_selection:
            sel = GetSelectionAsLinkSubList()
            for i in range(len(sel))[::-1]:
                if sel[i][0] is obj_to_attach:
                    sel.pop(i)
            self.attacher.References = sel
            # need to update textboxes
            self.fillAllRefLines()

        if len(self.attacher.References) == 0:
            self.i_active_ref = 0
            self.auto_next = True
        else:
            self.i_active_ref = -1
            self.auto_next = False

        Gui.Selection.addObserver(self)

        self.updatePreview()
        self.updateRefButtons()

        self.tv = TempoVis(self.obj.Document)
        if self.tv: # tv will still be None if Show module is unavailable
            self.tv.hide_all_dependent(self.obj)
            self.tv.show(self.obj)
            self.tv.setUnpickable(self.obj)
            self.tv.modifyVPProperty(self.obj, "Transparency", 70)
            self.tv.show([obj for (obj,subname) in self.attacher.References])
    def __init__(self, obj_to_attach, bool_take_selection):
        
        self.__define_attributes()
        
        self.obj = obj_to_attach
        if hasattr(obj_to_attach,"Attacher"):
            self.attacher = obj_to_attach.Attacher
        elif hasattr(obj_to_attach,"AttacherType"):
            self.attacher = Part.AttachEngine(obj_to_attach.AttacherType)
        else:
            self.obj_is_attachable = False
            self.attacher = Part.AttachEngine()
            
            mb = QtGui.QMessageBox()
            mb.setIcon(mb.Icon.Warning)
            mb.setText("{obj} is not attachable. You can still use attachment editor dialog to align the object, but the attachment won't be parametic."
                       .format(obj= obj_to_attach.Label))
            mb.setWindowTitle("Attachment")
            btnAbort = mb.addButton(QtGui.QMessageBox.StandardButton.Abort)
            btnOK = mb.addButton("Continue",QtGui.QMessageBox.ButtonRole.ActionRole)
            mb.setDefaultButton(btnOK)
            mb.exec_()
            if mb.clickedButton() is btnAbort:
                raise CancelError()
        
        import os
        self.form=uic.loadUi(os.path.dirname(__file__) + os.path.sep + "TaskAttachmentEditor.ui")
        # self.form.setWindowIcon(QtGui.QIcon(":/icons/PartDesign_InternalExternalGear.svg"))
        self.form.setWindowTitle("Attachment")
        
        self.refLines = [self.form.lineRef1, 
                         self.form.lineRef2,
                         self.form.lineRef3,
                         self.form.lineRef4]
        self.refButtons = [self.form.buttonRef1,
                           self.form.buttonRef2,
                           self.form.buttonRef3,
                           self.form.buttonRef4]
        self.superPlacementEdits = [self.form.superplacementX,
                                    self.form.superplacementY,
                                    self.form.superplacementZ,
                                    self.form.superplacementYaw,
                                    self.form.superplacementPitch,
                                    self.form.superplacementRoll]
                           
        self.block = False
                           
        for i in range(len(self.refLines)):
            QtCore.QObject.connect(self.refLines[i], QtCore.SIGNAL("textEdited(QString)"), lambda txt, i=i: self.lineRefChanged(i,txt))

        for i in range(len(self.refLines)):
            QtCore.QObject.connect(self.refButtons[i], QtCore.SIGNAL("clicked()"), lambda i=i: self.refButtonClicked(i))
        
        for i in range(len(self.superPlacementEdits)):
            QtCore.QObject.connect(self.superPlacementEdits[i], QtCore.SIGNAL("valueChanged(double)"), lambda val, i=i: self.superplacementChanged(i,val))
            
        QtCore.QObject.connect(self.form.checkBoxFlip, QtCore.SIGNAL("clicked()"), self.checkBoxFlipClicked)
        
        QtCore.QObject.connect(self.form.listOfModes, QtCore.SIGNAL("itemSelectionChanged()"), self.modeSelected)
        
        self.obj.Document.openTransaction("Edit attachment of {feat}".format(feat= self.obj.Name))
        

        self.readParameters()

        
        if len(self.attacher.References) == 0 and bool_take_selection:
            sel = GetSelectionAsLinkSubList()
            for i in range(len(sel))[::-1]:
                if sel[i][0] is obj_to_attach:
                    sel.pop(i)
            self.attacher.References = sel
        if len(self.attacher.References) == 0:
            self.i_active_ref = 0
            self.auto_next = True
        else:
            self.i_active_ref = -1
            self.auto_next = False

        Gui.Selection.addObserver(self)

        self.updatePreview()
        self.updateRefButtons()
        
        self.tv = TempoVis(self.obj.Document)
        self.tv.hide_all_dependent(self.obj)
        self.tv.show(self.obj)
        self.tv.show([obj for (obj,subname) in self.attacher.References])
示例#23
0
    def __init__(self):
        # Get the user's home directory.
        self.homeDir = os.path.expanduser("~")

        # Load the qt uic form. It _must_ be in ~/.FreeCAD/Mod/FreeCAD-CuraEngine-Plugin, Perhaps there is a better way...
        self.form = uic.loadUi(
            self.homeDir + "/.FreeCAD/Mod/FreeCAD-CuraEngine-Plugin/Slicer.ui")

        # Set the Default Values
        self.Vars = SliceDef()

        # Tab 1
        self.form.input_1_curapath.setText(self.Vars.readMisc("CuraPath"))
        self.initMisc(self.form.input_1_NOZDIA, "NozzleDiameter",
                      self._nozzleDiameter)

        self.initSetting(self.form.input_2_FILDIA, "filamentDiameter",
                         self._filamentDiameter)

        if not self.Vars.readMisc("OPPMODE"):
            self.form.Group_5_OPP.setChecked(False)
        self.initSetting(self.form.input_1_POSX, "posx", self._posx)
        self.initSetting(self.form.input_2_POSY, "posy", self._posy)
        self.initSetting(self.form.input_3_POSZ, "objectSink",
                         self._objectSink)

        self.initSetting(self.form.input_0_FLH, "initialLayerThickness",
                         self._initialLayerThickness)
        self.initSetting(self.form.input_1_LH, "layerThickness",
                         self._layerThickness)
        self.initSetting(self.form.input_2_PS, "insetCount", self._insetCount)
        self.initSetting(self.form.input_3_SBL, "downSkinCount",
                         self._downSkinCount)
        self.initSetting(self.form.input_4_STL, "upSkinCount",
                         self._upSkinCount)
        self.initMisc(self.form.input_5_DN, "InfillDensity",
                      self._InfillDensity)
        self.initSetting(self.form.input_6_EF, "filamentFlow",
                         self._filamentFlow)
        self.initSetting(self.form.input_1_LFR, "printSpeed", self._printSpeed)
        # Set inset speeds here temporarily until added to GUI############################
        self.Vars.writeSetting("inset0Speed",
                               self.Vars.readSetting("printSpeed"))
        self.Vars.writeSetting("insetXSpeed",
                               self.Vars.readSetting("printSpeed"))
        ##################################################################################
        self.initSetting(self.form.input_2_RFR, "moveSpeed", self._moveSpeed)
        self.initSetting(self.form.input_3_IFR, "infillSpeed",
                         self._infillSpeed)
        self.initSetting(self.form.input_4_FLFR, "initialLayerSpeed",
                         self._initialLayerSpeed)
        self.initSetting(self.form.input_5_MLT, "minimalLayerTime",
                         self._minimalLayerTime)

        self.initMisc(self.form.input_1_NT, "NozzleTemp", self._NozzleTemp)
        self.initMisc(self.form.input_2_BT, "BedTemp", self._BedTemp)

        # Set fan
        if not self.Vars.readMisc("FANMODE"):
            self.form.Group_0_EnableFan.setChecked(False)
        self.initSetting(self.form.input_1_MinFS, "fanSpeedMin",
                         self._fanSpeedMin)
        self.initSetting(self.form.input_2_MaxFS, "fanSpeedMax",
                         self._fanSpeedMax)
        self.form.slider_1_MinFS.setValue(self.Vars.readSetting("fanSpeedMin"))
        self.form.slider_2_MaxFS.setValue(self.Vars.readSetting("fanSpeedMax"))
        self.initSetting(self.form.input_1_MSAH, "fanFullOnLayerNr",
                         self._fanFullOnLayerNr)
        # Set retract
        if not self.Vars.readMisc("RETRACTMODE"):
            self.form.Group_1_EnableExtruderRetract.setChecked(False)
        self.initSetting(self.form.input_1_ERA, "retractionAmount",
                         self._retractionAmount)
        self.initSetting(self.form.input_2_ERFR, "retractionSpeed",
                         self._retractionSpeed)
        self.initSetting(self.form.input_3_ERMD, "retractionMinimalDistance",
                         self._retractionMinimalDistance)
        self.initSetting(self.form.input_4_ERME,
                         "minimalExtrusionBeforeRetraction",
                         self._minimalExtrusionBeforeRetraction)
        if self.Vars.readSetting("enableCombing"):
            self.form.checkbox_1_EC.setChecked(True)
        else:
            self.form.checkbox_1_EC.setChecked(False)
        # Set skirt
        if not self.Vars.readMisc("SKIRTMODE"):
            self.form.Group_2_EnableSkirt.setChecked(False)
        self.initSetting(self.form.input_1_DIST, "skirtDistance",
                         self._skirtDistance)
        self.initSetting(self.form.input_2_LC, "skirtLineCount",
                         self._skirtLineCount)
        self.initSetting(self.form.input_3_ML, "skirtMinLength",
                         self._skirtMinLength)
        # Set support
        if not self.Vars.readMisc("SUPPORTMODE"):
            self.form.Group_3_EnableSupport.setChecked(False)
        if self.Vars.readSetting("supportEverywhere"):
            self.form.radioButton_2_EE.setChecked(True)
        else:
            self.form.radioButton_1_ETB.setChecked(True)
        self.initMisc(self.form.input_0_SD, "SupportDensity",
                      self._SupportDensity)
        self.initSetting(self.form.input_1_SXYD, "supportXYDistance",
                         self._supportXYDistance)
        self.initSetting(self.form.input_2_SZD, "supportZDistance",
                         self._supportZDistance)
        # Set raft
        if not self.Vars.readMisc("RAFTMODE"):
            self.form.Group_4_EnableRaft.setChecked(False)
        self.initSetting(self.form.input_1_RMG, "raftMargin", self._raftMargin)
        self.initSetting(self.form.input_2_RLS, "raftLineSpacing",
                         self._raftLineSpacing)
        self.initSetting(self.form.input_3_RBT, "raftBaseThickness",
                         self._raftBaseThickness)
        self.initSetting(self.form.input_4_RBLW, "raftBaseLinewidth",
                         self._raftBaseLinewidth)
        self.initSetting(self.form.input_5_RIT, "raftInterfaceThickness",
                         self._raftInterfaceThickness)
        self.initSetting(self.form.input_6_RILW, "raftInterfaceLinewidth",
                         self._raftInterfaceLinewidth)
        # Tab3
        if self.Vars.readSetting("spiralizeMode"):
            self.form.checkbox_1_SPI.setChecked(True)
        else:
            self.form.checkbox_1_SPI.setChecked(False)
        self.form.textEdit_startcode.append(self.Vars.readSetting("startCode"))
        self.form.textEdit_endcode.append(self.Vars.readSetting("endCode"))

        #Connect Signals and Slots
        # Tab 1
        self.form.button_1_filediag.clicked.connect(self.chooseOutputDir)
        self.form.input_1_curapath.textChanged.connect(self.curaPathChange)
        self.form.button_1_ES.clicked.connect(self.exportSettingsFile)
        self.form.button_2_IS.clicked.connect(self.importSettingsFile)
        # Tab 2
        self.form.Group_0_EnableFan.clicked.connect(self._fanMode)
        self.form.slider_1_MinFS.valueChanged.connect(
            self.form.input_1_MinFS.setValue)
        self.form.slider_2_MaxFS.valueChanged.connect(
            self.form.input_2_MaxFS.setValue)
        self.form.input_1_MinFS.valueChanged.connect(
            self.form.slider_1_MinFS.setValue)
        self.form.input_2_MaxFS.valueChanged.connect(
            self.form.slider_2_MaxFS.setValue)
        self.form.Group_1_EnableExtruderRetract.clicked.connect(
            self._retractionMode)
        self.form.checkbox_1_EC.clicked.connect(self._enableCombing)
        self.form.Group_2_EnableSkirt.clicked.connect(self._skirtMode)
        self.form.Group_3_EnableSupport.clicked.connect(self._supportMode)
        self.form.radioButton_1_ETB.clicked.connect(self._supportTouchingBed)
        self.form.radioButton_2_EE.clicked.connect(self._supportEverywhere)
        self.form.Group_4_EnableRaft.clicked.connect(self._raftMode)
        self.form.Group_5_OPP.clicked.connect(self._oppMode)
        # Tab 3
        self.form.checkbox_1_SPI.clicked.connect(self._spiralize)
        self.form.textEdit_startcode.textChanged.connect(self._startCode)
        self.form.textEdit_endcode.textChanged.connect(self._endCode)
示例#24
0
#You should have received a copy of the GNU Lesser General Public
#License along with this library; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

from os.path import dirname, join
bolts_path = dirname(__file__)
from BOLTS import USE_PYSIDE

import FreeCAD, FreeCADGui

if USE_PYSIDE:
	from PySide import QtCore, QtGui
	from FreeCADGui import PySideUic as uic

	try:
		Ui_BoltsWidget,QBoltsWidget = uic.loadUiType(join(bolts_path,'bolts_widget.ui'))
		Ui_ValueWidget,QValueWidget = uic.loadUiType(join(bolts_path,'value_widget.ui'))
		Ui_BoolWidget,QBoolWidget = uic.loadUiType(join(bolts_path,'bool_widget.ui'))
		Ui_TableIndexWidget,QTableIndexWidget = uic.loadUiType(join(bolts_path,'tableindex_widget.ui'))
		Ui_PropertyWidget,QPropertyWidget = uic.loadUiType(join(bolts_path,'property_widget.ui'))
	except ImportError:
		FreeCAD.Console.PrintError("uic import failed. Make sure that the pyside tools are installed")
		raise
	from PySide.QtCore import Slot
	def unpack(x):
		return x
else:
	from PyQt4 import QtGui, QtCore
	from bolts_widget import Ui_BoltsWidget
	from PyQt4.QtGui import QDockWidget as QBoltsWidget
	from value_widget import Ui_ValueWidget
示例#25
0
    def __init__(self, repo, freecad_db):
        super(BoltsWidget, self).__init__()
        self.ui = uic.loadUi(join(bolts_path, 'bolts_widget.ui'))

        self.repo = repo
        self.dbs = {}
        self.dbs["freecad"] = freecad_db

        self.param_widgets = {}
        self.props_widgets = {}

        self.coll_root = QtGui.QTreeWidgetItem(
            self.ui.partsTree, ["Collections", "Ordered by collections"])
        self.coll_root.setData(0, 32, None)
        self.std_root = QtGui.QTreeWidgetItem(
            self.ui.partsTree, ["Standard", "Ordered by issuing body"])
        self.std_root.setData(0, 32, None)

        # set up collections
        for coll, in self.repo.itercollections():
            coll_item = QtGui.QTreeWidgetItem(self.coll_root,
                                              [coll.name, coll.description])
            coll_item.setData(0, 32, coll)

            multinames = {}
            multistds = {}

            clasids = []
            # names
            for name, multiname in self.dbs["freecad"].iternames(
                ["name", "multiname"], filter_collection=coll):
                # append classid
                clasids.append(self.repo.class_names.get_src(name).id)
                item = None
                if multiname is None:
                    item = QtGui.QTreeWidgetItem(
                        coll_item, [name.name.get_nice(), name.description])
                else:
                    if multiname not in multinames:
                        multinames[multiname] = QtGui.QTreeWidgetItem(
                            coll_item, [multiname.group.get_nice(), ""])
                    item = QtGui.QTreeWidgetItem(
                        multinames[multiname],
                        [name.name.get_nice(), name.description])

                item.setData(0, 32, name)

            # single names
            for std, multistd in self.dbs["freecad"].iterstandards(
                ["standard", "multistandard"], filter_collection=coll):
                item = None
                # only add item if it is not in classids
                if self.repo.class_standards.get_src(std).id not in clasids:
                    if multistd is None:
                        item = QtGui.QTreeWidgetItem(
                            coll_item,
                            [std.standard.get_nice(), std.description])
                    else:
                        if multistd not in multistds:
                            multistds[multistd] = QtGui.QTreeWidgetItem(
                                coll_item, [multistd.standard.get_nice(), ""])
                        item = QtGui.QTreeWidgetItem(
                            multistds[multistd],
                            [std.standard.get_nice(), std.description])

                    item.setData(0, 32, std)

        multistds = {}

        # set up standards
        for body, in repo.iterbodies():
            std_item = QtGui.QTreeWidgetItem(
                self.std_root,
                [body.body, "Standards issued by %s" % body.body])
            std_item.setData(0, 32, None)
            # single standards
            for std, multistd in self.dbs["freecad"].iterstandards(
                ["standard", "multistandard"], filter_body=body):
                if multistd is None:
                    item = QtGui.QTreeWidgetItem(
                        std_item, [std.standard.get_nice(), std.description])
                else:
                    if multistd not in multistds:
                        multistds[multistd] = QtGui.QTreeWidgetItem(
                            std_item, [multistd.standard.get_nice(), ""])
                    item = QtGui.QTreeWidgetItem(
                        multistds[multistd],
                        [std.standard.get_nice(), std.description])

                item.setData(0, 32, std)

        self.remove_empty_items(self.coll_root)

        # connections
        self.ui.addButton.clicked.connect(self.add_button_clicked)
        self.ui.partsTree.clicked.connect(self.parts_tree_sel_changed)

        # main layout for self.ui
        layout = QtGui.QHBoxLayout()
        layout.addWidget(self.ui)
        self.setLayout(layout)
示例#26
0
from PySide import QtCore, QtGui
from FreeCADGui import PySideUic as uic
import FreeCAD, FreeCADGui
from ConfigParser import ConfigParser
from os.path import basename, dirname, join
from uuid import UUID
from hashlib import sha1

import json
import requests
from requests.auth import HTTPBasicAuth

try:
	root_dir = dirname(__file__)
	Ui_CadinetDialog,QCadinetDialog = uic.loadUiType(join(root_dir,'cadinet.ui'))
except ImportError:
	FreeCAD.Console.PrintError("uic import failed. Make sure that the pyside tools are installed")
	raise

LICENSES = {
    "CC0 1.0" : "http://creativecommons.org/publicdomain/zero/1.0/",
    "CC-BY 3.0" : "http://creativecommons.org/licenses/by/3.0/",
    "CC-BY 4.0" : "http://creativecommons.org/licenses/by/4.0/",
    "CC-BY-SA 4.0" : "http://creativecommons.org/licenses/by-sa/4.0/",
    "CC-BY-ND 4.0" : "http://creativecommons.org/licenses/by-nd/4.0/",
    "CC-BY-NC 4.0" : "http://creativecommons.org/licenses/by-nc/4.0/",
    "CC-BY-NC-SA 4.0" : "http://creativecommons.org/licenses/by-nc-sa/4.0/",
    "CC-BY-NC-ND 4.0" : "http://creativecommons.org/licenses/by-nc-nd/4.0/",
    "MIT" : "http://opensource.org/licenses/MIT", #see https://fedoraproject.org/wiki/Licensing:MIT?rd=Licensing/MIT
    "BSD 3-clause" : "http://opensource.org/licenses/BSD-3-Clause",
	def __init__(self):
		# Get the user's home directory.
		self.homeDir = os.path.expanduser("~")

		# Load the qt uic form. It _must_ be in ~/.FreeCAD/Mod/FreeCAD-CuraEngine-Plugin, Perhaps there is a better way...
		self.form = uic.loadUi(os.path.join(os.path.dirname(__file__),"Slicer.ui"))

		# Set the Default Values
		self.Vars = SliceDef()
		
		# Tab 1
		self.form.input_1_curapath.setText(self.Vars.readMisc("CuraPath"))
		self.initMisc(self.form.input_1_NOZDIA, "NozzleDiameter", self._nozzleDiameter)

		self.initSetting(self.form.input_2_FILDIA, "filamentDiameter", self._filamentDiameter)

		if not self.Vars.readMisc("OPPMODE"):
			self.form.Group_5_OPP.setChecked(False)
		self.initSetting(self.form.input_1_POSX, "posx", self._posx)
		self.initSetting(self.form.input_2_POSY, "posy", self._posy)
		self.initSetting(self.form.input_3_POSZ, "objectSink", self._objectSink)

		self.initSetting(self.form.input_0_FLH, "initialLayerThickness", self._initialLayerThickness)
		self.initSetting(self.form.input_1_LH, "layerThickness", self._layerThickness)
		self.initSetting(self.form.input_2_PS, "insetCount", self._insetCount)
		self.initSetting(self.form.input_3_SBL, "downSkinCount", self._downSkinCount)
		self.initSetting(self.form.input_4_STL, "upSkinCount", self._upSkinCount)
		self.initMisc(self.form.input_5_DN, "InfillDensity", self._InfillDensity)
		self.initSetting(self.form.input_6_EF, "filamentFlow", self._filamentFlow)
		self.initSetting(self.form.input_1_LFR, "printSpeed", self._printSpeed)
		# Set inset speeds here temporarily until added to GUI############################
		self.Vars.writeSetting("inset0Speed", self.Vars.readSetting("printSpeed"))
		self.Vars.writeSetting("insetXSpeed", self.Vars.readSetting("printSpeed"))
		##################################################################################
		self.initSetting(self.form.input_2_RFR, "moveSpeed", self._moveSpeed)
		self.initSetting(self.form.input_3_IFR, "infillSpeed", self._infillSpeed)
		self.initSetting(self.form.input_4_FLFR, "initialLayerSpeed", self._initialLayerSpeed)
		self.initSetting(self.form.input_5_MLT, "minimalLayerTime", self._minimalLayerTime)

		self.initMisc(self.form.input_1_NT, "NozzleTemp", self._NozzleTemp)
		self.initMisc(self.form.input_2_BT, "BedTemp", self._BedTemp)

		# Set fan
		if not self.Vars.readMisc("FANMODE"):
			self.form.Group_0_EnableFan.setChecked(False)
		self.initSetting(self.form.input_1_MinFS, "fanSpeedMin", self._fanSpeedMin)
		self.initSetting(self.form.input_2_MaxFS, "fanSpeedMax", self._fanSpeedMax)
		self.form.slider_1_MinFS.setValue(self.Vars.readSetting("fanSpeedMin"))
		self.form.slider_2_MaxFS.setValue(self.Vars.readSetting("fanSpeedMax"))
		self.initSetting(self.form.input_1_MSAH, "fanFullOnLayerNr", self._fanFullOnLayerNr)
		# Set retract
		if not self.Vars.readMisc("RETRACTMODE"):
			self.form.Group_1_EnableExtruderRetract.setChecked(False)
		self.initSetting(self.form.input_1_ERA, "retractionAmount", self._retractionAmount)
		self.initSetting(self.form.input_2_ERFR, "retractionSpeed", self._retractionSpeed)
		self.initSetting(self.form.input_3_ERMD, "retractionMinimalDistance", self._retractionMinimalDistance)
		self.initSetting(self.form.input_4_ERME, "minimalExtrusionBeforeRetraction", self._minimalExtrusionBeforeRetraction)
		if self.Vars.readSetting("enableCombing"):
			self.form.checkbox_1_EC.setChecked(True)
		else:
			self.form.checkbox_1_EC.setChecked(False)
		# Set skirt
		if not self.Vars.readMisc("SKIRTMODE"):
			self.form.Group_2_EnableSkirt.setChecked(False)
		self.initSetting(self.form.input_1_DIST, "skirtDistance", self._skirtDistance)
		self.initSetting(self.form.input_2_LC, "skirtLineCount", self._skirtLineCount)
		self.initSetting(self.form.input_3_ML, "skirtMinLength", self._skirtMinLength)
		# Set support
		if not self.Vars.readMisc("SUPPORTMODE"):
			self.form.Group_3_EnableSupport.setChecked(False)
		if self.Vars.readSetting("supportEverywhere"):
			self.form.radioButton_2_EE.setChecked(True)
		else:
			self.form.radioButton_1_ETB.setChecked(True)
		self.initMisc(self.form.input_0_SD, "SupportDensity", self._SupportDensity)
		self.initSetting(self.form.input_1_SXYD, "supportXYDistance", self._supportXYDistance)
		self.initSetting(self.form.input_2_SZD, "supportZDistance", self._supportZDistance)
		# Set raft
		if not self.Vars.readMisc("RAFTMODE"):
			self.form.Group_4_EnableRaft.setChecked(False)
		self.initSetting(self.form.input_1_RMG, "raftMargin", self._raftMargin)
		self.initSetting(self.form.input_2_RLS, "raftLineSpacing", self._raftLineSpacing)
		self.initSetting(self.form.input_3_RBT, "raftBaseThickness", self._raftBaseThickness)
		self.initSetting(self.form.input_4_RBLW, "raftBaseLinewidth", self._raftBaseLinewidth)
		self.initSetting(self.form.input_5_RIT, "raftInterfaceThickness", self._raftInterfaceThickness)
		self.initSetting(self.form.input_6_RILW, "raftInterfaceLinewidth", self._raftInterfaceLinewidth)
		# Tab3
		if self.Vars.readSetting("spiralizeMode"):
			self.form.checkbox_1_SPI.setChecked(True)
		else:
			self.form.checkbox_1_SPI.setChecked(False)
		self.form.textEdit_startcode.append(self.Vars.readSetting("startCode"))
		self.form.textEdit_endcode.append(self.Vars.readSetting("endCode"))

		#Connect Signals and Slots
		# Tab 1
		self.form.button_1_filediag.clicked.connect(self.chooseOutputDir)
		self.form.input_1_curapath.textChanged.connect(self.curaPathChange)
		self.form.button_1_ES.clicked.connect(self.exportSettingsFile)
		self.form.button_2_IS.clicked.connect(self.importSettingsFile)
		# Tab 2
		self.form.Group_0_EnableFan.clicked.connect(self._fanMode)
		self.form.slider_1_MinFS.valueChanged.connect(self.form.input_1_MinFS.setValue)
		self.form.slider_2_MaxFS.valueChanged.connect(self.form.input_2_MaxFS.setValue)
		self.form.input_1_MinFS.valueChanged.connect(self.form.slider_1_MinFS.setValue)
		self.form.input_2_MaxFS.valueChanged.connect(self.form.slider_2_MaxFS.setValue)
		self.form.Group_1_EnableExtruderRetract.clicked.connect(self._retractionMode)
		self.form.checkbox_1_EC.clicked.connect(self._enableCombing)
		self.form.Group_2_EnableSkirt.clicked.connect(self._skirtMode)
		self.form.Group_3_EnableSupport.clicked.connect(self._supportMode)
		self.form.radioButton_1_ETB.clicked.connect(self._supportTouchingBed)
		self.form.radioButton_2_EE.clicked.connect(self._supportEverywhere)
		self.form.Group_4_EnableRaft.clicked.connect(self._raftMode)
		self.form.Group_5_OPP.clicked.connect(self._oppMode)
		# Tab 3
		self.form.checkbox_1_SPI.clicked.connect(self._spiralize)
		self.form.textEdit_startcode.textChanged.connect(self._startCode)
		self.form.textEdit_endcode.textChanged.connect(self._endCode)
示例#28
0
from PySide import QtCore, QtGui
from FreeCADGui import PySideUic as uic
import FreeCAD, FreeCADGui
from ConfigParser import ConfigParser
from os.path import basename, dirname, join
from uuid import UUID
from hashlib import sha1

import json
import requests
from requests.auth import HTTPBasicAuth

try:
    root_dir = dirname(__file__)
    Ui_CadinetDialog, QCadinetDialog = uic.loadUiType(
        join(root_dir, 'cadinet.ui'))
except ImportError:
    FreeCAD.Console.PrintError(
        "uic import failed. Make sure that the pyside tools are installed")
    raise

LICENSES = {
    "CC0 1.0": "http://creativecommons.org/publicdomain/zero/1.0/",
    "CC-BY 3.0": "http://creativecommons.org/licenses/by/3.0/",
    "CC-BY 4.0": "http://creativecommons.org/licenses/by/4.0/",
    "CC-BY-SA 4.0": "http://creativecommons.org/licenses/by-sa/4.0/",
    "CC-BY-ND 4.0": "http://creativecommons.org/licenses/by-nd/4.0/",
    "CC-BY-NC 4.0": "http://creativecommons.org/licenses/by-nc/4.0/",
    "CC-BY-NC-SA 4.0": "http://creativecommons.org/licenses/by-nc-sa/4.0/",
    "CC-BY-NC-ND 4.0": "http://creativecommons.org/licenses/by-nc-nd/4.0/",
    "MIT":