Various improvements
This commit is contained in:
parent
25c768ee2e
commit
3e1f17cfa2
11
main.py
11
main.py
@ -79,10 +79,10 @@ class App:
|
|||||||
self.menu.addSeparator()
|
self.menu.addSeparator()
|
||||||
|
|
||||||
new_action = self.menu.addAction("New task")
|
new_action = self.menu.addAction("New task")
|
||||||
new_action.triggered.connect(self.new_task.show)
|
new_action.triggered.connect(self.new_task_slot)
|
||||||
|
|
||||||
new_action = self.menu.addAction("Edit tasks")
|
edit_action = self.menu.addAction("Edit tasks")
|
||||||
new_action.triggered.connect(self.edit_tasks)
|
edit_action.triggered.connect(self.edit_tasks)
|
||||||
|
|
||||||
report_action = self.menu.addAction("Report")
|
report_action = self.menu.addAction("Report")
|
||||||
report_action.triggered.connect(self.report)
|
report_action.triggered.connect(self.report)
|
||||||
@ -109,6 +109,11 @@ class App:
|
|||||||
self.reportDialog.set_data(self.log.report())
|
self.reportDialog.set_data(self.log.report())
|
||||||
self.reportDialog.show()
|
self.reportDialog.show()
|
||||||
|
|
||||||
|
@QtCore.Slot()
|
||||||
|
def new_task_slot(self):
|
||||||
|
self.new_task.reset_task_text()
|
||||||
|
self.new_task.show()
|
||||||
|
|
||||||
@QtCore.Slot()
|
@QtCore.Slot()
|
||||||
def edit_tasks(self):
|
def edit_tasks(self):
|
||||||
self.taskEdit.tasks = self.tasks.tasks
|
self.taskEdit.tasks = self.tasks.tasks
|
||||||
|
23
new_task.py
23
new_task.py
@ -13,20 +13,22 @@ class NewTask(QtWidgets.QDialog):
|
|||||||
self.line_edit.setCompleter(completer)
|
self.line_edit.setCompleter(completer)
|
||||||
self.line_edit.textChanged.connect(completer.update_picker)
|
self.line_edit.textChanged.connect(completer.update_picker)
|
||||||
|
|
||||||
cancel_button = QtWidgets.QPushButton()
|
|
||||||
cancel_button.setText("OK")
|
|
||||||
cancel_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok-apply"))
|
|
||||||
cancel_button.pressed.connect(self.accept)
|
|
||||||
|
|
||||||
ok_button = QtWidgets.QPushButton()
|
ok_button = QtWidgets.QPushButton()
|
||||||
ok_button.setText("Cancel")
|
ok_button.setText("OK")
|
||||||
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-cancel"))
|
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok-apply"))
|
||||||
ok_button.pressed.connect(self.reject)
|
ok_button.pressed.connect(self.accept)
|
||||||
|
ok_button.setAutoDefault(True)
|
||||||
|
|
||||||
|
cancel_button = QtWidgets.QPushButton()
|
||||||
|
cancel_button.setText("Cancel")
|
||||||
|
cancel_button.setIcon(QtGui.QIcon.fromTheme("dialog-cancel"))
|
||||||
|
cancel_button.pressed.connect(self.reject)
|
||||||
|
cancel_button.setAutoDefault(False)
|
||||||
|
|
||||||
blayout = QtWidgets.QHBoxLayout()
|
blayout = QtWidgets.QHBoxLayout()
|
||||||
blayout.addSpacing(300)
|
blayout.addSpacing(300)
|
||||||
blayout.addWidget(ok_button)
|
|
||||||
blayout.addWidget(cancel_button)
|
blayout.addWidget(cancel_button)
|
||||||
|
blayout.addWidget(ok_button)
|
||||||
|
|
||||||
layout = QtWidgets.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
layout.addWidget(self.line_edit)
|
layout.addWidget(self.line_edit)
|
||||||
@ -37,3 +39,6 @@ class NewTask(QtWidgets.QDialog):
|
|||||||
@property
|
@property
|
||||||
def task_text(self):
|
def task_text(self):
|
||||||
return self.line_edit.text()
|
return self.line_edit.text()
|
||||||
|
|
||||||
|
def reset_task_text(self):
|
||||||
|
self.line_edit.setText("")
|
||||||
|
@ -27,26 +27,31 @@ class Report(QtWidgets.QDialog):
|
|||||||
self.previous_button.setText("Previous")
|
self.previous_button.setText("Previous")
|
||||||
self.previous_button.setIcon(QtGui.QIcon.fromTheme("arrow-left"))
|
self.previous_button.setIcon(QtGui.QIcon.fromTheme("arrow-left"))
|
||||||
self.previous_button.pressed.connect(self.previous)
|
self.previous_button.pressed.connect(self.previous)
|
||||||
|
self.previous_button.setAutoDefault(False)
|
||||||
|
|
||||||
self.next_button = QtWidgets.QPushButton()
|
self.next_button = QtWidgets.QPushButton()
|
||||||
self.next_button.setText("Next")
|
self.next_button.setText("Next")
|
||||||
self.next_button.setIcon(QtGui.QIcon.fromTheme("arrow-right"))
|
self.next_button.setIcon(QtGui.QIcon.fromTheme("arrow-right"))
|
||||||
self.next_button.pressed.connect(self.next)
|
self.next_button.pressed.connect(self.next)
|
||||||
|
self.next_button.setAutoDefault(False)
|
||||||
|
|
||||||
new_button = QtWidgets.QPushButton()
|
new_button = QtWidgets.QPushButton()
|
||||||
new_button.setText("New item")
|
new_button.setText("New item")
|
||||||
new_button.setIcon(QtGui.QIcon.fromTheme("list-add"))
|
new_button.setIcon(QtGui.QIcon.fromTheme("list-add"))
|
||||||
new_button.pressed.connect(self.new_log)
|
new_button.pressed.connect(self.new_log)
|
||||||
|
new_button.setAutoDefault(False)
|
||||||
|
|
||||||
del_button = QtWidgets.QPushButton()
|
del_button = QtWidgets.QPushButton()
|
||||||
del_button.setText("Delete item")
|
del_button.setText("Delete item")
|
||||||
del_button.setIcon(QtGui.QIcon.fromTheme("list-remove"))
|
del_button.setIcon(QtGui.QIcon.fromTheme("list-remove"))
|
||||||
del_button.pressed.connect(self.del_log)
|
del_button.pressed.connect(self.del_log)
|
||||||
|
del_button.setAutoDefault(False)
|
||||||
|
|
||||||
ok_button = QtWidgets.QPushButton()
|
ok_button = QtWidgets.QPushButton()
|
||||||
ok_button.setText("OK")
|
ok_button.setText("OK")
|
||||||
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok-apply"))
|
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok-apply"))
|
||||||
ok_button.pressed.connect(self._accept)
|
ok_button.pressed.connect(self._accept)
|
||||||
|
ok_button.setAutoDefault(True)
|
||||||
|
|
||||||
blayout = QtWidgets.QHBoxLayout()
|
blayout = QtWidgets.QHBoxLayout()
|
||||||
blayout.addWidget(self.previous_button)
|
blayout.addWidget(self.previous_button)
|
||||||
|
@ -16,16 +16,19 @@ class TaskEdit(QtWidgets.QDialog):
|
|||||||
new_button.setText("New item")
|
new_button.setText("New item")
|
||||||
new_button.setIcon(QtGui.QIcon.fromTheme("list-add"))
|
new_button.setIcon(QtGui.QIcon.fromTheme("list-add"))
|
||||||
new_button.pressed.connect(self.new_task)
|
new_button.pressed.connect(self.new_task)
|
||||||
|
new_button.setAutoDefault(False)
|
||||||
|
|
||||||
del_button = QtWidgets.QPushButton()
|
del_button = QtWidgets.QPushButton()
|
||||||
del_button.setText("Delete item")
|
del_button.setText("Delete item")
|
||||||
del_button.setIcon(QtGui.QIcon.fromTheme("list-remove"))
|
del_button.setIcon(QtGui.QIcon.fromTheme("list-remove"))
|
||||||
del_button.pressed.connect(self.del_task)
|
del_button.pressed.connect(self.del_task)
|
||||||
|
del_button.setAutoDefault(False)
|
||||||
|
|
||||||
ok_button = QtWidgets.QPushButton()
|
ok_button = QtWidgets.QPushButton()
|
||||||
ok_button.setText("OK")
|
ok_button.setText("OK")
|
||||||
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok-apply"))
|
ok_button.setIcon(QtGui.QIcon.fromTheme("dialog-ok-apply"))
|
||||||
ok_button.pressed.connect(self.accept)
|
ok_button.pressed.connect(self.accept)
|
||||||
|
ok_button.setAutoDefault(True)
|
||||||
|
|
||||||
blayout = QtWidgets.QHBoxLayout()
|
blayout = QtWidgets.QHBoxLayout()
|
||||||
blayout.addWidget(new_button)
|
blayout.addWidget(new_button)
|
||||||
|
Loading…
Reference in New Issue
Block a user