Merge lp:~smartgpx/bzr-gtk/workaround_for_lp494140 into lp:bzr-gtk/gtk2

Proposed by David Roberts
Status: Merged
Merged at revision: 709
Proposed branch: lp:~smartgpx/bzr-gtk/workaround_for_lp494140
Merge into: lp:bzr-gtk/gtk2
Diff against target: 69 lines (+12/-7)
2 files modified
revisionview.py (+4/-2)
viz/branchwin.py (+8/-5)
To merge this branch: bzr merge lp:~smartgpx/bzr-gtk/workaround_for_lp494140
Reviewer Review Type Date Requested Status
Vincent Ladeuil Needs Information
Review via email: mp+15855@code.launchpad.net
To post a comment you must log in.
Revision history for this message
David Roberts (smartgpx) wrote :

This demonstrates a workaround (not truely a 'solution') to lp:494140. With this patch, all gtk tools can be run under xandros, a debian-etch based OS supplied by asus.

It is not clear whether any vital functionality is lost by this patch: the author does not have access to a recent debian install for comparison purposes.

Rejection of this merge proposal in favour of a solution understood and supported by the developers will be a satisfactory outcome.

Revision history for this message
Vincent Ladeuil (vila) wrote :

With your patch, brz viz issues a warning:

Traceback (most recent call last):
  File "/home/vila/.bazaar/plugins/gtk/viz/branchwin.py", line 416, in _treeselection_changed_cb
    self.prev_button.set_menu(prev_menu)
AttributeError: 'gtk.ToolButton' object has no attribute 'set_menu'

I added some getattr() calls so that the code is still active for PyGtk-2.10, can you merge it and check it still works for you ?

The branch is: lp:~vila/bzr-gtk/494140-xandros-compat

You can push your branch again when you've got a working version.

review: Needs Fixing
673. By David Roberts

Further consequential changes for PyGtk-2.8

Revision history for this message
David Roberts (smartgpx) wrote :

Thank you for your attempt to 'mentor' by giving me the opportunity to
explore this.

I thought it was beyond my gtk/python skills at present. But I've got
a proposal.

My thinking is as follows. 'self.prev_button.set_menu' expects self to
be a MenuToolButton, which we should have established by calling
set_tool_item_type.
But for PyGtk < 2.10 we haven't done that.

But to avoid the runtime error we can at least inspect whether we can
call set_menu
on the button we actually have...

And we need to do this twice, for prev_button and next_button.

Seems to run Visualize cleanly now.

Did I merge your changes correctly and following correct etiquette/attribution?

2009/12/9 Vincent Ladeuil <email address hidden>:
> Review: Needs Fixing
> With your patch, brz viz issues a warning:
>
> Traceback (most recent call last):
>  File "/home/vila/.bazaar/plugins/gtk/viz/branchwin.py", line 416, in _treeselection_changed_cb
>    self.prev_button.set_menu(prev_menu)
> AttributeError: 'gtk.ToolButton' object has no attribute 'set_menu'
>
> I added some getattr() calls so that the code is still active for PyGtk-2.10, can you merge it and check it still works for you ?
>
> The branch is: lp:~vila/bzr-gtk/494140-xandros-compat
>
> You can push your branch again when you've got a working version.
> --
> https://code.edge.launchpad.net/~smartgpx/bzr-gtk/workaround_for_lp494140/+merge/15855
> You are the owner of lp:~smartgpx/bzr-gtk/workaround_for_lp494140.
>

Revision history for this message
Vincent Ladeuil (vila) wrote :

> Thank you for your attempt to 'mentor' by giving me the opportunity to
> explore this.
>
> I thought it was beyond my gtk/python skills at present. But I've got
> a proposal.

Hehe, obviously you're too humble here since you demonstrate your understanding of the issue below :)

>
> My thinking is as follows. 'self.prev_button.set_menu' expects self to
> be a MenuToolButton, which we should have established by calling
> set_tool_item_type.
> But for PyGtk < 2.10 we haven't done that.

But if you don't encounter the issue, does it matter ?
I mentioned the warning only to give you feedback about why my changes were needed.
If the behavior is fine on your side with them, no need to do *more* changes :)

>
> But to avoid the runtime error we can at least inspect whether we can
> call set_menu
> on the button we actually have...

That's sound, but not needed because we did that earlier.

>
> And we need to do this twice, for prev_button and next_button.
>
> Seems to run Visualize cleanly now.
>

