conduit r1903 - in trunk: . conduit/modules
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1903 - in trunk: . conduit/modules
- Date: Mon, 23 Feb 2009 21:17:24 +0000 (UTC)
Author: jstowers
Date: Mon Feb 23 21:17:23 2009
New Revision: 1903
URL: http://svn.gnome.org/viewvc/conduit?rev=1903&view=rev
Log:
2009-02-24 John Stowers <john stowers gmail com>
* conduit/modules/GoogleBookmarksModule.py:
Port to new config system.
Modified:
trunk/ChangeLog
trunk/conduit/modules/GoogleBookmarksModule.py
Modified: trunk/conduit/modules/GoogleBookmarksModule.py
==============================================================================
--- trunk/conduit/modules/GoogleBookmarksModule.py (original)
+++ trunk/conduit/modules/GoogleBookmarksModule.py Mon Feb 23 21:17:23 2009
@@ -5,8 +5,7 @@
import conduit
import conduit.dataproviders.DataProvider as DataProvider
-from conduit.datatypes.Bookmark import Bookmark
-import conduit.Web as Web
+import conduit.datatypes.Bookmark as Bookmark
import urllib2
from xml.dom.minidom import parse
@@ -26,13 +25,16 @@
_configurable_ = True
def __init__( self ):
- self.Bookmarks = []
- self.username = ""
- self.password = ""
DataProvider.DataSource.__init__( self )
+ self.update_configuration(
+ username = "",
+ password = ""
+ )
+ self.Bookmarks = []
def refresh( self ):
- #self.Bookmarks = []
+ DataProvider.DataSource.refresh( self )
+ self.Bookmarks = []
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password( 'Google Search History', 'www.google.com', self.username, self.password )
opener = urllib2.build_opener( auth_handler )
@@ -40,10 +42,10 @@
for item in parse( bookmark_feed ).documentElement.getElementsByTagName( "item" ):
title = item.getElementsByTagName( "title" )[0].childNodes[0].data
link = item.getElementsByTagName( "link" )[0].childNodes[0].data
- bookmark = Bookmark( title, link )
+ bookmark = Bookmark.Bookmark( title, link )
bookmark.set_UID( bookmark.get_hash() )
self.Bookmarks.append( bookmark )
- DataProvider.DataSource.refresh( self )
+ print self.Bookmarks
def get_all( self ):
DataProvider.DataSource.get_all( self )
@@ -59,39 +61,15 @@
return bookmark
def get_UID( self ):
- return "GoogleBookmarks"
-
- def configure( self, window ):
- # Thanks to the wiki for this
- import gtk
- import conduit.gtkui.SimpleConfigurator as SimpleConfigurator
-
- PasswordEntry = gtk.Entry()
- gtk.Entry().set_visibility( False )
-
- items = [
- {
- "Name" : "Username",
- "Kind" : "text",
- "Callback" : self.set_username,
- "InitialValue" : str( self.username )
- },
- {
- "Name" : "Password",
- "Kind" : "password",
- "Callback" : self.set_password,
- "InitialValue" : str( self.password )
- }
- ]
- dialog = SimpleConfigurator.SimpleConfigurator( window, self._name_, items )
- dialog.run()
- self.refresh()
-
- def set_username( self, username ):
- self.username = username
+ return self.username
- def set_password( self, password ):
- self.password = password
+ def config_setup(self, config):
+ config.add_section("Login Details")
+ config.add_item("Username", "text",
+ config_name = "username",
+ )
+ config.add_item("Password", "text",
+ config_name = "password",
+ password = True
+ )
- def get_configuration( self ):
- return { "username" : self.username, "password" : self.password }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]