gnome-applets r10864 - in trunk/invest-applet: . data invest



Author: callum
Date: Mon Jun 16 08:02:36 2008
New Revision: 10864
URL: http://svn.gnome.org/viewvc/gnome-applets?rev=10864&view=rev

Log:
Investment applet updates: Nicer border (bug 538130). Handle the cases where the list is unconfigured or not yet downloaded. Make the debugging flag useful.

Modified:
   trunk/invest-applet/ChangeLog
   trunk/invest-applet/data/prefs-dialog.glade
   trunk/invest-applet/data/prefs-dialog.ui
   trunk/invest-applet/invest/__init__.py
   trunk/invest-applet/invest/applet.py
   trunk/invest-applet/invest/invest-applet.py
   trunk/invest-applet/invest/preferences.py
   trunk/invest-applet/invest/quotes.py

Modified: trunk/invest-applet/data/prefs-dialog.glade
==============================================================================
--- trunk/invest-applet/data/prefs-dialog.glade	(original)
+++ trunk/invest-applet/data/prefs-dialog.glade	Mon Jun 16 08:02:36 2008
@@ -1,242 +1,167 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
 <glade-interface>
-
-<widget class="GtkDialog" id="preferences">
-  <property name="border_width">5</property>
-  <property name="title" translatable="yes">Invest Preferences</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_CENTER</property>
-  <property name="modal">True</property>
-  <property name="default_height">450</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">True</property>
-  <property name="icon_name"></property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-  <property name="has_separator">False</property>
-  <signal name="response" handler="prefs_dialog_response_cb" last_modification_time="Sat, 10 May 2003 09:37:44 GMT"/>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox2">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">2</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area2">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="close">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-close</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <property name="response_id">-7</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkVBox" id="big_box">
-	  <property name="border_width">5</property>
-	  <property name="visible">True</property>
-	  <property name="homogeneous">False</property>
-	  <property name="spacing">18</property>
-
-	  <child>
-	    <widget class="GtkVBox" id="loaded_extensions_box">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">6</property>
-
-	      <child>
-		<widget class="GtkLabel" id="label1310">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">&lt;b&gt;Stocks&lt;/b&gt;</property>
-		  <property name="use_underline">True</property>
-		  <property name="use_markup">True</property>
-		  <property name="justify">GTK_JUSTIFY_CENTER</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-		  <property name="width_chars">-1</property>
-		  <property name="single_line_mode">False</property>
-		  <property name="angle">0</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkAlignment" id="alignment16">
-		  <property name="visible">True</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xscale">1</property>
-		  <property name="yscale">1</property>
-		  <property name="top_padding">0</property>
-		  <property name="bottom_padding">0</property>
-		  <property name="left_padding">18</property>
-		  <property name="right_padding">0</property>
-
-		  <child>
-		    <widget class="GtkVBox" id="vbox156">
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">6</property>
-
-		      <child>
-			<widget class="GtkScrolledWindow" id="handlers">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="has_focus">True</property>
-			  <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-			  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-			  <property name="shadow_type">GTK_SHADOW_IN</property>
-			  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-			  <child>
-			    <widget class="GtkTreeView" id="stocks">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="headers_visible">True</property>
-			      <property name="rules_hint">True</property>
-			      <property name="reorderable">True</property>
-			      <property name="enable_search">True</property>
-			      <property name="fixed_height_mode">False</property>
-			      <property name="hover_selection">False</property>
-			      <property name="hover_expand">False</property>
-			    </widget>
-			  </child>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">True</property>
-			  <property name="fill">True</property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkHBox" id="hbox1">
-			  <property name="visible">True</property>
-			  <property name="homogeneous">True</property>
-			  <property name="spacing">6</property>
-
-			  <child>
-			    <widget class="GtkButton" id="add">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="label">gtk-add</property>
-			      <property name="use_stock">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">True</property>
-			      <property name="fill">True</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkButton" id="remove">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="label">gtk-remove</property>
-			      <property name="use_stock">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">True</property>
-			      <property name="fill">True</property>
-			    </packing>
-			  </child>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">True</property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkLabel" id="default_info">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">&lt;i&gt;&lt;small&gt;&lt;b&gt;Note:&lt;/b&gt; Quotes are delayed at least 15 minutes.
+  <widget class="GtkDialog" id="preferences">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Invest Preferences</property>
+    <property name="modal">True</property>
+    <property name="window_position">GTK_WIN_POS_CENTER</property>
+    <property name="default_height">450</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="has_separator">False</property>
+    <signal name="response" handler="prefs_dialog_response_cb"/>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkVBox" id="big_box">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="spacing">18</property>
+            <child>
+              <widget class="GtkVBox" id="loaded_extensions_box">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkLabel" id="explanation">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">label</property>
+                    <property name="use_markup">True</property>
+                    <property name="justify">GTK_JUSTIFY_CENTER</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="padding">12</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="stocklabel">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Stocks&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                    <property name="use_underline">True</property>
+                    <property name="justify">GTK_JUSTIFY_CENTER</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkAlignment" id="alignment16">
+                    <property name="visible">True</property>
+                    <property name="left_padding">18</property>
+                    <child>
+                      <widget class="GtkVBox" id="vbox156">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <widget class="GtkScrolledWindow" id="handlers">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="has_focus">True</property>
+                            <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+                            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                            <property name="shadow_type">GTK_SHADOW_IN</property>
+                            <child>
+                              <widget class="GtkTreeView" id="stocks">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="reorderable">True</property>
+                                <property name="rules_hint">True</property>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkHBox" id="hbox1">
+                            <property name="visible">True</property>
+                            <property name="spacing">6</property>
+                            <property name="homogeneous">True</property>
+                            <child>
+                              <widget class="GtkButton" id="add">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label">gtk-add</property>
+                                <property name="use_stock">True</property>
+                                <property name="response_id">0</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkButton" id="remove">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label">gtk-remove</property>
+                                <property name="use_stock">True</property>
+                                <property name="response_id">0</property>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="default_info">
+                            <property name="visible">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">&lt;i&gt;&lt;small&gt;&lt;b&gt;Note:&lt;/b&gt; Quotes are delayed at least 15 minutes.
 &lt;b&gt;Source: &lt;/b&gt; Yahoo!&lt;/small&gt;&lt;/i&gt;</property>
