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

@ -21,16 +21,19 @@ class ClipboardMenu(Menu):
def __init__(self, name, percent):
Menu.__init__(self, name)
self._progress_bar = ClipboardMenuItem(percent)
self._root.append(self._progress_bar)
if percent < 100:
self._progress_bar = ClipboardMenuItem(percent)
self._root.append(self._progress_bar)
else:
self._progress_bar = None
self._remove_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 not self._remove_icon:
self._remove_icon = CanvasIcon(icon_name='stock-remove')
@ -49,5 +52,6 @@ class ClipboardMenu(Menu):
self._remove_icon = None
def set_percent(self, percent):
self._progress_bar.set_property('percent', percent)
self._create_icons(percent)
if self._progress_bar:
self._progress_bar.set_property('percent', percent)
self._update_icons(percent)

View File

@ -139,9 +139,14 @@ class ClipboardBox(hippo.CanvasBox):
return True;
def motion_notify_event_cb(self, widget, event):
if not self._pressed_button:
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")
@ -152,10 +157,10 @@ class ClipboardBox(hippo.CanvasBox):
y = event.y
state = event.state
if widget.drag_check_threshold(self._press_start_x,
self._press_start_y,
x,
y):
if widget.drag_check_threshold(int(self._press_start_x),
int(self._press_start_y),
int(x),
int(y)):
targets = self._get_targets_for_dnd(
self._last_clicked_icon.get_object_id())

View File

@ -30,8 +30,7 @@ class ClipboardPanelWindow(PanelWindow):
# Offering dnd drags
self.drag_source_set(0, [], 0)
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("button_press_event", box.button_press_event_cb)
self.connect("drag_end", box.drag_end_cb)