def nodeselected(self, index, _): node = index.data(Qt.UserRole) if node is None: return self.removeProjectButton.setEnabled(node.canremove) self.newProjectButton.setEnabled(node.canadd) #self.newProjectButton.setText(node.addtext) #self.removeProjectButton.setText(node.removetext) project = node.project if project and not self.projectwidget.project == project: # Only load the project if it's different the current one. self.projectwidget.setproject(project) node.create_children() validateresults = list(project.validate()) if validateresults: text = "Here are some reasons we found: \n\n" for message in validateresults: text += "- {} \n".format(message) self.projectwidget.reasons_label.setText(text) if node.nodetype == Treenode.RoamNode: self.projectwidget.projectlabel.setText("IntraMaps Roam Config Manager") elif node.nodetype == Treenode.MapNode: self.projectwidget.loadmap() elif node.nodetype == Treenode.FormsNode: haslayers = self.projectwidget.checkcapturelayers() self.newProjectButton.setEnabled(haslayers) self.projectwidget.projectbuttonframe.setVisible(not project is None) self.projectwidget.setpage(node.page, node)
def nodeselected(self, index, _): node = index.data(Qt.UserRole) if node is None: return project = node.project if project and not self.projectwidget.project == project: # Only load the project if it's different the current one. self.projectwidget.setproject(project) node.create_children() validateresults = list(project.validate()) if validateresults: text = "Here are some reasons we found: \n\n" for message in validateresults: text += "- {} \n".format(message) self.projectwidget.reasons_label.setText(text) if node.nodetype == Treenode.RoamNode: self.projectwidget.projectlabel.setText("IntraMaps Roam Config Manager") if node.nodetype == Treenode.AddNew: try: item = node.additem() except ValueError: return newindex = self.treemodel.indexFromItem(item) self.projectList.setCurrentIndex(newindex) return self.projectwidget.projectbuttonframe.setVisible(not project is None) self.projectwidget.setpage(node.page, node)
def nodeselected(self, index, _): node = index.data(Qt.UserRole) if node is None: return project = node.project if project and not self.projectwidget.project == project: # Only load the project if it's different the current one. self.projectwidget.setproject(project) node.create_children() validateresults = list(project.validate()) if validateresults: text = "Here are some reasons we found: \n\n" for message in validateresults: text += "- {} \n".format(message) self.projectwidget.reasons_label.setText(text) if node.nodetype == Treenode.RoamNode: self.projectwidget.projectlabel.setText( "IntraMaps Roam Config Manager") if node.nodetype == Treenode.AddNew: try: item = node.additem() except ValueError: return newindex = self.treemodel.indexFromItem(item) self.projectList.setCurrentIndex(newindex) return self.projectwidget.projectbuttonframe.setVisible(not project is None) self.projectwidget.setpage(node.page, node)
def nodeselected(self, index, _): node = index.data(Qt.UserRole) if node is None: return self.removeProjectButton.setEnabled(node.canremove) self.newProjectButton.setEnabled(node.canadd) #self.newProjectButton.setText(node.addtext) #self.removeProjectButton.setText(node.removetext) project = node.project if project and not self.projectwidget.project == project: # Only load the project if it's different the current one. self.projectwidget.setproject(project) node.create_children() validateresults = list(project.validate()) if validateresults: text = "Here are some reasons we found: \n\n" for message in validateresults: text += "- {} \n".format(message) self.projectwidget.reasons_label.setText(text) if node.nodetype == Treenode.RoamNode: self.projectwidget.projectlabel.setText( "IntraMaps Roam Config Manager") elif node.nodetype == Treenode.MapNode: self.projectwidget.loadmap() elif node.nodetype == Treenode.FormsNode: haslayers = self.projectwidget.checkcapturelayers() self.newProjectButton.setEnabled(haslayers) self.projectwidget.projectbuttonframe.setVisible(not project is None) self.projectwidget.setpage(node.page, node)
def nodeselected(self, index, last, reloadProject=False): node = index.data(Qt.UserRole) if node is None: return project = node.project if project: validateresults = list(project.validate()) if validateresults: text = "Here are some reasons we found: \n\n" for message in validateresults: text += "- {} \n".format(message) self.projectwidget.reasons_label.setText(text) return if node.nodetype == Treenode.ProjectNode and reloadProject: self.reloadingProject = True self.projectwidget.setproject(project) return if project and self.loadedProject != project: # Only load the project if it's different the current one. roam.utils.info("Swapping to project: {}".format(project.name)) if self.loadedProject: lastnode = self.projectsnode.find_by_name( self.loadedProject.name) self.projectList.setExpanded(lastnode.index(), False) ## We are closing the open project at this point. Watch for null ref after this. self.projectwidget.setproject(project) return else: roam.utils.debug("Setting page") self.projectwidget.setpage(node.page, node) if node.nodetype == Treenode.RoamNode: self.projectwidget.projectlabel.setText( "IntraMaps Roam Config Manager") if node.nodetype == Treenode.AddNew: try: item = node.additem() except ValueError: return newindex = self.treemodel.indexFromItem(item) self.projectList.setCurrentIndex(newindex) return self.projectwidget.projectbuttonframe.setVisible(not project is None)
def nodeselected(self, index, last, reloadProject=False): node = index.data(Qt.UserRole) if node is None: return project = node.project if project: validateresults = list(project.validate()) if validateresults: text = "Here are some reasons we found: \n\n" for message in validateresults: text += "- {} \n".format(message) self.projectwidget.reasons_label.setText(text) return if node.nodetype == Treenode.ProjectNode and reloadProject: self.reloadingProject = True self.projectwidget.setproject(project) return if project and self.loadedProject != project: # Only load the project if it's different the current one. roam.utils.info("Swapping to project: {}".format(project.name)) if self.loadedProject: lastnode = self.projectsnode.find_by_name(self.loadedProject.name) self.projectList.setExpanded(lastnode.index(), False ) ## We are closing the open project at this point. Watch for null ref after this. self.projectwidget.setproject(project) return else: roam.utils.debug("Setting page") self.projectwidget.setpage(node.page, node) if node.nodetype == Treenode.RoamNode: self.projectwidget.projectlabel.setText("IntraMaps Roam Config Manager") if node.nodetype == Treenode.AddNew: try: item = node.additem() except ValueError: return newindex = self.treemodel.indexFromItem(item) self.projectList.setCurrentIndex(newindex) return self.projectwidget.projectbuttonframe.setVisible(not project is None)
def nodeselected(self, index, last, reloadProject=False): node = index.data(Qt.UserRole) if node is None: return project = node.project if project: if not project.requires_upgrade: validateresults = list(project.validate()) if validateresults: text = "Here are some reasons we found: \n\n" for message in validateresults: text += "- {} \n".format(message) self.projectwidget.reasons_label.setText(text) return if node.nodetype == Treenode.ProjectNode and reloadProject: self.reloadingProject = True self.projectwidget.setproject(project) return if project and self.loadedProject != project: # Only load the project if it's different the current one. if self.loadedProject: lastnode = self.projectsnode.find_by_name( self.loadedProject.name) self.projectList.setExpanded(lastnode.index(), False) # We are closing the open project at this point. Watch for null ref after this. self.projectwidget.setproject(project) self.projectwidget.setpage(node.page, node) return else: self.projectwidget.setpage(node.page, node) if node.nodetype == Treenode.AddNew: try: item = node.additem() except ValueError: return newindex = self.treemodel.indexFromItem(item) self.projectList.setCurrentIndex(newindex) return