def canDeleteConfigurationFolder(self): if self.isVLCRunning(): # Translators: message to inform the user than VLC is running. msg = _( "You must stop VLC application before delete configuration folder" ) # Translators: title of message box. dialogTitle = _("Warning") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK | wx.ICON_WARNING) return False if not self.vlcInitialized: # Translators: message to inform the user than VLC is not initialized. msg = _( "Impossible, VLC application is not installed or initialized") # Translators: title of message box. dialogTitle = _("Warning") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK | wx.ICON_WARNING) return False return True
def onDeleteVLCFolder(self, evt): if messageBox( # Translators: message to user # to confirm the deletion of VLC configuration folder. _("Do you want really to delete VLC configuration folder ?"), # Translators: title of message box. makeAddonWindowTitle(_("Confirmation")), wx.YES | wx.NO) == wx.NO: return vlc = vlc_settingsHandler.VLCSettings(_curAddon) wx.CallLater(100, vlc.deleteConfigurationFolder) self.Destroy()
def update(self): speech.cancelSpeech() # Translators: message to the user. speech.speakMessage(_("Please wait")) newVLCKeys = self.localeSettings.getVLCKeysToUpdate() if newVLCKeys is None: # no vlcrc modification # Translators: message to user than there is no VLC keys to modify. msg = _("There is no key modification to do") # Translators: title of message box. dialogTitle = _("Information") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK) return if not self.canUpdateVlcrcFile(): return text = self.getNewVLCKeysHelp() if messageBox( # Translators: message to ask the user if he accepts the update. text + ". " + _("Are you OK?"), # Translators: title of message box. _("%s add-on - Confirmation") % self.addon.manifest["summary"], wx.OK | wx.CANCEL) == wx.CANCEL: return lines = self._firstPass(newVLCKeys) lines = self._secondPass(lines, newVLCKeys) dest = os.path.join(self.vlcSettingsDir, "vlcrc.old") if os.path.exists(dest): os.remove(dest) shutil.copy(self.vlcrcFile, dest) try: shutil.copy(self.vlcrcFile, dest) except Exception: log.warning("vlcrc file cannot be copied to old file") self.save(lines) # Translators: message to inform the user than olcrc file has been updated. msg = _("VLC configuration file has been updated") # Translators: title of message box. dialogTitle = _("Information") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK)
def canUpdateVlcrcFile(self): if self.isVLCRunning(): # Translators: message to inform the user than VLC is running. msg = _( "You must stop VLC application before modify VLC configuration file" ) # Translators: title of message box. dialogTitle = _("Warning") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK | wx.ICON_WARNING) return False if not self.vlcInitialized: # Translators: message to inform the user than VLC is not initialized. msg = _( "Impossible, VLC application is not installed or initialized") # Translators: title of message box. dialogTitle = _("Warning") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK | wx.ICON_WARNING) return False if not self.exist(): # Translators: message to inform the user than VLC is not initialized. msg = _("Error, VLC configuration is not found") # Translators: title of message box. dialogTitle = _("Warning") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK | wx.ICON_WARNING) return False return True
def deleteConfigurationFolder(self): printDebug("deleteConfigurationFolder") if not self.canDeleteConfigurationFolder(): return try: shutil.rmtree(self.vlcSettingsDir) # Translators: message to user: VLC configuration folder has been deleted"), msg = _("VLC configuration folder (%s) has been deleted. " "Before modify VLC shortcuts, you must start VLC once." ) % self.vlcSettingsDir # Translators: title of message box. dialogTitle = _("Information") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK | wx.ICON_WARNING) except OSError: # Translators: message to user: VLC configuration folder cannot be deleted. msg = _("VLC configuration folder \"%s\" cannot be deleted" ) % self.vlcSettingsDir # Translators: title of message box. dialogTitle = _("Error") messageBox(msg, makeAddonWindowTitle(dialogTitle), wx.OK | wx.ICON_WARNING)
def recordFileToResume(self, resumeTime): currentFileName = self.getFullFilePath() if currentFileName in self.addonConfig[SCT_ResumeFiles]: # Translators: Message shown to ask user to modify resume time. msg = _("Do you want to modify resume time for this media ?") # Translators: title of message box title = makeAddonWindowTitle(_("Confirmation")) res = messageBox(msg, title, wx.OK | wx.CANCEL) if res == wx.CANCEL: return False self.addonConfig[SCT_ResumeFiles][currentFileName] = getTimeString(resumeTime) self.saveSettings(True) return True
def callback(resumeTime): res = messageBox( # Translators: message to ask the user if he want to resume playback. _("Do you want to resume Playback at %s") % formatTime(resumeTime), # Translators: title of message box. makeAddonWindowTitle(_("Confirmation")), wx.OK | wx.CANCEL) if res == wx.CANCEL: return mainWindow = self.appModule.mainWindow totalTime = getTimeList(mainWindow.getTotalTime()) jumpTime = getTimeList(resumeTime) wx.CallLater( 200, mainWindow.jumpToTime, jumpTime, totalTime, startPlaying=True)