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
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 props['port.port_type'] == 'DataInPort': OOoRTC.draw_comp.mAddOutPort(F_Name, p, [_ox,_oy,_or], [_sx,_sy], [_x, _y, _r], _obj) if props['port.port_type'] == 'DataOutPort': OOoRTC.draw_comp.mAddInPort(F_Name, p, [_ox,_oy,_or], [_sx,_sy], [_x, _y, _r], _obj)