def showOpenDialogue(self, widget=None): ## Shows the open file dialogue. # Prepare the dialogue. dlg = dialogues.OpenFile(self.mainWindow, useful.lastFolder, allowSub=True) if (dlg.files): # If the response is OK, play the first file, then queue the others. # Clear the queue first though, since it is now obsolete. queue.clear() # Set the last folder, (if it exists). if (dlg.dir): useful.lastFolder = dlg.dir if dlg.chkSubs.get_active(): # If the user want's subtitles, let them choose the stream. dlg2 = dialogues.OpenFile(self.mainWindow, useful.lastFolder, multiple=False, useFilter=False, title=_("Choose a Subtitle Stream")) if dlg2.files: player.player.set_property('suburi', useful.filenameToUri(dlg2.files[0])) player.player.set_property('subtitle-encoding', cfg.getStr('video/subenc')) else: # Bail if they chose add subtitles but then clicked cancel. return # Play the first file and append the rest to the queue. self.playFile(dlg.files[0]) queue.appendMany(dlg.files[1:])
def openDroppedFiles(self, widget, context, x, y, selection_data, info, time): ## Opens a file after a drag and drop. # Split all the files that were input. uris = selection_data.data.strip().split() # Clear the current queue. queue.clear() # Add all the items to the queue. for uri in uris: path = urllib.url2pathname(urlparse.urlparse(uri)[2]) queue.append(path) # Play the first file by calling the next function. self.playNext(atf=False) # Finish the drag. context.finish(True, False, time)