Back to index

system-config-printer  1.3.9+20120706
Functions | Variables
gtk_label_autowrap Namespace Reference

Functions

def set_autowrap
 set autowrapping for all labels in this widget tree
def label_size_allocate
 set wrap width to the pango.Layout of the labels ###

Variables

tuple window = gtk.Window(gtk.WINDOW_TOPLEVEL)
tuple label = gtk.Label("When you invoke GCC, it normally does preprocessing, compilation, assembly and linking.")
tuple hbox = gtk.HBox()

Function Documentation

def gtk_label_autowrap.label_size_allocate (   widget,
  allocation 
)

set wrap width to the pango.Layout of the labels ###

Definition at line 35 of file gtk_label_autowrap.py.

00035 
00036 def label_size_allocate(widget, allocation):
00037     layout = widget.get_layout()
00038 
00039     lw_old, lh_old = layout.get_pixel_size()
00040 
00041     # fixed width labels
00042     if lw_old == allocation.width:
00043         return
00044 
00045     layout.set_width(allocation.width * pango.SCALE)
00046     lw, lh = layout.get_pixel_size()
00047 
00048     if lh_old != lh:
00049         widget.set_size_request(-1, lh)

set autowrapping for all labels in this widget tree

Definition at line 24 of file gtk_label_autowrap.py.

00024 
00025 def set_autowrap(widget):
00026     if isinstance(widget, gtk.Container):
00027         children = widget.get_children()
00028         for i in xrange(len(children)):
00029             set_autowrap(children[i])
00030     elif isinstance(widget, gtk.Label) and widget.get_line_wrap():
00031         widget.connect_after("size-allocate", label_size_allocate)
00032         widget.set_property("xalign", 0)
00033         widget.set_property("yalign", 0)


Variable Documentation

tuple gtk_label_autowrap.hbox = gtk.HBox()

Definition at line 62 of file gtk_label_autowrap.py.

tuple gtk_label_autowrap.label = gtk.Label("When you invoke GCC, it normally does preprocessing, compilation, assembly and linking.")

Definition at line 56 of file gtk_label_autowrap.py.

tuple gtk_label_autowrap.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

Definition at line 53 of file gtk_label_autowrap.py.