def __init__(self, text=None, menu=None): """ Create a new hyperlink. @param text: The text of the hyperlink. @type text: str """ gtk.EventBox.__init__(self) PropertyObject.__init__(self) self._gproperties = {} if text is not None: self.set_property('text', text) self._is_active = False self._is_hover = False self._menu = menu self._label = gtk.Label() self.add(self._label) self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) self.connect('button-press-event', self._on_button_press_event) self.connect('button-release-event', self._on_button_release_event) self.connect('enter-notify-event', self._on_hover_changed, True) self.connect('leave-notify-event', self._on_hover_changed, False) self.connect('map-event', self._on_map_event) self.connect('notify', self._on_notify) self.set_text(text)
def __init__(self, **kwargs): deprecationwarn( 'ProxyComboBoxEntry is deprecated, use ProxyComboEntry instead', stacklevel=3) BaseComboBoxEntry.__init__(self) ValidatableProxyWidgetMixin.__init__(self, widget=self.entry) # We need to create the helper before PropertyObject, since we # need to access the helper in prop_set_list_editable, which # PropertyObject might call self._helper = _EasyComboBoxHelper(self) PropertyObject.__init__(self, **kwargs) self.set_text_column(ComboColumn.LABEL) # here we connect the expose-event signal directly to the entry self.child.connect('changed', self._on_child_entry__changed) # HACK! we force a queue_draw because when the window is first # displayed the icon is not drawn. gobject.idle_add(self.queue_draw) self.set_events(gtk.gdk.KEY_RELEASE_MASK) self.connect("key-release-event", self._on__key_release_event)
def __init__(self, text=None, menu=None): """ Create a new hyperlink. @param text: The text of the hyperlink. @type text: str """ gtk.EventBox.__init__(self) self.set_above_child(False) self.set_visible_window(False) PropertyObject.__init__(self) self._gproperties = {} if text is not None: self.set_property('text', text) self._is_active = False self._is_hover = False self._menu = menu self._label = gtk.Label() self.add(self._label) self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) self.connect('button-press-event', self._on_button_press_event) self.connect('button-release-event', self._on_button_release_event) self.connect('enter-notify-event', self._on_hover_changed, True) self.connect('leave-notify-event', self._on_hover_changed, False) self.connect('map-event', self._on_map_event) self.connect('notify', self._on_notify) self.set_text(text)
def __init__(self, data_type=int): # since the default data_type is str we need to set it to int # or float for spinbuttons gtk.SpinButton.__init__(self) PropertyObject.__init__(self, data_type=data_type) ValidatableProxyWidgetMixin.__init__(self) self._icon = IconEntry(self) self.set_property('xalign', 1.0)
def __init__(self): gtk.ComboBox.__init__(self) ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self) self._helper = _EasyComboBoxHelper(self) self.connect('changed', self._on__changed) renderer = gtk.CellRendererText() self.pack_start(renderer) self.add_attribute(renderer, 'text', ComboColumn.LABEL)
def __init__(self, action=gtk.FILE_CHOOSER_ACTION_OPEN, backend=None): """ Create a new ProxyFileChooserWidget object. @param action: @param backend: """ ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self, data_type=str) gtk.FileChooserWidget.__init__(self, action=action, backend=backend)
def __init__(self): self._is_unset = True gtk.TextView.__init__(self) PropertyObject.__init__(self, data_type=str) ValidatableProxyWidgetMixin.__init__(self) self._textbuffer = gtk.TextBuffer() self._textbuffer.connect('changed', self._on_textbuffer__changed) self.set_buffer(self._textbuffer)
def __init__(self, name=None, **kwargs): gtk.DrawingArea.__init__(self) PropertyObject.__init__(self, **kwargs) self.connect('notify::string1', lambda self, *a: self.queue_draw()) if name: self.set_name(name) self._layout = self.create_pango_layout("") self._layout.set_font_description( pango.FontDescription("sans serif 12")) self._pixmap = None self.set_flags(self.flags() | gtk.CAN_FOCUS)
def __init__(self, title=None, backend=None, dialog=None): """ Create a new ProxyFileChooserButton object. @param title: @param backend: @param dialog: """ ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self, data_type=str) # Broken, Broken PyGTK if isinstance(title, str): gtk.FileChooserButton.__init__(self, title, backend) else: gtk.FileChooserButton.__init__(self, dialog or title)
def __init__(self): self._completion = None gtk.Entry.__init__(self) PropertyObject.__init__(self) self.connect('insert-text', self._on_insert_text) self.connect('delete-text', self._on_delete_text) self.connect_after('grab-focus', self._after_grab_focus) self.connect('changed', self._on_changed) self.connect('focus', self._on_focus) self.connect('focus-out-event', self._on_focus_out_event) self.connect('move-cursor', self._on_move_cursor) # Ideally, this should be connected to notify::cursor-position, but # there seems to be a bug in gtk that the notification is not emited # when it should. # TODO: investigate that and report a bug. self.connect('notify::selection-bound', self._on_notify_selection_bound) self._block_changed = False self._current_object = None self._mode = ENTRY_MODE_TEXT self._icon = IconEntry(self) # List of validators # str -> static characters # int -> dynamic, according to constants above self._mask_validators = [] self._mask = None # Fields defined by mask # each item is a tuble, containing the begining and the end of the # field in the text self._mask_fields = [] self._current_field = -1 self._pos = 0 self._selecting = False self._block_insert = False self._block_delete = False
def __init__(self): DateEntry.__init__(self) ValidatableProxyWidgetMixin.__init__(self) PropertyObject.__init__(self) # Add some space to the entry, so it has rom for the icon, in case # of a validation error. # # Since we set the widget's width based on the number of characters, # get the width of a single char, so we can calculate how many # 'chars' the icon takes. layout = self.entry.get_layout() context = layout.get_context() metrics = context.get_metrics(context.get_font_description()) char_width = metrics.get_approximate_char_width() / pango.SCALE current_width = self.entry.get_width_chars() # We add 4 pixels to the width, because of the icon borders icon_width = VALIDATION_ICON_WIDTH + 4 self.entry.set_width_chars(current_width + int(icon_width / char_width))
def __init__(self, label='', data_type=None): """ Create a new ProxyLabel object. @param label: initial text @param data_type: data type of label """ gtk.Label.__init__(self, label) PropertyObject.__init__(self, data_type=data_type) ProxyWidgetMixin.__init__(self) self.set_use_markup(True) self._attr_dic = { "style": None, "weight": None, "size": None, "underline": None} self._size_list = ('xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large') self.connect("notify::label", self._on_label_changed) self._block_notify_label = False
def __init__(self, **kwargs): gobject.GObject.__init__(self) PropertyObject.__init__(self, **kwargs)
def __init__(self): entry = ProxyEntry() ComboEntry.__init__(self, entry=entry) ValidatableProxyWidgetMixin.__init__(self) PropertyObject.__init__(self) entry.connect('content-changed', self._on_entry__content_changed)
def __init__(self, color=gtk.gdk.Color(0, 0, 0)): ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self, data_type=str) gtk.ColorButton.__init__(self, color)
def __init__(self, fontname=None): ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self, data_type=str) gtk.FontButton.__init__(self, fontname)
def __init__(self): ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self, data_type=str) gtk.Button.__init__(self)
def __init__(self, label=None, use_underline=True): ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self, data_type=bool) gtk.CheckButton.__init__(self, label=label, use_underline=use_underline)
def __init__(self): ProxyWidgetMixin.__init__(self) PropertyObject.__init__(self, data_type=float) gtk.VScale.__init__(self)