Beispiel #1
0
    def deleteSlot(self):
        pn = str(self.portListcomboBox.currentText().toLocal8Bit())
        if (pn in self.rtc.InPorts) == True:
            i = self.rtc.InPorts[pn]
            self.rtc.mRemoveInPort(i)
            self.delPortTC(i)
            return
        elif (pn in self.rtc.OutPorts) == True:
            o = self.rtc.OutPorts[pn]
            self.rtc.mRemoveOutPort(o)
            self.delPortTC(o)
            return

        t_comp, nd = OOoRTC.JudgePort(self, self._paths)

        if t_comp:
            for n, o in self.rtc.OutPorts.items():
                if o._port_a[0] == t_comp[0]:
                    self.rtc.mRemoveOutPort(o)
                    self.delPortTC(o)
                    return
            for n, i in self.rtc.InPorts.items():
                if i._port_a[0] == t_comp[0]:
                    self.rtc.mRemoveInPort(i)
                    self.delPortTC(i)
                    return
        else:
            self.massageBoxFunc("", u'データポートを選択してください')
            return

        self.massageBoxFunc("", u'削除済みです')
Beispiel #2
0
    def resetSlot(self):
        t_comp, nd = OOoRTC.JudgePort(self, self._paths)
        if t_comp:
            for n, o in self.rtc.OutPorts.items():
                if o._port_a[0] == t_comp[0]:
                    o._num = int(o._col)
                    return
            for n, i in self.rtc.InPorts.items():
                if i._port_a[0] == t_comp[0]:
                    i._num = int(i._col)
                    return
        else:
            self.massageBoxFunc("", u'データポートを選択してください')
            return

        self.massageBoxFunc("", u'削除済みです')
Beispiel #3
0
    def attachBSlot(self):
        pn = str(self.portListcomboBox.currentText().toLocal8Bit())

        if (pn in self.rtc.OutPorts) == True:
            o = self.rtc.OutPorts[pn]
            self.attachTC(o)
            return

        t_comp, nd = OOoRTC.JudgePort(self, self._paths)

        if t_comp:
            for n, o in self.rtc.OutPorts.items():
                if o._port_a[0] == t_comp[0]:
                    self.attachTC(o)
                    return

        else:
            self.massageBoxFunc("", u'データポートを選択してください')
            return

        self.massageBoxFunc("", u'削除済みです')
Beispiel #4
0
 def actionPerformed(self, actionEvent):
     
     objectTree = self.dlg_control.getControl(ControlName.RTCTreeName)
     
     t_comp, nd = OOoRTC.JudgePort(objectTree, self._paths)
     
     if t_comp:
         
         for n,i in OOoRTC.draw_comp.InPorts.items():
             if i._port_a[0] == t_comp[0]:
                 i._obj.RotateAngle = i._r
                 t_pos = Point()
                 t_pos.X = i._x
                 t_pos.Y = i._y
                 i._obj.setPosition(t_pos)
                 return
     else:
         MyMsgBox(OOoRTC.SetCoding('エラー','utf-8'),OOoRTC.SetCoding('データポートを選択してください','utf-8'))
         return
     
     MyMsgBox(OOoRTC.SetCoding('エラー','utf-8'),OOoRTC.SetCoding('削除済みです','utf-8'))
Beispiel #5
0
    def treeWidgetSlot(self, obj):
        self.datatypecomboBox.setCurrentIndex(0)
        self.selItem = self.getTreeNode(obj)

        t_comp, nd = OOoRTC.JudgePort(self, self._paths)

        self.portListcomboBox.lineEdit().setText("")

        if t_comp:
            for n, o in self.rtc.OutPorts.items():
                if o._port_a[0] == t_comp[0]:
                    self.updateTree(o)
                    return
            for n, i in self.rtc.InPorts.items():
                if i._port_a[0] == t_comp[0]:
                    self.updateTree(i)
                    return
        else:
            return

        self.infotextBox.setText(u"未作成")
        """tmp = self.getTreeNode(obj)
Beispiel #6
0
    def addSlot(self):

        pn = str(self.portListcomboBox.currentText().toLocal8Bit())
        if (pn in self.rtc.InPorts) == True:
            self.setPortParam(self.rtc.InPorts[pn])
            self.updateSaveSheet()
            return
        elif (pn in self.rtc.OutPorts) == True:
            self.setPortParam(self.rtc.OutPorts[pn])
            self.updateSaveSheet()
            return

        dt = str(self.datatypecomboBox.currentText().toLocal8Bit())
        if dt != "":
            F_Name = dt + str(OpenRTM_aist.uuid1())
            pt = str(self.porttypecomboBox.currentText().toLocal8Bit())
            if pt == "DataOutPort":
                if self.compAddOutPort(F_Name, [[pt, dt], dt], False):
                    self.massageBoxFunc(
                        '',
                        dt.decode("utf-8") + u"型のOutPortを作成しました。")
            else:
                if self.compAddInPort(F_Name, [[pt, dt], dt], False):
                    self.massageBoxFunc(
                        '',
                        dt.decode("utf-8") + u"型のInPortを作成しました。")

            self.updateInPortList()
            self.updateDataPortList()
            self.updateSaveSheet()
            return

        t_comp, nd = OOoRTC.JudgePort(self, self._paths)
        if t_comp:

            for n, o in self.rtc.OutPorts.items():
                if o._port_a[0] == t_comp[0]:
                    self.setPortParam(o)

                    return
            for n, i in self.rtc.InPorts.items():
                if i._port_a[0] == t_comp[0]:
                    self.setPortParam(i)

                    return

            F_Name = t_comp[0][-2] + t_comp[0][-1]
            profile = t_comp[1].get_port_profile()
            #props = nvlist_to_dict(profile.properties)

            if OOoRTC.nvlist_getValue(profile.properties,
                                      'port.port_type') == 'DataInPort':
                self.compAddOutPort(F_Name, t_comp)
            elif OOoRTC.nvlist_getValue(profile.properties,
                                        'port.port_type') == 'DataOutPort':
                self.compAddInPort(F_Name, t_comp)

            self.updateSaveSheet()
            self.infotextBox.setText(u"作成済み")

            self.updateInPortList()
            self.updateDataPortList()

            self.massageBoxFunc(
                '',
                t_comp[0][-2] + u"の" + t_comp[0][-1] + u"と通信するデータポートを作成しました。")
        """print(self.coltextBox.text())
