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

View of /ModelEditor/DoubleTextEntryDialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Mon Jan 31 16:52:09 2005 UTC (13 years, 9 months ago) by efrank
Branch: MAIN
CVS Tags: before-dynamics-persistence, lwc, treatman-lastDay-0, preTreatmanDyn, HEAD
Changes since 1.1: +2 -2 lines
migration to wxPy 2.5.1.5.  basic function on mac now ok.

from wxPython.wx import *


class DoubleTextEntryDialog(wxDialog):
#    def __init__(self, parent, ID, title,prompt=("First", "Second"),
#    def onDialogCancel(self, evt):
#    def onDialogOK(self, evt):
#    def GetValue(self):
    
    def __init__(self, parent, ID, title,prompt=("First", "Second"),
                 pos=wxDefaultPosition, size=(500,500),
                 style=wxMAXIMIZE_BOX):
                 
        wxDialog.__init__(self, parent, ID, title, pos, size, style)
                                        
        self.firstText = None
        self.secondText  = None

        firstTxtDialogLabel  = wxStaticText(self, -1, prompt[0])
        secondTxtDialogLabel   = wxStaticText(self, -1, prompt[1])
         
        self.firstTxtDialogText     = wxTextCtrl(self, -1, "", size=(170, -1))
        self.secondTxtDialogText    = wxTextCtrl(self, -1, " ", size=(90, -1))

        okDialogBtn       = wxButton(self, -1, "ok")
        cancelDialogBtn   = wxButton(self, -1, "cancel")


        dialogMainSizer      = wxBoxSizer(wxVERTICAL)
        dialogFirstHSizer    = wxBoxSizer(wxHORIZONTAL)
        dialogSecondHSizer   = wxBoxSizer(wxHORIZONTAL)
        dialogChoicesHSizer  = wxBoxSizer(wxHORIZONTAL)

        
        dialogFirstHSizer.Add (firstTxtDialogLabel)
        dialogFirstHSizer.Add ((20,20), 0, 0, 0)
        dialogFirstHSizer.Add (self.firstTxtDialogText)
        
        
        dialogSecondHSizer.Add (secondTxtDialogLabel)
        dialogSecondHSizer.Add ((20,20), 0, 0, 0)
        dialogSecondHSizer.Add (self.secondTxtDialogText, 0, wxALIGN_RIGHT)
        

        dialogChoicesHSizer.Add (okDialogBtn)
        dialogChoicesHSizer.Add (cancelDialogBtn)
                              
        dialogMainSizer.Add(dialogFirstHSizer, 0, wxEXPAND, 2)
        dialogMainSizer.Add(dialogSecondHSizer, 0, wxEXPAND, 2)
        dialogMainSizer.Add(dialogChoicesHSizer, 0, wxEXPAND, 2)

        self.SetSizer(dialogMainSizer)
        self.SetAutoLayout(true)
                
                
        EVT_BUTTON(self, cancelDialogBtn.GetId(), self.onDialogCancel)
        EVT_BUTTON(self, okDialogBtn.GetId(),     self.onDialogOK)
 

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

    def onDialogOK(self, evt):
        self.secondText = self.secondTxtDialogText.GetValue()
        self.firstText = self.firstTxtDialogText.GetValue()
        self.EndModal(wxID_OK)
        return

    def GetValue(self):
        return (self.firstText[:], self.secondText[:])



MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3