.. default-domain:: py .. highlight:: py .. currentmodule:: RasterPropMonitor Monitor ======= .. class:: Monitor A Raster Prop Monitor screen in an IVA, such as an MFD. Obtained by calling :meth:`monitors`. .. note:: Raster Prop Monitor draws a monitor only while the player is in the IVA of its pod, or the IVA overlay is on. Reading another monitor's text or image updates it, in any camera mode. .. attribute:: part The part the monitor is in. :Attribute: Read-only, cannot be set :rtype: :class:`SpaceCenter.Part` :Game Scenes: Flight .. attribute:: prop_name The name of the prop, e.g. ``RasterPropMonitorBasicMFD``. :Attribute: Read-only, cannot be set :rtype: str :Game Scenes: Flight .. attribute:: pages The names of the pages, in the order of the prop's configuration. :Attribute: Read-only, cannot be set :rtype: list(str) :Game Scenes: Flight .. attribute:: active_page Returns the name of the page the monitor shows, and sets it as a press of the page's button does. Raster Prop Monitor can refuse the switch, or redirect it to another page, as the prop's configuration sets. Throws an exception if the monitor has no page with the name. :Attribute: Can be read or written :rtype: str :Game Scenes: Flight .. attribute:: buttons The names of the monitor's buttons, e.g. ``button_UP``. A button's index in this list is its identifier. A name is empty where the configuration leaves a gap. :Attribute: Read-only, cannot be set :rtype: list(str) :Game Scenes: Flight .. note:: These are the buttons that the active page handles. The buttons that select pages are not in the list. .. method:: press_button(id) Press and release a button, as the player does. The release is on the next frame. Throws an exception if the monitor has no button with the identifier. :param int id: The button's index in :attr:`Monitor.buttons`. :Game Scenes: Flight .. attribute:: page_buttons The names of the prop's buttons that select the monitor's pages, e.g. ``buttonR1``. A captured button is one of them. :Attribute: Read-only, cannot be set :rtype: list(str) :Game Scenes: Flight .. method:: press_page_button(name) Press and release a page button, as the player does. The release is on the next frame. A captured button shows the page the script chose. Throws an exception if the button does not select the monitor's pages. :param str name: The name of the button, from :attr:`Monitor.page_buttons`. :Game Scenes: Flight .. method:: capture_button(name, page) Take a page button from Raster Prop Monitor. A press of the button then shows the given page, such as the ``krpc`` page of the monitor's own display, in place of the pages Raster Prop Monitor assigns it, and fires :meth:`Monitor.captured_button_pressed`. The capture lasts while KSP builds the IVA again, but is not saved with the game. Throws an exception if the button does not select the monitor's pages, or the monitor has no page with the name. :param str name: The name of the button, from :attr:`Monitor.page_buttons`. :param str page: The name of the page to show. :Game Scenes: Flight .. method:: release_capture(name) Give a captured page button back to Raster Prop Monitor. :param str name: The name of the button. :Game Scenes: Flight .. method:: captured_button_pressed(name) An event that fires when the player presses a captured page button. The event lasts until it is removed. :param str name: The name of the button. :rtype: :class:`krpc.event.Event` :Game Scenes: Flight .. attribute:: display The monitor's own display, which its pages show when their ``KRPCDisplay`` handler names no display. :Attribute: Read-only, cannot be set :rtype: :class:`Display` :Game Scenes: Flight .. attribute:: screen_width The width of the screen, in characters. :Attribute: Read-only, cannot be set :rtype: int :Game Scenes: Flight .. attribute:: screen_height The height of the screen, in lines. :Attribute: Read-only, cannot be set :rtype: int :Game Scenes: Flight .. attribute:: screen_pixel_width The width of the screen, in pixels. :Attribute: Read-only, cannot be set :rtype: int :Game Scenes: Flight .. attribute:: screen_pixel_height The height of the screen, in pixels. :Attribute: Read-only, cannot be set :rtype: int :Game Scenes: Flight .. attribute:: letter_width The width of a character, in pixels. :Attribute: Read-only, cannot be set :rtype: int :Game Scenes: Flight .. attribute:: letter_height The height of a character, in pixels. :Attribute: Read-only, cannot be set :rtype: int :Game Scenes: Flight .. attribute:: default_color The color of text with no color tag, on the active page. :Attribute: Read-only, cannot be set :rtype: :class:`StdLib.ColorRGBA` :Game Scenes: Flight .. attribute:: text The text of the active page, as the screen shows it: one line per screen line, holding the characters Raster Prop Monitor draws. The tags it draws nothing for, such as colors, are removed. :Attribute: Read-only, cannot be set :rtype: str :Game Scenes: Flight .. attribute:: raw_text The text of the active page with its variables formatted, and Raster Prop Monitor's markup kept: colors ``[#rrggbb]`` and ``[#rrggbbaa]``, nudges ``[@xN]`` and ``[@yN]`` in pixels, ``[hw]`` and ``[dw]`` for half and double width, ``[sup]``, ``[sub]`` and ``[fontN]``. :Attribute: Read-only, cannot be set :rtype: str :Game Scenes: Flight .. note:: The page's text overlay, drawn over the text, is not included. .. attribute:: variables The names of the variables the active page shows, in the order of its text. :Attribute: Read-only, cannot be set :rtype: list(str) :Game Scenes: Flight .. method:: image([format = StdLib.ImageFormat.png], [quality = 75]) The screen as an image, at :attr:`Monitor.screen_pixel_width` by :attr:`Monitor.screen_pixel_height` pixels. :param StdLib.ImageFormat format: The format of the image. :param int quality: The quality of a JPEG image, from 1 to 100. :returns: The image data. :rtype: bytes :Game Scenes: Flight