def setRTCTree(self): if self.mgr != None: self.treeWidget.clear() self.treeNodeList = [] self.sheetcomboBox.clear() for i, j in self.rtc.m_excel.t_xlWorksheet.items(): self.sheetcomboBox.addItem(i.decode("utf-8")) if str(self.sheetcomboBox.currentText().toLocal8Bit() ) == u"保存用".encode("cp932"): self.sheetcomboBox.setCurrentIndex(1) address = str(self.namingServertextBox.text()) orb = self.mgr._orb namingserver = OOoRTC.SetNamingServer(address, orb, self.massageBoxFunc, "Unicode") if namingserver == None: return #print(namingserver) tmp = QtGui.QTreeWidgetItem(["/"]) self.treeWidget.addTopLevelItem(tmp) root = TreeNode(tmp, self) self.treeNodeList.append(root) oChild = self.createNode(address, True) root.appendChild(oChild) _path = ['/', address] self._paths = [] OOoRTC.rtc_get_rtclist(namingserver, self._paths, _path, oChild, self)
def SetRTCTree(oTreeModel, smgr, ctx, dlg_control): oTree = dlg_control.getControl( ControlName.RTCTreeName ) tfns_control = dlg_control.getControl( ControlName.NameServerFName ) if OOoRTC.mgr != None: orb = OOoRTC.mgr._orb namingserver = OOoRTC.SetNamingServer(str(tfns_control.Text), orb, MyMsgBox) if namingserver: oTreeDataModel = smgr.createInstanceWithContext("com.sun.star.awt.tree.MutableTreeDataModel", ctx) root = oTreeDataModel.createNode("/", False) oTreeDataModel.setRoot(root) oChild = oTreeDataModel.createNode(str(tfns_control.Text),False) root.appendChild(oChild) _path = ['/', str(tfns_control.Text)] _paths = [] OOoRTC.rtc_get_rtclist(namingserver, _paths, _path, oChild, oTreeDataModel) oTreeModel.DataModel = oTreeDataModel oTree.addSelectionChangeListener(TreeSelectListener(dlg_control, _paths)) create_listener = CreatePortListener( dlg_control, _paths) create_control = dlg_control.getControl(ControlName.CreateBName) create_control.addActionListener(create_listener) delete_listener = DeleteListener(dlg_control, _paths) delete_control = dlg_control.getControl(ControlName.DeleteBName) delete_control.addActionListener(delete_listener) setPos_listener = SetPosListener(dlg_control, _paths) setpos_control = dlg_control.getControl(ControlName.SetPosBName) setpos_control.addActionListener(setPos_listener)