def __init__(self): logger.info("Lucidity initialized. Hello there!") self.mainDelegate = MainDelegate() self.mainDelegate.mainApp = self self.sequence = Sequence() self.settings = Settings(PathFinder.findUserFile('settings.db')) self.mediaRequestLoop = MediaRequestLoop(PathFinder.findUserFile('media.db')) self.midiEventLoop = MidiEventLoop(self.mainDelegate) self.statusLoop = StatusLoop() self.systemUsageLoop = SystemUsageLoop() self.mainWindow = None
def __init__(self, delegate, pollIntervalInMs = 25): Thread.__init__(self, name = "MidiEventLoop") self._lock = Lock() self._isRunning = False self.delegate = delegate self._pollInterval = pollIntervalInMs / 1000 self.devices = None self.midiMappings = MidiMappingTable(PathFinder.findUserFile('midimappings.sql'))
def __init__(self, name:str, interval:int): self.name = name skinPath = PathFinder.findSkin(name) self.images = self._loadImages(skinPath) self._guiColors = self._loadColors(skinPath, "GuiColors.txt") self._palette = self._loadColors(skinPath, "Palette.txt") self._fonts = self._loadFonts(skinPath, "Fonts.txt") self.interval = interval
def _readLinesFromText(self): result = [] linesFile = open(PathFinder.findResource("text", "Obtuse.txt"), 'r') for line in linesFile: result.append(line.strip()) linesFile.close() return result
class StatusHandler(logging.Handler, StatusProvider): def __init__(self, level=logging.DEBUG): logging.Handler.__init__(self, level) self.lastMessage = "" def handle(self, record): self.lastMessage = record.getMessage() def getStatusString(self): return self.lastMessage logger = logging.getLogger("lucidity") logger.setLevel(logging.DEBUG) _consoleHandler = logging.StreamHandler() _consoleHandler.setLevel(logging.DEBUG) _fileHandler = logging.FileHandler(PathFinder.findUserFile("log.txt"), mode="w") _fileHandler.setLevel(logging.DEBUG) _logFormat = logging.Formatter("%(relativeCreated)d: %(threadName)s: %(levelname)s: %(message)s") _consoleHandler.setFormatter(_logFormat) _fileHandler.setFormatter(_logFormat) logger.addHandler(_consoleHandler) logger.addHandler(_fileHandler) statusHandler = StatusHandler() logger.addHandler(statusHandler)
def __init__(self, databaseLocation): self._filesColumns = {} schemaFileLocation = PathFinder.findSchemaFile("media.sql") self._database = Sqlite3Database(databaseLocation, schemaFileLocation) self.locations = self._loadLocationsFromDatabase() self.mediaFiles = self._loadFilesFromDatabase()
def __init__(self, absolutePath): self.absolutePath = absolutePath schemaLocation = PathFinder.findSchemaFile("midimappings.sql") self._database = Sqlite3Database(absolutePath, schemaLocation) self.mappingTable = self.loadMappings(self._database)
def __init__(self, absolutePath): self.absolutePath = absolutePath schemaLocation = PathFinder.findSchemaFile("settings.sql") self._database = Sqlite3Database(absolutePath, schemaLocation) self._settingsKeys = self._readSettings(self._database)