Author Topic: Library.py  (Read 641 times)

Offline Tethys

  • -=USF=- Co-Leader
  • Posts: 256
  • Cookies: 89
Library.py
« on: April 03, 2018, 03:49:40 PM »
I may need help figuring out how to force the topic list in the Library.py back to top using its own button. I can't seem to figure it out with my level of knowledge. I just need button and code that I can drop into my script. This is what I have done in a day; disabled pLibraryWindow.ScrollToTop() when you click a topic, removed the details from the Library window, created a new window for Details and added the details which I removed from the Library window, copied the Close button and successfully inserted it into the Details window, and resized the windows so they flow seamlessly.


Offline KrrKs

  • Posts: 461
  • Cookies: 25
Re: Library.py
« Reply #1 on: April 04, 2018, 01:43:42 PM »
No Idea if this works, I was just looking at the file for 10 minutes trying to learn python again:

If you want to scroll back up when a new button is pressed, you need a new event, a button that emits the event, a listener for that event, and finally the function to scroll up (what you disabled elsewhere).

So:
Define ET_SCROLLUP (or whatever name you like) with the other globals at the top

in init():  add ET_SCROLLUP to the list of writeable global variables-
Then set it the same way as the other eventtypes:
ET_SCROLLUP = Lib.LibEngineering.GetEngineeringNextEventType()

in CreateWindowInterior(pLibraryWindow):
copy pEvent=.... up to pButton.setNormalColor
paste the whole thing before pLibraryWindow.InteriorChangedSize()
   change ET_CLOSE of the copy Event to ET_SCROLLUP,
(also rename the button, and whatever else)
Spoiler: show

Code: [Select]
        pEvent = App.TGIntEvent_Create()
        pEvent.SetEventType(ET_SCROLLUP)
        pEvent.SetDestination(pMission)
        pEvent.SetInt(0)
        pScrollButton= App.STRoundedButton_CreateW(App.TGString("Scroll Up"), pEvent, 0.1, 0.02)

-> don't forget to add the new button to the window:
      pLibraryWindow.AddChild(pScrollButton, 0.01, 0.6, 0)

I have no idea what these values actually do, you have to experiment with them. I'm assuming it is x-position, y-position, and translucence or ordering

in CreateLibraryWindow add:
pLibraryWindow.AddPythonFuncHandlerForInstance(ET_SCROLLUP , __name__ + ".ScrollUp")

Finally add this function somewhere to the file:
Code: [Select]
def ScrollUp(pObject, pEvent):
        pLibraryWindow = GetLibraryWindow()
        pLibraryWindow.ScrollToTop()

That should do the trick.
There is probably an easier way instead of going the event listener route, idk.  :idk:

Offline Tethys

  • -=USF=- Co-Leader
  • Posts: 256
  • Cookies: 89
Re: Library.py
« Reply #2 on: April 04, 2018, 03:48:38 PM »
I tried the listener route, but it was unsuccessful, but I may not have properly done or completed it. So, I will try again with a clean Library.py. We'll see what happens

Offline Tethys

  • -=USF=- Co-Leader
  • Posts: 256
  • Cookies: 89
Re: Library.py
« Reply #3 on: April 04, 2018, 08:31:09 PM »
I had to add
        App.g_kEventManager.AddBroadcastPythonFuncHandler(ET_SCROLLUP, pMission, __name__ + ".ScrollUp")

into the init(): def, it works but only halfway, once you click on the button you have to click on the Interstellar Library window before it will scroll up. It does not scroll up unless you press the Back to Top button (and of course the extra mouse click). Not sure what the problem is, so I might PM you the code so you can load it up and check it out for yourself. I completed all your steps and went steps further, but it's not perfect. Perhaps I missed something.

Offline Tethys

  • -=USF=- Co-Leader
  • Posts: 256
  • Cookies: 89
