[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5630 - trunk/gnue-forms/samples/connections
From: |
btami |
Subject: |
r5630 - trunk/gnue-forms/samples/connections |
Date: |
Sun, 4 Apr 2004 16:21:19 -0500 (CDT) |
Author: btami
Date: 2004-04-04 16:21:18 -0500 (Sun, 04 Apr 2004)
New Revision: 5630
Modified:
trunk/gnue-forms/samples/connections/connection.gfd
Log:
added a 'Test Connection' button
Modified: trunk/gnue-forms/samples/connections/connection.gfd
===================================================================
--- trunk/gnue-forms/samples/connections/connection.gfd 2004-04-04 00:17:34 UTC
(rev 5629)
+++ trunk/gnue-forms/samples/connections/connection.gfd 2004-04-04 21:21:18 UTC
(rev 5630)
@@ -1,165 +1,262 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="iso8859-1"?>
+
+<!-- GNUe-Designer (0.5.3.99)
+ Saved on: 2004-04-04 15:24:39 -->
+
+<form title="Editor for Connection Settings">
+ <trigger type="on-activation">
+ blkUnbound.fldUI = getParameter('ui')
+ </trigger>
+ <connection name="connection_config" comment=""
+ dbname="%configdir%/connections.conf" host=""
provider="special.configfile"/>
+ <datasource name="connection_dtsrc" connection="connection_config"/>
+ <datasource name="dtsDrpProvider" type="static">
+ <staticset fields="provider,descr">
+ <staticsetrow>
+ <staticsetfield name="provider" value="adodbapi"/>
+ <staticsetfield name="descr" value="MS ADO"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="appserver"/>
+ <staticsetfield name="descr" value="GNUe appserver"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="cxoracle"/>
+ <staticsetfield name="descr" value="Oracle (cxoracle)"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="db2"/>
+ <staticsetfield name="descr" value="DB2"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="dcoracle"/>
+ <staticsetfield name="descr" value="Oracle (dcoracle)"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="gadfly"/>
+ <staticsetfield name="descr" value="Gadfly"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="informix"/>
+ <staticsetfield name="descr" value="Informix"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="ingres"/>
+ <staticsetfield name="descr" value="Ingres"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="interbase"/>
+ <staticsetfield name="descr" value="Interbase/Firebird"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="wodbc"/>
+ <staticsetfield name="descr" value="PythonWin ODBC"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="mysql"/>
+ <staticsetfield name="descr" value="MySql"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="popy"/>
+ <staticsetfield name="descr" value="Postgresql (popy)"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="pygresql"/>
+ <staticsetfield name="descr" value="Postgresql (pygresql)"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="psycopg"/>
+ <staticsetfield name="descr" value="Postgresql (psycopg)"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="pypgsql"/>
+ <staticsetfield name="descr" value="Postgresql (pypgsql)"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="sapdb"/>
+ <staticsetfield name="descr" value="SAP-DB/MaxDB"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="sqlite"/>
+ <staticsetfield name="descr" value="SQLite"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="sqlrelay"/>
+ <staticsetfield name="descr" value="SQLRelay"/>
+ </staticsetrow>
+ <staticsetrow>
+ <staticsetfield name="provider" value="sybase"/>
+ <staticsetfield name="descr" value="Sybase"/>
+ </staticsetrow>
+ </staticset>
+ </datasource>
+ <logic>
+ <block name="blkUnbound">
+ </block>
+ <block name="Block_1" datasource="connection_dtsrc">
+ <field name="SecE" field="_section_name">
+ <options>
+ <option name="tip"
+ value="Name of the connection, as it is used in the
datasource tag."/>
+ </options>
+ </field>
+ <field name="aliasE" field="aliases">
+ <options>
+ <option name="tip"
+ value="A space seperated list of aliases for this
connection."/>
+ </options>
+ </field>
+ <field name="provE" field="provider" fk_description="descr"
+ fk_key="provider" fk_source="dtsDrpProvider"/>
+ <field name="descrE" field="comment"/>
+ <field name="hostE" field="host"/>
+ <field name="portE" field="port"/>
+ <field name="dbE" field="dbname"/>
+ <field name="encE" field="encoding"/>
+ <field name="rpctE" field="rpctype"/>
+ <field name="tranE" field="transport"/>
+ <field name="servE" field="service"/>
+ </block>
+ </logic>
+ <layout xmlns:Char="GNUe:Layout:Char" Char:height="19" Char:width="50">
+ <page name="Conn">
+ <label name="Label_1" Char:height="1" Char:width="30" Char:x="6"
+ Char:y="1" text="Editor for Connection Settings"/>
+ <box name="setbox" Char:height="13" Char:width="48" Char:x="1"
+ Char:y="4" label="Settings"/>
+ <label name="SecL" Char:height="1" Char:width="16" Char:x="2" Char:y="3"
+ text="Connection name:"/>
+ <label name="aliasL" Char:height="1" Char:width="15" Char:x="2"
+ Char:y="6" text="Aliases (opt.):"/>
+ <label name="provL" Char:height="1" Char:width="16" Char:x="2"
+ Char:y="7" text="Provider (req.):"/>
+ <label name="descrL" Char:height="1" Char:width="12" Char:x="2"
+ Char:y="8" text="Comment:"/>
+ <label name="hostL" Char:height="1" Char:width="5" Char:x="2" Char:y="9"
+ text="Host:"/>
+ <label name="portL" Char:height="1" Char:width="9" Char:x="2"
+ Char:y="10" text="Port:"/>
+ <label name="dbL" Char:height="1" Char:width="9" Char:x="2" Char:y="11"
+ text="Database:"/>
+ <label name="encL" Char:height="1" Char:width="9" Char:x="2" Char:y="13"
+ text="Encoding:"/>
+ <label name="rpctL" Char:height="1" Char:width="19" Char:x="2"
+ Char:y="14" text="RPC type (appsrv.):"/>
+ <label name="transL" Char:height="1" Char:width="20" Char:x="2"
+ Char:y="15" text="Transport (appsrv.):"/>
+ <label name="servL" Char:height="1" Char:width="9" Char:x="2"
+ Char:y="12" text="Service:"/>
+ <entry name="Entry1" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="3" block="Block_1" field="SecE" label=""/>
+ <entry name="Entry2" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="6" block="Block_1" field="aliasE" label=""/>
+ <entry name="Entry3" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="7" block="Block_1" field="provE" label=""
style="dropdown"/>
+ <entry name="Entry4" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="8" block="Block_1" field="descrE" label=""/>
+ <entry name="Entry5" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="9" block="Block_1" field="hostE" label=""/>
+ <entry name="Entry6" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="10" block="Block_1" field="portE" label=""/>
+ <entry name="Entry7" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="11" block="Block_1" field="dbE" label=""/>
+ <entry name="Entry8" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="13" block="Block_1" field="encE" label=""/>
+ <entry name="Entry9" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="14" block="Block_1" field="rpctE" label=""/>
+ <entry name="Entry10" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="15" block="Block_1" field="tranE" label=""/>
+ <entry name="Entry11" Char:height="1" Char:width="25" Char:x="22"
+ Char:y="12" block="Block_1" field="servE" label=""/>
+ <button name="TestConnection" Char:height="1" Char:width="17"
+ Char:x="30" Char:y="17" label="Test connection">
+ <trigger type="ON-ACTION" name="TestConnection"><![CDATA[##
+from gnue.common.utils.FileUtils import dyn_import
+if blkUnbound.fldUI:
+ myLoginHandler = dyn_import('gnue.forms.uidrivers.%s.UILoginHandler'
%blkUnbound.fldUI)
+else:
+ from gnue.forms.uidrivers.wx import UILoginHandler as myLoginHandler
+
+from gnue.common.datasources.GConnections import GConnections
+from gnue.common.datasources.GDataObjects import LoginError
+from gnue.common.apps.plugin import find, LoadError
+
+name = form.getCurrentBlock()._fieldMap['SecE'].getValue()
+provider = form.getCurrentBlock()._fieldMap['provE'].getValue()
-<!-- GNUe Designer (0.5.0.99)
- Saved on: 2003-05-27 10:31:41 -->
+try:
+ base = 'gnue.common.datasources.drivers'
+ testDriver = find(provider, base, 'Connection')
+ print 'provider', provider, "OK"
+except LoadError, arg:
+ print arg
-<form name="__main__" title="Editor for Connection Settings">
- <connection name="connection_config" comment=""
- dbname="%configdir%/connections.conf" host=""
provider="special.configfile"/>
- <datasource name="connection_dtsrc" connection="connection_config"/>
- <datasource name="dtsDrpProvider" type="static">
- <staticset fields="provider,descr">
- <staticsetrow>
- <staticsetfield name="provider" value="adodbapi"/>
- <staticsetfield name="descr" value="MS ADO"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="appserver"/>
- <staticsetfield name="descr" value="GNUe appserver"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="cxoracle"/>
- <staticsetfield name="descr" value="Oracle (cxoracle)"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="db2"/>
- <staticsetfield name="descr" value="DB2"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="dcoracle"/>
- <staticsetfield name="descr" value="Oracle (dcoracle)"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="gadfly"/>
- <staticsetfield name="descr" value="Gadfly"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="informix"/>
- <staticsetfield name="descr" value="Informix"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="ingres"/>
- <staticsetfield name="descr" value="Ingres"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="interbase"/>
- <staticsetfield name="descr" value="Interbase/Firebird"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="wodbc"/>
- <staticsetfield name="descr" value="PythonWin ODBC"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="mysql"/>
- <staticsetfield name="descr" value="MySql"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="popy"/>
- <staticsetfield name="descr" value="Postgresql (popy)"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="pygresql"/>
- <staticsetfield name="descr" value="Postgresql (pygresql)"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="psycopg"/>
- <staticsetfield name="descr" value="Postgresql (psycopg)"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="pypgsql"/>
- <staticsetfield name="descr" value="Postgresql (pypgsql)"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="sapdb"/>
- <staticsetfield name="descr" value="SAP-DB/MaxDB"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="sqlite"/>
- <staticsetfield name="descr" value="SQLite"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="sqlrelay"/>
- <staticsetfield name="descr" value="SQLRelay"/>
- </staticsetrow>
- <staticsetrow>
- <staticsetfield name="provider" value="sybase"/>
- <staticsetfield name="descr" value="Sybase"/>
- </staticsetrow>
- </staticset>
- </datasource>
- <logic>
- <block name="Block_1" datasource="connection_dtsrc">
- <field name="SecE" field="_section_name">
- <options>
- <option name="tip"
- value="Name of the connection, as it is used in the
datasource tag."/>
- </options>
- </field>
- <field name="aliasE" field="aliases">
- <options>
- <option name="tip"
- value="A space seperated list of aliases for this
connection."/>
- </options>
- </field>
- <field name="provE" field="provider" fk_description="descr"
- fk_key="provider" fk_source="dtsDrpProvider"/>
- <field name="descrE" field="comment"/>
- <field name="hostE" field="host"/>
- <field name="portE" field="port"/>
- <field name="dbE" field="dbname"/>
- <field name="encE" field="encoding"/>
- <field name="rpctE" field="rpctype"/>
- <field name="tranE" field="transport"/>
- <field name="servE" field="service"/>
- </block>
- </logic>
- <layout xmlns:Char="GNUe:Layout:Char" Char:height="17" Char:width="50">
- <page name="Connection.conf">
- <label name="Label_1" Char:width="30" Char:x="6" Char:y="1"
- text="Editor for Connection Settings"/>
- <box name="setbox" Char:height="13" Char:width="48" Char:x="1"
- Char:y="4" label="Settings"/>
- <label name="SecL" Char:width="16" Char:x="2" Char:y="3"
- text="Connection name:"/>
- <label name="aliasL" Char:width="15" Char:x="2" Char:y="6"
- text="Aliases (opt.):"/>
- <label name="provL" Char:width="16" Char:x="2" Char:y="7"
- text="Provider (req.):"/>
- <label name="descrL" Char:width="12" Char:x="2" Char:y="8"
- text="Comment:"/>
- <label name="hostL" Char:width="5" Char:x="2" Char:y="9" text="Host:"/>
- <label name="portL" Char:width="9" Char:x="2" Char:y="10" text="Port:"/>
- <label name="dbL" Char:width="9" Char:x="2" Char:y="11"
text="Database:"/>
- <label name="encL" Char:width="9" Char:x="2" Char:y="13"
- text="Encoding:"/>
- <label name="rpctL" Char:width="19" Char:x="2" Char:y="14"
- text="RPC type (appsrv.):"/>
- <label name="transL" Char:width="20" Char:x="2" Char:y="15"
- text="Transport (appsrv.):"/>
- <label name="servL" Char:width="9" Char:x="2" Char:y="12"
- text="Service:"/>
- <entry name="Entry1" Char:width="25" Char:x="22" Char:y="3"
- block="Block_1" field="SecE"/>
- <entry name="Entry2" Char:width="25" Char:x="22" Char:y="6"
- block="Block_1" field="aliasE"/>
- <entry name="Entry3" Char:width="25" Char:x="22" Char:y="7"
- block="Block_1" field="provE" style="dropdown"/>
- <entry name="Entry4" Char:width="25" Char:x="22" Char:y="8"
- block="Block_1" field="descrE"/>
- <entry name="Entry5" Char:width="25" Char:x="22" Char:y="9"
- block="Block_1" field="hostE"/>
- <entry name="Entry6" Char:width="25" Char:x="22" Char:y="10"
- block="Block_1" field="portE"/>
- <entry name="Entry7" Char:width="25" Char:x="22" Char:y="11"
- block="Block_1" field="dbE"/>
- <entry name="Entry8" Char:width="25" Char:x="22" Char:y="13"
- block="Block_1" field="encE"/>
- <entry name="Entry9" Char:width="25" Char:x="22" Char:y="14"
- block="Block_1" field="rpctE"/>
- <entry name="Entry10" Char:width="25" Char:x="22" Char:y="15"
- block="Block_1" field="tranE"/>
- <entry name="Entry11" Char:width="25" Char:x="22" Char:y="12"
- block="Block_1" field="servE"/>
- </page>
+ parameters = {'message':arg}
+ modal = 1
+ activateDialog('messageDialog',parameters,modal)
+ return
+
+try:
+ connections = GConnections('')
+
+ lh = myLoginHandler()
+ param = lh.getLogin([name,name, [('_username', 'Username', False),
+ ('_password', 'Password', True)]])
+
+ param['host'] = form.getCurrentBlock()._fieldMap['hostE'].getValue()
+ param['dbname'] = form.getCurrentBlock()._fieldMap['dbE'].getValue()
+
+ conn = testDriver.Connection.Connection(connections, name, param)
+ conn.connect(param)
+ print 'Connection to ', name, " is OK."
+ del conn
+
+ parameters = {'message':'Connection to %s is OK' %name}
+ modal = 1
+ activateDialog('messageDialog',parameters,modal)
+ return
+
+except LoginError, arg:
+ print arg
+
+ parameters = {'message':arg}
+ modal = 1
+ activateDialog('messageDialog',parameters,modal)
+ return
+
+]]></trigger>
+ </button>
+ </page>
</layout>
-</form>
+
+ <dialog xmlns:c="GNUe:Layout:Char" name="messageDialog">
+ <trigger type="On-Startup">
+ form.setFeature('GUI:MENUBAR:SUPPRESS',1)
+ form.setFeature('GUI:TOOLBAR:SUPPRESS',1)
+ form.setFeature('GUI:STATUSBAR:SUPPRESS',1)
+ </trigger>
+ <trigger type="on-activation">
+ msgBlock.message = getParameter('message')
+ </trigger>
+
+ <options/>
+ <logic>
+ <block name="msgBlock">
+ <field name="message"/>
+ </block>
+ </logic>
+
+ <layout c:height="11" c:width="51">
+ <page name="Page_1">
+ <entry block="msgBlock" field="message" c:width="49" c:height="6"
c:x="1" c:y="2"/>
+ <button name="ok" c:height="1" c:width="4" c:x="24" c:y="9"
+ label="OK">
+ <trigger name="Trigger1" type="On-Action"><![CDATA[##
+ close()
+]]></trigger>
+ </button>
+ </page>
+ </layout>
+ </dialog>
+
+</form>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5630 - trunk/gnue-forms/samples/connections,
btami <=