Merge lp:~bellini666/stoq/help_button_on_dialogs into lp:~stoq-dev/stoq/master

Proposed by Thiago Bellini
Status: Merged
Approved by: Thiago Bellini
Approved revision: 4879
Merged at revision: 4888
Proposed branch: lp:~bellini666/stoq/help_button_on_dialogs
Merge into: lp:~stoq-dev/stoq/master
Diff against target: 44 lines (+24/-0)
1 file modified
stoqlib/gui/base/dialogs.py (+24/-0)
To merge this branch: bzr merge lp:~bellini666/stoq/help_button_on_dialogs
Reviewer Review Type Date Requested Status
Stoq Developers Pending
Review via email: mp+90189@code.launchpad.net

Description of the change

Add support for showing help button on dialogs.

With this change, the 'Plugins Dialog' will show the help button, that is already working to show it's help. Other dialogs can do the same by just adding "help_section = 'page_name'", just like other editors and wizards.

pyflakes and pep8 tests passed.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stoqlib/gui/base/dialogs.py'
2--- stoqlib/gui/base/dialogs.py 2011-11-30 17:51:25 +0000
3+++ stoqlib/gui/base/dialogs.py 2012-01-25 19:12:24 +0000
4@@ -105,6 +105,7 @@
5 class AbstractDialog(GladeDelegate, RunnableView):
6 """Abstract Dialog class that defines a simple run API."""
7 gladefile = None
8+ help_section = None
9
10 def __init__(self, delete_handler=None):
11 if not delete_handler:
12@@ -115,9 +116,32 @@
13 delete_handler=delete_handler,
14 keyactions=self.keyactions)
15
16+ if self.help_section:
17+ self._add_help_button(self.help_section)
18+
19+ #
20+ # Public API
21+ #
22+
23 def setup_keyactions(self):
24 self.keyactions = {}
25
26+ #
27+ # Private
28+ #
29+
30+ def _add_help_button(self, section):
31+ def on_help__clicked(button):
32+ from stoqlib.gui.help import show_section
33+ show_section(section)
34+
35+ self.action_area.set_layout(gtk.BUTTONBOX_END)
36+ button = gtk.Button(stock=gtk.STOCK_HELP)
37+ button.connect('clicked', on_help__clicked)
38+ self.action_area.add(button)
39+ self.action_area.set_child_secondary(button, True)
40+ button.show()
41+
42 #
43 # Special note for BasicDialog and BasicPluggableDialog: if you inherit
44 # from this class, you *must* call Basic*Dialog._initialize() right after

Subscribers

People subscribed via source and target branches