Re: Library.py
« Reply #4 on: April 07, 2018, 11:24:00 AM »
Here is a modified Library.py with a separate details window and a scroll back to top button to help streamline the Interstellar Library. Thanks to Defiant for the original coding and to Krrks for helping out with the scroll to top button. Copy and paste this code directly over the code in Library.py be sure to make a backup in case you want to revert back. Report bugs to this thread please.

Spoiler: show
Code: [Select]
#Modified for KM2015 by Tethys and Krrks; Original code by Defiant

from bcdebug import debug
import App
import MissionLib
import Foundation
import Lib.LibEngineering
from Custom.QBautostart.Libs.Races import Races

ET_CLOSE = None
ET_CATEGORY = None
ET_TOPIC = None
ET_SCROLLUP = None
sLibraryName = "Interstellar Library"
sInfoName = "Details"
pTopicMenu = None
pBodyMenu = None
SelectedCategory = 0

MODINFO = {     "Author": "\"Defiant\" erik@bckobayashimaru.de",
                "Version": "0.2",
                "License": "BSD",
                "Description": "Interstellar Library for BC",
                "needBridge": 0
            }


def CreateBodyMenu(pInfoWindow):
        debug(__name__ + ", CreateBodyMenu")
        global pBodyMenu
        WIDTH = 0.3
        HEIGHT = 0.6
        X_POS = 0.01
        Y_POS = 0.01
       
        pBodyMenu = App.STSubPane_Create(WIDTH, HEIGHT)
        pInfoWindow.AddChild(pBodyMenu, X_POS, Y_POS)
       

def CreateTopicMenu(pLibraryWindow):
        debug(__name__ + ", CreateTopicMenu")
        global pTopicMenu
        WIDTH = 0.1
        HEIGHT = 0.6
        X_POS = 0.13
        Y_POS = 0.01
       
        pTopicMenu = App.STSubPane_Create(WIDTH, HEIGHT)
        pLibraryWindow.AddChild(pTopicMenu, X_POS, Y_POS)


def CreateCategoryMenu(pLibraryWindow):
        debug(__name__ + ", CreateCategoryMenu")
        WIDTH = 0.1
        HEIGHT = 0.3
        X_POS = 0.01
        Y_POS = 0.01
       
        pCategoryMenu = App.STSubPane_Create(WIDTH, HEIGHT)

        pEvent = App.TGIntEvent_Create()
        pEvent.SetEventType(ET_CATEGORY)
        pEvent.SetDestination(pLibraryWindow)
        pEvent.SetInt(1)
        pButton = App.STCharacterMenu_Create("Ships")
        pButton.SetActivationEvent(pEvent)
        pButton.SetNotOpenable()
        pCategoryMenu.AddChild(pButton)
       
        pEvent = App.TGIntEvent_Create()
        pEvent.SetEventType(ET_CATEGORY)
        pEvent.SetDestination(pLibraryWindow)
        pEvent.SetInt(2)
        pButton = App.STCharacterMenu_Create("Systems")
        pButton.SetActivationEvent(pEvent)
        pButton.SetNotOpenable()
        pCategoryMenu.AddChild(pButton)
       
        pEvent = App.TGIntEvent_Create()
        pEvent.SetEventType(ET_CATEGORY)
        pEvent.SetDestination(pLibraryWindow)
        pEvent.SetInt(3)
        pButton = App.STCharacterMenu_Create("Races")
        pButton.SetActivationEvent(pEvent)
        pButton.SetNotOpenable()
        pCategoryMenu.AddChild(pButton)

pCategoryMenu.ResizeToContents()
       
        pLibraryWindow.AddChild(pCategoryMenu, X_POS, Y_POS)


def CreateShipsSelect(pTopicMenu):
        debug(__name__ + ", CreateShipsSelect")
        pLibraryWindow = GetLibraryWindow()
        FdtnShips = Foundation.shipList
        g_pShipsDatabase = App.g_kLocalizationManager.Load("data/TGL/Ships.tgl")
dButtons = {}

        for iIndex in range(len(FdtnShips)):
                if iIndex == 0:
                        continue
                Ship = FdtnShips[iIndex]
                ShipLongName = Ship.name
                if not g_pShipsDatabase.HasString(Ship.GetShipFile()):
                        continue

