1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.richtext.RichTextFormattingDialog:
==========================================================================================================================================
|phoenix_title| **wx.richtext.RichTextFormattingDialog**
==========================================================================================================================================
This dialog allows the user to edit a character and/or paragraph style.
In the constructor, specify the pages that will be created. Use :meth:`wx.richtext.RichTextFormattingDialog.GetStyle` to retrieve the common style for a given range, and then use :meth:`wx.richtext.RichTextFormattingDialog.ApplyStyle` to apply the user-selected formatting to a control.
For example: ::
if self.richTextCtrl.HasSelection():
range = self.richTextCtrl.GetSelectionRange()
else:
range = wx.RichTextRange(0, self.richTextCtrl.GetLastPosition()+1)
pages = wx.richtext.RICHTEXT_FORMAT_FONT \
| wx.richtext.RICHTEXT_FORMAT_INDENTS_SPACING \
| wx.richtext.RICHTEXT_FORMAT_TABS \
| wx.richtext.RICHTEXT_FORMAT_BULLETS
with wx.richtext.RichTextFormattingDialog(pages, self) as dlg:
dlg.GetStyle(self.richTextCtrl, range)
if dlg.ShowModal() == wx.ID_OK:
dlg.ApplyStyle(self.richTextCtrl, range)
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>RichTextFormattingDialog</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.richtext.RichTextFormattingDialog_inheritance.png" alt="Inheritance diagram of RichTextFormattingDialog" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.adv.PropertySheetDialog.html" title="wx.adv.PropertySheetDialog" alt="" coords="32,469,231,499"/> <area shape="rect" id="node9" href="wx.richtext.RichTextFormattingDialog.html" title="wx.richtext.RichTextFormattingDialog" alt="" coords="5,547,259,576"/> <area shape="rect" id="node2" href="wx.Dialog.html" title="wx.Dialog" alt="" coords="91,392,172,421"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="24,5,125,35"/> <area shape="rect" id="node6" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="76,83,187,112"/> <area shape="rect" id="node4" href="wx.Object.html" title="wx.Object" alt="" coords="149,5,231,35"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="87,160,176,189"/> <area shape="rect" id="node8" href="wx.NonOwnedWindow.html" title="wx.NonOwnedWindow" alt="" coords="53,237,211,267"/> <area shape="rect" id="node7" href="wx.TopLevelWindow.html" title="wx.TopLevelWindow" alt="" coords="61,315,203,344"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextFormattingDialog.__init__` Default constructor.
:meth:`~wx.richtext.RichTextFormattingDialog.ApplyStyle` Apply attributes to the given range, only changing attributes that need to be changed.
:meth:`~wx.richtext.RichTextFormattingDialog.Create` Creation: see :ref:`wx.richtext.RichTextFormattingDialog` "the constructor" for details about the parameters.
:meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes` Gets the attributes being edited.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialog` Helper for pages to get the top-level dialog.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialogAttributes` Helper for pages to get the attributes.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialogStyleDefinition` Helper for pages to get the style.
:meth:`~wx.richtext.RichTextFormattingDialog.GetFormattingDialogFactory` Returns the object to be used to customize the dialog and provide pages.
:meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.
:meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` Gets the dialog options, determining what the interface presents to the user.
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyle` Gets common attributes from the given range and calls :meth:`~RichTextFormattingDialog.SetAttributes` .
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` Gets the associated style definition, if any.
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet` Gets the associated style sheet, if any.
:meth:`~wx.richtext.RichTextFormattingDialog.HasOption` Returns ``True`` if the given option is present.
:meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes` Sets the attributes to be edited.
:meth:`~wx.richtext.RichTextFormattingDialog.SetFormattingDialogFactory` Sets the formatting factory object to be used for customization and page creation.
:meth:`~wx.richtext.RichTextFormattingDialog.SetImageList` Sets the image list associated with the dialog's property sheet.
:meth:`~wx.richtext.RichTextFormattingDialog.SetOptions` Sets the dialog options, determining what the interface presents to the user.
:meth:`~wx.richtext.RichTextFormattingDialog.SetStyle` Sets the attributes and optionally updates the display, if `update` is ``True``.
:meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition` Sets the style definition and optionally update the display, if `update` is ``True``.
:meth:`~wx.richtext.RichTextFormattingDialog.UpdateDisplay` Updates the display.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextFormattingDialog.Attributes` See :meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes` and :meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes`
:attr:`~wx.richtext.RichTextFormattingDialog.ImageList` See :meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` and :meth:`~wx.richtext.RichTextFormattingDialog.SetImageList`
:attr:`~wx.richtext.RichTextFormattingDialog.Options` See :meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` and :meth:`~wx.richtext.RichTextFormattingDialog.SetOptions`
:attr:`~wx.richtext.RichTextFormattingDialog.StyleDefinition` See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` and :meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition`
:attr:`~wx.richtext.RichTextFormattingDialog.StyleSheet` See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.richtext.RichTextFormattingDialog(PropertySheetDialog)
**Possible constructors**::
RichTextFormattingDialog()
RichTextFormattingDialog(flags, parent, title="Formatting", id=ID_ANY,
pos=DefaultPosition, sz=DefaultSize, style=DEFAULT_DIALOG_STYLE)
This dialog allows the user to edit a character and/or paragraph
style.
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self)`
Default constructor.
**~~~**
**__init__** `(self, flags, parent, title="Formatting", id=ID_ANY, pos=DefaultPosition, sz=DefaultSize, style=DEFAULT_DIALOG_STYLE)`
Constructors.
:param `flags`: The pages to show.
:type `flags`: long
:param `parent`: The dialog's parent.
:type `parent`: wx.Window
:param `title`: The dialog's title.
:type `title`: string
:param `id`: The dialog's ``ID``.
:type `id`: wx.WindowID
:param `pos`: The dialog's position.
:type `pos`: wx.Point
:param `sz`: The dialog's size.
:type `sz`: wx.Size
:param `style`: The dialog's window style.
:type `style`: long
**~~~**
.. method:: ApplyStyle(self, ctrl, range, flags=RICHTEXT_SETSTYLE_WITH_UNDO|RICHTEXT_SETSTYLE_OPTIMIZE)
Apply attributes to the given range, only changing attributes that need to be changed.
:param `ctrl`:
:type `ctrl`: wx.richtext.RichTextCtrl
:param `range`:
:type `range`: wx.richtext.RichTextRange
:param `flags`:
:type `flags`: int
:rtype: `bool`
.. method:: Create(self, flags, parent, title=GetTranslation("Formatting"), id=ID_ANY, pos=DefaultPosition, sz=DefaultSize, style=DEFAULT_DIALOG_STYLE)
Creation: see :ref:`wx.richtext.RichTextFormattingDialog` "the constructor" for details about the parameters.
:param `flags`:
:type `flags`: long
:param `parent`:
:type `parent`: wx.Window
:param `title`:
:type `title`: string
:param `id`:
:type `id`: wx.WindowID
:param `pos`:
:type `pos`: wx.Point
:param `sz`:
:type `sz`: wx.Size
:param `style`:
:type `style`: long
:rtype: `bool`
.. method:: GetAttributes(self)
Gets the attributes being edited.
:rtype: :ref:`TextAttr`
.. staticmethod:: GetDialog(win)
Helper for pages to get the top-level dialog.
:param `win`:
:type `win`: wx.Window
:rtype: :ref:`wx.richtext.RichTextFormattingDialog`
.. staticmethod:: GetDialogAttributes(win)
Helper for pages to get the attributes.
:param `win`:
:type `win`: wx.Window
:rtype: :ref:`TextAttr`
.. staticmethod:: GetDialogStyleDefinition(win)
Helper for pages to get the style.
:param `win`:
:type `win`: wx.Window
:rtype: :ref:`wx.richtext.RichTextStyleDefinition`
.. staticmethod:: GetFormattingDialogFactory()
Returns the object to be used to customize the dialog and provide pages.
:rtype: :ref:`wx.richtext.RichTextFormattingDialogFactory`
.. method:: GetImageList(self)
Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.
:rtype: :ref:`ImageList`
.. method:: GetOptions(self)
Gets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
:rtype: `int`
.. method:: GetStyle(self, ctrl, range)
Gets common attributes from the given range and calls :meth:`SetAttributes` .
Attributes that do not have common values in the given range will be omitted from the style's flags.
:param `ctrl`:
:type `ctrl`: wx.richtext.RichTextCtrl
:param `range`:
:type `range`: wx.richtext.RichTextRange
:rtype: `bool`
.. method:: GetStyleDefinition(self)
Gets the associated style definition, if any.
:rtype: :ref:`wx.richtext.RichTextStyleDefinition`
.. method:: GetStyleSheet(self)
Gets the associated style sheet, if any.
:rtype: :ref:`wx.richtext.RichTextStyleSheet`
.. method:: HasOption(self, option)
Returns ``True`` if the given option is present.
:param `option`:
:type `option`: int
:rtype: `bool`
.. method:: SetAttributes(self, attr)
Sets the attributes to be edited.
:param `attr`:
:type `attr`: wx.TextAttr
.. staticmethod:: SetFormattingDialogFactory(factory)
Sets the formatting factory object to be used for customization and page creation.
It deletes the existing factory object.
:param `factory`:
:type `factory`: wx.richtext.RichTextFormattingDialogFactory
.. method:: SetImageList(self, imageList)
Sets the image list associated with the dialog's property sheet.
:param `imageList`:
:type `imageList`: wx.ImageList
.. method:: SetOptions(self, options)
Sets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
:param `options`:
:type `options`: int
.. method:: SetStyle(self, style, update=True)
Sets the attributes and optionally updates the display, if `update` is ``True``.
:param `style`:
:type `style`: wx.TextAttr
:param `update`:
:type `update`: bool
:rtype: `bool`
.. method:: SetStyleDefinition(self, styleDef, sheet, update=True)
Sets the style definition and optionally update the display, if `update` is ``True``.
:param `styleDef`:
:type `styleDef`: wx.richtext.RichTextStyleDefinition
:param `sheet`:
:type `sheet`: wx.richtext.RichTextStyleSheet
:param `update`:
:type `update`: bool
:rtype: `bool`
.. method:: UpdateDisplay(self)
Updates the display.
:rtype: `bool`
.. attribute:: Attributes
See :meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes` and :meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes`
.. attribute:: ImageList
See :meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` and :meth:`~wx.richtext.RichTextFormattingDialog.SetImageList`
.. attribute:: Options
See :meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` and :meth:`~wx.richtext.RichTextFormattingDialog.SetOptions`
.. attribute:: StyleDefinition
See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` and :meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition`
.. attribute:: StyleSheet
See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet`
|