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