Beispiel #1
0
 def resetItems(self):
     self.isUpdating = True
     self.dataViewModel.clear()
     filterEntry = self.filterEntry.text().lower()
     rowCount = 0
     colCount = 0
     catalogData = self.localCatalogData
     if self.location == "remote":
         catalogData = self.remoteCatalogData
     for id, value in catalogData.items():
         id2, filename, type, directory, file, description, repo, installDirectory, sha = value
         if (filterEntry == "" or filterEntry in filename.lower()
                 or filterEntry in description.lower()):
             if (not self.pdfCheckbox.isChecked() and type == "PDF") or \
                     (not self.mp3Checkbox.isChecked() and type == "MP3") or \
                     (not self.mp4Checkbox.isChecked() and type == "MP4") or \
                     (not self.bookCheckbox.isChecked() and type == "BOOK") or \
                     (not self.docxCheckbox.isChecked() and type == "DOCX") or \
                     (not self.devotionalCheckbox.isChecked() and type == "DEVOTIONAL") or \
                     (not self.commCheckbox.isChecked() and type == "COMM"):
                 continue
             enable = True
             if self.location == "remote":
                 installDirectory = os.path.join(config.marvelData,
                                                 installDirectory)
                 if FileUtil.regexFileExists(
                         "{0}.*".format(GithubUtil.getShortname(filename)),
                         installDirectory):
                     enable = False
             item = QStandardItem(id)
             item.setEnabled(enable)
             self.dataViewModel.setItem(rowCount, colCount, item)
             colCount += 1
             item = QStandardItem(file)
             item.setEnabled(enable)
             self.dataViewModel.setItem(rowCount, colCount, item)
             colCount += 1
             item = QStandardItem(directory)
             item.setEnabled(enable)
             self.dataViewModel.setItem(rowCount, colCount, item)
             colCount += 1
             # item = QStandardItem(description)
             # self.dataViewModel.setItem(rowCount, colCount, item)
             # colCount += 1
             # add row count
             rowCount += 1
             colCount = 0
     self.dataViewModel.setHorizontalHeaderLabels([
         "#",
         config.thisTranslation["file"],
         config.thisTranslation["directory"],
         # config.thisTranslation["description"]
     ])
     self.dataView.resizeColumnsToContents()
     self.isUpdating = False
Beispiel #2
0
 def itemClicked(self, index):
     selectedRow = index.row()
     self.catalogEntryId = self.dataViewModel.item(selectedRow, 0).text()
     if self.location == "remote":
         item = self.remoteCatalogData[self.catalogEntryId]
         id, filename, type, directory, file, description, repo, installDirectory, sha = item
         installDirectory = os.path.join(config.marvelData,
                                         installDirectory)
         if FileUtil.regexFileExists(
                 "{0}.*".format(GithubUtil.getShortname(filename)),
                 installDirectory):
             self.downloadButton.setEnabled(False)
             self.downloadButton.setStyleSheet("")
         else:
             self.downloadButton.setEnabled(True)
             self.downloadButton.setStyleSheet(self.textButtonStyle)