shipfile = g_pShipsDatabase.GetString(Ship.GetShipFile()).GetCString()
dButtons[shipfile] = iIndex

lSortedButtons = dButtons.keys()
lSortedButtons.sort()
for shipfile in lSortedButtons:
iIndex = dButtons[shipfile]

                # Setup the event for when this button is clicked
                pEvent = App.TGIntEvent_Create()
                pEvent.SetEventType(ET_TOPIC)
                pEvent.SetInt(iIndex) # store the index so we know which button was clicked.
                pEvent.SetDestination(pLibraryWindow)
               
                pButton = App.STRoundedButton_CreateW(App.TGString(shipfile), pEvent, 0.20, 0.02)
                pButton.SetActivationEvent(pEvent)
                pTopicMenu.AddChild(pButton)
               
                pEvent.SetSource(pButton)
        App.g_kLocalizationManager.Unload(g_pShipsDatabase)
       

def CreateSystemSelect(pTopicMenu):
        debug(__name__ + ", CreateSystemSelect")
        pLibraryWindow = GetLibraryWindow()
        FdtnSystems = Foundation.systemList
        pSystemsDatabase = App.g_kLocalizationManager.Load("data/TGL/Systems.tgl")
dButtons = {}

        for iIndex in range(len(FdtnSystems)):
                if iIndex == 0:
                        continue
                mySystem = FdtnSystems[iIndex]
                LongName = mySystem.name

                if not pSystemsDatabase.HasString(mySystem.name):
                        continue

dButtons[LongName] = iIndex

lSortedButtons = dButtons.keys()
lSortedButtons.sort()
for systemname in lSortedButtons:
iIndex = dButtons[systemname]

                # Setup the event for when this button is clicked
                pEvent = App.TGIntEvent_Create()
                pEvent.SetEventType(ET_TOPIC)
                pEvent.SetInt(iIndex) # store the index so we know which button was clicked.
                pEvent.SetDestination(pLibraryWindow)
               
                pButton = App.STRoundedButton_CreateW(pSystemsDatabase.GetString(systemname), pEvent, 0.20, 0.02)
                pButton.SetActivationEvent(pEvent)
                pTopicMenu.AddChild(pButton)
               
                pEvent.SetSource(pButton)
               
        App.g_kLocalizationManager.Unload(pSystemsDatabase)


def CreateRacesSelect(pTopicMenu):
        debug(__name__ + ", CreateRacesSelect")
        pLibraryWindow = GetLibraryWindow()
        pRaceDatabase = App.g_kLocalizationManager.Load("data/TGL/Races.tgl")
        dButtons = {}

        i = 0
        for race in Races.keys():
                if race != "GodShips":
                        if pRaceDatabase and pRaceDatabase.HasString(race):
                                race = pRaceDatabase.GetString(race).GetCString()
                        dButtons[race] = i

i = i + 1

lSortedButtons = dButtons.keys()
lSortedButtons.sort()
for racename in lSortedButtons:
i = dButtons[racename]

# Setup the event for when this button is clicked
pEvent = App.TGIntEvent_Create()
pEvent.SetEventType(ET_TOPIC)
pEvent.SetInt(i) # store the index so we know which button was clicked.
pEvent.SetDestination(pLibraryWindow)

pButton = App.STRoundedButton_CreateW(App.TGString(racename), pEvent, 0.20, 0.02)
pButton.SetActivationEvent(pEvent)
pTopicMenu.AddChild(pButton)

pEvent.SetSource(pButton)


        # Other ships
        pEvent = App.TGIntEvent_Create()
        pEvent.SetEventType(ET_TOPIC)
        pEvent.SetInt(99)
        pEvent.SetDestination(pLibraryWindow)
        pButton = App.STRoundedButton_CreateW(App.TGString("Minor Races"), pEvent, 0.20, 0.02)
        pButton.SetActivationEvent(pEvent)
        pTopicMenu.AddChild(pButton)
        pEvent.SetSource(pButton)
       
        App.g_kLocalizationManager.Unload(pRaceDatabase)
               


