mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Code cleanup
This commit is contained in:
parent
b35cdbd7b4
commit
485b4c3c6c
@ -1,13 +1,15 @@
|
||||
# -*- coding: cp1252 -*-
|
||||
import config
|
||||
import paths
|
||||
""" Lightweigth module that saves session position across global config and performs validation of config files. """
|
||||
import os
|
||||
import logging
|
||||
import config
|
||||
import paths
|
||||
log = logging.getLogger("sessionmanager.manager")
|
||||
from sessions import session_exceptions
|
||||
|
||||
manager = None
|
||||
def setup():
|
||||
""" Creates the singleton instance used within TWBlue to access this object. """
|
||||
global manager
|
||||
if not manager:
|
||||
manager = sessionManager()
|
||||
@ -15,12 +17,16 @@ def setup():
|
||||
class sessionManager(object):
|
||||
|
||||
def get_current_session(self):
|
||||
""" Returns the currently focused session, if valid. """
|
||||
if self.is_valid(config.app["sessions"]["current_session"]):
|
||||
return config.app["sessions"]["current_session"]
|
||||
else:
|
||||
return False
|
||||
|
||||
def add_session(self, id):
|
||||
""" Adds a new session to the global config, so it will be taken into account for all operations.
|
||||
|
||||
:param id: Session identified.
|
||||
:param id: str.
|
||||
"""
|
||||
log.debug("Adding a new session: %s" % (id,))
|
||||
path = os.path.join(paths.config_path(), id)
|
||||
if not os.path.exists(path):
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" Module to perform session actions such as adddition, removal or display of the global settings dialogue. """
|
||||
""" Module to perform session actions such as addition, removal or display of the global settings dialogue. """
|
||||
import shutil
|
||||
import time
|
||||
import os
|
||||
|
Loading…
Reference in New Issue
Block a user