Made a plugin for listing the values of settings
This commit is contained in:
parent
27bcf9f341
commit
18873e6e75
|
@ -132,16 +132,12 @@ class Manager:
|
|||
# By an earlier call to restore session
|
||||
for key in self.enabled.keys():
|
||||
if (key in self.restored) == False:
|
||||
write(0)
|
||||
self.disablePlugin(key)
|
||||
for key in self.disabled.keys():
|
||||
if (key in self.restored) == True:
|
||||
write(1)
|
||||
self.enablePlugin(key)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
global manager
|
||||
manager = Manager()
|
|
@ -32,8 +32,8 @@ def addch(input):
|
|||
|
||||
# Remove the last character in input
|
||||
def backspace(input):
|
||||
stdscr = settings.get("stdscr")
|
||||
stdscr.deleteln()
|
||||
#stdscr = settings.get("stdscr")
|
||||
#stdscr.deleteln()
|
||||
l = len(input)
|
||||
if(l>4):
|
||||
return input[:l-1]
|
||||
|
|
|
@ -28,7 +28,7 @@ def init():
|
|||
curses.cbreak()
|
||||
curses.noecho()
|
||||
stdscr.keypad(1)
|
||||
curses.halfdelay(100)
|
||||
curses.halfdelay(10)
|
||||
|
||||
# Set these values in settings class for use elsewhere
|
||||
settings.set("stdscr", stdscr)
|
||||
|
@ -75,7 +75,7 @@ def loop():
|
|||
|
||||
stdscr = settings.get("stdscr")
|
||||
input = settings.get("prompt")
|
||||
(y, x) = settings.get("stdscr").getyx()
|
||||
#(y, x) = settings.get("stdscr").getyx()
|
||||
disp(input)
|
||||
|
||||
while halt == False:
|
||||
|
|
|
@ -19,6 +19,9 @@ def advance(y, maxy, stdscr):
|
|||
|
||||
stdscr.move(0,0)
|
||||
stdscr.deleteln()
|
||||
stdscr.move(y,0)
|
||||
space = " " * settings.get("maxyx")[1]
|
||||
stdscr.addstr(y,0,space)
|
||||
return y
|
||||
|
||||
|
||||
|
@ -44,11 +47,34 @@ def insert(string):
|
|||
|
||||
|
||||
# Replace the string on the current line
|
||||
def disp(string):
|
||||
def disp(string, y=-1):
|
||||
stdscr = settings.get("stdscr")
|
||||
if stdscr == None:
|
||||
return
|
||||
|
||||
move = None
|
||||
|
||||
if y == -1:
|
||||
y = settings.get("cliney")
|
||||
space = " " * ( len(string)+1 )
|
||||
stdscr.addstr(y, 0, space)
|
||||
else:
|
||||
stdscr.leaveok(True)
|
||||
move = stdscr.getyx()
|
||||
l = len(string)
|
||||
if l == 0:
|
||||
return
|
||||
space = " " * settings.get("maxyx")[0]
|
||||
stdscr.addstr(y, 0, space)
|
||||
|
||||
|
||||
|
||||
try:
|
||||
stdscr.addstr(settings.get("cliney"), 0, string)
|
||||
|
||||
stdscr.addstr(y, 0, string)
|
||||
except:
|
||||
bt.message.error("Error displaying string: "+string)
|
||||
|
||||
stdscr.leaveok(False)
|
||||
if move != None:
|
||||
stdscr.move( move[0], move[1] )
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# This is a simple test plugin, to make sure everything is working
|
||||
|
||||
__author__="bjschuma"
|
||||
__date__ ="$Jan 9, 2010 7:22:31 PM$"
|
||||
|
||||
|
||||
global name, app, type, path, opt
|
||||
name = "lsset"
|
||||
app = "scion"
|
||||
type = "extra"
|
||||
path = ""
|
||||
opt = []
|
||||
|
||||
from bt.message import write
|
||||
import settings
|
||||
|
||||
|
||||
# Called every time the plugin is enabled
|
||||
def open():
|
||||
pass
|
||||
|
||||
|
||||
# Called every time the plugin is stopped
|
||||
def close():
|
||||
pass
|
||||
|
||||
|
||||
# Called when the plugin needs to perform some action
|
||||
def run(args=None):
|
||||
keys = settings.settings.keys()
|
||||
join = ", "
|
||||
|
||||
if args == None:
|
||||
str = join.join(keys)
|
||||
write(str)
|
||||
else:
|
||||
if settings.has(args[0]) == True:
|
||||
write( settings.get(args[0], True) )
|
||||
|
Loading…
Reference in New Issue