def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"CRUD Productos", pos = wx.DefaultPosition, size = wx.Size( 760,460 ), style = wx.DEFAULT_DIALOG_STYLE ) #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) #Clase Padre formulario superior self.frm_padre=parent sizer0 = wx.GridSizer( 0, 2, 0, 0 ) #agregado para colocar una celda del grid derecho para img sizer1 = wx.BoxSizer( wx.VERTICAL ) fgSizer1 = wx.FlexGridSizer( 8, 2, 0, 0 ) fgSizer1.SetFlexibleDirection( wx.BOTH ) fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"ACCION", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) fgSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 ) self.lbl1 = wx.StaticText( self, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, 0 ) self.lbl1.Wrap( -1 ) fgSizer1.Add( self.lbl1, 0, wx.ALL, 5 ) self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Id. Producto", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText6.Wrap( -1 ) fgSizer1.Add( self.m_staticText6, 0, wx.ALL, 5 ) self.txt1 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.txt1, 0, wx.ALL, 5 ) self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Descripcion", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText7.Wrap( -1 ) fgSizer1.Add( self.m_staticText7, 0, wx.ALL, 5 ) self.txt2 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), 0 ) fgSizer1.Add( self.txt2, 0, wx.ALL, 5 ) self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Barcode", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText8.Wrap( -1 ) fgSizer1.Add( self.m_staticText8, 0, wx.ALL, 5 ) self.txt3 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.txt3, 0, wx.ALL, 5 ) self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"Costo", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText9.Wrap( -1 ) fgSizer1.Add( self.m_staticText9, 0, wx.ALL, 5 ) self.txt4 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.txt4, 0, wx.ALL, 5 ) self.m_staticText10 = wx.StaticText( self, wx.ID_ANY, u"Precio", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText10.Wrap( -1 ) fgSizer1.Add( self.m_staticText10, 0, wx.ALL, 5 ) self.txt5 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.txt5, 0, wx.ALL, 5 ) self.m_staticText11 = wx.StaticText( self, wx.ID_ANY, u"Categoria", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText11.Wrap( -1 ) fgSizer1.Add( self.m_staticText11, 0, wx.ALL, 5 ) OpcionCat = ['Seleccionar'] self.cbCat = wx.ComboBox( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, OpcionCat, 0 ) fgSizer1.Add( self.cbCat, 0, wx.ALL, 5 ) self.m_staticText12 = wx.StaticText( self, wx.ID_ANY, u"Inactivo", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText12.Wrap( -1 ) fgSizer1.Add( self.m_staticText12, 0, wx.ALL, 5 ) self.checkInactivo = wx.CheckBox( self, wx.ID_ANY, u"Checkear Inactivo", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer1.Add( self.checkInactivo, 0, wx.ALL, 5 ) sizer1.Add( fgSizer1, 1, wx.EXPAND, 5 ) fgSizer2 = wx.FlexGridSizer( 0, 3, 0, 0 ) fgSizer2.SetFlexibleDirection( wx.BOTH ) fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) fgSizer2.Add( ( 50, 0), 1, wx.EXPAND, 5 ) self.btn1 = wx.Button( self, wx.ID_ANY, u"Aceptar", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.btn1, 0, wx.ALL, 5 ) self.btn4 = wx.Button( self, wx.ID_ANY, u"Salir", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.btn4, 0, wx.ALL, 5 ) sizer1.Add( fgSizer2, 1, wx.EXPAND, 5 ) sizer0.Add( sizer1, 1, wx.EXPAND, 5 ) #sizer imagen sizer_img = wx.FlexGridSizer( 3, 1, 0, 0 ) sizer_img.SetFlexibleDirection( wx.BOTH ) sizer_img.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.ruta='imgs/blank_img.png' self.img = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 ) sizer_img.Add( self.img, 0, wx.ALL, 5 ) sizer0.Add( sizer_img, 1, wx.EXPAND, 5 ) self.btn_buscar_img = wx.Button( self, wx.ID_ANY, u"Buscar Img", wx.DefaultPosition, wx.DefaultSize, 0 ) sizer_img.Add( self.btn_buscar_img, 0, wx.ALL, 5 ) #Maximo tamaño de imagen self.PhotoMaxSize=400 #fin buscar imagen self.SetSizer(sizer0 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.btn1.Bind( wx.EVT_BUTTON, self.btnAceptar ) self.btn4.Bind( wx.EVT_BUTTON, self.btnSalir ) self.cbCat.Bind( wx.EVT_COMBOBOX, self.CatSeleccion ) self.checkInactivo.Bind( wx.EVT_CHECKBOX, self.chkInactivar ) self.btn_buscar_img.Bind( wx.EVT_BUTTON, self.BuscarImg ) #evento buscar img #base de datos self.db = mysqlclass3.Database("ventas") #Instanciar la conexion a la Bd. #Evento mostrar datos #MODAL PARA mensajes self.dial = wx.MessageDialog(None, 'DATOS GUARDADOS', 'Info', wx.OK|wx.CENTRE) #cargar imagen por defecto self.VerImagen(self.ruta)
def __init__( self, parent ): self.title="Listar Productos, Busqueda por Descripcion" wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = self.title, pos = wx.DefaultPosition, size = wx.Size( 610,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) fgSizer1 = wx.FlexGridSizer( 3, 1, 0, 0 ) fgSizer1.SetFlexibleDirection( wx.BOTH ) fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) fgSizer2 = wx.FlexGridSizer( 0, 3, 0, 0 ) fgSizer2.SetFlexibleDirection( wx.BOTH ) fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Buscar", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) fgSizer2.Add( self.m_staticText1, 0, wx.ALL, 5 ) self.txt_Busqueda = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 250,-1 ), 0 ) fgSizer2.Add(self.txt_Busqueda , 0, wx.ALL, 5 ) self.btn_Buscar = wx.Button( self, wx.ID_ANY, u"Buscar", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer2.Add( self.btn_Buscar, 0, wx.ALL, 5 ) fgSizer1.Add( fgSizer2, 1, wx.EXPAND, 5 ) fgSizer3 = wx.FlexGridSizer( 1, 2, 0, 0 ) fgSizer3.SetFlexibleDirection( wx.BOTH ) fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) self.listctrl = wx.ListCtrl( self, wx.ID_ANY, wx.Point( 10,10 ), wx.Size( 600,200 ), wx.LC_REPORT|wx.SUNKEN_BORDER ) fgSizer3.Add( self.listctrl, 0, wx.ALL, 5 ) fgSizer1.Add( fgSizer3, 1, wx.EXPAND, 5 ) #Agregar un sizer de 1 fila 4 col fgSizer4 = wx.FlexGridSizer( 1, 4, 0, 0 ) fgSizer4.SetFlexibleDirection( wx.BOTH ) fgSizer4.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) #Botones para mantenimiento self.btn_Insertar = wx.Button( self, wx.ID_ANY, u"Insertar", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer4.Add( self.btn_Insertar, 0, wx.ALL, 5 ) self.btn_Ver = wx.Button( self, wx.ID_ANY, u"Ver", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer4.Add( self.btn_Ver, 0, wx.ALL, 5 ) self.btn_Editar = wx.Button( self, wx.ID_ANY, u"Editar", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer4.Add( self.btn_Editar, 0, wx.ALL, 5 ) self.btn_Eliminar = wx.Button( self, wx.ID_ANY, u"Eliminar", wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer4.Add( self.btn_Eliminar, 0, wx.ALL, 5 ) fgSizer1.Add( fgSizer4, 1, wx.EXPAND, 5 ) self.SetSizer( fgSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.btn_Buscar.Bind( wx.EVT_BUTTON, self.Buscar ) self.txt_Busqueda.Bind( wx.EVT_TEXT, self.Busqueda ) self.listctrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.Seleccionar) self.btn_Insertar.Bind( wx.EVT_BUTTON, self.Insertar ) self.btn_Ver.Bind( wx.EVT_BUTTON, self.Ver ) self.btn_Editar.Bind( wx.EVT_BUTTON, self.Editar ) self.btn_Eliminar.Bind( wx.EVT_BUTTON, self.Eliminar ) #Conexion Bd self.db = mysqlclass3.Database("ventas") #Instanciar la conexion a la Bd. #definir valor de item2 self.item ='' self.item2 ='' #Evento cargar datos de encabezado a la lista y se definen las columnas que lleva el control self.listctrl.InsertColumn(0, 'Id', width=100) self.listctrl.InsertColumn(1, 'Barcode', width=150) self.listctrl.InsertColumn(2, 'Descripcion', width=350) self.Cargar()
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"CRUD Productos", pos=wx.DefaultPosition, size=wx.Size(-1, 320), style=wx.DEFAULT_DIALOG_STYLE) #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) #Clase Padre formulario superior self.frm_padre = parent btn2 = wx.BoxSizer(wx.VERTICAL) fgSizer1 = wx.FlexGridSizer(7, 2, 0, 0) fgSizer1.SetFlexibleDirection(wx.BOTH) fgSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, u"ACCION", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) fgSizer1.Add(self.m_staticText1, 0, wx.ALL, 5) self.lbl1 = wx.StaticText(self, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, 0) self.lbl1.Wrap(-1) fgSizer1.Add(self.lbl1, 0, wx.ALL, 5) self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u"Id. Producto", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText6.Wrap(-1) fgSizer1.Add(self.m_staticText6, 0, wx.ALL, 5) self.txt1 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer1.Add(self.txt1, 0, wx.ALL, 5) self.m_staticText7 = wx.StaticText(self, wx.ID_ANY, u"Descripcion", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText7.Wrap(-1) fgSizer1.Add(self.m_staticText7, 0, wx.ALL, 5) self.txt2 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(300, -1), 0) fgSizer1.Add(self.txt2, 0, wx.ALL, 5) self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"Barcode", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText8.Wrap(-1) fgSizer1.Add(self.m_staticText8, 0, wx.ALL, 5) self.txt3 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(160, -1), 0) fgSizer1.Add(self.txt3, 0, wx.ALL, 5) self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"Costo", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText9.Wrap(-1) fgSizer1.Add(self.m_staticText9, 0, wx.ALL, 5) self.txt4 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer1.Add(self.txt4, 0, wx.ALL, 5) self.m_staticText10 = wx.StaticText(self, wx.ID_ANY, u"Precio", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText10.Wrap(-1) fgSizer1.Add(self.m_staticText10, 0, wx.ALL, 5) self.txt5 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer1.Add(self.txt5, 0, wx.ALL, 5) self.m_staticText81 = wx.StaticText(self, wx.ID_ANY, u"Categoria", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText81.Wrap(-1) fgSizer1.Add(self.m_staticText81, 0, wx.ALL, 5) m_comboBox1Choices = [u"0", u"1"] self.m_comboBox1 = wx.ComboBox(self, wx.ID_ANY, u"Combo!", wx.DefaultPosition, wx.Size(300, -1), m_comboBox1Choices, 0) fgSizer1.Add(self.m_comboBox1, 0, wx.ALL, 5) btn2.Add(fgSizer1, 1, wx.EXPAND, 5) fgSizer2 = wx.FlexGridSizer(0, 3, 0, 0) fgSizer2.SetFlexibleDirection(wx.BOTH) fgSizer2.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) fgSizer2.Add((50, 0), 1, wx.EXPAND, 5) self.btn1 = wx.Button(self, wx.ID_ANY, u"Aceptar", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer2.Add(self.btn1, 0, wx.ALL, 5) self.btn4 = wx.Button(self, wx.ID_ANY, u"Salir", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer2.Add(self.btn4, 0, wx.ALL, 5) btn2.Add(fgSizer2, 1, wx.EXPAND, 5) self.SetSizer(btn2) self.Layout() self.Centre(wx.BOTH) # Connect Events self.btn1.Bind(wx.EVT_BUTTON, self.btnAceptar) self.btn4.Bind(wx.EVT_BUTTON, self.btnSalir) #base de datos self.db = mysqlclass3.Database( "ventas") #Instanciar la conexion a la Bd. #Evento mostrar datos #MODAL PARA mensajes self.dial = wx.MessageDialog(None, 'CONSULTA CORRECTA', 'Info', wx.OK | wx.CENTRE)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition, size=wx.Size(376, 189), style=wx.DEFAULT_DIALOG_STYLE) self.frm_padre = parent #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) fgSizer1 = wx.FlexGridSizer(5, 3, 0, 0) fgSizer1.SetFlexibleDirection(wx.BOTH) fgSizer1.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) fgSizer1.Add((10, 0), 1, wx.EXPAND, 5) self.lbl1 = wx.StaticText(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.lbl1.Wrap(-1) fgSizer1.Add(self.lbl1, 0, wx.ALL, 5) fgSizer1.Add((10, 0), 1, wx.EXPAND, 5) fgSizer1.Add((10, 0), 1, wx.EXPAND, 5) self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, u"id Categoria", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText1.Wrap(-1) fgSizer1.Add(self.m_staticText1, 0, wx.ALL, 5) self.m_textCtrl1 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer1.Add(self.m_textCtrl1, 0, wx.ALL, 5) fgSizer1.Add((10, 0), 1, wx.EXPAND, 5) self.m_staticText11 = wx.StaticText(self, wx.ID_ANY, u"Nombre", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText11.Wrap(-1) fgSizer1.Add(self.m_staticText11, 0, wx.ALL, 5) self.m_textCtrl2 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(200, -1), 0) fgSizer1.Add(self.m_textCtrl2, 0, wx.ALL, 5) fgSizer1.Add((10, 0), 1, wx.EXPAND, 5) self.m_button1 = wx.Button(self, wx.ID_ANY, u"Guardar", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer1.Add(self.m_button1, 0, wx.ALL, 5) self.m_button11 = wx.Button(self, wx.ID_ANY, u"Salir", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer1.Add(self.m_button11, 0, wx.ALL, 5) self.SetSizer(fgSizer1) self.Layout() #self.id_producto='' self.Centre(wx.BOTH) self.db = mysqlclass3.Database( "ventas") #Instanciar la conexion a la Bd. # Connect Events self.m_button1.Bind(wx.EVT_BUTTON, self.Guardar) self.m_button11.Bind(wx.EVT_BUTTON, self.Salir) #MODAL PARA mensajes self.dial = wx.MessageDialog(None, 'EXITO', 'Info', wx.OK | wx.CENTRE)
def __init__( self, parent ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 556,98 ), style = wx.DEFAULT_DIALOG_STYLE ) self.frm_padre=parent #self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) fgSizer1 = wx.FlexGridSizer( 3, 3, 0, 0 ) fgSizer1.SetFlexibleDirection( wx.BOTH ) fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) fgSizer1.Add( ( 20, 20), 1, wx.EXPAND, 5 ) fgSizer1.Add( ( 20, 20), 1, wx.EXPAND, 5 ) fgSizer1.Add( ( 20, 20), 1, wx.EXPAND, 5 ) bSizer1 = wx.BoxSizer( wx.HORIZONTAL ) bSizer1.Add( ( 30, 30), 1, wx.EXPAND, 5 ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Seguro que deseas eliminar id", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) bSizer1.Add( self.m_staticText1, 0, wx.ALL, 5 ) self.m_textCtrl1 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer1.Add( self.m_textCtrl1, 0, wx.ALL, 5 ) bSizer1.Add( ( 30, 30), 1, wx.EXPAND, 5 ) fgSizer1.Add( bSizer1, 1, wx.EXPAND, 5 ) bSizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.m_button1 = wx.Button( self, wx.ID_ANY, u"Aceptar", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add( self.m_button1, 0, wx.ALL, 5 ) self.m_button2 = wx.Button( self, wx.ID_ANY, u"Cerrar", wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add( self.m_button2, 0, wx.ALL, 5 ) fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 ) self.SetSizer( fgSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.m_button1.Bind( wx.EVT_BUTTON, self.Aceptar ) self.m_button2.Bind( wx.EVT_BUTTON, self.Cerrar ) #base de datos self.db = mysqlclass3.Database("ventas") #Instanciar la conexion a la Bd. #Evento mostrar datos #MODAL PARA mensajes self.dial = wx.MessageDialog(None, 'Eliminado con exito', 'Info', wx.OK|wx.CENTRE)