示例#1
0
    def __init__(self, procesador):

        route = self.route = Routes.Transsiberian(procesador.configuracion)

        titulo = "%s (%d)" % (_("Transsiberian Railway"), route.level)
        icono = Iconos.Train()
        extparam = "transsiberian"
        QTVarios.WDialogo.__init__(self, procesador.pantalla, 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.recuperarVideo(siTam=False)
示例#2
0
    def __init__(self, wowner, configuracion, recno):
        expedition = Everest.Expedition(configuracion, recno)
        self.li_routes, self.current, svg, rotulo = 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, 762.0 * 520.0 / 1172.0)
        lySVG = Colocacion.H().relleno(1).control(wsvg).relleno(1)

        liAcciones = (
            (_("Climb"), Iconos.Empezar(), self.climb),
            None,
            (_("Close"), Iconos.MainMenu(), self.cancel),
            None,
        )
        tb = Controles.TBrutina(self, liAcciones).vertical()
        if self.current is None:
            tb.setAccionVisible(self.climb, False)

        lyRot = Colocacion.H()
        for elem in rotulo:
            lb_rotulo = Controles.LB(self, elem).alinCentrado()
            lb_rotulo.setStyleSheet(
                "QWidget { border-style: groove; border-width: 2px; border-color: LightSlateGray ;}"
            )
            lb_rotulo.ponTipoLetra(puntos=12, peso=700)
            lyRot.control(lb_rotulo)

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("ROUTE", _("Route"), 240, siCentrado=True)
        oColumnas.nueva("GAMES", _("Games"), 80, siCentrado=True)
        oColumnas.nueva("DONE", _("Done"), 80, siCentrado=True)
        oColumnas.nueva("TIME", _("Time"), 80, siCentrado=True)
        oColumnas.nueva("MTIME", _("Average time"), 80, siCentrado=True)
        oColumnas.nueva("MPOINTS", _("Av. lost points"), 80, siCentrado=True)
        oColumnas.nueva("TRIES", _("Max tries"), 80, siCentrado=True)
        oColumnas.nueva("TOLERANCE", _("Tolerance"), 80, siCentrado=True)
        grid = Grid.Grid(self,
                         oColumnas,
                         siSelecFilas=True,
                         siSeleccionMultiple=False)
        grid.setMinimumWidth(grid.anchoColumnas() + 20)
        grid.coloresAlternados()

        lyG = Colocacion.V().otro(lyRot).control(grid)

        lyR = Colocacion.H().control(tb).otro(lyG)

        ly = Colocacion.V().otro(lySVG).otro(lyR)

        self.setLayout(ly)

        self.recuperarVideo(siTam=True, anchoDefecto=784, altoDefecto=670)
示例#3
0
    def __init__(self, parent=None):
        super(SourceWidget, self).__init__(parent)

        self.mimeData = None

        imageFile = QtCore.QFile(':/images/example.svg')
        imageFile.open(QtCore.QIODevice.ReadOnly)
        self.imageData = imageFile.readAll()
        imageFile.close()

        imageArea = QtGui.QScrollArea()
        self.imageLabel = QtSvg.QSvgWidget()
        self.imageLabel.renderer().load(self.imageData)
        imageArea.setWidget(self.imageLabel)

        instructTopLabel = QtGui.QLabel("This is an SVG drawing:")
        instructBottomLabel = QtGui.QLabel("Drag the icon to copy the drawing as a PNG file:")
        dragIcon = QtGui.QPushButton("Export")
        dragIcon.setIcon(QtGui.QIcon(':/images/drag.png'))
        dragIcon.pressed.connect(self.startDrag)

        layout = QtGui.QGridLayout()
        layout.addWidget(instructTopLabel, 0, 0, 1, 2)
        layout.addWidget(imageArea, 1, 0, 2, 2)
        layout.addWidget(instructBottomLabel, 3, 0)
        layout.addWidget(dragIcon, 3, 1)
        self.setLayout(layout)
        self.setWindowTitle("Delayed Encoding")