-			  <property name="use_underline">False</property>
-			  <property name="use_markup">True</property>
-			  <property name="justify">GTK_JUSTIFY_LEFT</property>
-			  <property name="wrap">False</property>
-			  <property name="selectable">False</property>
-			  <property name="xalign">0</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">0</property>
-			  <property name="ypad">0</property>
-			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			  <property name="width_chars">-1</property>
-			  <property name="single_line_mode">False</property>
-			  <property name="angle">0</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-		    </widget>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
+                            <property name="use_markup">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="padding">6</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="close">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-close</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-7</property>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

Modified: trunk/invest-applet/data/prefs-dialog.ui
==============================================================================
--- trunk/invest-applet/data/prefs-dialog.ui	(original)
+++ trunk/invest-applet/data/prefs-dialog.ui	Mon Jun 16 08:02:36 2008
@@ -4,100 +4,60 @@
   <object class="GtkDialog" id="preferences">
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Invest Preferences</property>
-    <property name="type">GTK_WINDOW_TOPLEVEL</property>
-    <property name="window_position">GTK_WIN_POS_CENTER</property>
     <property name="modal">True</property>
+    <property name="window_position">GTK_WIN_POS_CENTER</property>
     <property name="default_height">450</property>
-    <property name="resizable">True</property>
     <property name="destroy_with_parent">True</property>
-    <property name="icon_name"></property>
-    <property name="decorated">True</property>
-    <property name="skip_taskbar_hint">False</property>
-    <property name="skip_pager_hint">False</property>
     <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
-    <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-    <property name="focus_on_map">True</property>
-    <property name="urgency_hint">False</property>
     <property name="has_separator">False</property>
-    <signal handler="prefs_dialog_response_cb" last_modification_time="Sat, 10 May 2003 09:37:44 GMT" name="response"/>
+    <signal handler="prefs_dialog_response_cb" name="response"/>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
-        <property name="homogeneous">False</property>
         <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area2">
