dabo Commit
Revision 4918
Date: 2009-01-11 08:24:07 -0800 (Sun, 11 Jan 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/4918

Changed:
A   trunk/daboserver/appSource/people/
A   trunk/daboserver/appSource/people/biz/
A   trunk/daboserver/appSource/people/biz/ActivitiesBizobj.py
A   trunk/daboserver/appSource/people/biz/PeopleBizobj.py
A   trunk/daboserver/appSource/people/biz/__init__.py
A   trunk/daboserver/appSource/people/cache/
A   trunk/daboserver/appSource/people/db/
A   trunk/daboserver/appSource/people/db/__init__.py
A   trunk/daboserver/appSource/people/db/default.cnxml
A   trunk/daboserver/appSource/people/deadui/
A   trunk/daboserver/appSource/people/deadui/__init__.py
A   trunk/daboserver/appSource/people/deadui/people.cdxml
A   trunk/daboserver/appSource/people/main.py
A   trunk/daboserver/appSource/people/reports/
A   trunk/daboserver/appSource/people/reports/__init__.py
A   trunk/daboserver/appSource/people/resources/
A   trunk/daboserver/appSource/people/resources/__init__.py
A   trunk/daboserver/appSource/people/test/
A   trunk/daboserver/appSource/people/test/__init__.py
A   trunk/daboserver/appSource/people/ui/
A   trunk/daboserver/appSource/people/ui/IncidentPage.cdxml
A   trunk/daboserver/appSource/people/ui/__init__.py
A   trunk/daboserver/appSource/people/ui/people-code.py
A   trunk/daboserver/appSource/people/ui/people.cdxml
A   trunk/daboserver/controllers/ActivitiesBizobj.py
A   trunk/daboserver/controllers/PeopleBizobj.py
U   trunk/daboserver/controllers/bizservers.py

Log:
Updated the bizserver controller so that forceCreate=True when creating new 
local SQLite connections.

Added the 'people' application that will be used as the new demo.


Diff:
Added: trunk/daboserver/appSource/people/biz/ActivitiesBizobj.py
===================================================================
--- trunk/daboserver/appSource/people/biz/ActivitiesBizobj.py                   
        (rev 0)
+++ trunk/daboserver/appSource/people/biz/ActivitiesBizobj.py   2009-01-11 
16:24:07 UTC (rev 4918)
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import dabo
+
+class ActivitiesBizobj(dabo.biz.dBizobj):
+       def afterInit(self):
+               self.DataSource = "activities"
+               self.KeyField = "id"
+               self.addFrom("activities")
+               self.addField("details")
+               self.addField("reported_date")
+               self.addField("severity")
+               self.addField("id")
+               self.LinkField = "people_fk"
+               
+               self.NonUpdateFields = ["reported_date"]
+
+       
+       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

Added: trunk/daboserver/appSource/people/biz/PeopleBizobj.py
===================================================================
--- trunk/daboserver/appSource/people/biz/PeopleBizobj.py                       
        (rev 0)
+++ trunk/daboserver/appSource/people/biz/PeopleBizobj.py       2009-01-11 
16:24:07 UTC (rev 4918)
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import dabo
+
+class PeopleBizobj(dabo.biz.dBizobj):
+       def afterInit(self):
+               self.DataSource = "people"
+               self.KeyField = "id"
+               self.addFrom("people")
+               self.addField("city")
+               self.addField("firstname")
+               self.addField("stateprov")
+               self.addField("lastname")
+               self.addField("street")
+               self.addField("postalcode")
+               self.addField("id")
+               self.addOrderBy("lastname")
+               self.VirtualFields = {"fullname": self.getFullName}
+               self.setWhereClause(" lastname like ? ")
+               
+       
+       def getFullName(self):
+               return " ".join((self.Record.firstname, self.Record.lastname))
+               
+
+       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

Added: trunk/daboserver/appSource/people/biz/__init__.py
===================================================================
--- trunk/daboserver/appSource/people/biz/__init__.py                           
(rev 0)
+++ trunk/daboserver/appSource/people/biz/__init__.py   2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+######
+# In order for Dabo to 'see' classes in your biz directory, add an 
+# import statement here for each class. E.g., if you have a file named
+# 'MyClasses.py' in this directory, and it defines two classes named 
'FirstClass'
+# and 'SecondClass', add these lines:
+# 
+# from MyClass import FirstClass
+# from MyClass import SecondClass
+# 
+# Now you can refer to these classes as: self.Application.biz.FirstClass and
+# self.Application.biz.SecondClass
+######
+
+from PeopleBizobj import PeopleBizobj
+from ActivitiesBizobj import ActivitiesBizobj
+

Added: trunk/daboserver/appSource/people/db/__init__.py
===================================================================
--- trunk/daboserver/appSource/people/db/__init__.py                            
(rev 0)
+++ trunk/daboserver/appSource/people/db/__init__.py    2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+######
+# In order for Dabo to 'see' classes in your db directory, add an 
+# import statement here for each class. E.g., if you have a file named
+# 'MyClasses.py' in this directory, and it defines two classes named 
'FirstClass'
+# and 'SecondClass', add these lines:
+# 
+# from MyClass import FirstClass
+# from MyClass import SecondClass
+# 
+# Now you can refer to these classes as: self.Application.db.FirstClass and
+# self.Application.db.SecondClass
+######
+

Added: trunk/daboserver/appSource/people/db/default.cnxml
===================================================================
--- trunk/daboserver/appSource/people/db/default.cnxml                          
(rev 0)
+++ trunk/daboserver/appSource/people/db/default.cnxml  2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<connectiondefs xmlns="http://www.dabodev.com";
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+xsi:schemaLocation="http://www.dabodev.com conn.xsd"
+xsi:noNamespaceSchemaLocation = "http://dabodev.com/schema/conn.xsd";>
+
+       <connection dbtype="web">
+               <name>people</name>
+               <remotehost>http:daboserver.com:7777</remotehost>
+               <database></database>
+               <user></user>
+               <password></password>
+               <port></port>
+       </connection>
+
+</connectiondefs>

Added: trunk/daboserver/appSource/people/deadui/__init__.py
===================================================================
--- trunk/daboserver/appSource/people/deadui/__init__.py                        
        (rev 0)
+++ trunk/daboserver/appSource/people/deadui/__init__.py        2009-01-11 
16:24:07 UTC (rev 4918)
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+######
+# In order for Dabo to 'see' classes in your ui directory, add an 
+# import statement here for each class. E.g., if you have a file named
+# 'MyClasses.py' in this directory, and it defines two classes named 
'FirstClass'
+# and 'SecondClass', add these lines:
+# 
+# from MyClass import FirstClass
+# from MyClass import SecondClass
+# 
+# Now you can refer to these classes as: self.Application.ui.FirstClass and
+# self.Application.ui.SecondClass
+######
+

Added: trunk/daboserver/appSource/people/deadui/people.cdxml
===================================================================
--- trunk/daboserver/appSource/people/deadui/people.cdxml                       
        (rev 0)
+++ trunk/daboserver/appSource/people/deadui/people.cdxml       2009-01-11 
16:24:07 UTC (rev 4918)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<dForm CxnFile="path://db/default.cnxml" Name="dForm" Caption="People" 
SaveRestorePosition="False" Top="150" Height="617" Width="544" 
designerClass="DesForm" CxnName="people" Left="448">
+       <code>
+               <createBizobjs><![CDATA[
+def createBizobjs(self):
+       peopleBizobj = self.Application.biz.PeopleBizobj(self.Connection)
+       self.addBizobj(peopleBizobj)
+
+       activitiesBizobj = 
self.Application.biz.ActivitiesBizobj(self.Connection)
+       self.addBizobj(activitiesBizobj)
+       peopleBizobj.addChild(activitiesBizobj)
+]]>
+               </createBizobjs>
+               <search><![CDATA[
+def search(self):
+       txt = self.searchText.Value
+       if not txt:
+               self.searchText.setFocus()
+               return
+       self.PrimaryBizobj.setParams("%%%s%%" % txt)
+       self.requery()
+]]>
+               </search>
+       </code>
+
+       <dSizer SlotCount="3" designerClass="LayoutSizer" 
Orientation="Vertical">
+               <dLabel FontBold="True" FontFace="Gill Sans" sizerInfo="{}" 
Caption="Incident Reports" ForeColor="(0, 0, 255)" FontSize="24" 
designerClass="controlMix" FontItalic="True"></dLabel>
+               <dPageFrame sizerInfo="{'VAlign': 'Middle'}" 
designerClass="controlMix" PageCount="2">
+                       <dPage Caption="People" designerClass="controlMix">
+                               <dSizer SlotCount="3" 
designerClass="LayoutSizer" Orientation="Vertical">
+                                       <dBorderSizer 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': True}" Orientation="Horizontal" 
Caption="Search" designerClass="LayoutBorderSizer" SlotCount="4" 
DefaultBorder="8">
+                                               <dPanel 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 8, 'Expand': False}" 
designerClass="LayoutSpacerPanel"></dPanel>
+                                               <dTextBox RegID="searchText" 
Width="327" sizerInfo="{}" designerClass="controlMix">
+                                                       <code>
+                                                               
<onKeyChar><![CDATA[
+def onKeyChar(self, evt):
+       if evt.keyCode == 13:
+               self.Form.search()
+]]>
+                                                               </onKeyChar>
+                                                       </code>
+                                               </dTextBox>
+                                               <dButton Caption="Search" 
sizerInfo="{}" designerClass="controlMix">
+                                                       <code>
+                                                               <onHit><![CDATA[
+def onHit(self, evt):
+       self.Form.search()
+]]>
+                                                               </onHit>
+                                                       </code>
+                                               </dButton>
+                                               <dPanel 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 8, 'Expand': False}" 
designerClass="LayoutSpacerPanel"></dPanel>
+                                       </dBorderSizer>
+                                       <dGrid ColumnCount="2" 
SelectionMode="Cell" designerClass="controlMix" DataSource="people" 
sizerInfo="{'HAlign': 'Center', 'Border': 12}">
+                                               <dColumn Caption="First Name" 
designerClass="controlMix" Order="0" DataField="firstname"></dColumn>
+                                               <dColumn Caption="Last Name" 
designerClass="controlMix" Order="10" DataField="lastname"></dColumn>
+                                       </dGrid>
+                                       <dGridSizer HGap="5" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 3, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 20, 'Expand': True}" Rows="6" 
designerClass="LayoutGridSizer" VGap="7" MaxDimension="R" Columns="2">
+                                               <dLabel Caption="First" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
rowColPos="(0, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox1" rowColPos="(0, 1)" designerClass="controlMix" 
DataSource="people" DataField="firstname"></dTextBox>
+                                               <dLabel Caption="Last" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
Name="dLabel1" rowColPos="(1, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox2" rowColPos="(1, 1)" designerClass="controlMix" 
DataSource="people" DataField="lastname"></dTextBox>
+                                               <dLabel Caption="Address" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
Name="dLabel2" rowColPos="(2, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox3" rowColPos="(2, 1)" designerClass="controlMix" 
DataSource="people" DataField="street"></dTextBox>
+                                               <dLabel Caption="City" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
Name="dLabel3" rowColPos="(3, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox4" rowColPos="(3, 1)" designerClass="controlMix" 
DataSource="people" DataField="city"></dTextBox>
+                                               <dLabel Caption="State" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
Name="dLabel4" rowColPos="(4, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox5" rowColPos="(4, 1)" designerClass="controlMix" 
DataSource="people" DataField="stateprov"></dTextBox>
+                                               <dLabel Caption="Zip" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
Name="dLabel5" rowColPos="(5, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox6" rowColPos="(5, 1)" designerClass="controlMix" 
DataSource="people" DataField="postalcode"></dTextBox>
+                                       </dGridSizer>
+                               </dSizer>
+                       </dPage>
+                       <dPage Caption="Incidents" designerClass="controlMix" 
Name="dPage1">
+                               <dSizer SlotCount="2" 
designerClass="LayoutSizer" Orientation="Vertical">
+                                       <dGrid ColumnCount="3" 
SelectionMode="Cell" designerClass="controlMix" DataSource="activities" 
sizerInfo="{}">
+                                               <dColumn Caption="Details" 
designerClass="controlMix" Order="0" DataField="details"></dColumn>
+                                               <dColumn Caption="Date" 
designerClass="controlMix" Order="10" DataField="report_date"></dColumn>
+                                               <dColumn Caption="Severity" 
designerClass="controlMix" DataField="severity"></dColumn>
+                                       </dGrid>
+                                       <dGridSizer HGap="8" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 2, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 10, 'Expand': True}" Rows="3" 
designerClass="LayoutGridSizer" VGap="7" MaxDimension="r" Columns="2">
+                                               <dLabel Caption="Date" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
rowColPos="(0, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
rowColPos="(0, 1)" designerClass="controlMix" DataField="report_date" 
DataSource="activities"></dTextBox>
+                                               <dLabel Caption="Severity" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1}" designerClass="controlMix" 
Name="dLabel1" rowColPos="(1, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox1" rowColPos="(1, 1)" designerClass="controlMix" 
DataSource="activities" DataField="severity"></dTextBox>
+                                               <dLabel Caption="Details" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'VAlign': 'Top', 'RowExpand': True}" 
designerClass="controlMix" Name="dLabel2" rowColPos="(2, 0)"></dLabel>
+                                               <dEditBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'RowExpand': True}" rowColPos="(2, 1)" 
designerClass="controlMix" DataField="details" 
DataSource="activities"></dEditBox>
+                                       </dGridSizer>
+                               </dSizer>
+                       </dPage>
+               </dPageFrame>
+               <dBorderSizer SlotCount="2" Caption="Controls" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Right', 
'VAlign': 'Top', 'Border': 6, 'Expand': False}" 
designerClass="LayoutBorderSizer" Orientation="Horizontal">
+                       <dButton Caption="Save" sizerInfo="{'Border': 5}" 
designerClass="controlMix" Name="dButton1">
+                               <code>
+                                       <onHit><![CDATA[
+def onHit(self, evt):
+       self.Form.save()
+]]>
+                                       </onHit>
+                               </code>
+                       </dButton>
+                       <dButton Caption="Cancel" sizerInfo="{'Border': 5}" 
designerClass="controlMix">
+                               <code>
+                                       <onHit><![CDATA[
+def onHit(self, evt):
+       self.Form.cancel()
+]]>
+                                       </onHit>
+                               </code>
+                       </dButton>
+               </dBorderSizer>
+       </dSizer>
+</dForm>

Added: trunk/daboserver/appSource/people/main.py
===================================================================
--- trunk/daboserver/appSource/people/main.py                           (rev 0)
+++ trunk/daboserver/appSource/people/main.py   2009-01-11 16:24:07 UTC (rev 
4918)
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import dabo
+dabo.ui.loadUI("wx")
+
+app = dabo.dApp(SourceURL="http://daboserver.com:7777";)
+
+# IMPORTANT! Change app.MainFormClass value to the name
+# of the form class that you want to run when your
+# application starts up.
+app.MainFormClass = "people.cdxml"
+
+app.start()


Property changes on: trunk/daboserver/appSource/people/main.py
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/daboserver/appSource/people/reports/__init__.py
===================================================================
--- trunk/daboserver/appSource/people/reports/__init__.py                       
        (rev 0)
+++ trunk/daboserver/appSource/people/reports/__init__.py       2009-01-11 
16:24:07 UTC (rev 4918)
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+######
+# In order for Dabo to 'see' classes in your reports directory, add an 
+# import statement here for each class. E.g., if you have a file named
+# 'MyClasses.py' in this directory, and it defines two classes named 
'FirstClass'
+# and 'SecondClass', add these lines:
+# 
+# from MyClass import FirstClass
+# from MyClass import SecondClass
+# 
+# Now you can refer to these classes as: self.Application.reports.FirstClass 
and
+# self.Application.reports.SecondClass
+######
+

