Changed maximum number of image number spinbox

Raised the maximum to be always equal to the image list.
dev
Peery 3 years ago
parent ede0c01ed3
commit a8dcbcc386

@ -16,6 +16,7 @@ from ArtNet.web.link_generator import LinkGenerator
class ArtNetManager: class ArtNetManager:
def __init__(self, config_location: str = "."): def __init__(self, config_location: str = "."):
self.known_image_amount = None
self.config = ConfigReader(config_location, "somePassword") self.config = ConfigReader(config_location, "somePassword")
if self.config.data["version"] != self.config.CONFIG_VERSION: if self.config.data["version"] != self.config.CONFIG_VERSION:
@ -63,8 +64,9 @@ class ArtNetManager:
self.window.set_temporary_status_message("Hello o7", 5000) self.window.set_temporary_status_message("Hello o7", 5000)
def run(self): def run(self):
if len(self.all_images) > 0: if len(self.all_images) == 0:
self.curr_image_index = 0 raise FileNotFoundError("No files or folders were in artnet root!")
self.curr_image_index = 0
self.refresh_shown_image() self.refresh_shown_image()
self.window.show() self.window.show()
@ -89,6 +91,8 @@ class ArtNetManager:
if self.db_connection.get_art_by_path(image) is not None: if self.db_connection.get_art_by_path(image) is not None:
self.known_image_amount += 1 self.known_image_amount += 1
self.window.ui.imageNumberSpinBox.setMaximum(len(self.all_images))
def scrape_tags(self, file_name: str, art_ID: int, url: str=None): def scrape_tags(self, file_name: str, art_ID: int, url: str=None):
""" """
Scrape the tags from the given url and return which one's are new Scrape the tags from the given url and return which one's are new

@ -56,8 +56,7 @@ class ConfigReader:
Read the config from file and overwrite local settings Read the config from file and overwrite local settings
:return: :return:
""" """
print(os.path.isfile(self.__config_location)) print(f"Config file: {os.path.join(os.getcwd(), self.__config_location)}")
print(os.path.join(os.getcwd(), self.__config_location))
file = open(self.__config_location, "r") file = open(self.__config_location, "r")
data = yaml.safe_load(stream=file) data = yaml.safe_load(stream=file)
self.data = self.decrypt_sensitive_data(data) self.data = self.decrypt_sensitive_data(data)
@ -114,7 +113,7 @@ class ConfigReader:
) )
ConfigReader.nonce = bytes("qt34nvßn".encode('utf-8')) ConfigReader.nonce = bytes("qt34nvßn".encode('utf-8'))
def encrypt_text(self, text: str) -> str: def encrypt_text(self, text: str) -> bytes:
cipher_text_bytes = self.__aesgcm.encrypt(data=text.encode('utf-8'), cipher_text_bytes = self.__aesgcm.encrypt(data=text.encode('utf-8'),
associated_data=None, associated_data=None,
nonce=ConfigReader.nonce nonce=ConfigReader.nonce

Loading…
Cancel
Save