Index
2012-06-05 18:49Simon Cropper : [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 19:10Paul McNett : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 19:24Simon Cropper : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 19:28John Fabiani : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 19:38John Fabiani : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 19:47Simon Cropper : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 20:02Paul McNett : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 20:06Simon Cropper : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 20:14John Fabiani : Re: [dabo-users] Dabo! Everyone's answer to my question!
2012-06-05 20:22John Fabiani : Re: [dabo-users] Dabo! Everyone's answer to my question!
Back to top
[dabo-users] Dabo! Everyone's answer to my question!

Author: Simon Cropper

Posted: 2012-06-05 18:49:28   Link

Hi,

After a year of travels, learning, testing packages, requests for help

on various fora, I have returned again to this list as people keep

saying try Dabo! try Dabo!

I keep telling them I have tried Dabo but it can't be "bent" to my

generic needs, that it is built on a well structured business model with

clear structured way of getting things done. I tell them that the

framework can be modified but the main developers recommend you use

their classes, etc to ensure compatibility.

I even point out that my correspondence with the developers indicate

that no major development to the code is likely. Still they say Dabo! Dabo!

So while trying to find some code to understand how wxGrid works in

wxPython the same mantra permeated through my treads. {Try Dabo! Try

Dabo!}.

The main protagonist was John Fabiani who eventually offered up the

invite "I hope you will revisit Dabo and ask me how to do things."

Well I'm here. I am willing to be shown...

So, I will throw up an apparently simple challenge. John, show me how I

can open a simple sqlite table and present the data in a window/frame in

an editable grid. Don't worry about the fluff, just the basic bones. The

code should be able to be pointed at any sqlite table. In other words

the grid is created and populated on the fly. In VFP parlance an

editable "browse" window that supposedly could be pointed at any

database table.

For reference: Mike Driscol (Mouse vs Python) was kind enough to

demonstrate the use of ObjectListView

<http://pypi.python.org/pypi/ObjectListView> and wxPython to access an

sqlite table, which looks promising

(http://www.blog.pythonlibrary.org/2012/06/04/wxpython-and-sqlalchemy-loading-random-sqlite-databases-for-viewing/).

This is a working example, and the first I have been provided, that

demonstrates the use of a dynamic grid-like widget in wxPython that can

be created on the fly.

--

Cheers Simon

Simon Cropper - Open Content Creator / Website Administrator

Free and Open Source Software Workflow Guides

------------------------------------------------------------

Introduction http://www.fossworkflowguides.com

GIS Packages http://www.fossworkflowguides.com/gis

bash / Python http://www.fossworkflowguides.com/scripting

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

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/4FCE9B08.1030606@fossworkflowguides.com

©2012 Simon Cropper
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: Paul McNett

Posted: 2012-06-05 19:10:17   Link

On 6/5/12 4:49 PM, Simon Cropper wrote:

> Well I'm here. I am willing to be shown...

>

> So, I will throw up an apparently simple challenge. John, show me how I

> can open a simple sqlite table and present the data in a window/frame in

> an editable grid. Don't worry about the fluff, just the basic bones. The

> code should be able to be pointed at any sqlite table. In other words

> the grid is created and populated on the fly. In VFP parlance an

> editable "browse" window that supposedly could be pointed at any

> database table.

Here's a single script that creates the database, a bare-bones bizobj, and a

bare-bones UI. I hope this gets you started!

http://paulmcnett.com/test_grid_editable_sqlite.py

Paul

_______________________________________________

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/4FCE9FE9.3040208@ulmcnett.com

©2012 Paul McNett
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: Simon Cropper

Posted: 2012-06-05 19:24:07   Link

On 06/06/12 10:10, Paul McNett wrote:

> On 6/5/12 4:49 PM, Simon Cropper wrote:

>> Well I'm here. I am willing to be shown...

>>

>> So, I will throw up an apparently simple challenge. John, show me how I

>> can open a simple sqlite table and present the data in a window/frame in

>> an editable grid. Don't worry about the fluff, just the basic bones. The

>> code should be able to be pointed at any sqlite table. In other words

>> the grid is created and populated on the fly. In VFP parlance an

>> editable "browse" window that supposedly could be pointed at any

>> database table.

>

> Here's a single script that creates the database, a bare-bones bizobj, and a

> bare-bones UI. I hope this gets you started!

>

> http://paulmcnett.com/test_grid_editable_sqlite.py

>

> Paul

> _______________________________________________

> 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/4FCE9FE9.3040208@ulmcnett.com

Hi Paul,

Considering the bulk of this script is involved with creating a table

with data that is quite a small amount of code.

The code does however implies a knowledge of the underlying table

structure. Is it possible to extract the structural elements of a table,

like the field names, field type, etc so a grid could be created on the fly?

The pseudo code would be something like...

1. connect to table

3. work out number of fields (F#)

4. create a grid with same number of columns

5. populate said grid

--

Cheers Simon

Simon Cropper - Open Content Creator / Website Administrator

Free and Open Source Software Workflow Guides

------------------------------------------------------------

Introduction http://www.fossworkflowguides.com

GIS Packages http://www.fossworkflowguides.com/gis

bash / Python http://www.fossworkflowguides.com/scripting

_______________________________________________

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/4FCEA327.6030405@fossworkflowguides.com

©2012 Simon Cropper
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: John Fabiani

Posted: 2012-06-05 19:28:00   Link

On 06/05/2012 04:49 PM, Simon Cropper wrote:

> Hi,

>

> After a year of travels, learning, testing packages, requests for help

> on various fora, I have returned again to this list as people keep

> saying try Dabo! try Dabo!

>

> I keep telling them I have tried Dabo but it can't be "bent" to my

> generic needs, that it is built on a well structured business model with

> clear structured way of getting things done. I tell them that the

> framework can be modified but the main developers recommend you use

> their classes, etc to ensure compatibility.

>

> I even point out that my correspondence with the developers indicate

> that no major development to the code is likely. Still they say Dabo! Dabo!

>

> So while trying to find some code to understand how wxGrid works in

> wxPython the same mantra permeated through my treads. {Try Dabo! Try

> Dabo!}.

>

> The main protagonist was John Fabiani who eventually offered up the

> invite "I hope you will revisit Dabo and ask me how to do things."

>

> Well I'm here. I am willing to be shown...

>

> So, I will throw up an apparently simple challenge. John, show me how I

> can open a simple sqlite table and present the data in a window/frame in

> an editable grid. Don't worry about the fluff, just the basic bones. The

> code should be able to be pointed at any sqlite table. In other words

> the grid is created and populated on the fly. In VFP parlance an

> editable "browse" window that supposedly could be pointed at any

> database table.

>

> For reference: Mike Driscol (Mouse vs Python) was kind enough to

> demonstrate the use of ObjectListView

> <http://pypi.python.org/pypi/ObjectListView> and wxPython to access an

> sqlite table, which looks promising

> (http://www.blog.pythonlibrary.org/2012/06/04/wxpython-and-sqlalchemy-loading-random-sqlite-databases-for-viewing/).

> This is a working example, and the first I have been provided, that

> demonstrates the use of a dynamic grid-like widget in wxPython that can

> be created on the fly.

>

I was wondering if you might come back - Welcome back!

First let's confirm that you are setup correctly. Please provide your

platform, python and wypython versions, along with the dabo version.

But in the mean time check this link - which is nothing more than the

grid test extracted from the dGrid.py code.

http://dabo.codepad.org/R3kRkf8t

Take note that the data is created in the code - but could be from any

database. I realize this is not what Mike provided but you should note

that the code is easier to read and it take less code to display the data.

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/4FCEA410.6010506@jfcomputer.com

©2012 John Fabiani
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: John Fabiani

Posted: 2012-06-05 19:38:23   Link

On 06/05/2012 05:24 PM, Simon Cropper wrote:

> On 06/06/12 10:10, Paul McNett wrote:

>> On 6/5/12 4:49 PM, Simon Cropper wrote:

>>> Well I'm here. I am willing to be shown...

>>>

>>> So, I will throw up an apparently simple challenge. John, show me how I

>>> can open a simple sqlite table and present the data in a window/frame in

>>> an editable grid. Don't worry about the fluff, just the basic bones. The

>>> code should be able to be pointed at any sqlite table. In other words

>>> the grid is created and populated on the fly. In VFP parlance an

>>> editable "browse" window that supposedly could be pointed at any

>>> database table.

>> Here's a single script that creates the database, a bare-bones bizobj, and a

>> bare-bones UI. I hope this gets you started!

>>

>> http://paulmcnett.com/test_grid_editable_sqlite.py

>>

>> Paul

>> _______________________________________________

>> 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/4FCE9FE9.3040208@ulmcnett.com

> Hi Paul,

>

> Considering the bulk of this script is involved with creating a table

> with data that is quite a small amount of code.

>

> The code does however implies a knowledge of the underlying table

> structure. Is it possible to extract the structural elements of a table,

> like the field names, field type, etc so a grid could be created on the fly?

>

> The pseudo code would be something like...

>

> 1. connect to table

> 3. work out number of fields (F#)

> 4. create a grid with same number of columns

> 5. populate said grid

>

Dabo has a method "browse" (like in VFP) that will accept any dataset.

Read below:

def browse(dataSource, parent=None, keyCaption=None, includeFields=None,

colOrder=None, colWidths=None, colTypes=None, autoSizeCols=True):

"""

Given a data source, a form with a grid containing the data

is created and displayed. If the source is a Dabo cursor object,

its getDataSet() method will be called to extract the data.

If parent is passed, the form isn't created, and the browsegrid

becomes a child of parent instead.

The columns will be taken from the first record of the dataset,

with each

column header caption being set to the field name, unless the

optional

keyCaption parameter is passed. This parameter is a 1:1 dict containing

the data set keys as its keys, and the desired caption as the

corresponding value.

If the includeFields parameter is a sequence, the only columns

added will

be the fieldnames included in the includeFields sequence. If the

includeFields parameter is None, all fields will be added to the

grid.

The columns will be in the order returned by ds.keys(), unless the

optional colOrder parameter is passed. Like the keyCaption property,

this is a 1:1 dict containing key:order.

"""

So your job is to learn how to make a connection to the database. But

first you need to insure the setup is right - many newbies run into

trouble when they setup.

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/4FCEA67F.2080007@jfcomputer.com

©2012 John Fabiani
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: Simon Cropper

Posted: 2012-06-05 19:47:36   Link

On 06/06/12 10:28, John Fabiani wrote:

> First let's confirm that you are setup correctly. Please provide your

> platform, python and wypython versions, along with the dabo version.

Platform: Ubuntu 11.10

Python: 2.7.2+

wxPython: 2.8.11.0 (gtk2-unicode)

Dabo not installed at the moment. Lost it in recent upgrade.

Considering your comment on Paul's reply I stopped reinstalling.

Are my existing specs OK? If so, what is the best method for installing?

--

Cheers Simon

Simon Cropper - Open Content Creator / Website Administrator

Free and Open Source Software Workflow Guides

------------------------------------------------------------

Introduction http://www.fossworkflowguides.com

GIS Packages http://www.fossworkflowguides.com/gis

bash / Python http://www.fossworkflowguides.com/scripting

_______________________________________________

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/4FCEA8A8.8020902@fossworkflowguides.com

©2012 Simon Cropper
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: Paul McNett

Posted: 2012-06-05 20:02:46   Link

On 6/5/12 5:24 PM, Simon Cropper wrote:

> The pseudo code would be something like...

>

> 1. connect to table

> 3. work out number of fields (F#)

> 4. create a grid with same number of columns

> 5. populate said grid

See the new version of the file I just updated. It derives everything but the table

name and key field name.

Sorry that's all I can do right now.

Paul

_______________________________________________

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/4FCEAC36.2070000@ulmcnett.com

©2012 Paul McNett
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: Simon Cropper

Posted: 2012-06-05 20:06:35   Link

On 06/06/12 11:02, Paul McNett wrote:

> On 6/5/12 5:24 PM, Simon Cropper wrote:

>> The pseudo code would be something like...

>>

>> 1. connect to table

>> 3. work out number of fields (F#)

>> 4. create a grid with same number of columns

>> 5. populate said grid

>

> See the new version of the file I just updated. It derives everything but the table

> name and key field name.

>

> Sorry that's all I can do right now.

>

> Paul

>

> _______________________________________________

> 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/4FCEAC36.2070000@ulmcnett.com

Paul,

John is currently taking me through my setup to ensure everything is

working then I will test and play with your example.

Thanks for taking the time to demonstrate this functionality.

--

Cheers Simon

Simon Cropper - Open Content Creator / Website Administrator

Free and Open Source Software Workflow Guides

------------------------------------------------------------

Introduction http://www.fossworkflowguides.com

GIS Packages http://www.fossworkflowguides.com/gis

bash / Python http://www.fossworkflowguides.com/scripting

_______________________________________________

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/4FCEAD1B.4060108@fossworkflowguides.com

©2012 Simon Cropper
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: John Fabiani

Posted: 2012-06-05 20:14:29   Link

On 06/05/2012 05:47 PM, Simon Cropper wrote:

> On 06/06/12 10:28, John Fabiani wrote:

>> First let's confirm that you are setup correctly. Please provide your

>> platform, python and wypython versions, along with the dabo version.

> Platform: Ubuntu 11.10

> Python: 2.7.2+

> wxPython: 2.8.11.0 (gtk2-unicode)

>

> Dabo not installed at the moment. Lost it in recent upgrade.

>

> Considering your comment on Paul's reply I stopped reinstalling.

>

> Are my existing specs OK? If so, what is the best method for installing?

>

I use SVN to maintain Dabo. Since you are using Linux I recommend

installing SVNserve and use the link on the website to install Dabo. I

also use '.pth' file as a way to tell python where to find Dabo. The

only question I have is where does the "dabo.pth" need to be. Normally,

it is in the 'site-packages' but I believe that is NOT correct for

Ubuntu. I believe it goes in the 'distutils' folder. Paul and Ed

(along with others) use Ubuntu maybe they'll speak up.

Near the bottom:

http://dabodev.com/download

Next you'll have to teach yourself how to create a connection using Dabo.

http://wiki.dabodev.com/FAQs

Note that you'll want to use the one for sqlite of course.

Since, you were on the wxPython list I will assume that you can get the

file name of the database via python.

fake code:

get the database name

get a connection - use dbSqlite -> getConnection

get a cursor

getTables()

# you should have enough info to choose a table

execute an sql against the table

pass a dataset to the browse method.

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/4FCEAEF5.7070002@jfcomputer.com

©2012 John Fabiani
Back to top
Re: [dabo-users] Dabo! Everyone's answer to my question!

Author: John Fabiani

Posted: 2012-06-05 20:22:19   Link

On 06/05/2012 06:14 PM, John Fabiani wrote:

> On 06/05/2012 05:47 PM, Simon Cropper wrote:

>> On 06/06/12 10:28, John Fabiani wrote:

>>> First let's confirm that you are setup correctly. Please provide your

>>> platform, python and wypython versions, along with the dabo version.

>> Platform: Ubuntu 11.10

>> Python: 2.7.2+

>> wxPython: 2.8.11.0 (gtk2-unicode)

>>

>> Dabo not installed at the moment. Lost it in recent upgrade.

>>

>> Considering your comment on Paul's reply I stopped reinstalling.

>>

>> Are my existing specs OK? If so, what is the best method for installing?

>>

> I use SVN to maintain Dabo. Since you are using Linux I recommend

> installing SVNserve and use the link on the website to install Dabo. I

> also use '.pth' file as a way to tell python where to find Dabo. The

> only question I have is where does the "dabo.pth" need to be. Normally,

> it is in the 'site-packages' but I believe that is NOT correct for

> Ubuntu. I believe it goes in the 'distutils' folder. Paul and Ed

> (along with others) use Ubuntu maybe they'll speak up.

>

> Near the bottom:

> http://dabodev.com/download

>

> Next you'll have to teach yourself how to create a connection using Dabo.

>

> http://wiki.dabodev.com/FAQs

>

> Note that you'll want to use the one for sqlite of course.

>

> Since, you were on the wxPython list I will assume that you can get the

> file name of the database via python.

>

> fake code:

>

> get the database name

> get a connection - use dbSqlite -> getConnection

> get a cursor

> getTables()

>

>

> # you should have enough info to choose a table

>

> execute an sql against the table

> pass a dataset to the browse method.

>

> 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/4FCEAEF5.7070002@jfcomputer.com

>

Oops! I mean install the SVN client!

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/4FCEB0CB.6040909@jfcomputer.com

©2012 John Fabiani