Minor changes

This commit is contained in:
Loïc Guégan 2024-09-17 10:35:33 +02:00
parent 277ed8637d
commit 0838598f3d
2 changed files with 19 additions and 4 deletions

View file

@ -1,6 +1,5 @@
import sqlite3, time, socket import sqlite3, time, socket
class CalDB: class CalDB:
__DBVERSION__="1" __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("creation", "'+str(time.time())+'")')
self.cur.execute('INSERT INTO infos VALUES("created_on", "'+socket.gethostname()+'")') self.cur.execute('INSERT INTO infos VALUES("created_on", "'+socket.gethostname()+'")')
# Calendars table # 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 # 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() self.con.commit()
def keyExists(self, db, key): def keyExists(self, db, key):

View file

@ -1,8 +1,24 @@
from pathlib import Path from pathlib import Path
from db import CalDB from db import CalDB
import configparser 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: class Env: