[dabo-users] Trying to use multiple Bizobjects in a parent-child relationship

2011-01-22 Thread David Martinez
In my biz folder, I have two files that were automatically created by 
the ClassDesigner:

PubliccustomerBizobj.py
PublichistoryBizobj.py

In my biz folder, my __init__.py file contains the following:


from PubliccustomerBizobj import PubliccustomerBizobj
from PublichistoryBizobj import PublichistoryBizobj



My customer class looks like this:

class PubliccustomerBizobj(dabo.biz.dBizobj):
 def afterInit(self):
 self.DataSource = public.customer
 self.KeyField = id
 self.addFrom(public.customer)
 self.addField(cu_fax)
 self.addField(cu_postal)
 self.addField(cu_phone_2)
 self.addField(cu_providence)
 self.addField(cu_phone_1)
 self.addField(cu_active)
 self.addField(cu_country)
 self.addField(cu_city)
 self.addField(cu_rate)
 self.addField(cu_name)
 self.addField(cu_comments)
 self.addField(cu_primary_contact_id)
 self.addField(cu_address_1)
 self.addField(cu_address_2)
 self.addField(cu_address_3)
 self.addField(id)

 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


PubliccustomerBizobj.addChild(PublichistoryBizobj)




My history class looks like this:

class PublichistoryBizobj(dabo.biz.dBizobj):
 def afterInit(self):
 self.DataSource = public.history
 self.KeyField = id
 self.LinkField = hs_customer_id
 self.addFrom(public.history)
 self.addField(hs_subject)
 self.addField(hs_type)
 self.addField(hs_datetime)
 self.addField(hs_comments)
 self.addField(id)

 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



However, when I try to run the application, the error I receive is this:

NameError: name 'PublichistoryBizobj' is not defined.



This error  references the 
PubliccustomerBizobj.addChild(PublichistoryBizobj) line. Why is this 
occurring?


___
Post Messages to: Dabo-users@leafe.com
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/4d3aaf24.7000...@contouredsolutions.com


Re: [dabo-users] Hand coded form with .cdxml panel: exception

2011-01-22 Thread Sibylle Koczian
Hello,

Am 16.01.2011 14:17, schrieb Sibylle Koczian:
 Hello,

 Am 15.01.2011 22:38, schrieb Ed Leafe:
 On Jan 13, 2011, at 10:53 AM, Sibylle Koczian wrote:

 Done, here it is:

 http://dabo.codepad.org/ZhkzIwkr

 OK, thanks, that helped. Turns out that some of the column properties
 were choking because their underlying attributes had not been
 initialized. I've posted a fix; let me know if that works for you.


 My first answer wasn't complete: I just ran my test application and that
 worked. But now I tried to load that panel again into the ClassDesigner
 and got a new exception:

 sib@gespenst-xubuntu:~/bin/dabosib$ ~/src/dabo-trunk/ide/ClassDesigner.py
 Traceback (most recent call last):
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 4417, in
 module
   clsDes = ClassDesigner(f)
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 256, in
 __init__
   frm = self.onNewDesign(None)
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 2035, in
 onNewDesign
   return self.openClass(dlg.fileToOpen)
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 744, in
 openClass
   obj = self.recreateChildren(frm.mainPanel, kids, None, False)
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 1249, in
 recreateChildren
   ret = self._recreateControl()
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 1023, in
 _recreateControl
   self.recreateChildren(obj, kids, None, False)
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 1244, in
 recreateChildren
   ret = self._recreateLayoutSizer()
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 874, in
 _recreateLayoutSizer
   self.recreateChildren(parent, [kid], sz, True)
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 1249, in
 recreateChildren
   ret = self._recreateControl()
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 1010, in
 _recreateControl
   self._recreateKidsForGrid(obj, kids)
 File /home/sib/src/dabo-trunk/ide/ClassDesigner.py, line 1038, in
 _recreateKidsForGrid
   typ = type(getattr(col, kprop))
 AttributeError: 'controlMix' object has no attribute 'classID'
 sib@gespenst-xubuntu:~/bin/dabosib$ ~/src/dabo-trunk/ide/ClassDesigner.py

 That doesn't happen if I load a saved panel without a grid or if I load
 a saved form.

 Latest version information:

 Platform: GTK
 Python Version: 2.6.6 on linux2
 Dabo Version: Version 0.9.3; Revision 6321M
 UI Version: 2.8.11.0 on wxGTK (gtk2)


