def displaySubusersList(self): self.sectionTitle.setText("Subusers") subusersDividedDict = subuser.executeGetJson( ["list", "subusers", "--json"]) subusersDict = {} subusersDict.update(subusersDividedDict["locked"]) subusersDict.update(subusersDividedDict["unlocked"]) self.listWidget.clear() for subuserName, attributes in subusersDict.items(): if not subuserName.startswith("!"): widgetItem = SubuserListWidgetItem(subuserName, attributes) def wrapsSelected(): thisWidgetItem = widgetItem def selected(): self.selectionLabel.setText(thisWidgetItem.name) self.tabWidget.clear() self.tabWidget.insertTab( 0, thisWidgetItem.getActionsWidget(), "Actions") return selected widgetItem.selected = wrapsSelected() self.listWidget.addItem(widgetItem) firstItem = self.listWidget.item(0) if firstItem: self.listWidget.setItemSelected(firstItem, True)
def displayRepositoriesList(self,displayToListWidget=False): if displayToListWidget: self.sectionTitle.setText("Repositories") self.repositoriesList = subuser.executeGetJson(["list","repositories","--json"]) repositoriesItem = self.sideBar.topLevelItem(1) repositoriesItem.takeChildren() repositoryItems=[] if displayToListWidget: self.listWidget.clear() for repositoryName,attributes in self.repositoriesList.items(): newItem = RepositoryTreeWidgetItem(repositoryName,attributes) repositoryItems.append(newItem) if displayToListWidget: widgetItem = QtGui.QListWidgetItem(newItem.text(0)) widgetItem.setIcon(QtGui.QIcon(icons["repository"])) def wrapsActivated(): item = newItem return (lambda: self.sideBar.setCurrentItem(item)) widgetItem.activated = wrapsActivated() def wrapsSelected(): item = newItem def selected(): self.selectionLabel.setText(item.displayName) self.tabWidget.clear() self.tabWidget.insertTab(0,item.getActionsWidget(),"Actions") return selected widgetItem.selected = wrapsSelected() self.listWidget.addItem(widgetItem) repositoriesItem.addChildren(repositoryItems) if displayToListWidget: firstItem = self.listWidget.item(0) if firstItem: self.listWidget.setItemSelected(firstItem,True)
def displayRepository(self,repoItem): self.sectionTitle.setText(repoItem.displayName) self.listWidget.clear() imageSources = subuser.executeGetJson(["list","available","--json"]) for imageSourceName,attributes in imageSources[repoItem.name].items(): newItem = ImageSourceListWidgetItem(imageSourceName,attributes) def wrapsSelected(): item = newItem def selected(): self.selectionLabel.setText(item.name) self.tabWidget.clear() self.tabWidget.insertTab(0,item.getActionsWidget(),"Actions") return selected newItem.selected = wrapsSelected() self.listWidget.addItem(newItem) firstItem = self.listWidget.item(0) if firstItem: self.listWidget.setItemSelected(firstItem,True)
def displayRepositoriesList(self, displayToListWidget=False): if displayToListWidget: self.sectionTitle.setText("Repositories") self.repositoriesList = subuser.executeGetJson( ["list", "repositories", "--json"]) repositoriesItem = self.sideBar.topLevelItem(1) repositoriesItem.takeChildren() repositoryItems = [] if displayToListWidget: self.listWidget.clear() for repositoryName, attributes in self.repositoriesList.items(): newItem = RepositoryTreeWidgetItem(repositoryName, attributes) repositoryItems.append(newItem) if displayToListWidget: widgetItem = QtGui.QListWidgetItem(newItem.text(0)) widgetItem.setIcon(QtGui.QIcon(icons["repository"])) def wrapsActivated(): item = newItem return (lambda: self.sideBar.setCurrentItem(item)) widgetItem.activated = wrapsActivated() def wrapsSelected(): item = newItem def selected(): self.selectionLabel.setText(item.displayName) self.tabWidget.clear() self.tabWidget.insertTab(0, item.getActionsWidget(), "Actions") return selected widgetItem.selected = wrapsSelected() self.listWidget.addItem(widgetItem) repositoriesItem.addChildren(repositoryItems) if displayToListWidget: firstItem = self.listWidget.item(0) if firstItem: self.listWidget.setItemSelected(firstItem, True)
def displaySubusersList(self): self.sectionTitle.setText("Subusers") subusersDividedDict = subuser.executeGetJson(["list","subusers","--json"]) subusersDict = {} subusersDict.update(subusersDividedDict["locked"]) subusersDict.update(subusersDividedDict["unlocked"]) self.listWidget.clear() for subuserName,attributes in subusersDict.items(): if not subuserName.startswith("!"): widgetItem = SubuserListWidgetItem(subuserName,attributes) def wrapsSelected(): thisWidgetItem = widgetItem def selected(): self.selectionLabel.setText(thisWidgetItem.name) self.tabWidget.clear() self.tabWidget.insertTab(0,thisWidgetItem.getActionsWidget(),"Actions") return selected widgetItem.selected = wrapsSelected() self.listWidget.addItem(widgetItem) firstItem = self.listWidget.item(0) if firstItem: self.listWidget.setItemSelected(firstItem,True)
def displayRepository(self, repoItem): self.sectionTitle.setText(repoItem.displayName) self.listWidget.clear() imageSources = subuser.executeGetJson(["list", "available", "--json"]) for imageSourceName, attributes in imageSources[repoItem.name].items(): newItem = ImageSourceListWidgetItem(imageSourceName, attributes) def wrapsSelected(): item = newItem def selected(): self.selectionLabel.setText(item.name) self.tabWidget.clear() self.tabWidget.insertTab(0, item.getActionsWidget(), "Actions") return selected newItem.selected = wrapsSelected() self.listWidget.addItem(newItem) firstItem = self.listWidget.item(0) if firstItem: self.listWidget.setItemSelected(firstItem, True)