Propagate config changes better

This commit is contained in:
Fabian 2024-02-29 23:00:43 +01:00
parent 64f72dbf35
commit 4c0715ee83
2 changed files with 5 additions and 4 deletions

View File

@ -89,7 +89,7 @@ class ImportTask(QtWidgets.QDialog):
def showEvent(self, _): def showEvent(self, _):
self.auto_change_task_check_box.setChecked(self.config.import_auto_change_task) self.auto_change_task_check_box.setChecked(self.config.import_auto_change_task)
# pick up config changes # pick up config changes
self.completer.update_urls() self.completer.update()
self.line_edit.setText("") self.line_edit.setText("")
self.raise_() self.raise_()
self.line_edit.setFocus() self.line_edit.setFocus()

View File

@ -33,13 +33,12 @@ class TaskCompleter(QtWidgets.QCompleter):
self.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.session = FuturesSession() self.session = FuturesSession()
self.session.headers["Accept"] = "application/json" self.session.headers["Accept"] = "application/json"
add_auth(config, self.session)
self.config = config self.config = config
self.picker_url = None self.picker_url = None
self.search_url = None self.search_url = None
self.issue_url_tmpl = None self.issue_url_tmpl = None
self.issue_key_regex = re.compile(r"^[a-zA-Z0-9]+-[0-9]+") self.issue_key_regex = re.compile(r"^[a-zA-Z0-9]+-[0-9]+")
self.update_urls() self.update()
self.text = "" self.text = ""
self.response_text = "" self.response_text = ""
self.model_data = set() self.model_data = set()
@ -53,10 +52,12 @@ class TaskCompleter(QtWidgets.QCompleter):
self.rif_counter_lock = threading.Lock() self.rif_counter_lock = threading.Lock()
self.last_rif_state = TaskCompleter.RifState.STOPPED self.last_rif_state = TaskCompleter.RifState.STOPPED
def update_urls(self): def update(self):
self.picker_url = os.path.join(self.config.jira_url, "rest/api/2/issue/picker") self.picker_url = os.path.join(self.config.jira_url, "rest/api/2/issue/picker")
self.search_url = os.path.join(self.config.jira_url, "rest/api/2/search") self.search_url = os.path.join(self.config.jira_url, "rest/api/2/search")
self.issue_url_tmpl = os.path.join(self.config.jira_url, "rest/api/2/issue/{}") self.issue_url_tmpl = os.path.join(self.config.jira_url, "rest/api/2/issue/{}")
self.session = FuturesSession()
add_auth(self.config, self.session)
@QtCore.Slot() @QtCore.Slot()
def process_response(self): def process_response(self):