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

View of /ModelEditor/EnzAddEnzDialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Fri Mar 11 21:33:13 2005 UTC (13 years, 8 months ago) by efrank
Branch: MAIN
CVS Tags: before-dynamics-persistence, treatman-lastDay-0, preTreatmanDyn, lwc, HEAD
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

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


class EnzAddEnzDialog(wxDialog):
    """
    Add an enzyme to the chemistry database
    """

    #------------------------------------------------------------------------
    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.enzNameText = wxTextCtrl(self.onAddPagePanel, -1, "", size=(170, -1))
        self.enzNamePrompt = wxStaticText(self.onAddPagePanel, -1, "Enzyme name:")
        #self.hasECNumberComboBox = wxComboBox(self.onAddPagePanel, -1, "No",
        #                                     size=(50,-1), choices = ["No", "Yes"],
        #                                     style=wxCB_DROPDOWN | wxCB_READONLY)
        #self.hasECNumberComboBox.SetValue( "No")

        self.ecNumberText = wxTextCtrl(self.onAddPagePanel, -1, "", size=(170, -1))
        self.ecNumberPrompt = wxStaticText(self.onAddPagePanel, -1, "EC number, if it exists: ")
        self.ecNumberPrompt3 = wxStaticText(self.onAddPagePanel, -1, "Format 5.5.5.5 or 5.5.-.-. Do NOT include 'EC'")

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


        onAddPageMainSizer   = wxBoxSizer(wxVERTICAL)
        enzNameHSizer  = wxBoxSizer(wxHORIZONTAL)
        ecNumberVSizer  = wxBoxSizer(wxVERTICAL)
        ecNumberQueryHSizer  = wxBoxSizer(wxHORIZONTAL)
        dialogChoicesHSizer  = wxBoxSizer(wxHORIZONTAL)

        enzNameHSizer.Add(self.enzNamePrompt)
        enzNameHSizer.Add(self.enzNameText)

        ecNumberQueryHSizer.Add(self.ecNumberPrompt)
        #ecNumberQueryHSizer.Add(self.hasECNumberComboBox, 0, wxEXPAND)
        #ecNumberQueryHSizer.Add(self.ecNumberPrompt2)
        ecNumberQueryHSizer.Add(self.ecNumberText)

        ecNumberVSizer.Add( ecNumberQueryHSizer )
        ecNumberVSizer.Add( self.ecNumberPrompt3 )
                
        dialogChoicesHSizer.Add (self.addDialogBtn)
        dialogChoicesHSizer.Add (self.cancelDialogBtn)

        onAddPageMainSizer.Add (enzNameHSizer)
        onAddPageMainSizer.Add ((20,20), 0, wxEXPAND)
        onAddPageMainSizer.Add (ecNumberVSizer)
        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):
    #------------------------------------------------------------------------
        
        enzName  = self.enzNameText.GetValue().strip()
        #hasECNumber = self.hasECNumberComboBox.GetValue()
        ec = self.ecNumberText.GetValue().strip()

        return (enzName, ec)

    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3