def __init__(self, name, parent): # a mini DOM for accessing the SVG data self.__dom = None # the previous size of the widget; used to detect resizings self.__old_size = (0, 0) # the size of the image self.__image_size = (100, 100) DisplayTarget.__init__(self, name, parent) self.__widget = gtk.Image() self.__widget.show() # the "graphics" property is not readable because otherwise it could # be used to spy out files on the user's system after loading them into # "uri" self._register_property("graphics", TYPE_STRING, self._setp_graphics, None) self._register_property("dom", TYPE_OBJECT, None, self._getp_dom) self._register_property("uri", TYPE_STRING, self._setp_uri, self._getp) self._setp("graphics", "") # watch the element for geometry changes self.add_observer(self.__on_observe_size)
def delete(self): for c in self._get_children(): c.delete() self._unregister_child(c) del c self.__children = [] self.__children_id.clear() self.__ids.clear() DisplayTarget.delete(self)
def __init__(self, name, parent): # the control; you can load a control only once self.__control = None self.__widget = gtk.HBox() self.__widget.show() DisplayTarget.__init__(self, name, parent) self._register_property("oafiid", TYPE_STRING, self._setp_oafiid, self._getp)
def __init__(self, name, parent): # the list is necessary for preserving order self.__children = [] # mapping: id -> child self.__children_id = {} # mapping: child -> id self.__ids = {} # the relative-relations: id_of_relative -> [child] self.__relatives = {} DisplayTarget.__init__(self, name, parent)
def __init__(self, name, parent): self.__old_value = "" self.__font_description = None self.__wrap_at = -1 self.__alignment = pango.ALIGN_LEFT self.__justify = True self.__size = (0, 0) DisplayTarget.__init__(self, name, parent) self.__widget = Tiling() self.__pango_context = self.__widget.get_pango_context() self.__pango_context.set_base_dir(pango.DIRECTION_LTR) self.__pango_layout = pango.Layout(self.__pango_context) self.__color = (0, 0, 0, 255) self.__font_description = self.__pango_context.get_font_description() self.__widget.show() # i guess a label has to accept everything printable for its value # these days self._register_property("value", TYPE_ANY, self._setp_value, self._getp) self._register_property("color", TYPE_STRING, self._setp_color, self._getp) self._register_property("font", TYPE_STRING, self._setp_font, self._getp) self._register_property("wrap-at", TYPE_UNIT, self._setp_wrap_at, self._getp) self._register_property("alignment", TYPE_STRING, self._setp_alignment, self._getp) self._register_property("justify", TYPE_BOOL, self._setp_justify, self._getp) self._setp("value", "") self._setp("color", "black") self.set_prop("font", "Sans 8") self.set_prop("wrap-at", Unit.Unit(0, Unit.UNIT_PX)) self.set_prop("alignment", "left") self.set_prop("justify", True) # watch the widget for geometry changes; we need this for percentual # font sizes self.add_observer(self.__on_observe_size)
def __init__(self, name, parent): DisplayTarget.__init__(self, name, parent) self.__widget = gtk.Entry() self.__widget.show() self.__widget.connect("changed", self.__on_changed) self._register_property("value", TYPE_STRING, self._setp_value, self._getp) self._register_property("font", TYPE_STRING, self._setp_font, self._getp) self._register_property("color", TYPE_STRING, self._setp_color, self._getp) self._register_action(self.__ACTION_CHANGE) w, h = self.__widget.size_request() self.set_size(Unit.Unit(w, Unit.UNIT_PX), Unit.Unit(h, Unit.UNIT_PX))
def __init__(self, name, parent): self.__size = (0, 0) # the original image size self.__original_size = (0, 0) # the current saturation value self.__current_saturation = 0.0 # the current opacity value self.__current_opacity = 0.0 DisplayTarget.__init__(self, name, parent) self.__widget = Tiling() self.__widget.show() self._register_property("uri", TYPE_STRING, self._setp_uri, self._getp) self._register_property("saturation", TYPE_FLOAT, self._setp_saturation, self._getp) self._register_property("scale", TYPE_FLOAT, self._setp_scale, self._getp) self._register_property("opacity", TYPE_FLOAT, self._setp_opacity, self._getp) self._register_property("image-width", TYPE_UNIT, self._setp_image_size, self._getp_image_size) self._register_property("image-height", TYPE_UNIT, self._setp_image_size, self._getp_image_size) self._setp("image-width", Unit.Unit())#-1, Unit.UNIT_PX)) self._setp("image-height", Unit.Unit())#-1, Unit.UNIT_PX)) self._setp("opacity", 1.0) self._setp("saturation", 1.0) self._setp("scale", 1.0) # watch the parent for geometry changes self.add_observer(self.__on_observe_size)
def delete(self): DisplayTarget.delete(self)
def detect_leave(self, stamp): if (not self._is_active()): return DisplayTarget.detect_leave(self, stamp) for c in self.__children: c.detect_leave(stamp)
def delete(self): del self.__dom del self.__widget DisplayTarget.delete(self)