The startup process of an application depends on two factors.Is this and application for making other applications or is this a standalone application. The folder structure is the same for both types, but when it comes to making an application for making other applications or holding sub applications, this one contains several new steps when starting up. This documents consists only of the first part. The other part can be found in another document.

The first startup path without sub applications

from debcore.errors import DG3Exception
from debcore.paths import getpaths
from debcore.settings import getsettings
from dereporter.reportermain import DEReporter

appdef = {
    'type' : 'application',
    'title' : 'DE Reporter',
    'appname' : 'DEReporter',
    'appversion' : '@getappversion()',
    'orgname' : '4ThePeople Ltd',
    'orgdomain' : '',
    'appicon' : 'icon:DE8Reporter_32.png',

# code is properly divided between Application(DG3Designer), DG3MainWindow and MainWindow
    getpaths(startpath='My DEReporter',prefix='DEReporter') # Initialize paths with reporter parameters
    getsettings() # Initialize settings with reporter defaults
    app = DEReporter(appdef)
except DG3Exception as e:
    print "Error in loading DE Reporter\n%s" % e.formaterror(allinfo=True)

Typical bootstrap code

The steps are:

  1. Create the global application paths using the getpaths command
  2. Load or create global settings based on the global paths and if the application has been started before
  3. Create the application object using the appdef object
  4. Run the application

The application startup code consists of a class based on Application and a main window factory that loads a main window.

from import Application

class DEReporter(Application):
    def __init__(self, eldef):
        self.__repo = None

    def _mainwinfactory(self,eldef):
        return DEReporterMainWindow()

The application startup code

The steps are:

  1. Do internal setup
  2. Do init of super application object with a main window factory for creating your custom main window
  3. Add code for the factory that creates and return the windows object with the application object as definition

The main window startup code uses a template stored in the template path (described in the global path document)

from debguiqt import MainWindow

class DEReporterMainWindow(MainWindow):
    def __init__(self, eldef=None):

    def _runatstartup(self):
        bounds ='bounds')
        states ='windowstates')
        if bounds and states:
        super(MainWindow, self)._runatstartup()

The main window will also look for a _runatstartup method that is run when the window is shown and the application message queue are started. It you override it make sure you call the super version as well since that one also looks in the window definition for a doafterstartup  actions.