def openFile(self, near = None): fileDialog = Q.QFileDialog(self) fileDialog.setAcceptMode(Q.QFileDialog.AcceptOpen) fileDialog.setFileMode(Q.QFileDialog.ExistingFiles) fileDialog.setFilter(Q.QDir.Hidden|Q.QDir.AllEntries|Q.QDir.System) fileDialog.setViewMode(Q.QFileDialog.Detail) if near is not None: if isinstance(near,str): near = Q.QFileInfo(near) if isinstance(near,Q.QFileInfo): if near.isDir(): near = Q.QDir(near.filePath()) else: near = near.dir() if not isinstance(near,Q.QDir): near = Q.QDir.home() fileDialog.setDirectory(near.canonicalPath()) if fileDialog.exec(): if fileDialog.selectedFiles(): if not self.player: # return self.player = self._parent.getPlayerAt(-1) for filePath in fileDialog.selectedFiles(): print("\n"+filePath+"\n") self.player.command("loadfile",str(filePath),"append-play") w = self.player.widget if w:w.sized_once = False
def browseForWoWFolder(self): selectedDir = Qt.QFileDialog.getExistingDirectory(self, self.tr("Select Wow Install Folder"), self.wowInstallFolder.text(), Qt.QFileDialog.ShowDirsOnly | Qt.QFileDialog.DontResolveSymlinks) if selectedDir: directory = Qt.QDir("{}/_retail_/Interface/AddOns".format(selectedDir)) if directory.exists(): self.wowInstallFolder.setText(selectedDir) else: Qt.QMessageBox.warning(self, self.tr("Not Wow-Folder"), self.tr( "The selected folder wasn't an installation directory of wow.\nPlease select the wow folder"))