Set up shelve module so that we can persist some UI info

This commit is contained in:
Anna 2010-04-16 22:44:22 -04:00
parent 6bde20333f
commit c9317af7e8

View File

@ -2,7 +2,7 @@
#
# Custom twitter client... mostly for learning Python
import sys, ConfigParser, os, re, optparse
import sys, ConfigParser, os, re, optparse, shelve
import twitter
import gtk, gtk.glade, gobject
from urllib2 import HTTPError
@ -18,10 +18,12 @@ class MyTwitter():
config.read(os.path.expanduser(config_file))
self.username = config.get('global', 'username')
self.password = config.get('global', 'password')
self.num_entries = int(config.get('global', 'entries'))
self.refresh_time = int(config.get('global', 'refreshtime'))
db_file = os.path.expanduser(config.get('global', 'dbfile'))
self.db = shelve.open(db_file)
if self.refresh_time < 10:
self.refresh_time = 10
@ -135,6 +137,7 @@ class MyTwitter():
def gtk_main_quit(self, widget):
self.db.close()
gtk.main_quit()