Added: trunk/daboserver/appSource/people/resources/__init__.py
===================================================================
--- trunk/daboserver/appSource/people/resources/__init__.py                     
        (rev 0)
+++ trunk/daboserver/appSource/people/resources/__init__.py     2009-01-11 
16:24:07 UTC (rev 4918)
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+######
+# In order for Dabo to 'see' classes in your resources directory, add an 
+# import statement here for each class. E.g., if you have a file named
+# 'MyClasses.py' in this directory, and it defines two classes named 
'FirstClass'
+# and 'SecondClass', add these lines:
+# 
+# from MyClass import FirstClass
+# from MyClass import SecondClass
+# 
+# Now you can refer to these classes as: self.Application.resources.FirstClass 
and
+# self.Application.resources.SecondClass
+######
+

Added: trunk/daboserver/appSource/people/test/__init__.py
===================================================================
--- trunk/daboserver/appSource/people/test/__init__.py                          
(rev 0)
+++ trunk/daboserver/appSource/people/test/__init__.py  2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+######
+# In order for Dabo to 'see' classes in your test directory, add an 
+# import statement here for each class. E.g., if you have a file named
+# 'MyClasses.py' in this directory, and it defines two classes named 
'FirstClass'
+# and 'SecondClass', add these lines:
+# 
+# from MyClass import FirstClass
+# from MyClass import SecondClass
+# 
+# Now you can refer to these classes as: self.Application.test.FirstClass and
+# self.Application.test.SecondClass
+######
+

