diff options
author | Walter Bender <walter@walter-laptop.(none)> | 2009-09-07 20:06:32 (GMT) |
---|---|---|
committer | Walter Bender <walter@walter-laptop.(none)> | 2009-09-07 20:06:32 (GMT) |
commit | 46b7b9f5ad53fc2fb934f037224cb1b8a4a3a73f (patch) | |
tree | 4d0cc4aaa5506fde9673a1f04d3091947f6872e2 | |
parent | 536411fd82cfc04925e12670d56a5c3d589a57f0 (diff) |
hover hints in toolbar
-rw-r--r-- | TurtleArtActivity.py | 32 | ||||
-rw-r--r-- | icons/help-toolbar.svg | 28 | ||||
-rw-r--r-- | tawindow.py | 14 |
3 files changed, 59 insertions, 15 deletions
diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index 731f9aa..6136c02 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -89,9 +89,11 @@ class TurtleArtActivity(activity.Activity): self.keep_button.connect('clicked', self._do_savesnapshot_cb) self.keep_button.show() activity_button.props.page.insert(self.keep_button, -1) - separator = gtk.SeparatorToolItem() - separator.show() - activity_button.props.page.insert(separator, -1) + samples_button = ToolButton( "stock-open" ) + samples_button.set_tooltip(_('Samples')) + samples_button.connect('clicked', self._do_samples_cb) + samples_button.show() + activity_button.props.page.insert(samples_button, -1) self.save_as_html = ToolButton('htmloff') self.save_as_html.set_tooltip(_("Save as HTML")) self.save_as_html.connect('clicked', self._do_savehtml_cb) @@ -128,7 +130,6 @@ class TurtleArtActivity(activity.Activity): fullscreen_button.set_tooltip(_("Fullscreen")) fullscreen_button.props.accelerator = '<Alt>Enter' fullscreen_button.connect('clicked', self.__fullscreen_cb) - view_toolbar.insert(fullscreen_button, -1) fullscreen_button.show() view_toolbar_button = ToolbarButton( @@ -206,14 +207,21 @@ class TurtleArtActivity(activity.Activity): toolbar_box.toolbar.insert(separator, -1) separator.show() - # project open - samples_button = ToolButton( "stock-open" ) - samples_button.set_tooltip(_('Samples')) - samples_button.props.sensitive = True - samples_button.connect('clicked', self._do_samples_cb) - samples_button.props.accelerator = _('<Alt>o') - toolbar_box.toolbar.insert(samples_button, -1) - samples_button.show() + # Help + help_toolbar = gtk.Toolbar() + self.hover_help_label = gtk.Label("help") + self.hover_help_label.show() + self.hover_toolitem = gtk.ToolItem() + self.hover_toolitem.add(self.hover_help_label) + help_toolbar.insert(self.hover_toolitem,-1) + self.hover_toolitem.show() + + help_toolbar_button = ToolbarButton( + page=help_toolbar, + icon_name='help-toolbar') + help_toolbar.show() + toolbar_box.toolbar.insert(help_toolbar_button, -1) + help_toolbar_button.show() separator = gtk.SeparatorToolItem() separator.props.draw = False diff --git a/icons/help-toolbar.svg b/icons/help-toolbar.svg new file mode 100644 index 0000000..d763270 --- /dev/null +++ b/icons/help-toolbar.svg @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.0" + width="55" + height="54.695999" + viewBox="0 0 55 54.696" + id="svg2" + xml:space="preserve"><defs + id="defs20"> + + + + + </defs><text + x="13.484375" + y="45.1605" + id="text2412" + xml:space="preserve" + style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"><tspan + x="13.484375" + y="45.1605" + id="tspan2414" + style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold">?</tspan></text> + +</svg>
\ No newline at end of file diff --git a/tawindow.py b/tawindow.py index 503d8cd..bbeb122 100644 --- a/tawindow.py +++ b/tawindow.py @@ -319,7 +319,7 @@ def mouse_move(tw, x, y, verbose=False, mdx=0, mdy=0): proto = get_proto_from_category(tw,x,y) if proto and proto!='hide': if timeout_tag[0] == 0: - timeout_tag[0] = showPopup(proto.name) + timeout_tag[0] = showPopup(proto.name,tw) return else: if timeout_tag[0] > 0: @@ -330,7 +330,7 @@ def mouse_move(tw, x, y, verbose=False, mdx=0, mdy=0): timeout_tag[0] = 0 elif spr and spr.type == 'selbutton': if timeout_tag[0] == 0: - timeout_tag[0] = showPopup(spr.name) + timeout_tag[0] = showPopup(spr.name,tw) else: if timeout_tag[0] > 0: try: @@ -767,10 +767,18 @@ def blocks(tw): def xy(event): return map(int, event.get_coords()) -def showPopup(block_name): +def showPopup(block_name,tw): + try: + label = block_name + ": " + hover_dict[block_name] + except: + label = block_name + tw.activity.hover_help_label.set_text(label) + tw.activity.hover_help_label.show() + """ i = popupHandler.getInvoker(block_name) if i: return gobject.timeout_add(500, i.showPopup, "") + """ return 0 |