def createNewFolder(self, name):
     try:
         ht_requests.create_folder(self.authcontrol,
                                   folder_name=name,
                                   ht_id_path=self.path)
         folderlist = ht_requests._list_location_contents(
             self.authcontrol, ht_id_path=self.path)
         self.stringlistmodel.getLists(folderlist)
     except Exception as e:
         QMessageBox.warning(None, QApplication.applicationDisplayName(),
                             "Error creating remote directory.\n" + str(e))
    def acceptApiKey(self):
        self.accessKey = self.promptui.apiKeyLineEdit.text()
        if self.accessKey == "":
            QMessageBox.warning(None, QApplication.applicationDisplayName(),
                                "Please set the API Access key.")
            return

        self.apiSubmitted.emit(self.accessKey)
        try:
            self.authcontrol = htauthcontroller.HTAuthorizationController(
                self.accessKey)
            self.promptui.ht_server_url.setText(self.authcontrol.base_url)
            self.promptui.ht_username.setText(self.authcontrol.get_username())
            self.promptui.token_expiration.setText(self.authcontrol.expires_at)
            folderlist = ht_requests._list_location_contents(
                self.authcontrol, ht_id_path=self.path)
            self.stringlistmodel.getLists(folderlist)
            self.promptui.listView.setModel(self.stringlistmodel)
        except Exception as e:
            QMessageBox.warning(
                None, QApplication.applicationDisplayName(),
                "Error during the authentication process.\n" + str(e))
 def ascendingDirectories(self, myIndex):
     try:
         self.parentName += myIndex.data() + "/"
         self.promptui.directoryLabel.setText(self.parentName)
         self.path += self.stringlistmodel.uuidList[
             self.stringlistmodel.directoryList.index(myIndex.data())] + ","
         folderlist = ht_requests._list_location_contents(
             self.authcontrol, ht_id_path=self.path)
         self.stringlistmodel.getLists(folderlist)
         self.promptui.locationLineEdit.setText("")
     except Exception as e:
         QMessageBox.warning(None, QApplication.applicationDisplayName(),
                             "Error during directory traversal.\n" + str(e))
 def parentDirectory(self):
     try:
         self.parentName = self.parentName.split("/")
         self.parentName = "/".join(self.parentName[:-2]) + "/"
         self.promptui.directoryLabel.setText(self.parentName)
         self.path = self.path.split(",")
         self.path = ",".join(self.path[:-2]) + ","
         folderlist = ht_requests._list_location_contents(
             self.authcontrol, ht_id_path=self.path)
         self.stringlistmodel.getLists(folderlist)
     except Exception as e:
         QMessageBox.warning(
             None, QApplication.applicationDisplayName(),
             "Error getting the parent directory.\n" + str(e))
Ejemplo n.º 5
0
    def checkList(self):
        missingSources = []
        displayMessage = False
        for i in range(len(self.tablemodel.templatesources)):
            if "Custom Input" not in self.tablemodel.templatesources[i]:
                if self.tablemodel.templatesources[
                        i] not in self.tablemodel.newmetadatasources:
                    missingSources.append(self.tablemodel.templatesources[i])
                    displayMessage = True

        for i in range(len(self.tablemodel.newmetadataList)):
            self.tablemodel.addRow(self.tablemodel.newmetadataList[i])

        if displayMessage:
            QMessageBox.warning(
                None, QApplication.applicationDisplayName(),
                "Bad stuff happens. " +
                "The file extracted is missing Source: \n\n" +
                str(missingSources))

        self.tablemodel.newmetadataList = []
        self.tablemodel.newmetadatasources = []