-            <property name="visible">True</property>
-            <property name="layout_style">GTK_BUTTONBOX_END</property>
-            <child>
-              <object class="GtkButton" id="close">
-                <property name="visible">True</property>
-                <property name="can_default">True</property>
-                <property name="can_focus">True</property>
-                <property name="label">gtk-close</property>
-                <property name="use_stock">True</property>
-                <property name="relief">GTK_RELIEF_NORMAL</property>
-                <property name="focus_on_click">True</property>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="padding">0</property>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">GTK_PACK_END</property>
-          </packing>
-        </child>
         <child>
           <object class="GtkVBox" id="big_box">
-            <property name="border_width">5</property>
             <property name="visible">True</property>
-            <property name="homogeneous">False</property>
+            <property name="border_width">5</property>
             <property name="spacing">18</property>
             <child>
               <object class="GtkVBox" id="loaded_extensions_box">
                 <property name="visible">True</property>
-                <property name="homogeneous">False</property>
-                <property name="spacing">6</property>
                 <child>
-                  <object class="GtkLabel" id="label1310">
+                  <object class="GtkLabel" id="explanation">
                     <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Stocks&lt;/b&gt;</property>
-                    <property name="use_underline">True</property>
+                    <property name="label" translatable="yes">label</property>
                     <property name="use_markup">True</property>
                     <property name="justify">GTK_JUSTIFY_CENTER</property>
-                    <property name="wrap">False</property>
-                    <property name="selectable">False</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="padding">12</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="stocklabel">
+                    <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="yalign">0.5</property>
-                    <property name="xpad">0</property>
-                    <property name="ypad">0</property>
-                    <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                    <property name="width_chars">-1</property>
-                    <property name="single_line_mode">False</property>
-                    <property name="angle">0</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Stocks&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                    <property name="use_underline">True</property>
+                    <property name="justify">GTK_JUSTIFY_CENTER</property>
                   </object>
                   <packing>
-                    <property name="padding">0</property>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkAlignment" id="alignment16">
                     <property name="visible">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="yalign">0.5</property>
-                    <property name="xscale">1</property>
-                    <property name="yscale">1</property>
-                    <property name="top_padding">0</property>
-                    <property name="bottom_padding">0</property>
                     <property name="left_padding">18</property>
-                    <property name="right_padding">0</property>
                     <child>
                       <object class="GtkVBox" id="vbox156">
                         <property name="visible">True</property>
-                        <property name="homogeneous">False</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkScrolledWindow" id="handlers">
@@ -107,46 +67,28 @@
                             <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
                             <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
                             <property name="shadow_type">GTK_SHADOW_IN</property>
-                            <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
                             <child>
                               <object class="GtkTreeView" id="stocks">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="headers_visible">True</property>
-                                <property name="rules_hint">True</property>
                                 <property name="reorderable">True</property>
-                                <property name="enable_search">True</property>
-                                <property name="fixed_height_mode">False</property>
-                                <property name="hover_selection">False</property>
-                                <property name="hover_expand">False</property>
+                                <property name="rules_hint">True</property>
                               </object>
                             </child>
                           </object>
-                          <packing>
-                            <property name="padding">0</property>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                          </packing>
                         </child>
                         <child>
                           <object class="GtkHBox" id="hbox1">
                             <property name="visible">True</property>
-                            <property name="homogeneous">True</property>
                             <property name="spacing">6</property>
+                            <property name="homogeneous">True</property>
                             <child>
                               <object class="GtkButton" id="add">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="label">gtk-add</property>
                                 <property name="use_stock">True</property>
-                                <property name="relief">GTK_RELIEF_NORMAL</property>
-                                <property name="focus_on_click">True</property>
                               </object>
-                              <packing>
-                                <property name="padding">0</property>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
-                              </packing>
                             </child>
                             <child>
                               <object class="GtkButton" id="remove">
@@ -154,68 +96,65 @@
                                 <property name="can_focus">True</property>
                                 <property name="label">gtk-remove</property>
                                 <property name="use_stock">True</property>
-                                <property name="relief">GTK_RELIEF_NORMAL</property>
-                                <property name="focus_on_click">True</property>
                               </object>
                               <packing>
-                                <property name="padding">0</property>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
-                            <property name="padding">0</property>
                             <property name="expand">False</property>
-                            <property name="fill">True</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkLabel" id="default_info">
                             <property name="visible">True</property>
