Add new setting to automatically select task as active after importing it
This commit is contained in:
parent
595e7ab1f9
commit
1e7985c1c9
@ -76,3 +76,14 @@ class Config:
|
|||||||
if type(value) is not bool:
|
if type(value) is not bool:
|
||||||
raise RuntimeError('config key "flip_menu" must be a bool')
|
raise RuntimeError('config key "flip_menu" must be a bool')
|
||||||
self._configparser["DEFAULT"]["flip_menu"] = f'"{value}"'
|
self._configparser["DEFAULT"]["flip_menu"] = f'"{value}"'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def import_auto_change_task(self):
|
||||||
|
val = dequotify(self._configparser.get("DEFAULT", "import_auto_change_task", fallback="no")).lower()
|
||||||
|
return val in ["yes", "true", "1"]
|
||||||
|
|
||||||
|
@import_auto_change_task.setter
|
||||||
|
def import_auto_change_task(self, value):
|
||||||
|
if type(value) is not bool:
|
||||||
|
raise RuntimeError('config key "import_auto_change_task" must be a bool')
|
||||||
|
self._configparser["DEFAULT"]["import_auto_change_task"] = f'"{value}"'
|
||||||
|
@ -79,6 +79,8 @@ class App:
|
|||||||
def new_task_imported(self):
|
def new_task_imported(self):
|
||||||
if self.import_task.task_text:
|
if self.import_task.task_text:
|
||||||
self.tasks.add_jira_task(self.import_task.task_text)
|
self.tasks.add_jira_task(self.import_task.task_text)
|
||||||
|
if self.config.import_auto_change_task:
|
||||||
|
self.change_task(self.import_task.task_text)
|
||||||
self.update_tray_menu()
|
self.update_tray_menu()
|
||||||
|
|
||||||
@QtCore.Slot()
|
@QtCore.Slot()
|
||||||
|
@ -50,6 +50,13 @@ class Settings(QtWidgets.QDialog):
|
|||||||
self.flip_menu_check_box = QtWidgets.QCheckBox()
|
self.flip_menu_check_box = QtWidgets.QCheckBox()
|
||||||
settings_layout.addWidget(self.flip_menu_check_box, 3, 1, QtCore.Qt.AlignRight)
|
settings_layout.addWidget(self.flip_menu_check_box, 3, 1, QtCore.Qt.AlignRight)
|
||||||
|
|
||||||
|
import_auto_change_task_label = QtWidgets.QLabel()
|
||||||
|
import_auto_change_task_label.setText("Automatically select as active task\n after task import")
|
||||||
|
#import_auto_change_task_label.setTextFormat(QtCore.Qt.)
|
||||||
|
settings_layout.addWidget(import_auto_change_task_label, 4, 0)
|
||||||
|
self.import_auto_change_task_check_box = QtWidgets.QCheckBox()
|
||||||
|
settings_layout.addWidget(self.import_auto_change_task_check_box, 4, 1, QtCore.Qt.AlignRight)
|
||||||
|
|
||||||
self.ok_button = QtWidgets.QPushButton()
|
self.ok_button = QtWidgets.QPushButton()
|
||||||
self.ok_button.setText("OK")
|
self.ok_button.setText("OK")
|
||||||
self.ok_button.setIcon(get_icon("dialog-ok"))
|
self.ok_button.setIcon(get_icon("dialog-ok"))
|
||||||
@ -74,12 +81,14 @@ class Settings(QtWidgets.QDialog):
|
|||||||
self.jira_token_edit.setText(self.config.jira_token)
|
self.jira_token_edit.setText(self.config.jira_token)
|
||||||
self.tray_theme_combo_box.setCurrentText(self.config.tray_theme.capitalize())
|
self.tray_theme_combo_box.setCurrentText(self.config.tray_theme.capitalize())
|
||||||
self.flip_menu_check_box.setChecked(self.config.flip_menu)
|
self.flip_menu_check_box.setChecked(self.config.flip_menu)
|
||||||
|
self.import_auto_change_task_check_box.setChecked(self.config.import_auto_change_task)
|
||||||
|
|
||||||
def _accepted(self):
|
def _accepted(self):
|
||||||
self.config.jira_url = self.jira_url_edit.text()
|
self.config.jira_url = self.jira_url_edit.text()
|
||||||
self.config.jira_token = self.jira_token_edit.text()
|
self.config.jira_token = self.jira_token_edit.text()
|
||||||
self.config.tray_theme = self.tray_theme_combo_box.currentText()
|
self.config.tray_theme = self.tray_theme_combo_box.currentText()
|
||||||
self.config.flip_menu = self.flip_menu_check_box.isChecked()
|
self.config.flip_menu = self.flip_menu_check_box.isChecked()
|
||||||
|
self.config.import_auto_change_task = self.import_auto_change_task_check_box.isChecked()
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user