def __init__(self, _filePath, _isOpenDetailsOnNewWindow): try: if uni.getBoolValue("isForceOpenWithDefaultApplication"): _path = fu.checkSource(_filePath) Execute.openWith([_path]) else: _path = fu.checkSource(_filePath, "file", False) if _path is not None: isOpened = False mtype = fu.getMimeType(_path) if mtype[0] is not None: if mtype[0].split("/")[0] == "text": TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow) isOpened = True elif mtype[0].split("/")[0] == "audio": if Taggers.getTagger(True) is not None: MusicDetails.MusicDetails(_path, _isOpenDetailsOnNewWindow) isOpened = True elif mtype[0].split("/")[0] == "image": ImageDetails.ImageDetails(_path, "file", _isOpenDetailsOnNewWindow) isOpened = True elif fu.isBinary(_path) is False: TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow) isOpened = True else: if fu.isBinary(_path) is False: TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow) isOpened = True if isOpened is False: if uni.getBoolValue("isOpenWithDefaultApplication"): Execute.openWith([_path]) else: Dialogs.showError(translate("Details", "File Is Not Supported"), str(translate("Details", "\"%s\" couldn't opened. This file is not supported.")) % Organizer.getLink( str(_path))) elif fu.isDir(_filePath): if uni.getBoolValue("isOpenWithDefaultApplication"): Execute.openWith([_filePath]) else: Dialogs.showError(translate("Details", "Directories Is Not Supported"), str(translate("Details", "\"%s\" couldn't opened. Directories is not supported to show details.")) % Organizer.getLink( str(_filePath))) else: Dialogs.showError(translate("Details", "File Is Not Exist"), str(translate("Details", "\"%s\" couldn't opened. This file is not exist.")) % Organizer.getLink( str(_filePath))) except: answer = Dialogs.askSpecial(translate("Details", "File Couldn't Opened"), str(translate("Details", "\"%s\" couldn't opened. This file may is not supported. <br>If you think this is a bug, please report us.")) % Organizer.getLink( str(_filePath)), translate("QuickMake", "Report This Bug"), translate("QuickMake", "OK"), None) if answer == translate("QuickMake", "Report This Bug"): ReportBug.ReportBug()
def setSourceToSearch(self, _isReload=True, _isLoadFromCache=False): try: if self.sourceToSearch is None or _isReload: sourceToSearch = "" self.isMultipleSource = False pathToSearchs = str(self.lePathToSeach.text()) if fu.isExist(pathToSearchs) is False and pathToSearchs.find(";") != -1: self.isMultipleSource = True for pathToSearch in uni.getListFromListString(pathToSearchs, ";"): if pathToSearch in self.sourceToSearchCache and _isLoadFromCache: sourceToSearch += self.sourceToSearchCache[pathToSearch] else: pathToSearch = fu.checkSource(pathToSearch) if pathToSearch is not None: if fu.isReadableFileOrDir(pathToSearch): if fu.isFile(pathToSearch) and fu.isBinary(pathToSearch) is False: sts = fu.readFromFile(pathToSearch) + "\n" sourceToSearch += sts self.sourceToSearchCache[pathToSearch] = sts elif fu.isDir(pathToSearch): sts = fu.getFileTree(pathToSearch, -1, "return", "plainText", "fileList") + "\n" sourceToSearch += sts self.sourceToSearchCache[pathToSearch] = sts self.sourceToSearch = sourceToSearch if sourceToSearch != "": return True return False else: return True except: ReportBug.ReportBug()
def setSourceToSearch(self, _isReload=True, _isLoadFromCache=False): try: if self.sourceToSearch is None or _isReload: sourceToSearch = "" self.isMultipleSource = False pathToSearchs = str(self.lePathToSeach.text()) if fu.isExist(pathToSearchs) is False and pathToSearchs.find( ";") != -1: self.isMultipleSource = True for pathToSearch in uni.getListFromListString( pathToSearchs, ";"): if pathToSearch in self.sourceToSearchCache and _isLoadFromCache: sourceToSearch += self.sourceToSearchCache[ pathToSearch] else: pathToSearch = fu.checkSource(pathToSearch) if pathToSearch is not None: if fu.isReadableFileOrDir(pathToSearch): if fu.isFile(pathToSearch) and fu.isBinary( pathToSearch) is False: sts = fu.readFromFile(pathToSearch) + "\n" sourceToSearch += sts self.sourceToSearchCache[ pathToSearch] = sts elif fu.isDir(pathToSearch): sts = fu.getFileTree( pathToSearch, -1, "return", "plainText", "fileList") + "\n" sourceToSearch += sts self.sourceToSearchCache[ pathToSearch] = sts self.sourceToSearch = sourceToSearch if sourceToSearch != "": return True return False else: return True except: ReportBug.ReportBug()
def __init__(self, _filePath, _isOpenDetailsOnNewWindow): try: if uni.getBoolValue("isForceOpenWithDefaultApplication"): _path = fu.checkSource(_filePath) Execute.openWith([_path]) else: _path = fu.checkSource(_filePath, "file", False) if _path is not None: isOpened = False mtype = fu.getMimeType(_path) if mtype[0] is not None: if mtype[0].split("/")[0] == "text": TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow) isOpened = True elif mtype[0].split("/")[0] == "audio": if Taggers.getTagger(True) is not None: MusicDetails.MusicDetails( _path, _isOpenDetailsOnNewWindow) isOpened = True elif mtype[0].split("/")[0] == "image": ImageDetails.ImageDetails( _path, "file", _isOpenDetailsOnNewWindow) isOpened = True elif fu.isBinary(_path) is False: TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow) isOpened = True else: if fu.isBinary(_path) is False: TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow) isOpened = True if isOpened is False: if uni.getBoolValue("isOpenWithDefaultApplication"): Execute.openWith([_path]) else: Dialogs.showError( translate("Details", "File Is Not Supported"), str( translate( "Details", "\"%s\" couldn't opened. This file is not supported." )) % Organizer.getLink(str(_path))) elif fu.isDir(_filePath): if uni.getBoolValue("isOpenWithDefaultApplication"): Execute.openWith([_filePath]) else: Dialogs.showError( translate("Details", "Directories Is Not Supported"), str( translate( "Details", "\"%s\" couldn't opened. Directories is not supported to show details." )) % Organizer.getLink(str(_filePath))) else: Dialogs.showError( translate("Details", "File Is Not Exist"), str( translate( "Details", "\"%s\" couldn't opened. This file is not exist." )) % Organizer.getLink(str(_filePath))) except: answer = Dialogs.askSpecial( translate("Details", "File Couldn't Opened"), str( translate( "Details", "\"%s\" couldn't opened. This file may is not supported. <br>If you think this is a bug, please report us." )) % Organizer.getLink(str(_filePath)), translate("QuickMake", "Report This Bug"), translate("QuickMake", "OK"), None) if answer == translate("QuickMake", "Report This Bug"): ReportBug.ReportBug()