From def0518872318b85e1663109323b64be2a7cdb9b Mon Sep 17 00:00:00 2001 From: infirit Date: Sat, 8 Feb 2014 16:11:05 +0100 Subject: invest-applet: fixed chart and prefs window, added chart scale option - combo boxes printed their content twice - preferences dialog threw warning - added plot scale option to charts window - Replace GtkComboBox with GtkComboBoxText Based on gnome commit 766c9e1711330ec2b7109aa39ddd43b6583a30d3 Authot: Enrico Minack Url: https://git.gnome.org/browse/gnome-applets/commit/?id=766c9e1711330ec2b7109aa39ddd43b6583a30d3 --- invest-applet/data/financialchart.ui | 705 +++++++++++++---------------------- invest-applet/data/prefs-dialog.ui | 126 ++++--- invest-applet/invest/chart.py | 16 +- 3 files changed, 349 insertions(+), 498 deletions(-) diff --git a/invest-applet/data/financialchart.ui b/invest-applet/data/financialchart.ui index 1de0f38d..d7d80954 100644 --- a/invest-applet/data/financialchart.ui +++ b/invest-applet/data/financialchart.ui @@ -1,101 +1,37 @@ - - + - - - - - - - Today - - - 5 Days - - - 3 Months - - - 6 Months - - - 1 Year - - - 5 Years - - - Maximum - - - - - - - - - - l - - - b - - - c - - - + - 6 True + False + 6 Financial Chart - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - False + center 500 - True True stock_chart - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False True - False + False 6 True - False + False 6 True + False _Ticker symbol: True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 s - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - 0 False False + 0 @@ -103,83 +39,55 @@ True True True - True - True - 0 - - True - * - False - 0 True True + 1 True True - GTK_RELIEF_NORMAL - True + False + False True - False True True - 0.5 - 0.5 + False 0 0 - 0 - 0 - 0 - 0 True - False + False 2 True + False gtk-refresh - 4 - 0.5 - 0.5 - 0 - 0 - 0 False False + 0 True + False Auto _refresh True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - 0 False False + 1 @@ -188,265 +96,193 @@ - 0 False False + 2 - + True - False - True - model1 - - - - 0 - - + False + + Today + 5 Days + 3 Months + 6 Months + 1 Year + 5 Years + Maximum + - 0 False False + 3 - 0 False False + 0 True True - False 6 True + False 5 2 - False - 6 6 + 6 True + False + 1 _Graph style: True - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - q - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - 0 - 1 - 0 - 1 - fill - + GTK_FILL + True - Moving average: - False - False - GTK_JUSTIFY_LEFT - False - False + False 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + Moving average: - 0 - 1 1 2 - fill - + GTK_FILL + True - Exponential moving average: - False - False - GTK_JUSTIFY_LEFT - False - False + False 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + Exponential moving average: - 0 - 1 2 3 - fill - - - - - - True - False - True - model2 - - - - 0 - - - - - 1 - 2 - 0 - 1 - fill + GTK_FILL + True - False + False 6 + 5 True True - 5 + False + False True - GTK_RELIEF_NORMAL - True True - False True - 0 False False + 0 + 10 True True - 10 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 1 + 20 True True - 20 + False + False True - GTK_RELIEF_NORMAL - True True - False True - 0 False False + 2 + 50 True True - 50 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 3 + 100 True True - 100 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 4 + 200 True True - 200 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 5 @@ -455,112 +291,92 @@ 2 2 3 - fill - fill + GTK_FILL + GTK_FILL True - Overlays: - False - False - GTK_JUSTIFY_LEFT - False - False + False 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + Overlays: - 0 - 1 3 4 - fill - + GTK_FILL + True - False - 0 + False + Bollinger True True - Bollinger + False + False True - GTK_RELIEF_NORMAL - True True - False True - 0 False False + 0 + SAR True True - SAR + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 1 + Splits True True - Splits + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 2 + Volumes True True - Volumes + False + False True - GTK_RELIEF_NORMAL - True True - False True - 0 False False + 3 @@ -569,118 +385,91 @@ 2 3 4 - fill - fill + GTK_FILL + GTK_FILL True - Indicators: - False - False - GTK_JUSTIFY_LEFT - False - False + False 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 + Indicators: - 0 - 1 4 5 - fill - + GTK_FILL + True + False 3 3 - False - 0 - 0 + RSI True True - RSI + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 - 1 1 2 - fill - + GTK_FILL + + Vol True True - Vol + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 - 1 2 3 - fill - + GTK_FILL + + MFI True True - MFI + False + False True - GTK_RELIEF_NORMAL - True True - False True 1 2 - 0 - 1 - fill - + GTK_FILL + + Slow stoch True True - Slow stoch + False + False True - GTK_RELIEF_NORMAL - True True - False True @@ -688,20 +477,18 @@ 2 1 2 - fill - + GTK_FILL + + Vol+MA True True - Vol+MA + False + False True - GTK_RELIEF_NORMAL - True - False - False True @@ -709,41 +496,35 @@ 2 2 3 - fill - + GTK_FILL + + ROC True True - ROC + False + False True - GTK_RELIEF_NORMAL - True - False - False True 2 3 - 0 - 1 - fill - + GTK_FILL + + Fast stoch True True - Fast stoch + False + False True - GTK_RELIEF_NORMAL - True - False - False True @@ -751,20 +532,19 @@ 3 1 2 - fill - + GTK_FILL + + W%R True True - W%R + False + False True - GTK_RELIEF_NORMAL - True True - False True @@ -772,29 +552,24 @@ 3 2 3 - fill - + GTK_FILL + + MACD True True - MACD + False + False True - GTK_RELIEF_NORMAL - True True - False True - 0 - 1 - 0 - 1 - fill - + GTK_FILL + @@ -803,121 +578,110 @@ 2 4 5 - fill - fill + GTK_FILL + GTK_FILL True - False + False 6 + 5 True True - 5 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 0 + 10 True True - 10 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 1 + 20 True True - 20 + False + False True - GTK_RELIEF_NORMAL - True True - False True - 0 False False + 2 + 50 True True - 50 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 3 + 100 True True - 100 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 4 + 200 True True - 200 + False + False True - GTK_RELIEF_NORMAL - True - False - False True - 0 False False + 5 @@ -926,8 +690,81 @@ 2 1 2 - fill - fill + GTK_FILL + GTK_FILL + + + + + True + False + + + True + False + + Line + Bar + Candle + + + + False + False + 0 + + + + + True + False + 50 + + + True + False + Scale: + + + + + False + False + 1 + + + + + True + False + + Linear + Logarithmic + + + + False + False + 2 + + + + + True + False + + + True + True + 3 + + + + + 1 + 2 + GTK_FILL + GTK_FILL @@ -935,59 +772,44 @@ True + False _Options True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - 0 False False + 1 True True - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT + never + in True - GTK_SHADOW_NONE + False + none True - 5 + False stock_chart - 0.5 - 0.5 - 0 - 0 + 5 - 0 True True + 2 @@ -995,24 +817,13 @@ True True Downloading chart from <b>Yahoo!</b> - False True - GTK_JUSTIFY_LEFT - False True - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - 0 False False + 3 diff --git a/invest-applet/data/prefs-dialog.ui b/invest-applet/data/prefs-dialog.ui index 0e83e372..ee4e7ff6 100644 --- a/invest-applet/data/prefs-dialog.ui +++ b/invest-applet/data/prefs-dialog.ui @@ -1,8 +1,8 @@ - + - + False 5 Invest Preferences True @@ -10,22 +10,71 @@ 450 True dialog - + - + True + False + vertical 2 + + + True + False + end + + + gtk-help + True + True + True + False + True + + + False + False + 0 + + + + + gtk-close + True + True + True + False + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + True + False 5 18 True + False True + False label True center @@ -40,6 +89,7 @@ True + False 0 Stocks True @@ -57,11 +107,13 @@ True + False 18 18 True + False 6 @@ -69,7 +121,6 @@ True True never - automatic in @@ -77,16 +128,22 @@ True True True + + + + True + True 0 True + False 6 True @@ -95,9 +152,12 @@ True True False + False True + True + True 0 @@ -107,21 +167,26 @@ True True False + False True + True + True 1 False + True 1 True + False 0 <i><small><b>Note:</b> Quotes are delayed at least 15 minutes. <b>Source: </b> Yahoo!</small></i> @@ -137,12 +202,15 @@ + True + True 2 True + False 0 Currency True @@ -160,69 +228,35 @@ True + False 18 True True - + False + True 4 + True + True 6 0 - - 1 - - - - - True - end - - - gtk-help - True - True - True - True - - - False - False - 0 - - - - - gtk-close - True - True - True - False - True - - - False - False - 1 - - - False - end - 0 + True + 1 diff --git a/invest-applet/invest/chart.py b/invest-applet/invest/chart.py index 044a2209..e12424a6 100644 --- a/invest-applet/invest/chart.py +++ b/invest-applet/invest/chart.py @@ -104,9 +104,15 @@ class FinancialChart: def __init__(self, ui): self.ui = ui - #Time ranges of the plot + #Time ranges of the plot (parameter / combo-box t) self.time_ranges = ["1d", "5d", "3m", "6m", "1y", "5y", "my"] + #plot types (parameter / combo-box q) + self.plot_types = ["l", "b", "c"] + + #plot scales (parameter / combo-box l) + self.plot_scales = ["off", "on"] + # Window Properties win = ui.get_object("window") win.set_title(_("Financial Chart")) @@ -119,7 +125,7 @@ class FinancialChart: pass # Defaut comboboxes values - for widget in ["t", "q"]: + for widget in ["t", "q", "l"]: ui.get_object(widget).set_active(0) # Connect every option widget to its corresponding change signal @@ -131,7 +137,7 @@ class FinancialChart: "pe5","pe10", "pe20","pe50","pe100","pe200", "pb","pp","ps","pv", "ar","af","ap","aw","am","ass","afs","av","avm"), "toggled"), - (("t", "q"), "changed"), + (("t", "q", "l"), "changed"), (("s",), "activate"), ]: for widget in widgets: @@ -215,8 +221,8 @@ class FinancialChart: url = chart_base_url % { "s": tickers[0], "t": self.time_ranges[self.ui.get_object("t").get_active()], - "q": self.ui.get_object("q").get_active_text(), - "l": "off", + "q": self.plot_types[self.ui.get_object("q").get_active()], + "l": self.plot_scales[self.ui.get_object("l").get_active()], "z": "l", "p": p, "a": a, -- cgit v1.2.1