Compare commits

..

No commits in common. "36e644a736c25f8819e1237a77e36df7c9e876a9" and "5b2253ae72db06c62f65f6bb03d08496b6b3bb94" have entirely different histories.

10 changed files with 23 additions and 52 deletions

View File

@ -15,7 +15,7 @@ classifiers =
package_dir = package_dir =
= src = src
packages = find: packages = find:
python_requires = >=3.8 python_requires = >=3.6
install_requires = install_requires =
requests requests
requests-futures requests-futures

View File

@ -1,10 +1,7 @@
from configparser import ConfigParser from configparser import ConfigParser
from pathlib import Path from pathlib import Path
try: from PySide2 import QtCore
from PySide6 import QtCore
except ImportError:
from PySide2 import QtCore
from fime.exceptions import FimeException from fime.exceptions import FimeException

View File

@ -7,10 +7,7 @@ from datetime import datetime, date, timedelta
from threading import Thread, Event from threading import Thread, Event
from typing import List from typing import List
try: from PySide2 import QtCore
from PySide6 import QtCore
except ImportError:
from PySide2 import QtCore
data_dir_path = os.path.join(QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.AppDataLocation), data_dir_path = os.path.join(QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.AppDataLocation),
"fime") "fime")

View File

@ -3,10 +3,7 @@
# Created by: The Resource Compiler for Qt version 5.15.2 # Created by: The Resource Compiler for Qt version 5.15.2
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
try: from PySide2 import QtCore
from PySide6 import QtCore
except ImportError:
from PySide2 import QtCore
qt_resource_data = b"\ qt_resource_data = b"\
\x00\x00\x02\xdd\ \x00\x00\x02\xdd\

View File

@ -1,7 +1,4 @@
try: from PySide2 import QtGui, QtWidgets
from PySide6 import QtGui, QtWidgets
except ImportError:
from PySide2 import QtGui, QtWidgets
from fime.task_completer import TaskCompleter from fime.task_completer import TaskCompleter
from fime.util import get_icon from fime.util import get_icon

View File

