[Bio] / ModelEditor / MainLayout.py Repository:
ViewVC logotype

View of /ModelEditor/MainLayout.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (download) (as text) (annotate)
Fri Mar 11 21:33:13 2005 UTC (13 years, 7 months ago) by efrank
Branch: MAIN
CVS Tags: before-dynamics-persistence, lwc, treatman-lastDay-0, preTreatmanDyn, HEAD
Changes since 1.10: +1 -1 lines
1. introduce Model as king of the hill rather than RecoElem.
2. migrations to follow
3. new modules for by-peg filtering
4. first stab at externalized app fwk
5. moved seed data factory

bunch of timing code still in this ...need to take out

#--------------------------------------------------------------
# 
# MainLayout.py
#
# Lays out the various windows and GUI widgets.
#
#
# HISTORY:
#    long ago  hwang      first version
#    02-20-04  hwang      added functions to be clear on which panel I am on
#
# BUGS:
#
#--------------------------------------------------------------


from wxPython.wx import *
from wxPython.grid import *
from wxPython.html import *
from wxPython.lib.dialogs import wxScrolledMessageDialog


from CatalogServices.Catalog import Catalog

class MainLayout(wxFrame):
#    def getSelectedMetabsGrid(self):
#    def __init__(self, *args, **kwds):

