2010-01-24 21:29:02 -05:00
|
|
|
#! /usr/bin/python
|
|
|
|
|
|
|
|
# To change this template, choose Tools | Templates
|
|
|
|
# and open the template in the editor.
|
|
|
|
|
|
|
|
__author__="bjschuma"
|
|
|
|
__date__ ="$Jan 23, 2010 2:33:21 PM$"
|
|
|
|
|
2010-02-20 15:37:09 -05:00
|
|
|
from bt.file import *
|
|
|
|
from bt import signal
|
2010-02-21 21:50:02 -05:00
|
|
|
#import session
|
2010-01-24 21:29:02 -05:00
|
|
|
|
|
|
|
|
2010-02-20 15:37:09 -05:00
|
|
|
class Alias(dict):
|
|
|
|
def __init__(self):
|
|
|
|
dict.__init__(self)
|
2010-02-21 21:50:02 -05:00
|
|
|
signal.register("scion-plugins-loaded",self.load,3)
|
|
|
|
signal.register("scion-end",self.save,90)
|
2010-01-24 21:29:02 -05:00
|
|
|
|
|
|
|
|
2010-02-20 15:37:09 -05:00
|
|
|
def has(self,key):
|
|
|
|
return ( key in self.keys() )
|
2010-01-24 21:29:02 -05:00
|
|
|
|
|
|
|
|
2010-02-21 21:50:02 -05:00
|
|
|
def save(self):
|
|
|
|
import session
|
|
|
|
write("Saving aliases",1)
|
|
|
|
file = fopen( join(session.settings["session"],"aliases"), 'w' )
|
2010-02-20 15:37:09 -05:00
|
|
|
sp = " "
|
|
|
|
for key in self.keys():
|
|
|
|
file.write("alias "+key+"="+self[key]+"\n")
|
2010-01-24 21:29:02 -05:00
|
|
|
|
|
|
|
|
2010-02-21 21:50:02 -05:00
|
|
|
def load(self):
|
|
|
|
import session
|
|
|
|
path = join(session.settings["session"],"aliases")
|
2010-02-20 15:37:09 -05:00
|
|
|
write("Alias file: "+path,1)
|
|
|
|
signal.attachScript("scion-plugins-loaded", path )
|