Added: trunk/daboserver/appSource/people/ui/IncidentPage.cdxml
===================================================================
--- trunk/daboserver/appSource/people/ui/IncidentPage.cdxml                     
        (rev 0)
+++ trunk/daboserver/appSource/people/ui/IncidentPage.cdxml     2009-01-11 
16:24:07 UTC (rev 4918)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<dPage classID="285146608" BorderColor="(0, 0, 0)" sizerInfo="{}" Name="dPage" 
MinSizerWidth="10" AlwaysResetSizer="True" Enabled="True" Caption="" 
ForeColor="(0, 0, 0)" Tag="None" designerClass="path://IncidentPage.py.cdxml" 
savedClass="True" Transparency="255" BackColor="(221, 221, 221)" 
MinSizerHeight="10" BorderStyle="Default" ToolTipText="None" 
BorderLineStyle="Solid" BorderWidth="0">
+       <dSizer classID="285146608-285147024" Orientation="Vertical" 
DefaultBorderTop="False" DefaultBorderRight="False" DefaultSpacing="0" 
DefaultBorderBottom="False" DefaultBorder="0" DefaultBorderLeft="False" 
designerClass="LayoutSizer" SlotCount="5">
+               <dLabel FontUnderline="False" BorderColor="(0, 0, 0)" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': False}" AutoResize="True" 
FontFace="Lucida Grande" BorderWidth="0" BorderStyle="Default" FontBold="False" 
ForeColor="(0, 0, 0)" BackColor="(221, 221, 221)" FontItalic="False" 
classID="285146608-296126768" Name="dLabel1" Enabled="True" Caption="Severity" 
designerClass="controlMix" Transparency="255" BorderLineStyle="Solid" 
Tag="None" FontSize="13" Alignment="Left" ToolTipText="None"></dLabel>
+               <dTextBox PasswordEntry="False" BorderColor="(0, 0, 0)" 
sizerInfo="{'BorderSides': ['Bottom'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': True}" TextLength="None" 
FontFace="Lucida Grande" BorderWidth="0" BorderStyle="Sunken" FontBold="False" 
ForeColor="(0, 0, 0)" BackColor="(221, 221, 221)" FontItalic="False" 
DataSource="activities" classID="285146608-296127184" Name="dTextBox1" 
Enabled="True" Value="" designerClass="controlMix" Transparency="255" 
FontUnderline="False" BorderLineStyle="Solid" ReadOnly="False" Tag="None" 
DataField="severity" FontSize="13" ForceCase="None" Alignment="Left" 
ToolTipText="None"></dTextBox>
+               <dPanel classID="285146608-295905456" Spacing="50" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0}" designerClass="LayoutSpacerPanel"></dPanel>
+               <dLabel FontUnderline="False" BorderColor="(0, 0, 0)" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': False}" AutoResize="True" 
FontFace="Lucida Grande" BorderWidth="0" BorderStyle="Default" FontBold="False" 
ForeColor="(0, 0, 0)" BackColor="(221, 221, 221)" FontItalic="False" 
classID="285146608-296127280" Name="dLabel2" Enabled="True" Caption="Incident 
Details" designerClass="controlMix" Transparency="255" BorderLineStyle="Solid" 
Tag="None" FontSize="13" Alignment="Left" ToolTipText="None"></dLabel>
+               <dEditBox FontUnderline="False" BorderColor="(0, 0, 0)" 
sizerInfo="{'BorderSides': ['Bottom'], 'Proportion': 1, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': True}" FontFace="Lucida Grande" 
BorderWidth="0" BorderStyle="Sunken" FontBold="False" ForeColor="(0, 0, 0)" 
BackColor="(221, 221, 221)" FontItalic="False" DataSource="activities" 
classID="285146608-296127536" Name="dEditBox" Enabled="True" Value="" 
designerClass="controlMix" Transparency="255" BorderLineStyle="Solid" 
ReadOnly="False" Tag="None" DataField="incident" FontSize="13" ForceCase="None" 
Alignment="Left" ToolTipText="None"></dEditBox>
+       </dSizer>
+</dPage>

