Exemple #1
0
 def onUpdate(self, destLeft, destTop, destRight, destBottom, width, height, bitsPerPixel, isCompress, data):
     """
     @summary: callback use when bitmap is received 
     """
     image = RDPBitmapToQtImage(width, height, bitsPerPixel, isCompress, data);
     with QtGui.QPainter(self._buffer) as qp:
     # draw image
         qp.drawImage(destLeft, destTop, image, 0, 0, destRight - destLeft + 1, destBottom - destTop + 1)
     if not self._startTimeout:
         self._startTimeout = False
         self._reactor.callLater(self._timeout, self.checkUpdate)
Exemple #2
0
def loop(widget, rssFile, nextEvent):
    """
    @summary: timer function
    @param widget: {QRemoteDesktop}
    @param rssFile: {rss.FileReader}
    """

    if nextEvent.type.value == rss.EventType.UPDATE:
        image = RDPBitmapToQtImage(
            nextEvent.event.width.value, nextEvent.event.height.value,
            nextEvent.event.bpp.value,
            nextEvent.event.format.value == rss.UpdateFormat.BMP,
            nextEvent.event.data.value)
        widget._viewer.notifyImage(
            nextEvent.event.destLeft.value, nextEvent.event.destTop.value,
            image, nextEvent.event.destRight.value -
            nextEvent.event.destLeft.value + 1,
            nextEvent.event.destBottom.value - nextEvent.event.destTop.value +
            1)

    elif nextEvent.type.value == rss.EventType.SCREEN:
        widget._viewer.resize(nextEvent.event.width.value,
                              nextEvent.event.height.value)

    elif nextEvent.type.value == rss.EventType.INFO:
        widget._text.append(
            "Domain : %s\nUsername : %s\nPassword : %s\nHostname : %s\n" %
            (nextEvent.event.domain.value, nextEvent.event.username.value,
             nextEvent.event.password.value, nextEvent.event.hostname.value))
    elif nextEvent.type.value == rss.EventType.KEY_SCANCODE:
        if nextEvent.event.isPressed.value == 0:
            widget._text.moveCursor(QtGui.QTextCursor.End)
            widget._text.insertPlainText(
                scancodeToChar(nextEvent.event.code.value))

    elif nextEvent.type.value == rss.EventType.CLOSE:
        return

    e = rssFile.nextEvent()
    QtCore.QTimer.singleShot(e.timestamp.value,
                             lambda: loop(widget, rssFile, e))
Exemple #3
0
def loop(widget, rssFile, nextEvent):
    """
    @summary: timer function
    @param widget: {QRemoteDesktop}
    @param rssFile: {rss.FileReader}
    """

    if nextEvent.type.value == rss.EventType.UPDATE:
        image = RDPBitmapToQtImage(
            nextEvent.event.width.value, nextEvent.event.height.value,
            nextEvent.event.bpp.value,
            nextEvent.event.format.value == rss.UpdateFormat.BMP,
            nextEvent.event.data.value)
        widget.notifyImage(
            nextEvent.event.destLeft.value, nextEvent.event.destTop.value,
            image, nextEvent.event.destRight.value -
            nextEvent.event.destLeft.value + 1,
            nextEvent.event.destBottom.value - nextEvent.event.destTop.value +
            1)

    elif nextEvent.type.value == rss.EventType.SCREEN:
        widget.resize(nextEvent.event.width.value,
                      nextEvent.event.height.value)

    elif nextEvent.type.value == rss.EventType.INFO:
        widget.drawInfos(nextEvent.event.domain.value,
                         nextEvent.event.username.value,
                         nextEvent.event.password.value,
                         nextEvent.event.hostname.value)

    elif nextEvent.type.value == rss.EventType.CLOSE:
        widget.close()
        return

    e = rssFile.nextEvent()
    QtCore.QTimer.singleShot(e.timestamp.value,
                             lambda: loop(widget, rssFile, e))