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 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gobject">
<refmeta>
<refentrytitle>gobject.GObject</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>PyGTK Docs</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gobject.GObject</refname>
<refpurpose>the base class</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gobject.GObject</classname></ooclass>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--get-property">get_property</link></methodname>
<methodparam><parameter>property_name</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--get-properties">get_properties</link></methodname>
<methodparam><parameter>first_property_name</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--set-property">set_property</link></methodname>
<methodparam><parameter>property_name</parameter></methodparam>
<methodparam><parameter>value</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--set-properties">set_properties</link></methodname>
<methodparam><parameter>property_name</parameter>
<initializer>value</initializer></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--freeze-notify">freeze_notify</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--notify">notify</link></methodname>
<methodparam><parameter>property_name</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--thaw-notify">thaw_notify</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--get-data">get_data</link></methodname>
<methodparam><parameter>key</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--set-data">set_data</link></methodname>
<methodparam><parameter>key</parameter></methodparam>
<methodparam><parameter>data</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--connect">connect</link></methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--connect-after">connect_after</link></methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--connect-object">connect_object</link></methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--connect-object-after">connect_object_after</link></methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--disconnect">disconnect</link></methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--handler-disconnect">handler_disconnect</link></methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--handler-is-connected">handler_is_connected</link></methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--handler-block">handler_block</link></methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--handler-unblock">handler_unblock</link></methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--handler-block-by-func">handler_block_by_func</link></methodname>
<methodparam><parameter>callable</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--handler-unblock-by-func">handler_unblock_by_func</link></methodname>
<methodparam><parameter>callable</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--emit">emit</link></methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--stop-emission">stop_emission</link></methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--emit-stop-by-name">emit_stop_by_name</link></methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gobject--chain">chain</link></methodname>
<methodparam></methodparam> </methodsynopsis>
</classsynopsis>
</refsect1>
<refsect1>
<title>Ancestry</title>
<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
</synopsis>
</refsect1>
<refsect1>
<title>Attributes</title>
<blockquote role="properties">
<informaltable pgwide="1" frame="none">
<tgroup cols="3">
<?dbhtml cellpadding="5"?>
<colspec column="1" colwidth="1in"/>
<colspec column="2" colwidth="1in"/>
<colspec column="3" colwidth="4in"/>
<tbody>
<row valign="top">
<entry>"props"</entry>
<entry>Read/Write</entry>
<entry>
<para>This attribute gives full access to GObject properties as
simple attributes. It can be used to iterate over all the object
properties, and can be used both on class or instance objects.</para>
<para>Examples:</para>
<programlisting>
button = Button()
button_label = button.props.label
button.props.label = 'Click on this fancy button'
for pspec in button.props:
print pspec
print button.get_property(pspec.name)
label_pspec = Button.props.label
button_label = button.get_property(label_pspec.name)
</programlisting>
</entry>
</row>
<row valign="top">
<entry>"__doc__"</entry>
<entry>Read</entry>
<entry>The documentation for the object type. Uses
"__gdoc__" if no specific documentation set.</entry>
</row>
<row valign="top">
<entry>"__gdoc__"</entry>
<entry>Read</entry>
<entry>The generated documentation for the underlying GObject
type.</entry>
</row>
<row valign="top">
<entry>"__gtype__"</entry>
<entry>Read</entry>
<entry>The underlying GObject type.</entry>
</row>
<row valign="top">
<entry>"__grefcount__"</entry>
<entry>Read</entry>
<entry>The reference count for the underlying GObject.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</blockquote>
</refsect1>
<refsect1 id="signal-prototypes-gobject">
<title>gobject.GObject Signal Prototypes</title>
<variablelist>
<varlistentry>
<term>"<link linkend="signal-gobject--notify">notify</link>"</term>
<listitem>
<methodsynopsis language="python"><methodname>callback</methodname>
<methodparam><parameter>gobject</parameter></methodparam>
<methodparam><parameter>property_spec</parameter></methodparam>
<methodparam><parameter>user_param1</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>The <link
linkend="class-gobject"><classname>gobject.GObject</classname></link>
class is the base class providing the common attributes and methods for
the PyGTK classes. The <link
linkend="class-gobject"><classname>gobject.GObject</classname></link>
class is not a user interface widget class.</para>
<para>The <link
linkend="class-gobject"><classname>gobject.GObject</classname></link>
class provides the signal management methods, the object property access
methods and the object data management methods.</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gobject--get-property">
<title>gobject.GObject.get_property</title>
<programlisting><methodsynopsis language="python">
<methodname>get_property</methodname>
<methodparam><parameter>property_name</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>property_name</parameter> :</term>
<listitem><simpara>a string containing the property name for the
GObject</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a Python object containing the value of the
property</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_property</methodname>() method returns the
value of the property specified by <parameter>property_name</parameter> or
None if there is no value associated with the property.</para>
<para>The <exceptionname>TypeError</exceptionname> exception is raised
if the property name is not registered with the object class.</para>
</refsect2>
<refsect2 id="method-gobject--get-properties">
<title>gobject.GObject.get_properties</title>
<programlisting><methodsynopsis language="python">
<methodname>get_properties</methodname>
<methodparam><parameter>first_property_name</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>first_property_name</parameter> :</term>
<listitem><simpara>a string containing the first property name for the
GObject</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional property names
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a tuple containing the property values
requested</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_properties</methodname>() method returns a tuple containing
the values of the properties requested, or
None if there is no value associated with the property.</para>
<para>The <exceptionname>TypeError</exceptionname> exception is raised
if the property name is not registered with the object class.</para>
</refsect2>
<refsect2 id="method-gobject--set-property">
<title>gobject.GObject.set_property</title>
<programlisting><methodsynopsis language="python">
<methodname>set_property</methodname>
<methodparam><parameter>property_name</parameter></methodparam>
<methodparam><parameter>value</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>property_name</parameter> :</term>
<listitem><simpara>a string containing the property
name</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter> :</term>
<listitem><simpara>a Python object containing the property value
to be set</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>set_property</methodname>() method sets the
property specified by <parameter>property_name</parameter> to the specified
<parameter>value</parameter>.</para>
<para>The <exceptionname>TypeError</exceptionname> exception is raised
if the property name is not registered with the object class or if the value
specified could not be converted to the property type.</para>
</refsect2>
<refsect2 id="method-gobject--set-properties">
<title>gobject.GObject.set_properties</title>
<programlisting><methodsynopsis language="python">
<methodname>set_properties</methodname>
<methodparam><parameter>property_name</parameter>
<initializer>value</initializer></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>property_name</parameter> :</term>
<listitem><simpara>the property name</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter> :</term>
<listitem><simpara>a Python object containing the property value
to be set</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional property name and value
kwargs</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>set_properties</methodname>() method sets the
property specified by <parameter>property_name</parameter> to the specified
<parameter>value</parameter>, followed by pairs of property name
and value as keyword arguments.</para>
<para>The <exceptionname>TypeError</exceptionname> exception is raised
if the property name is not registered with the object class or if the value
specified could not be converted to the property type.</para>
</refsect2>
<refsect2 id="method-gobject--freeze-notify">
<title>gobject.GObject.freeze_notify</title>
<programlisting><methodsynopsis language="python">
<methodname>freeze_notify</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<para>The <methodname>freeze_notify</methodname>() method freezes the
object's property-changed notification queue so that "notify" signals are
blocked until the <methodname>thaw_notify</methodname>() method is
called.</para>
</refsect2>
<refsect2 id="method-gobject--notify">
<title>gobject.GObject.notify</title>
<programlisting><methodsynopsis language="python">
<methodname>notify</methodname>
<methodparam><parameter>property_name</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>property_name</parameter> :</term>
<listitem><simpara>a string containing a property
name</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>notify</methodname>() method causes the "notify"
signal for the property specified by <parameter>property_name</parameter> to
be emitted.</para>
</refsect2>
<refsect2 id="method-gobject--thaw-notify">
<title>gobject.GObject.thaw_notify</title>
<programlisting><methodsynopsis language="python">
<methodname>thaw_notify</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<para>The <methodname>thaw_notify</methodname>() method thaws the
object's property-changed notification queue so that "notify" signals are
emitted.</para>
</refsect2>
<refsect2 id="method-gobject--get-data">
<title>gobject.GObject.get_data</title>
<programlisting><methodsynopsis language="python">
<methodname>get_data</methodname>
<methodparam><parameter>key</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>key</parameter> :</term>
<listitem><simpara>a string used as the key</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a Python object containing the associated
data</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_data</methodname>() method returns the
Python object associated with the specified <parameter>key</parameter> or
None if there is no data associated with the <parameter>key</parameter> or
if there is no key associated with the object.</para>
</refsect2>
<refsect2 id="method-gobject--set-data">
<title>gobject.GObject.set_data</title>
<programlisting><methodsynopsis language="python">
<methodname>set_data</methodname>
<methodparam><parameter>key</parameter></methodparam>
<methodparam><parameter>data</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>key</parameter> :</term>
<listitem><simpara>a string used as a key</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter> :</term>
<listitem><simpara>a Python object that is the value to be
associated with the key</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>set_data</methodname>() method associates the
specified Python object (<parameter>data</parameter>) with
<parameter>key</parameter>.</para>
</refsect2>
<refsect2 id="method-gobject--connect">
<title>gobject.GObject.connect</title>
<programlisting><methodsynopsis language="python">
<methodname>connect</methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>detailed_signal</parameter> :</term>
<listitem><simpara>a string containing the signal
name</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>handler</parameter> :</term>
<listitem><simpara>a Python function or method
object.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional optional
parameters</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>an integer identifier</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>connect</methodname>() method adds a function or
method (<parameter>handler</parameter>)to the end of the list of signal
handlers for the named <parameter>detailed_signal</parameter> but before the
default class signal handler. An optional set of parameters may be specified
after the <parameter>handler</parameter> parameter. These will all be passed
to the signal handler when invoked.</para>
<para>For example if a function handler was connected to a signal
using:</para>
<programlisting>
handler_id = object.connect("signal_name", handler, arg1, arg2, arg3)
</programlisting>
<para>The handler should be defined as:</para>
<programlisting>
def handler(object, arg1, arg2, arg3):
</programlisting>
<para>A method handler connected to a signal using:</para>
<programlisting>
handler_id = object.connect("signal_name", self.handler, arg1, arg2)
</programlisting>
<para>requires an additional argument when defined:</para>
<programlisting>
def handler(self, object, arg1, arg2)
</programlisting>
<para>A <exceptionname>TypeError</exceptionname> exception is raised
if <parameter>detailed_signal</parameter> identifies a signal name that is
not associated with the object.</para>
</refsect2>
<refsect2 id="method-gobject--connect-after">
<title>gobject.GObject.connect_after</title>
<programlisting><methodsynopsis language="python">
<methodname>connect_after</methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>detailed_signal</parameter> :</term>
<listitem><simpara>a string containing the signal
name</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>handler</parameter> :</term>
<listitem><simpara>a Python function or method
object</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional optional
parameters</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>connect_after</methodname>() method is similar
to the <methodname>connect</methodname>() method except that the
<parameter>handler</parameter> is added to the signal handler list after the
default class signal handler. Otherwise the details of
<parameter>handler</parameter> definition and invocation are the
same.</para>
</refsect2>
<refsect2 id="method-gobject--connect-object">
<title>gobject.GObject.connect_object</title>
<programlisting><methodsynopsis language="python">
<methodname>connect_object</methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
<methodparam><parameter>gobject</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>detailed_signal</parameter> :</term>
<listitem><simpara>a string containing the signal
name</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>handler</parameter> :</term>
<listitem><simpara>a Python function or method
object</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>gobject</parameter> :</term>
<listitem><simpara>a GObject</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>connect_object</methodname>() method is the same
as the <methodname>connect</methodname>() method except that the
<parameter>handler</parameter> is invoked with the specified
<parameter>gobject</parameter> in place of the object invoking the
<methodname>connect_object</methodname>() method. For example, a call with a
function handler:</para>
<programlisting>
handler_id = object("signal_name", handler, gobject)
</programlisting>
<para>will cause the <parameter>handler</parameter> to be invoked
as:</para>
<programlisting>
handler(gobject)
</programlisting>
<para>Likewise a method handler will be invoked as:</para>
<programlisting>
self.handler(gobject)
</programlisting>
<para>This can be helpful in invoking PyGTK widget methods that
require no arguments except the widget itself (e.g.
<methodname>widget.destroy</methodname>()) by using the class method as the
handler. For example, a Button "clicked" signal can be set up to invoke the
Window <methodname>destroy</methodname>() method as:</para>
<programlisting>
handler_id = button.connect_object("clicked", Window.destroy, window)
</programlisting>
<para>When the button is clicked the handler is invoked as:</para>
<programlisting>
Window.destroy(window)
</programlisting>
<para>which is the same as:</para>
<programlisting>
window.destroy()
</programlisting>
<para>Additional arguments may be passed to the handler as with the
<methodname>connect</methodname>() method handler invocations.</para>
</refsect2>
<refsect2 id="method-gobject--connect-object-after">
<title>gobject.GObject.connect_object_after</title>
<programlisting><methodsynopsis language="python">
<methodname>connect_object_after</methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>handler</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>detailed_signal</parameter> :</term>
<listitem><simpara>a string containing the signal
name</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>handler</parameter> :</term>
<listitem><simpara>a Python function or method
object</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>gobject</parameter> :</term>
<listitem><simpara>a GObject</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>connect_object_after</methodname>() method is
similar to the <methodname>connect_object</methodname>() method except that
the <parameter>handler</parameter> is added to the signal handler list after
the default class signal handler. Otherwise the details of
<parameter>handler</parameter> definition and invocation are the
same.</para>
</refsect2>
<refsect2 id="method-gobject--disconnect">
<title>gobject.GObject.disconnect</title>
<programlisting><methodsynopsis language="python">
<methodname>disconnect</methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>handler_id</parameter> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>disconnect</methodname>() method removes the
signal handler with the specified <parameter>handler_id</parameter> from the
list of signal handlers for the object.</para>
</refsect2>
<refsect2 id="method-gobject--handler-disconnect">
<title>gobject.GObject.handler_disconnect</title>
<programlisting><methodsynopsis language="python">
<methodname>handler_disconnect</methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>handler_id</parameter> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>handler_disconnect</methodname>() method removes
the signal handler with the specified <parameter>handler_id</parameter> from
the list of signal handlers for the object.</para>
</refsect2>
<refsect2 id="method-gobject--handler-is-connected">
<title>gobject.GObject.handler_is_connected</title>
<programlisting><methodsynopsis language="python">
<methodname>handler_is_connected</methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>handler_id</parameter> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara><literal>True</literal> if the signal handler
is connected to the object.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>handler_is_connected</methodname>() method
returns <literal>True</literal> if the signal handler with the specified
<parameter>handler_id</parameter> is connected to the object.</para>
</refsect2>
<refsect2 id="method-gobject--handler-block">
<title>gobject.GObject.handler_block</title>
<programlisting><methodsynopsis language="python">
<methodname>handler_block</methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>handler_id</parameter> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>handler_block</methodname>() method blocks the
signal handler with the specified <parameter>handler_id</parameter> from
being invoked until it is unblocked.</para>
</refsect2>
<refsect2 id="method-gobject--handler-unblock">
<title>gobject.GObject.handler_unblock</title>
<programlisting><methodsynopsis language="python">
<methodname>handler_unblock</methodname>
<methodparam><parameter>handler_id</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>handler_id</parameter> :</term>
<listitem><simpara>an integer handler
identifier</simpara></listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id="method-gobject--handler-block-by-func">
<title>gobject.GObject.handler_block_by_func</title>
<programlisting><methodsynopsis language="python">
<methodname>handler_block_by_func</methodname>
<methodparam><parameter>callable</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>callable</parameter> :</term>
<listitem><simpara>a callable python object</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>handler_block_by_func</methodname>() method blocks the
all signal handler connected to a specific <parameter>callable</parameter> from
being invoked until the callable is unblocked.</para>
</refsect2>
<refsect2 id="method-gobject--handler-unblock-by-func">
<title>gobject.GObject.handler_unblock_by_func</title>
<programlisting><methodsynopsis language="python">
<methodname>handler_unblock_by_func</methodname>
<methodparam><parameter>callback</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>callable</parameter> :</term>
<listitem><simpara>a callable python object</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>handler_unblock_by_func</methodname>() method unblocks
all signal handler connected to a specified <parameter>callable</parameter>
thereby allowing it to be invoked when the associated signals are
emitted.</para>
</refsect2>
<refsect2 id="method-gobject--emit">
<title>gobject.GObject.emit</title>
<programlisting><methodsynopsis language="python">
<methodname>emit</methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>detailed_signal</parameter> :</term>
<listitem><simpara>a string containing the signal
name</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional parameters</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a PyObject*</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>emit</methodname>() method causes the object to
emit the signal specified by <parameter>detailed_signal</parameter>. The
additional parameters must match the number and type of the required signal
handler parameters. In most cases no additional parameters are needed. for
example:</para>
<programlisting>
button.emit("clicked")
</programlisting>
<para>is all that is required to emit the "clicked" signal for a
button. The most common case requiring additional parameters occurs when
emitting an event signal; for example:</para>
<programlisting>
button.emit("button_press_event", event)
</programlisting>
</refsect2>
<refsect2 id="method-gobject--stop-emission">
<title>gobject.GObject.stop_emission</title>
<programlisting><methodsynopsis language="python">
<methodname>stop_emission</methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>detailed_signal</parameter> :</term>
<listitem><simpara>a string containing the signal
name</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>stop_emission</methodname>() method stops the
current emission of the signal specified by
<parameter>detailed_signal</parameter>. Any signal handlers in the list
still to be run will not be invoked.</para>
</refsect2>
<refsect2 id="method-gobject--emit-stop-by-name">
<title>gobject.GObject.emit_stop_by_name</title>
<programlisting><methodsynopsis language="python">
<methodname>emit_stop_by_name</methodname>
<methodparam><parameter>detailed_signal</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>detailed_signal</parameter> :</term>
<listitem><simpara>a string containing the signal
name</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>emit_stop_by_name</methodname>() method stops
the current emission of the signal specified by
<parameter>detailed_signal</parameter>. Any signal handlers in the list
still to be run will not be invoked.</para>
</refsect2>
<refsect2 id="method-gobject--chain">
<title>gobject.GObject.chain</title>
<programlisting><methodsynopsis language="python">
<methodname>chain</methodname>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional parameters</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a Python object</simpara></listitem>
</varlistentry>
</variablelist>
<para>The chain() method does something.</para>
</refsect2>
</refsect1>
<refsect1>
<title>Signals</title>
<refsect2 id="signal-gobject--notify">
<title>The GObject "notify" Signal</title>
<programlisting><methodsynopsis language="python">
<methodname>callback</methodname>
<methodparam><parameter>gobject</parameter></methodparam>
<methodparam><parameter>property_spec</parameter></methodparam>
<methodparam><parameter>user_param1</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>gobject</parameter> :</term>
<listitem><simpara>the gobject that received the
signal</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>property_spec</parameter> :</term>
<listitem><simpara>the <link linkend="class-gobjectgparamspec"><classname>gobject.GParamSpec</classname></link> of the property that was
changed</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>user_param1</parameter> :</term>
<listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional user parameters (if
any)</simpara></listitem>
</varlistentry>
</variablelist>
<para>The "notify" signal is emitted on a gobject when one of its
properties has been changed. Note that getting this signal doesn't guarantee
that the value of the property has actually changed, it may also be emitted
when the setter for the property is called to reinstate the previous
value. For example to be notified of the change of the title of a <link
linkend="class-gtkwindow"><classname>gtk.Window</classname></link> you could
connect to the "notify" signal similar to:</para>
<programlisting>
window.connect("notify::title", callback)
</programlisting>
</refsect2>
</refsect1>
</refentry>
|