Exemplo n.º 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)
Exemplo n.º 2
0
    def __init__(self, procesador, name, title, icono, folder, li_tam_blocks,
                 one_line):
        self.one_line = one_line
        if one_line:
            self.tol = TurnOnLights.read_oneline_tol()
        else:
            self.tol = TurnOnLights.read_tol(name, title, folder,
                                             li_tam_blocks)
        self.reinit = False

        titulo = _("Turn on the lights") + ": " + title
        if self.tol.is_calculation_mode():
            tipo = _("Calculation mode")
            background = "#88AA3A"
        else:
            tipo = _("Memory mode")
            background = "#BDDBE8"

        self.procesador = procesador
        extparam = "tol%s-%d" % (name, self.tol.work_level)

        QTVarios.WDialogo.__init__(self, procesador.pantalla, titulo, icono,
                                   extparam)

        self.colorTheme = QTUtil.qtColor("#F0F0F0")

        lb = Controles.LB(self, tipo)
        lb.ponFondoN(background).alinCentrado().ponTipoLetra(puntos=14)

        # Toolbar
        tb = Controles.TBrutina(self)
        tb.new(_("Close"), Iconos.MainMenu(), self.terminar)
        anterior, siguiente, terminado = self.tol.prev_next()
        if terminado:
            tb.new(_("Rebuild"), Iconos.Reindexar(), self.rebuild)
        if anterior:
            tb.new(_("Previous"), Iconos.Anterior(), self.goto_previous)
        if siguiente:
            tb.new(_("Next"), Iconos.Siguiente(), self.goto_next)
        if one_line:
            tb.new(_("Change"), Iconos.TOLchange(), self.cambiar_one_line)
        tb.new(_("Config"), Iconos.Configurar(), self.config)
        tb.new(_("Information"), Iconos.Informacion(), self.colors)

        # Lista
        oColumnas = Columnas.ListaColumnas()
        work_level = self.tol.work_level + 1
        oColumnas.nueva("THEME",
                        _("Level %d/%d") % (work_level, self.tol.num_levels),
                        175)

        edicionIconos = Delegados.PmIconosColor()
        self.dicIconos = {}
        for k, pm in edicionIconos.dicpmIconos.iteritems():
            self.dicIconos[k] = QtGui.QIcon(pm)

        for x in range(self.tol.num_blocks):
            oColumnas.nueva("BLOCK%d" % x,
                            "%d" % (x + 1, ),
                            42,
                            siCentrado=True,
                            edicion=edicionIconos)

        self.grid = grid = Grid.Grid(self,
                                     oColumnas,
                                     altoFila=42,
                                     background="white")
        self.grid.setAlternatingRowColors(False)
        self.grid.tipoLetra(puntos=10, peso=500)
        nAnchoPgn = self.grid.anchoColumnas() + 20
        self.grid.setMinimumWidth(nAnchoPgn)
        self.registrarGrid(grid)

        # Colocamos ---------------------------------------------------------------
        ly = Colocacion.V().control(lb).control(tb).control(self.grid)

        self.setLayout(ly)

        alto = self.tol.num_themes * 42 + 146
        self.recuperarVideo(siTam=True,
                            altoDefecto=alto,
                            anchoDefecto=max(nAnchoPgn, 480))