def SelectCategory(pObject, pEvent):
        debug(__name__ + ", SelectCategory")
        global SelectedCategory
        SelectedCategory = pEvent.GetInt()
        if SelectedCategory and pTopicMenu:
                pTopicMenu.KillChildren()
                pBodyMenu.KillChildren()
                if SelectedCategory == 1:
                        CreateShipsSelect(pTopicMenu)
                if SelectedCategory == 2:
                        CreateSystemSelect(pTopicMenu)
                if SelectedCategory == 3:
                        CreateRacesSelect(pTopicMenu)
                pTopicMenu.ResizeToContents()
       

def SelectTopic(pObject, pEvent):
        debug(__name__ + ", SelectTopic")
        SHIP_IMAGE_WIDTH = 0.2515625
        SHIP_IMAGE_HEIGHT = 0.2458333

        SelectedTopic = pEvent.GetInt()
        if SelectedTopic != None:
                pLibraryWindow = GetLibraryWindow()
                #pLibraryWindow.ScrollToTop()
                pBodyMenu.KillChildren()
                if SelectedCategory == 1:
                        FdtnShips = Foundation.shipList
                        myship = FdtnShips[SelectedTopic]
                        g_pShipsDatabase = App.g_kLocalizationManager.Load("data/TGL/Ships.tgl")
                        pShipsHeader = App.TGParagraph_Create("", 0.1, None, "", 0.1, App.TGParagraph.TGPF_WORD_WRAP | App.TGParagraph.TGPF_READ_ONLY)
                        pShipsHeader.SetStringW(g_pShipsDatabase.GetString(myship.GetShipFile()))
                        pBodyMenu.AddChild(pShipsHeader)

                        pIcon = App.TGIcon_Create("ShipIcons", App.SPECIES_UNKNOWN)
                        pIcon.Resize(SHIP_IMAGE_WIDTH, SHIP_IMAGE_HEIGHT)
                        iIconNumber = myship.GetIconNum()
                pIcon.SetVisible()
                pIcon.SetIconNum(iIconNumber)
                pIcon.SizeToArtwork()
                        pBodyMenu.AddChild(pIcon)
                       
                        pShipsText = App.TGParagraph_Create("", 0.3, None, "", 1.0, App.TGParagraph.TGPF_WORD_WRAP | App.TGParagraph.TGPF_READ_ONLY)
                        pShipsText.SetStringW(g_pShipsDatabase.GetString(myship.GetShipFile() + " Description"))
                        pBodyMenu.AddChild(pShipsText)
                        App.g_kLocalizationManager.Unload(g_pShipsDatabase)
                elif SelectedCategory == 2:
                        FdtnSystems = Foundation.systemList
                        mySystem = FdtnSystems[SelectedTopic]
                        pSystemsDatabase = App.g_kLocalizationManager.Load("data/TGL/Systems.tgl")
                        pSystemsHeader = App.TGParagraph_Create("", 0.1, None, "", 0.1, App.TGParagraph.TGPF_WORD_WRAP | App.TGParagraph.TGPF_READ_ONLY)
                        pSystemsHeader.SetStringW(pSystemsDatabase.GetString(mySystem.name))
                        pBodyMenu.AddChild(pSystemsHeader)

        pGraphicsMode = App.GraphicsModeInfo_GetCurrentMode()
        pcLCARS = pGraphicsMode.GetLcarsString()
                        pIcon = App.TGIcon_Create(pcLCARS, 800)
                        pIcon.Resize(SHIP_IMAGE_WIDTH, SHIP_IMAGE_HEIGHT)
                pIcon.SetVisible()
                pIcon.SizeToArtwork()
                        pBodyMenu.AddChild(pIcon)
                       
                        pSystemsText = App.TGParagraph_Create("", 0.3, None, "", 1.0, App.TGParagraph.TGPF_WORD_WRAP | App.TGParagraph.TGPF_READ_ONLY)
                        pSystemsText.SetStringW(pSystemsDatabase.GetString(mySystem.name + " Description"))
                        pBodyMenu.AddChild(pSystemsText)

                        App.g_kLocalizationManager.Unload(pSystemsDatabase)
                elif SelectedCategory == 3:
                        pRaceDatabase = App.g_kLocalizationManager.Load("data/TGL/Races.tgl")
       
                        i = 0
                        myRace = None
                        for race in Races.keys():
                                #print i, race
                                if race != "GodShips":
                                        if SelectedTopic == i:
                                                myRace = race
                                                break
                                        elif SelectedTopic == 99:
                                                myRace = "Other"
                                                break
                                i = i + 1