No change with Rev. 6334. Should I perhaps open a ticket on the tracker, 
so this doesn't get lost?

Greetings,
Sibylle
___
Post Messages to: Dabo-users@leafe.com
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/4d3ab028.5030...@t-online.de


Re: [dabo-users] Trying to use multiple Bizobjects in a parent-child relationship

2011-01-22 Thread John Fabiani
On Saturday, January 22, 2011 02:19:16 am David Martinez wrote:
 In my biz folder, I have two files that were automatically created by
 the ClassDesigner:
 
 PubliccustomerBizobj.py
 PublichistoryBizobj.py
 
 In my biz folder, my __init__.py file contains the following:
 
 
 from PubliccustomerBizobj import PubliccustomerBizobj
 from PublichistoryBizobj import PublichistoryBizobj
 
 
 
 My customer class looks like this:
 
 class PubliccustomerBizobj(dabo.biz.dBizobj):
  def afterInit(self):
  self.DataSource = public.customer
  self.KeyField = id
  self.addFrom(public.customer)
  self.addField(cu_fax)
  self.addField(cu_postal)
  self.addField(cu_phone_2)
  self.addField(cu_providence)
  self.addField(cu_phone_1)
  self.addField(cu_active)
  self.addField(cu_country)
  self.addField(cu_city)
  self.addField(cu_rate)
  self.addField(cu_name)
  self.addField(cu_comments)
  self.addField(cu_primary_contact_id)
  self.addField(cu_address_1)
  self.addField(cu_address_2)
  self.addField(cu_address_3)
  self.addField(id)
 
  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
 
 
 PubliccustomerBizobj.addChild(PublichistoryBizobj)
 
 
 
 
 My history class looks like this:
 
 class PublichistoryBizobj(dabo.biz.dBizobj):
  def afterInit(self):
  self.DataSource = public.history
  self.KeyField = id
  self.LinkField = hs_customer_id
  self.addFrom(public.history)
  self.addField(hs_subject)
  self.addField(hs_type)
  self.addField(hs_datetime)
  self.addField(hs_comments)
  self.addField(id)
 
  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
 
 
 
 However, when I try to run the application, the error I receive is this:
 
 NameError: name 'PublichistoryBizobj' is not defined.
 
 
 
 This error  references the
 PubliccustomerBizobj.addChild(PublichistoryBizobj) line. Why is this
 occurring?

Not sure but it appears that you are missing the self.ParentLinkField for the 
child bizobj.
self.ParentLinkField = 'id'

Johnf
___
Post Messages to: Dabo-users@leafe.com
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/201101220849.15428.jo...@jfcomputer.com


Re: [dabo-users] Trying to use multiple Bizobjects in a parent-child relationship

2011-01-22 Thread Ed Leafe
On Jan 22, 2011, at 5:19 AM, David Martinez wrote:

 PubliccustomerBizobj.addChild(PublichistoryBizobj)

Here you are adding a class to a class inside a class definition; that 
won't work. You need to work with instances:

biz = self.Application.biz
cust = biz.PubliccustomerBizobj()
hist = biz.PublichistoryBizobj()
cust.addChild(hist)

Generally, this code would go in the form's createBizobjs() method; 
note that I added a reference to the biz module, which is where these modules 
will be defined in your app.


-- Ed Leafe



___
Post Messages to: Dabo-users@leafe.com
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/3a473139-6c3e-455c-a056-4298d5070...@leafe.com


Re: [dabo-users] Trying to use multiple Bizobjects in a parent-child relationship

