The command line mostly works again!
This commit is contained in:
parent
6b7347464a
commit
e28bf46c60
|
@ -84,12 +84,13 @@ class Manager:
|
|||
def shutdown(self):
|
||||
emit("scion-end")
|
||||
write("Shutting down manager, disabling all active plugins", True)
|
||||
session = self.findsession()
|
||||
self.savesession(session)
|
||||
path = session.getSession()
|
||||
#session = self.findsession()
|
||||
self.savesession(path)
|
||||
keys = self.enabled.keys()
|
||||
for plugin in keys:
|
||||
self.disablePlugin(plugin)
|
||||
settings.save(session)
|
||||
#session.settings.save(path)
|
||||
|
||||
|
||||
def startup(self):
|
||||
|
|
|
@ -39,7 +39,7 @@ def main():
|
|||
|
||||
manager.manager.restoresession()
|
||||
manager.manager.startup()
|
||||
#emit("scion-begin")
|
||||
emit("scion-begin")
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from bt import plugin
|
|||
from bt import alias
|
||||
from bt.message import write
|
||||
from bt.file import *
|
||||
import settings
|
||||
from session import settings
|
||||
|
||||
|
||||
class Plugin(plugin.Plugin):
|
||||
|
@ -20,7 +20,7 @@ class Plugin(plugin.Plugin):
|
|||
|
||||
def getfile(self,flags='r'):
|
||||
#path = join( settings.get("user"), "."+settings.get("appname") )
|
||||
path = join(settings.get("appdir"), "aliases")
|
||||
path = join(settings["appdir"], "aliases")
|
||||
return fopen(path,flags)
|
||||
|
||||
|
||||
|
|
|
@ -8,20 +8,20 @@ __date__ ="$Dec 19, 2009 11:19:43 PM$"
|
|||
|
||||
|
||||
import curses
|
||||
import settings
|
||||
from session import settings
|
||||
from bt.message import write
|
||||
import message
|
||||
from run import run
|
||||
|
||||
# (Sometimes) add a character to the input string
|
||||
def addch(input):
|
||||
stdscr = settings.get("stdscr")
|
||||
stdscr = settings["stdscr"]
|
||||
c = stdscr.getch()
|
||||
|
||||
if(c >= 32 and c<= 126):
|
||||
input += curses.keyname(c)
|
||||
|
||||
keys = settings.get("keyinput")
|
||||
keys = settings["keyinput"]
|
||||
if (c in keys.keys()) == True:
|
||||
input = keys[c](input)
|
||||
#else:
|
||||
|
|
|
@ -23,7 +23,7 @@ def insert(input):
|
|||
return
|
||||
|
||||
hist += [input]
|
||||
if len(hist) > settings.get("maxhist"):
|
||||
if len(hist) > settings["maxhist"]:
|
||||
hist.pop(0)
|
||||
idx = len(hist)
|
||||
|
||||
|
@ -62,7 +62,7 @@ def prev(input):
|
|||
global hist,idx
|
||||
if idx > 0:
|
||||
idx -= 1
|
||||
return settings.get("prompt") + hist[idx]
|
||||
return settings["prompt"] + hist[idx]
|
||||
|
||||
|
||||
def next(input):
|
||||
|
@ -70,7 +70,7 @@ def next(input):
|
|||
|
||||
if idx < len(hist):
|
||||
idx += 1
|
||||
prompt = settings.get("prompt")
|
||||
prompt = settings["prompt"]
|
||||
|
||||
if idx == len(hist):
|
||||
return prompt
|
||||
|
|
|
@ -10,7 +10,7 @@ __date__ ="$Dec 19, 2009 9:39:37 PM$"
|
|||
from bt.message import write
|
||||
from bt.signal import *
|
||||
import manager
|
||||
import settings
|
||||
from session import settings
|
||||
|
||||
# Command line related imports
|
||||
from addch import addch
|
||||
|
@ -32,18 +32,20 @@ def init():
|
|||
curses.halfdelay(10)
|
||||
|
||||
# Set these values in settings class for use elsewhere
|
||||
settings.set("stdscr", stdscr)
|
||||
settings.set("maxyx", maxyx)
|
||||
if settings.has("prompt") == False:
|
||||
settings.set("prompt", ">>> ")
|
||||
else:
|
||||
settings.set("prompt",settings.get("prompt")+" ")
|
||||
settings["stdscr"] = stdscr
|
||||
settings["maxyx"] = maxyx
|
||||
#if settings.has("prompt") == False:
|
||||
# settings.set("prompt", ">>> ")
|
||||
settings.init("prompt",">>> ")
|
||||
#else:
|
||||
# settings.set("prompt",settings.get("prompt")+" ")
|
||||
|
||||
if settings.has("maxhist") == False:
|
||||
settings.set("maxhist",50)
|
||||
#if settings.has("maxhist") == False:
|
||||
# settings.set("maxhist",50)
|
||||
settings.init("maxhist",50)
|
||||
|
||||
settings.set("clinex", 0)
|
||||
settings.set("cliney", 0)
|
||||
settings["clinex"] = 0
|
||||
settings["cliney"] = 0
|
||||
register("message-write", insert,90)
|
||||
|
||||
|
||||
|
@ -60,15 +62,19 @@ def quit():
|
|||
# Undo ncurses initialization
|
||||
curses.nocbreak()
|
||||
curses.echo()
|
||||
settings.get("stdscr").keypad(0)
|
||||
settings["stdscr"].keypad(0)
|
||||
curses.endwin()
|
||||
|
||||
# Delete keys that settings no longer needs
|
||||
settings.delete("stdscr")
|
||||
settings.delete("maxyx")
|
||||
del settings["stdscr"]
|
||||
del settings["maxyx"]
|
||||
del settings["cliney"]
|
||||
del settings["clinex"]
|
||||
#settings.delete("stdscr")
|
||||
#settings.delete("maxyx")
|
||||
#settings.delete("prompt")
|
||||
settings.delete("clinex")
|
||||
settings.delete("cliney")
|
||||
#settings.delete("clinex")
|
||||
#settings.delete("cliney")
|
||||
#settings.delete("everyloop")
|
||||
|
||||
# Return to previous write function
|
||||
|
@ -86,8 +92,8 @@ def loop():
|
|||
|
||||
init()
|
||||
|
||||
stdscr = settings.get("stdscr")
|
||||
input = settings.get("prompt")
|
||||
stdscr = settings["stdscr"]
|
||||
input = settings["prompt"]
|
||||
write("Type \"help\" for a list of valid commands")
|
||||
disp(input)
|
||||
|
||||
|
|
|
@ -8,19 +8,19 @@ __date__ ="$Dec 19, 2009 11:57:19 PM$"
|
|||
|
||||
|
||||
import curses
|
||||
import settings
|
||||
from session import settings
|
||||
import bt.message
|
||||
import bt.signal
|
||||
|
||||
|
||||
def advance(y, maxy, stdscr):
|
||||
if y < (maxy-2):
|
||||
settings.set("cliney", y+1)
|
||||
settings["cliney"] = y+1
|
||||
return y+1
|
||||
stdscr.move(0,0)
|
||||
stdscr.deleteln()
|
||||
stdscr.move(y,0)
|
||||
space = " " * settings.get("maxyx")[1]
|
||||
space = " " * settings["maxyx"][1]
|
||||
stdscr.addstr(y,0,space)
|
||||
return y
|
||||
|
||||
|
@ -30,9 +30,9 @@ def insert(string):
|
|||
if len(string) == 0:
|
||||
return
|
||||
|
||||
stdscr = settings.get("stdscr")
|
||||
maxyx = settings.get("maxyx")
|
||||
y = settings.get("cliney")
|
||||
stdscr = settings["stdscr"]
|
||||
maxyx = settings["maxyx"]
|
||||
y = settings["cliney"]
|
||||
|
||||
if len(string) >= maxyx[1]:
|
||||
stdscr.addstr(y, 0, string[0:maxyx[1]])
|
||||
|
@ -48,20 +48,20 @@ def insert(string):
|
|||
|
||||
# Replace the string on the current line
|
||||
def disp(string, y=-1):
|
||||
stdscr = settings.get("stdscr")
|
||||
stdscr = settings["stdscr"]
|
||||
if stdscr == None:
|
||||
return
|
||||
|
||||
move = None
|
||||
|
||||
if y == -1:
|
||||
y = settings.get("cliney")
|
||||
space = " " * settings.get("maxyx")[1]
|
||||
y = settings["cliney"]
|
||||
space = " " * settings["maxyx"][1]
|
||||
stdscr.addstr(y, 0, space)
|
||||
else:
|
||||
stdscr.leaveok(True)
|
||||
move = stdscr.getyx()
|
||||
space = " " * settings.get("maxyx")[1]
|
||||
space = " " * settings["maxyx"][1]
|
||||
#stdscr.addstr(y, 0, space)
|
||||
|
||||
|
||||
|
|
|
@ -7,14 +7,14 @@ __author__="bjschuma"
|
|||
__date__ ="$Dec 19, 2009 11:38:46 PM$"
|
||||
|
||||
from manager import manager
|
||||
import settings
|
||||
from session import settings
|
||||
#from bt.message import write
|
||||
import history
|
||||
|
||||
|
||||
# Check for valid input
|
||||
def run(input):
|
||||
prompt = settings.get("prompt")
|
||||
prompt = settings["prompt"]
|
||||
input = input[len(prompt):].strip()
|
||||
|
||||
if len(input) == 0:
|
||||
|
@ -32,4 +32,4 @@ def run(input):
|
|||
history.insert(input)
|
||||
|
||||
# Account for the prompt changing when the manager runs
|
||||
return settings.get("prompt")
|
||||
return settings["prompt"]
|
||||
|
|
Loading…
Reference in New Issue