Beispiel #7
0
    def actionPerformed(self, actionEvent):

        

        try:
            draw = OOoDraw()
        except NotOOoDrawException:
            return

        sobj = draw.document.CurrentSelection

        if sobj:
            if sobj.Count > 0:
                obj = sobj.getByIndex(0)
                
                jport, d_type = JudgeDrawObjRTC(obj)
                
                if jport:
                    xo_control = self.dlg_control.getControl( ControlName.XoffsetBName )
                    yo_control = self.dlg_control.getControl( ControlName.YoffsetBName )
                    ro_control = self.dlg_control.getControl( ControlName.RoffsetBName )
                    xs_control = self.dlg_control.getControl( ControlName.XscaleBName )
                    ys_control = self.dlg_control.getControl( ControlName.YscaleBName )
                    jport._ox = long(xo_control.Text)
                    jport._oy = long(yo_control.Text)
                    jport._or = float(ro_control.Text)
                    jport._sx = long(xs_control.Text)
                    jport._sy = long(ys_control.Text)
                    UpdateSaveSheet()

                    return

                dtcb_control = self.dlg_control.getControl( ControlName.DataTypeCBName )
                dt = str(dtcb_control.Text)
                if dt != "":
                    F_Name = dt + str(OpenRTM_aist.uuid1())
                    ptcb_control = self.dlg_control.getControl( ControlName.PortTypeCBName )
                    pt = str(ptcb_control.Text)
                    

                    for d in DrawDataPort.DataType.DataTypeList:
                        if dt == d:
                            dt = d
                    
                    if pt == "DataOutPort":
                        pt = "DataInPort"
                    else:
                        pt = "DataOutPort"
                    CompAddPort(F_Name, [[pt,dt],dt], self.dlg_control, obj, pt, False)
                    if pt == "DataInPort":
                        MyMsgBox('',OOoRTC.SetCoding(dt+"型のOutPortを作成しました。",'utf-8'))
                    else:
                        MyMsgBox('',OOoRTC.SetCoding(dt+"型のInPortを作成しました。",'utf-8'))
                    UpdateSaveSheet()

                    info_control = self.dlg_control.getControl( ControlName.TextFName )
                    info_control.setText(OOoRTC.SetCoding('作成済み','utf-8'))

                    return
                    
                    
                objectTree = self.dlg_control.getControl(ControlName.RTCTreeName)
                t_comp, nd = OOoRTC.JudgePort(objectTree, self._paths)
                
                
                if t_comp:
                    
                    m_i,m_j = JudgeRTCObjDraw(obj)
                    
                    F_Name = t_comp[0][-2] + t_comp[0][-1] + str(m_i) + str(m_j)
                    
                    
                    profile = t_comp[1].get_port_profile()
                    props = nvlist_to_dict(profile.properties)

                    
                    CompAddPort(F_Name, t_comp, self.dlg_control, obj, props['port.port_type'])
                    
                        
                    t_str = str(m_i) + "ページの" +  str(m_j) + "番目の図形と" + t_comp[0][-2] + t_comp[0][-1] + "を関連付けました"
                    MyMsgBox('',OOoRTC.SetCoding(t_str,'utf-8'))
                        
                        

                    

                    UpdateSaveSheet()

                    info_control = self.dlg_control.getControl( ControlName.TextFName )
                    info_control.setText(OOoRTC.SetCoding('作成済み','utf-8'))