Beispiel #1
0
    def loadSheet(self):
        
        self.rtc.mRemoveAllPort()
        count = 1
        m_hostname = ''
        _path = []
        

        while True:
            
            
            cell,sheet,m_len = self.rtc.m_excel.getCell(count,"A",'保存用',"",False)

            if cell.Value2 == None:
                return
            
            m_name = re.split(':',cell.Value2)
            
            
            if len(m_name) < 2:
                return

            if len(m_name) == 2:
                for dn in CalcDataPort.DataType.DataTypeList:
                    if m_name[1] == dn:
                        m_name[1] = dn
                #m_name[1] = m_name[1].decode("cp932").encode("utf-8")
                F_Name = m_name[1] + str(OpenRTM_aist.uuid1())
                row,col,mlen,sn,mstate,t_attachports = self.loadParam(count)
                if m_name[0] == 'DataInPort':
                    self.rtc.mAddInPort(F_Name, [[m_name[0],m_name[1]],m_name[1]], row, col, mlen, sn, mstate, t_attachports, False)
                elif m_name[0] == 'DataOutPort':
                    self.rtc.mAddOutPort(F_Name, [[m_name[0],m_name[1]],m_name[1]], row, col, mlen, sn, mstate, t_attachports, False)
            else:
                if m_hostname == m_name[1]:
                    pass
                else:
                    _paths = OOoRTC.GetPathList(m_name[1], self.mgr, None)
                    m_hostname = m_name[1]

                if _paths == None:
                    return

                for p in _paths:
                    if p[0] == m_name:
                        F_Name = p[0][-2] + p[0][-1]
                        profile = p[1].get_port_profile()
                        #props = nvlist_to_dict(profile.properties)

                        

                        row,col,mlen,sn,mstate,t_attachports = self.loadParam(count)
                        
                        if OOoRTC.nvlist_getValue(profile.properties,'port.port_type') == 'DataInPort':
                            self.rtc.mAddOutPort(F_Name, p, row, col, mlen, sn, mstate, t_attachports)
                        elif OOoRTC.nvlist_getValue(profile.properties,'port.port_type') == 'DataOutPort':
                            self.rtc.mAddInPort(F_Name, p, row, col, mlen, sn, mstate, t_attachports)            
    
            count = count + 1
Beispiel #2
0
def GetDataType(m_port):
    basic = DataType.basic
    extended = DataType.extended
    
    profile = m_port.get_port_profile()
    #props = nvlist_to_dict(profile.properties)
    #data_type =  props['dataport.data_type']
    data_type =  OOoRTC.nvlist_getValue(profile.properties,'dataport.data_type')
    if data_type.startswith('IDL:'):
        data_type = data_type[4:]
    colon = data_type.rfind(':')
    if colon != -1:
        data_type = data_type[:colon]

    data_type = data_type.replace('RTC/','')
    
    
    
    return GetDataSType(data_type)
Beispiel #3
0
  def configUpdate(self):
      
      for i in range(0, 100):
          dn = "dataport" + str(i+1)
          
          
          if self._configsets.haveConfig(dn):
              
              self._configsets.activateConfigurationSet(dn)
              self._configsets.update(dn)

              
              tdt = ""
              tmp = None
              if self.ConfInPorts.has_key(dn):
                  if self.conf_port_type[0] != "DataInPort":
                      del self.ConfInPorts[dn]
                  else:
                      tmp = self.ConfInPorts[dn]
                      tdt = "DataInPort"
              if self.ConfOutPorts.has_key(dn):
                  if self.conf_port_type[0] != "DataOutPort":
                      del self.ConfOutPorts[dn]
                  else:
                      tmp = self.ConfOutPorts[dn]
                      tdt = "DataOutPort"

              data_type = ""
              if tmp != None:
                  profile = tmp._port.get_port_profile()
                  #props = nvlist_to_dict(profile.properties)
                  #data_type =  props['dataport.data_type']
                  data_type =  OOoRTC.nvlist_getValue(profile.properties,'dataport.data_type')
                  if data_type.startswith('IDL:'):
                    data_type = data_type[4:]
                    colon = data_type.rfind(':')
                  if colon != -1:
                    data_type = data_type[:colon]

                    data_type = data_type.replace('RTC/','')
              

              if int(self.conf_column[0]) > 0 and len(self.conf_start_row[0]) > 0:
                  c_move = True
                  if int(self.c_move[0]) == 0:
                      c_move = False
                  Attach_Port = {}
                  tA = re.split(",",self.Attach_Port[0])
                  for k in tA:
                       if k != "" and k != "None":
                           Attach_Port[k] = k

                  if tdt != None and data_type == self.conf_data_type[0]:# and self.conf_port_type[0] == tdt:
                      tmp._row = self.conf_start_row[0]
                      tmp._sn = self.conf_sheetname[0]
                      tmp._col = self.conf_column[0]
                      tmp._length = self.conf_end_row[0]
                      tmp.attachports = Attach_Port 
                      tmp.state = c_move
                      

                  else:
                      
                      if tmp != None:
                          tmp._port.disconnect_all()
                          self.removePort(tmp._port)

                      
                      
                      if self.conf_port_type[0] == "DataInPort":
                        self.addConfInPort(dn, self.conf_data_type[0], self.conf_start_row[0], int(self.conf_column[0]), self.conf_end_row[0], self.conf_sheetname[0], c_move, Attach_Port)
                      elif self.conf_port_type[0] == "DataOutPort":
                        self.addConfOutPort(dn, self.conf_data_type[0], self.conf_start_row[0], int(self.conf_column[0]), self.conf_end_row[0], self.conf_sheetname[0], c_move, Attach_Port)