Added: trunk/daboserver/appSource/people/ui/__init__.py
===================================================================
--- trunk/daboserver/appSource/people/ui/__init__.py                            
(rev 0)
+++ trunk/daboserver/appSource/people/ui/__init__.py    2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+######
+# In order for Dabo to 'see' classes in your ui directory, add an 
+# import statement here for each class. E.g., if you have a file named
+# 'MyClasses.py' in this directory, and it defines two classes named 
'FirstClass'
+# and 'SecondClass', add these lines:
+# 
+# from MyClass import FirstClass
+# from MyClass import SecondClass
+# 
+# Now you can refer to these classes as: self.Application.ui.FirstClass and
+# self.Application.ui.SecondClass
+######
+

Added: trunk/daboserver/appSource/people/ui/people-code.py
===================================================================
--- trunk/daboserver/appSource/people/ui/people-code.py                         
(rev 0)
+++ trunk/daboserver/appSource/people/ui/people-code.py 2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+### Dabo Class Designer code. You many freely edit the code,
+### but do not change the comments containing:
+###            'Dabo Code ID: XXXX', 
+### as these are needed to link the code to the objects.
+
+## *!* ## Dabo Code ID: dListBox-dForm
+def afterInit(self):
+       self.DynamicWidth = lambda: .75 * self.Parent.Width
+
+
+
+## *!* ## Dabo Code ID: dTextBox-dForm
+def onKeyChar(self, evt):
+       dabo.ui.callAfter(self.Form.onSearchTextKeyChar, evt)
+
+
+
+## *!* ## Dabo Code ID: dButton-dForm
+def onHit(self, evt):
+       self.Form.requery()
+
+
+
+## *!* ## Dabo Code ID: dForm-top
+import dabo.dEvents as dEvents
+
+def afterInitAll(self):
+       dabo.ui.callAfter(self.layout)
+       self.nameList.bindEvent(dEvents.Hit, self.onNameSelection)
+
+def onNameSelection(self, evt):
+       self.PrimaryBizobj.RowNumber = self.nameList.PositionValue
+       self.update()
+
+def afterRequery(self):
+       names = self.PrimaryBizobj.getDataSet(flds=("id", "fullname"))
+       self.nameList.Choices = [rec["fullname"] for rec in names]
+       self.nameList.Keys = [rec["id"] for rec in names]
+       dabo.ui.callAfterInterval(100, self.update)
+       dabo.ui.callAfterInterval(200, self.layout)
+
+def beforeRequery(self):
+       val = self.searchText.Value
+       if not val:
+               return False
+       self.PrimaryBizobj.setWhereClause(" lastname like '%%%s%%' " % val)
+
+def createBizobjs(self):
+       cxn = self.Application.getConnectionByName("people")
+       pbiz = self.Application.biz.PeopleBizobj(cxn)
+       self.addBizobj(pbiz)
+       abiz = self.Application.biz.ActivitiesBizobj(cxn)
+       self.addBizobj(abiz)
+       pbiz.addChild(abiz)
+
+def onSearchTextKeyChar(self, evt):
+       val = self.searchText.Value
+       if evt.keyCode == 13 and val:
+               self.requery()
+       else:
+               self.searchButton.Enabled = bool(val)
+

