Clipboard fixes.

This commit is contained in:
Tomeu Vizoso 2006-12-14 13:50:42 +01:00
parent e68f0e00e9
commit cc39ef169f
3 changed files with 22 additions and 14 deletions

View File

@ -22,15 +22,18 @@ class ClipboardMenu(Menu):
def __init__(self, name, percent): def __init__(self, name, percent):
Menu.__init__(self, name) Menu.__init__(self, name)
if percent < 100:
self._progress_bar = ClipboardMenuItem(percent) self._progress_bar = ClipboardMenuItem(percent)
self._root.append(self._progress_bar) self._root.append(self._progress_bar)
else:
self._progress_bar = None
self._remove_icon = None self._remove_icon = None
self._stop_icon = None self._stop_icon = None
self._create_icons(percent) self._update_icons(percent)
def _create_icons(self, percent): def _update_icons(self, percent):
if percent == 100: if percent == 100:
if not self._remove_icon: if not self._remove_icon:
self._remove_icon = CanvasIcon(icon_name='stock-remove') self._remove_icon = CanvasIcon(icon_name='stock-remove')
@ -49,5 +52,6 @@ class ClipboardMenu(Menu):
self._remove_icon = None self._remove_icon = None
def set_percent(self, percent): def set_percent(self, percent):
if self._progress_bar:
self._progress_bar.set_property('percent', percent) self._progress_bar.set_property('percent', percent)
self._create_icons(percent) self._update_icons(percent)

View File

@ -143,6 +143,11 @@ class ClipboardBox(hippo.CanvasBox):
if not self._pressed_button: if not self._pressed_button:
return True return True
# if the mouse button is not pressed, no drag should occurr
if not event.state & gtk.gdk.BUTTON1_MASK:
self._pressed_button = None
return True
logging.debug("motion_notify_event_cb") logging.debug("motion_notify_event_cb")
if event.is_hint: if event.is_hint:
@ -152,10 +157,10 @@ class ClipboardBox(hippo.CanvasBox):
y = event.y y = event.y
state = event.state state = event.state
if widget.drag_check_threshold(self._press_start_x, if widget.drag_check_threshold(int(self._press_start_x),
self._press_start_y, int(self._press_start_y),
x, int(x),
y): int(y)):
targets = self._get_targets_for_dnd( targets = self._get_targets_for_dnd(
self._last_clicked_icon.get_object_id()) self._last_clicked_icon.get_object_id())

View File

@ -30,7 +30,6 @@ class ClipboardPanelWindow(PanelWindow):
# Offering dnd drags # Offering dnd drags
self.drag_source_set(0, [], 0) self.drag_source_set(0, [], 0)
self.add_events(gtk.gdk.BUTTON_PRESS_MASK | self.add_events(gtk.gdk.BUTTON_PRESS_MASK |
gtk.gdk.POINTER_MOTION_MASK |
gtk.gdk.POINTER_MOTION_HINT_MASK) gtk.gdk.POINTER_MOTION_HINT_MASK)
self.connect("motion_notify_event", box.motion_notify_event_cb) self.connect("motion_notify_event", box.motion_notify_event_cb)
self.connect("button_press_event", box.button_press_event_cb) self.connect("button_press_event", box.button_press_event_cb)