示例#4
0
    def __init__(self, parent=None):
        """ SVGCellWidget(parent: QWidget) -> SVGCellWidget
        Create a SVGCellWidget without any toolbar
        """
        QCellWidget.__init__(self, parent)
        self.setLayout(QtGui.QVBoxLayout(self))

        self.svgWidget = QtSvg.QSvgWidget()
        self.layout().addWidget(self.svgWidget)

        self.controlBarType = None
        self.fileSrc = None
示例#5
0
文件: azan.py 项目: a-atalla/azan
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        uic.loadUi("ui/MainWindow.ui", self)
        ###
        self.h_days = ['Ahd', 'Ith', 'Thu', 'Arb', 'Kha', 'Jum', 'Sab']
        self.h_months = [
            'Muh', 'Saf', 'Rab-Awl', 'Rab-Than', 'Jum-Awl', 'Jum-Than', 'Raj',
            'Sha', 'Ram', 'Sha', 'Dhu-Quida', 'Thu-Hjja'
        ]
        self.cal = HijriCal()

        global settingsDialog
        settingsDialog = SettingsDialog()
        settingsDialog.database()
        settingsDialog.calculate()
        settingsDialog.getcity()
        settingsDialog.settings()
        settingsDialog.cityCoordinates()

        global azkar
        azkar = PopupWindow()

        global reportDialog
        reportDialog = ReportDialog()

        self.changeStyle(settingsDialog.selectedStyle)
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.mediaObject = Phonon.MediaObject(self)
        self.metaInformationResolver = Phonon.MediaObject(self)
        Phonon.createPath(self.mediaObject, self.audioOutput)

        #svg widget to display qibla svg image
        self.svgwidget = QtSvg.QSvgWidget()

        #insert svg widget into main vbox before the last widget
        self.horizontalLayout_3.insertWidget(0, self.svgwidget)
        self.svgwidget.setSizePolicy(QtGui.QSizePolicy.Maximum,
                                     QtGui.QSizePolicy.Maximum)
        self.svgwidget.setMaximumSize(150, 150)

        self.timer = QtCore.QTimer(self)
        self.timer.start(1000)

        self.center()
        self.TrayIcon()
        self.displayTime()
        self.refreshWindow()
        self.connections()
示例#6
0
    def initUI(self):
        """ Establish all interface components, hide them for initial
        startup state. Trigger an automatic closing timer for a ui with
        no close buttons, and no window, and no taskbar entry.
        """
        self.vbox_layout = QtGui.QVBoxLayout()
        self.vbox_layout.setSpacing(0)
        self.vbox_layout.setMargin(0)

        self.lblLuminance = QtGui.QLabel("Default", self)
        self.lblLuminance.setContentsMargins(75, 0, 0, 0)
        self.lblLuminance.setVisible(False)

        # Auto-close timer
        self.closeTimer = QtCore.QBasicTimer()
        self.closeTimer.start(self._close_wait, self)

        # Fade-out timer
        self.fadeTimer = QtCore.QTimer()
        self.fadeTimer.setInterval(self._close_wait - 1000)
        self.fadeTimer.timeout.connect(self.fade_out)
        self.fadeTimer.start()

        # Luminance capture timer
        self.luminanceTimer = QtCore.QTimer()
        self.luminanceTimer.setInterval(1000)
        self.luminanceTimer.timeout.connect(self.update_luminance)

        fname = "luminancelabel/ui/TriangleRotate.svg"
        self.lblSvg = QtSvg.QSvgWidget(fname, self)
        self.lblSvg.setMaximumWidth(0)
        self.lblSvg.setMinimumWidth(0)

        self.vbox_layout.addWidget(self.lblLuminance)
        self.vbox_layout.addWidget(self.lblSvg)

        # Requires a compositing window manager to be translucent
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint)
        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowStaysOnTopHint)

        self.setLayout(self.vbox_layout)
        self.setGeometry(self._startX, self._startY, 800, 600)
        self.setWindowTitle("LuminanceLabel - Rotate")
        self.show()