iIconNumber = 99
if myRace != "Other" and hasattr(Races[myRace], "RaceIcon"):
iIconNumber = Races[myRace].RaceIcon

                        pRacesHeader = App.TGParagraph_Create("", 0.1, None, "", 0.1, App.TGParagraph.TGPF_WORD_WRAP | App.TGParagraph.TGPF_READ_ONLY)
                        if pRaceDatabase and pRaceDatabase.HasString(myRace):
                                pRacesHeader.SetStringW(pRaceDatabase.GetString(myRace))
                        else:
                                pRacesHeader.SetStringW(App.TGString(myRace))
                        pBodyMenu.AddChild(pRacesHeader)

                        pIcon = App.TGIcon_Create("RacesIcons", App.SPECIES_UNKNOWN)
                        pIcon.Resize(SHIP_IMAGE_WIDTH, SHIP_IMAGE_HEIGHT)
                pIcon.SetVisible()
                pIcon.SetIconNum(iIconNumber)
                pIcon.SizeToArtwork()
                        pBodyMenu.AddChild(pIcon)

                        if pRaceDatabase and pRaceDatabase.HasString(myRace + " Description"):
                                pRacesText = App.TGParagraph_Create("", 0.3, None, "", 1.0, App.TGParagraph.TGPF_WORD_WRAP | App.TGParagraph.TGPF_READ_ONLY)
                                pRacesText.SetStringW(pRaceDatabase.GetString(myRace + " Description"))
                                pBodyMenu.AddChild(pRacesText)
               
       
                        App.g_kLocalizationManager.Unload(pRaceDatabase)


# ceate the window interior here!
def CreateWindowInterior(pLibraryWindow):
        debug(__name__ + ", CreateWindowInterior")
        CreateCategoryMenu(pLibraryWindow)
        CreateTopicMenu(pLibraryWindow)
        #CreateBodyMenu(pLibraryWindow)
       
        pMission = MissionLib.GetMission()
        pEvent = App.TGIntEvent_Create()
        pEvent.SetEventType(ET_CLOSE)
        pEvent.SetDestination(pMission)
        pEvent.SetInt(0)
        pButton = App.STRoundedButton_CreateW(App.TGString("Close"), pEvent, 0.1, 0.03)
        pButton.SetNormalColor(App.g_kMainMenuButtonColor)
        pLibraryWindow.AddChild(pButton, 0.01, 0.4, 0)
       
        pLibraryWindow.InteriorChangedSize()
        pLibraryWindow.Layout()