Added: trunk/daboserver/appSource/people/ui/people.cdxml
===================================================================
--- trunk/daboserver/appSource/people/ui/people.cdxml                           
(rev 0)
+++ trunk/daboserver/appSource/people/ui/people.cdxml   2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<dForm code-ID="dForm-top" CxnFile="path://../db/default.cnxml" Name="dForm" 
Caption="PyWorks 2008" SaveRestorePosition="False" Top="107" Height="703" 
Width="748" designerClass="DesForm" CxnName="people" Left="346">
+       <dSizer SlotCount="2" designerClass="LayoutSizer" 
Orientation="Vertical">
+               <dLabel FontBold="True" FontFace="Gill Sans" 
sizerInfo="{'Proportion': 0, 'HAlign': 'Center', 'Expand': False}" 
Caption="Incident Reports" FontSize="24" designerClass="controlMix" 
FontItalic="True"></dLabel>
+               <dSizer SlotCount="2" sizerInfo="{'BorderSides': ['All'], 
'Proportion': 1, 'HAlign': 'Left', 'VAlign': 'Top', 'Border': 0, 'Expand': 
True}" designerClass="LayoutSizer" Orientation="Vertical">
+                       <dBorderSizer SlotCount="2" Caption="Search" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 2, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': True}" 
designerClass="LayoutBorderSizer" Orientation="Vertical">
+                               <dSizer SlotCount="4" DefaultBorder="5" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 10, 'Expand': True}" designerClass="LayoutSizer" 
Orientation="Horizontal">
+                                       <dPanel Spacing="60" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 0, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 5}" designerClass="LayoutSpacerPanel"></dPanel>
+                                       <dLabel Caption="Enter last name:" 
sizerInfo="{}" designerClass="controlMix" Name="dLabel1"></dLabel>
+                                       <dTextBox RegID="searchText" 
sizerInfo="{}" code-ID="dTextBox-dForm" designerClass="controlMix"></dTextBox>
+                                       <dButton code-ID="dButton-dForm" 
Caption="Search" sizerInfo="{}" designerClass="controlMix" RegID="searchButton" 
Enabled="False"></dButton>
+                               </dSizer>
+                               <dListBox code-ID="dListBox-dForm" 
sizerInfo="{'Expand': False}" designerClass="controlMix" RegID="nameList" 
Choices="[]"></dListBox>
+                       </dBorderSizer>
+                       <dSizer SlotCount="5" sizerInfo="{'BorderSides': 
['All'], 'Proportion': 3, 'HAlign': 'Left', 'VAlign': 'Top', 'Border': 0, 
'Expand': True}" designerClass="LayoutSizer" Orientation="Horizontal">
+                               <dPanel Spacing="15" sizerInfo="{'BorderSides': 
['All'], 'Proportion': 0, 'HAlign': 'Left', 'VAlign': 'Top', 'Border': 0, 
'Expand': False}" designerClass="LayoutSpacerPanel"></dPanel>
+                               <dBorderSizer SlotCount="1" Caption="Details" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 1, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': True}" 
designerClass="LayoutBorderSizer" Orientation="Vertical">
+                                       <dGridSizer HGap="11" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 1, 'HAlign': 'Center', 
'VAlign': 'Top', 'Border': 15, 'Expand': True}" Rows="6" 
designerClass="LayoutGridSizer" VGap="6" MaxDimension="r" Columns="2">
+                                               <dLabel Caption="First" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Right', 'ColExpand': False}" 
designerClass="controlMix" Name="dLabel2" rowColPos="(0, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox1" rowColPos="(0, 1)" designerClass="controlMix" 
DataSource="people" DataField="firstname"></dTextBox>
+                                               <dLabel Caption="Last" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Right', 'ColExpand': False}" 
designerClass="controlMix" Name="dLabel3" rowColPos="(1, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox2" rowColPos="(1, 1)" designerClass="controlMix" 
DataSource="people" DataField="lastname"></dTextBox>
+                                               <dLabel Caption="Address" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Right', 'ColExpand': False}" 
designerClass="controlMix" Name="dLabel4" rowColPos="(2, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox3" rowColPos="(2, 1)" designerClass="controlMix" 
DataSource="people" DataField="fullname"></dTextBox>
+                                               <dLabel Caption="City" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Right', 'ColExpand': False}" 
designerClass="controlMix" Name="dLabel5" rowColPos="(3, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox4" rowColPos="(3, 1)" designerClass="controlMix" 
DataSource="people" DataField="city"></dTextBox>
+                                               <dLabel Caption="State" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Right', 'ColExpand': False}" 
designerClass="controlMix" Name="dLabel6" rowColPos="(4, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox5" rowColPos="(4, 1)" designerClass="controlMix" 
DataSource="people" DataField="stateprov"></dTextBox>
+                                               <dLabel Caption="Zip" 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'HAlign': 'Right', 'ColExpand': False}" 
designerClass="controlMix" Name="dLabel7" rowColPos="(5, 0)"></dLabel>
+                                               <dTextBox 
sizerInfo="{'RowSpan': 1, 'ColSpan': 1, 'Proportion': 0, 'HAlign': 'Left'}" 
Name="dTextBox6" rowColPos="(5, 1)" designerClass="controlMix" 
DataSource="people" DataField="postalcode"></dTextBox>
+                                       </dGridSizer>
+                               </dBorderSizer>
+                               <dPanel sizerInfo="{'BorderSides': ['All'], 
'Proportion': 0, 'HAlign': 'Left', 'VAlign': 'Top', 'Border': 0, 'Expand': 
False}" designerClass="LayoutSpacerPanel"></dPanel>
+                               <dBorderSizer SlotCount="1" Caption="Incidents" 
sizerInfo="{'BorderSides': ['All'], 'Proportion': 1, 'HAlign': 'Left', 
'VAlign': 'Top', 'Border': 0, 'Expand': True}" 
designerClass="LayoutBorderSizer" Orientation="Vertical">
+                                       <dPageSelect sizerInfo="{'VAlign': 
'Middle'}" designerClass="controlMix" PageCount="1">
+                                               <dPage classID="285146608" 
Caption="Page 1" designerClass="controlMix">
+                                                       <dSizer 
classID="285146608-285147024" SlotCount="5" designerClass="LayoutSizer" 
Orientation="Vertical">
+                                                               <dLabel 
classID="285146608-296126768" Caption="Label" sizerInfo="{}" 
designerClass="controlMix"></dLabel>
+                                                               <dTextBox 
classID="285146608-296127184" sizerInfo="{}" 
designerClass="controlMix"></dTextBox>
+                                                               <dPanel 
classID="285146608-295905456" sizerInfo="{'BorderSides': ['All'], 'Proportion': 
0, 'HAlign': 'Left', 'VAlign': 'Top', 'Border': 0, 'Expand': False}" 
designerClass="LayoutSpacerPanel"></dPanel>
+                                                               <dLabel 
classID="285146608-296127280" Caption="Label" sizerInfo="{}" 
designerClass="controlMix" Name="dLabel1"></dLabel>
+                                                               <dEditBox 
classID="285146608-296127536" sizerInfo="{}" 
designerClass="controlMix"></dEditBox>
+                                                       </dSizer>
+                                               </dPage>
+                                       </dPageSelect>
+                               </dBorderSizer>
+                               <dPanel Spacing="15" sizerInfo="{'BorderSides': 
['All'], 'Proportion': 0, 'HAlign': 'Left', 'VAlign': 'Top', 'Border': 0, 
'Expand': False}" designerClass="LayoutSpacerPanel"></dPanel>
+                       </dSizer>
+               </dSizer>
+       </dSizer>
+</dForm>

