478
479
480
481
482
483
484
485
486
487
488
489
490
491 | def hbox(w1, w2, exr=True):
b = gtk.HBox(homogeneous=False, spacing=5)
######b.set_property("visible", True)
b.pack_start(w1, expand=not exr, fill=not exr)
b.pack_start(w2, expand=exr, fill=exr)
return b
# Attach textual menu entry and callback
@staticmethod
def add_menu(menuwidget, label, action, insert=None):
for where in list(menuwidget):
m = gtk.MenuItem(label)
m.connect("activate", action) |
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
| 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 | def hbox(w1, w2, exr=True):
b = gtk.HBox(homogeneous=False, spacing=5)
######b.set_property("visible", True)
b.pack_start(w1, expand=not exr, fill=not exr)
b.pack_start(w2, expand=exr, fill=exr)
return b
# Wrap entries/checkboxes with extra label, background, images, etc.
@staticmethod
def wrap(widgetstore=None, id=None, w=None, label=None, color=None, image=None, align=1, label_size=305, label_markup=0):
if id:
widgetstore[id] = w
if label:
if type(w) is gtk.Entry:
w.set_width_chars(11)
w = uikit.hbox(w, uikit.label(label, size=label_size, markup=label_markup))
if image:
pix = gtk.image_new_from_pixbuf(uikit.pixbuf(image))
if pix:
w = uikit.hbox(w, pix, exr=False)
if color:
w = uikit.bg(w, color)
if align:
a = gtk.Alignment()
a.set_padding(0, 0, align, 0)
a.add(w)
w = a
w.show_all()
return w
# Attach textual menu entry and callback
@staticmethod
def add_menu(menuwidget, label, action, insert=None):
for where in list(menuwidget):
m = gtk.MenuItem(label)
m.connect("activate", action) |