# ceate the window interior here!
def CreateWindowInterior1(pInfoWindow):
        debug(__name__ + ", CreateWindowInterior1")
        #CreateCategoryMenu(pInfoWindow)
        #CreateTopicMenu(pInfoWindow)
        CreateBodyMenu(pInfoWindow)
       
        pMission = MissionLib.GetMission()
        pEvent = App.TGIntEvent_Create()
        pEvent.SetEventType(ET_CLOSE)
        pEvent.SetDestination(pMission)
        pEvent.SetInt(0)
        pButton = App.STRoundedButton_CreateW(App.TGString("Close"), pEvent, 0.08, 0.03)
        pButton.SetNormalColor(App.g_kMainMenuButtonColor)
        pInfoWindow.AddChild(pButton, 0.25, 0.01, 0)
        pEvent1 = App.TGIntEvent_Create()
        pEvent1.SetEventType(ET_SCROLLUP)
        pEvent1.SetDestination(pMission)
        pEvent1.SetInt(0)
        pButton1 = App.STRoundedButton_CreateW(App.TGString("Return to Top"), pEvent1, 0.08, 0.03)
        pButton1.SetNormalColor(App.g_kMainMenuButtonColor)
        pInfoWindow.AddChild(pButton1, 0.16, 0.01, 0)
       
        pInfoWindow.InteriorChangedSize()
        pInfoWindow.Layout()
       

def GetLibraryWindow():
        debug(__name__ + ", GetLibraryWindow")
        pTacticalControlWindow = App.TacticalControlWindow_GetTacticalControlWindow()

        # cycle all
        curChild = pTacticalControlWindow.GetFirstChild()
        while curChild:
                curWindow = App.STStylizedWindow_Cast(curChild)
                if curWindow:
                        kString = curWindow.GetName()
                        if (kString.GetCString() == sLibraryName):
                                return curWindow
                curChild = pTacticalControlWindow.GetNextChild(curChild)

def GetInfoWindow():
        debug(__name__ + ", GetInfoWindow")
        pTacticalControlWindow = App.TacticalControlWindow_GetTacticalControlWindow()

        # cycle all
        curChild = pTacticalControlWindow.GetFirstChild()
        while curChild:
                curWindow = App.STStylizedWindow_Cast(curChild)
                if curWindow:
                        kString = curWindow.GetName()
                        if (kString.GetCString() == sInfoName):
                                return curWindow
                curChild = pTacticalControlWindow.GetNextChild(curChild)


# handle mouse clicks in empty space
def PassMouse(pWindow, pEvent):
        debug(__name__ + ", PassMouse")
        pWindow.CallNextHandler(pEvent)

        if pEvent.EventHandled() == 0:
                pEvent.SetHandled()


def WindowOpenClose(pObject, pEvent):
        debug(__name__ + ", WindowOpenClose")
        pLibraryWindow = GetLibraryWindow()
        if not pLibraryWindow:
                pLibraryWindow = CreateLibraryWindow(None, None)

        pInfoWindow = GetInfoWindow()
        if not pInfoWindow:
                pInfoWindow = CreateInfoWindow(None, None)

        pTacticalControlWindow = App.TacticalControlWindow_GetTacticalControlWindow()
        if pLibraryWindow.IsVisible() and pInfoWindow.IsVisible():
                pTacticalControlWindow.MoveToBack(pLibraryWindow)
                pLibraryWindow.SetNotVisible()
                pTacticalControlWindow.MoveToBack(pInfoWindow)
                pInfoWindow.SetNotVisible()
        else:
                pLibraryWindow.SetVisible()
                pTacticalControlWindow.MoveToFront(pLibraryWindow)
                # Not so agressiv to the front - only give us problems!
                pTacticalControlWindow.MoveTowardsBack(pLibraryWindow)
                pInfoWindow.SetVisible()
                pTacticalControlWindow.MoveToFront(pInfoWindow)
                # Not so agressiv to the front - only give us problems!
                pTacticalControlWindow.MoveTowardsBack(pInfoWindow)


def WindowClose(pObject, pEvent):
        debug(__name__ + ", WindowClose")
        pLibraryWindow = GetLibraryWindow()
        pInfoWindow = GetInfoWindow()
        if pLibraryWindow:
                pTacticalControlWindow = App.TacticalControlWindow_GetTacticalControlWindow()
                if pLibraryWindow.IsVisible():
                        pTacticalControlWindow.MoveToBack(pLibraryWindow)
                        pLibraryWindow.SetNotVisible()
                        pTacticalControlWindow.MoveToBack(pInfoWindow)
                        pInfoWindow.SetNotVisible()
       
        pObject.CallNextHandler(pEvent)