2011-01-22 Thread Ed Leafe
On Jan 22, 2011, at 11:49 AM, John Fabiani wrote:

 Not sure but it appears that you are missing the self.ParentLinkField for the 
 child bizobj.
 self.ParentLinkField = 'id'


That won't hurt anything, but is not necessary, since 'id' is the 
KeyField of the parent. ParentLinkField is only needed when a child is linked 
to something other than the parent's KeyField; otherwise, the KeyField is 
assumed.



-- Ed Leafe



___
Post Messages to: Dabo-users@leafe.com
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/487c7449-4304-4922-b7a9-a6649de96...@leafe.com


Re: [dabo-users] Mini-mac and my code

2011-01-22 Thread Henning Hraban Ramm
Am 2011-01-22 um 20:31 schrieb John Fabiani:

 The tabs are not tabs.  dPageFrame with appended pages looks like a  
 bar across
 the top with push buttons.

Completely normal Mac UI, like it or not.

 dButtons with with background colors do not
 display the background color and strangely the backcolor appears  
 when the form
 loses focus.  The background color creates a rectangular around the  
 rounded
 button (Mac buttons have rounded corners - oval) - strange!

I never tried background colors for buttons (IMHO it makes no sense to  
break the default look of any OS)...




Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net
https://www.cacert.org (I'm an assurer)




___
Post Messages to: Dabo-users@leafe.com
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/d1ee6ec9-ffee-4802-954f-403c8a096...@fiee.net


Re: [dabo-users] Hand coded form with .cdxml panel: exception

2011-01-22 Thread Sibylle Koczian
Am 22.01.2011 18:44, schrieb Ed Leafe:
 On Jan 22, 2011, at 5:23 AM, Sibylle Koczian wrote:

 No change with Rev. 6334. Should I perhaps open a ticket on the tracker,
 so this doesn't get lost?


   Normally, that would be a good idea, but I think it should be OK now; I 
 just posted a fix. Let me know how it works.


Thank you, yes, that works. I can load the panel class into the class 
designer, edit and save it and the changed application runs.

Very nice!

Sibylle
___
Post Messages to: Dabo-users@leafe.com
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/4d3b34d2.6030...@t-online.de


Re: [dabo-users] Mini-mac and my code

2011-01-22 Thread John Fabiani
On Saturday, January 22, 2011 11:48:47 am Henning Hraban Ramm wrote:
 Am 2011-01-22 um 20:31 schrieb John Fabiani:
  The tabs are not tabs.  dPageFrame with appended pages looks like a
  bar across
  the top with push buttons.
 
 Completely normal Mac UI, like it or not.
 
  dButtons with with background colors do not
  display the background color and strangely the backcolor appears
  when the form
  loses focus.  The background color creates a rectangular around the
  rounded
  button (Mac buttons have rounded corners - oval) - strange!
 
 I never tried background colors for buttons (IMHO it makes no sense to
 break the default look of any OS)...
 
 
 
 
 Greetlings from Lake Constance!
 Hraban
 ---
 http://www.fiee.net
 https://www.cacert.org (I'm an assurer)

I understand the argument but I see many apps where the buttons have a 
background color (even the OS dialogs).   So as far as the buttons not 
displaying the background colors correctly was a surprise.  

The other thing that has caught me off guard was the lack of Developer info.  

Johnf
___
Post Messages to: Dabo-users@leafe.com
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/201101221234.13487.jo...@jfcomputer.com


Re: [dabo-users] Mini-mac and my code

2011-01-22 Thread Ed Leafe
On Jan 22, 2011, at 3:34 PM, John Fabiani wrote:

 I understand the argument but I see many apps where the buttons have a 
 background color (even the OS dialogs).   So as far as the buttons not 
 displaying the background colors correctly was a surprise.  


Can you name one such example?



-- Ed Leafe



___
Post Messages to: Dabo-users@leafe.com
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/eb917ed9-9a05-45b7-afdf-dc418390b...@leafe.com


Re: [dabo-users] Mini-mac and my code

