Prevent disable and enable from ever being disabled

This commit is contained in:
bjschuma 2009-12-20 01:16:20 -05:00
parent ea31ada3ce
commit a61f7688cc
7 changed files with 94 additions and 4 deletions

View File

@ -83,7 +83,10 @@ class Manager:
def run(self,name,args=None):
self.enabled[name].run(args)
name = name.strip()
if (name in self.enabled)==True:
self.enabled[name].run(args)
global manager

4
src/clean.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
rm -r ./*/*.pyc
rm -r ./*/*/*.pyc

View File

@ -18,7 +18,7 @@ def addch(input):
c = stdscr.getch()
if c == 10:
enter(input)
input = enter(input)
elif c == 127:
input = backspace(input)
@ -42,4 +42,5 @@ def backspace(input):
# Attempt to run a command
def enter(input):
run(input)
input = run(input)
return input

View File

@ -11,9 +11,11 @@ from manager import manager
# Check for valid input
def run(input):
prompt = input[0:4]
input = input[4:]
split = input.split()
split = input.strip().split()
if len(split)>1:
manager.run(split[0],split[1:])
else:
manager.run(input)
return prompt

39
src/core/disable.py Normal file
View File

@ -0,0 +1,39 @@
#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Dec 20, 2009 12:52:29 AM$"
global name, app, type, path, opt
name = "disable"
app = "scion"
type = "core"
path = ""
opt = []
from manager import manager
# Called every time the plugin is enabled
def open():
pass
# Called every time the plugin is stopped
def close():
# Run this to prevent disable from ever being disabled
manager.run("enable",("disable"))
pass
# Called when the plugin needs to perform some action
def run(args=None):
if args == None:
return
for plugin in args:
manager.disablePlugin(plugin)

38
src/core/enable.py Normal file
View File

@ -0,0 +1,38 @@
#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Dec 20, 2009 12:54:32 AM$"
global name, app, type, path, opt
name = "enable"
app = "scion"
type = "core"
path = ""
opt = []
from manager import manager
# Called every time the plugin is enabled
def open():
pass
# Called every time the plugin is stopped
def close():
# Prevent enable from ever being disabled
manager.enablePlugin("enable")
pass
# Called when the plugin needs to perform some action
def run(args=None):
if args == None:
return
for plugin in args:
manager.enablePlugin(plugin)

View File

@ -30,5 +30,8 @@ def close():
# Called when the plugin needs to perform some action
def run(args=None):
if args == None:
return
for plugin in args:
manager.reloadPlugin(plugin)