from PyQt4 import QtGui
from ui_mant_libros_new import NewLibrosWindow
from ui_mant_libros_edit import EditLibrosWindow
from ui_mant_libros_id_edit import GetIdEditWindow

# Debug only
import inspect


class MenuLibros(QtGui.QWidget):
    """
        Ventana-menu para editar Libros
    """
    def __init__(self):
        super(MenuLibros, self).__init__()

        self.createButtons()

        self.setWindowTitle('Mantenimiento Libros')

        self.setWindowIcon(QtGui.QIcon('images/user-plus.png'))
        self.setWindowTitle("Mantenimiento Libros")
        self.setGeometry(650, 300, 150, 100)

    def createButtons(self):
        btn_new_libros = QtGui.QPushButton('Nuevo')
        btn_new_libros.clicked.connect(self.open_new_libros_window)

        btn_edit_libros = QtGui.QPushButton('Editar')
        btn_edit_libros.clicked.connect(self.open_edit_libros_window)

        btn_list_libros = QtGui.QPushButton('Listar')
        btn_list_libros.clicked.connect(self.close)

        btn_delete_libros = QtGui.QPushButton('Eliminar')
        btn_delete_libros.clicked.connect(self.close)


        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(btn_new_libros)
        hbox.addWidget(btn_edit_libros)
        hbox.addWidget(btn_list_libros)
        hbox.addWidget(btn_delete_libros)
        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(hbox)

        self.setLayout(vbox)

    def open_new_libros_window(self):
        self.new_libros_view = NewLibrosWindow()
        self.new_libros_view.show()
        print(inspect.stack()[0][3])

        self.close()

    def open_edit_libros_window(self):
        self.edit_libros_view = GetIdEditWindow()
        self.edit_libros_view.show()
        print(inspect.stack()[0][3])

        self.close()

    def open_list_reserva_window(self):
        # self.new_reserva_view = NewReserva()
        # self.new_reserva_view.show()
        print(inspect.stack()[0][3])

        self.close()

    def open_delete_reserva_window(self):
        # self.new_reserva_view = NewReserva()
        # self.new_reserva_view.show()
        print(inspect.stack()[0][3])

        self.close()

if __name__ == '__main__':

    import sys

    app = QtGui.QApplication(sys.argv)
    mainWin = MenuLibros()
    mainWin.show()
    sys.exit(app.exec_())

[((81, 10, 81, 38), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', ({(81, 29, 81, 37): 'sys.argv'}, {}), '(sys.argv)', False, 'from PyQt4 import QtGui\n'), ((26, 25, 26, 51), 'PyQt4.QtGui.QPushButton', 'QtGui.QPushButton', ({(26, 43, 26, 50): '"""Nuevo"""'}, {}), "('Nuevo')", False, 'from PyQt4 import QtGui\n'), ((29, 26, 29, 53), 'PyQt4.QtGui.QPushButton', 'QtGui.QPushButton', ({(29, 44, 29, 52): '"""Editar"""'}, {}), "('Editar')", False, 'from PyQt4 import QtGui\n'), ((32, 26, 32, 53), 'PyQt4.QtGui.QPushButton', 'QtGui.QPushButton', ({(32, 44, 32, 52): '"""Listar"""'}, {}), "('Listar')", False, 'from PyQt4 import QtGui\n'), ((35, 28, 35, 57), 'PyQt4.QtGui.QPushButton', 'QtGui.QPushButton', ({(35, 46, 35, 56): '"""Eliminar"""'}, {}), "('Eliminar')", False, 'from PyQt4 import QtGui\n'), ((39, 15, 39, 34), 'PyQt4.QtGui.QHBoxLayout', 'QtGui.QHBoxLayout', ({}, {}), '()', False, 'from PyQt4 import QtGui\n'), ((44, 15, 44, 34), 'PyQt4.QtGui.QVBoxLayout', 'QtGui.QVBoxLayout', ({}, {}), '()', False, 'from PyQt4 import QtGui\n'), ((50, 31, 50, 48), 'ui_mant_libros_new.NewLibrosWindow', 'NewLibrosWindow', ({}, {}), '()', False, 'from ui_mant_libros_new import NewLibrosWindow\n'), ((57, 32, 57, 49), 'ui_mant_libros_id_edit.GetIdEditWindow', 'GetIdEditWindow', ({}, {}), '()', False, 'from ui_mant_libros_id_edit import GetIdEditWindow\n'), ((21, 27, 21, 62), 'PyQt4.QtGui.QIcon', 'QtGui.QIcon', ({(21, 39, 21, 61): '"""images/user-plus.png"""'}, {}), "('images/user-plus.png')", False, 'from PyQt4 import QtGui\n'), ((52, 14, 52, 29), 'inspect.stack', 'inspect.stack', ({}, {}), '()', False, 'import inspect\n'), ((59, 14, 59, 29), 'inspect.stack', 'inspect.stack', ({}, {}), '()', False, 'import inspect\n'), ((66, 14, 66, 29), 'inspect.stack', 'inspect.stack', ({}, {}), '()', False, 'import inspect\n'), ((73, 14, 73, 29), 'inspect.stack', 'inspect.stack', ({}, {}), '()', False, 'import inspect\n')]