Fix some bugs
This commit is contained in:
parent
3189d9a7a5
commit
d08c4a1971
@ -71,18 +71,21 @@ class WorklogDialog(QtWidgets.QDialog):
|
||||
super().__init__(parent)
|
||||
self.config = config
|
||||
self.return_ = False
|
||||
self.initial_text = ""
|
||||
self.editor = None
|
||||
|
||||
def createEditor(self, parent, option, index):
|
||||
editor = super().createEditor(parent, option, index)
|
||||
self.editor = super().createEditor(parent, option, index)
|
||||
self.editFinished.connect(partial(self.edit_finished_row_target, index.row()))
|
||||
self.return_ = False
|
||||
editor.returnPressed.connect(self.return_pressed)
|
||||
self.initial_text = index.data()
|
||||
self.editor.returnPressed.connect(self.return_pressed)
|
||||
completer = TaskCompleter(self.config)
|
||||
completer.setFilterMode(QtCore.Qt.MatchFlag.MatchContains)
|
||||
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
||||
editor.setCompleter(completer)
|
||||
editor.textChanged.connect(completer.update_picker)
|
||||
return editor
|
||||
self.editor.setCompleter(completer)
|
||||
self.editor.textChanged.connect(completer.update_picker)
|
||||
return self.editor
|
||||
|
||||
@QtCore.Slot()
|
||||
def return_pressed(self):
|
||||
@ -90,7 +93,7 @@ class WorklogDialog(QtWidgets.QDialog):
|
||||
|
||||
@QtCore.Slot()
|
||||
def edit_finished_row_target(self, row):
|
||||
if not self.return_:
|
||||
if not self.return_ or self.editor.text() == self.initial_text:
|
||||
self.edit_finished_row.emit(row)
|
||||
|
||||
def __init__(self, config: Config, worklog: Worklog, parent, *args, **kwargs):
|
||||
@ -175,6 +178,7 @@ class WorklogDialog(QtWidgets.QDialog):
|
||||
def showEvent(self, _):
|
||||
# reinitialize to purge caches
|
||||
self.rest = WorklogRest(self.config)
|
||||
self._statuses = []
|
||||
self.update_all()
|
||||
self.upload_button.setEnabled(False)
|
||||
|
||||
@ -249,6 +253,7 @@ class WorklogDialog(QtWidgets.QDialog):
|
||||
self.tableWidget.setMinimumWidth(min(desired_width, self.tableWidget.maximumWidth()))
|
||||
self.adjustSize()
|
||||
|
||||
@QtCore.Slot(int)
|
||||
def update_status_view(self, row):
|
||||
if self._statuses[row][0] is Status.PROGRESS:
|
||||
icon = ProgressIndicator(self)
|
||||
@ -323,6 +328,8 @@ class WorklogDialog(QtWidgets.QDialog):
|
||||
self._worklog_data[row][0] = self.tableWidget.item(row, 0).text()
|
||||
self.save()
|
||||
self.update_all()
|
||||
# status view update might get filtered (if still fetching) in update_all, therefore we force it here again
|
||||
self.update_status_view(row)
|
||||
self.upload_button.setEnabled(False)
|
||||
|
||||
@QtCore.Slot()
|
||||
|
Loading…
Reference in New Issue
Block a user