[Fwd: Problems with PyGridTableBase]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mario Lacunza

    #1

    [Fwd: Problems with PyGridTableBase]

    --------- Mensaje reenviado --------
    De: Mario Lacunza <mario.lacunza@ gmail.com>
    Para: Lista Python Ing <python-list@python.org >
    Asunto: Problems with PyGridTableBase
    Fecha: Sat, 09 Sep 2006 00:03:20 -0500

    Hello,

    I attach two files:frmClient es and frmClientesNE.

    frmClientes charge a Grid with resume Costumers data: Name, Commercial
    ID, address, etc. and edition options.

    frmClientes in

    Line 178
    def OnBtnNuevoButto n(self, event):

    call to frmClientesNE. Its append a new record to the database and clear
    all controls and when I close it, the grid in frmClientes: grClte must
    be recharge with the new data, but that dont work. Only work when a
    Delete some record.

    I couldnt send yours a runable .py version, because both of them files
    pickup data from a Firebird's database.

    I try to implement the wxPython Demo model: Grid_MegaExampl e, follow
    that my class Grilla must be:

    Line 224:
    class Grilla(Grid.Gri d):

    but for the Boa Constructors controls creation I couldnt inherit from
    Grid.Grid, thats my problem, I need your help I try for two days and
    nothing :-( ... some ideas??

    Thanks in advance!!

    =============== =============== =============== =============== ==========
    FILE: FRMCLIENTES.PY
    =============== =============== =============== =============== ==========

    # -*- coding: utf8 -*-#
    #Boa:Frame:frmC lientes

    __version__='0. 5'
    __autor__='Mari o Lacunza Vasquez <mlacunza@gmail .com>'

    import wx
    import wx.grid
    import modGlobals
    from Conectar import Conectar
    import errores

    def create(parent):
    return frmClientes(par ent)

    [wxID_FRMCLIENTE S, wxID_FRMCLIENTE SBRNSALIR, wxID_FRMCLIENTE SBTNBORRAR,
    wxID_FRMCLIENTE SBTNEDIT, wxID_FRMCLIENTE SBTNNUEVO,
    wxID_FRMCLIENTE SGRCLTE,
    wxID_FRMCLIENTE SLBLTITULO, wxID_FRMCLIENTE SPANEL1,
    ] = [wx.NewId() for _init_ctrls in range(8)]

    class frmClientes(wx. Frame):
    def _init_coll_fsGr id_Growables(se lf, parent):
    # generated method, don't edit

    parent.AddGrowa bleRow(0)

    def _init_coll_fsGr id_Items(self, parent):
    # generated method, don't edit

    parent.AddWindo w(self.grClte, 0, border=2, flag=wx.EXPAND |
    wx.ALL)

    def _init_coll_fsBt n_Items(self, parent):
    # generated method, don't edit

    parent.AddWindo w(self.btnNuevo , 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    parent.AddWindo w(self.btnEdit, 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    parent.AddWindo w(self.btnBorra r, 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    parent.AddWindo w(self.brnSalir , 0, border=2, flag=wx.EXPAND |
    wx.ALL)

    def _init_coll_fsTi t_Items(self, parent):
    # generated method, don't edit

    parent.AddWindo w(self.lblTitul o, 0, border=6, flag=wx.EXPAND)

    def _init_coll_bsCl te_Items(self, parent):
    # generated method, don't edit

    parent.AddWindo w(self.panel1, 1, border=0, flag=wx.EXPAND)

    def _init_coll_fsTi t_Growables(sel f, parent):
    # generated method, don't edit

    parent.AddGrowa bleRow(0)

    def _init_coll_fsCl te_Growables(se lf, parent):
    # generated method, don't edit

    parent.AddGrowa bleRow(0)
    parent.AddGrowa bleRow(1)
    parent.AddGrowa bleRow(2)
    parent.AddGrowa bleCol(0)

    def _init_coll_fsCl te_Items(self, parent):
    # generated method, don't edit

    parent.AddSizer (self.fsTit, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    parent.AddSizer (self.fsGrid, 1, border=10,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    parent.AddSizer (self.fsBtn, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)

    def _init_sizers(se lf):
    # generated method, don't edit
    self.bsClte = wx.BoxSizer(ori ent=wx.VERTICAL )

    self.fsClte = wx.FlexGridSize r(cols=1, hgap=0, rows=0, vgap=0)

    self.fsTit = wx.FlexGridSize r(cols=1, hgap=0, rows=0, vgap=0)

    self.fsGrid = wx.FlexGridSize r(cols=1, hgap=5, rows=0, vgap=5)

    self.fsBtn = wx.FlexGridSize r(cols=4, hgap=0, rows=0, vgap=0)

    self._init_coll _bsClte_Items(s elf.bsClte)
    self._init_coll _fsClte_Growabl es(self.fsClte)
    self._init_coll _fsClte_Items(s elf.fsClte)
    self._init_coll _fsTit_Growable s(self.fsTit)
    self._init_coll _fsTit_Items(se lf.fsTit)
    self._init_coll _fsGrid_Growabl es(self.fsGrid)
    self._init_coll _fsGrid_Items(s elf.fsGrid)
    self._init_coll _fsBtn_Items(se lf.fsBtn)

    self.SetSizer(s elf.bsClte)
    self.panel1.Set Sizer(self.fsCl te)

    def _init_ctrls(sel f, prnt):
    # generated method, don't edit
    wx.Frame.__init __(self, id=wxID_FRMCLIE NTES,
    name=u'frmClien tes',
    parent=prnt, pos=wx.Point(35 2, 148), size=wx.Size(58 9,
    514),
    style=wx.DEFAUL T_FRAME_STYLE, title=u'Cliente s')
    self.SetClientS ize(wx.Size(589 , 514))

    self.panel1 = wx.Panel(id=wxI D_FRMCLIENTESPA NEL1, name='panel1',
    parent=self, pos=wx.Point(0, 0), size=wx.Size(58 9, 514),
    style=wx.TAB_TR AVERSAL)

    self.lblTitulo = wx.StaticText(i d=wxID_FRMCLIEN TESLBLTITULO,
    label=u'',
    name=u'lblTitul o', parent=self.pan el1, pos=wx.Point(25 8,
    0),
    size=wx.Size(72 , 19), style=0)
    self.lblTitulo. Center(wx.HORIZ ONTAL)
    self.lblTitulo. SetFont(wx.Font (12, wx.SWISS, wx.NORMAL, wx.BOLD,
    False,
    u'Sans'))

    self.grClte = wx.grid.Grid(id =wxID_FRMCLIENT ESGRCLTE,
    name=u'grClte',
    parent=self.pan el1, pos=wx.Point(10 , 63),
    size=wx.Size(56 8, 326),
    style=0)
    self.grClte.Ena bleEditing(Fals e)
    self.grClte.Bin d(wx.grid.EVT_G RID_SELECT_CELL ,
    self.OnGrClteGr idSelectCell)

    self.btnNuevo = wx.Button(id=wx ID_FRMCLIENTESB TNNUEVO,
    label=u'Nuevo',
    name=u'btnNuevo ', parent=self.pan el1, pos=wx.Point(11 8,
    435),
    size=wx.Size(85 , 34), style=0)
    self.btnNuevo.S etToolTipString (u'Nuevo Cliente')
    self.btnNuevo.B ind(wx.EVT_BUTT ON, self.OnBtnNuevo Button,
    id=wxID_FRMCLIE NTESBTNNUEVO)

    self.btnEdit = wx.Button(id=wx ID_FRMCLIENTESB TNEDIT,
    label=u'Editar' ,
    name=u'btnEdit' , parent=self.pan el1, pos=wx.Point(20 7,
    435),
    size=wx.Size(85 , 34), style=0)
    self.btnEdit.Se tToolTipString( u'Editar Cliente')
    self.btnEdit.Bi nd(wx.EVT_BUTTO N, self.OnBtnEditB utton,
    id=wxID_FRMCLIE NTESBTNEDIT)

    self.btnBorrar = wx.Button(id=wx ID_FRMCLIENTESB TNBORRAR,
    label=u'Elimina r', name=u'btnBorra r', parent=self.pan el1,
    pos=wx.Point(29 6, 435), size=wx.Size(85 , 34), style=0)
    self.btnBorrar. SetToolTipStrin g(u'Eliminar Cliente')
    self.btnBorrar. Bind(wx.EVT_BUT TON, self.OnBtnBorra rButton,
    id=wxID_FRMCLIE NTESBTNBORRAR)

    self.brnSalir = wx.Button(id=wx ID_FRMCLIENTESB RNSALIR,
    label=u'Salir',
    name=u'brnSalir ', parent=self.pan el1, pos=wx.Point(38 5,
    435),
    size=wx.Size(85 , 34), style=0)
    self.brnSalir.S etToolTipString (u'Salir')
    self.brnSalir.B ind(wx.EVT_BUTT ON, self.OnBrnSalir Button,
    id=wxID_FRMCLIE NTESBRNSALIR)

    self._init_size rs()

    def __init__(self, parent):
    self._init_ctrl s(parent)

    self.CrearGrid( )

    #-------------------------------------------------------------------------------
    def CrearGrid(self) :
    #Setea la Tabla para el Grid
    self.table = Tabla()
    self.grClte.Set Table(self.tabl e, True)

    #Setea el ancho de las columnas del Grid
    self.grClte.Set ColSize(0,50)
    self.grClte.Set ColSize(2,150)
    self.grClte.Set ColSize(4,250)

    #-------------------------------------------------------------------------------

    def OnBtnNuevoButto n(self, event):
    #Nuevo
    import frmClientesNE
    x=frmClientesNE .create(None,"N ")
    x.Show()

    def OnBtnEditButton (self, event):
    #Editar
    import frmClientesNE
    x=frmClientesNE .create(None,"E ",self.Valo r)
    x.Show()

    def OnBtnBorrarButt on(self, event):
    self.oD=D_Cltes ()

    dlg=wx.MessageD ialog(self,u'¿ Está seguro de eliminar este
    Cliente?', \
    'PymeGestor',wx .YES_NO | wx.ICON_QUESTIO N)
    rpta=dlg.ShowMo dal()
    if (rpta==wx.ID_YE S):
    self.oD.Borrar( self.Valor)
    dlg2=wx.Message Dialog(self,u'E l Cliente fue el eliminado con
    éxito.', \
    'PymeGestor',wx .OK | wx.ICON_INFORMA TION)
    dlg2.ShowModal( )
    dlg2.Destroy()
    else:
    pass

    dlg.Destroy()

    def OnBrnSalirButto n(self, event):
    self.Close(True )

    def OnGrClteGridSel ectCell(self, event):
    #Obtiene el valor de la celda seleccionada.
    self.R=event.Ge tRow()
    #Fija como 0 la celda q contiene el campo ID.
    self.C = 0

    self.Valor=self .table.GetValue (self.R,self.C)

    event.Skip()


    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    class Tabla(wx.grid.P yGridTableBase) :
    """Clase que maneja la grilla de Datos."""

    def __init__(self):
    wx.grid.PyGridT ableBase.__init __(self)

    self.oCltes=D_C ltes()
    self.data=self. oCltes.CargarCl ientes()

    #Setea el Numero de Columnas a mostrar por el SQL
    self.Columnas=7

    #Setea los titulos del Grid
    self.colLabels = ["ID", "CODIGO", "CLIENTE", "NRO.DOC.",
    "DIRECCION" , "TELEFONO","EMA IL"]

    def GetNumberRows(s elf):
    r=len(self.data )
    return r

    def GetNumberCols(s elf):
    return self.Columnas

    def IsEmptyCell(sel f, row, col):
    return False

    def GetValue(self, row, col):
    #Muestra los datos devueltos por el Recordset
    value=self.data[row][col]
    if value is not None:
    return value
    else:
    return ''

    def SetValue(self, row, col, value):
    try:
    self.data[row][col] = value
    except IndexError:
    # add a new row
    self.data.appen d([''] * self.GetNumberC ols())
    self.SetValue(r ow, col, value)
    # tell the grid we've added a row
    msg = wxGridTableMess age(self, # The table
    wxGRIDTABLE_NOT IFY_ROWS_APPEND ED, # what we did to
    it
    1 # how many
    )
    self.GetView(). ProcessTableMes sage(msg)

    def GetColLabelValu e(self, col):
    return self.colLabels[col]

    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------

    class O_Cltes:
    """Clase de Negocios para el manejo de los Clientes."""
    def __init__(self):
    """ Constructor."""


    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------

    class D_Cltes:
    """Maneja las operaciones con clientes."""

    mCodigo=None
    mNombre=None
    mTipoDoc=None
    mNumDoc=None
    mDireccion=None
    mPostal=None
    mFono1=None
    mFono2=None
    mFax=None
    mEmail=None
    mCelular=None
    mWeb=None
    mLinCredito=Non e

    def __init__(self):
    """ Constructor."""

    #Instancia la Clase
    self.cnn=Conect ar()

    #Obtiene cadena de Conexion
    self.cnn.__clas s__.cnn=modGlob als.CNN

    #-------------------------------------------------------------------------------

    def CargarClientes( self):
    """Genera lista de Clientes."""

    sql="Select ID, Codigo, Nombre, NumDoc, Direccion, Fono1, Email
    from tblClientes"
    self.cnn.__clas s__.SQL=sql

    try:
    rs=self.cnn.Eje cutarSQL()
    return rs

    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    #-------------------------------------------------------------------------------
    def Borrar(self, mCod):
    """Borra Cliente de la Bd."""

    sql="Delete from tblClientes Where ID=%d"%(mCod)
    self.cnn.__clas s__.SQL=sql

    try:
    rs=self.cnn.Eje cutarSQL('Delet e')
    return True

    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    #-------------------------------------------------------------------------------

    def CargaTDoc(self) :

    sql="Select ID, Detalle from tblTipoDoc"
    self.cnn.__clas s__.SQL=sql

    try:
    rs=self.cnn.Eje cutarSQL()
    return rs

    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec

    #-------------------------------------------------------------------------------

    def Graba(self):
    """Graba los datos."""

    #Obtiene el codigo
    self.__class__. mCodigo=self.Ge neraCod()

    sql="Insert into tblClientes(ID, CODIGO, NOMBRE, TIPODOC,
    NUMDOC, DIRECCION, POSTAL,\
    FONO1,FONO2,FAX , EMAIL, CELULAR, WEB, LINCREDITO)\
    VALUES(GEN_ID(G EN_TBLCLIENTES_ ID,1),\
    '%s', '%s', %d, '%s', '%s','%s','%s', '%s','%s','%s', '%s','%s',%
    d)"\
    %(self.__class_ _.mCodigo, self.__class__. mNombre,
    self.__class__. mTipoDoc, self.__class__. mNumDoc,\
    self.__class__. mDireccion, self.__class__. mPostal,
    self.__class__. mFono1,\
    self.__class__. mFono2, self.__class__. mFax,
    self.__class__. mEmail,\
    self.__class__. mCelular, self.__class__. mWeb,
    self.__class__. mLinCredito)

    self.cnn.__clas s__.SQL=sql

    try:
    rs=self.cnn.Eje cutarSQL('Inser t')
    if rs==False:
    return False
    else:
    return True

    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec

    self.CargarClie ntes()
    #-------------------------------------------------------------------------------

    def GeneraCod(self) :
    """Genera el Codigo Unico para este cliente."""

    sql="Select MAX(Codigo) from tblClientes"
    self.cnn.__clas s__.SQL=sql

    try:
    rs=self.cnn.Eje cutarSQL()
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec

    #Si es el primer registro en la Tabla
    if rs[0][0]==None:
    cod=modGlobals. CrearCodigo('', 'C',9)
    else:
    cod=modGlobals. CrearCodigo(rs[0][0],'C', 9)

    return cod

    #-------------------------------------------------------------------------------

    def Edita(self, mCod):
    """Edita los datos."""

    sql="Update Where ID=%d" %(mCod)

    self.cnn.__clas s__.SQL=sql

    try:
    rs=self.cnn.Eje cutarSQL('Updat e')
    if rs==False:
    return False
    else:
    return True


    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec

    #-------------------------------------------------------------------------------
    def BuscarClte(self ,mCod):

    sql="Select * From tblClientes Where ID=%d" %(mCod)

    self.cnn.__clas s__.SQL=sql

    try:
    rs=self.cnn.Eje cutarSQL()
    return rs
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec


    =============== =============== =============== =============== ==========
    =============== =============== =============== =============== ==========
    =============== =============== =============== =============== ==========


    =============== =============== =============== =============== ==========
    FILE: FRMCLIENTESNE.P Y
    =============== =============== =============== =============== ==========

    # -*- coding: utf8 -*-#
    #Boa:Frame:Fram e1

    import wx
    import modGlobals
    from Conectar import Conectar
    import errores
    from frmClientes import D_Cltes

    def create(parent, mTipo, mCodClte=''):
    return Frame1(parent, mTipo, mCodClte)

    [wxID_FRAME1, wxID_FRAME1BTNO K, wxID_FRAME1BTNS ALIR,
    wxID_FRAME1CBOT IPODOC,
    wxID_FRAME1LBLC EL, wxID_FRAME1LBLC OD, wxID_FRAME1LBLC ODIGO,
    wxID_FRAME1LBLC P,
    wxID_FRAME1LBLC TE, wxID_FRAME1LBLD IREC, wxID_FRAME1LBLE MAIL,
    wxID_FRAME1LBLF 1, wxID_FRAME1LBLF 2, wxID_FRAME1LBLF AX,
    wxID_FRAME1LBLL IN,
    wxID_FRAME1LBLN UM, wxID_FRAME1LBLT D, wxID_FRAME1LBLW EB,
    wxID_FRAME1PANE L1,
    wxID_FRAME1TXTC ELU, wxID_FRAME1TXTC LTE, wxID_FRAME1TXTD IREC,
    wxID_FRAME1TXTE MAIL, wxID_FRAME1TXTF AX, wxID_FRAME1TXTF ONO1,
    wxID_FRAME1TXTF ONO2, wxID_FRAME1TXTL INCRE, wxID_FRAME1TXTN UMDOC,
    wxID_FRAME1TXTP OSTAL, wxID_FRAME1TXTW EB,
    ] = [wx.NewId() for _init_ctrls in range(30)]

    class Frame1(wx.Frame ):
    TipoOper=None
    CodClte=None

    def _init_coll_fsCl te_Growables(se lf, parent):
    # generated method, don't edit

    parent.AddGrowa bleRow(0)
    parent.AddGrowa bleRow(1)
    parent.AddGrowa bleCol(0)

    def _init_coll_fsCt rls_Items(self, parent):
    # generated method, don't edit

    parent.AddWindo w(self.lblCod, 0, border=5, flag=0)
    parent.AddWindo w(self.lblCodig o, 0, border=5, flag=0)
    parent.AddWindo w(self.lblCte, 0, border=5, flag=0)
    parent.AddWindo w(self.txtClte, 0, border=5, flag=0)
    parent.AddWindo w(self.lblTD, 0, border=5, flag=0)
    parent.AddWindo w(self.cboTipoD oc, 0, border=5, flag=0)
    parent.AddWindo w(self.lblNum, 0, border=5, flag=0)
    parent.AddWindo w(self.txtNumDo c, 0, border=5, flag=0)
    parent.AddWindo w(self.lblDirec , 0, border=5, flag=0)
    parent.AddWindo w(self.txtDirec , 0, border=5, flag=0)
    parent.AddWindo w(self.lblCP, 0, border=5, flag=0)
    parent.AddWindo w(self.txtPosta l, 0, border=5, flag=0)
    parent.AddWindo w(self.lblF1, 0, border=5, flag=0)
    parent.AddWindo w(self.txtFono1 , 0, border=5, flag=0)
    parent.AddWindo w(self.lblF2, 0, border=5, flag=0)
    parent.AddWindo w(self.txtFono2 , 0, border=5, flag=0)
    parent.AddWindo w(self.lblFax, 0, border=5, flag=0)
    parent.AddWindo w(self.txtFax, 0, border=5, flag=0)
    parent.AddWindo w(self.lblEmail , 0, border=5, flag=0)
    parent.AddWindo w(self.txtEmail , 0, border=5, flag=0)
    parent.AddWindo w(self.lblWeb, 0, border=5, flag=0)
    parent.AddWindo w(self.txtWeb, 0, border=5, flag=0)
    parent.AddWindo w(self.lblCel, 0, border=5, flag=0)
    parent.AddWindo w(self.txtCelu, 0, border=5, flag=0)
    parent.AddWindo w(self.lblLin, 0, border=5, flag=0)
    parent.AddWindo w(self.txtLinCr e, 0, border=5, flag=0)

    def _init_coll_fsCl te_Items(self, parent):
    # generated method, don't edit

    parent.AddSizer (self.fsCtrls, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    parent.AddSizer (self.fsBtn, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)

    def _init_coll_fsBt n_Items(self, parent):
    # generated method, don't edit

    parent.AddWindo w(self.btnOk, 0, border=5, flag=wx.ALL |
    wx.EXPAND)
    parent.AddWindo w(self.btnSalir , 0, border=5, flag=wx.ALL |
    wx.EXPAND)

    def _init_coll_bsCl te_Items(self, parent):
    # generated method, don't edit

    parent.AddWindo w(self.panel1, 0, border=0, flag=wx.EXPAND)

    def _init_sizers(se lf):
    # generated method, don't edit
    self.bsClte = wx.BoxSizer(ori ent=wx.VERTICAL )

    self.fsClte = wx.FlexGridSize r(cols=0, hgap=0, rows=2, vgap=0)

    self.fsCtrls = wx.FlexGridSize r(cols=2, hgap=1, rows=0, vgap=2)

    self.fsBtn = wx.FlexGridSize r(cols=2, hgap=0, rows=0, vgap=0)

    self._init_coll _bsClte_Items(s elf.bsClte)
    self._init_coll _fsClte_Items(s elf.fsClte)
    self._init_coll _fsClte_Growabl es(self.fsClte)
    self._init_coll _fsCtrls_Items( self.fsCtrls)
    self._init_coll _fsBtn_Items(se lf.fsBtn)

    self.SetSizer(s elf.bsClte)
    self.panel1.Set Sizer(self.fsCl te)

    def _init_ctrls(sel f, prnt):
    # generated method, don't edit
    wx.Frame.__init __(self, id=wxID_FRAME1, name='', parent=prnt,
    pos=wx.Point(62 9, 243), size=wx.Size(26 3, 353),
    style=wx.DEFAUL T_FRAME_STYLE, title=u'Cliente s')
    self.SetClientS ize(wx.Size(263 , 353))

    self.panel1 = wx.Panel(id=wxI D_FRAME1PANEL1, name='panel1',
    parent=self,
    pos=wx.Point(0, 0), size=wx.Size(26 3, 348),
    style=wx.TAB_TR AVERSAL)

    self.lblCte = wx.StaticText(i d=wxID_FRAME1LB LCTE,
    label=u'Cliente ',
    name=u'lblCte', parent=self.pan el1, pos=wx.Point(4, 14),
    size=wx.Size(35 , 12), style=0)

    self.txtClte = wx.TextCtrl(id= wxID_FRAME1TXTC LTE,
    name=u'txtClte' ,
    parent=self.pan el1, pos=wx.Point(58 , 14),
    size=wx.Size(20 0, 22),
    style=0, value=u'')
    self.txtClte.Se tToolTipString( u'Nombre o Raz\xf3n Social')

    self.lblTD = wx.StaticText(i d=wxID_FRAME1LB LTD, label=u'Tipo
    Doc.',
    name=u'lblTD', parent=self.pan el1, pos=wx.Point(4, 38),
    size=wx.Size(45 , 12), style=0)

    self.cboTipoDoc = wx.ComboBox(cho ices=[],
    id=wxID_FRAME1C BOTIPODOC,
    name=u'cboTipoD oc', parent=self.pan el1, pos=wx.Point(58 ,
    38),
    size=wx.Size(19 8, 24), style=0, value=u'')
    self.cboTipoDoc .SetLabel(u'')
    self.cboTipoDoc .Bind(wx.EVT_CO MBOBOX, self.OnCboTipoD ocCombobox,
    id=wxID_FRAME1C BOTIPODOC)

    self.lblNum = wx.StaticText(i d=wxID_FRAME1LB LNUM, label=u'N
    \xfamero',
    name=u'lblNum', parent=self.pan el1, pos=wx.Point(4, 64),
    size=wx.Size(38 , 12), style=0)

    self.txtNumDoc = wx.TextCtrl(id= wxID_FRAME1TXTN UMDOC,
    name=u'txtNumDo c',
    parent=self.pan el1, pos=wx.Point(58 , 64), size=wx.Size(80 ,
    22),
    style=0, value=u'')
    self.txtNumDoc. SetToolTipStrin g(u'N\xfamero de Documento')

    self.lblDirec = wx.StaticText(i d=wxID_FRAME1LB LDIREC,
    label=u'Direcci \xf3n', name=u'lblDirec ',
    parent=self.pan el1,
    pos=wx.Point(4, 88), size=wx.Size(47 , 12), style=0)

    self.txtDirec = wx.TextCtrl(id= wxID_FRAME1TXTD IREC,
    name=u'txtDirec ',
    parent=self.pan el1, pos=wx.Point(58 , 88),
    size=wx.Size(20 0, 22),
    style=0, value=u'')
    self.txtDirec.S etToolTipString (u'Direcci\xf3n ')

    self.lblCP = wx.StaticText(i d=wxID_FRAME1LB LCP,
    label=u'Cod.Pos tal',
    name=u'lblCP', parent=self.pan el1, pos=wx.Point(4, 112),
    size=wx.Size(52 , 12), style=0)

    self.txtPostal = wx.TextCtrl(id= wxID_FRAME1TXTP OSTAL,
    name=u'txtPosta l',
    parent=self.pan el1, pos=wx.Point(58 , 112),
    size=wx.Size(80 , 24),
    style=0, value=u'')
    self.txtPostal. SetToolTipStrin g(u'C\xf3digo Postal')

    self.lblF1 = wx.StaticText(i d=wxID_FRAME1LB LF1, label=u'Tel
    \xe9fono',
    name=u'lblF1', parent=self.pan el1, pos=wx.Point(4, 138),
    size=wx.Size(39 , 12), style=0)

    self.txtFono1 = wx.TextCtrl(id= wxID_FRAME1TXTF ONO1,
    name=u'txtFono1 ',
    parent=self.pan el1, pos=wx.Point(58 , 138),
    size=wx.Size(80 , 22),
    style=0, value=u'')

    self.lblF2 = wx.StaticText(i d=wxID_FRAME1LB LF2, label=u'Tel
    \xe9fono',
    name=u'lblF2', parent=self.pan el1, pos=wx.Point(4, 162),
    size=wx.Size(39 , 12), style=0)

    self.txtFono2 = wx.TextCtrl(id= wxID_FRAME1TXTF ONO2,
    name=u'txtFono2 ',
    parent=self.pan el1, pos=wx.Point(58 , 162),
    size=wx.Size(80 , 22),
    style=0, value=u'')

    self.lblFax = wx.StaticText(i d=wxID_FRAME1LB LFAX, label=u'Fax',
    name=u'lblFax', parent=self.pan el1, pos=wx.Point(4, 186),
    size=wx.Size(16 , 12), style=0)

    self.txtFax = wx.TextCtrl(id= wxID_FRAME1TXTF AX, name=u'txtFax',
    parent=self.pan el1, pos=wx.Point(58 , 186),
    size=wx.Size(80 , 22),
    style=0, value=u'')

    self.lblEmail = wx.StaticText(i d=wxID_FRAME1LB LEMAIL,
    label=u'Email',
    name=u'lblEmail ', parent=self.pan el1, pos=wx.Point(4,
    210),
    size=wx.Size(27 , 12), style=0)

    self.txtEmail = wx.TextCtrl(id= wxID_FRAME1TXTE MAIL,
    name=u'txtEmail ',
    parent=self.pan el1, pos=wx.Point(58 , 210),
    size=wx.Size(19 2, 22),
    style=0, value=u'@')

    self.lblWeb = wx.StaticText(i d=wxID_FRAME1LB LWEB,
    label=u'Website ',
    name=u'lblWeb', parent=self.pan el1, pos=wx.Point(4, 234),
    size=wx.Size(36 , 12), style=0)

    self.txtWeb = wx.TextCtrl(id= wxID_FRAME1TXTW EB, name=u'txtWeb',
    parent=self.pan el1, pos=wx.Point(58 , 234),
    size=wx.Size(19 2, 22),
    style=0, value=u'http://')

    self.lblCel = wx.StaticText(i d=wxID_FRAME1LB LCEL,
    label=u'Celular ',
    name=u'lblCel', parent=self.pan el1, pos=wx.Point(4, 258),
    size=wx.Size(35 , 12), style=0)

    self.txtCelu = wx.TextCtrl(id= wxID_FRAME1TXTC ELU,
    name=u'txtCelu' ,
    parent=self.pan el1, pos=wx.Point(58 , 258),
    size=wx.Size(80 , 22),
    style=0, value=u'9')

    self.lblLin = wx.StaticText(i d=wxID_FRAME1LB LLIN,
    label=u'Lin.Cr\ xe9dito', name=u'lblLin',
    parent=self.pan el1,
    pos=wx.Point(4, 282), size=wx.Size(53 , 12), style=0)

    self.txtLinCre = wx.TextCtrl(id= wxID_FRAME1TXTL INCRE,
    name=u'txtLinCr e',
    parent=self.pan el1, pos=wx.Point(58 , 282),
    size=wx.Size(80 , 22),
    style=0, value=u'0')
    self.txtLinCre. SetToolTipStrin g(u'Linea de Cr\xe9dito')

    self.btnOk = wx.Button(id=wx ID_FRAME1BTNOK, label=u'Aceptar ',
    name=u'btnOk', parent=self.pan el1, pos=wx.Point(41 , 309),
    size=wx.Size(85 , 34), style=0)
    self.btnOk.SetT oolTipString(u' Acepta cambios')
    self.btnOk.Bind (wx.EVT_BUTTON, self.OnBtnOkBut ton,
    id=wxID_FRAME1B TNOK)

    self.btnSalir = wx.Button(id=wx ID_FRAME1BTNSAL IR,
    label=u'Salir',
    name=u'btnSalir ', parent=self.pan el1, pos=wx.Point(13 6,
    309),
    size=wx.Size(85 , 34), style=0)
    self.btnSalir.S etToolTipString (u'Salir')
    self.btnSalir.B ind(wx.EVT_BUTT ON, self.OnBtnSalir Button,
    id=wxID_FRAME1B TNSALIR)

    self.lblCod = wx.StaticText(i d=wxID_FRAME1LB LCOD, label=u'C
    \xf3digo',
    name=u'lblCod', parent=self.pan el1, pos=wx.Point(4, 0),
    size=wx.Size(34 , 12), style=0)

    self.lblCodigo = wx.StaticText(i d=wxID_FRAME1LB LCODIGO,
    label=u'',
    name=u'lblCodig o', parent=self.pan el1, pos=wx.Point(58 ,
    0),
    size=wx.Size(15 0, 12), style=0)
    self.lblCodigo. SetToolTipStrin g(u'C\xf3digo Cliente')
    self.lblCodigo. SetAutoLayout(F alse)

    self._init_size rs()

    def __init__(self, parent, mTipo, mCodClte):
    self._init_ctrl s(parent)

    self.__class__. TipoOper=mTipo
    self.__class__. CodClte=mCodClt e


    #Setea tamaños minimos
    self.fsClte.Fit (self)
    self.fsClte.Set SizeHints(self)

    self.oClte=D_Cl tes()

    #Estableve el Encoding
    self.encode='ut f8'

    self.CargarComb o()
    self.CargaForm( )

    #-------------------------------------------------------------------------------

    def CargaForm(self) :

    if self.__class__. TipoOper=="E":
    self.dat=self.o Clte.BuscarClte (self.__class__ .CodClte)
    self.CargarCtrl s()

    #-------------------------------------------------------------------------------

    def CargarCtrls(sel f):

    self.lblCodigo. SetLabel(self.d at[0][1])
    self.txtClte.Se tValue(self.dat[0][2])
    self.cboTipoDoc .SetSelection(s elf.dat[0][3]-1)
    self.txtNumDoc. SetValue(self.d at[0][4])
    self.txtDirec.S etValue(self.da t[0][5])
    self.txtPostal. SetValue(self.d at[0][6])
    self.txtFono1.S etValue(self.da t[0][7])
    self.txtFono2.S etValue(self.da t[0][8])
    self.txtFax.Set Value(self.dat[0][9])
    self.txtEmail.S etValue(self.da t[0][10])
    self.txtCelu.Se tValue(self.dat[0][11])
    self.txtWeb.Set Value(self.dat[0][12])
    self.txtLinCre. SetValue(str(se lf.dat[0][13]))

    #-------------------------------------------------------------------------------
    def CargarCombo(sel f):

    rs=self.oClte.C argaTDoc()

    self.cboTipoDoc .Clear()

    i=0

    for it in rs:
    x=unicode(rs[i][1],self.encode)
    self.cboTipoDoc .Append(x,rs[i][0])
    i+=1

    if self.__class__. TipoOper=="N":
    #Vacia el 1er elemento mostrado para q el user se vea
    obligado a escoger
    self.cboTipoDoc .SetValue('')
    elif self.__class__. TipoOper=="E":
    #Pinta el registro seleccionado
    pass

    #-------------------------------------------------------------------------------
    def ObtieneValores( self):
    self.oClte.__cl ass__.mNombre=s elf.txtClte.Get Value()
    self.oClte.__cl ass__.mTipoDoc= int(self.kTipoD oc)
    self.oClte.__cl ass__.mNumDoc=s elf.txtNumDoc.G etValue()
    self.oClte.__cl ass__.mDireccio n=self.txtDirec .GetValue()
    self.oClte.__cl ass__.mPostal=s elf.txtPostal.G etValue()
    self.oClte.__cl ass__.mFono1=se lf.txtFono1.Get Value()
    self.oClte.__cl ass__.mFono2=se lf.txtFono2.Get Value()
    self.oClte.__cl ass__.mFax=self .txtFax.GetValu e()
    self.oClte.__cl ass__.mEmail=se lf.txtEmail.Get Value()
    self.oClte.__cl ass__.mCelular= self.txtCelu.Ge tValue()
    self.oClte.__cl ass__.mWeb=self .txtWeb.GetValu e()
    self.oClte.__cl ass__.mLinCredi to=int(self.txt LinCre.GetValue ())

    #-------------------------------------------------------------------------------

    def BorrarCtrls(sel f):
    self.txtClte.Cl ear()
    self.txtNumDoc. Clear()
    self.txtDirec.C lear()
    self.cboTipoDoc .Clear()
    self.txtPostal. Clear()
    self.txtFono1.C lear()
    self.txtFono2.C lear()
    self.txtFax.Cle ar()
    self.txtEmail.C lear()
    self.txtCelu.Cl ear()
    self.txtWeb.Cle ar()
    self.txtLinCre. Clear()

    #-------------------------------------------------------------------------------

    def OnBtnOkButton(s elf, event):

    self.ObtieneVal ores()

    if self.__class__. TipoOper=="N":
    if self.oClte.Grab a()==True:
    dlg=wx.MessageD ialog(self,u'Se ingresó el nuevo
    Cliente.', \
    'PymeGestor',wx .OK | wx.ICON_EXCLAMA TION)
    dlg.ShowModal()
    dlg.Destroy()
    self.BorrarCtrl s()
    self.txtClte.Se tFocus()

    else:
    dlg=wx.MessageD ialog(self,u'Hu bo un error al ingresar
    los datos.\
    Corrija y vuelva a intentarlo.','P ymeGestor',wx.O K |
    wx.ICON_ERROR)
    dlg.ShowModal()
    dlg.Destroy()
    self.txtClte.Se tFocus()

    elif self.__class__. TipoOper=="E":
    self.oClte.Edit a()
    else:
    pass

    #-------------------------------------------------------------------------------

    def OnBtnSalirButto n(self, event):
    self.Close(True )

    #-------------------------------------------------------------------------------

    def OnCboTipoDocCom bobox(self, event):
    cb = event.GetEventO bject()
    #Obtengo el Key
    self.kTipoDoc = cb.GetClientDat a(cb.GetSelecti on())

    #-------------------------------------------------------------------------------

    =============== =============== =============== =============== =============== ==
    =============== =============== =============== =============== =============== ==

    --
    Mario Lacunza <mario.lacunza@ gmail.com>

  • Eric_Dexter@msn.com

    #2
    Re: [Fwd: Problems with PyGridTableBase]

    Hopefully this helps keep your post alive.. I looked all over the
    internet for examples written with wxgrid and wxgrid with python and
    haven't realy found out how to add the other functions to a
    boa-constructor program there just isn't anything except the simple
    example incuded with boa. This is as far as I got and I am not sure I
    am very close (with my example trying to add the extra functions to the
    class instead of inheriting it from grid)

    #Boa:Frame:Fram e3

    import wx
    import wx.grid

    def create(parent):
    return Frame3(parent)

    [wxID_FRAME3, wxID_FRAME3BUTT ON1, wxID_FRAME3GRID 1,
    wxID_FRAME3TEXT CTRL1,
    ] = [wx.NewId() for _init_ctrls in range(4)]

    class Frame3(wx.Frame ):
    def _init_ctrls(sel f, prnt):
    # generated method, don't edit
    wx.Frame.__init __(self, id=wxID_FRAME3, name='', parent=prnt,
    pos=wx.Point(40 1, 118), size=wx.Size(36 7, 585),
    style=wx.DOUBLE _BORDER, title=u'')
    self.SetClientS ize(wx.Size(361 , 579))

    self.grid1 = wx.grid.Grid(id =wxID_FRAME3GRI D1, name='grid1',
    parent=self, pos=wx.Point(8, 16), size=wx.Size(80 , 392),
    style=wx.WANTS_ CHARS | wx.TRANSPARENT_ WINDOW |
    wx.MINIMIZE_BOX | wx.DOUBLE_BORDE R | wx.VSCROLL)

    self.textCtrl1 = wx.TextCtrl(id= wxID_FRAME3TEXT CTRL1,
    name='textCtrl1 ',
    parent=self, pos=wx.Point(11 2, 16), size=wx.Size(23 2,
    392),
    style=wx.TE_LIN EWRAP, value=u'')
    self.textCtrl1. SetThemeEnabled (False)
    self.textCtrl1. SetCursor(wx.CR OSS_CURSOR)

    self.button1 = wx.Button(id=wx ID_FRAME3BUTTON 1, label=u'exit',
    name='button1', parent=self, pos=wx.Point(72 , 440),
    size=wx.Size(13 6, 23), style=0)
    self.button1.Bi nd(wx.EVT_BUTTO N, self.OnButton1B utton,
    id=wxID_FRAME3B UTTON1)

    def __init__(self, parent):
    self._init_ctrl s(parent)
    self.grid1.Crea teGrid(0, 1)

    def OnButton1Button (self, event):
    self.Close()
    def update_instumen t_list(csndname ):
    csdInstrumentLi st(csndname) #needs to have a file variable..
    noinlist=0
    for number in range(0,noinlis t):
    self.grid1.Appe ndRows(1)
    self.grid1.SetC ellValue(number ,0,instrlist[number])





    Mario Lacunza wrote:
    --------- Mensaje reenviado --------
    De: Mario Lacunza <mario.lacunza@ gmail.com>
    Para: Lista Python Ing <python-list@python.org >
    Asunto: Problems with PyGridTableBase
    Fecha: Sat, 09 Sep 2006 00:03:20 -0500
    >
    Hello,
    >
    I attach two files:frmClient es and frmClientesNE.
    >
    frmClientes charge a Grid with resume Costumers data: Name, Commercial
    ID, address, etc. and edition options.
    >
    frmClientes in
    >
    Line 178
    def OnBtnNuevoButto n(self, event):
    >
    call to frmClientesNE. Its append a new record to the database and clear
    all controls and when I close it, the grid in frmClientes: grClte must
    be recharge with the new data, but that dont work. Only work when a
    Delete some record.
    >
    I couldnt send yours a runable .py version, because both of them files
    pickup data from a Firebird's database.
    >
    I try to implement the wxPython Demo model: Grid_MegaExampl e, follow
    that my class Grilla must be:
    >
    Line 224:
    class Grilla(Grid.Gri d):
    >
    but for the Boa Constructors controls creation I couldnt inherit from
    Grid.Grid, thats my problem, I need your help I try for two days and
    nothing :-( ... some ideas??
    >
    Thanks in advance!!
    >
    =============== =============== =============== =============== ==========
    FILE: FRMCLIENTES.PY
    =============== =============== =============== =============== ==========
    >
    # -*- coding: utf8 -*-#
    #Boa:Frame:frmC lientes
    >
    __version__='0. 5'
    __autor__='Mari o Lacunza Vasquez <mlacunza@gmail .com>'
    >
    import wx
    import wx.grid
    import modGlobals
    from Conectar import Conectar
    import errores
    >
    def create(parent):
    return frmClientes(par ent)
    >
    [wxID_FRMCLIENTE S, wxID_FRMCLIENTE SBRNSALIR, wxID_FRMCLIENTE SBTNBORRAR,
    wxID_FRMCLIENTE SBTNEDIT, wxID_FRMCLIENTE SBTNNUEVO,
    wxID_FRMCLIENTE SGRCLTE,
    wxID_FRMCLIENTE SLBLTITULO, wxID_FRMCLIENTE SPANEL1,
    ] = [wx.NewId() for _init_ctrls in range(8)]
    >
    class frmClientes(wx. Frame):
    def _init_coll_fsGr id_Growables(se lf, parent):
    # generated method, don't edit
    >
    parent.AddGrowa bleRow(0)
    >
    def _init_coll_fsGr id_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddWindo w(self.grClte, 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    >
    def _init_coll_fsBt n_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddWindo w(self.btnNuevo , 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    parent.AddWindo w(self.btnEdit, 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    parent.AddWindo w(self.btnBorra r, 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    parent.AddWindo w(self.brnSalir , 0, border=2, flag=wx.EXPAND |
    wx.ALL)
    >
    def _init_coll_fsTi t_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddWindo w(self.lblTitul o, 0, border=6, flag=wx.EXPAND)
    >
    def _init_coll_bsCl te_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddWindo w(self.panel1, 1, border=0, flag=wx.EXPAND)
    >
    def _init_coll_fsTi t_Growables(sel f, parent):
    # generated method, don't edit
    >
    parent.AddGrowa bleRow(0)
    >
    def _init_coll_fsCl te_Growables(se lf, parent):
    # generated method, don't edit
    >
    parent.AddGrowa bleRow(0)
    parent.AddGrowa bleRow(1)
    parent.AddGrowa bleRow(2)
    parent.AddGrowa bleCol(0)
    >
    def _init_coll_fsCl te_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddSizer (self.fsTit, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    parent.AddSizer (self.fsGrid, 1, border=10,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    parent.AddSizer (self.fsBtn, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    >
    def _init_sizers(se lf):
    # generated method, don't edit
    self.bsClte = wx.BoxSizer(ori ent=wx.VERTICAL )
    >
    self.fsClte = wx.FlexGridSize r(cols=1, hgap=0, rows=0, vgap=0)
    >
    self.fsTit = wx.FlexGridSize r(cols=1, hgap=0, rows=0, vgap=0)
    >
    self.fsGrid = wx.FlexGridSize r(cols=1, hgap=5, rows=0, vgap=5)
    >
    self.fsBtn = wx.FlexGridSize r(cols=4, hgap=0, rows=0, vgap=0)
    >
    self._init_coll _bsClte_Items(s elf.bsClte)
    self._init_coll _fsClte_Growabl es(self.fsClte)
    self._init_coll _fsClte_Items(s elf.fsClte)
    self._init_coll _fsTit_Growable s(self.fsTit)
    self._init_coll _fsTit_Items(se lf.fsTit)
    self._init_coll _fsGrid_Growabl es(self.fsGrid)
    self._init_coll _fsGrid_Items(s elf.fsGrid)
    self._init_coll _fsBtn_Items(se lf.fsBtn)
    >
    self.SetSizer(s elf.bsClte)
    self.panel1.Set Sizer(self.fsCl te)
    >
    def _init_ctrls(sel f, prnt):
    # generated method, don't edit
    wx.Frame.__init __(self, id=wxID_FRMCLIE NTES,
    name=u'frmClien tes',
    parent=prnt, pos=wx.Point(35 2, 148), size=wx.Size(58 9,
    514),
    style=wx.DEFAUL T_FRAME_STYLE, title=u'Cliente s')
    self.SetClientS ize(wx.Size(589 , 514))
    >
    self.panel1 = wx.Panel(id=wxI D_FRMCLIENTESPA NEL1, name='panel1',
    parent=self, pos=wx.Point(0, 0), size=wx.Size(58 9, 514),
    style=wx.TAB_TR AVERSAL)
    >
    self.lblTitulo = wx.StaticText(i d=wxID_FRMCLIEN TESLBLTITULO,
    label=u'',
    name=u'lblTitul o', parent=self.pan el1, pos=wx.Point(25 8,
    0),
    size=wx.Size(72 , 19), style=0)
    self.lblTitulo. Center(wx.HORIZ ONTAL)
    self.lblTitulo. SetFont(wx.Font (12, wx.SWISS, wx.NORMAL, wx.BOLD,
    False,
    u'Sans'))
    >
    self.grClte = wx.grid.Grid(id =wxID_FRMCLIENT ESGRCLTE,
    name=u'grClte',
    parent=self.pan el1, pos=wx.Point(10 , 63),
    size=wx.Size(56 8, 326),
    style=0)
    self.grClte.Ena bleEditing(Fals e)
    self.grClte.Bin d(wx.grid.EVT_G RID_SELECT_CELL ,
    self.OnGrClteGr idSelectCell)
    >
    self.btnNuevo = wx.Button(id=wx ID_FRMCLIENTESB TNNUEVO,
    label=u'Nuevo',
    name=u'btnNuevo ', parent=self.pan el1, pos=wx.Point(11 8,
    435),
    size=wx.Size(85 , 34), style=0)
    self.btnNuevo.S etToolTipString (u'Nuevo Cliente')
    self.btnNuevo.B ind(wx.EVT_BUTT ON, self.OnBtnNuevo Button,
    id=wxID_FRMCLIE NTESBTNNUEVO)
    >
    self.btnEdit = wx.Button(id=wx ID_FRMCLIENTESB TNEDIT,
    label=u'Editar' ,
    name=u'btnEdit' , parent=self.pan el1, pos=wx.Point(20 7,
    435),
    size=wx.Size(85 , 34), style=0)
    self.btnEdit.Se tToolTipString( u'Editar Cliente')
    self.btnEdit.Bi nd(wx.EVT_BUTTO N, self.OnBtnEditB utton,
    id=wxID_FRMCLIE NTESBTNEDIT)
    >
    self.btnBorrar = wx.Button(id=wx ID_FRMCLIENTESB TNBORRAR,
    label=u'Elimina r', name=u'btnBorra r', parent=self.pan el1,
    pos=wx.Point(29 6, 435), size=wx.Size(85 , 34), style=0)
    self.btnBorrar. SetToolTipStrin g(u'Eliminar Cliente')
    self.btnBorrar. Bind(wx.EVT_BUT TON, self.OnBtnBorra rButton,
    id=wxID_FRMCLIE NTESBTNBORRAR)
    >
    self.brnSalir = wx.Button(id=wx ID_FRMCLIENTESB RNSALIR,
    label=u'Salir',
    name=u'brnSalir ', parent=self.pan el1, pos=wx.Point(38 5,
    435),
    size=wx.Size(85 , 34), style=0)
    self.brnSalir.S etToolTipString (u'Salir')
    self.brnSalir.B ind(wx.EVT_BUTT ON, self.OnBrnSalir Button,
    id=wxID_FRMCLIE NTESBRNSALIR)
    >
    self._init_size rs()
    >
    def __init__(self, parent):
    self._init_ctrl s(parent)
    >
    self.CrearGrid( )
    >
    #-------------------------------------------------------------------------------
    def CrearGrid(self) :
    #Setea la Tabla para el Grid
    self.table = Tabla()
    self.grClte.Set Table(self.tabl e, True)
    >
    #Setea el ancho de las columnas del Grid
    self.grClte.Set ColSize(0,50)
    self.grClte.Set ColSize(2,150)
    self.grClte.Set ColSize(4,250)
    >
    #-------------------------------------------------------------------------------
    >
    def OnBtnNuevoButto n(self, event):
    #Nuevo
    import frmClientesNE
    x=frmClientesNE .create(None,"N ")
    x.Show()
    >
    def OnBtnEditButton (self, event):
    #Editar
    import frmClientesNE
    x=frmClientesNE .create(None,"E ",self.Valo r)
    x.Show()
    >
    def OnBtnBorrarButt on(self, event):
    self.oD=D_Cltes ()
    >
    dlg=wx.MessageD ialog(self,u'¿E stá seguro de eliminar este
    Cliente?', \
    'PymeGestor',wx .YES_NO | wx.ICON_QUESTIO N)
    rpta=dlg.ShowMo dal()
    if (rpta==wx.ID_YE S):
    self.oD.Borrar( self.Valor)
    dlg2=wx.Message Dialog(self,u'E l Cliente fue el eliminado con
    éxito.', \
    'PymeGestor',wx .OK | wx.ICON_INFORMA TION)
    dlg2.ShowModal( )
    dlg2.Destroy()
    else:
    pass
    >
    dlg.Destroy()
    >
    def OnBrnSalirButto n(self, event):
    self.Close(True )
    >
    def OnGrClteGridSel ectCell(self, event):
    #Obtiene el valor de la celda seleccionada.
    self.R=event.Ge tRow()
    #Fija como 0 la celda q contiene el campo ID.
    self.C = 0
    >
    self.Valor=self .table.GetValue (self.R,self.C)
    >
    event.Skip()
    >
    >
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    class Tabla(wx.grid.P yGridTableBase) :
    """Clase que maneja la grilla de Datos."""
    >
    def __init__(self):
    wx.grid.PyGridT ableBase.__init __(self)
    >
    self.oCltes=D_C ltes()
    self.data=self. oCltes.CargarCl ientes()
    >
    #Setea el Numero de Columnas a mostrar por el SQL
    self.Columnas=7
    >
    #Setea los titulos del Grid
    self.colLabels = ["ID", "CODIGO", "CLIENTE", "NRO.DOC.",
    "DIRECCION" , "TELEFONO","EMA IL"]
    >
    def GetNumberRows(s elf):
    r=len(self.data )
    return r
    >
    def GetNumberCols(s elf):
    return self.Columnas
    >
    def IsEmptyCell(sel f, row, col):
    return False
    >
    def GetValue(self, row, col):
    #Muestra los datos devueltos por el Recordset
    value=self.data[row][col]
    if value is not None:
    return value
    else:
    return ''
    >
    def SetValue(self, row, col, value):
    try:
    self.data[row][col] = value
    except IndexError:
    # add a new row
    self.data.appen d([''] * self.GetNumberC ols())
    self.SetValue(r ow, col, value)
    # tell the grid we've added a row
    msg = wxGridTableMess age(self, # The table
    wxGRIDTABLE_NOT IFY_ROWS_APPEND ED, # what we did to
    it
    1 # how many
    )
    self.GetView(). ProcessTableMes sage(msg)
    >
    def GetColLabelValu e(self, col):
    return self.colLabels[col]
    >
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    >
    class O_Cltes:
    """Clase de Negocios para el manejo de los Clientes."""
    def __init__(self):
    """ Constructor."""
    >
    >
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    >
    class D_Cltes:
    """Maneja las operaciones con clientes."""
    >
    mCodigo=None
    mNombre=None
    mTipoDoc=None
    mNumDoc=None
    mDireccion=None
    mPostal=None
    mFono1=None
    mFono2=None
    mFax=None
    mEmail=None
    mCelular=None
    mWeb=None
    mLinCredito=Non e
    >
    def __init__(self):
    """ Constructor."""
    >
    #Instancia la Clase
    self.cnn=Conect ar()
    >
    #Obtiene cadena de Conexion
    self.cnn.__clas s__.cnn=modGlob als.CNN
    >
    #-------------------------------------------------------------------------------
    >
    def CargarClientes( self):
    """Genera lista de Clientes."""
    >
    sql="Select ID, Codigo, Nombre, NumDoc, Direccion, Fono1, Email
    from tblClientes"
    self.cnn.__clas s__.SQL=sql
    >
    try:
    rs=self.cnn.Eje cutarSQL()
    return rs
    >
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    #-------------------------------------------------------------------------------
    def Borrar(self, mCod):
    """Borra Cliente de la Bd."""
    >
    sql="Delete from tblClientes Where ID=%d"%(mCod)
    self.cnn.__clas s__.SQL=sql
    >
    try:
    rs=self.cnn.Eje cutarSQL('Delet e')
    return True
    >
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    #-------------------------------------------------------------------------------
    >
    def CargaTDoc(self) :
    >
    sql="Select ID, Detalle from tblTipoDoc"
    self.cnn.__clas s__.SQL=sql
    >
    try:
    rs=self.cnn.Eje cutarSQL()
    return rs
    >
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    >
    #-------------------------------------------------------------------------------
    >
    def Graba(self):
    """Graba los datos."""
    >
    #Obtiene el codigo
    self.__class__. mCodigo=self.Ge neraCod()
    >
    sql="Insert into tblClientes(ID, CODIGO, NOMBRE, TIPODOC,
    NUMDOC, DIRECCION, POSTAL,\
    FONO1,FONO2,FAX , EMAIL, CELULAR, WEB, LINCREDITO)\
    VALUES(GEN_ID(G EN_TBLCLIENTES_ ID,1),\
    '%s', '%s', %d, '%s', '%s','%s','%s', '%s','%s','%s', '%s','%s',%
    d)"\
    %(self.__class_ _.mCodigo, self.__class__. mNombre,
    self.__class__. mTipoDoc, self.__class__. mNumDoc,\
    self.__class__. mDireccion, self.__class__. mPostal,
    self.__class__. mFono1,\
    self.__class__. mFono2, self.__class__. mFax,
    self.__class__. mEmail,\
    self.__class__. mCelular, self.__class__. mWeb,
    self.__class__. mLinCredito)
    >
    self.cnn.__clas s__.SQL=sql
    >
    try:
    rs=self.cnn.Eje cutarSQL('Inser t')
    if rs==False:
    return False
    else:
    return True
    >
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    >
    self.CargarClie ntes()
    #-------------------------------------------------------------------------------
    >
    def GeneraCod(self) :
    """Genera el Codigo Unico para este cliente."""
    >
    sql="Select MAX(Codigo) from tblClientes"
    self.cnn.__clas s__.SQL=sql
    >
    try:
    rs=self.cnn.Eje cutarSQL()
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    >
    #Si es el primer registro en la Tabla
    if rs[0][0]==None:
    cod=modGlobals. CrearCodigo('', 'C',9)
    else:
    cod=modGlobals. CrearCodigo(rs[0][0],'C', 9)
    >
    return cod
    >
    #-------------------------------------------------------------------------------
    >
    def Edita(self, mCod):
    """Edita los datos."""
    >
    sql="Update Where ID=%d" %(mCod)
    >
    self.cnn.__clas s__.SQL=sql
    >
    try:
    rs=self.cnn.Eje cutarSQL('Updat e')
    if rs==False:
    return False
    else:
    return True
    >
    >
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    >
    #-------------------------------------------------------------------------------
    def BuscarClte(self ,mCod):
    >
    sql="Select * From tblClientes Where ID=%d" %(mCod)
    >
    self.cnn.__clas s__.SQL=sql
    >
    try:
    rs=self.cnn.Eje cutarSQL()
    return rs
    except errores.Conexio nError, err:
    print "Error:",err.me nsaje
    except errores.Conexio nEjecucionError , err:
    print "Error:",err.ms gEjec
    >
    >
    =============== =============== =============== =============== ==========
    =============== =============== =============== =============== ==========
    =============== =============== =============== =============== ==========
    >
    >
    =============== =============== =============== =============== ==========
    FILE: FRMCLIENTESNE.P Y
    =============== =============== =============== =============== ==========
    >
    # -*- coding: utf8 -*-#
    #Boa:Frame:Fram e1
    >
    import wx
    import modGlobals
    from Conectar import Conectar
    import errores
    from frmClientes import D_Cltes
    >
    def create(parent, mTipo, mCodClte=''):
    return Frame1(parent, mTipo, mCodClte)
    >
    [wxID_FRAME1, wxID_FRAME1BTNO K, wxID_FRAME1BTNS ALIR,
    wxID_FRAME1CBOT IPODOC,
    wxID_FRAME1LBLC EL, wxID_FRAME1LBLC OD, wxID_FRAME1LBLC ODIGO,
    wxID_FRAME1LBLC P,
    wxID_FRAME1LBLC TE, wxID_FRAME1LBLD IREC, wxID_FRAME1LBLE MAIL,
    wxID_FRAME1LBLF 1, wxID_FRAME1LBLF 2, wxID_FRAME1LBLF AX,
    wxID_FRAME1LBLL IN,
    wxID_FRAME1LBLN UM, wxID_FRAME1LBLT D, wxID_FRAME1LBLW EB,
    wxID_FRAME1PANE L1,
    wxID_FRAME1TXTC ELU, wxID_FRAME1TXTC LTE, wxID_FRAME1TXTD IREC,
    wxID_FRAME1TXTE MAIL, wxID_FRAME1TXTF AX, wxID_FRAME1TXTF ONO1,
    wxID_FRAME1TXTF ONO2, wxID_FRAME1TXTL INCRE, wxID_FRAME1TXTN UMDOC,
    wxID_FRAME1TXTP OSTAL, wxID_FRAME1TXTW EB,
    ] = [wx.NewId() for _init_ctrls in range(30)]
    >
    class Frame1(wx.Frame ):
    TipoOper=None
    CodClte=None
    >
    def _init_coll_fsCl te_Growables(se lf, parent):
    # generated method, don't edit
    >
    parent.AddGrowa bleRow(0)
    parent.AddGrowa bleRow(1)
    parent.AddGrowa bleCol(0)
    >
    def _init_coll_fsCt rls_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddWindo w(self.lblCod, 0, border=5, flag=0)
    parent.AddWindo w(self.lblCodig o, 0, border=5, flag=0)
    parent.AddWindo w(self.lblCte, 0, border=5, flag=0)
    parent.AddWindo w(self.txtClte, 0, border=5, flag=0)
    parent.AddWindo w(self.lblTD, 0, border=5, flag=0)
    parent.AddWindo w(self.cboTipoD oc, 0, border=5, flag=0)
    parent.AddWindo w(self.lblNum, 0, border=5, flag=0)
    parent.AddWindo w(self.txtNumDo c, 0, border=5, flag=0)
    parent.AddWindo w(self.lblDirec , 0, border=5, flag=0)
    parent.AddWindo w(self.txtDirec , 0, border=5, flag=0)
    parent.AddWindo w(self.lblCP, 0, border=5, flag=0)
    parent.AddWindo w(self.txtPosta l, 0, border=5, flag=0)
    parent.AddWindo w(self.lblF1, 0, border=5, flag=0)
    parent.AddWindo w(self.txtFono1 , 0, border=5, flag=0)
    parent.AddWindo w(self.lblF2, 0, border=5, flag=0)
    parent.AddWindo w(self.txtFono2 , 0, border=5, flag=0)
    parent.AddWindo w(self.lblFax, 0, border=5, flag=0)
    parent.AddWindo w(self.txtFax, 0, border=5, flag=0)
    parent.AddWindo w(self.lblEmail , 0, border=5, flag=0)
    parent.AddWindo w(self.txtEmail , 0, border=5, flag=0)
    parent.AddWindo w(self.lblWeb, 0, border=5, flag=0)
    parent.AddWindo w(self.txtWeb, 0, border=5, flag=0)
    parent.AddWindo w(self.lblCel, 0, border=5, flag=0)
    parent.AddWindo w(self.txtCelu, 0, border=5, flag=0)
    parent.AddWindo w(self.lblLin, 0, border=5, flag=0)
    parent.AddWindo w(self.txtLinCr e, 0, border=5, flag=0)
    >
    def _init_coll_fsCl te_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddSizer (self.fsCtrls, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    parent.AddSizer (self.fsBtn, 1, border=5,
    flag=wx.ALIGN_C ENTER_HORIZONTA L)
    >
    def _init_coll_fsBt n_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddWindo w(self.btnOk, 0, border=5, flag=wx.ALL |
    wx.EXPAND)
    parent.AddWindo w(self.btnSalir , 0, border=5, flag=wx.ALL |
    wx.EXPAND)
    >
    def _init_coll_bsCl te_Items(self, parent):
    # generated method, don't edit
    >
    parent.AddWindo w(self.panel1, 0, border=0, flag=wx.EXPAND)
    >
    def _init_sizers(se lf):
    # generated method, don't edit
    self.bsClte = wx.BoxSizer(ori ent=wx.VERTICAL )
    >
    self.fsClte = wx.FlexGridSize r(cols=0, hgap=0, rows=2, vgap=0)
    >
    self.fsCtrls = wx.FlexGridSize r(cols=2, hgap=1, rows=0, vgap=2)
    >
    self.fsBtn = wx.FlexGridSize r(cols=2, hgap=0, rows=0, vgap=0)
    >
    self._init_coll _bsClte_Items(s elf.bsClte)
    self._init_coll _fsClte_Items(s elf.fsClte)
    self._init_coll _fsClte_Growabl es(self.fsClte)
    self._init_coll _fsCtrls_Items( self.fsCtrls)
    self._init_coll _fsBtn_Items(se lf.fsBtn)
    >
    self.SetSizer(s elf.bsClte)
    self.panel1.Set Sizer(self.fsCl te)
    >
    def _init_ctrls(sel f, prnt):
    # generated method, don't edit
    wx.Frame.__init __(self, id=wxID_FRAME1, name='', parent=prnt,
    pos=wx.Point(62 9, 243), size=wx.Size(26 3, 353),
    style=wx.DEFAUL T_FRAME_STYLE, title=u'Cliente s')
    self.SetClientS ize(wx.Size(263 , 353))
    >
    self.panel1 = wx.Panel(id=wxI D_FRAME1PANEL1, name='panel1',
    parent=self,
    pos=wx.Point(0, 0), size=wx.Size(26 3, 348),
    style=wx.TAB_TR AVERSAL)
    >
    self.lblCte = wx.StaticText(i d=wxID_FRAME1LB LCTE,
    label=u'Cliente ',
    name=u'lblCte', parent=self.pan el1, pos=wx.Point(4, 14),
    size=wx.Size(35 , 12), style=0)
    >
    self.txtClte = wx.TextCtrl(id= wxID_FRAME1TXTC LTE,
    name=u'txtClte' ,
    parent=self.pan el1, pos=wx.Point(58 , 14),
    size=wx.Size(20 0, 22),
    style=0, value=u'')
    self.txtClte.Se tToolTipString( u'Nombre o Raz\xf3n Social')
    >
    self.lblTD = wx.StaticText(i d=wxID_FRAME1LB LTD, label=u'Tipo
    Doc.',
    name=u'lblTD', parent=self.pan el1, pos=wx.Point(4, 38),
    size=wx.Size(45 , 12), style=0)
    >
    self.cboTipoDoc = wx.ComboBox(cho ices=[],
    id=wxID_FRAME1C BOTIPODOC,
    name=u'cboTipoD oc', parent=self.pan el1, pos=wx.Point(58 ,
    38),
    size=wx.Size(19 8, 24), style=0, value=u'')
    self.cboTipoDoc .SetLabel(u'')
    self.cboTipoDoc .Bind(wx.EVT_CO MBOBOX, self.OnCboTipoD ocCombobox,
    id=wxID_FRAME1C BOTIPODOC)
    >
    self.lblNum = wx.StaticText(i d=wxID_FRAME1LB LNUM, label=u'N
    \xfamero',
    name=u'lblNum', parent=self.pan el1, pos=wx.Point(4, 64),
    size=wx.Size(38 , 12), style=0)
    >
    self.txtNumDoc = wx.TextCtrl(id= wxID_FRAME1TXTN UMDOC,
    name=u'txtNumDo c',
    parent=self.pan el1, pos=wx.Point(58 , 64), size=wx.Size(80 ,
    22),
    style=0, value=u'')
    self.txtNumDoc. SetToolTipStrin g(u'N\xfamero de Documento')
    >
    self.lblDirec = wx.StaticText(i d=wxID_FRAME1LB LDIREC,
    label=u'Direcci \xf3n', name=u'lblDirec ',
    parent=self.pan el1,
    pos=wx.Point(4, 88), size=wx.Size(47 , 12), style=0)
    >
    self.txtDirec = wx.TextCtrl(id= wxID_FRAME1TXTD IREC,
    name=u'txtDirec ',
    parent=self.pan el1, pos=wx.Point(58 , 88),
    size=wx.Size(20 0, 22),
    style=0, value=u'')
    self.txtDirec.S etToolTipString (u'Direcci\xf3n ')
    >
    self.lblCP = wx.StaticText(i d=wxID_FRAME1LB LCP,
    label=u'Cod.Pos tal',
    name=u'lblCP', parent=self.pan el1, pos=wx.Point(4, 112),
    size=wx.Size(52 , 12), style=0)
    >
    self.txtPostal = wx.TextCtrl(id= wxID_FRAME1TXTP OSTAL,
    name=u'txtPosta l',
    parent=self.pan el1, pos=wx.Point(58 , 112),
    size=wx.Size(80 , 24),
    style=0, value=u'')
    self.txtPostal. SetToolTipStrin g(u'C\xf3digo Postal')
    >
    self.lblF1 = wx.StaticText(i d=wxID_FRAME1LB LF1, label=u'Tel
    \xe9fono',
    name=u'lblF1', parent=self.pan el1, pos=wx.Point(4, 138),
    size=wx.Size(39 , 12), style=0)
    >
    self.txtFono1 = wx.TextCtrl(id= wxID_FRAME1TXTF ONO1,
    name=u'txtFono1 ',
    parent=self.pan el1, pos=wx.Point(58 , 138),
    size=wx.Size(80 , 22),
    style=0, value=u'')
    >
    self.lblF2 = wx.StaticText(i d=wxID_FRAME1LB LF2, label=u'Tel
    \xe9fono',
    name=u'lblF2', parent=self.pan el1, pos=wx.Point(4, 162),
    size=wx.Size(39 , 12), style=0)
    >
    self.txtFono2 = wx.TextCtrl(id= wxID_FRAME1TXTF ONO2,
    name=u'txtFono2 ',
    parent=self.pan el1, pos=wx.Point(58 , 162),
    size=wx.Size(80 , 22),
    style=0, value=u'')
    >
    self.lblFax = wx.StaticText(i d=wxID_FRAME1LB LFAX, label=u'Fax',
    name=u'lblFax', parent=self.pan el1, pos=wx.Point(4, 186),
    size=wx.Size(16 , 12), style=0)
    >
    self.txtFax = wx.TextCtrl(id= wxID_FRAME1TXTF AX, name=u'txtFax',
    parent=self.pan el1, pos=wx.Point(58 , 186),
    size=wx.Size(80 , 22),
    style=0, value=u'')
    >
    self.lblEmail = wx.StaticText(i d=wxID_FRAME1LB LEMAIL,
    label=u'Email',
    name=u'lblEmail ', parent=self.pan el1, pos=wx.Point(4,
    210),
    size=wx.Size(27 , 12), style=0)
    >
    self.txtEmail = wx.TextCtrl(id= wxID_FRAME1TXTE MAIL,
    name=u'txtEmail ',
    parent=self.pan el1, pos=wx.Point(58 , 210),
    size=wx.Size(19 2, 22),
    style=0, value=u'@')
    >
    self.lblWeb = wx.StaticText(i d=wxID_FRAME1LB LWEB,
    label=u'Website ',
    name=u'lblWeb', parent=self.pan el1, pos=wx.Point(4, 234),
    size=wx.Size(36 , 12), style=0)
    >
    self.txtWeb = wx.TextCtrl(id= wxID_FRAME1TXTW EB, name=u'txtWeb',
    parent=self.pan el1, pos=wx.Point(58 , 234),
    size=wx.Size(19 2, 22),
    style=0, value=u'http://')
    >
    self.lblCel = wx.StaticText(i d=wxID_FRAME1LB LCEL,
    label=u'Celular ',
    name=u'lblCel', parent=self.pan el1, pos=wx.Point(4, 258),
    size=wx.Size(35 , 12), style=0)
    >
    self.txtCelu = wx.TextCtrl(id= wxID_FRAME1TXTC ELU,
    name=u'txtCelu' ,
    parent=self.pan el1, pos=wx.Point(58 , 258),
    size=wx.Size(80 , 22),
    style=0, value=u'9')
    >
    self.lblLin = wx.StaticText(i d=wxID_FRAME1LB LLIN,
    label=u'Lin.Cr\ xe9dito', name=u'lblLin',
    parent=self.pan el1,
    pos=wx.Point(4, 282), size=wx.Size(53 , 12), style=0)
    >
    self.txtLinCre = wx.TextCtrl(id= wxID_FRAME1TXTL INCRE,
    name=u'txtLinCr e',
    parent=self.pan el1, pos=wx.Point(58 , 282),
    size=wx.Size(80 , 22),
    style=0, value=u'0')
    self.txtLinCre. SetToolTipStrin g(u'Linea de Cr\xe9dito')
    >
    self.btnOk = wx.Button(id=wx ID_FRAME1BTNOK, label=u'Aceptar ',
    name=u'btnOk', parent=self.pan el1, pos=wx.Point(41 , 309),
    size=wx.Size(85 , 34), style=0)
    self.btnOk.SetT oolTipString(u' Acepta cambios')
    self.btnOk.Bind (wx.EVT_BUTTON, self.OnBtnOkBut ton,
    id=wxID_FRAME1B TNOK)
    >
    self.btnSalir = wx.Button(id=wx ID_FRAME1BTNSAL IR,
    label=u'Salir',
    name=u'btnSalir ', parent=self.pan el1, pos=wx.Point(13 6,
    309),
    size=wx.Size(85 , 34), style=0)
    self.btnSalir.S etToolTipString (u'Salir')
    self.btnSalir.B ind(wx.EVT_BUTT ON, self.OnBtnSalir Button,
    id=wxID_FRAME1B TNSALIR)
    >
    self.lblCod = wx.StaticText(i d=wxID_FRAME1LB LCOD, label=u'C
    \xf3digo',
    name=u'lblCod', parent=self.pan el1, pos=wx.Point(4, 0),
    size=wx.Size(34 , 12), style=0)
    >
    self.lblCodigo = wx.StaticText(i d=wxID_FRAME1LB LCODIGO,
    label=u'',
    name=u'lblCodig o', parent=self.pan el1, pos=wx.Point(58 ,
    0),
    size=wx.Size(15 0, 12), style=0)
    self.lblCodigo. SetToolTipStrin g(u'C\xf3digo Cliente')
    self.lblCodigo. SetAutoLayout(F alse)
    >
    self._init_size rs()
    >
    def __init__(self, parent, mTipo, mCodClte):
    self._init_ctrl s(parent)
    >
    self.__class__. TipoOper=mTipo
    self.__class__. CodClte=mCodClt e
    >
    >
    #Setea tamaños minimos
    self.fsClte.Fit (self)
    self.fsClte.Set SizeHints(self)
    >
    self.oClte=D_Cl tes()
    >
    #Estableve el Encoding
    self.encode='ut f8'
    >
    self.CargarComb o()
    self.CargaForm( )
    >
    #-------------------------------------------------------------------------------
    >
    def CargaForm(self) :
    >
    if self.__class__. TipoOper=="E":
    self.dat=self.o Clte.BuscarClte (self.__class__ .CodClte)
    self.CargarCtrl s()
    >
    #-------------------------------------------------------------------------------
    >
    def CargarCtrls(sel f):
    >
    self.lblCodigo. SetLabel(self.d at[0][1])
    self.txtClte.Se tValue(self.dat[0][2])
    self.cboTipoDoc .SetSelection(s elf.dat[0][3]-1)
    self.txtNumDoc. SetValue(self.d at[0][4])
    self.txtDirec.S etValue(self.da t[0][5])
    self.txtPostal. SetValue(self.d at[0][6])
    self.txtFono1.S etValue(self.da t[0][7])
    self.txtFono2.S etValue(self.da t[0][8])
    self.txtFax.Set Value(self.dat[0][9])
    self.txtEmail.S etValue(self.da t[0][10])
    self.txtCelu.Se tValue(self.dat[0][11])
    self.txtWeb.Set Value(self.dat[0][12])
    self.txtLinCre. SetValue(str(se lf.dat[0][13]))
    >
    #-------------------------------------------------------------------------------
    def CargarCombo(sel f):
    >
    rs=self.oClte.C argaTDoc()
    >
    self.cboTipoDoc .Clear()
    >
    i=0
    >
    for it in rs:
    x=unicode(rs[i][1],self.encode)
    self.cboTipoDoc .Append(x,rs[i][0])
    i+=1
    >
    if self.__class__. TipoOper=="N":
    #Vacia el 1er elemento mostrado para q el user se vea
    obligado a escoger
    self.cboTipoDoc .SetValue('')
    elif self.__class__. TipoOper=="E":
    #Pinta el registro seleccionado
    pass
    >
    #-------------------------------------------------------------------------------
    def ObtieneValores( self):
    self.oClte.__cl ass__.mNombre=s elf.txtClte.Get Value()
    self.oClte.__cl ass__.mTipoDoc= int(self.kTipoD oc)
    self.oClte.__cl ass__.mNumDoc=s elf.txtNumDoc.G etValue()
    self.oClte.__cl ass__.mDireccio n=self.txtDirec .GetValue()
    self.oClte.__cl ass__.mPostal=s elf.txtPostal.G etValue()
    self.oClte.__cl ass__.mFono1=se lf.txtFono1.Get Value()
    self.oClte.__cl ass__.mFono2=se lf.txtFono2.Get Value()
    self.oClte.__cl ass__.mFax=self .txtFax.GetValu e()
    self.oClte.__cl ass__.mEmail=se lf.txtEmail.Get Value()
    self.oClte.__cl ass__.mCelular= self.txtCelu.Ge tValue()
    self.oClte.__cl ass__.mWeb=self .txtWeb.GetValu e()
    self.oClte.__cl ass__.mLinCredi to=int(self.txt LinCre.GetValue ())
    >
    #-------------------------------------------------------------------------------
    >
    def BorrarCtrls(sel f):
    self.txtClte.Cl ear()
    self.txtNumDoc. Clear()
    self.txtDirec.C lear()
    self.cboTipoDoc .Clear()
    self.txtPostal. Clear()
    self.txtFono1.C lear()
    self.txtFono2.C lear()
    self.txtFax.Cle ar()
    self.txtEmail.C lear()
    self.txtCelu.Cl ear()
    self.txtWeb.Cle ar()
    self.txtLinCre. Clear()
    >
    #-------------------------------------------------------------------------------
    >
    def OnBtnOkButton(s elf, event):
    >
    self.ObtieneVal ores()
    >
    if self.__class__. TipoOper=="N":
    if self.oClte.Grab a()==True:
    dlg=wx.MessageD ialog(self,u'Se ingresó el nuevo
    Cliente.', \
    'PymeGestor',wx .OK | wx.ICON_EXCLAMA TION)
    dlg.ShowModal()
    dlg.Destroy()
    self.BorrarCtrl s()
    self.txtClte.Se tFocus()
    >
    else:
    dlg=wx.MessageD ialog(self,u'Hu bo un error al ingresar
    los datos.\
    Corrija y vuelva a intentarlo.','P ymeGestor',wx.O K |
    wx.ICON_ERROR)
    dlg.ShowModal()
    dlg.Destroy()
    self.txtClte.Se tFocus()
    >
    elif self.__class__. TipoOper=="E":
    self.oClte.Edit a()
    else:
    pass
    >
    #-------------------------------------------------------------------------------
    >
    def OnBtnSalirButto n(self, event):
    self.Close(True )
    >
    #-------------------------------------------------------------------------------
    >
    def OnCboTipoDocCom bobox(self, event):
    cb = event.GetEventO bject()
    #Obtengo el Key
    self.kTipoDoc = cb.GetClientDat a(cb.GetSelecti on())
    >
    #-------------------------------------------------------------------------------
    >
    =============== =============== =============== =============== =============== ==
    =============== =============== =============== =============== =============== ==

    --
    Mario Lacunza <mario.lacunza@ gmail.com>

    Comment

    Working...