Compare commits

..

No commits in common. "b54cd0d1df0f678f948f081ee1fccce42aa277df" and "5753624065993cd7d82529094c03faf81efae71f" have entirely different histories.

5 changed files with 17 additions and 11 deletions

View File

@ -29,7 +29,7 @@ jira_url = https://jira.company.com
jira_token = aBc1D34
```
The `jira_token` is a Personal Access Token. See [here](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html) on how to get one.
The `jira_token` is a Personal Access Token. See [here](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.htmlh) on how to get one.
## License

View File

@ -19,8 +19,8 @@ def dequotify(string):
class Config:
def __init__(self):
self._configparser = ConfigParser()
config_dir_path = Path(QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.AppConfigLocation))
config_path = config_dir_path / "fime.conf"
config_dir_path = Path(QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.ConfigLocation))
config_path = config_dir_path / "fime" / "fime.conf"
if config_path.exists():
print(f'Reading config file "{config_path}"')
with open(config_path) as f:

View File

@ -12,6 +12,12 @@ try:
except ImportError:
from PySide2 import QtCore
data_dir_path = os.path.join(QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.AppDataLocation),
"fime")
tasks_path = os.path.join(data_dir_path, "tasks.json")
data_path = os.path.join(data_dir_path, "data_{}.json")
save_delay = 3 * 60
max_jira_tasks = 50
@ -78,8 +84,6 @@ class Tasks:
class Data(MutableMapping):
def __init__(self):
data_dir_path = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.AppDataLocation)
self.data_path = os.path.join(data_dir_path, "data_{}.json")
if not os.path.exists(data_dir_path):
os.mkdir(data_dir_path)
self._cache = {}
@ -97,7 +101,7 @@ class Data(MutableMapping):
atexit.register(cleanup)
def __getitem__(self, key):
dpath = self.data_path.format(key)
dpath = data_path.format(key)
if key not in self._cache and os.path.exists(dpath):
with open(dpath, "r") as f:
self._cache[key] = json.loads(f.read())
@ -124,7 +128,7 @@ class Data(MutableMapping):
for key in self._hot_keys:
print(f"... saving dict {key} ...")
to_write = self._cache[key] # apparently thread-safe
with open(self.data_path.format(key), "w+") as f:
with open(data_path.format(key), "w+") as f:
f.write(json.dumps(to_write))
self._hot_keys = set()
self._saving = False

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
import signal
import sys
from functools import partial
@ -131,7 +132,7 @@ class App:
self.app.quit()
def run(self):
timer = QtCore.QTimer(None)
timer = QtCore.QTimer()
# interrupt event loop regularly for signal handling
timer.timeout.connect(lambda: None)
timer.start(500)
@ -160,8 +161,6 @@ class App:
def main():
try:
# important for QStandardPath to be correct
QtCore.QCoreApplication.setApplicationName("fime")
app = App()
app.run()
except FimeException as e:

View File

@ -27,6 +27,9 @@ class EditStartedDetector(QtWidgets.QStyledItemDelegate):
def createEditor(self, parent, option, index):
editor = super().createEditor(parent, option, index)
editor.editingFinished.connect(self.editFinished)
self.editStarted.emit()
return editor
def setModelData(self, editor, model, index):
super().setModelData(editor, model, index)
self.editFinished.emit()