+                            <property name="xalign">0</property>
                             <property name="label" translatable="yes">&lt;i&gt;&lt;small&gt;&lt;b&gt;Note:&lt;/b&gt; Quotes are delayed at least 15 minutes.
 &lt;b&gt;Source: &lt;/b&gt; Yahoo!&lt;/small&gt;&lt;/i&gt;</property>
-                            <property name="use_underline">False</property>
                             <property name="use_markup">True</property>
-                            <property name="justify">GTK_JUSTIFY_LEFT</property>
-                            <property name="wrap">False</property>
-                            <property name="selectable">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0.5</property>
-                            <property name="xpad">0</property>
-                            <property name="ypad">0</property>
-                            <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-                            <property name="width_chars">-1</property>
-                            <property name="single_line_mode">False</property>
-                            <property name="angle">0</property>
                           </object>
                           <packing>
-                            <property name="padding">0</property>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                       </object>
                     </child>
                   </object>
                   <packing>
-                    <property name="padding">0</property>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="padding">0</property>
-                <property name="expand">True</property>
-                <property name="fill">True</property>
+                <property name="padding">6</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="padding">0</property>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <object class="GtkButton" id="close">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-close</property>
+                <property name="use_stock">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
           </packing>
         </child>
       </object>

Modified: trunk/invest-applet/invest/__init__.py
==============================================================================
--- trunk/invest-applet/invest/__init__.py	(original)
+++ trunk/invest-applet/invest/__init__.py	Mon Jun 16 08:02:36 2008
@@ -7,6 +7,8 @@
 # Autotools set the actual data_dir in defs.py
 from defs import *
 
+DEBUGGING = False
+
 # Allow to use uninstalled invest ---------------------------------------------
 UNINSTALLED_INVEST = False
 def _check(path):
@@ -26,7 +28,8 @@
 	SHARED_DATA_DIR = join(DATA_DIR, "gnome-applets", "invest-applet")
 	BUILDER_DATA_DIR = BUILDERDIR
 	ART_DATA_DIR = SHARED_DATA_DIR
-print "Data Dir: %s" % SHARED_DATA_DIR
+if DEBUGGING:
+	print "Data Dir: %s" % SHARED_DATA_DIR
 
 USER_INVEST_DIR = expanduser("~/.gnome2/invest-applet")
 if not exists(USER_INVEST_DIR):

Modified: trunk/invest-applet/invest/applet.py
==============================================================================
--- trunk/invest-applet/invest/applet.py	(original)
+++ trunk/invest-applet/invest/applet.py	Mon Jun 16 08:02:36 2008
@@ -33,17 +33,34 @@
 		self.investwidget = InvestWidget(self.quotes_updater)
 		self.ilw = InvestmentsListWindow(self.applet, self.investwidget)
 
+	def reload_ilw(self):
+		self.ilw.destroy()
+		self.new_ilw()
+
 	def button_clicked(self, widget,event):
 		if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
-			self.ilw.toggle_show()
+			# Three cases...
+			if len (invest.STOCKS) == 0:
+				# a) We aren't configured yet
+				invest.preferences.show_preferences(self, _("<b>You have not entered any stock information yet</b>"))
+				self.reload_ilw()
+			elif not self.quotes_updater.quotes_valid:
+				# b) We can't get the data (e.g. offline)
+				alert = gtk.MessageDialog(buttons=gtk.BUTTONS_CLOSE)
+				alert.set_markup(_("<b>No stock quotes are currently available</b>"))
+				alert.format_secondary_text(_("The server could not be contacted. The computer is either offline or the servers are down. Try again later."))
+				alert.run()
+				alert.destroy()
+			else:
+				# c) Everything is normal: pop-up the window
+				self.ilw.toggle_show()
 	
 	def on_about(self, component, verb):
 		invest.about.show_about()
 	
 	def on_preferences(self, component, verb):
 		invest.preferences.show_preferences(self)
-		self.ilw.destroy()
-		self.new_ilw()
+		self.reload_ilw()
 	
 	def on_refresh(self, component, verb):
 		self.quotes_updater.refresh()
@@ -63,6 +80,7 @@
 		self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DOCK)
 		self.stick()
 		self.set_resizable(False)
