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 __init__(self, parent, ID, curTime, totalTime, mainWindow):
		self.mainWindow = mainWindow
		self.destroyed = False
		# Translators: title of go to time dialog.
		title = makeAddonWindowTitle(_("Go to time"))
		super(GoToTimeDialog, self).__init__(parent, ID, title, size=(290, 130))
		self.curTime = curTime
		self.totalTime = totalTime
		self.timer = None
		self.jumpTime = None
		self.doGui()
 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 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 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 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 createSubMenu(self):
     self.prefsMenu = gui.mainFrame.sysTrayIcon.preferencesMenu
     menu = wx.Menu()
     self.vlcSettingsMenu = self.prefsMenu.AppendSubMenu(
         menu,
         # Translators: label of the add-on settings menu.
         makeAddonWindowTitle(_("settings ...")),
         # Translators: the tooltip text for addon submenu.
         makeAddonWindowTitle(_("Settings menu")))
     settingsSubMenu = menu.Append(
         wx.ID_ANY,
         # Translators: name of the option in the menu.
         _("Settings") + "...",
         "")
     gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onSettingsMenu,
                                    settingsSubMenu)
     vlcConfigSubMenu = menu.Append(
         wx.ID_ANY,
         # Translators: name of the option in the menu.
         _("VLC's configuration") + "...",
         "")
     gui.mainFrame.sysTrayIcon.Bind(wx.EVT_MENU, self.onVLCConfigMenu,
                                    vlcConfigSubMenu)
Example #9
0
		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)
Example #10
0
	def script_hotKeyHelp(self, gesture):
		helpMsg = []
		# Translators: title of script gesture help.
		helpMsg.append(_("Add-on's Input gestures:"))
		for identifier in self._gestureMap:
			scriptDoc = self._gestureMap[identifier].__doc__
			if scriptDoc:
				(layout, keyName) = keyboardHandler.KeyboardInputGesture.getDisplayTextForIdentifier(identifier)  # noqa:E501
				helpMsg.append("%s %s" % (scriptDoc, keyName))
		helpMsg.append("")
		vlcHelp = self.appModule.vlcrcSettings.vlcHotKeyHelpText()
		helpMsg.append(vlcHelp)
		text = "\n".join(helpMsg)
		# Translators: title of main window shortcut help window.
		title = makeAddonWindowTitle(_("main window help"))
		wx.CallAfter(MessageBox.run, title, text)
class VLCConfigurationDialog(SettingsDialog):
    # Translators: The title of the VLC configuration dialog.
    title = makeAddonWindowTitle(_("VLC's configuration"))

    def makeSettings(self, settingsSizer):
        settingsSizerHelper = gui.guiHelper.BoxSizerHelper(self,
                                                           sizer=settingsSizer)
        bHelper = gui.guiHelper.ButtonHelper(wx.HORIZONTAL)
        self.modifyVLCShortcutsButton = bHelper.addButton(
            self,
            # Translators: The label of a button
            # to modify vlc shortcuts in the vlc configuration dialog.
            label=_("&Modify vlc shortcuts"))
        self.modifyVLCShortcutsButton.Bind(wx.EVT_BUTTON, self.onModify)

        self.deleteVLCFolder = bHelper.addButton(
            self,
            # Translators: The label of a button
            # to delete vlc configuration folder in VLC configuration dialog.
            label=_("&Delete VLC configuration folder"))
        self.deleteVLCFolder.Bind(wx.EVT_BUTTON, self.onDeleteVLCFolder)
        settingsSizer.Add(bHelper.sizer)

    def postInit(self):
        self.modifyVLCShortcutsButton.SetFocus()

    def onModify(self, evt):
        vlcrc = vlc_settingsHandler.Vlcrc()
        wx.CallLater(100, vlcrc.update)
        self.Destroy()

    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()