示例#7
0
    def setupUi(self, tlSVGFeature):
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(tlSVGFeature.sizePolicy().hasHeightForWidth())
        tlSVGFeature.setSizePolicy(sizePolicy)
        tlSVGFeature.setMaximumSize(QtCore.QSize(300, 300))
        self.dockWidget = QtGui.QDockWidget(tlSVGFeature)
        self.dockWidget.setEnabled(True)
        self.dockWidget.setGeometry(QtCore.QRect(0, 0, 300, 300))
        self.dockWidget.setMinimumSize(QtCore.QSize(300, 300))
        self.dockWidget.setObjectName(_fromUtf8("dockWidget"))
        self.dockWidgetContents = QtGui.QWidget()
        self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
        self.svgWidget = QtSvg.QSvgWidget(self.dockWidgetContents)
        self.svgWidget.setGeometry(QtCore.QRect(0, 0, 300, 300))
        self.svgWidget.setObjectName(_fromUtf8("svgWidget"))
        self.dockWidget.setWidget(self.dockWidgetContents)

        self.retranslateUi(tlSVGFeature)
        QtCore.QMetaObject.connectSlotsByName(tlSVGFeature)
示例#8
0
文件: pyxel.py 项目: poksme/Pyxel
    def initUI(self):
        self.cte = min(win.width / (gb.width + 200), \
                           win.height / (gb.height + 100))
        self.colsel = 2
        self.brush = 0
        self.pal = 0
        self.logoFlag = True

        self.screen = Screen.Screen(self)
        self.screen.setGeometry(0, 0, Screen.width * self.cte,
                                Screen.height * self.cte)

        self.background = QtSvg.QSvgWidget("pix/bg2.svg", self)
        self.background.setGeometry(0, 0, pos.backgroundW * self.cte, \
                                        pos.backgroundH * self.cte)
        self.board = PyxelBoard.PyxelBoard(self)
        self.board.setGeometry(pos.boardX * self.cte, pos.boardY * self.cte, \
                                   gb.width * self.cte, gb.height * self.cte)
        self.palette = PyxelPalette.PyxelPalette(self)
        self.palette.setGeometry(pos.paletteX * self.cte, pos.paletteY * self.cte, \
                                     pos.paletteW * self.cte, pos.paletteH * self.cte + 1)
        self.brushWidget = BrushWidget.BrushWidget(self)
        self.brushWidget.setGeometry((pos.paletteX + pos.space) * self.cte, pos.paletteY * self.cte, \
                                         pos.paletteW * self.cte, pos.paletteH * self.cte + 1)
示例#9
0
import sys
from PyQt4 import QtGui, QtSvg

app = QtGui.QApplication(sys.argv)
svgWidget = QtSvg.QSvgWidget('pic1.svg')
svgWidget.setGeometry(50,50,759,668)
svgWidget.show()

sys.exit(app.exec_())
示例#10
0
    def __init__(self, procesador):

        self.procesador = procesador
        self.configuracion = procesador.configuracion

        self.siPlay = False
        self.wreload = False

        self.dbwashing = Washing.DBWashing(procesador.configuracion)
        self.washing = self.dbwashing.washing
        eng = self.washing.lastEngine(procesador.configuracion)
        siTerminado = eng is None

        owner = procesador.pantalla
        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 siTerminado:
            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("IntFiles/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))
        p = 1.0
        wsvg.setFixedSize(287.79 * p, 398.83 * p)

        if siTerminado:
            plant = "<tr><td align=\"right\">%s:</td><td><b>%s</b></td></tr>"
            hints, times, games = self.washing.totals()
            nEngines = self.washing.numEngines()
            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.numEngines(),
                self.washing.totalEngines(procesador.configuracion),
                _("Engine"),
                eng.nombre,
                _("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).alinCentrado().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
        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("STEP", _("Washing"), 50, siCentrado=True)
        oColumnas.nueva("ENGINE", _("Engine"), 170, siCentrado=True)
        oColumnas.nueva("ELO", _("Elo"), 50, siCentrado=True)
        oColumnas.nueva("COLOR", _("Color"), 70, siCentrado=True)
        oColumnas.nueva("STATE", _("State"), 90, siCentrado=True)
        oColumnas.nueva("HINTS", _("Hints"), 60, siCentrado=True)
        oColumnas.nueva("GAMES", _("Games"), 60, siCentrado=True)
        oColumnas.nueva("TIME", _("Time"), 60, siCentrado=True)
        oColumnas.nueva("DATE", _("Date"), 120, siCentrado=True)
        oColumnas.nueva("INDEX", _("Index"), 60, siCentrado=True)

        self.grid = grid = Grid.Grid(self, oColumnas, siSelecFilas=True)
        nAnchoPgn = self.grid.anchoColumnas() + 20
        self.grid.setMinimumWidth(nAnchoPgn)
        self.registrarGrid(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.recuperarVideo(siTam=True, anchoDefecto=nAnchoPgn)
示例#11
0
    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.pantalla, titulo, icono, mapa)

        self.procesador = procesador

        self.playCurrent = None

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("TIPO", "", 24, edicion=Delegados.PmIconosBMT(), siCentrado=True)
        oColumnas.nueva("SELECT", _("Select one to play"), 150)

        self.grid = Grid.Grid(self, oColumnas, siSelecFilas=True, xid="W")

        self.registrarGrid(self.grid)

        liAcciones = (
            (_("Close"), Iconos.MainMenu(), self.terminar), None,
            (_("Play"), Iconos.Empezar(), self.play), None,
        )
        tbWork = Controles.TBrutina(self, liAcciones, tamIcon=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 = QtGui.QWidget()
        w.setLayout(ly)

        splitter = QtGui.QSplitter(self)
        splitter.addWidget(w)
        splitter.addWidget(wsvg)
        self.registrarSplitter(splitter, "splitter")

        oColumnas = Columnas.ListaColumnas()
        oColumnas.nueva("ACTIVE", _("Active"), 80, siCentrado=True)
        oColumnas.nueva("TIPO", _("Type"), 110, siCentrado=True)
        oColumnas.nueva("DCREATION", _("Creation date"), 110, siCentrado=True)
        oColumnas.nueva("DONE", _("Done"), 110, siCentrado=True)
        oColumnas.nueva("DEND", _("Ending date"), 110, siCentrado=True)
        oColumnas.nueva("RESULT", _("Result"), 110, siCentrado=True)

        self.gridData = Grid.Grid(self, oColumnas, siSelecFilas=True, xid="H")
        self.registrarGrid(self.gridData)

        liAcciones = ((_("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 = Controles.TBrutina(self, liAcciones, tamIcon=24)

        ly = Colocacion.V().control(tb).control(self.gridData)
        w = QtGui.QWidget()
        w.setLayout(ly)

        self.tab = Controles.Tab()
        self.tab.ponPosicion("W")
        self.tab.nuevaTab(splitter, _("Map"))
        self.tab.nuevaTab(w, _("Data"))

        ly = Colocacion.H().control(self.tab).margen(0)
        self.setLayout(ly)

        self.recuperarVideo(siTam=True, anchoDefecto=960, altoDefecto=600)

        self.workmap.setWidget(wsvg)
        self.workmap.resetWidget()
        self.grid.gotop()
        self.gridData.gotop()

        self.informacion()
示例#12
0
 def widget(self, pieza):
     w = QtSvg.QSvgWidget()
     w.load(self.dicPiezas[pieza])
     return w
示例#13
0
def add_svg(path):
    svg_widget = QtSvg.QSvgWidget(path)
    svg_widget.setFixedSize(100, 100)
    return svg_widget
    while True:
        if cv2.waitKey(1) & 0xFF == ord(stop):
            break

        frame, lds2 = one_frame()

        if lds2:
            lds.merge_with_new_frame(lds2)
            draw_landmarks(frame, lds)

        cv2.imshow('Vid', frame)
    return lds.fingerprint()


app = QtGui.QApplication(sys.argv)
svgWidget = QtSvg.QSvgWidget()
svgWidget.setGeometry(50, 50, 759, 668)
svgWidget.show()

video_capture = cv2.VideoCapture(0)

faces = {}
svg = Svg(sys.argv[1])
for fname in sys.argv[1:]:
    svg2 = Svg(fname)
    svg.merge(fname, svg2)

    svgWidget.load(svg.blend({fname: 1}))
    face = capture_landmarks(stop='a')
    faces[fname] = face
print(faces)