|
|
|
@ -17,6 +17,11 @@ class ArtNetManager:
|
|
|
|
|
|
|
|
|
|
def __init__(self, config_location: str = "."):
|
|
|
|
|
self.config = ConfigReader(config_location, "somePassword")
|
|
|
|
|
|
|
|
|
|
if self.config.data["version"] != self.config.CONFIG_VERSION:
|
|
|
|
|
print("Loaded config version is unequal to expected version! {0} (current) != {1} (expected)"
|
|
|
|
|
.format(self.config.data["version"], self.config.CONFIG_VERSION))
|
|
|
|
|
|
|
|
|
|
self.db_connection = None
|
|
|
|
|
self.__app = QApplication(sys.argv)
|
|
|
|
|
|
|
|
|
@ -45,16 +50,10 @@ class ArtNetManager:
|
|
|
|
|
database=db_data["database"])
|
|
|
|
|
self.window = Window(self)
|
|
|
|
|
|
|
|
|
|
# TODO prompt for overwriting config when password invalid
|
|
|
|
|
# TODO sane default location
|
|
|
|
|
# TODO tag editor, don't kill dialog if fields are missing
|
|
|
|
|
# TODO display Tag Category when searching for tags
|
|
|
|
|
|
|
|
|
|
# TODO remove string limit restrictions on implications & similar
|
|
|
|
|
|
|
|
|
|
self.__file_root: str = None
|
|
|
|
|
self.window.on_artnet_root_change_clicked()
|
|
|
|
|
self.__file_reader = FileReader(self.__file_root)
|
|
|
|
|
if len(self.config.data["file_root"]) == 0 or not os.path.isdir(self.config.data["file_root"]): # no file_root given by config or invalid
|
|
|
|
|
print("Querying for new file root due to lack of valid one ...")
|
|
|
|
|
self.window.on_artnet_root_change_clicked()
|
|
|
|
|
self.__file_reader = FileReader(self.config.data["file_root"])
|
|
|
|
|
|
|
|
|
|
self.curr_image_index: int = None
|
|
|
|
|
|
|
|
|
@ -336,7 +335,7 @@ class ArtNetManager:
|
|
|
|
|
|
|
|
|
|
print("Displaying", self.all_images[self.curr_image_index])
|
|
|
|
|
self.window.display_image(image_title, image_author,
|
|
|
|
|
os.path.join(self.__file_root, self.all_images[self.curr_image_index]),
|
|
|
|
|
os.path.join(self.config.data["file_root"], self.all_images[self.curr_image_index]),
|
|
|
|
|
self.all_images[self.curr_image_index],
|
|
|
|
|
art_ID, image_link, file_name=s[-1])
|
|
|
|
|
self.window.set_tag_list([self.db_connection.get_tag_by_ID(x)[0][1].strip() for x in self.db_connection.get_art_tags_by_ID(art_ID)])
|
|
|
|
@ -349,7 +348,7 @@ class ArtNetManager:
|
|
|
|
|
return DBAdapter(user=user, password=password, host=host, port=port, database=database)
|
|
|
|
|
|
|
|
|
|
def get_root(self) -> str:
|
|
|
|
|
return self.__file_root
|
|
|
|
|
return self.config.data["file_root"]
|
|
|
|
|
|
|
|
|
|
def change_root(self, path: str):
|
|
|
|
|
"""
|
|
|
|
@ -362,7 +361,8 @@ class ArtNetManager:
|
|
|
|
|
if len(path) == 0:
|
|
|
|
|
exit(0)
|
|
|
|
|
print("Changing root to", path)
|
|
|
|
|
self.__file_root = path
|
|
|
|
|
self.config.data["file_root"] = path
|
|
|
|
|
self.config.update_config()
|
|
|
|
|
|
|
|
|
|
def get_db_connection_details(self) -> dict:
|
|
|
|
|
return self.config.data["db"]
|
|
|
|
|