@ -4,12 +4,8 @@ import signal
import sys import sys
from functools import partial from functools import partial
try: from PySide2 import QtCore, QtWidgets
from PySide6 import QtCore, QtWidgets from PySide2.QtWidgets import QMessageBox
PYSIDE_6 = True
except ImportError:
from PySide2 import QtCore, QtWidgets
PYSIDE_6 = False
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
import fime.icons import fime.icons
@ -24,7 +20,6 @@ from fime.util import get_screen_height, get_icon
class App: class App:
def __init__(self): def __init__(self):
self.app = QtWidgets.QApplication(sys.argv) self.app = QtWidgets.QApplication(sys.argv)
self.app.setQuitOnLastWindowClosed(False)
data = Data() data = Data()
self.tasks = Tasks(data) self.tasks = Tasks(data)
@ -33,7 +28,7 @@ class App:
icon = get_icon("appointment-new") icon = get_icon("appointment-new")
self.menu = QtWidgets.QMenu(None) self.menu = QtWidgets.QMenu()
self.import_task = ImportTask(None) self.import_task = ImportTask(None)
self.import_task.accepted.connect(self.new_task_imported) self.import_task.accepted.connect(self.new_task_imported)
@ -121,8 +116,7 @@ class App:
exit_action = self.menu.addAction("Close") exit_action = self.menu.addAction("Close")
exit_action.triggered.connect(self.app.quit) exit_action.triggered.connect(self.app.quit)
def sigterm_handler(self, signo, _frame): def sigterm_handler(self, _signo, _frame):
print(f'handling signal "{signal.strsignal(signo)}"')
self.app.quit() self.app.quit()
def run(self): def run(self):
@ -132,10 +126,7 @@ class App:
timer.start(500) timer.start(500)
signal.signal(signal.SIGTERM, self.sigterm_handler) signal.signal(signal.SIGTERM, self.sigterm_handler)
signal.signal(signal.SIGINT, self.sigterm_handler) signal.signal(signal.SIGINT, self.sigterm_handler)
if PYSIDE_6: self.app.exec_()
self.app.exec()
else:
self.app.exec_()
@QtCore.Slot() @QtCore.Slot()
def report(self): def report(self):
@ -158,7 +149,7 @@ def main():
app = App() app = App()
app.run() app.run()
except FimeException as e: except FimeException as e:
QtWidgets.QMessageBox.critical(None, "Error", str(e), QtWidgets.QMessageBox.Ok) QMessageBox.critical(None, "Error", str(e), QMessageBox.Ok)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1,10 +1,9 @@
try: from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets
from datetime import datetime from datetime import datetime
from PySide2.QtWidgets import QHeaderView
from fime.data import Tasks from fime.data import Tasks
from fime.util import get_screen_height, get_icon from fime.util import get_screen_height, get_icon
@ -42,9 +41,9 @@ class Report(QtWidgets.QDialog):
self.tableWidget.setItemDelegateForColumn(0, Report.TaskItemCompleter(self._tasks, self)) self.tableWidget.setItemDelegateForColumn(0, Report.TaskItemCompleter(self._tasks, self))
self.header = QtWidgets.QHeaderView(QtCore.Qt.Orientation.Horizontal) self.header = QtWidgets.QHeaderView(QtCore.Qt.Orientation.Horizontal)
self.header.setMinimumSectionSize(1) self.header.setMinimumSectionSize(1)
self.header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) self.header.setSectionResizeMode(QHeaderView.ResizeToContents)
self.tableWidget.setHorizontalHeader(self.header) self.tableWidget.setHorizontalHeader(self.header)
self.header.setSectionResizeMode(self.header.logicalIndex(0), QtWidgets.QHeaderView.Stretch) self.header.setSectionResizeMode(self.header.logicalIndex(0), QHeaderView.Stretch)
self.previous_button = QtWidgets.QPushButton() self.previous_button = QtWidgets.QPushButton()
self.previous_button.setText("Previous") self.previous_button.setText("Previous")

View File

@ -5,16 +5,15 @@ from functools import reduce
from queue import Queue, Empty from queue import Queue, Empty
from urllib.parse import urlparse, parse_qs from urllib.parse import urlparse, parse_qs
try: from PySide2 import QtCore
from PySide6 import QtCore, QtWidgets from PySide2.QtCore import QTimer
except ImportError: from PySide2.QtWidgets import QCompleter
from PySide2 import QtCore, QtWidgets
from requests_futures.sessions import FuturesSession from requests_futures.sessions import FuturesSession
from fime.config import Config from fime.config import Config
class TaskCompleter(QtWidgets.QCompleter): class TaskCompleter(QCompleter):
def __init__(self, parent=None, *args, **kwargs): def __init__(self, parent=None, *args, **kwargs):
super().__init__([], parent, *args, **kwargs) super().__init__([], parent, *args, **kwargs)
self.setFilterMode(QtCore.Qt.MatchFlag.MatchContains) self.setFilterMode(QtCore.Qt.MatchFlag.MatchContains)
@ -27,7 +26,7 @@ class TaskCompleter(QtWidgets.QCompleter):
self.response_text = "" self.response_text = ""
self.model_data = set() self.model_data = set()
self.escalate = False self.escalate = False
self.update_timer = QtCore.QTimer(self) self.update_timer = QTimer(self)
self.update_timer.timeout.connect(self.process_response) self.update_timer.timeout.connect(self.process_response)
self.update_timer.setInterval(250) self.update_timer.setInterval(250)
self.queue = Queue() self.queue = Queue()

View File

@ -1,7 +1,4 @@
try: from PySide2 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets
except ImportError:
from PySide2 import QtCore, QtGui, QtWidgets
from fime.util import get_icon from fime.util import get_icon

View File

@ -1,7 +1,4 @@
try: from PySide2 import QtGui
from PySide6 import QtGui
except ImportError:
from PySide2 import QtGui
def get_screen_height(qobject): def get_screen_height(qobject):