Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

194 lines
9.0KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>TUI Windows In Python (Debugging with GDB)</title>
  17. <meta name="description" content="TUI Windows In Python (Debugging with GDB)">
  18. <meta name="keywords" content="TUI Windows In Python (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Python-API.html#Python-API" rel="up" title="Python API">
  26. <link href="Python-Auto_002dloading.html#Python-Auto_002dloading" rel="next" title="Python Auto-loading">
  27. <link href="Registers-In-Python.html#Registers-In-Python" rel="prev" title="Registers In Python">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="TUI-Windows-In-Python"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="Registers-In-Python.html#Registers-In-Python" accesskey="p" rel="prev">Registers In Python</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python API</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Implementing-new-TUI-windows"></a>
  64. <h4 class="subsubsection">23.2.2.35 Implementing new TUI windows</h4>
  65. <a name="index-Python-TUI-Windows"></a>
  66. <p>New TUI (see <a href="TUI.html#TUI">TUI</a>) windows can be implemented in Python.
  67. </p>
  68. <a name="index-gdb_002eregister_005fwindow_005ftype"></a>
  69. <dl>
  70. <dt><a name="index-gdb_002eregister_005fwindow_005ftype-1"></a>Function: <strong>gdb.register_window_type</strong> <em>(<var>name</var>, <var>factory</var>)</em></dt>
  71. <dd><p>Because TUI windows are created and destroyed depending on the layout
  72. the user chooses, new window types are implemented by registering a
  73. factory function with <small>GDB</small>.
  74. </p>
  75. <p><var>name</var> is the name of the new window. It&rsquo;s an error to try to
  76. replace one of the built-in windows, but other window types can be
  77. replaced.
  78. </p>
  79. <p><var>function</var> is a factory function that is called to create the TUI
  80. window. This is called with a single argument of type
  81. <code>gdb.TuiWindow</code>, described below. It should return an object
  82. that implements the TUI window protocol, also described below.
  83. </p></dd></dl>
  84. <p>As mentioned above, when a factory function is called, it is passed a
  85. an object of type <code>gdb.TuiWindow</code>. This object has these
  86. methods and attributes:
  87. </p>
  88. <dl>
  89. <dt><a name="index-TuiWindow_002eis_005fvalid"></a>Function: <strong>TuiWindow.is_valid</strong> <em>()</em></dt>
  90. <dd><p>This method returns <code>True</code> when this window is valid. When the
  91. user changes the TUI layout, windows no longer visible in the new
  92. layout will be destroyed. At this point, the <code>gdb.TuiWindow</code>
  93. will no longer be valid, and methods (and attributes) other than
  94. <code>is_valid</code> will throw an exception.
  95. </p></dd></dl>
  96. <dl>
  97. <dt><a name="index-TuiWindow_002ewidth"></a>Variable: <strong>TuiWindow.width</strong></dt>
  98. <dd><p>This attribute holds the width of the window. It is not writable.
  99. </p></dd></dl>
  100. <dl>
  101. <dt><a name="index-TuiWindow_002eheight"></a>Variable: <strong>TuiWindow.height</strong></dt>
  102. <dd><p>This attribute holds the height of the window. It is not writable.
  103. </p></dd></dl>
  104. <dl>
  105. <dt><a name="index-TuiWindow_002etitle"></a>Variable: <strong>TuiWindow.title</strong></dt>
  106. <dd><p>This attribute holds the window&rsquo;s title, a string. This is normally
  107. displayed above the window. This attribute can be modified.
  108. </p></dd></dl>
  109. <dl>
  110. <dt><a name="index-TuiWindow_002eerase"></a>Function: <strong>TuiWindow.erase</strong> <em>()</em></dt>
  111. <dd><p>Remove all the contents of the window.
  112. </p></dd></dl>
  113. <dl>
  114. <dt><a name="index-TuiWindow_002ewrite"></a>Function: <strong>TuiWindow.write</strong> <em>(<var>string</var>)</em></dt>
  115. <dd><p>Write <var>string</var> to the window. <var>string</var> can contain ANSI
  116. terminal escape styling sequences; <small>GDB</small> will translate these
  117. as appropriate for the terminal.
  118. </p></dd></dl>
  119. <p>The factory function that you supply should return an object
  120. conforming to the TUI window protocol. These are the method that can
  121. be called on this object, which is referred to below as the &ldquo;window
  122. object&rdquo;. The methods documented below are optional; if the object
  123. does not implement one of these methods, <small>GDB</small> will not attempt
  124. to call it. Additional new methods may be added to the window
  125. protocol in the future. <small>GDB</small> guarantees that they will begin
  126. with a lower-case letter, so you can start implementation methods with
  127. upper-case letters or underscore to avoid any future conflicts.
  128. </p>
  129. <dl>
  130. <dt><a name="index-Window_002eclose"></a>Function: <strong>Window.close</strong> <em>()</em></dt>
  131. <dd><p>When the TUI window is closed, the <code>gdb.TuiWindow</code> object will be
  132. put into an invalid state. At this time, <small>GDB</small> will call
  133. <code>close</code> method on the window object.
  134. </p>
  135. <p>After this method is called, <small>GDB</small> will discard any references
  136. it holds on this window object, and will no longer call methods on
  137. this object.
  138. </p></dd></dl>
  139. <dl>
  140. <dt><a name="index-Window_002erender"></a>Function: <strong>Window.render</strong> <em>()</em></dt>
  141. <dd><p>In some situations, a TUI window can change size. For example, this
  142. can happen if the user resizes the terminal, or changes the layout.
  143. When this happens, <small>GDB</small> will call the <code>render</code> method on
  144. the window object.
  145. </p>
  146. <p>If your window is intended to update in response to changes in the
  147. inferior, you will probably also want to register event listeners and
  148. send output to the <code>gdb.TuiWindow</code>.
  149. </p></dd></dl>
  150. <dl>
  151. <dt><a name="index-Window_002ehscroll"></a>Function: <strong>Window.hscroll</strong> <em>(<var>num</var>)</em></dt>
  152. <dd><p>This is a request to scroll the window horizontally. <var>num</var> is the
  153. amount by which to scroll, with negative numbers meaning to scroll
  154. right. In the TUI model, it is the viewport that moves, not the
  155. contents. A positive argument should cause the viewport to move
  156. right, and so the content should appear to move to the left.
  157. </p></dd></dl>
  158. <dl>
  159. <dt><a name="index-Window_002evscroll"></a>Function: <strong>Window.vscroll</strong> <em>(<var>num</var>)</em></dt>
  160. <dd><p>This is a request to scroll the window vertically. <var>num</var> is the
  161. amount by which to scroll, with negative numbers meaning to scroll
  162. backward. In the TUI model, it is the viewport that moves, not the
  163. contents. A positive argument should cause the viewport to move down,
  164. and so the content should appear to move up.
  165. </p></dd></dl>
  166. <hr>
  167. <div class="header">
  168. <p>
  169. Previous: <a href="Registers-In-Python.html#Registers-In-Python" accesskey="p" rel="prev">Registers In Python</a>, Up: <a href="Python-API.html#Python-API" accesskey="u" rel="up">Python API</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  170. </div>
  171. </body>
  172. </html>