Various fixes
This commit is contained in:
parent
6815dbd684
commit
c25912ef6a
@ -327,24 +327,27 @@ def duration_to_str(duration: timedelta) -> str:
|
|||||||
class PrevNextable:
|
class PrevNextable:
|
||||||
def __init__(self, data: LogCommentsData):
|
def __init__(self, data: LogCommentsData):
|
||||||
self._data = data
|
self._data = data
|
||||||
self.date = date.today()
|
|
||||||
self._prev = None
|
self._prev = None
|
||||||
self._next = None
|
self._next = None
|
||||||
self._update_prev_next()
|
self._date = date.today()
|
||||||
|
|
||||||
def _update_prev_next(self):
|
@property
|
||||||
self._prev, self._next = self._data.get_prev_next_avail(self.date)
|
def date(self):
|
||||||
|
return self._date
|
||||||
|
|
||||||
|
@date.setter
|
||||||
|
def date(self, value):
|
||||||
|
self._prev, self._next = self._data.get_prev_next_avail(value)
|
||||||
|
self._date = value
|
||||||
|
|
||||||
def prev_next_avail(self) -> Tuple[bool, bool]:
|
def prev_next_avail(self) -> Tuple[bool, bool]:
|
||||||
return self._prev is not None, self._next is not None
|
return self._prev is not None, self._next is not None
|
||||||
|
|
||||||
def previous(self):
|
def previous(self):
|
||||||
self.date = self._prev
|
self.date = self._prev
|
||||||
self._update_prev_next()
|
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
self.date = self._next
|
self.date = self._next
|
||||||
self._update_prev_next()
|
|
||||||
|
|
||||||
def date_str(self) -> str:
|
def date_str(self) -> str:
|
||||||
return self.date.strftime("%Y-%m-%d")
|
return self.date.strftime("%Y-%m-%d")
|
||||||
|
@ -18,6 +18,7 @@ class ImportTask(QtWidgets.QDialog):
|
|||||||
completer = TaskCompleter(config)
|
completer = TaskCompleter(config)
|
||||||
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)
|
||||||
|
self.line_edit.setFocus()
|
||||||
|
|
||||||
self.indicator = ProgressIndicator(self)
|
self.indicator = ProgressIndicator(self)
|
||||||
self.indicator.setAnimationDelay(70)
|
self.indicator.setAnimationDelay(70)
|
||||||
@ -75,5 +76,7 @@ class ImportTask(QtWidgets.QDialog):
|
|||||||
def task_text(self):
|
def task_text(self):
|
||||||
return self.line_edit.text()
|
return self.line_edit.text()
|
||||||
|
|
||||||
def reset_task_text(self):
|
def showEvent(self, _):
|
||||||
self.line_edit.setText("")
|
self.line_edit.setText("")
|
||||||
|
self.raise_()
|
||||||
|
self.activateWindow()
|
||||||
|
@ -116,7 +116,7 @@ class App:
|
|||||||
self.menu.addSeparator()
|
self.menu.addSeparator()
|
||||||
|
|
||||||
new_action = self.menu.addAction("Import Jira task")
|
new_action = self.menu.addAction("Import Jira task")
|
||||||
new_action.triggered.connect(self.new_task_slot)
|
new_action.triggered.connect(self.import_task.show)
|
||||||
|
|
||||||
edit_action = self.menu.addAction("Edit tasks")
|
edit_action = self.menu.addAction("Edit tasks")
|
||||||
edit_action.triggered.connect(self.edit_tasks)
|
edit_action.triggered.connect(self.edit_tasks)
|
||||||
@ -148,11 +148,6 @@ class App:
|
|||||||
else:
|
else:
|
||||||
self.app.exec_()
|
self.app.exec_()
|
||||||
|
|
||||||
@QtCore.Slot()
|
|
||||||
def new_task_slot(self):
|
|
||||||
self.import_task.reset_task_text()
|
|
||||||
self.import_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
|
||||||
|
@ -83,7 +83,7 @@ class ReportDialog(QtWidgets.QDialog):
|
|||||||
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"))
|
||||||
self.ok_button.pressed.connect(self._accept)
|
self.ok_button.pressed.connect(self._accept)
|
||||||
self.ok_button.setAutoDefault(False)
|
self.ok_button.setAutoDefault(True)
|
||||||
|
|
||||||
blayout = QtWidgets.QHBoxLayout()
|
blayout = QtWidgets.QHBoxLayout()
|
||||||
blayout.addWidget(self.previous_button)
|
blayout.addWidget(self.previous_button)
|
||||||
@ -102,6 +102,8 @@ class ReportDialog(QtWidgets.QDialog):
|
|||||||
self.update_title()
|
self.update_title()
|
||||||
self.refresh_table()
|
self.refresh_table()
|
||||||
self.update_prev_next()
|
self.update_prev_next()
|
||||||
|
self.raise_()
|
||||||
|
self.activateWindow()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
self._report.save(self._report_data)
|
self._report.save(self._report_data)
|
||||||
|
@ -85,3 +85,7 @@ class TaskEdit(QtWidgets.QDialog):
|
|||||||
@tasks.setter
|
@tasks.setter
|
||||||
def tasks(self, tasks):
|
def tasks(self, tasks):
|
||||||
self.list.setStringList(tasks)
|
self.list.setStringList(tasks)
|
||||||
|
|
||||||
|
def showEvent(self, _):
|
||||||
|
self.raise_()
|
||||||
|
self.activateWindow()
|
||||||
|
@ -6,7 +6,7 @@ from fime.config import Config
|
|||||||
from fime.data import Worklog, duration_to_str
|
from fime.data import Worklog, duration_to_str
|
||||||
from fime.progressindicator import ProgressIndicator
|
from fime.progressindicator import ProgressIndicator
|
||||||
from fime.task_completer import TaskCompleter
|
from fime.task_completer import TaskCompleter
|
||||||
from fime.util import get_icon, EditStartedDetector, Status
|
from fime.util import get_icon, EditStartedDetector, Status, get_screen_height, get_screen_width
|
||||||
from fime.worklog_rest import WorklogRest
|
from fime.worklog_rest import WorklogRest
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -14,8 +14,6 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
from PySide2 import QtCore, QtGui, QtWidgets
|
from PySide2 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
from fime.util import get_screen_width
|
|
||||||
|
|
||||||
|
|
||||||
class WorklogDialog(QtWidgets.QDialog):
|
class WorklogDialog(QtWidgets.QDialog):
|
||||||
class TabTable(QtWidgets.QTableWidget):
|
class TabTable(QtWidgets.QTableWidget):
|
||||||
@ -158,7 +156,7 @@ class WorklogDialog(QtWidgets.QDialog):
|
|||||||
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"))
|
||||||
self.ok_button.pressed.connect(self._accept)
|
self.ok_button.pressed.connect(self._accept)
|
||||||
self.ok_button.setAutoDefault(False)
|
self.ok_button.setAutoDefault(True)
|
||||||
|
|
||||||
alayout = QtWidgets.QHBoxLayout()
|
alayout = QtWidgets.QHBoxLayout()
|
||||||
alayout.addWidget(self.previous_button)
|
alayout.addWidget(self.previous_button)
|
||||||
@ -182,6 +180,8 @@ class WorklogDialog(QtWidgets.QDialog):
|
|||||||
self._worklog.date = date.today()
|
self._worklog.date = date.today()
|
||||||
self.update_all()
|
self.update_all()
|
||||||
self.upload_button.setEnabled(False)
|
self.upload_button.setEnabled(False)
|
||||||
|
self.raise_()
|
||||||
|
self.activateWindow()
|
||||||
|
|
||||||
def update_all(self):
|
def update_all(self):
|
||||||
self.refresh_table()
|
self.refresh_table()
|
||||||
@ -253,6 +253,10 @@ class WorklogDialog(QtWidgets.QDialog):
|
|||||||
self.tableWidget.setColumnWidth(0, self.tableWidget.columnWidth(0) + self.row_height)
|
self.tableWidget.setColumnWidth(0, self.tableWidget.columnWidth(0) + self.row_height)
|
||||||
desired_width = self.tableWidget.columnWidth(0) + self.tableWidget.columnWidth(1) + self.tableWidget.columnWidth(2) + 4
|
desired_width = self.tableWidget.columnWidth(0) + self.tableWidget.columnWidth(1) + self.tableWidget.columnWidth(2) + 4
|
||||||
self.tableWidget.setMinimumWidth(min(desired_width, self.tableWidget.maximumWidth()))
|
self.tableWidget.setMinimumWidth(min(desired_width, self.tableWidget.maximumWidth()))
|
||||||
|
if self.tableWidget.rowCount() > 4:
|
||||||
|
desired_height = self.tableWidget.rowCount() * self.tableWidget.rowHeight(0) \
|
||||||
|
+ self.tableWidget.horizontalHeader().height() + 4
|
||||||
|
self.tableWidget.setMinimumHeight(min(desired_height, get_screen_height(self.tableWidget) * 0.8))
|
||||||
self.adjustSize()
|
self.adjustSize()
|
||||||
|
|
||||||
@QtCore.Slot(int)
|
@QtCore.Slot(int)
|
||||||
|
Loading…
Reference in New Issue
Block a user