Exemplo n.º 1
0
 def slotDeletedObject(self, obj):
     if Script.getObjectType(obj) == "App::PySerial":
         if obj.Proxy.hasParent(obj):
             obj = obj.Proxy.getParent(obj)
     if Script.getObjectType(obj) == "App::UsbPool" and\
        obj.Proxy.Machine.isRunning():
         obj.Proxy.Machine.halt()
         obj.Proxy.Machine.pool.waitForDone()
Exemplo n.º 2
0
 def Activated(self):
     obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]
     code = '''obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]\n'''
     if Script.getObjectType(obj) == "App::UsbPool":
         code += '''obj.Pause = not obj.Pause'''
     if Script.getObjectType(obj) == "App::PySerial":
         code += '''obj.InList[0].Pause = not obj.InList[0].Pause'''
     FreeCADGui.doCommand(code)
     FreeCAD.ActiveDocument.recompute()
Exemplo n.º 3
0
 def IsActive(self):
     if FreeCAD.ActiveDocument is not None:
         s = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)
         if len(s):
             obj = s[0]
             if Script.getObjectType(obj) == "App::UsbPool" or\
                Script.getObjectType(obj) == "App::PySerial":
                 return True
     return False
Exemplo n.º 4
0
 def IsActive(self):
     if FreeCAD.ActiveDocument is not None:
         s = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)
         if len(s):
             obj = s[0]
             if Script.getObjectType(obj) == "App::UsbPool" or\
                Script.getObjectType(obj) == "App::PySerial":
                 return True
     return False
Exemplo n.º 5
0
 def Activated(self):
     obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]
     code = '''obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]\n'''
     if Script.getObjectType(obj) == "App::UsbPool":
         code += '''obj.Pause = not obj.Pause'''
     if Script.getObjectType(obj) == "App::PySerial":
         code += '''obj.InList[0].Pause = not obj.InList[0].Pause'''
     FreeCADGui.doCommand(code)
     FreeCAD.ActiveDocument.recompute()
Exemplo n.º 6
0
 def IsActive(self):
     if FreeCAD.ActiveDocument is not None:
         s = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)
         if len(s):
             obj = s[0]
             if Script.getObjectType(obj) == "App::PySerial":
                 obj = obj.Proxy.getParent(obj)
             if Script.getObjectType(obj) == "App::UsbPool" and\
                obj.Proxy.Machine.run:
                 return True
     return False
Exemplo n.º 7
0
 def IsActive(self):
     if FreeCAD.ActiveDocument is not None:
         s = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)
         if len(s):
             obj = s[0]
             if Script.getObjectType(obj) == "App::PySerial":
                 obj = obj.Proxy.getParent(obj)                
             if Script.getObjectType(obj) == "App::UsbPool" and\
                obj.Proxy.Machine.run:
                 return True
     return False
Exemplo n.º 8
0
    def Activated(self):
        obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]
        code = '''obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]\n'''
        if Script.getObjectType(obj) == "App::UsbPool":
            code += '''for o in obj.Serials:
    o.Proxy.Update = ["Port", "Baudrate"]
    o.touch()'''
        if Script.getObjectType(obj) == "App::PySerial":
            code += '''obj.Proxy.Update = ["Port", "Baudrate"]
obj.touch()'''
        FreeCADGui.doCommand(code)
        FreeCAD.ActiveDocument.recompute()
Exemplo n.º 9
0
    def Activated(self):
        obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]
        code = '''obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]\n'''
        if Script.getObjectType(obj) == "App::UsbPool":
            code += '''for o in obj.Serials:
    o.Proxy.Update = ["Port", "Baudrate"]
    o.touch()'''
        if Script.getObjectType(obj) == "App::PySerial":
            code += '''obj.Proxy.Update = ["Port", "Baudrate"]
obj.touch()'''
        FreeCADGui.doCommand(code)
        FreeCAD.ActiveDocument.recompute()
Exemplo n.º 10
0
 def shouldShow(self):
     for obj in FreeCADGui.Selection.getSelection():
         if AppScript.getObjectType(obj) == "App::UsbPool" and\
            GuiScript.getObjectViewType(obj.ViewObject) == "Gui::UsbTinyG2":
             self.view.setModel(obj.ViewObject.Proxy.Model)
             return True
     self.view.setModel(self.model)
     return False
Exemplo n.º 11
0
 def shouldShow(self):
     for obj in FreeCADGui.Selection.getSelection():
         if AppScript.getObjectType(obj) == "App::UsbPool" and\
            GuiScript.getObjectViewType(obj.ViewObject) == "Gui::UsbTinyG2":
             self.view.setModel(obj.ViewObject.Proxy.Model)
             return True
     self.view.setModel(self.model)
     return False
Exemplo n.º 12
0
 def Activated(self):
     obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]
     code = '''obj = Gui.Selection.getSelection(App.ActiveDocument.Name)[0]\n'''
     if Script.getObjectType(obj) == "App::PySerial":
         obj = obj.Proxy.getParent(obj)
         code += '''obj = obj.Proxy.getParent(obj)\n'''
     if obj.Proxy.Machine.isRunning():
         code += '''obj.Proxy.Machine.stop()'''
     else:
         code += '''obj.Proxy.Machine.start(obj)'''
     FreeCADGui.doCommand(code)
     FreeCAD.ActiveDocument.recompute()
Exemplo n.º 13
0
 def Activated(self):
     obj = FreeCADGui.Selection.getSelection(FreeCAD.ActiveDocument.Name)[0]
     code = '''obj = Gui.Selection.getSelection(App.ActiveDocument.Name)[0]\n'''
     if Script.getObjectType(obj) == "App::PySerial":
         obj = obj.Proxy.getParent(obj)
         code += '''obj = obj.Proxy.getParent(obj)\n'''
     if obj.Proxy.Machine.isRunning():
         code += '''obj.Proxy.Machine.stop()'''
     else:
         code += '''obj.Proxy.Machine.start(obj)'''            
     FreeCADGui.doCommand(code)
     FreeCAD.ActiveDocument.recompute()