summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Minack <enrico-minack@gmx.de>2010-08-02 15:32:36 +0200
committerEnrico Minack <enrico-minack@gmx.de>2010-08-02 15:32:36 +0200
commit0574c0cfdc82099e888a40548fb3d92901e64f12 (patch)
treeb432d546c245d9b38120d6148b4d5662c05fdc4a
parent0eaa7fbc70dc65f6190853729efceca520a7df21 (diff)
[invest-applet] added help to context menu and preferences, fixes bug #563475
-rw-r--r--invest-applet/data/Invest_Applet.xml1
-rw-r--r--invest-applet/data/prefs-dialog.ui17
-rw-r--r--invest-applet/invest/Makefile.am1
-rw-r--r--invest-applet/invest/applet.py4
-rw-r--r--invest-applet/invest/help.py8
-rwxr-xr-xinvest-applet/invest/invest-applet.py2
-rw-r--r--invest-applet/invest/preferences.py8
7 files changed, 38 insertions, 3 deletions
diff --git a/invest-applet/data/Invest_Applet.xml b/invest-applet/data/Invest_Applet.xml
index 9baa4928c..832f6b83e 100644
--- a/invest-applet/data/Invest_Applet.xml
+++ b/invest-applet/data/Invest_Applet.xml
@@ -3,6 +3,7 @@
<popup name="button3">
<menuitem name="Refresh" verb="Refresh" _label="_Refresh" pixtype="stock" pixname="gtk-refresh"/>
<menuitem name="Prefs" verb="Prefs" _label="_Preferences" pixtype="stock" pixname="gtk-properties"/>
+ <menuitem name="Help" verb="Help" _label="_Help" pixtype="stock" pixname="gtk-help"/>
<menuitem name="About" verb="About" _label="_About" pixtype="stock" pixname="gtk-about"/>
</popup>
</popups>
diff --git a/invest-applet/data/prefs-dialog.ui b/invest-applet/data/prefs-dialog.ui
index 0beee9a31..e5998393d 100644
--- a/invest-applet/data/prefs-dialog.ui
+++ b/invest-applet/data/prefs-dialog.ui
@@ -191,6 +191,20 @@
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkButton" id="close">
<property name="label">gtk-close</property>
<property name="visible">True</property>
@@ -202,7 +216,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
@@ -215,6 +229,7 @@
</object>
</child>
<action-widgets>
+ <action-widget response="1">help</action-widget>
<action-widget response="-7">close</action-widget>
</action-widgets>
</object>
diff --git a/invest-applet/invest/Makefile.am b/invest-applet/invest/Makefile.am
index ede7a610e..286b974ca 100644
--- a/invest-applet/invest/Makefile.am
+++ b/invest-applet/invest/Makefile.am
@@ -9,6 +9,7 @@ investdir = $(pythondir)/invest
invest_PYTHON = \
__init__.py \
about.py \
+ help.py \
applet.py \
chart.py \
currencies.py \
diff --git a/invest-applet/invest/applet.py b/invest-applet/invest/applet.py
index f59e92eea..4cd5ad7ad 100644
--- a/invest-applet/invest/applet.py
+++ b/invest-applet/invest/applet.py
@@ -17,6 +17,7 @@ class InvestApplet:
self.applet.setup_menu_from_file (
None, "Invest_Applet.xml",
None, [("About", self.on_about),
+ ("Help", self.on_help),
("Prefs", self.on_preferences),
("Refresh", self.on_refresh)
])
@@ -62,6 +63,9 @@ class InvestApplet:
def on_about(self, component, verb):
invest.about.show_about()
+ def on_help(self, component, verb):
+ invest.help.show_help()
+
def on_preferences(self, component, verb):
invest.preferences.show_preferences(self)
self.reload_ilw()
diff --git a/invest-applet/invest/help.py b/invest-applet/invest/help.py
new file mode 100644
index 000000000..7dfaabf00
--- /dev/null
+++ b/invest-applet/invest/help.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+import gtk, gtk.gdk
+
+def show_help():
+ gtk.show_uri(None, "ghelp:invest-applet", gtk.gdk.CURRENT_TIME)
+
+def show_help_section(id):
+ gtk.show_uri(None, "ghelp:invest-applet?%s" % id, gtk.gdk.CURRENT_TIME)
diff --git a/invest-applet/invest/invest-applet.py b/invest-applet/invest/invest-applet.py
index c01dbcada..da1fb051a 100755
--- a/invest-applet/invest/invest-applet.py
+++ b/invest-applet/invest/invest-applet.py
@@ -19,7 +19,7 @@ else:
sys.path.insert(0, abspath("@PYTHONDIR@"))
# Now the path is set, import our applet
-import invest, invest.applet, invest.defs
+import invest, invest.applet, invest.defs, invest.help
# Prepare i18n
import gettext, locale
diff --git a/invest-applet/invest/preferences.py b/invest-applet/invest/preferences.py
index 2a0247f27..2485e1631 100644
--- a/invest-applet/invest/preferences.py
+++ b/invest-applet/invest/preferences.py
@@ -21,6 +21,7 @@ class PrefsDialog:
self.ui.get_object("add").connect('activate', self.on_add_stock)
self.ui.get_object("remove").connect('clicked', self.on_remove_stock)
self.ui.get_object("remove").connect('activate', self.on_remove_stock)
+ self.ui.get_object("help").connect('clicked', self.on_help)
self.treeview.connect('key-press-event', self.on_tree_keypress)
self.currency.connect('key-press-event', self.on_entry_keypress)
self.currency.connect('activate', self.on_activate_entry)
@@ -132,7 +133,9 @@ class PrefsDialog:
self.dialog.show_all()
if explanation == "":
expl.hide()
- self.dialog.run()
+ # returns 1 if help is clicked
+ while self.dialog.run() == 1:
+ pass
self.dialog.destroy()
invest.STOCKS = {}
@@ -179,6 +182,9 @@ class PrefsDialog:
for path in paths:
model.remove(model.get_iter(path))
+ def on_help(self, w):
+ invest.help.show_help_section("invest-applet-usage")
+
def on_tree_keypress(self, w, event):
if event.keyval == 65535:
self.on_remove_stock(w)