Good. AIUI you may not have the history associated with the 'next' and 'previous' buttons, but that's the price to pay for running an older PyGtk version I'm afraid.

> Did I merge your changes correctly and following correct
> etiquette/attribution?

I have no idea since you didn't push :)

The diff below is still your original one and the associated branch is still at revno 672.

Revision history for this message
Vincent Ladeuil (vila) wrote :

@David: Any progress to report ?
Can you at least push your current branch here so we continue the discussion ?

review: Needs Information

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'revisionview.py'
--- revisionview.py 2009-06-10 18:07:35 +0000
+++ revisionview.py 2009-12-11 09:04:12 +0000
@@ -51,13 +51,15 @@
51 webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)51 webbrowser._tryorder.insert(0, '%s "%%s"' % cmd)
52 webbrowser.open(uri)52 webbrowser.open(uri)
5353
54gtk.link_button_set_uri_hook(_open_link)54if getattr(gtk, 'link_button_set_uri_hook', None) is not None:
55 # Not available before PyGtk-2.10
56 gtk.link_button_set_uri_hook(_open_link)
5557
56class BugsTab(gtk.VBox):58class BugsTab(gtk.VBox):
5759
58 def __init__(self):60 def __init__(self):
59 super(BugsTab, self).__init__(False, 6)61 super(BugsTab, self).__init__(False, 6)
60 62
61 table = gtk.Table(rows=2, columns=2)63 table = gtk.Table(rows=2, columns=2)
6264
63 table.set_row_spacings(6)65 table.set_row_spacings(6)
6466
=== modified file 'viz/branchwin.py'
--- viz/branchwin.py 2009-05-25 15:57:23 +0000
+++ viz/branchwin.py 2009-12-11 09:04:12 +0000
@@ -1,11 +1,10 @@
1# -*- coding: UTF-8 -*-
2"""Branch window.1"""Branch window.
32
4This module contains the code to manage the branch information window,3This module contains the code to manage the branch information window,
5which contains both the revision graph and details panes.4which contains both the revision graph and details panes.
6"""5"""
76
8__copyright__ = "Copyright © 2005 Canonical Ltd."7__copyright__ = "Copyright (c) 2005 Canonical Ltd."
9__author__ = "Scott James Remnant <scott@ubuntu.com>"8__author__ = "Scott James Remnant <scott@ubuntu.com>"
109
1110
@@ -80,7 +79,9 @@
80 self.accel_group = gtk.AccelGroup()79 self.accel_group = gtk.AccelGroup()
81 self.add_accel_group(self.accel_group)80 self.add_accel_group(self.accel_group)
8281
83 gtk.Action.set_tool_item_type(gtk.MenuToolButton)82 if getattr(gtk.Action, 'set_tool_item_type', None) is not None:
83 # Not available before PyGtk-2.10
84 gtk.Action.set_tool_item_type(gtk.MenuToolButton)
8485
85 self.prev_rev_action = gtk.Action("prev-rev", "_Previous Revision", "Go to the previous revision", gtk.STOCK_GO_DOWN)86 self.prev_rev_action = gtk.Action("prev-rev", "_Previous Revision", "Go to the previous revision", gtk.STOCK_GO_DOWN)
86 self.prev_rev_action.set_accel_path("<viz>/Go/Previous Revision")87 self.prev_rev_action.set_accel_path("<viz>/Go/Previous Revision")
@@ -413,7 +414,8 @@
413 self.prev_rev_action.set_sensitive(False)414 self.prev_rev_action.set_sensitive(False)
414 prev_menu.hide()415 prev_menu.hide()
415416
416 self.prev_button.set_menu(prev_menu)417 if getattr(self.prev_button, 'set_menu', None) is not None:
418 self.prev_button.set_menu(prev_menu)
417419
418 next_menu = gtk.Menu()420 next_menu = gtk.Menu()
419 if len(children) > 0:421 if len(children) > 0:
@@ -433,7 +435,8 @@
433 self.next_rev_action.set_sensitive(False)435 self.next_rev_action.set_sensitive(False)
434 next_menu.hide()436 next_menu.hide()
435437
436 self.next_button.set_menu(next_menu)438 if getattr(self.next_button, 'set_menu', None) is not None:
439 self.next_button.set_menu(next_menu)
437440
438 self.revisionview.set_revision(revision)441 self.revisionview.set_revision(revision)
439 self.revisionview.set_children(children)442 self.revisionview.set_children(children)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: