Replace tabs with spaces in code snippets.

This commit is contained in:
Manuel Rodríguez Guimeráns
2015-02-17 16:14:06 +01:00
parent 349a8a7227
commit e139a2c7eb

182
README.md
View File

@@ -143,7 +143,7 @@ from rdpy.protocol.rdp import rdp
class MyRDPFactory(rdp.ClientFactory): class MyRDPFactory(rdp.ClientFactory):
def clientConnectionLost(self, connector, reason): def clientConnectionLost(self, connector, reason):
reactor.stop() reactor.stop()
def clientConnectionFailed(self, connector, reason): def clientConnectionFailed(self, connector, reason):
@@ -153,35 +153,35 @@ class MyRDPFactory(rdp.ClientFactory):
class MyObserver(rdp.RDPClientObserver): class MyObserver(rdp.RDPClientObserver):
def onReady(self): def onReady(self):
""" """
@summary: Call when stack is ready @summary: Call when stack is ready
""" """
#send 'r' key #send 'r' key
self._controller.sendKeyEventUnicode(ord(unicode("r".toUtf8(), encoding="UTF-8")), True) self._controller.sendKeyEventUnicode(ord(unicode("r".toUtf8(), encoding="UTF-8")), True)
#mouse move and click at pixel 200x200 #mouse move and click at pixel 200x200
self._controller.sendPointerEvent(200, 200, 1, true) self._controller.sendPointerEvent(200, 200, 1, true)
def onUpdate(self, destLeft, destTop, destRight, destBottom, width, height, bitsPerPixel, isCompress, data): def onUpdate(self, destLeft, destTop, destRight, destBottom, width, height, bitsPerPixel, isCompress, data):
""" """
@summary: Notify bitmap update @summary: Notify bitmap update
@param destLeft: xmin position @param destLeft: xmin position
@param destTop: ymin position @param destTop: ymin position
@param destRight: xmax position because RDP can send bitmap with padding @param destRight: xmax position because RDP can send bitmap with padding
@param destBottom: ymax position because RDP can send bitmap with padding @param destBottom: ymax position because RDP can send bitmap with padding
@param width: width of bitmap @param width: width of bitmap
@param height: height of bitmap @param height: height of bitmap
@param bitsPerPixel: number of bit per pixel @param bitsPerPixel: number of bit per pixel
@param isCompress: use RLE compression @param isCompress: use RLE compression
@param data: bitmap data @param data: bitmap data
""" """
def onClose(self): def onClose(self):
""" """
@summary: Call when stack is close @summary: Call when stack is close
""" """
return MyObserver(controller) return MyObserver(controller)
from twisted.internet import reactor from twisted.internet import reactor
reactor.connectTCP("XXX.XXX.XXX.XXX", 3389, MyRDPFactory()) reactor.connectTCP("XXX.XXX.XXX.XXX", 3389, MyRDPFactory())
@@ -198,45 +198,45 @@ class MyRDPFactory(rdp.ServerFactory):
class MyObserver(rdp.RDPServerObserver): class MyObserver(rdp.RDPServerObserver):
def onReady(self): def onReady(self):
""" """
@summary: Call when server is ready @summary: Call when server is ready
to send and receive messages to send and receive messages
""" """
def onKeyEventScancode(self, code, isPressed): def onKeyEventScancode(self, code, isPressed):
""" """
@summary: Event call when a keyboard event is catch in scan code format @summary: Event call when a keyboard event is catch in scan code format
@param code: scan code of key @param code: scan code of key
@param isPressed: True if key is down @param isPressed: True if key is down
@see: rdp.RDPServerObserver.onKeyEventScancode @see: rdp.RDPServerObserver.onKeyEventScancode
""" """
def onKeyEventUnicode(self, code, isPressed): def onKeyEventUnicode(self, code, isPressed):
""" """
@summary: Event call when a keyboard event is catch in unicode format @summary: Event call when a keyboard event is catch in unicode format
@param code: unicode of key @param code: unicode of key
@param isPressed: True if key is down @param isPressed: True if key is down
@see: rdp.RDPServerObserver.onKeyEventUnicode @see: rdp.RDPServerObserver.onKeyEventUnicode
""" """
def onPointerEvent(self, x, y, button, isPressed): def onPointerEvent(self, x, y, button, isPressed):
""" """
@summary: Event call on mouse event @summary: Event call on mouse event
@param x: x position @param x: x position
@param y: y position @param y: y position
@param button: 1, 2 or 3 button @param button: 1, 2 or 3 button
@param isPressed: True if mouse button is pressed @param isPressed: True if mouse button is pressed
@see: rdp.RDPServerObserver.onPointerEvent @see: rdp.RDPServerObserver.onPointerEvent
""" """
def onClose(self): def onClose(self):
""" """
@summary: Call when human client close connection @summary: Call when human client close connection
@see: rdp.RDPServerObserver.onClose @see: rdp.RDPServerObserver.onClose
""" """
return MyObserver(controller) return MyObserver(controller)
from twisted.internet import reactor from twisted.internet import reactor
reactor.listenTCP(3389, MyRDPFactory()) reactor.listenTCP(3389, MyRDPFactory())
@@ -249,7 +249,7 @@ from rdpy.protocol.rfb import rfb
class MyRFBFactory(rfb.ClientFactory): class MyRFBFactory(rfb.ClientFactory):
def clientConnectionLost(self, connector, reason): def clientConnectionLost(self, connector, reason):
reactor.stop() reactor.stop()
def clientConnectionFailed(self, connector, reason): def clientConnectionFailed(self, connector, reason):
@@ -258,40 +258,40 @@ class MyRFBFactory(rfb.ClientFactory):
def buildObserver(self, controller, addr): def buildObserver(self, controller, addr):
class MyObserver(rfb.RFBClientObserver): class MyObserver(rfb.RFBClientObserver):
def onReady(self): def onReady(self):
""" """
@summary: Event when network stack is ready to receive or send event @summary: Event when network stack is ready to receive or send event
""" """
def onUpdate(self, width, height, x, y, pixelFormat, encoding, data): def onUpdate(self, width, height, x, y, pixelFormat, encoding, data):
""" """
@summary: Implement RFBClientObserver interface @summary: Implement RFBClientObserver interface
@param width: width of new image @param width: width of new image
@param height: height of new image @param height: height of new image
@param x: x position of new image @param x: x position of new image
@param y: y position of new image @param y: y position of new image
@param pixelFormat: pixefFormat structure in rfb.message.PixelFormat @param pixelFormat: pixefFormat structure in rfb.message.PixelFormat
@param encoding: encoding type rfb.message.Encoding @param encoding: encoding type rfb.message.Encoding
@param data: image data in accordance with pixel format and encoding @param data: image data in accordance with pixel format and encoding
""" """
def onCutText(self, text): def onCutText(self, text):
""" """
@summary: event when server send cut text event @summary: event when server send cut text event
@param text: text received @param text: text received
""" """
def onBell(self): def onBell(self):
""" """
@summary: event when server send biiip @summary: event when server send biiip
""" """
def onClose(self): def onClose(self):
""" """
@summary: Call when stack is close @summary: Call when stack is close
""" """
return MyObserver(controller) return MyObserver(controller)
from twisted.internet import reactor from twisted.internet import reactor
reactor.connectTCP("XXX.XXX.XXX.XXX", 3389, MyRFBFactory()) reactor.connectTCP("XXX.XXX.XXX.XXX", 3389, MyRFBFactory())