Beispiel #4
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, OOoRTC.nvlist_getValue(profile.properties,'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'))
Beispiel #5
0
def LoadSheet():
  
    
    if OOoRTC.draw_comp:
      
      draw = OOoRTC.draw_comp.draw
      
      OOoRTC.draw_comp.mRemoveAllPort()
      oDrawPages = draw.drawpages
      oDrawPage = oDrawPages.getByIndex(0)
      
      st_control = oDrawPage.getForms().getByIndex(0).getByName('SaveTextBox')
      text = str(st_control.Text)
      m_port = re.split(';',text)

      m_hostname = ''
      _path = []
      
      for mp in m_port:
        m_list = re.split('#',mp)
        if len(m_list) > 10:
          m_name = re.split(':',m_list[0])
          if len(m_name) < 2:
            return
          if len(m_name) == 2:
              for dn in DrawDataPort.DataType.DataTypeList:
                  if m_name[1] == dn:
                      m_name[1] = dn
                  m_i,m_j,_ox,_oy,_or,_sx,_sy,_x,_y,_r,_obj,flag = LoadParam(m_list, oDrawPages)
                  F_Name = m_name[1] + str(m_i) + str(m_j)

                  if m_name[0] == "DataOutPort":
                    OOoRTC.draw_comp.mAddOutPort(F_Name, [[m_name[0],m_name[1]],m_name[1]], [_ox,_oy,_or], [_sx,_sy], [_x, _y, _r], _obj, False)
                  if m_name[0] == 'DataOutPort':
                    OOoRTC.draw_comp.mAddInPort(F_Name, [[m_name[0],m_name[1]],m_name[1]], [_ox,_oy,_or], [_sx,_sy], [_x, _y, _r], _obj, False)
              
          else:
              if m_hostname == m_name[1]:
                pass
              else:
                _paths = OOoRTC.GetPathList(m_name[1], OOoRTC.mgr ,MyMsgBox)
                m_hostname = m_name[1]
              if _paths == None:
                return
              for p in _paths:
                if p[0] == m_name:
                  
                  
                  profile = p[1].get_port_profile()
                  #props = nvlist_to_dict(profile.properties)

                  m_i,m_j,_ox,_oy,_or,_sx,_sy,_x,_y,_r,_obj,flag = LoadParam(m_list, oDrawPages)

                  F_Name = p[0][-2] + p[0][-1] + str(m_i) + str(m_j)

                  
                  
                  
                  
                  
                  if flag:
                    if OOoRTC.nvlist_getValue(profile.properties,'port.port_type') == 'DataInPort':
                        OOoRTC.draw_comp.mAddOutPort(F_Name, p, [_ox,_oy,_or], [_sx,_sy], [_x, _y, _r], _obj)
                    if OOoRTC.nvlist_getValue(profile.properties,'port.port_type') == 'DataOutPort':
                        OOoRTC.draw_comp.mAddInPort(F_Name, p, [_ox,_oy,_or], [_sx,_sy], [_x, _y, _r], _obj)
