remember dir of last loaded torrent - eternalswd

This commit is contained in:
Marcos Pinto 2007-07-09 04:40:34 +00:00
parent 51eb0040e3
commit 11eecbc293
2 changed files with 7 additions and 2 deletions

View File

@ -28,11 +28,11 @@
# this exception statement from your version. If you delete this exception # this exception statement from your version. If you delete this exception
# statement from all source files in the program, then also delete it here. # statement from all source files in the program, then also delete it here.
import common, dgtk import common, dgtk, pref
import gtk, gtk.glade import gtk, gtk.glade
import os, os.path import os, os.path
PREFS_FILENAME = "prefs.state"
class PreferencesDlg: class PreferencesDlg:
def __init__(self, parent, preferences): def __init__(self, parent, preferences):
@ -278,6 +278,8 @@ def show_file_open_dialog(parent=None, title=None):
f1 = gtk.FileFilter() f1 = gtk.FileFilter()
f1.set_name(_("All files")) f1.set_name(_("All files"))
f1.add_pattern("*") f1.add_pattern("*")
loadpref = pref.Preferences(os.path.join('%s %s'%(common.PROGRAM_NAME, common.PROGRAM_VERSION), PREFS_FILENAME))
chooser.set_current_folder(loadpref.get("default_load_path"))
chooser.add_filter(f1) chooser.add_filter(f1)
chooser.set_select_multiple(True) chooser.set_select_multiple(True)
@ -287,6 +289,7 @@ def show_file_open_dialog(parent=None, title=None):
response = chooser.run() response = chooser.run()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
result = chooser.get_filenames() result = chooser.get_filenames()
loadpref.set("default_load_path", chooser.get_current_folder())
else: else:
result = None result = None
chooser.destroy() chooser.destroy()

View File

@ -35,12 +35,14 @@
import pickle import pickle
import common import common
import os.path
DEFAULT_PREFS = { DEFAULT_PREFS = {
"auto_end_seeding" : False, "auto_end_seeding" : False,
"auto_seed_ratio" : 0, "auto_seed_ratio" : 0,
"close_to_tray" : False, "close_to_tray" : False,
"default_download_path" : "", "default_download_path" : "",
"default_load_path" : os.path.expanduser("~/"),
"enable_dht" : True, "enable_dht" : True,
"enable_system_tray" : True, "enable_system_tray" : True,
"enabled_plugins" : "", "enabled_plugins" : "",