def onOk(self, event): super(audioConverterOptionsDialog, self).onOk(event) for pos, val in enumerate(availableConversionFormats.keys()): if self.conversionFormatChoice.GetSelection()==pos: addonConfig.conf['converter']['format']=val for pos, val in enumerate(availableConversionQualities.keys()): if self.conversionQualityChoice.GetSelection()==pos: addonConfig.conf['converter']['quality']=val addonConfig.save()
def onChooseDownloadFolderClicked(self, evt): dlg=wx.DirDialog(gui.mainFrame, # Translators: label of a dialog for choosing download folder. _("Select a folder for downloading videos"), addonConfig.conf['downloader']['path'], wx.DD_DEFAULT_STYLE) gui.mainFrame.prePopup() result=dlg.ShowModal() gui.mainFrame.postPopup() if result == wx.ID_OK: addonConfig.conf['downloader']['path']=dlg.GetPath() addonConfig.save()
def __init__(self): super(globalPluginHandler.GlobalPlugin, self).__init__() if globalVars.appArgs.secure: return if addonConfig.conf['downloader']['path'] == "currentUserFolder": addonConfig.conf['downloader']['path'] = os.path.expanduser("~") addonConfig.save() self.menu = gui.mainFrame.sysTrayIcon.menu self.youtubeDownloaderSubmenu = wx.Menu() self.audioConverterOptionsMenuItem = self.youtubeDownloaderSubmenu.Append( wx.ID_ANY, # Translators: the name for an item of addon submenu. _("Audio &converter options..."), # Translators: the tooltip text for an item of addon submenu. _("Displays a dialog box for audio converter setup")) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onAudioConverterOptionsClicked, self.audioConverterOptionsMenuItem) self.downloadsFolderMenuItem = self.youtubeDownloaderSubmenu.Append( wx.ID_ANY, # Translators: the name for an item of addon submenu. _("View &downloaded videos"), # Translators: the tooltip text for an item of addon submenu. _("Opens a folder with downloaded videos")) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onDownloadsFolderClicked, self.downloadsFolderMenuItem) self.chooseDownloadFolderMenuItem = self.youtubeDownloaderSubmenu.Append( wx.ID_ANY, # Translators: the name for an item of addon submenu. _("Choose download &folder..."), # Translators: the tooltip text for an item of addon submenu. _("Opens a Windows dialog box to choose a folder in which videos will be downloaded" )) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onChooseDownloadFolderClicked, self.chooseDownloadFolderMenuItem) self.openSiteMenuItem = self.youtubeDownloaderSubmenu.Append( wx.ID_ANY, # Translators: A lebel that means to open the website of this add-on _("Open the NVDA Youtube-dl &website..."), # Translators: the tooltip text for a menu ite that opens the add-on website _("Opens the website for this add-on")) gui.mainFrame.sysTrayIcon.Bind( wx.EVT_MENU, lambda evt: os.startfile( "https://github.com/oliver2213/NVDAYoutube-dl"), self.openSiteMenuItem) self.youtubeDownloaderMenuItem = self.menu.InsertMenu( 2, wx.ID_ANY, # Translators: the name of addon submenu. _("&Youtube-dl"), self.youtubeDownloaderSubmenu)
def onChooseDownloadFolderClicked(self, evt): dlg = wx.DirDialog( gui.mainFrame, # Translators: label of a dialog for choosing download folder. _("Select a folder for downloading videos"), addonConfig.conf['downloader']['path'], wx.DD_DEFAULT_STYLE) gui.mainFrame.prePopup() result = dlg.ShowModal() gui.mainFrame.postPopup() if result == wx.ID_OK: addonConfig.conf['downloader']['path'] = dlg.GetPath() addonConfig.save()
def __init__(self): super(globalPluginHandler.GlobalPlugin, self).__init__() if globalVars.appArgs.secure: return if addonConfig.conf['downloader']['path']=="currentUserFolder": addonConfig.conf['downloader']['path']=os.path.expanduser("~") addonConfig.save() self.menu=gui.mainFrame.sysTrayIcon.menu self.youtubeDownloaderSubmenu=wx.Menu() self.audioConverterOptionsMenuItem=self.youtubeDownloaderSubmenu.Append(wx.ID_ANY, # Translators: the name for an item of addon submenu. _("Audio &converter options..."), # Translators: the tooltip text for an item of addon submenu. _("Displays a dialog box for audio converter setup")) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onAudioConverterOptionsClicked, self.audioConverterOptionsMenuItem) self.downloadsFolderMenuItem=self.youtubeDownloaderSubmenu.Append(wx.ID_ANY, # Translators: the name for an item of addon submenu. _("View &downloaded videos"), # Translators: the tooltip text for an item of addon submenu. _("Opens a folder with downloaded videos")) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onDownloadsFolderClicked, self.downloadsFolderMenuItem) self.chooseDownloadFolderMenuItem=self.youtubeDownloaderSubmenu.Append(wx.ID_ANY, # Translators: the name for an item of addon submenu. _("Choose download &folder..."), # Translators: the tooltip text for an item of addon submenu. _("Opens a Windows dialog box to choose a folder in which videos will be downloaded")) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onChooseDownloadFolderClicked, self.chooseDownloadFolderMenuItem) self.openSiteMenuItem=self.youtubeDownloaderSubmenu.Append(wx.ID_ANY, # Translators: A lebel that means to open the website of this add-on _("Open the NVDA Youtube-dl &website..."), # Translators: the tooltip text for a menu ite that opens the add-on website _("Opens the website for this add-on")) gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, lambda evt: os.startfile("https://github.com/oliver2213/NVDAYoutube-dl"), self.openSiteMenuItem) self.youtubeDownloaderMenuItem=self.menu.InsertMenu(2, wx.ID_ANY, # Translators: the name of addon submenu. _("&Youtube-dl"), self.youtubeDownloaderSubmenu)