Added quick select for TagSelectDialog

Implemented the last remaining tag in the TagSelectDialog to be automatically selected when confirming the dialog.
Improved logging of DB connection and selected tags
dev
Peery 3 years ago
parent 95fb1dbd0e
commit 1dd8f4af30

@ -358,7 +358,7 @@ class ArtNetManager:
self.window.setting_up_data = False
def create_db_connection(self, host: str, port: int, database: str, user: str, password: str) -> DBAdapter:
print("Changing db connection to ".format(host, port, user, password))
print(f"Changing db connection to {host}:{port} {user}@{database}")
return DBAdapter(user=user, password=password, host=host, port=port, database=database)
def get_root(self) -> str:

@ -63,7 +63,13 @@ class TagSelectDialog(QtWidgets.QDialog):
if super(TagSelectDialog, self).exec_() == QtWidgets.QDialog.Rejected:
return None
if self.selection is None:
if self.ui.search_result_list.model().rowCount() == 1 and self.selection is None:
# quick select for the last remaining tag
model_index = self.ui.search_result_list.model().index(0, 0)
item_data = self.ui.search_result_list.model().itemData(model_index)
self.selection = item_data[0]
elif self.selection is None: # nothing selected
return None
tag = self.parent.get_tag(self.selection)[0]
tag_data = {
@ -74,4 +80,5 @@ class TagSelectDialog(QtWidgets.QDialog):
"implications": self.parent.get_tag_implications(tag[0]),
"category_id": tag[2]
}
print("TagSelectDialog selected tag:", tag_data)
return tag_data

Loading…
Cancel
Save