50 lines
930 B
Python
50 lines
930 B
Python
#! /usr/bin/python
|
|
|
|
# To change this template, choose Tools | Templates
|
|
# and open the template in the editor.
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Feb 17, 2010 9:18:50 PM$"
|
|
|
|
|
|
from bt.settings import Settings
|
|
from bt.file import *
|
|
from bt.message import write
|
|
from bt import signal
|
|
from manager import Manager
|
|
|
|
global settings
|
|
global manager
|
|
|
|
|
|
def getSession():
|
|
path = settings["appdir"]
|
|
mkdir(path)
|
|
path = join(path,"session")
|
|
mkdir(path)
|
|
return path
|
|
|
|
|
|
def restore():
|
|
write("Restoring session",1)
|
|
path = getSession()
|
|
write(path,2)
|
|
settings.load(path)
|
|
enabled = fopen( join(path,"enabled") )
|
|
if not enabled == None:
|
|
for line in enabled:
|
|
manager.enablePlugin(line.strip())
|
|
|
|
|
|
def save():
|
|
write("Saving session")
|
|
|
|
|
|
|
|
settings = Settings()
|
|
manager = Manager()
|
|
# We want to restore settings as early as possible
|
|
settings.setdefaults()
|
|
|
|
signal.register("scion-plugins-loaded",restore,0)
|
|
signal.register("scion-end",save,0) |