#    def catPanel(self)
#    def htmlPanel(self)
#    def enzymePanel(self)
#    def rxPanel(self)
#    def metPanel(self)
#    def rePanel(self)
#    def menuBar(self)
#    def showLayout(self)    
#    def createFoundryCombobox(self)

    #------------------------------------------------------------------------
    def __init__(self, *args, **kwds):
    #------------------------------------------------------------------------
        # begin wxGlade: MainFrame.__init__
        kwds["style"] = wxDEFAULT_FRAME_STYLE
        wxFrame.__init__(self, *args, **kwds)


        # list of comboBoxes related to Data Foundry selection
        # Used by manageDataFacories to keep up to date as
        # foundries are added dynamically during run.

        self.mainFoundryNames = []
        self.__foundryNameDict = {}
        # $$ self.__foundryNameList = ["Bss", "Wit"]

        # register a method that keeps the combo boxes up to
        # date when new factories come along

        self.notebook = wxNotebook(self, -1, style=0)
        self.showLayout()
        
        Catalog.instance().registerObserver( self.manageDataFactories)

        return

    #------------------------------------------------------------------------
    def manageDataFactories(self, newFactoryInstance):
    #------------------------------------------------------------------------
        """
        Registered as a callback for any additions to the Catalog.  We
        update combo boxes, factory dictionaries and load the new factory's
        catalog in the catalogTree
        """
        
        if ( self.__foundryNameDict.has_key( newFactoryInstance.getFoundryName() ) ):
            self.error( "Duplicate foundry name added to foundry list. Ignoring")
            return
        
        self.__foundryNameDict[ newFactoryInstance.getFoundryName() ] = newFactoryInstance
        
        self.foundryComboBox.Clear()

        for foundryName in self.__foundryNameDict.keys():
            #self.mainFoundryNames.append(foundryName)
            self.foundryComboBox.Append(foundryName, foundryName)
            
        self.foundryComboBox.SetValue( newFactoryInstance.getFoundryName() )
        
        if ( not "KahChemDb" == newFactoryInstance.getFoundryType() ):
            top = newFactoryInstance.getCatalogTop()
            self.cat.recurseCatalog( top, self.catalog_tree, self.catalogRootId)

        return
    #------------------------------------------------------------------------
    def getCurrentDataFactory(self):
    #------------------------------------------------------------------------
        """
        Returns instance of DataFactory corresponding to selection in
        foundry combo box.
        """

        foundryName = self.foundryComboBox.GetValue()
        f = self.__foundryNameDict[ foundryName ]
    
        return f
    
    #------------------------------------------------------------------------
    def getSelectedMetabsGrid(self):
    #------------------------------------------------------------------------
        return self.selectedMetabsGrid
    
    
    #------------------------------------------------------------------------
    def createFoundryComboBox(self):
    #------------------------------------------------------------------------
                
        self.dataFactoryLabel     = wxStaticText(self, -1, "Data Factory              ")
        self.foundryComboBox      = wxComboBox(self, -1, "",size=(150,-1),
                                               choices = [],
                                               style=wxCB_DROPDOWN| wxCB_READONLY)
        #self.foundryComboBox.SetValue("Bss")
        
        
        return

    #------------------------------------------------------------------------
    def catPanelLayout(self):
    #------------------------------------------------------------------------

        self.catPanel          = wxSplitterWindow(self.notebook, -1)
        catTopPanel            = wxPanel(self.catPanel, -1)
        catBottomPanel         = wxPanel(self.catPanel, -1)
       
        self.catPanel.SplitHorizontally(catTopPanel, catBottomPanel, 300)
                      
        self.catalog_treeId = wxNewId()
        self.catalog_tree = wxTreeCtrl(catTopPanel, self.catalog_treeId,
                                       style=wxTR_HAS_BUTTONS|wxSUNKEN_BORDER)



        self.catPath                 = wxStaticText(catBottomPanel, -1, "Path:")
        self.catVersion              = wxStaticText(catBottomPanel, -1, "Version to use:")
        self.catHistory              = wxStaticText(catBottomPanel, -1, "History")
        self.catHistoryDate          = wxStaticText(catBottomPanel, -1, "Date:")
        self.catHistoryUser          = wxStaticText(catBottomPanel, -1, "User:")
        self.catHistoryCreatedFrom   = wxStaticText(catBottomPanel, -1, "Created From:")


        self.catPathValue            = wxTextCtrl(catBottomPanel, -1,
                                                  "Select a Catalog Entry",
                                                  size = (150, -1),
                                                  style = wxTE_READONLY)
        self.catVersionValueComboBox = wxComboBox(catBottomPanel, -1, "", 
                                                  size=(150,-1), choices=[],
                                                  style=wxCB_DROPDOWN| wxCB_READONLY)
        self.catVersionValueComboBox.Clear()
        #self.catVersionValue              =wxStaticText(self.catBottomPanel, -1, "")
        self.catEmptyValue                = wxStaticText(catBottomPanel, -1, "")
        self.catHistoryDateValue          = wxStaticText(catBottomPanel, -1, "")
        self.catHistoryUserValue          = wxStaticText(catBottomPanel, -1, "")
        self.catHistoryCreatedFromValue   = wxStaticText(catBottomPanel, -1, "")


        self.catalog_tree.SetSize((500,500))
        catBottomPanel.SetSize((500,500))
               
        catTopSizer = wxBoxSizer(wxVERTICAL) 
        catTopSizer.Add(self.catalog_tree, 1, wxGROW)
        catTopPanel.SetSizer(catTopSizer)
        catTopPanel.SetAutoLayout(True)


        catBottomSizerStaticText = wxBoxSizer(wxVERTICAL) 
        catBottomSizerStaticText.Add(self.catEmptyValue)
        catBottomSizerStaticText.Add(self.catPath)
        catBottomSizerStaticText.Add( (20,20), 0, wxEXPAND)
        catBottomSizerStaticText.Add(self.catVersion)
        catBottomSizerStaticText.Add( (20,20), 0, wxEXPAND)
        catBottomSizerStaticText.Add(wxStaticText(catBottomPanel, -1, ""))
        catBottomSizerStaticText.Add(self.catHistory)
        catBottomSizerStaticText.Add(self.catHistoryDate)          
        catBottomSizerStaticText.Add(self.catHistoryUser)         
        catBottomSizerStaticText.Add(self.catHistoryCreatedFrom)

        catBottomSizerDynamicText = wxBoxSizer(wxVERTICAL)
        catBottomSizerDynamicText.Add(self.catEmptyValue)
        catBottomSizerDynamicText.Add(self.catPathValue)
        catBottomSizerDynamicText.Add(wxStaticText(catBottomPanel, -1, ""))
        catBottomSizerDynamicText.Add(self.catVersionValueComboBox)
        catBottomSizerDynamicText.Add( (20,33), 0, wxEXPAND)
        #catBottomSizerDynamicText.Add( (20,20), 0, wxEXPAND)
        catBottomSizerDynamicText.Add(self.catHistoryDateValue)          
        catBottomSizerDynamicText.Add(self.catHistoryUserValue)         
        catBottomSizerDynamicText.Add(self.catHistoryCreatedFromValue)   


        catVersionMainSizer = wxBoxSizer(wxHORIZONTAL)
        catVersionMainSizer.Add(catBottomSizerStaticText)
        catVersionMainSizer.Add( (20,20), 0, wxEXPAND)
        catVersionMainSizer.Add(catBottomSizerDynamicText)

        catBottomMainSizer = wxBoxSizer(wxVERTICAL)
        catBottomMainSizer.Add(catVersionMainSizer)


        catBottomPanel.SetSizer(catBottomMainSizer)
        catBottomPanel.SetAutoLayout(True)

        return


    #------------------------------------------------------------------------
    def htmlPanelLayout(self):
    #------------------------------------------------------------------------

        self.helpHtmlPanel = wxPanel(self.notebook, -1)
        self.helpHtmlPage  = wxHtmlWindow(self.helpHtmlPanel, -1)
        
        self.helpHtmlPanel.SetSize((300,400))
        self.helpHtmlPage.SetSize((300,400))

        htmlMainSizer = wxBoxSizer(wxVERTICAL)
        htmlMainSizer.Add(self.helpHtmlPage, 1, wxGROW)

        self.helpHtmlPanel.SetSizer(htmlMainSizer)
        self.helpHtmlPanel.SetAutoLayout(True)

        return

    #------------------------------------------------------------------------
    def enzymePanelLayout(self):
    #------------------------------------------------------------------------

        self.enzymesPanel = wxSplitterWindow(self.notebook, -1)
        enzymesTop       = wxSplitterWindow(self.enzymesPanel, -1)
        enzymesTopLeft   = wxPanel(enzymesTop, -1)
        enzymesTopRight  = wxPanel(enzymesTop, -1)
        enzymesBottom    = wxPanel(self.enzymesPanel, -1)
        
        self.enzymesPanel.SetSize((490, 800))
        enzymesTop.SetSize((486,224))
        enzymesTopLeft.SetSize((241, 227))
        enzymesTopRight.SetSize((251, 227))
        enzymesBottom.SetSize((486 ,224 ))
        
        self.enzymesPanel.SplitHorizontally(enzymesTop, enzymesBottom, 400)
        enzymesTop.SplitVertically(enzymesTopLeft, enzymesTopRight, 360)

	self.searchEnzymesBtn = wxButton(enzymesTopLeft, -1, "Search")
        self.addEnzymesBtn    = wxButton(enzymesTopLeft, -1, "Add")
        
        self.enzymesSearchText = wxTextCtrl(enzymesTopLeft, -1, "", size=(170, -1))

        self.enzymesPrompt = wxStaticText(enzymesTopLeft, -1, "Find enzyme with")
        self.choicesEnzymesComboBox = wxComboBox(enzymesTopLeft, -1, "EC",size=(150,-1),
                                                 choices=["EC", "Name", "Substrate", "Product"],
                                                 style=wxCB_DROPDOWN| wxCB_READONLY)
        self.choicesEnzymesComboBox.SetValue("EC")
        self.optionsEnzymesComboBox = wxComboBox(enzymesTopLeft, -1, "Equals",size=(150,-1),
                                                 choices=["Equals", "Contains"],
                                                 style=wxCB_DROPDOWN| wxCB_READONLY)
        self.optionsEnzymesComboBox.SetValue("Equals")
        

        enzymesTopLeftBogusSizer = wxBoxSizer(wxVERTICAL)
	enzymesTopLeftMainSizer  = wxBoxSizer(wxVERTICAL)
        enzymesOptionsTextSizer  = wxBoxSizer(wxHORIZONTAL)
	enzymesSearchAddSizer    = wxBoxSizer(wxHORIZONTAL)
	
	enzymesOptionsTextSizer.Add(self.optionsEnzymesComboBox)
        enzymesOptionsTextSizer.Add(self.enzymesSearchText, 0, wxEXPAND)
	
	enzymesSearchAddSizer.Add(self.searchEnzymesBtn)
        enzymesSearchAddSizer.Add(self.addEnzymesBtn)


	enzymesTopLeftMainSizer.Add( (20,20), 0,wxEXPAND)
        enzymesTopLeftMainSizer.Add(self.enzymesPrompt)
	enzymesTopLeftMainSizer.Add(self.choicesEnzymesComboBox)
	enzymesTopLeftMainSizer.Add(enzymesOptionsTextSizer)
        enzymesTopLeftMainSizer.Add((20,20), 0,wxEXPAND)
        enzymesTopLeftMainSizer.Add(enzymesSearchAddSizer)

	enzymesTopLeftBogusSizer.Add(enzymesTopLeftMainSizer)
        enzymesTopLeft.SetSizer(enzymesTopLeftMainSizer)
        enzymesTopLeft.SetAutoLayout(true)                            
        
	#enzymesTopRight

        self.enzymesSearchResultsGridLabel = wxStaticText(enzymesTopRight, -1, "Search Results")
        self.enzymesSearchSelectBtn = wxButton(enzymesTopRight, -1, "Select")
        self.enzymesListFunctionBtn = wxButton(enzymesTopRight, -1, "List Functions")
	self.enzymesSearchClearBtn  = wxButton(enzymesTopRight, -1, "Clear")

	self.enzymesSearchResultsGrid = wxGrid(enzymesTopRight, -1)
        self.enzymesSearchResultsGrid.CreateGrid(0, 4)
        self.enzymesSearchResultsGrid.SetColLabelValue(0,"Foundry")
        self.enzymesSearchResultsGrid.AutoSizeColumn(0)
        self.enzymesSearchResultsGrid.SetColLabelValue(1,"EC")
        self.enzymesSearchResultsGrid.SetColLabelValue(2,"Name")
	self.enzymesSearchResultsGrid.SetColLabelValue(3,"Aux")
        self.enzymesSearchResultsGrid.AutoSizeColumn(2)
       
        enzymesTRHChoicesSizer   = wxBoxSizer(wxHORIZONTAL)
        enzymesTopRightMainSizer = wxBoxSizer(wxVERTICAL)
        
        enzymesTRHChoicesSizer.Add(self.enzymesSearchSelectBtn, 0, 0, 0, 0)
	enzymesTRHChoicesSizer.Add(self.enzymesListFunctionBtn, 0, 0, 0, 0)
	enzymesTRHChoicesSizer.Add(self.enzymesSearchClearBtn, 0, 0, 0, 0)
        
        
        enzymesTopRightMainSizer.Add (self.enzymesSearchResultsGridLabel)
        enzymesTopRightMainSizer.Add (self.enzymesSearchResultsGrid, 7, wxEXPAND)
        enzymesTopRightMainSizer.Add (enzymesTRHChoicesSizer)
        
        enzymesTopRight.SetSizer(enzymesTopRightMainSizer)
        enzymesTopRight.SetAutoLayout(true)

	#enzymeBottom

	self.selectedEnzymesGridLabel   = wxStaticText(enzymesBottom, -1, "Selected Reactions")
        self.clearSelectedEnzymesBtn    = wxButton(enzymesBottom, -1, "Clear")
        self.enzymesSelectedResultsGrid = wxGrid(enzymesBottom, -1)

        self.enzymesSelectedResultsGrid.CreateGrid(0, 4)
        self.enzymesSelectedResultsGrid.SetColLabelValue(0,"Foundry")
        self.enzymesSelectedResultsGrid.AutoSizeColumn(0)
        self.enzymesSelectedResultsGrid.SetColLabelValue(1,"EC")
        self.enzymesSelectedResultsGrid.SetColLabelValue(2,"Name")
	self.enzymesSelectedResultsGrid.SetColLabelValue(3,"Aux")
        self.enzymesSelectedResultsGrid.AutoSizeColumn(2)
       
        enzymesBottomMainSizer   = wxBoxSizer(wxVERTICAL)

        enzymesBottomMainSizer.Add (self.clearSelectedEnzymesBtn)
        enzymesBottomMainSizer.Add (self.selectedEnzymesGridLabel)
        enzymesBottomMainSizer.Add (self.enzymesSelectedResultsGrid, 4, wxEXPAND)
                
        enzymesBottom.SetSizer(enzymesBottomMainSizer)
        enzymesBottom.SetAutoLayout(true)


        return

   #------------------------------------------------------------------------
    def rxPanelLayout(self):
   #------------------------------------------------------------------------
        self.rxPanel = wxSplitterWindow(self.notebook, -1)
        rxTop       = wxSplitterWindow(self.rxPanel, -1)
        rxTopLeft   = wxPanel(rxTop, -1)
        rxTopRight  = wxPanel(rxTop, -1)
        rxBottom    = wxPanel(self.rxPanel, -1)
        
        self.rxPanel.SetSize((490, 800))
        rxTop.SetSize((486, 224))
        rxTopLeft.SetSize((241, 227))
        rxTopRight.SetSize((251, 227))
        rxBottom.SetSize((486, 224))

        #rxTopLeft
        self.rxPanel.SplitHorizontally(rxTop, rxBottom, 400)
        rxTop.SplitVertically(rxTopLeft, rxTopRight, 360)

        self.searchRxBtn = wxButton(rxTopLeft, -1, "Search")
        self.addRxBtn    = wxButton(rxTopLeft, -1, "Add")
        
        self.hasMetabsLabel          = wxStaticText(rxTopLeft, -1, "Has Metabolite")
        self.hasEnzymesLabel         = wxStaticText(rxTopLeft, -1, "Has Enzyme")

        self.hasMetabsText           = wxTextCtrl(rxTopLeft, -1, "", size=(170, -1))
        self.hasEnzymesText          = wxTextCtrl(rxTopLeft, -1, "", size=(170, -1))


        self.optionsRxComboBox       = wxComboBox(rxTopLeft, -1, "Input",size=(150,-1),
                                                  choices=["Input", "Output",
                                                  "From Metabolite Page"],
                                                  style=wxCB_DROPDOWN| wxCB_READONLY)
        self.optionsRxComboBox.SetValue("Input")
        self.orAndRxComboBox         = wxComboBox(rxTopLeft, -1, "Or", size=(150,-1),
                                                  choices=["Or", "And"],
                                                  style=wxCB_DROPDOWN | wxCB_READONLY)
        self.orAndRxComboBox.SetValue( "Or" )
        self.ecNameComboBox          = wxComboBox(rxTopLeft, -1, "EC", size=(150,-1),
                                                  choices=["EC", "Name"],
                                                  style=wxCB_DROPDOWN| wxCB_READONLY)
        self.ecNameComboBox.SetValue( "EC" )

        rxTopLeftMainSizer  = wxBoxSizer(wxVERTICAL)
        rxLVDataOptionsSizer = wxBoxSizer(wxVERTICAL)
        
        rxLHHasMetabsSizer   = wxBoxSizer(wxHORIZONTAL)
        rxLHEnzymesSizer     = wxBoxSizer(wxHORIZONTAL)
        rxLHSearchAddSizer   = wxBoxSizer(wxHORIZONTAL)
        
        rxLHHasMetabsSizer.Add(self.optionsRxComboBox, 0, 0)
        self.optionsRxComboBox.SetValue( "Input")
        rxLHHasMetabsSizer.Add(self.hasMetabsText, 0, wxEXPAND, 0, 0)

        rxLHEnzymesSizer.Add(self.ecNameComboBox, 0, wxEXPAND)
        rxLHEnzymesSizer.Add(self.hasEnzymesText, 0, wxEXPAND, 0, 0)

        rxLHSearchAddSizer.Add(self.searchRxBtn)
        rxLHSearchAddSizer.Add(self.addRxBtn)
                                    
        rxTopLeftMainSizer.Add((20,20), 0,wxEXPAND)
        rxTopLeftMainSizer.Add(self.hasMetabsLabel, 0, 0, 0, 0)
        rxTopLeftMainSizer.Add(rxLHHasMetabsSizer)
        rxTopLeftMainSizer.Add((20,20), 0,wxEXPAND)
        rxTopLeftMainSizer.Add(self.orAndRxComboBox)
        rxTopLeftMainSizer.Add((20,20), 0,wxEXPAND)
        rxTopLeftMainSizer.Add(self.hasEnzymesLabel, 0, 0, 0, 0)
        rxTopLeftMainSizer.Add(rxLHEnzymesSizer)
        rxTopLeftMainSizer.Add((20,20), 0,wxEXPAND)
        rxTopLeftMainSizer.Add(rxLHSearchAddSizer)
        rxTopLeft.SetSizer(rxTopLeftMainSizer)
        rxTopLeft.SetAutoLayout(true)

        #rxTopRight

        self.rxSearchResultsGridLabel= wxStaticText(rxTopRight, -1, "Search Results")
	self.selectRxBtn = wxButton(rxTopRight, -1, "Select")
	self.clearSearchedRxBtn = wxButton (rxTopRight, -1, "Clear")
	
	self.rxSearchResultsGrid = wxGrid(rxTopRight, -1)
        self.rxSearchResultsGrid.CreateGrid(0, 3)
        self.rxSearchResultsGrid.SetColLabelValue(0,"Foundry")
        self.rxSearchResultsGrid.AutoSizeColumn(0)
        self.rxSearchResultsGrid.SetColLabelValue(1,"Aux")
        self.rxSearchResultsGrid.SetColLabelValue(2,"Reactions")
        self.rxSearchResultsGrid.AutoSizeColumn(2)
       
        rxTopRightMainSizer   = wxBoxSizer(wxVERTICAL)
        rxTRHChoicesSizer     = wxBoxSizer(wxHORIZONTAL)

        rxTRHChoicesSizer.Add(self.selectRxBtn, 0, 0, 0, 0)
        rxTRHChoicesSizer.Add(self.clearSearchedRxBtn, 0, 0, 0, 0)
        
        rxTopRightMainSizer.Add (self.rxSearchResultsGridLabel)
        rxTopRightMainSizer.Add (self.rxSearchResultsGrid, 7, wxEXPAND)
        rxTopRightMainSizer.Add (rxTRHChoicesSizer)
        
        rxTopRight.SetSizer(rxTopRightMainSizer)
        rxTopRight.SetAutoLayout(true)

        #rxBottom

        self.rxSelectedRxGridLabel     = wxStaticText(rxBottom, -1, "Selected Reactions")
        self.clearSelectedRxBtn = wxButton(rxBottom, -1, "Clear")
        self.rxSelectedResultsGrid     = wxGrid(rxBottom, -1)

        self.rxSelectedResultsGrid.CreateGrid(0, 3)
        self.rxSelectedResultsGrid.SetColLabelValue(0,"Foundry")
        self.rxSelectedResultsGrid.AutoSizeColumn(0)
        self.rxSelectedResultsGrid.SetColLabelValue(1,"Aux")
        self.rxSelectedResultsGrid.SetColLabelValue(2,"Reactions")
        self.rxSelectedResultsGrid.AutoSizeColumn(2)
       
        rxBottomMainSizer   = wxBoxSizer(wxVERTICAL)

        rxBottomMainSizer.Add (self.clearSelectedRxBtn)
        rxBottomMainSizer.Add (self.rxSelectedRxGridLabel)
        rxBottomMainSizer.Add (self.rxSelectedResultsGrid, 4, wxEXPAND)
                
        rxBottom.SetSizer(rxBottomMainSizer)
        rxBottom.SetAutoLayout(true)



        #Rx on/off
        #  turn off except for text...so lock down to just one
        #  capability
        
        self.orAndRxComboBox.Enable(False)
        self.ecNameComboBox.Enable(False)
        self.hasEnzymesText.Enable(true)

        return
    #------------------------------------------------------------------------
    def metPanelLayout(self):
    #------------------------------------------------------------------------
  
        
        # metabolites page
        
        self.metPanel = wxSplitterWindow(self.notebook, -1)
        metTop = wxSplitterWindow(self.metPanel, -1)
        metTopLeft = wxPanel(metTop, -1)
        #$$metTopRight =wxPanel(metTop, -1)
        
        #test case

        self.theBssPanel = wxPanel(metTop, -1)
        theHBssSizer = wxBoxSizer(wxHORIZONTAL)
        theVBssSizer = wxBoxSizer(wxVERTICAL)

        self.clearSearchResultsBtn = wxButton(self.theBssPanel, -1, "Clear")
        self.selectSearchResultsBtn = wxButton(self.theBssPanel, -1, "Select")

        self.bssLabel = wxStaticText(self.theBssPanel, -1, "Search Results")
        
        self.bssGrid = wxGrid(self.theBssPanel, -1)
        self.bssGrid.CreateGrid(0, 4)
        self.bssGrid.SetColLabelValue(0,"Foundry")
        self.bssGrid.AutoSizeColumn(0)
        self.bssGrid.SetColLabelValue(1,"Comp. Name")
        self.bssGrid.AutoSizeColumn(1)
        self.bssGrid.SetColLabelValue(2,"Aux")
        self.bssGrid.AutoSizeColumn(2)
        self.bssGrid.SetColLabelValue(3,"Class")
        self.bssGrid.AutoSizeColumn(3)
        

        theVBssSizer.Add(self.bssLabel, 0, wxEXPAND, 2)
        theVBssSizer.Add(self.bssGrid,4 , wxEXPAND , 0)

        theHBssSizer.Add(self.clearSearchResultsBtn, 0, wxALIGN_RIGHT, 0,0)
        theHBssSizer.Add(self.selectSearchResultsBtn, 0, wxALIGN_RIGHT, 0,0)

        
        theVBssSizer.Add(theHBssSizer, 1, 0, 0)
        self.theBssPanel.SetSizer(theVBssSizer)
        self.theBssPanel.SetAutoLayout(true)

        metTopRight = self.theBssPanel
                
        #metBottom
        metBottom = wxPanel(self.metPanel, -1)
        self.clearSelectedMetabsBtn = wxButton(metBottom, -1, "Clear")
        self.selectedMetabsGrid = wxGrid(metBottom, -1)


        #metTopLeft
                        
        #$self.optionsShortComboBox = wxComboBox(metTopLeft, -1,
        #$                            "Equals", choices=["Equals", "Contains" ],
        #$                             style=wxCB_DROPDOWN |wxCB_READONLY)
        #$self.optionsShortComboBox.SetValue( "Equals")
        self.optionsLongComboBox  = wxComboBox(metTopLeft, -1, "Contains",
                                    choices=["Equals", "Contains" ],
                                     style=wxCB_DROPDOWN |wxCB_READONLY )

        self.optionsLongComboBox.SetValue( "Contains" )

        #$self.orAndMetabsComboBox  = wxComboBox(metTopLeft, -1, "Or", choices=["Or", "And"],
        #$                         style=wxCB_DROPDOWN|wxCB_READONLY )
        #$self.orAndMetabsComboBox.SetValue("Or")

        #$self.shortLabel         = wxStaticText(metTopLeft, -1, "Short Name")
        #$self.shortText          = wxTextCtrl(metTopLeft, -1, "", size=(170, -1))
        
        self.longLabel       = wxStaticText(metTopLeft, -1, "Compound Name")
        self.longText        = wxTextCtrl(metTopLeft, -1, "", size=(170, -1))
        self.searchMetabsBtn = wxButton(metTopLeft, -1, "Search")
        self.addMetabsBtn    = wxButton(metTopLeft, -1, "Add")


        metLMainSizer       = wxBoxSizer(wxVERTICAL)
        metLVShortLongSizer = wxBoxSizer(wxVERTICAL)
        metLHSearchAddSizer = wxBoxSizer(wxHORIZONTAL)
        #$$$metLHMainSizer      = wxBoxSizer(wxHORIZONTAL)
        #$metLHShortSizer     = wxBoxSizer(wxHORIZONTAL)
        metLHLongSizer      = wxBoxSizer(wxHORIZONTAL)

        #$metLHShortSizer.Add(self.optionsShortComboBox, 0, wxEXPAND)
        #$metLHShortSizer.Add(self.shortText, 0, wxEXPAND, 0)
        # we're in the process of removing short-text capabilities.  so, disable
        #self.shortText.Enable(false)

        metLHLongSizer.Add(self.optionsLongComboBox, 0, wxEXPAND)
        metLHLongSizer.Add(self.longText, 0, wxEXPAND, 0)

        metLHSearchAddSizer.Add(self.searchMetabsBtn)
        metLHSearchAddSizer.Add(self.addMetabsBtn)
               
        #$$metLVShortLongSizer.Add( 20, 20, 0, wxEXPAND)
        #$metLVShortLongSizer.Add(20, 20, 0, wxEXPAND)
        #metLVShortLongSizer.Add(self.shortLabel, 0, wxADJUST_MINSIZE|wxGROW)
        #$metLVShortLongSizer.Add(metLHShortSizer)
        #$$metLVShortLongSizer.Add(20, 20, 0, wxEXPAND)
        #$metLVShortLongSizer.Add(self.orAndMetabsComboBox)
        #$metLVShortLongSizer.Add(20, 20, 0, wxEXPAND)

        metLVShortLongSizer.Add(self.longLabel)
        metLVShortLongSizer.Add(metLHLongSizer)
        
        metLMainSizer.Add((20, 20), 0, wxEXPAND)
        metLMainSizer.Add(metLVShortLongSizer, wxGROW|wxADJUST_MINSIZE|wxALL,0)
        metLMainSizer.Add((20, 20), 0, wxEXPAND)
        metLMainSizer.Add(metLHSearchAddSizer, 0, wxGROW|wxADJUST_MINSIZE|wxALL)
        
        metTopLeft.SetSizer(metLMainSizer)
        metTopLeft.SetAutoLayout(true)

        # $$ migration question: should really be wxSize
        metTopLeft.SetSize((241, 227))
        metTopRight.SetSize((251, 227))

        
        self.selectedMetabsGrid.CreateGrid(0, 3)
        self.selectedMetabsGrid.SetColLabelValue(0,"Foundry")
        self.selectedMetabsGrid.AutoSizeColumn(0)
        self.selectedMetabsGrid.SetColLabelValue(1,"Comp. Name")
        self.selectedMetabsGrid.AutoSizeColumn(1)
        self.selectedMetabsGrid.SetColLabelValue(2,"Aux")
        
        metTop.SplitVertically(metTopLeft, metTopRight, 360)
        metBottom.SetSize((486, 224))
        self.metPanel.SetSize((490, 800))
        self.metPanel.SplitHorizontally(metTop, metBottom, 270)
   
        
                
        #MetBottom
        metVBottomSizer = wxBoxSizer(wxVERTICAL)

        staticBox = wxStaticBox(metBottom, -1, "Selected Metabolites")
        staticBoxSizer= wxStaticBoxSizer(staticBox, wxHORIZONTAL)
        staticBoxSizer.Add(self.selectedMetabsGrid,1, wxEXPAND, 0)
        
        metVBottomSizer.Add((20, 20),0, wxEXPAND)
        metVBottomSizer.Add(self.clearSelectedMetabsBtn, 0, 0, 0)
        metVBottomSizer.Add(staticBoxSizer, 1, wxEXPAND|wxRIGHT, 5)
        
        metBottom.SetSizer(metVBottomSizer)
        metBottom.SetAutoLayout(true)



        return
            
    #------------------------------------------------------------------------
    def rePanelLayout(self):
    #------------------------------------------------------------------------

        self.rePanel     = wxSplitterWindow(self.notebook, -1)
        reTreePanel = wxPanel(self.rePanel, -1)
        reListPanel = wxPanel(self.rePanel, -1)

        self.rePanel.SplitVertically(reTreePanel, reListPanel, 300)


        self.tree_ctr = wxTreeCtrl(reTreePanel, -1,
                                   style=wxTR_HAS_BUTTONS|wxSUNKEN_BORDER
                                   | wxTR_HIDE_ROOT)

        # this list_box should be a listCtrl???  need to associate data
        # with the items.  for now, we make a dictionary in parallel to
        # handle it.
        
        self.list_box = wxListBox(reListPanel, -1, style=wxLB_SINGLE|wxLB_HSCROLL,  choices=[""])
        self.list_boxData = {}

        self.tree_ctr.SetSize((300, 500))
        self.list_box.SetSize((300, 500))

        reTreeSizer = wxBoxSizer(wxHORIZONTAL)
        reTreeSizer.Add(self.tree_ctr, 1, wxEXPAND, 0)
        reTreePanel.SetSizer(reTreeSizer)
        reTreePanel.SetAutoLayout(true)

        reListSizer = wxBoxSizer(wxHORIZONTAL)
        reListSizer.Add(self.list_box, 1, wxEXPAND, 0)
        reListPanel.SetSizer(reListSizer)
        reListPanel.SetAutoLayout(true)
                
        return

    #------------------------------------------------------------------------
    def menuBar(self):
    #------------------------------------------------------------------------
    
        self.theMainMenuBar = wxMenuBar()
       
        # *only* Layout/creation here.  The rest of the setup is done
        # in the MainMenuBar class.

        return  self.theMainMenuBar
    
    #------------------------------------------------------------------------    
    def showLayout(self):
    #------------------------------------------------------------------------
        #put it here in case layout needs to done before init

        self.catPanelLayout()
        self.htmlPanelLayout()
        self.enzymePanelLayout()
        self.rxPanelLayout()
        self.metPanelLayout()
        self.rePanelLayout()
        self.menuBar()
        self.createFoundryComboBox()

        
        self.SetTitle("MONERA Model Editor")
        self.SetSize((500,482))
        

        mainTopSizer = wxBoxSizer(wxVERTICAL)
        mainLeftSizer = wxBoxSizer(wxVERTICAL)
        leftSizer = wxBoxSizer(wxHORIZONTAL)

        #$$ migration question mainLeftSizer.Add(800, 20, 0, 0, 0)
        #$$ and leftSizer.Add(1, 600, 0, 0, 0)
        mainLeftSizer.Add((800, 20), 0, 0, 0)
        leftSizer.Add((1, 600), 0, 0, 0)
        
        self.notebook.AddPage(self.catPanel, "Catalog")
        self.notebook.AddPage(self.rePanel, "Navigator")
        self.notebook.AddPage(self.rxPanel, "Reactions")
        self.notebook.AddPage(self.metPanel, "Metabolites")
        self.notebook.AddPage(self.enzymesPanel, "Enzymes")
        self.notebook.AddPage(self.helpHtmlPanel, "Help")
    
        leftSizer.Add(wxNotebookSizer(self.notebook), 1, wxEXPAND, 0)
        mainLeftSizer.Add(leftSizer, 1, wxEXPAND, 0)
        mainTopSizer.Add(self.dataFactoryLabel, 0, wxALIGN_RIGHT)
        mainTopSizer.Add(self.foundryComboBox, 0, wxALIGN_RIGHT)
        mainTopSizer.Add(mainLeftSizer, 1, wxEXPAND, 0)
        self.SetMenuBar( self.theMainMenuBar )
        self.SetSizer(mainTopSizer)
        mainTopSizer.Fit(self)
        mainTopSizer.SetSizeHints(self)
        self.Layout()
       

# end of class MainFrame




MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3