From 9f03c9b0dd70cf1e1bc28f18f4789610fac840eb Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Wed, 28 Mar 2012 19:57:18 +0000 Subject: reapplying help patch --- (limited to 'TurtleArt') diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py index 6bbaf69..0cfb242 100644 --- a/TurtleArt/taconstants.py +++ b/TurtleArt/taconstants.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -#Copyright (c) 2010-11 Walter Bender +#Copyright (c) 2010-12 Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal diff --git a/TurtleArt/tapalette.py b/TurtleArt/tapalette.py index 86a3bda..7678f7e 100644 --- a/TurtleArt/tapalette.py +++ b/TurtleArt/tapalette.py @@ -86,6 +86,8 @@ from sugar.graphics import style from taconstants import EXPANDABLE_STYLE from tautils import debug_output +from util.helpbutton import add_section, add_paragraph + from gettext import gettext as _ help_strings = { @@ -150,49 +152,11 @@ class Palette(): else: help_strings[self._name] = '' - def add_section(self, section_text, icon=None): - ''' Add a section to the help palette. From helpbutton.py by - Gonzalo Odiard ''' - hbox = gtk.HBox() - label = gtk.Label() - label.set_use_markup(True) - label.set_markup('%s' % section_text) - label.set_line_wrap(True) - label.set_size_request(self._max_text_width, -1) - hbox.add(label) - if icon is not None: - _icon = Icon(icon_name=icon) - hbox.add(_icon) - label.set_size_request(self._max_text_width - 20, -1) - else: - label.set_size_request(self._max_text_width, -1) - - hbox.show_all() - self._help_box.pack_start(hbox, False, False, padding=5) - - def add_paragraph(self, text, icon=None): - ''' Add an entry to the help palette. From helpbutton.py by - Gonzalo Odiard ''' - hbox = gtk.HBox() - label = gtk.Label(text) - label.set_justify(gtk.JUSTIFY_LEFT) - label.set_line_wrap(True) - hbox.add(label) - if icon is not None: - _icon = Icon(icon_name=icon) - hbox.add(_icon) - label.set_size_request(self._max_text_width - 20, -1) - else: - label.set_size_request(self._max_text_width, -1) - - hbox.show_all() - self._help_box.pack_start(hbox, False, False, padding=5) - def set_help(self, help): if self._help is None: self._help = help if hasattr(self, '_help_box'): - self.add_section(self._help, icon=self._name + 'off') + add_section(self._help_box, self._help, icon=self._name + 'off') def set_special_name(self, name): self._special_name = name @@ -229,9 +193,10 @@ class Palette(): else: first_arg = special_name if first_arg is None or first_arg == '' or first_arg == ' ': - self.add_paragraph('%s' % (help_string)) + add_paragraph(self._help_box, '%s' % (help_string)) else: - self.add_paragraph('%s: %s' % (first_arg, help_string)) + add_paragraph(self._help_box, '%s: %s' % (first_arg, + help_string)) if colors is not None: block.set_colors(colors) block.set_value_block(value_block) -- cgit v0.9.1