Beispiel #6
0
  def configUpdate(self):
      
      for i in range(0, 100):
          dn = "dataport" + str(i+1)
          
          
          if self._configsets.haveConfig(dn):
              
              self._configsets.activateConfigurationSet(dn)
              self._configsets.update(dn)

              
              tdt = ""
              tmp = None
              if dn in self.ConfInPorts:
                  if self.conf_port_type[0] != "DataInPort":
                      del self.ConfInPorts[dn]
                  else:
                      tmp = self.ConfInPorts[dn]
                      tdt = "DataInPort"
              if dn in self.ConfOutPorts:
                  if self.conf_port_type[0] != "DataOutPort":
                      del self.ConfOutPorts[dn]
                  else:
                      tmp = self.ConfOutPorts[dn]
                      tdt = "DataOutPort"

              data_type = ""
              if tmp != None:
                  profile = tmp._port.get_port_profile()
                  #props = nvlist_to_dict(profile.properties)
                  #data_type =  props['dataport.data_type']
                  data_type =  OOoRTC.nvlist_getValue(profile.properties,'dataport.data_type')
                  if data_type.startswith('IDL:'):
                    data_type = data_type[4:]
                    colon = data_type.rfind(':')
                  if colon != -1:
                    data_type = data_type[:colon]

                    data_type = data_type.replace('RTC/','')
              

              if int(self.conf_column[0]) > 0 and len(self.conf_start_row[0]) > 0:
                  c_move = True
                  if int(self.c_move[0]) == 0:
                      c_move = False
                  Attach_Port = {}
                  tA = re.split(",",self.Attach_Port[0])
                  for k in tA:
                       if k != "" and k != "None":
                           Attach_Port[k] = k

                  if tdt != None and data_type == self.conf_data_type[0]:# and self.conf_port_type[0] == tdt:
                      tmp._row = self.conf_start_row[0]
                      tmp._sn = self.conf_sheetname[0]
                      tmp._col = self.conf_column[0]
                      tmp._length = self.conf_end_row[0]
                      tmp.attachports = Attach_Port 
                      tmp.state = c_move
                      

                  else:
                      
                      if tmp != None:
                          tmp._port.disconnect_all()
                          self.removePort(tmp._port)

                      
                      
                      if self.conf_port_type[0] == "DataInPort":
                        self.addConfInPort(dn, self.conf_data_type[0], self.conf_start_row[0], int(self.conf_column[0]), self.conf_end_row[0], self.conf_sheetname[0], c_move, Attach_Port)
                      elif self.conf_port_type[0] == "DataOutPort":
                        self.addConfOutPort(dn, self.conf_data_type[0], self.conf_start_row[0], int(self.conf_column[0]), self.conf_end_row[0], self.conf_sheetname[0], c_move, Attach_Port)
Beispiel #7
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 #8
0
    def loadSheet(self):

        self.rtc.mRemoveAllPort()
        count = 1
        m_hostname = ''
        _path = []

        while True:

            cell, sheet, m_len = self.rtc.m_excel.getCell(
                count, "A", '保存用', "", False)

            if cell.Value2 == None:
                return

            m_name = re.split(':', cell.Value2)

            if len(m_name) < 2:
                return

            if len(m_name) == 2:
                for dn in CalcDataPort.DataType.DataTypeList:
                    if m_name[1] == dn:
                        m_name[1] = dn
                #m_name[1] = m_name[1].decode("cp932").encode("utf-8")
                F_Name = m_name[1] + str(OpenRTM_aist.uuid1())
                row, col, mlen, sn, mstate, t_attachports = self.loadParam(
                    count)
                if m_name[0] == 'DataInPort':
                    self.rtc.mAddInPort(F_Name,
                                        [[m_name[0], m_name[1]], m_name[1]],
                                        row, col, mlen, sn, mstate,
                                        t_attachports, False)
                elif m_name[0] == 'DataOutPort':
                    self.rtc.mAddOutPort(F_Name,
                                         [[m_name[0], m_name[1]], m_name[1]],
                                         row, col, mlen, sn, mstate,
                                         t_attachports, False)
            else:
                if m_hostname == m_name[1]:
                    pass
                else:
                    _paths = OOoRTC.GetPathList(m_name[1], self.mgr, None)
                    m_hostname = m_name[1]

                if _paths == None:
                    return

                for p in _paths:
                    if p[0] == m_name:
                        F_Name = p[0][-2] + p[0][-1]
                        profile = p[1].get_port_profile()
                        #props = nvlist_to_dict(profile.properties)

                        row, col, mlen, sn, mstate, t_attachports = self.loadParam(
                            count)

                        if OOoRTC.nvlist_getValue(
                                profile.properties,
                                'port.port_type') == 'DataInPort':
                            self.rtc.mAddOutPort(F_Name, p, row, col, mlen, sn,
                                                 mstate, t_attachports)
                        elif OOoRTC.nvlist_getValue(
                                profile.properties,
                                'port.port_type') == 'DataOutPort':
                            self.rtc.mAddInPort(F_Name, p, row, col, mlen, sn,
                                                mstate, t_attachports)

            count = count + 1
Beispiel #9
0
    def addSlot(self):
        
        pn = str(self.portListcomboBox.currentText().toLocal8Bit())
        if self.rtc.InPorts.has_key(pn) == True:
            self.setPortParam(self.rtc.InPorts[pn])
            self.updateSaveSheet()
            return
        elif self.rtc.OutPorts.has_key(pn) == 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()