Example #1
0
    def __init__(self, owner, procesador):

        title = _("In one line")
        titulo = _("Turn on the lights") + ": " + title
        extparam = "tolconfoneline"
        icono = Iconos.TOLchange()
        QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam)

        self.tol = TurnOnLights.read_oneline_tol()
        self.procesador = procesador

        lbNumPos = Controles.LB2P(self, _("Number of positions"))
        liBlocks = [(str(x), x) for x in range(6, 60, 6)]
        self.cbNumPos = Controles.CB(self, liBlocks, self.tol.num_pos)

        lbtipo = Controles.LB2P(self, _("Mode"))
        liTipos = [(_("Calculation mode"), True), (_("Memory mode"), False)]
        self.cbTipo = Controles.CB(self, liTipos, self.tol.calculation_mode)

        lbfile = Controles.LB2P(self, _("File"))
        pbfile = Controles.PB(self, "", self.newfile).ponIcono(Iconos.Buscar())
        self.lbshowfile = Controles.LB(self, self.tol.fns)
        lyfile = Colocacion.H().control(pbfile).control(
            self.lbshowfile).relleno(1)

        self.chbauto = Controles.CHB(self, _("Redo each day automatically"),
                                     self.tol.auto_day)

        tb = Controles.TBrutina(self)
        tb.new(_("Accept"), Iconos.Aceptar(), self.aceptar)
        tb.new(_("Cancel"), Iconos.Cancelar(), self.cancelar)

        # Colocamos ---------------------------------------------------------------
        ly = Colocacion.G()
        ly.controld(lbNumPos, 1, 0).control(self.cbNumPos, 1, 1)
        ly.controld(lbtipo, 2, 0).control(self.cbTipo, 2, 1)
        ly.controld(lbfile, 3, 0).otro(lyfile, 3, 1)
        ly.control(self.chbauto, 4, 0, 1, 2)

        layout = Colocacion.V().control(tb).espacio(10).otro(ly)

        self.setLayout(layout)

        self.recuperarVideo(siTam=True)
    def menuLibros(self):
        menu = QTVarios.LCMenu(self)
        nBooks = len(self.listaLibros.lista)

        for book in self.listaLibros.lista:
            ico = Iconos.PuntoVerde(
            ) if book == self.book else Iconos.PuntoNaranja()
            menu.opcion(("x", book), book.nombre, ico)

        menu.separador()
        menu.opcion(("n", None), _("Install new book"), Iconos.Nuevo())
        if nBooks > 1:
            menu.separador()
            menub = menu.submenu(_("Remove a book from the list"),
                                 Iconos.Delete())
            for book in self.listaLibros.lista:
                if not book.pordefecto:
                    menub.opcion(("b", book), book.nombre, Iconos.Delete())
            menu.separador()
            menu.opcion(("1", None), _("Find Next") + " <F3>", Iconos.Buscar())

        resp = menu.lanza()
        if resp:
            orden, book = resp
            if orden == "x":
                self.cambiaLibro(book)
            elif orden == "n":
                fbin = QTUtil2.leeFichero(self,
                                          self.listaLibros.path,
                                          "bin",
                                          titulo=_("Polyglot book"))
                if fbin:
                    self.listaLibros.path = os.path.dirname(fbin)
                    nombre = os.path.basename(fbin)[:-4]
                    book = Books.Libro("P", nombre, fbin, True)
                    self.listaLibros.nuevo(book)
                    self.cambiaLibro(book)
            elif orden == "b":
                self.listaLibros.borra(book)
                self.listaLibros.guardaVar(self.fvar)
            elif orden == "1":
                self.buscaSiguiente()