From Dabo Wiki
Revision as of 02:54, 30 December 2016 by Ed (talk | contribs) (Created page with "=== How do I do ... in Dabo? === We used to have pretty exhaustive documentation when we were both working on Dabo every day, but due to bit rot, most is either out of date o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How do I do ... in Dabo?

We used to have pretty exhaustive documentation when we were both working on Dabo every day, but due to bit rot, most is either out of date or no longer available online. So if you can't find your answer here in this wiki, post a question to the dabo-users email list, and someone will be sure to help you.

How is Dabo licensed?

As of 11/4/2004, Dabo is licensed under the very liberal MIT License, which allows you to do whatever you want with our code, as long as the copyright notice and license terms remain intact. See http://www.dabodev.com/licensing.

Does Dabo come with its own Debugger?

Well, yes and no. If you are used to a full-fledged IDE for your development, you will probably be disappointed in Dabo's debugging capabilities. But I have had a lot of success using pudb, which gives you the ability to set breakpoints, see the call stack, and monitor variable values.

What editor should I use when working with Dabo?

Any text editor will work fine. It is recommended to use a text editor that has syntax highlighting for python. You could also use the editor that comes with Dabo. It currently has syntax highlighting and some auto completion.

How do you pronounce "Dabo"?

Paul came up with the name, and pronounces it 'dah-bo'; it rhymes with "Bob - o".

Listen to it here.

What the hell does "dabo" mean, anyway?

Everything you can imagine, and nothing at all. IOW, we're not telling .

However, we have collected various meanings of dabo from around the world on the DaboDefined page

How mature is the framework?

Dabo is actually two distinct entities: the framework itself, and the visual tools designed to make developing with the framework easier. The framework is very mature, and has not changed significantly in many years. Aside from a few bugfixes, most of the change has been in the UI layer, where we have added several new controls, and enhanced the API. The visual tools are fairly complete, but still may have a few rough edges. The visual tools are themselves written in Dabo, and I think of them as extremely complex Dabo applications. I still have things that I want to add to the Class Designer, for example, or places where some features are not fully implemented. I don't foresee having significant time to work on these visual tools in the near future.

Has anyone used Dabo in a real-world App?

Yes, there have been many, including some military applications that needed our help, but were top-secret so that we had to more or less guess what their problems were. ;-)

An equally good demonstration of what Dabo can do is the fact that all of the Dabo tools, such as the Class Designer, are written in Dabo! There are no external libraries or specialized C code anywhere; it's 100% Dabo.

How to report Problems or Bugs?

When reporting Problems or Bugs always include the versions of your Operating System, Python, Wxwidgets and Dabo. Most of the used versions of your system can be found in every Dabo app (Class Designer, AppWizard, DaboDemo) under the menu item Help/About).

If you have any problems or questions use the dabo-users mailing list.

For bug reports please use file an issue on GitHub.

What is the difference between a property and a dynamic property?

A plain property takes a value. checkbox.Enabled = False will disable the checkbox. A dynamic property takes a function. This function will be evaluated at the proper time by Dabo to dynamically determine the value of the property.

def dynEnabled():
    import datetime
    return datetime.datetime.now().minute > 30
checkbox.DynamicEnabled = dynEnabled

Now, the checkbox will be enabled only in the last half of each hour.

A dynamic property can be used at different places:

  • in the constructor:

cb = dabo.ui.dCheckBox(frm, DynamicEnabled=dynEnabled)

  • in the class definition:
class MyCheckBox(dabo.ui.dCheckBox):
    def initProperties(self):
        self.DynamicEnabled = dynEnabled

  • after instantiating:
cb = dabo.ui.dCheckBox(frm)
cb.DynamicEnabled = dynEnabled


How do I connect to a database?

Except if you are using SQLite, you will need the name of the database, username, password, server and port (there is a default port for each type of database, it is normaly not changed).

from connectInfo import ConnectInfo
from dConnection import dConnection

ci = ConnectInfo("MySQL")
ci.Host = "servername"
ci.Database = "name_of_database"
ci.User = "user_name"
ci.PlainTextPassword = "password"
#Setting the port is not realy needed.

conn = dConnection(ci).getConnection()

If you want to connect to a SQLite database, you only need the database file.

from connectInfo import ConnectInfo
from dConnection import dConnection

ci = ConnectInfo("SQLite")
ci.Database = "databasefile.db"

conn = dConnection(ci).getConnection()

How can I execute a simple query?

To execute a query you need to get a cursor and use that to execute the query.

mycursor = conn.getDaboCursor()
mycursor.execute("query here")

What is a Bizobj?

"Bizobj" is an abbreviated term for "business object", which is a programmatic object that enforces BusinessRules in an application.

How can I manipulate data on load and on save for a bizobj?

You can manipulate the data that loads into a bizobj by overriding bizobj.getFieldVal():

