Example #1
0
    def render(field, window, widget, bounds, state):
        if len(field) == 3:
            proto, field, name = field

            if backend.get_keyflag_value(proto, field, name):
                sh = gtk.SHADOW_IN
            else:
                sh = gtk.SHADOW_OUT
        else:
            raise Exception

        size = 15

        if size > bounds.height:
            size = bounds.height
        if size > bounds.width:
            size = bounds.width

        # Paint a right aligned checkbox
        widget.style.paint_check(window, state, sh, bounds, widget,
                                 "checkbutton", bounds.x,
                                 bounds.y + (bounds.height - size) / 2,
                                 size, size)

        # Yes we handle the drawing
        return True
Example #2
0
 def get_value(self):
     if self.flag_name != None:
         return backend.get_keyflag_value(self.protocol, self.field,
                                          self.flag_name)
     else:
         return backend.get_field_value(self.protocol, self.field)