diff -Nru lcurse-0.2+git20160823/debian/changelog lcurse-0.2+git20160824/debian/changelog --- lcurse-0.2+git20160823/debian/changelog 2016-08-23 16:08:56.000000000 +0000 +++ lcurse-0.2+git20160824/debian/changelog 2016-08-24 09:55:02.000000000 +0000 @@ -1,3 +1,9 @@ +lcurse (0.2+git20160824-0~webupd8~0) xenial; urgency=medium + + * New Git pull + + -- Alin Andrei Wed, 24 Aug 2016 12:54:46 +0200 + lcurse (0.2+git20160823-0~webupd8~3) xenial; urgency=medium * New Git pull diff -Nru lcurse-0.2+git20160823/modules/application.py lcurse-0.2+git20160824/modules/application.py --- lcurse-0.2+git20160823/modules/application.py 2016-08-23 10:07:57.000000000 +0000 +++ lcurse-0.2+git20160824/modules/application.py 2016-08-24 09:54:30.000000000 +0000 @@ -355,20 +355,57 @@ contents = os.listdir(parent) addonName = str(self.addonList.item(row, 0).text()) deleted = False + deleted_addons = [] + potential_deletions = [] for item in contents: itemDir = "{}/{}".format(parent, item) if os.path.isdir(itemDir) and not item.lower().startswith("blizzard_"): toc = "{}/{}.toc".format(itemDir, item) if os.path.exists(toc): tmp = self.extractAddonMetadataFromTOC(toc) - if re.match(tmp[0], addonName) != None: + if tmp[0] == addonName: rmtree(itemDir) + deleted_addons.append(item) deleted = True + + self.addonList.removeRow(row) + if not deleted: Qt.QMessageBox.question(self, "No addons removed", - str(self.tr("No addons matching {} found.\nManual deletion required.")).format(addonName), + str(self.tr("No addons matching \"{}\" found.\nThe addon might already be removed, or could be going under a different name.\nManual deletion may be required.")).format(addonName), Qt.QMessageBox.Ok) - self.addonList.removeRow(row) + else: + potential = False + for item in contents: + itemDir = "{}/{}".format(parent, item) + if os.path.isdir(itemDir) and not item.lower().startswith("blizzard_"): + toc = "{}/{}.toc".format(itemDir, item) + if os.path.exists(toc): + tmp = self.extractAddonMetadataFromTOC(toc) + for d in deleted_addons: + deletions = list(filter(None, re.split("[_, \-!?:]+", d))) + for word in deletions: + if re.search(word, tmp[0]) != None: + potential_deletions.append(item) + potential = True + break + if potential: + break + if potential: + to_delete = '\n'.join(potential_deletions) + removal = Qt.QMessageBox.question(self, "Potential deletion candidates found", + str(self.tr("Remove the following addons as well?\n{}")).format(to_delete), + Qt.QMessageBox.Yes, Qt.QMessageBox.No) + if removal == Qt.QMessageBox.Yes: + for p in potential_deletions: + all_rows = self.addonList.rowCount() + for n in range(0, all_rows): + name = str(self.addonList.item(n, 0).text()) + if p == name: + self.addonList.removeRow(n) + break + rmtree("{}/{}".format(parent, p)) + self.saveAddons() def setRowColor(self, row, color):