Author: dmeyer
Date: Fri Sep  7 08:57:38 2007
New Revision: 2798

Log:
add last features to be usable

Modified:
   trunk/WIP/netsearch/src/feed/__init__.py
   trunk/WIP/netsearch/test/feed.py
   trunk/WIP/netsearch/test/feedmanager.glade

Modified: trunk/WIP/netsearch/src/feed/__init__.py
==============================================================================
--- trunk/WIP/netsearch/src/feed/__init__.py    (original)
+++ trunk/WIP/netsearch/src/feed/__init__.py    Fri Sep  7 08:57:38 2007
@@ -25,4 +25,5 @@
 
 add_channel = manager.add_channel
 list_channels = manager.list_channels
+remove_channel = manager.remove_channel
 update = manager.update

Modified: trunk/WIP/netsearch/test/feed.py
==============================================================================
--- trunk/WIP/netsearch/test/feed.py    (original)
+++ trunk/WIP/netsearch/test/feed.py    Fri Sep  7 08:57:38 2007
@@ -9,7 +9,7 @@
             print 'no channels defined'
             sys.exit(0)
         kaa.beacon.connect()
-        kaa.netsearch.feed.update().connect(sys.exit)
+        kaa.netsearch.feed.update(verbose=all).connect(sys.exit)
         kaa.notifier.loop()
         sys.exit(0)
 
@@ -34,30 +34,39 @@
         self.tree.set_model(self.treestore)
         column = gtk.TreeViewColumn("URL", gtk.CellRendererText(), text=0)
         self.tree.append_column(column)
+        self._rebuild()
 
+    def _rebuild(self):
         self.channels = []
+        self.treestore.clear()
         for channel in kaa.netsearch.feed.list_channels():
             self.treestore.append(None, [ channel.url ])
             self.channels.append(channel)
-            
+
+    def _get_selection(self):
+        sel = self.tree.get_selection().get_selected_rows()[1]
+        if not sel:
+            return None
+        return self.channels[sel[0][0]]
+
     def on_add_clicked(self, args):
-        Edit()
+        Edit(callback=self._rebuild)
         
     def on_configure_clicked(self, args):
-        sel = self.tree.get_selection().get_selected_rows()[1]
-        if not sel:
-            return
-        Edit(self.channels[sel[0][0]])
+        if self._get_selection():
+            Edit(self._get_selection(), self._rebuild)
     
     def on_remove_clicked(self, args):
-        pass
-    
-    def on_quit_clicked(self, args):
+        if self._get_selection():
+            kaa.netsearch.feed.remove_channel(self._get_selection())
+            self._rebuild
+            
+    def quit(self, *args):
         sys.exit(0)
 
 
 class Edit(object):
-    def __init__(self, channel=None):
+    def __init__(self, channel=None, callback=None):
         self.xml = gtk.glade.XML(GLADEFILE, 'edit')
         self.xml.signal_autoconnect (self)
         self.win = self.xml.get_widget("edit")
@@ -67,7 +76,8 @@
                 self.get_widget(widget).set_text(getattr(channel, widget))
                 self.xml.get_widget(widget).set_sensitive(False)
         self.win.show()
-
+        self.callback = callback
+        
 
     def get_widget(self, name):
         return self.xml.get_widget(name)
@@ -84,7 +94,8 @@
 
     def on_cancel_clicked(self, args):
         self.win.destroy()
-
+        if self.callback:
+            self.callback()
 
     def on_ok_clicked(self, args):
         # get data
@@ -98,10 +109,16 @@
 
         if self.channel:
             self.channel.configure(download, num, keep)
+            self.win.destroy()
+            if self.callback:
+                self.callback()
             return
 
         if url and destdir:
             kaa.netsearch.feed.add_channel(url, destdir, download, num, keep)
+            self.win.destroy()
+            if self.callback:
+                self.callback()
             return
         
         # no idea how this works with glade.

Modified: trunk/WIP/netsearch/test/feedmanager.glade
==============================================================================
--- trunk/WIP/netsearch/test/feedmanager.glade  (original)
+++ trunk/WIP/netsearch/test/feedmanager.glade  Fri Sep  7 08:57:38 2007
@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.2.2 on Sat Sep  1 22:11:00 2007 by [EMAIL 
PROTECTED]>
+<!--Generated with glade3 3.2.2 on Fri Sep  7 14:55:27 2007 by [EMAIL 
PROTECTED]>
 <glade-interface>
   <widget class="GtkWindow" id="manager">
     <property name="visible">True</property>
     <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
     <property name="title" translatable="yes">Channel Manager</property>
+    <signal name="delete_event" handler="quit"/>
+    <signal name="destroy_event" handler="quit"/>
     <child>
       <widget class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
@@ -85,7 +87,7 @@
                 <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
                 <property name="label" translatable="yes">Quit</property>
                 <property name="response_id">0</property>
-                <signal name="clicked" handler="on_quit_clicked"/>
+                <signal name="clicked" handler="quit"/>
               </widget>
               <packing>
                 <property name="position">3</property>
@@ -123,16 +125,27 @@
                 <property name="n_rows">2</property>
                 <property name="n_columns">2</property>
                 <child>
-                  <widget class="GtkEntry" id="dirname">
+                  <widget class="GtkLabel" id="label1">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" translatable="yes">URL</property>
+                  </widget>
+                  <packing>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="x_padding">10</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" 
translatable="yes">Directory</property>
                   </widget>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="x_padding">10</property>
                   </packing>
                 </child>
                 <child>
@@ -147,27 +160,16 @@
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label2">
+                  <widget class="GtkEntry" id="dirname">
                     <property name="visible">True</property>
+                    <property name="can_focus">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" 
translatable="yes">Directory</property>
                   </widget>
                   <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="x_padding">10</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkLabel" id="label1">
-                    <property name="visible">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">URL</property>
-                  </widget>
-                  <packing>
-                    <property name="x_options">GTK_FILL</property>
-                    <property name="x_padding">10</property>
                   </packing>
                 </child>
               </widget>
@@ -179,6 +181,50 @@
                 <property name="n_rows">2</property>
                 <property name="n_columns">2</property>
                 <child>
+                  <widget class="GtkCheckButton" id="download">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" 
translatable="yes">Download</property>
+                    <property name="response_id">0</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="on_download_toggled"/>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkCheckButton" id="keep">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" translatable="yes">Keep 
Old</property>
+                    <property name="response_id">0</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="on_keep_toggled"/>
+                  </widget>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkCheckButton" id="all_items">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" translatable="yes">All 
Items</property>
+                    <property name="response_id">0</property>
+                    <property name="active">True</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="on_all_items_toggled"/>
+                  </widget>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
                   <widget class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
@@ -217,50 +263,6 @@
                     <property name="bottom_attach">2</property>
                   </packing>
                 </child>
-                <child>
-                  <widget class="GtkCheckButton" id="all_items">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">All 
Items</property>
-                    <property name="response_id">0</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="on_all_items_toggled"/>
-                  </widget>
-                  <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkCheckButton" id="keep">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" translatable="yes">Keep 
Old</property>
-                    <property name="response_id">0</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="on_keep_toggled"/>
-                  </widget>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <widget class="GtkCheckButton" id="download">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="label" 
translatable="yes">Download</property>
-                    <property name="response_id">0</property>
-                    <property name="active">True</property>
-                    <property name="draw_indicator">True</property>
-                    <signal name="toggled" handler="on_download_toggled"/>
-                  </widget>
-                </child>
               </widget>
               <packing>
                 <property name="position">1</property>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to