Use first mediaSearch directory as first choice for open file initial directory, followed by directory of currently open file

This commit is contained in:
Et0h 2015-08-25 10:01:41 +01:00
parent c66ae60d43
commit bb2308c0c9
2 changed files with 10 additions and 2 deletions

View File

@ -229,7 +229,9 @@ class ConfigDialog(QtGui.QDialog):
def browseMediapath(self):
self.loadMediaBrowseSettings()
options = QtGui.QFileDialog.Options()
if os.path.isdir(self.mediadirectory):
if self.config["mediaSearchDirectories"] and os.path.isdir(self.config["mediaSearchDirectories"][0]):
defaultdirectory = self.config["mediaSearchDirectories"][0]
elif os.path.isdir(self.mediadirectory):
defaultdirectory = self.mediadirectory
elif os.path.isdir(QDesktopServices.storageLocation(QDesktopServices.MoviesLocation)):
defaultdirectory = QDesktopServices.storageLocation(QDesktopServices.MoviesLocation)

View File

@ -417,7 +417,13 @@ class MainWindow(QtGui.QMainWindow):
self.loadMediaBrowseSettings()
options = QtGui.QFileDialog.Options()
if os.path.isdir(self.mediadirectory):
self.mediadirectory = ""
currentdirectory = os.path.dirname(self._syncplayClient.userlist.currentUser.file["path"]) if self._syncplayClient.userlist.currentUser.file else None
if currentdirectory and os.path.isdir(currentdirectory):
defaultdirectory = currentdirectory
elif self.config["mediaSearchDirectories"] and os.path.isdir(self.config["mediaSearchDirectories"][0]):
defaultdirectory = self.config["mediaSearchDirectories"][0]
elif os.path.isdir(self.mediadirectory):
defaultdirectory = self.mediadirectory
elif os.path.isdir(QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.MoviesLocation)):
defaultdirectory = QtGui.QDesktopServices.storageLocation(QtGui.QDesktopServices.MoviesLocation)