コード例 #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()
コード例 #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()
コード例 #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
コード例 #4
0
ファイル: UsbCommand.py プロジェクト: prrvchr/USBTerminal
 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
コード例 #5
0
ファイル: UsbCommand.py プロジェクト: prrvchr/USBTerminal
 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()
コード例 #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
コード例 #7
0
ファイル: UsbCommand.py プロジェクト: prrvchr/USBTerminal
 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
コード例 #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()
コード例 #9
0
ファイル: UsbCommand.py プロジェクト: prrvchr/USBTerminal
    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()
コード例 #10
0
ファイル: TinyG2Panel.py プロジェクト: prrvchr/USBTerminal
 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
コード例 #11
0
ファイル: TinyG2Panel.py プロジェクト: vjseff/USBTerminal
 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
コード例 #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()
コード例 #13
0
ファイル: UsbCommand.py プロジェクト: prrvchr/USBTerminal
 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()