def getFieldVal(self, fld, row=None):
    ret = super(MyBizobj, self).getFieldVal(fld, row) 
    if fld == "field name": 
        # change ret here
    return ret

You can manipulate the data that is saved from a bizobj by overriding bizobj.setFieldVal():

def setFieldVal(self, fld, val):
    if fld == "field name": 
        # change val here
    super(MyBizobj, self).setFieldVal(fld, val)

I'm having a hard time using dBizobj, and it might be that I don't understand the underlying concept very well, but I cannot find any decent information on the subject. Can someone recommend some reading?

I don't know of any particular source, but you can do a Google search for "business object" or "3-tier" to come up with several possibilities. Here are two quick finds, one in VB and one in Visual FoxPro?:



I think it's pretty clear to most people what the UI is, and what database interaction is. The bizobj is the layer that connects the two. UIs? are boring without being able to display data, and useless if they can't take what the user has entered and store it. So the UI code asks the bizobj for its data, and then tells it to store what the user entered. But the bizobj outranks the UI; it determines if the user should be able to see the data in the first place, and if so, it handles all the details of getting that from the database. Then when the UI tells the bizobj to save the data, the bizobj first checks to make sure that the data is valid before passing it on to the database layer for storage. This is the heart of the "business" part of the name "business object": it enforces the rules that make sense for the business application it is part of. For example, your business may have a rule that it will not accept an order from an account whose current balance is more than 30 days overdue for payment. When the UI tells this Order bizobj to save a new order, it is responsible for validating that the account is in good standing, and if not, to refuse to save the order, and return an error code so that the UI knows that there is a problem and can display that to the user.

While you're Googling, also check out the chain of responsibility design pattern. It is a design in which objects are not supposed to know everything; all they know is their particular task, and which object to call when it receives a request it doesn't know how to do. Example: when you click the Save button, it doesn't know anything except that it's supposed to tell its Form that someone clicked it. The form then gets that save() message, and since it doesn't know about the database, it passes it up the chain to the bizobj. The bizobj knows that it needs to run validation on the data, and if it fails, to return an error code. However, if validation passes, it doesn't know how to actually handle the storing of the data, so it passes the save() message to the database tier. This is the object that knows how to take the data and write it to the appropriate storage, so here is where the saving actually happens. When it is done, it returns a value that indicates success or failure back to the bizobj that called it. The bizobj passes it back to the form, which then displays an appropriate message to the user.

So in a nutshell, code that deals with the display of information and interaction with the user belongs in the UI layer (form, controls). Code that deals with reading and writing to a database belongs in the data layer (dCursor). Everything else belongs in the bizobj. Hope that this helps clarify the workings of a 3-tier application design.

What are the color names available?

Dabo uses the same color names as HTML. I mean, who would want to think up new names for all those different shades? You can see what each color looks like on the ColorExamples page.

How can I draw shapes or text?

See DrawObjects.

How can I use a simple message box?

Dabo provides many simple and easy to use methods for displaying a message box.

To show a message box with the info icon:


To show a message box with the exclamation icon:


-To show a message box with the stop icon, use:


Won't real-life applications become slow when using Dabo? Or very limited compared to make-everything-you-like-in-C++?

I haven't seen anything that indicates that wxPython is any slower than any other GUI out there. wxWidgets is written in C++, and is very fast. wxPython simply wraps wxWidgets. And to be honest, in database applications, it isn't the UI that is the limiting factor; it's the database read/write operations. Dabo isn't targeted to be a graphics program, where UI speed is critical; it's a database app framework.

Can we drop down to wxPython if needed?

Yes. There is nothing that would stop you from using wxPython code and objects if needed. You would be limited to doing this in code, since the visual tools are designed to work with Dabo objects. You would also need to rely on wxPython events instead of the Dabo event model. And I would ask that if you find some place where you feel the need to use wxPython, please post a note here explaining the problem. Either there is a way to do it in Dabo that is just not obvious, as we don't follow wxPython naming all the time, or perhaps it is a part of wxPython that we have not yet wrapped. In the latter case it is very likely that we could come up with a Dabo wrapper in a very short period of time.

Is there a Dabo IDE?

Not yet. There are many visual editing tools, but we never quite got around to putting them all together into a single, unified IDE.

Can the Select/Edit/Browse Forms generated by the App Wizard be customized?

They can be customized, but only with a text editor. They are standard Python/Dabo .py code files, stored in the ui folder of the generated app.

I'm running the Class Designer on Windows, and I'm getting a SyntaxError on the last line of a method, and that line is only a comment! What did I do wrong?

You didn't do anything wrong; this is a strange behavior of the Windows Python compiler - it doesn't happen on other platforms. To fix this, either remove the comment, or add a line that does nothing afterwards, such as pass or x = 1.