Re: Working example for calling a specific form from a python script

"Adrian Maier" <[email protected]> Fri, 17 Nov 2006 16:27:19 +0200
Newsgroups gmane.comp.gnu.enterprise.general
Message-ID <[email protected]>
On 11/17/06, Jan Ischebeck <[email protected]> wrote:
> Hi Adrian,
>
> the following example is working for me (latest development version).
>
> Jan
>
> #!/usr/bin/python
>
> from gnue.forms.GFInstance import GFInstance
> from gnue.forms.uidrivers import wx26 as ui
> from gnue.forms.GFConfig import ConfigOptions
> from gnue.common.apps.GClientApp import GClientApp
>
> class gfdrunner(GClientApp):
>   def __init__ (self, connections = None):
>     self.OPTIONS['username'] = "myname"
>     self.OPTIONS['password'] = "mypassword"
>     GClientApp.__init__ (self, connections, 'forms', ConfigOptions)
>
>     self.configurationManager.registerAlias ('gConfigForms', 'forms')
>
>   def run(self):
>     instance = GFInstance(manager=self,
>                connections=self.connections,
>                ui=ui, disableSplash=1)
>
>     instance.addFormFromFile('F:\gnue\samples\gauntlet.gfd')
>     instance.activate()
>
> r = gfdrunner()
> r.run()

Hello Jan,

This script works here, too. But it asked me for a username and password,
in console mode :

************************************************************
GNU Enterprise: Login to db_faf

  Login required for
"DB_FAF"

  User Name: am
  Password:

Then the form started with the wx ui.  A little strange, but it's an important
step forward:  the form ran !

James had explained me a couple of days ago, on irc,  that it's necessary to
define a login manager class that returns the user and password.  I'll try doing
that next.


Thanks !

Adrian Maier