Merge lp:~evfool/software-center/smallfixes into lp:software-center

Proposed by Robert Roth
Status: Merged
Merged at revision: 1868
Proposed branch: lp:~evfool/software-center/smallfixes
Merge into: lp:software-center
Diff against target: 27 lines (+4/-3)
1 file modified
softwarecenter/ui/gtk/widgets/mkit.py (+4/-3)
To merge this branch: bzr merge lp:~evfool/software-center/smallfixes
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+65456@code.launchpad.net

Description of the change

Small fixes to the LinkButton from mkit to behave more like other widgets/links
1) When pressing mouse button over a Linkbutton, dragging out and then back in, the link color turn from normal to active (when pressing the button) and from active to normal (when leaving the link's area) and then back from normal to active (when reentering with the mouse button still pressed) - before this fix it did not, thus when dragging out and in while the button is pressed, the link color did not change back to active, in spite of the fact that the mouse was still over the link, the button was still pressed, and the state was active, but the link was not redrawn as active.
2) When pressing the mouse button over a LinkButton, dragging out from the area of the link, and releasing the button, the clicked signal was always emitted, which is not normal behavior (LP:#796640), when dragging out and releasing the button outside, the link should not be clicked. So emitting the clicked signal only if both pressed and released in the linkbuttons region.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Nice, clean fix, thanks Robert!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/ui/gtk/widgets/mkit.py'
--- softwarecenter/ui/gtk/widgets/mkit.py 2011-05-19 09:01:54 +0000
+++ softwarecenter/ui/gtk/widgets/mkit.py 2011-06-22 09:07:30 +0000
@@ -1088,9 +1088,10 @@
1088 def _on_enter(self, cat, event):1088 def _on_enter(self, cat, event):
1089 if cat == self._button_press_origin:1089 if cat == self._button_press_origin:
1090 cat.set_state(gtk.STATE_ACTIVE)1090 cat.set_state(gtk.STATE_ACTIVE)
1091 self._colorise_label_active()
1091 else:1092 else:
1092 cat.set_state(gtk.STATE_PRELIGHT)1093 cat.set_state(gtk.STATE_PRELIGHT)
1093 self._colorise_label_normal()1094 self._colorise_label_normal()
1094 self.window.set_cursor(self._cursor)1095 self.window.set_cursor(self._cursor)
1095 return1096 return
10961097
@@ -1137,9 +1138,9 @@
1137 else:1138 else:
1138 self._button_press_origin = None1139 self._button_press_origin = None
1139 cat.set_state(gtk.STATE_PRELIGHT)1140 cat.set_state(gtk.STATE_PRELIGHT)
1140 1141 gobject.timeout_add(50, emit_clicked)
1142
1141 self._colorise_label_normal()1143 self._colorise_label_normal()
1142 gobject.timeout_add(50, emit_clicked)
1143 return1144 return
11441145
1145 def _on_key_press(self, cat, event):1146 def _on_key_press(self, cat, event):