+		self.set_border_width(6)
 		
 		self.applet = applet # this is the widget we want to align with
 		self.alignment = self.applet.get_orient ()

Modified: trunk/invest-applet/invest/invest-applet.py
==============================================================================
--- trunk/invest-applet/invest/invest-applet.py	(original)
+++ trunk/invest-applet/invest/invest-applet.py	Mon Jun 16 08:02:36 2008
@@ -17,7 +17,6 @@
 	sys.path.insert(0, abspath(name))
 else:
 	sys.path.insert(0, abspath("@PYTHONDIR@"))
-	print "Running installed invest, using [ PYTHONDIR@:$PYTHONPATH]"
 
 # Now the path is set, import our applet
 import invest, invest.applet, invest.defs
@@ -31,8 +30,11 @@
 
 from gettext import gettext as _
 
+debugging = False
+
 def applet_factory(applet, iid):
-	print 'Starting invest instance:', applet, iid
+	if invest.DEBUGGING:
+		print 'Starting invest instance:', applet, iid
 	invest.applet.InvestApplet(applet)
 	return True
 
@@ -78,7 +80,8 @@
 		if o in ("-h", "--help"):
 			usage()
 		elif o in ("-d", "--debug"):
-			print "No problems so far."
+			invest.DEBUGGING = True
+			print "Debugging enabled"
 		elif o in ("-w", "--window"):
 			standalone = True
 			

Modified: trunk/invest-applet/invest/preferences.py
==============================================================================
--- trunk/invest-applet/invest/preferences.py	(original)
+++ trunk/invest-applet/invest/preferences.py	Mon Jun 16 08:02:36 2008
@@ -81,8 +81,12 @@
 				
 		self.sync_ui()
 		
-	def show_run_hide(self):
+	def show_run_hide(self, explanation = ""):
+		expl = self.ui.get_object("explanation")
+		expl.set_markup(explanation)
 		self.dialog.show_all()
+		if explanation == "":
+			expl.hide()
 		self.dialog.run()
 		self.dialog.destroy()
 		
@@ -103,9 +107,9 @@
 		self.model.foreach(save_symbol)
 		try:
 			cPickle.dump(invest.STOCKS, file(invest.STOCKS_FILE, 'w'))
-			print 'Stocks written to file'
+			if invest.DEBUGGING: print 'Stocks written to file'
 		except Exception, msg:
-			print 'Could not save stocks file:', msg
+			if invest.DEBUGGING: print 'Could not save stocks file:', msg
 			
 	
 	def sync_ui(self):
@@ -125,5 +129,5 @@
 			
 		return False
 		
-def show_preferences(applet):
-	PrefsDialog(applet).show_run_hide()
+def show_preferences(applet, explanation = ""):
+	PrefsDialog(applet).show_run_hide(explanation)

Modified: trunk/invest-applet/invest/quotes.py
==============================================================================
--- trunk/invest-applet/invest/quotes.py	(original)
+++ trunk/invest-applet/invest/quotes.py	Mon Jun 16 08:02:36 2008
@@ -23,6 +23,8 @@
 		for ticker in invest.STOCKS.keys():
 			s += "%s+" % ticker
 		
+		self.quotes_valid = False
+
 		gnomevfs.async.open(invest.QUOTES_URL % {"s": s[:-1]}, self.on_quotes_open)
 		return True
 		
@@ -30,7 +32,13 @@
 		if not exc_type:
 			handle.read(invest.GNOMEVFS_CHUNK_SIZE, lambda h,d,e,b: self.on_quotes_read(h,d,e,b, ""))
 		else:
-			handle.close(lambda *args: None)	
+			# In the event of an exception we try and
+			# close the handle. Chances are it was not
+			# opened, so we ignore the error.
+			try:
+				handle.close(lambda *args: None)
+			except:
+				pass
 
 	def on_quotes_read(self, handle, data, exc_type, bytes_requested, read):
 		if not exc_type:
@@ -67,6 +75,12 @@
 	def populate(self, quotes):
 		self.clear()
 		
+		if (len(quotes) == 0):
+			self.quotes_valid = False
+			return
+		else:
+			self.quotes_valid = True
+
 		quote_items = quotes.items ()
 		quote_items.sort ()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]