Compare commits

..

2 Commits

Author SHA1 Message Date
Sergio Martínez Portela
2196c13b14 Try to find a reasonable size when starting application. 2021-04-03 01:47:58 +02:00
Sergio Martínez Portela
f3e1573677 Minor cleanup in document loader. 2021-04-03 01:47:33 +02:00
2 changed files with 11 additions and 5 deletions

View File

@ -5,8 +5,9 @@ from datetime import datetime
from typing import List from typing import List
import org_rw import org_rw
from org_rw import OrgTime from org_rw import OrgTime, OrgDoc
EXTENSIONS = ( ".org", ".org.txt" )
def is_today(ot: OrgTime): def is_today(ot: OrgTime):
now = datetime.now() now = datetime.now()
@ -37,17 +38,19 @@ class Agenda:
class DocumentManager: class DocumentManager:
def __init__(self, basepath): docs: list[OrgDoc]
self.basepath = basepath
def __init__(self, base_path: os.PathLike):
self.base_path = base_path
def load(self): def load(self):
top = os.path.abspath(self.basepath) top = os.path.abspath(self.base_path)
docs = [] docs = []
for root, dirs, files in os.walk(top): for root, dirs, files in os.walk(top):
for name in files: for name in files:
if ".org" not in name: if all(map(lambda ext: not name.endswith(ext), EXTENSIONS)):
continue continue
path = os.path.join(root, name) path = os.path.join(root, name)

View File

@ -33,6 +33,9 @@ class Dialog(QDialog):
super(Dialog, self).__init__() super(Dialog, self).__init__()
self.setWindowTitle("OrgEditor") self.setWindowTitle("OrgEditor")
scrSize = self.screen().size()
self.resize(scrSize.width() / 1.5,
scrSize.height() / 1.5)
self.loader = None self.loader = None
self.manager = doc_manager.DocumentManager(DOCS_PATH) self.manager = doc_manager.DocumentManager(DOCS_PATH)