Exemplo n.º 1
0
    def on_btnAltahab_clicked(self, widget):
        """
        Boton que da de alta una habtiacion
        :return: Void
        """
        try:
            numhab = variables.filahab[0].get_text()
            prezohab = variables.filahab[1].get_text()
            prezohab = prezohab.replace(',', '.')
            prezohab = float(prezohab)
            prezohab = round(prezohab, 2)
            if variables.filarbt[0].get_active():
                tipo = 'simple'
            elif variables.filarbt[1].get_active():
                tipo = 'doble'
            elif variables.filarbt[2].get_active():
                tipo = 'family'
            else:
                pass

            if variables.switch.get_active():
                libre = 'SI'
            else:
                libre = 'NO'
            registro = (numhab, tipo, prezohab, libre)
            if numhab != None:
                funcioneshab.insertarhab(registro)
                funcioneshab.listadohab(variables.listhab)
                funcioneshab.listadonumhab()
                funcioneshab.limpiarentry(variables.filahab)
            else:
                pass
        except:
            print("Error alta habitacion")
Exemplo n.º 2
0
    def on_btnAltahab_clicked(self, widget):
        '''
        Se encarga de recoger los datos de la habitacion para darla de alta
        @param widget:
        @return:
        '''
        try:
            numhab = variables.filahab[0].get_text()
            prezohab = variables.filahab[1].get_text()
            prezohab = prezohab.replace(',', '.')
            prezohab = float(prezohab)
            prezohab = round(prezohab, 2)
            if variables.filarbt[0].get_active():
                tipo = 'simple'
            elif variables.filarbt[1].get_active():
                tipo = 'doble'
            elif variables.filarbt[2].get_active():
                tipo = 'family'
            else:
                pass

            if variables.switch.get_active():
                libre = 'SI'
            else:
                libre = 'NO'
            registro = (numhab, tipo, prezohab, libre)
            if numhab != None:
                funcioneshab.insertarhab(registro)
                funcioneshab.listadohab(variables.listhab)
                funcioneshab.listadonumhab()
                funcioneshab.limpiarentry(variables.filahab)
            else:
                pass
        except:
            print("Error alta habitacion")
Exemplo n.º 3
0
    def on_btnAltaHab_clicked(self, widget):
        try:
            num = variables.filahab[0].get_text()

            if variables.filahab[1][0].get_active():
                tipo = 'Simple'
            if variables.filahab[1][1].get_active():
                tipo = 'Double'
            if variables.filahab[1][2].get_active():
                tipo = 'Family'

            prezo = variables.filahab[2].get_text()
            registro = (num, tipo, prezo.replace(',', '.'))
            if num != '' and tipo != '' and prezo != '':
                funcioneshab.insertarhab(registro)
                funcioneshab.ponerListadoEnGUI()
            else:
                print('Algún campo está vacío')
        except Exception as e:
            print('Detalles: ', e)
Exemplo n.º 4
0
    def on_btnAltahab_clicked(self, widget):
        """
        Da de alta una habitacion con los datos de los entries.

        Crea una nueva habitacion con los costes y el tipo introducido
        por medio de los entries, los radio buttons... y carga de nuevo
        el treeview borrando tambien los entries.

        :param widget:
        :return: void

        """
        try:
            numhab = variables.filahab[0].get_text()
            prezohab = variables.filahab[1].get_text()
            prezohab = prezohab.replace(',', '.')
            prezohab = float(prezohab)
            prezohab = round(prezohab, 2)
            if variables.filarbt[0].get_active():
                tipo = 'simple'
            elif variables.filarbt[1].get_active():
                tipo = 'doble'
            elif variables.filarbt[2].get_active():
                tipo = 'family'
            else:
                pass

            if variables.switch.get_active():
                libre = 'SI'
            else:
                libre = 'NO'
            registro = (numhab, tipo, prezohab, libre)
            if numhab != None:
                funcioneshab.insertarhab(registro)
                funcioneshab.listadohab(variables.listhab)
                funcioneshab.listadonumhab()
                funcioneshab.limpiarentry(variables.filahab)
            else:
                pass
        except:
            print("Error alta habitacion")
Exemplo n.º 5
0
    def on_btnAltahab_clicked(self, widget):
        """
        Gestiona el evento del botón alta de la ventana de habitaciones.
        Da de alta una nueva habitación.
        :param widget:
        :return: No devuelve nada.

        """
        try:
            numhab = variables.filahab[0].get_text()
            prezohab = variables.filahab[1].get_text()
            prezohab = prezohab.replace(',', '.')
            prezohab = float(prezohab)
            prezohab = round(prezohab, 2)
            if variables.filarbt[0].get_active():
                tipo = 'simple'
            elif variables.filarbt[1].get_active():
                tipo = 'doble'
            elif variables.filarbt[2].get_active():
                tipo = 'family'
            else:
                pass

            if variables.switch.get_active():
                libre = 'SI'
            else:
                libre = 'NO'
            registro = (numhab, tipo, prezohab, libre)
            if numhab != None:
                funcioneshab.insertarhab(registro)
                funcioneshab.listadohab(variables.listhab)
                funcioneshab.listadonumhab()
                funcioneshab.limpiarentry(variables.filahab)
            else:
                pass
        except:
            print("Error alta habitacion")