From 0838598f3d24e1f81c039b8a2af1557979bee14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gu=C3=A9gan?= Date: Tue, 17 Sep 2024 10:35:33 +0200 Subject: [PATCH] Minor changes --- tropical/db.py | 5 ++--- tropical/env.py | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tropical/db.py b/tropical/db.py index 15e083b..431fce8 100644 --- a/tropical/db.py +++ b/tropical/db.py @@ -1,6 +1,5 @@ import sqlite3, time, socket - class CalDB: __DBVERSION__="1" @@ -21,9 +20,9 @@ class CalDB: self.cur.execute('INSERT INTO infos VALUES("creation", "'+str(time.time())+'")') self.cur.execute('INSERT INTO infos VALUES("created_on", "'+socket.gethostname()+'")') # Calendars table - self.cur.execute("CREATE TABLE calendars(id INTEGER PRIMARY KEY, name TEXT, description TEXT, color TEXT)") + self.cur.execute("CREATE TABLE calendars(id INTEGER PRIMARY KEY, name TEXT, description TEXT, color TEXT, type INTEGER)") # Events table - self.cur.execute("CREATE TABLE events(id INTEGER PRIMARY KEY, name TEXT, calendar INTEGER, description TEXT, start REAL, end REAL, repeat TEXT, frequency INTEGER, FOREIGN KEY(calendar) REFERENCES calendars(id))") + self.cur.execute("CREATE TABLE events(id INTEGER PRIMARY KEY, name TEXT, calendar INTEGER, description TEXT, start REAL, end REAL, repeat INTEGER, frequency INTEGER, location INTEGER, FOREIGN KEY(calendar) REFERENCES calendars(id))") self.con.commit() def keyExists(self, db, key): diff --git a/tropical/env.py b/tropical/env.py index 3c2bc3b..e2484fd 100644 --- a/tropical/env.py +++ b/tropical/env.py @@ -1,8 +1,24 @@ - from pathlib import Path from db import CalDB import configparser +from enum import Enum + +class EvtRepeat(Enum): + DAYLY = 1 + WEEKLY = 2 + MONTHLY = 3 + YEARLY = 4 + +class EvtLocation(Enum): + LOCAL = 1 + REMOTE = 2 + LOCAL_AND_REMOTE = 3 + +class CalType(Enum): + TROPICAL = 1 + CALDAV = 2 + class Env: