def start(self, pathFichero, modo, num_linea): self.board.saveVisual() self.pathFichero = pathFichero dbop = OpeningLines.Opening(pathFichero) self.board.dbvisual_set_file(dbop.nom_fichero) self.reinicio(dbop, modo, num_linea)
def study(procesador, fichero): with QTUtil.EscondeWindow(procesador.main_window): dbop = OpeningLines.Opening(os.path.join(procesador.configuracion.folder_openings(), fichero)) w = WLines(procesador, dbop) w.exec_() dbop.close() return w.resultado
def inicio(self, pathFichero, modo, num_linea): self.tablero.saveVisual() self.pathFichero = pathFichero dbop = OpeningLines.Opening(pathFichero) self.tablero.dbVisual_setFichero(dbop.nom_fichero) self.reinicio(dbop, modo, num_linea)
def changeFolder(self): nof = _("New opening folder") base = self.configuration.folder_base_openings li = [x for x in os.listdir(base) if os.path.isdir(os.path.join(base, x))] menu = QTVarios.LCMenu(self) rondo = QTVarios.rondoPuntos() menu.opcion("", _("Home folder"), Iconos.Home()) menu.separador() for x in li: menu.opcion(x, x, rondo.otro()) menu.separador() menu.opcion(":n", nof, Iconos.Nuevo()) if Code.is_windows: menu.separador() menu.opcion(":m", _("Direct maintenance"), Iconos.Configurar()) resp = menu.lanza() if resp is not None: if resp == ":m": os.startfile(base) return elif resp == ":n": name = "" error = "" while True: li_gen = [FormLayout.separador] li_gen.append((nof + ":", name)) if error: li_gen.append(FormLayout.separador) li_gen.append((None, error)) resultado = FormLayout.fedit(li_gen, title=nof, parent=self, icon=Iconos.OpeningLines(), anchoMinimo=460) if resultado: accion, liResp = resultado name = liResp[0].strip() if name: path = os.path.join(base, name) try: os.mkdir(path) except: error = _("Unable to create this folder") continue if not os.path.isdir(path): continue break else: return else: path = os.path.join(base, resp) path = Util.relative_path(path) self.configuration.set_folder_openings(path) self.configuration.graba() self.listaOpenings = OpeningLines.ListaOpenings(self.configuration) self.glista.refresh() self.glista.gotop() if len(self.listaOpenings) == 0: self.wtrain.setVisible(False) self.setWindowTitle(self.getTitulo())
def openingsTrainingStatic(self, pathFichero): dbop = OpeningLines.Opening(pathFichero) num_linea = WindowOpeningLines.selectLine(self, dbop) dbop.close() if num_linea is not None: self.manager = ManagerOpeningLines.ManagerOpeningLines(self) self.manager.start(pathFichero, "static", num_linea) else: self.openings()
def openingsTrainingStatic(self, pathFichero): dbop = OpeningLines.Opening(pathFichero) num_linea = PantallaOpeningLines.selectLine(self, dbop) dbop.close() if num_linea is not None: self.gestor = GestorOpeningLines.GestorOpeningLines(self) self.gestor.inicio(pathFichero, "static", num_linea) else: self.openings()
def start(self, pathFichero): self.pathFichero = pathFichero dbop = OpeningLines.Opening(pathFichero) self.reinicio(dbop)
def __init__(self, procesador): self.procesador = procesador self.configuracion = procesador.configuracion self.resultado = None self.listaOpenings = OpeningLines.ListaOpenings(self.configuracion) QTVarios.WDialogo.__init__(self, procesador.main_window, self.getTitulo(), Iconos.OpeningLines(), "openingLines") o_columns = Columnas.ListaColumnas() o_columns.nueva("TITLE", _("Name"), 240) o_columns.nueva("BASEPV", _("First moves"), 280) o_columns.nueva("NUMLINES", _("Lines"), 80, centered=True) o_columns.nueva("FILE", _("File"), 200) self.glista = Grid.Grid(self, o_columns, siSelecFilas=True, siSeleccionMultiple=True) sp = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) li_acciones = ( (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("Edit"), Iconos.Modificar(), self.modificar), None, (_("New"), Iconos.Nuevo(), self.new), None, (_("Copy"), Iconos.Copiar(), self.copy), None, (_("Rename"), Iconos.Modificar(), self.renombrar), None, (_("Up"), Iconos.Arriba(), self.arriba), (_("Down"), Iconos.Abajo(), self.abajo), None, (_("Remove"), Iconos.Borrar(), self.borrar), None, (_("Reinit"), Iconos.Reiniciar(), self.reiniciar), None, (_("Folder"), Iconos.File(), self.changeFolder), None, ) tb = QTVarios.LCTB(self, li_acciones) tb.setSizePolicy(sp) li_acciones = ( (_("Sequential"), Iconos.TrainSequential(), self.tr_sequential), None, (_("Static"), Iconos.TrainStatic(), self.tr_static), None, (_("Positions"), Iconos.TrainPositions(), self.tr_positions), None, (_("With engines"), Iconos.TrainEngines(), self.tr_engines), ) self.tbtrain = tbtrain = Controles.TBrutina(self, li_acciones, siTexto=False) lbtrain = Controles.LB( self, _("Trainings")).alinCentrado().ponFondoN("lightgray") lytrain = Colocacion.V().control(lbtrain).control(tbtrain).margen(0) self.wtrain = QtWidgets.QWidget() self.wtrain.setLayout(lytrain) lytb = Colocacion.H().control(tb).control(self.wtrain).margen(0) wtb = QtWidgets.QWidget() wtb.setFixedHeight(62) wtb.setLayout(lytb) # Colocamos ly = Colocacion.V().control(wtb).control(self.glista).margen(4) self.setLayout(ly) self.register_grid(self.glista) self.restore_video(anchoDefecto=self.glista.anchoColumnas() + 20) self.wtrain.setVisible(False) self.glista.gotop()