2011-01-22 Thread John Fabiani
On Saturday, January 22, 2011 01:34:36 pm Ed Leafe wrote:
 On Jan 22, 2011, at 3:34 PM, John Fabiani wrote:
  I understand the argument but I see many apps where the buttons have a
  background color (even the OS dialogs).   So as far as the buttons not
  displaying the background colors correctly was a surprise.
 
   Can you name one such example?
 
 
 
 -- Ed Leafe
Yes xTuple - has them and I assume the dialogs that appear are the ones from 
the OS.

Johnf
___
Post Messages to: Dabo-users@leafe.com
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/201101222106.01519.jo...@jfcomputer.com


Re: [dabo-users] Mini-mac and my code

2011-01-22 Thread John Fabiani
On Saturday, January 22, 2011 09:06:01 pm John Fabiani wrote:
 On Saturday, January 22, 2011 01:34:36 pm Ed Leafe wrote:
  On Jan 22, 2011, at 3:34 PM, John Fabiani wrote:
   I understand the argument but I see many apps where the buttons have a
   background color (even the OS dialogs).   So as far as the buttons not
   displaying the background colors correctly was a surprise.
  
  Can you name one such example?
  
  -- Ed Leafe
 
 Yes xTuple - has them and I assume the dialogs that appear are the ones
 from the OS.
 
 Johnf

Also when I open a terminal and then use the control-Q (windows key and a 'q') 
a dialog appears and the close button is blue.  And I'm sure this is not the 
only dialog that appears that way.

From your question I assume you do not see colored backgrounds for buttons.  I 
am using 10.6 64 bit and they appear in many dialogs.

Johnf
___
Post Messages to: Dabo-users@leafe.com
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/201101222118.55415.jo...@jfcomputer.com


Re: [dabo-users] Trying to use multiple Bizobjects in a parent-child relationship

2011-01-22 Thread David Martinez
Add those 4 lines to my createBizobjs() method and the error went away. 
However, when I try to run the app, a dialog box appears saying 
Attribute Error: 'NoneType' object has no attribute 'addForm'



On 1/22/2011 9:36 AM, Ed Leafe wrote:
 On Jan 22, 2011, at 5:19 AM, David Martinez wrote:

 PubliccustomerBizobj.addChild(PublichistoryBizobj)
   Here you are adding a class to a class inside a class definition; that 
 won't work. You need to work with instances:

 biz = self.Application.biz
 cust = biz.PubliccustomerBizobj()
 hist = biz.PublichistoryBizobj()
 cust.addChild(hist)

   Generally, this code would go in the form's createBizobjs() method; 
 note that I added a reference to the biz module, which is where these modules 
 will be defined in your app.


 -- Ed Leafe



 ___
 Post Messages to: Dabo-users@leafe.com
 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/3a473139-6c3e-455c-a056-4298d5070...@leafe.com
___
Post Messages to: Dabo-users@leafe.com
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/4d3bc1f8.2030...@contouredsolutions.com


Re: [dabo-users] Trying to use multiple Bizobjects in a parent-child relationship

2011-01-22 Thread David Martinez
My apologies. It's addFrom not addForm



On 1/22/2011 9:36 AM, Ed Leafe wrote:
 On Jan 22, 2011, at 5:19 AM, David Martinez wrote:

 PubliccustomerBizobj.addChild(PublichistoryBizobj)
   Here you are adding a class to a class inside a class definition; that 
 won't work. You need to work with instances:

 biz = self.Application.biz
 cust = biz.PubliccustomerBizobj()
 hist = biz.PublichistoryBizobj()
 cust.addChild(hist)

   Generally, this code would go in the form's createBizobjs() method; 
 note that I added a reference to the biz module, which is where these modules 
 will be defined in your app.


 -- Ed Leafe



 ___
 Post Messages to: Dabo-users@leafe.com
 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/3a473139-6c3e-455c-a056-4298d5070...@leafe.com
___
Post Messages to: Dabo-users@leafe.com
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/4d3bc3a5.8080...@contouredsolutions.com