Added: trunk/daboserver/controllers/ActivitiesBizobj.py
===================================================================
--- trunk/daboserver/controllers/ActivitiesBizobj.py                            
(rev 0)
+++ trunk/daboserver/controllers/ActivitiesBizobj.py    2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import dabo
+
+class ActivitiesBizobj(dabo.biz.RemoteBizobj):
+       def defineConnection(self):
+               self.setConnectionParams(
+                               dbType="MySQL", 
+                               database="webtest", 
+                               host="dabodev.com",
+                               user="webuser",
+                               plainTextPassword="foxrocks")
+
+
+       def validateRecord(self):
+               """Place record validation code here"""
+               pass
+                       

Added: trunk/daboserver/controllers/PeopleBizobj.py
===================================================================
--- trunk/daboserver/controllers/PeopleBizobj.py                                
(rev 0)
+++ trunk/daboserver/controllers/PeopleBizobj.py        2009-01-11 16:24:07 UTC 
(rev 4918)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import dabo
+
+class PeopleBizobj(dabo.biz.RemoteBizobj):
+       def defineConnection(self):
+               self.setConnectionParams(
+                               dbType="MySQL", 
+                               database="webtest", 
+                               host="dabodev.com",
+                               user="webuser",
+                               plainTextPassword="foxrocks")
+
+
+       def validateRecord(self):
+               """Place record validation code here"""
+               pass
+                       