def ScrollUp(pObject, pEvent):
        #debug(__name__ + ", ScrollUp")
        pLibraryWindow = GetLibraryWindow()
        #App.TacticalControlWindow_GetTacticalControlWindow().SetFocus(pLibraryWindow)
        pLibraryWindow.ScrollToTop()
        App.TacticalControlWindow_GetTacticalControlWindow().SetFocus(pLibraryWindow)

def CreateLibraryWindow(pObject, pEvent):
        debug(__name__ + ", CreateLibraryWindow")
        pLibraryWindow = App.STStylizedWindow_CreateW("StylizedWindow", "NoMinimize", App.TGString(sLibraryName), 0.0, 0.0, None, 1, 0.35, 0.5, App.g_kMainMenuBorderMainColor)
        pTacticalControlWindow = App.TacticalControlWindow_GetTacticalControlWindow()
        pTacticalControlWindow.AddChild(pLibraryWindow, 0.1, 0.094)

        pLibraryWindow.AddPythonFuncHandlerForInstance(App.ET_MOUSE, __name__ + ".PassMouse")
        pLibraryWindow.SetNotVisible()
       
        pLibraryWindow.AddPythonFuncHandlerForInstance(ET_CATEGORY, __name__ + ".SelectCategory")
        pLibraryWindow.AddPythonFuncHandlerForInstance(ET_TOPIC, __name__ + ".SelectTopic")
       
        CreateWindowInterior(pLibraryWindow)
       
        return pLibraryWindow

def CreateInfoWindow(pObject, pEvent):
        debug(__name__ + ", CreateInfoWindow")
        pTacticalControlWindow = App.TacticalControlWindow_GetTacticalControlWindow()
        pInfoWindow = App.STStylizedWindow_CreateW("StylizedWindow", "NoMinimize", App.TGString(sInfoName), 0.0, 0.0, None, 1, 0.35, 0.65, App.g_kMainMenuBorderMainColor)
        pTacticalControlWindow.AddChild(pInfoWindow, 0.45, 0.05)

        pInfoWindow.SetNotVisible()

        pInfoWindow.AddPythonFuncHandlerForInstance(App.ET_MOUSE, __name__ + ".PassMouse")
        pInfoWindow.SetNotVisible()
        pInfoWindow.AddPythonFuncHandlerForInstance(ET_SCROLLUP, __name__ + ".ScrollUp")
       
        CreateWindowInterior1(pInfoWindow)
        return pInfoWindow

def init():
        debug(__name__ + ", init")
        global ET_CLOSE, ET_CATEGORY, ET_TOPIC, ET_SCROLLUP
       
        pMission = MissionLib.GetMission()
        pBridge = App.g_kSetManager.GetSet("bridge")
        g_pScience = App.CharacterClass_GetObject(pBridge, "Science")
        ET_CLOSE = Lib.LibEngineering.GetEngineeringNextEventType()
        ET_CATEGORY = Lib.LibEngineering.GetEngineeringNextEventType()
        ET_TOPIC = Lib.LibEngineering.GetEngineeringNextEventType()
        ET_SCROLLUP = Lib.LibEngineering.GetEngineeringNextEventType()
       
        Lib.LibEngineering.CreateMenuButton(sLibraryName, "Science", __name__ + ".WindowOpenClose")
        #MissionLib.CreateTimer(Lib.LibEngineering.GetEngineeringNextEventType(), __name__ + ".CreateLibraryWindow", App.g_kUtopiaModule.GetGameTime() + 2.0, 0, 0)
        App.g_kEventManager.AddBroadcastPythonFuncHandler(ET_CLOSE, pMission, __name__ + ".WindowOpenClose")
        App.g_kEventManager.AddBroadcastPythonFuncHandler(ET_SCROLLUP, pMission, __name__ + ".ScrollUp")
        if g_pScience:
                g_pScience.AddPythonFuncHandlerForInstance(App.ET_CHARACTER_MENU, __name__ + ".WindowClose")