Ok... I Have a piece of code I think is psuedo worthy of actually sharing... as well as a few improvements I'd like to make but have no idea as to how to do so.LinesList = []
def OnPluginConnect():
win = world.GetPluginID
temp = world.GetWorldWindowPosition.split(',')
winHeight = int((int(temp[3]) - int(temp[1])) * 0.25)
winWidth = int(temp[2]) - int(temp[0]) - 29
world.WindowCreate (win, 0, 0, winWidth, winHeight, 4, 0, 0x000000)
world.WindowRectOp (win, 1, 1, 1, -1, -1, 0x0000FF, 0xFFFFFF)
world.WindowRectOp (win, 1, 2, 2, -2, -2, 0x0000FF, 0xFFFFFF)
world.WindowShow (win, 1)
def OnPluginDisconnect():
win = world.GetPluginID
world.WindowShow (win, 0)
def OnPluginClose():
win = world.GetPluginID
world.WindowShow (win, 0)
def OnPluginDisable():
win = world.GetPluginID
world.WindowShow (win, 0)
def OnPluginEnable():
win = world.GetPluginID
world.WindowCreate (win, 0, 0, winWidth, winHeight, 4, 0, 0x000000)
world.WindowRectOp (win, 1, 1, 1, -1, -1, 0x0000FF, 0xFFFFFF)
world.WindowRectOp (win, 1, 2, 2, -2, -2, 0x0000FF, 0xFFFFFF)
world.WindowShow (win, 1)
def OnPluginWorldOutputResized():
win = world.GetPluginID
temp = world.GetWorldWindowPosition.split(',')
winHeight = int((int(temp[3]) - int(temp[1])) * 0.25)
winWidth = int(temp[2]) - int(temp[0]) - 29
world.WindowFont (win, 'body', 'Dina', 10, 0, 0, 0, 0, 1, 0)
fontHeight = int(world.WindowFontInfo(win, 'body', 1))
mLines = winHeight / fontHeight
world.WindowCreate (win, 0, 0, winWidth, winHeight, 4, 0, 0x000000)
world.WindowRectOp (win, 1, 1, 1, -1, -1, 0x0000FF, 0x0000FF)
world.WindowRectOp (win, 1, 2, 2, -2, -2, 0x0000FF, 0x0000FF)
winTMargin = 5
winLMargin = 5
for i in range(0, len(LinesList)):
localTMargin = winTMargin + 16*i
world.WindowText (win, 'body', LinesList[i], winLMargin, localTMargin, 0, 0, 0xCCCCCC, 1)
world.WindowShow (win, 1)
def OnPluginScreendraw(type, log, line):
win = world.GetPluginID
temp = world.GetWorldWindowPosition.split(',')
winHeight = int((int(temp[3]) - int(temp[1])) * 0.25)
winWidth = int(temp[2]) - int(temp[0]) - 29
world.WindowFont (win, 'body', 'Dina', 10, 0, 0, 0, 0, 1, 0)
fontHeight = int(world.WindowFontInfo(win, 'body', 1))
mLines = winHeight / fontHeight
if len(LinesList) >= mLines:
LinesList.pop(0)
world.WindowRectOp (win, 1, 2, 2, -2, -2, 0x0000FF, 0x0000FF)
LinesList.append (line)
world.WindowCreate (win, 0, 0, winWidth, winHeight, 4, 0, 0x000000)
world.WindowRectOp (win, 1, 1, 1, -1, -1, 0x0000FF, 0x0000FF)
world.WindowRectOp (win, 1, 2, 2, -2, -2, 0x0000FF, 0x0000FF)
winTMargin = 5
winLMargin = 5
for i in range(0, len(LinesList)):
localTMargin = winTMargin + 16*i
world.WindowText (win, 'body', LinesList[i], winLMargin, localTMargin, 0, 0, 0xCCCCCC, 1)
world.WindowShow (win, 1)
return 0
It will display the most recent lines. Any number of lines based on a percentage of your screen. Now... Here is where things get dicey. The world screen size isn't updated when maximized, any idea how to extract that, so as to use it in the resizing function here.
And the other improvement I want to make is. I want this window to be displayed ONLY when I am scrolling back in the main window. Any ideas?
(EDIT by David: I took the liberty of fixing the [i] tags in the post so as to not italicize the entire post.) |