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

View of /ModelEditor/MetAddMetDialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue Feb 8 16:51:29 2005 UTC (14 years, 6 months ago) by efrank
Branch: MAIN
CVS Tags: before-dynamics-persistence, treatman-lastDay-0, preTreatmanDyn, lwc, HEAD
move exporter to Cytoscape out to its own module.
get the isClass attrib up into the model editor for viewing/setting.

from wxPython.wx import *
from wxPython.grid import *

from KahOM.Reactant         import Reactant


class MetAddMetDialog(wxDialog):

    #------------------------------------------------------------------------
    def __init__(self, parent, ID, title,
                 pos=wxDefaultPosition, size=wxDefaultSize,
                 style=wxDEFAULT_DIALOG_STYLE):
    #------------------------------------------------------------------------

        
        wxDialog.__init__(self, parent, ID, title, pos, size, style)
        
        self.parent= parent
        
        self.onAddPagePanel  = wxPanel(self, -1)

        self.metNameText = wxTextCtrl(self.onAddPagePanel, -1, "", size=(170, -1))
        self.metNamePrompt = wxStaticText(self.onAddPagePanel, -1, "Specie name:")

        self.isClassLabel = wxStaticText(self.onAddPagePanel, -1, "Is class: ")
        self.isClassComboBox = wxComboBox(self.onAddPagePanel, -1, "Specific",
                                             size=(150,-1), choices = ["Class", "Specific", "Unknown"],
                                             style=wxCB_DROPDOWN | wxCB_READONLY)
        self.isClassComboBox.SetValue( "Unknown")

        self.addDialogBtn       = wxButton(self.onAddPagePanel,-1, "add")
        self.cancelDialogBtn    = wxButton(self.onAddPagePanel, wxID_CANCEL, "cancel")


        onAddPageMainSizer   = wxBoxSizer(wxVERTICAL)
        metNameHSizer  = wxBoxSizer(wxHORIZONTAL)
        isClassHSizer  = wxBoxSizer(wxHORIZONTAL)
        dialogChoicesHSizer  = wxBoxSizer(wxHORIZONTAL)

        metNameHSizer.Add(self.metNamePrompt)
        metNameHSizer.Add(self.metNameText)

        isClassHSizer.Add(self.isClassLabel)
        isClassHSizer.Add(self.isClassComboBox, 0, wxEXPAND)
                
        dialogChoicesHSizer.Add (self.addDialogBtn)
        dialogChoicesHSizer.Add (self.cancelDialogBtn)

        onAddPageMainSizer.Add (metNameHSizer)
        onAddPageMainSizer.Add ((20,20), 0, wxEXPAND)
        onAddPageMainSizer.Add (isClassHSizer)
        onAddPageMainSizer.Add ((20,20), 0, wxEXPAND)
        onAddPageMainSizer.Add (dialogChoicesHSizer)
        self.onAddPagePanel.SetSizer(onAddPageMainSizer)
        self.onAddPagePanel.SetAutoLayout(true)

        EVT_BUTTON(self, self.cancelDialogBtn.GetId(), self.onDialogCancel)
        EVT_BUTTON(self, self.addDialogBtn.GetId(),     self.onDialogAdd)

        return

    #------------------------------------------------------------------------
    def onDialogCancel(self, evt):
    #------------------------------------------------------------------------
        self.EndModal(wxID_CANCEL)
        self.Destroy()
        return

    #------------------------------------------------------------------------
    def onDialogAdd(self, evt):
    #------------------------------------------------------------------------
        self.EndModal(wxID_OK)
        #self.Destroy()
        return


    #------------------------------------------------------------------------
    def GetValue( self):
    #------------------------------------------------------------------------
        # Not really right...what if the selected goobers come from different
        # factories?  Then mixing this all together doesn't make sense. since
        # we dont' track the foundryItemKey stuff right yet, we don't get
        # in trouble.  but its all a pack of lies at the moment.
        
        
        isClass = self.isClassComboBox.GetValue()
        spName  = self.metNameText.GetValue()

        return (spName, isClass)

    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3