On Tuesday, September 28, 2010 01:31:44 pm Jeff Johnson wrote:
> Number 2. Thanks Ed. I will try it.
>
> Jeff
>
> ---------------
>
> Jeff Johnson
> [email protected]
> (623) 582-0323
>
> www.san-dc.com
>
> On 09/28/2010 12:54 PM, Ed Leafe wrote:
> > On Sep 28, 2010, at 3:32 PM, Jeff Johnson wrote:
> >> I would like to create a single form application.
> >>
> > You mean an MDI design, where the main form contains one or more
> > subforms?
> >
> >> I tried just adding a
> >> panel to the FrmMain but that did not work. It is expecting a second
> >> parameter which should be a wxwindow. There is no data, just buttons
> >> that run some python scripts.
> >>
> > Or do you just want something like this:
> > class MyForm(dabo.ui.dForm):
> > def afterInit(self):
> > [ ...add your controls here]
> >
> > if __name__ == "__main__":
> > app = dabo.dApp(MainFormClass=MyForm)
> > app.start()
> >
> > -- Ed Leafe
Ok here is a non-working framework of a hand coded form.
# -*- coding: utf-8 -*-
#/usr/bin/env python
import wx
import dabo
dabo.settings.dateFormat ="%m/%d/%Y"
import dabo.dEvents as dEvents
import dabo.dException as dException
#from profilehooks import profile, coverage
dabo.ui.loadUI('wx')
from dabo.ui import dKeys as dKeys
class MainForm(dabo.ui.dForm):
def createBizobjs(self):
#below is not required because the default is to find all cdxml files.
self.Application.addConnectFile("pes.cnxml")
# This call will actually create the connection if it hasn't already
# been made. If it has, it returns the existing connection, so that
# multiple connections aren't used up.
self.conn = self.Application.getConnectionByName("PesConn")
class SomeTable_Bizobj(dabo.biz.dBizobj):
def initProperties(self):
pass
def afterInit(self):
self.DataSource = "sometable"
self.addFrom( "public.esagency")
self.addField("inactive")
self.addField("name_1")
self.addField("address")
self.addField("city")
self.addField("state_1")
self.addField("zip")
self.addField("plus4")
self.addField("phone")
self.addField("phoneext")
self.addField("county")
self.addField("notify_1")
self.addField("note")
self.addField("fk_county")
self.addField("pkid")
self.KeyField = "pkid"
self.NonUpdateFields=["pkid"]
self.DefaultValues={"state_1":'CA'}
def validateRecord(self):
"""Returning anything other than an empty string from
this method will prevent the data from being saved.
"""
ret = ""
# Add your business rules here.
return ret
self.esclient=SomeTable_Bizobj(self.conn)
self.addBizobj(self.esclient)
def afterInit(self):
"""Normally the programmer would add code to display the controls
here. The programmer could add panels that contain other controls etc. """
self.Caption = "Replace with a Window Title"
def afterInitAll(self):
pass
def initProperties(self):
pass
if __name__ == "__main__":
app = dabo.dApp()
app.MainFormClass = MainForm
app.start()
Johnf
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]