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

Proposed by Robert Roth
Status: Merged
Merged at revision: 2522
Proposed branch: lp:~evfool/software-center/lp875043
Merge into: lp:software-center
Diff against target: 46 lines (+13/-1)
1 file modified
softwarecenter/ui/gtk3/widgets/exhibits.py (+13/-1)
To merge this branch: bzr merge lp:~evfool/software-center/lp875043
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Review via email: mp+79477@code.launchpad.net

Description of the change

The branch contains a fix to only count a button release from exhibit as a click and activate the exhibit if both the button press and the release happened inside the exhibit. (bug #875043 happens as a result of this, as when double-clicking, the second clicks release event has been registered as a click on the exhibit)

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

On Sat, Oct 15, 2011 at 04:16:27PM -0000, Robert Roth wrote:
> Robert Roth has proposed merging lp:~evfool/software-center/lp875043 into lp:software-center.

Thanks a lot Robert! Looks great.

> Requested reviews:
> Michael Vogt (mvo)
> Related bugs:
> Bug #875043 in software-center (Ubuntu): "Double clicking to maximise causes advert click through"
> https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/875043
>
> For more details, see:
> https://code.launchpad.net/~evfool/software-center/lp875043/+merge/79477
>
> The branch contains a fix to only count a button release from exhibit as a click and activate the exhibit if both the button press and the release happened inside the exhibit. (bug #875043 happens as a result of this, as when double-clicking, the second clicks release event has been registered as a click on the exhibit)
> --
> https://code.launchpad.net/~evfool/software-center/lp875043/+merge/79477
> You are requested to review the proposed merge of lp:~evfool/software-center/lp875043 into lp:software-center.

> === modified file 'softwarecenter/ui/gtk3/widgets/exhibits.py'
> --- softwarecenter/ui/gtk3/widgets/exhibits.py 2011-10-12 15:34:18 +0000
> +++ softwarecenter/ui/gtk3/widgets/exhibits.py 2011-10-15 16:15:28 +0000
> @@ -263,6 +263,7 @@
>
> self.cursor = 0
> self._timeout = 0
> + self.pressed = False
>
> self.alpha = 1.0
> self.image = None
> @@ -287,10 +288,12 @@
> def _init_event_handling(self):
> self.set_can_focus(True)
> self.set_events(Gdk.EventMask.BUTTON_RELEASE_MASK|
> + Gdk.EventMask.BUTTON_PRESS_MASK|
> Gdk.EventMask.ENTER_NOTIFY_MASK|
> Gdk.EventMask.LEAVE_NOTIFY_MASK)
> self.connect("enter-notify-event", self.on_enter_notify)
> self.connect("leave-notify-event", self.on_leave_notify)
> + self.connect("button-press-event", self.on_button_press)
> self.connect("button-release-event", self.on_button_release)
> self.connect("key-press-event", self.on_key_press)
>
> @@ -315,11 +318,20 @@
> def on_button_release(self, widget, event):
> if not point_in(self.get_allocation(),
> int(event.x), int(event.y)):
> + self.pressed = False
> return
>
> exhibit = self.exhibits[self.cursor]
> - if exhibit.package_names:
> + if exhibit.package_names and self.pressed:
> self.emit("show-exhibits-clicked", exhibit)
> + self.pressed = False
> + return
> +
> + def on_button_press(self, widget, event):
> + if not point_in(self.get_allocation(),
> + int(event.x), int(event.y)):
> + return
> + self.pressed = True
> return
>
> def on_key_press(self, widget, event):
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/widgets/exhibits.py'
2--- softwarecenter/ui/gtk3/widgets/exhibits.py 2011-10-12 15:34:18 +0000
3+++ softwarecenter/ui/gtk3/widgets/exhibits.py 2011-10-15 16:15:28 +0000
4@@ -263,6 +263,7 @@
5
6 self.cursor = 0
7 self._timeout = 0
8+ self.pressed = False
9
10 self.alpha = 1.0
11 self.image = None
12@@ -287,10 +288,12 @@
13 def _init_event_handling(self):
14 self.set_can_focus(True)
15 self.set_events(Gdk.EventMask.BUTTON_RELEASE_MASK|
16+ Gdk.EventMask.BUTTON_PRESS_MASK|
17 Gdk.EventMask.ENTER_NOTIFY_MASK|
18 Gdk.EventMask.LEAVE_NOTIFY_MASK)
19 self.connect("enter-notify-event", self.on_enter_notify)
20 self.connect("leave-notify-event", self.on_leave_notify)
21+ self.connect("button-press-event", self.on_button_press)
22 self.connect("button-release-event", self.on_button_release)
23 self.connect("key-press-event", self.on_key_press)
24
25@@ -315,11 +318,20 @@
26 def on_button_release(self, widget, event):
27 if not point_in(self.get_allocation(),
28 int(event.x), int(event.y)):
29+ self.pressed = False
30 return
31
32 exhibit = self.exhibits[self.cursor]
33- if exhibit.package_names:
34+ if exhibit.package_names and self.pressed:
35 self.emit("show-exhibits-clicked", exhibit)
36+ self.pressed = False
37+ return
38+
39+ def on_button_press(self, widget, event):
40+ if not point_in(self.get_allocation(),
41+ int(event.x), int(event.y)):
42+ return
43+ self.pressed = True
44 return
45
46 def on_key_press(self, widget, event):