Update folder search timeout messages and ensure they are actually displayed

This commit is contained in:
Et0h 2016-06-02 14:17:47 +01:00
parent 409ad460aa
commit b1c8c9f5b2
5 changed files with 14 additions and 15 deletions

View File

@ -1621,8 +1621,8 @@ class FileSwitchManager(object):
if os.path.isfile(os.path.join(directory, randomFilename)):
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt"
if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT:
self.disabledDir = directory
self.folderSearchEnabled = False
self._client.ui.showErrorMessage(getMessage("folder-search-first-file-timeout-error").format(directory))
return
# Actual directory search
@ -1634,6 +1634,10 @@ class FileSwitchManager(object):
if time.time() - startTime > constants.FOLDER_SEARCH_TIMEOUT:
self.disabledDir = directory
self.folderSearchEnabled = False
if not self.folderSearchEnabled:
if self.disabledDir is not None:
self._client.ui.showErrorMessage(getMessage("folder-search-timeout-error").format(self.disabledDir))
self.disabledDir = None
return
if self.mediaFilesCache <> newMediaFilesCache:
@ -1665,9 +1669,9 @@ class FileSwitchManager(object):
startTime = time.time()
if os.path.isfile(os.path.join(directory, randomFilename)):
randomFilename = u"RandomFile"+unicode(random.randrange(10000, 99999))+".txt"
if not self.folderSearchEnabled:
return
if time.time() - startTime > constants.FOLDER_SEARCH_FIRST_FILE_TIMEOUT:
self.disabledDir = directory
self.folderSearchEnabled = False
return
startTime = time.time()

View File

@ -137,7 +137,8 @@ de = {
"invalid-offset-value" : u"Ungültiger Offset-Wert",
"switch-file-not-found-error" : u"Konnte nicht zur Datei '{0}' wechseln. Syncplay looks in the specified media directories.", # File not found, folder it was not found in # TODO: Re-translate "Syncplay sucht im Ordner der aktuellen Datei und angegebenen Medien-Verzeichnissen." to reference to checking in "current media directory"
"folder-search-timeout-error" : u"Die Suche nach Mediendateien in '{}' wurde abgebrochen weil sie zu lange gedauert hat. Dies tritt auf, wenn ein zu durchsuchender Medienordner zu viele Unterordner hat. Syncplay wird bis zum Neustart nur noch das Verzeichnis der aktuellen Datei durchsuchen.", #Folder
"folder-search-timeout-error" : u"The search for media in media directories was aborted as it took too long to search through '{}'. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. For automatic file switching to work again please remove this directory as a media directory (optionally using a sub-directory instead) and re-open Syncplay.", #Folder # TODO: Re-translate using new language
"folder-search-first-file-timeout-error" : u"The search for media in '{}' was aborted as it took too long to access the directory. This could happen if it is a network drive or if you configure your drive to spin down after a period of inactivity. For automatic file switching to work again please remove this directory as a media directory or resolve the issue (e.g. by changing power saving settings) and re-open Syncplay.", #Folder # TODO: Translate
"failed-to-load-server-list-error" : u"Konnte die Liste der öffentlichen Server nicht laden. Bitte besuche http://www.syncplay.pl/ [Englisch] mit deinem Browser.",

View File

@ -136,8 +136,9 @@ en = {
"invalid-seek-value" : u"Invalid seek value",
"invalid-offset-value" : u"Invalid offset value",
"switch-file-not-found-error" : u"Could not switch to file '{0}'. Syncplay looks specified media directories.", # File not found
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder
"switch-file-not-found-error" : u"Could not switch to file '{0}'. Syncplay looks in specified media directories.", # File not found
"folder-search-timeout-error" : u"The search for media in media directories was aborted as it took too long to search through '{}'. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. For automatic file switching to work again please remove this directory as a media directory (optionally using a sub-directory instead) and re-open Syncplay.", #Folder
"folder-search-first-file-timeout-error" : u"The search for media in '{}' was aborted as it took too long to access the directory. This could happen if it is a network drive or if you configure your drive to spin down after a period of inactivity. For automatic file switching to work again please remove this directory as a media directory or resolve the issue (e.g. by changing power saving settings) and re-open Syncplay.", #Folder
"failed-to-load-server-list-error" : u"Failed to load public server list. Please visit http://www.syncplay.pl/ in your browser.",

View File

@ -137,7 +137,8 @@ ru = {
"invalid-offset-value" : u"Некорректное смещение",
"switch-file-not-found-error" : u"Невозможно переключиться на файл '{0}'. Syncplay looks in the folder specified media directories.", # File not found # TODO: Translate last part into Russian
"folder-search-timeout-error" : u"The search for media in '{}' was aborted as it took too long. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. Until Syncplay is restarted only the directory of the currently open file will be checked.", #Folder # TODO: Translate into Russian
"folder-search-timeout-error" : u"The search for media in media directories was aborted as it took too long to search through '{}'. This will occur if you select a folder with too many sub-folders in your list of media folders to search through. For automatic file switching to work again please remove this directory as a media directory (optionally using a sub-directory instead) and re-open Syncplay.", #Folder # TODO: Translate
"folder-search-first-file-timeout-error" : u"The search for media in '{}' was aborted as it took too long to access the directory. This could happen if it is a network drive or if you configure your drive to spin down after a period of inactivity. For automatic file switching to work again please remove this directory as a media directory or resolve the issue (e.g. by changing power saving settings) and re-open Syncplay.", #Folder # TODO: Translate
"failed-to-load-server-list-error" : u"Failed to load public server list. Please visit http://www.syncplay.pl/ in your browser.", # TODO: Translate into Russian

View File

@ -458,7 +458,6 @@ class MainWindow(QtGui.QMainWindow):
self.listTreeView.expandAll()
self.updateListGeometry()
self._syncplayClient.fileSwitch.setFilenameWatchlist(self.newWatchlist)
self.checkForDisabledDir()
@needsClient
def undoPlaylistChange(self):
@ -544,13 +543,6 @@ class MainWindow(QtGui.QMainWindow):
return
menu.exec_(self.listTreeView.viewport().mapToGlobal(position))
@needsClient
def checkForDisabledDir(self):
if self._syncplayClient.fileSwitch.disabledDir is not None and self._syncplayClient.fileSwitch.currentWindow is not None:
self.showErrorMessage(getMessage("folder-search-timeout-error").format(self._syncplayClient.fileSwitch.disabledDir))
self._syncplayClient.fileSwitch.disabledDir = None
def updateListGeometry(self):
try:
roomtocheck = 0