Exemple #1
0
 def _connect_hotspot_signals(self):
     self._hotspot_callback_handles = []
     self._hotspot_callback_handles.append(weak_connect(self.model._model,
         'row-inserted', self.on_row_inserted))
     self._hotspot_callback_handles.append(weak_connect(self.model._model,
         'row-deleted', self.on_row_deleted))
     self._hotspot_callback_handles.append(weak_connect(self.model._model,
         'row-changed', self.on_row_changed))
Exemple #2
0
 def __init__(self, title, renderer, **attrs):
     signals.SignalEmitter.__init__(self)
     self.create_signal('clicked')
     self._column = gtk.TreeViewColumn(title, renderer._renderer)
     self._column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
     self._column.set_clickable(True)
     self.attrs = attrs
     renderer.setup_attributes(self._column, attrs)
     self.renderer = renderer
     weak_connect(self._column, 'clicked', self._header_clicked)
Exemple #3
0
 def on_parent_set(self, widget, old_parent):
     if isinstance(self.get_parent(), gtk.ScrolledWindow):
         window = self.get_parent()
         scrollbars = (window.get_hscrollbar(), window.get_vscrollbar())
         self.scrollbars = scrollbars
         self.scroll_positions = []
         self.keep_scroll_change = []
         for i, scrollbar in enumerate(scrollbars):
             self.scroll_positions.append(None)
             self.keep_scroll_change.append(False)
             weak_connect(scrollbar, 'change-value',
                     self.on_bar_change_value, i)
             weak_connect(scrollbar, 'value-changed',
                     self.on_bar_value_changed, i)
Exemple #4
0
 def __init__(self, model):
     Widget.__init__(self)
     self.model = model
     self.set_widget(MiroTreeView(model._model))
     self.selection = self._widget.get_selection()
     self.columns = []
     self.attr_map_for_column = {}
     self.gtk_column_to_wrapper = {}
     self.background_color = None
     self.drag_button_down = False
     self._renderer_xpad = self._renderer_ypad = 0
     self.context_menu_callback = self.drag_source = self.drag_dest = None
     self.hotspot_tracker = None
     self.hover_info = None
     self.in_bulk_change = False
     self.handled_last_button_press = False
     self.delaying_press = False
     self.ignore_selection_changed = False
     self.set_columns_draggable(False)
     self.create_signal('row-expanded')
     self.create_signal('row-collapsed')
     self.create_signal('selection-changed')
     self.create_signal('hotspot-clicked')
     self.create_signal('row-double-clicked')
     self.create_signal('row-activated')
     self.wrapped_widget_connect('row-activated', self.on_row_activated)
     self.wrapped_widget_connect('row-expanded', self.on_row_expanded)
     self.wrapped_widget_connect('row-collapsed', self.on_row_collapsed)
     self.wrapped_widget_connect('button-press-event', self.on_button_press)
     self.wrapped_widget_connect('button-release-event',
         self.on_button_release)
     self.wrapped_widget_connect('motion-notify-event',
         self.on_motion_notify)
     self.wrapped_widget_connect('drag-data-get', self.on_drag_data_get)
     self.wrapped_widget_connect('drag-end', self.on_drag_end)
     self.wrapped_widget_connect('drag-motion', self.on_drag_motion)
     self.wrapped_widget_connect('drag-leave', self.on_drag_leave)
     self.wrapped_widget_connect('drag-data-received',
             self.on_drag_data_received)
     self.wrapped_widget_connect('unrealize', self.on_unrealize)
     weak_connect(self.selection, 'changed', self.on_selection_changed)
     self._connect_hotspot_signals()
     self.layout_manager = LayoutManager(self._widget)
     self.selected = None
     if hasattr(self, 'get_tooltip'):
         self._widget.set_property('has-tooltip', True)
         self.wrapped_widget_connect('query-tooltip', self.on_tooltip)
         self._last_tooltip_place = None
Exemple #5
0
    def wrapped_browser_connect(self, signal, method, *user_args):
        """Connect to a signal of the widget we're wrapping.

        We use a weak reference to ensures that we don't have circular
        references between the wrapped widget and the wrapper widget.
        """
        return weak_connect(self._browser, signal, method, *user_args)
Exemple #6
0
    def wrapped_browser_connect(self, signal, method, *user_args):
        """Connect to a signal of the widget we're wrapping.

        We use a weak reference to ensures that we don't have circular
        references between the wrapped widget and the wrapper widget.
        """
        return weak_connect(self._browser, signal, method, *user_args)
Exemple #7
0
 def forward_signal(self, signal_name, forwarded_signal_name=None):
     if forwarded_signal_name is None:
         forwarded_signal_name = signal_name
     return weak_connect(self._widget.entry, signal_name,
             self.do_forward_signal, forwarded_signal_name)
Exemple #8
0
 def forward_signal(self, signal_name, forwarded_signal_name=None):
     if forwarded_signal_name is None:
         forwarded_signal_name = signal_name
     return weak_connect(self._widget.entry, signal_name,
                         self.do_forward_signal, forwarded_signal_name)