comparison gui/filebrowser.py @ 170:0296f5f74a0f

Fixed saving and loading that broke with changing of the settings module.
author Beliar <KarstenBock@gmx.net>
date Sat, 25 Feb 2012 22:05:39 +0100
parents 06145a6ee387
children
comparison
equal deleted inserted replaced
169:5b880b8cff6d 170:0296f5f74a0f
48 48
49 self.extensions = extensions 49 self.extensions = extensions
50 # FIXME M. George Hansen 2011-06-06: Not sure that user_path is set 50 # FIXME M. George Hansen 2011-06-06: Not sure that user_path is set
51 # correctly atm. Plus, I don't think that this should be 51 # correctly atm. Plus, I don't think that this should be
52 # hard-coded. 52 # hard-coded.
53 self.path = os.path.join(self.settings.user_path, 'saves') 53 self.path = os.path.relpath(os.path.join(self.settings.get("parpg", "DataPath"), 'saves'))
54 if not os.path.exists(self.path):
55 os.makedirs(self.path)
54 self.dir_list = [] 56 self.dir_list = []
55 self.file_list = [] 57 self.file_list = []
56 58
57 def close(self): 59 def close(self):
58 """Closes the browser""" 60 """Closes the browser"""
113 dir_list = ('..',) + filter(lambda d: not d.startswith('.'), \ 115 dir_list = ('..',) + filter(lambda d: not d.startswith('.'), \
114 self.engine.getVFS().\ 116 self.engine.getVFS().\
115 listDirectories(self.path)) 117 listDirectories(self.path))
116 file_list = filter(lambda f: f.split('.')[-1] in self.extensions, \ 118 file_list = filter(lambda f: f.split('.')[-1] in self.extensions, \
117 self.engine.getVFS().listFiles(self.path)) 119 self.engine.getVFS().listFiles(self.path))
118
119 self.dir_list = decodeList(dir_list) 120 self.dir_list = decodeList(dir_list)
120 self.file_list = decodeList(file_list) 121 self.file_list = decodeList(file_list)
121 self._widget.distributeInitialData({ 122 self._widget.distributeInitialData({
122 'dirList' : self.dir_list, 123 'dirList' : self.dir_list,
123 'fileList' : self.file_list 124 'fileList' : self.file_list