def __init__(self, parent, repo, project=None, collection=None): QDialog.__init__(self, parent) self.setupUi(self) self.project = project self.parent = parent self.repo = repo self.repo_uri = os.path.join(repo.base_uri, repo.index_name) self.collection = None self.origCollection = None self.tmpCollection = None if collection: self.origCollection = collection self.tmpCollection = copy.deepcopy(collection) else: self.tmpCollection = PackageCollection(packages=PackageSet(self.repo_uri)) self.connect(self.titleText, SIGNAL("textChanged(const QString &)"), self.titleChanged) self.connect(self.descriptionText, SIGNAL("textChanged()"), self.descriptionChanged) self.connect(self.languagesCombo, SIGNAL("currentIndexChanged(int)"), self.updateTranslations) self.connect(self.packagesButton, SIGNAL("clicked()"), self.slotSelectPackages) self.connect(self.selectIcon, SIGNAL("clicked()"), self.slotSelectIcon) self.connect(self.clearIcon, SIGNAL("clicked()"), self.slotClearIcon) self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) self.fillContent()
def slotSelectPackages(self): if self.tmpCollection.packages.selectedPackages and self.tmpCollection.packages.selectedComponents: dialog = PackagesDialog( self, self.repo, self.tmpCollection.packages.selectedPackages, self.tmpCollection.packages.selectedComponents) if dialog.exec_(): self.tmpCollection.packages = PackageSet(self.repo_uri,\ dialog.components,\ dialog.packages,\ dialog.all_packages) else: dialog = PackagesDialog(self, self.repo) if dialog.exec_(): self.tmpCollection.packages = PackageSet(self.repo_uri,\ dialog.components,\ dialog.packages,\ dialog.all_packages)
default = collection.getAttribute("default") if not default: default = "" # Reads Collection identifiers id = collection.getTagData("Id") icon = collection.getTagData("Icon") # Reads Collection Translations translations = __collectionTranslations( collection.getTag("Translations")) # Reads Collection Selected Packages uri, selectedcomponents, selectedpackages, allPackages = __packageSelection( collection.getTag("PackageSelection")) packages = PackageSet(uri, selectedcomponents, selectedpackages, allPackages) self.package_collections.append( PackageCollection(id, icon, translations, packages, default)) # Hack for now.Change After multi repository support self.repo_uri = self.package_collections[0].packages.repoURI for collection in self.package_collections: collection.packages.selectedComponents.sort() collection.packages.selectedPackages.sort() collection.packages.allPackages.sort() else: packageSelectionTag = doc.getTag("PackageSelection") if packageSelectionTag: