Created a sorted list class

This commit is contained in:
bjschuma 2010-02-24 19:16:57 -05:00
parent acdcca152e
commit f1172d85d0
8 changed files with 29 additions and 19 deletions

View File

@ -1,9 +0,0 @@
#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Feb 22, 2010 10:52:13 PM$"

View File

@ -26,7 +26,7 @@ def add(script):
def runScript(script):
# Run commands if the script is not a python script
if re.match("\w*\.py",script) == None:
if re.match("(\/|\w)*\.py",script) == None:
from bt import cmd
f = file.fopen(script)
for line in f:
@ -34,6 +34,7 @@ def runScript(script):
f.close()
# Execute the script with the python interpreter as a backend
else:
write("Running python script: "+script,2)
execfile(script)
@ -65,7 +66,7 @@ def isScript(script):
global scripts
write("Checking if file is a script: "+script,2)
for ext in extension:
if not re.match("\w*\."+ext,script) == None:
if not re.match("(\/|\w)*\."+ext,script) == None:
scripts += [script]

15
src/core/bt/slist.py Normal file
View File

@ -0,0 +1,15 @@
__author__="bjschuma"
__date__ ="$Feb 22, 2010 10:52:13 PM$"
# This is a sorted list (as long as items are inserted with add() )
class slist(list):
def __init__(self):
list.__init__(self)
def add(self,item):
self += [item]
self.sort()

View File

@ -16,16 +16,9 @@ class Plugin(plugin.Plugin):
self.usage = "exec [command, file file.py]"
def open(self):
pass
def close(self):
pass
def run(self, args=None):
if args==None:
write(self.usage)
return
join = ' '

4
src/tests/test.py Normal file
View File

@ -0,0 +1,4 @@
print "hello,world"
import session
from bt.message import write
write(session.settings)

3
src/tests/test.scion Normal file
View File

@ -0,0 +1,3 @@
echo success!
echo I love you, Holly!
echo echo test!

2
src/tests/test2.scion Normal file
View File

@ -0,0 +1,2 @@
echo this is a script
echo 42

1
src/tests/test3.scion Normal file
View File

@ -0,0 +1 @@
exec file tests/test.py