def __init__(self, wowner, configuration, recno): expedition = Everest.Expedition(configuration, recno) self.li_routes, self.current, svg, label = expedition.gen_routes() titulo = _("Everest") icono = Iconos.Trekking() extparam = "expedition" QTVarios.WDialogo.__init__(self, wowner, titulo, icono, extparam) self.selected = False wsvg = QtSvg.QSvgWidget() wsvg.load(QtCore.QByteArray(svg)) wsvg.setFixedSize(762, int(762.0 * 520.0 / 1172.0)) lySVG = Colocacion.H().relleno(1).control(wsvg).relleno(1) li_acciones = ( (_("Climb"), Iconos.Empezar(), self.climb), None, (_("Close"), Iconos.MainMenu(), self.cancel), None, ) tb = Controles.TBrutina(self, li_acciones).vertical() if self.current is None: tb.setAccionVisible(self.climb, False) lyRot = Colocacion.H() for elem in label: lb_rotulo = Controles.LB(self, elem).align_center() lb_rotulo.setStyleSheet( "QWidget { border-style: groove; border-width: 2px; border-color: LightSlateGray ;}" ) lb_rotulo.ponTipoLetra(puntos=12, peso=700) lyRot.control(lb_rotulo) o_columns = Columnas.ListaColumnas() o_columns.nueva("ROUTE", _("Route"), 240, centered=True) o_columns.nueva("GAMES", _("Games"), 80, centered=True) o_columns.nueva("DONE", _("Done"), 80, centered=True) o_columns.nueva("TIME", _("Time"), 80, centered=True) o_columns.nueva("MTIME", _("Average time"), 80, centered=True) o_columns.nueva("MPOINTS", _("Av. lost points"), 80, centered=True) o_columns.nueva("TRIES", _("Max tries"), 80, centered=True) o_columns.nueva("TOLERANCE", _("Tolerance"), 80, centered=True) grid = Grid.Grid(self, o_columns, siSelecFilas=True, siSeleccionMultiple=False) grid.setMinimumWidth(grid.anchoColumnas() + 20) grid.coloresAlternados() lyG = Colocacion.V().otro(lyRot).control(grid).margen(0) lyR = Colocacion.H().control(tb).otro(lyG).margen(0) ly = Colocacion.V().otro(lySVG).otro(lyR).margen(3) self.setLayout(ly) self.restore_video(siTam=True, anchoDefecto=784, altoDefecto=670)
def __init__(self, procesador): route = self.route = Routes.Transsiberian(procesador.configuration) titulo = "%s (%d)" % (_("Transsiberian Railway"), route.level) icono = Iconos.Train() extparam = "transsiberian" QTVarios.WDialogo.__init__(self, procesador.main_window, titulo, icono, extparam) self.procesador = procesador wsvg = QtSvg.QSvgWidget() x = self.route.get_txt().encode("utf-8") wsvg.load(QtCore.QByteArray(x)) wsvg.setFixedSize(762, 762.0 * 658.0 / 1148.0) lySVG = Colocacion.H().relleno(1).control(wsvg).relleno(1) # Title lbTit = self.LINE(_("Moscow"), _("Vladivostok"), 14, 500).altoFijo(26) lbKM = self.KM(route.total_km, 12, 500).altoFijo(26) self.set_style("White", "#33322C", lbTit, lbKM) lbKMdone = self.KM(route.km, 12, 500).altoFijo(26) self.set_border(lbKMdone) lyTitle = Colocacion.H().control(lbTit).control(lbKM).control(lbKMdone) if route.is_ended(): self.init_ended(route, lyTitle, lySVG) else: self.init_working(route, lyTitle, lySVG) self.restore_video(siTam=False)
def show(self, *args, **kwargs): """ Displays this window """ # Transparent Background # # See: https://doc.qt.io/qt-5/qt.html#WindowType-enum # This combination works on Windows 10 # Note: It may not work on Ubuntu... # Has Keyboard Focus self.setWindowFlags( Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint ) # Not Sure if this is needed at all # window.setStyleSheet("background:transparent;") self.setAttribute(Qt.WA_TranslucentBackground) # Load SVG Data self._svg = QtSvg.QSvgWidget(parent=self) self._redraw() # Adopt size self.resize(self._width, self._height) self._svg.resize(self._width, self._height) self._start_timer() super().show(*args, **kwargs)
def __init__(self, svgImage, labelname, max, min): super().__init__() self.svgWidget = QtSvg.QSvgWidget(svgImage) self.label = QLabel(labelname, self) self.labelMin = QLabel(str(min)) self.labelMax = QLabel(str(max)) # Instance: self.schemeLabelMinMax = QGridLayout() self.widgetMinMax = QWidget() self.scheme = QGridLayout() self.init_ui()
def SvgIcon(img_path: str): svg_widg = QtSvg.QSvgWidget() svg_widg.load(img_path) svg_widg.setStyleSheet(""" background-color: transparent; border: none; fill: white; color: white; """) svg_widg.setFixedSize(QtCore.QSize(20, 20)) return svg_widg
def __init__(self, parent=None): super(BusyIndicator, self).__init__(parent) self.resize(80, 80) layout = QtWidgets.QHBoxLayout() svg = QtSvg.QSvgWidget() path = os.path.join(PATH, 'svg', 'oval.svg') svg.load(path) layout.addWidget(svg) self.setLayout(layout) self.hide()
def __init__(self, parent=None): super(BusyIndicator, self).__init__(parent) self.resize(100, 100) self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) layout = QtWidgets.QHBoxLayout() svg = QtSvg.QSvgWidget() svg.load(u":/svg/tail-spin.svg") layout.addWidget(svg) self.setLayout(layout) self.hide()
def widget(self, pieza): w = QtSvg.QSvgWidget() w.load(self.dicPiezas[pieza]) return w
def __init__(self, procesador, mapa): self.workmap = WorkMap.WorkMap(mapa) dic = TrListas.maps() titulo = dic[mapa] icono = getattr(Iconos, mapa)() QTVarios.WDialogo.__init__(self, procesador.main_window, titulo, icono, mapa) self.procesador = procesador self.playCurrent = None o_columns = Columnas.ListaColumnas() o_columns.nueva("TYPE", "", 24, edicion=Delegados.PmIconosBMT(), centered=True) o_columns.nueva("SELECT", _("Select one to play"), 150) self.grid = Grid.Grid(self, o_columns, siSelecFilas=True, xid="W") self.register_grid(self.grid) li_acciones = ( (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("Play"), Iconos.Empezar(), self.play), None, ) tbWork = QTVarios.LCTB(self, li_acciones, icon_size=24) self.lbInfo = Controles.LB(self) self.wsvg = wsvg = QtSvg.QSvgWidget() p = wsvg.palette() p.setColor(wsvg.backgroundRole(), QtGui.QColor("#F5F5F5")) wsvg.setPalette(p) ly = Colocacion.V().control(tbWork).control(self.lbInfo).control( self.grid) w = QtWidgets.QWidget() w.setLayout(ly) splitter = QtWidgets.QSplitter(self) splitter.addWidget(w) splitter.addWidget(wsvg) self.register_splitter(splitter, "splitter") o_columns = Columnas.ListaColumnas() o_columns.nueva("ACTIVE", _("Active"), 80, centered=True) o_columns.nueva("TYPE", _("Type"), 110, centered=True) o_columns.nueva("DCREATION", _("Creation date"), 110, centered=True) o_columns.nueva("DONE", _("Done"), 110, centered=True) o_columns.nueva("DEND", _("Ending date"), 110, centered=True) o_columns.nueva("RESULT", _("Result"), 110, centered=True) self.gridData = Grid.Grid(self, o_columns, siSelecFilas=True, xid="H") self.register_grid(self.gridData) li_acciones = ( (_("Close"), Iconos.MainMenu(), self.terminar), None, (_("Select"), Iconos.Seleccionar(), self.data_select), None, (_("New"), Iconos.NuevoMas(), self.data_new), None, (_("Remove"), Iconos.Borrar(), self.data_remove), None, ) tb = QTVarios.LCTB(self, li_acciones, icon_size=24) ly = Colocacion.V().control(tb).control(self.gridData) w = QtWidgets.QWidget() w.setLayout(ly) self.tab = Controles.Tab() self.tab.set_position("W") self.tab.nuevaTab(splitter, _("Map")) self.tab.nuevaTab(w, _("Data")) ly = Colocacion.H().control(self.tab).margen(0) self.setLayout(ly) self.restore_video(siTam=True, anchoDefecto=960, altoDefecto=600) self.workmap.setWidget(wsvg) self.workmap.resetWidget() self.grid.gotop() self.gridData.gotop() self.informacion()
def __init__(self, procesador): self.procesador = procesador self.configuration = procesador.configuration self.siPlay = False self.wreload = False self.dbwashing = Washing.DBWashing(procesador.configuration) self.washing = self.dbwashing.washing eng = self.washing.last_engine(procesador.configuration) finished = eng is None owner = procesador.main_window titulo = _("The Washing Machine") extparam = "washing" icono = Iconos.WashingMachine() QTVarios.WDialogo.__init__(self, owner, titulo, icono, extparam) # Toolbar tb = QTVarios.LCTB(self) tb.new(_("Close"), Iconos.MainMenu(), self.terminar) tb.new(_("File"), Iconos.Recuperar(), self.file) if not finished: tb.new(_("Play"), Iconos.Play(), self.play) # Tab current ia = self.washing.index_average() c_create = "#f9e7e7" c_tactics = "#df8f87" c_reinit = "#8aa678" c_des = "#e4e4e4" c_hab = "#9dde67" c_act = "#dd2a2b" c_ia = "#cccdea" li_ia = ("#ffed00", "#ff8e00", "#29b41b", "#1174ff", "#bc01d9", "#eb0000") d_ia = li_ia[int(eng.index() / (100.0 / 6.0)) % 6] state = eng.state wsvg = QtSvg.QSvgWidget() with open(Code.path_resource("IntFiles/Svg", "washing-machine.svg")) as f: svg = f.read() d_create = c_des d_tactics = c_des d_reinit = c_des ctac = "" if state == Washing.CREATING: d_create = c_act elif state == Washing.REPLAY: d_create = c_hab d_tactics = c_hab d_reinit = c_act elif state == Washing.TACTICS: d_create = c_hab d_tactics = c_act ctac = str(eng.numTactics()) svg = svg.replace(c_create, d_create) svg = svg.replace(c_tactics, d_tactics) svg = svg.replace(c_reinit, d_reinit) svg = svg.replace("TAC", ctac) svg = svg.replace(c_ia, d_ia) wsvg.load(QtCore.QByteArray(svg.encode("utf-8"))) p = 1.0 wsvg.setFixedSize(287.79 * p, 398.83 * p) if finished: plant = '<tr><td align="right">%s:</td><td><b>%s</b></td></tr>' hints, times, games = self.washing.totals() nEngines = self.washing.num_engines() html = '<h2><center>%s: %d %s</center></h2><br><table cellpadding="4">' % ( _("Finished"), nEngines, _("engines"), ) for x in range(3): html += plant html += "</table>" html = html % ( _("Hints"), "%d (%0.02f)" % (hints, hints * 1.0 / nEngines), _("Games"), "%d (%0.02f)" % (games, games * 1.0 / nEngines), _("Time"), "%s (%s)" % (Util.secs2str(times), Util.secs2str(int(times / nEngines))), ) else: plant = '<tr><td align="right">%s:</td><td><b>%s</b></td></tr>' plantverde = '<tr><td align="right">%s:</td><td style="color:green;"><b>%s</b></td></tr>' html = '<h2><center>%s %d/%d</center></h2><br><table cellpadding="4">' for x in range(8): html += plantverde if x == 2 else plant html += "</table>" html = html % ( _("Washing"), self.washing.num_engines(), self.washing.total_engines(procesador.configuration), _("Engine"), eng.name, _("Elo"), eng.elo, "<b>%s</b>" % _("Task"), eng.lbState(), _("Color"), _("White") if eng.color else _("Black"), _("Hints"), "%d/%d" % (eng.hints_current, eng.hints), _("Games"), eng.games, _("Time"), eng.lbTime(), _("Index"), eng.cindex(), ) lbTxt = Controles.LB(self, html).ponTipoLetra(puntos=12) lbIdx = Controles.LB(self, "%0.2f%%" % ia).align_center().ponTipoLetra( puntos=36, peso=700) ly0 = Colocacion.V().control(wsvg).relleno(1) ly1 = Colocacion.V().espacio(20).control(lbTxt).espacio(20).control( lbIdx).relleno(1) ly2 = Colocacion.H().otro(ly0).otro(ly1) gbCurrent = Controles.GB(self, "", ly2) # Lista o_columns = Columnas.ListaColumnas() o_columns.nueva("STEP", _("Washing"), 50, centered=True) o_columns.nueva("ENGINE", _("Engine"), 170, centered=True) o_columns.nueva("ELO", _("Elo"), 50, centered=True) o_columns.nueva("COLOR", _("Color"), 70, centered=True) o_columns.nueva("STATE", _("State"), 90, centered=True) o_columns.nueva("HINTS", _("Hints"), 60, centered=True) o_columns.nueva("GAMES", _("Games"), 60, centered=True) o_columns.nueva("TIME", _("Time"), 60, centered=True) o_columns.nueva("DATE", _("Date"), 120, centered=True) o_columns.nueva("INDEX", _("Index"), 60, centered=True) self.grid = grid = Grid.Grid(self, o_columns, siSelecFilas=True) nAnchoPgn = self.grid.anchoColumnas() + 20 self.grid.setMinimumWidth(nAnchoPgn) self.register_grid(grid) ly0 = Colocacion.V().control(self.grid) gbDatos = Controles.GB(self, "", ly0) self.tab = Controles.Tab() self.tab.nuevaTab(gbCurrent, _("Current")) self.tab.nuevaTab(gbDatos, _("Data")) # Colocamos --------------------------------------------------------------- ly = Colocacion.V().control(tb).control(self.tab) self.setLayout(ly) self.restore_video(siTam=True, anchoDefecto=nAnchoPgn)
def set_work_in_progress(self): """This method set the status of the widget as work in progress""" svg = QtSvg.QSvgWidget() svg.setFixedSize(QtCore.QSize(20, 20)) svg.load(u':/resources/svg/tail-spin.svg') self._set_widget(widget=svg)