Modified: trunk/daboserver/controllers/bizservers.py
===================================================================
--- trunk/daboserver/controllers/bizservers.py  2009-01-11 16:08:02 UTC (rev 
4917)
+++ trunk/daboserver/controllers/bizservers.py  2009-01-11 16:24:07 UTC (rev 
4918)
@@ -34,13 +34,17 @@
 ## NOTE: the next line is an example from the demonstration app.
 ## Be sure to CHANGE it to whatever is required for your app.
 from OrdersBizobj import OrdersBizobj
+from PeopleBizobj import PeopleBizobj
+from ActivitiesBizobj import ActivitiesBizobj
 #-------------------------------------------------------
 
 
 # The bizobj class *MUST* be defined here for each data source that is to be 
 # handled by this server. Be sure that these classes are imported above.
 ## NOTE: as mentioned above, this is for the demo app.
-bizDict = {"orders": OrdersBizobj}
+bizDict = {"orders": OrdersBizobj,
+         "people": PeopleBizobj,
+         "activities": ActivitiesBizobj}
 
 # The path to the server copy of the web application source files *MUST* be
 # defined here. It is used to compare local app manifests in order to 
@@ -48,7 +52,6 @@
 sourcePath = os.path.join(os.getcwd(), "daboserver/appSource")
 
 
-
 class BizserversController(BaseController):
        
        def biz(self, hashval=None, ds=None, method=None, *args, **kwargs):
@@ -128,7 +131,8 @@
        def getFileRequestDB(self):
                curr = os.getcwd()
                db = os.path.join(curr, "DaboFileCache.db")
-               cxn = dabo.db.dConnection(connectInfo={"DbType": "SQLite", 
"Database": db})
+               cxn = dabo.db.dConnection(connectInfo={"DbType": "SQLite", 
"Database": db},
+                       forceCreate=True)
                cursor = cxn.getDaboCursor()
                return cursor
 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to