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

View of /PyGUI/DoubleTextEntryDialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (download) (as text) (annotate)
Wed Jul 14 16:33:26 2004 UTC (15 years, 3 months ago) by hwang
Branch: MAIN
CVS Tags: V00-00-03, MigrateToNewPackage, forRick-14Jul04-0, mass-spec-01, mass-spec-03, mass-spec-02, forRick-14Jul04-1, HEAD
Changes since 1.3: +6 -7 lines
	Add changes to dialog size

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