Package prlsdkapi :: Class VmDisplayDev
[hide private]
[frames] | no frames]

Class VmDisplayDev

object --+        
         |        
 PrlObject --+    
             |    
VmObjEmulation --+
                 |
                VmDisplayDev

The VmDisplayDev class provides methods for remote capture of screen shots of a virtual machine desktop and for sending keyboard and mouse commands to it. With this functionality, you can programmatically connect to a remote virtual machine and run its applications as if you were sitting at the virtual machine's console. The typical usage of the Remote Desktop Access functionality is creating automation scripts for unattended operating system and other software installations.

There are four groups of functions comprising the Remote Desktop Access API :

Instance Methods [hide private]
 
__init__(self, vm)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__del__(self)
 
__ensure_attr__(self)
 
engage_job(self, job)
 
check_connected(self)
 
connect_to_vm(self)
Connects to a virtual machine to begin a remote desktop access session.
 
disconnect_from_vm(self)
Ends a remote desktop access session that was started with connect_to_vm.
 
get_screen_buffer(self)
Returns the contents of the screen buffer of the primary display.
 
send_screen_size_event(self, width, height, depth)
Send "screen size change" event to the virtual machine.
 
capture_screen_to_file(self, filename, x, y, width, height, format=1342177291, quality=-1)
Captures a screen area of a remote virtual machine directly to a file on the client computer.
 
set_mouse_pos(self, coord_xyz, buttons)
Set the mouse pointer position.
 
move_mouse(self, coord_dxdydz, buttons)
Move the mouse pointer to a relative position and send a mouse event (press or release the specified mouse button).
 
send_keys_event(self, action_keys_pairs, action_time_wait=-1)
Send a set of keyboard key events to the virtual machine.
 
send_key_event(self, action, keys, action_time_wait=0)
Send a set of keyboard key events to the virtual machine.

Inherited from VmObjEmulation: call_vm, inderect_self, safe_call

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  __prefix__ = 'devdisplay'
Properties [hide private]
  sliding_mouse_enabled
Determines if sliding mouse is enabled.
  screen_size
The virtual machine screen size (width, height, depth).
  dyn_res_tool_status
Determines if Dynamic Resolution Tool is enabled.

Inherited from object: __class__

Method Details [hide private]

__init__(self, vm)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__ensure_attr__(self)

 
Overrides: VmObjEmulation.__ensure_attr__

connect_to_vm(self)

 

Connects to a virtual machine to begin a remote desktop access session. This is an asynchronous method.

Returns:
A Job object.

get_screen_buffer(self)

 

Returns the contents of the screen buffer of the primary display. The screen data is always returned as 32-bit RGBA with the alpha channel containing the value of 0.

Returns:
A buffer object containing the screen data.

send_screen_size_event(self, width, height, depth)

 

Send "screen size change" event to the virtual machine.

Parameters:
  • width - The new resolution width.
  • height - The new resolution height.
  • depth - The new resolution depth.

capture_screen_to_file(self, filename, x, y, width, height, format=1342177291, quality=-1)

 

Captures a screen area of a remote virtual machine directly to a file on the client computer. This is an asynchronous method.

Parameters:
  • filename - Name and path of the file to save the image to.
  • x - The X coordinate of the area to capture.
  • y - The Y coordinate of the area to capture.
  • width - The width of the area to capture (pixels).
  • height - The height of the area to capture (pixels).
  • format - Image format to use. See consts.PIF_xxx.
  • quality - Image quality factor. Must be in the range from 0 to 100, or -1. Specify 0 to use the highest data compression, 100 for no compression, or -1 for the default value.
Returns:
A Job object.

set_mouse_pos(self, coord_xyz, buttons)

 

Set the mouse pointer position.

Parameters:
  • coord_xyz - A tuple containing mouse pointer coordinates (x, y, z). The 'z' coordinate (scroll) is optional.
  • buttons - Mouse buttons state. See consts.PMB_xxx.

move_mouse(self, coord_dxdydz, buttons)

 

Move the mouse pointer to a relative position and send a mouse event (press or release the specified mouse button). The position to which you want to move the pointer is calculated relatively to the center of the screen.

Parameters:
  • coord_dxdydz - A tuple containing mouse pointer coordinate offsets (dx, dy, dz). The 'dz' offset (scroll) is optional.
  • buttons - Mouse buttons state. See consts.PMB_xxx.

send_keys_event(self, action_keys_pairs, action_time_wait=-1)

 

Send a set of keyboard key events to the virtual machine.

Parameters:
  • action_keys_pairs - A tuple containing action/key pairs (action, key_codes). The key_codes item is also a tuple containing a list of key codes. See consts.ScanCodesList for available codes or start Python from the command line, import the prlsdkapi module, and issue the print prlsdkapi.prlsdk.consts.ScanCodesList statement. See consts.PKE_xxx for available actions.
  • action_time_wait - A time delay between actions specified in the action_keys_pairs parameter (in milliseconds).

send_key_event(self, action, keys, action_time_wait=0)

 

Send a set of keyboard key events to the virtual machine.

Parameters:
  • action - Action. See consts.PKE_xxx for available actions.
  • keys - A tuple containing a list of key codes. See consts.ScanCodesList for available codes.
  • action_time_wait - A time delay imposed on key input after the event execution (in milliseconds).

Property Details [hide private]

sliding_mouse_enabled

Determines if sliding mouse is enabled. True - enabled; False - disabled.

Get Method:
unreachable(s)

screen_size

The virtual machine screen size (width, height, depth).

Get Method:
unreachable(s)

dyn_res_tool_status

Determines if Dynamic Resolution Tool is enabled. True - enabled; False - disabled.

Get Method:
unreachable(s)