コード例 #1
0
ファイル: __init__.py プロジェクト: bdorer/NVDARemote
	def do_connect(self, evt):
		evt.Skip()
		last_cons = configuration.get_config()['connections']['last_connected']
		last = ''
		if last_cons:
			last = last_cons[-1]
		# Translators: Title of the connect dialog.
		dlg = dialogs.DirectConnectDialog(parent=gui.mainFrame, id=wx.ID_ANY, title=_("Connect"))
		dlg.panel.host.SetValue(last)
		dlg.panel.host.SelectAll()
		def handle_dlg_complete(dlg_result):
			if dlg_result != wx.ID_OK:
				return
			if dlg.client_or_server.GetSelection() == 0: #client
				server_addr = dlg.panel.host.GetValue()
				server_addr, port = address_to_hostport(server_addr)
				channel = dlg.panel.key.GetValue()
				if dlg.connection_type.GetSelection() == 0:
					self.connect_as_master((server_addr, port), channel)
				else:
					self.connect_as_slave((server_addr, port), channel)
			else: #We want a server
				channel = dlg.panel.key.GetValue()
				self.start_control_server(int(dlg.panel.port.GetValue()), channel)
				if dlg.connection_type.GetSelection() == 0:
					self.connect_as_master(('127.0.0.1', int(dlg.panel.port.GetValue())), channel)
				else:
					self.connect_as_slave(('127.0.0.1', int(dlg.panel.port.GetValue())), channel)
		gui.runScriptModalDialog(dlg, callback=handle_dlg_complete)
コード例 #2
0
    def script_saveMousePosition(self, gesture):
        x, y = winUser.getCursorPos()
        # Stringify coordinates early.
        x, y = str(x), str(y)
        # Translators: edit field label for new mouse position.
        d = EnterPositionName(
            gui.mainFrame,
            _("Enter the name for the current mouse position (x: {x}, Y: {y})".
              format(x=x, y=y)),
            # Translators: title for save mouse position dialog.
            _("Save mouse position"))

        def callback(result):
            if result == wx.ID_OK:
                name = d.GetValue().rstrip()
                if name == "": return
                appName = self.getMouse().appModule.appName
                # If the files path does not exist, create it now.
                if not os.path.exists(GCMousePositions):
                    os.mkdir(GCMousePositions)
                position = ConfigObj(os.path.join(GCMousePositions,
                                                  appName + ".gc"),
                                     encoding="UTF-8")
                position[name] = ",".join([x, y])
                position.write()
                # Translators: presented when position (tag) has been saved.
                ui.message(_("Position saved in %s.") % position.filename)

        gui.runScriptModalDialog(d, callback)
コード例 #3
0
ファイル: __init__.py プロジェクト: Oliver2213/NVDARemote
	def do_connect(self, evt):
		if evt != 'gesture':
			evt.Skip()
		last_cons = get_config()['connections']['last_connected']
		last = ''
		if last_cons:
			last = last_cons[-1]
		# Translators: Title of the connect dialog.
		dlg = dialogs.DirectConnectDialog(parent=gui.mainFrame, id=wx.ID_ANY, title=_("Connect"))
		dlg.panel.host.SetValue(last)
		dlg.panel.host.SelectAll()
		def handle_dlg_complete(dlg_result):
			if dlg_result != wx.ID_OK:
				return
			if dlg.client_or_server.GetSelection() == 0: #client
				server_addr = dlg.panel.host.GetValue()
				server_addr, port = address_to_hostport(server_addr)
				channel = dlg.panel.key.GetValue()
				if dlg.connection_type.GetSelection() == 0:
					self.connect_slave((server_addr, port), channel)
				else:
					self.connect_control((server_addr, port), channel)
			else: #We want a server
				channel = dlg.panel.key.GetValue()
				self.server = server.Server(SERVER_PORT, channel)
				server_thread = threading.Thread(target=self.server.run)
				server_thread.daemon = True
				server_thread.start()
				if dlg.connection_type.GetSelection() == 0:
					self.connect_slave(('127.0.0.1', SERVER_PORT), channel)
				else:
					self.connect_control(('127.0.0.1', SERVER_PORT), channel)
		gui.runScriptModalDialog(dlg, callback=handle_dlg_complete)
コード例 #4
0
	def chooseServiceDialog(self) -> None:
		"""Dialog for selecting an online service from the list of available.
		Call using keyboard commands or menu items.
		"""
		# Translators: The title of the online service selection dialog and menu item
		sd = ServicesDialog(parent=gui.mainFrame, id=wx.ID_ANY, title=_("choose online service").capitalize())
		gui.runScriptModalDialog(sd)
コード例 #5
0
def doStartupDialogs():
    import config
    import gui
    # Translators: The title of the dialog to tell users that there are erros in the configuration file.
    if config.conf.baseConfigError:
        import wx
        gui.messageBox(
            # Translators: A message informing the user that there are errors in the configuration file.
            _("Your configuration file contains errors. "
              "Your configuration has been reset to factory defaults.\n"
              "More details about the errors can be found in the log file."),
            # Translators: The title of the dialog to tell users that there are errors in the configuration file.
            _("Configuration File Error"),
            wx.OK | wx.ICON_EXCLAMATION)
    if config.conf["general"]["showWelcomeDialogAtStartup"]:
        gui.WelcomeDialog.run()
    if config.conf["speechViewer"]["showSpeechViewerAtStartup"]:
        gui.mainFrame.onToggleSpeechViewerCommand(evt=None)
    import inputCore
    if inputCore.manager.userGestureMap.lastUpdateContainedError:
        import wx
        gui.messageBox(
            _("Your gesture map file contains errors.\n"
              "More details about the errors can be found in the log file."),
            _("gesture map File Error"), wx.OK | wx.ICON_EXCLAMATION)
    if not globalVars.appArgs.secure and not config.isAppX and not config.conf[
            'update']['askedAllowUsageStats']:
        gui.runScriptModalDialog(gui.AskAllowUsageStatsDialog(None))
コード例 #6
0
    def script_streamLabelEraser(self, gesture):
        # Unfortunately, py3 flag must be checked here.
        import sys
        choices = [str(pos) for pos in range(1, self.simpleParent.childCount)
                   ] if sys.version.startswith("3") else [
                       str(pos)
                       for pos in xrange(1, self.simpleParent.childCount)
                   ]
        # Translators: The title of the stream configuration eraser dialog.
        streamEraserTitle = _("Stream label and settings eraser")
        # Translators: The text of the stream configuration eraser dialog.
        streamEraserText = _(
            "Enter the position of the encoder you wish to delete or will delete"
        )
        # 17.12: wxPython 4 does not have number entry dialog, so replace it with a combo box.
        dlg = wx.SingleChoiceDialog(gui.mainFrame,
                                    streamEraserText,
                                    streamEraserTitle,
                                    choices=choices)
        dlg.SetSelection(self.IAccessibleChildID - 1)

        def callback(result):
            if result == wx.ID_OK:
                self.removeStreamConfig(dlg.GetStringSelection())

        gui.runScriptModalDialog(dlg, callback)
コード例 #7
0
ファイル: jumpToWindow.py プロジェクト: ctoth/jumpToWindow
	def script_find_window(self, gesture):
		dlg = wx.TextEntryDialog(gui.mainFrame, _("Search For:"), _("Jump To Window"))

		def callback(result):
			if result == wx.ID_OK:
				wx.CallLater(100, self.find, dlg.GetValue())
		gui.runScriptModalDialog(dlg, callback)
コード例 #8
0
ファイル: core.py プロジェクト: bramd/nvda
def doStartupDialogs():
	import config
	import gui
	# Translators: The title of the dialog to tell users that there are erros in the configuration file.
	if config.conf.baseConfigError:
		import wx
		gui.messageBox(
			# Translators: A message informing the user that there are errors in the configuration file.
			_("Your configuration file contains errors. "
				"Your configuration has been reset to factory defaults.\n"
				"More details about the errors can be found in the log file."),
			# Translators: The title of the dialog to tell users that there are errors in the configuration file.
			_("Configuration File Error"),
			wx.OK | wx.ICON_EXCLAMATION)
	if config.conf["general"]["showWelcomeDialogAtStartup"]:
		gui.WelcomeDialog.run()
	if config.conf["speechViewer"]["showSpeechViewerAtStartup"]:
		gui.mainFrame.onToggleSpeechViewerCommand(evt=None)
	import inputCore
	if inputCore.manager.userGestureMap.lastUpdateContainedError:
		import wx
		gui.messageBox(_("Your gesture map file contains errors.\n"
				"More details about the errors can be found in the log file."),
			_("gesture map File Error"), wx.OK|wx.ICON_EXCLAMATION)
	if not globalVars.appArgs.secure and not config.isAppX and not config.conf['update']['askedAllowUsageStats']:
		gui.runScriptModalDialog(gui.AskAllowUsageStatsDialog(None))
コード例 #9
0
    def script_changeTitle(self, gesture):
        w = windowWithHandle()
        changeTitleDialog = wx.TextEntryDialog(
            gui.mainFrame,
            # Translators: Message in the dialog used to change title of the curently focused window.
            _("Enter the new title for this window:"),
            # Translators: Title of the dialog.
            _("Change window title"),
            w.windowText)

        def callback(result):
            if result == wx.ID_OK:
                newTitle = changeTitleDialog.GetValue()
                res = w.setWindowText(newTitle)
                if res == 0:
                    wx.CallAfter(
                        gui.messageBox,
                        # Translators: Shown when changing of the current window title failed.
                        _("Failed to change window title!"),
                        # Translators: Title of the error dialog
                        _("Error"),
                        wx.OK | wx.ICON_ERROR)
                    return

        gui.runScriptModalDialog(changeTitleDialog, callback)
コード例 #10
0
ファイル: updateCheck.py プロジェクト: ehollig/nvda
	def _downloadSuccess(self):
		self._stopped()
		gui.runScriptModalDialog(UpdateAskInstallDialog(
			parent=gui.mainFrame,
			destPath=self.destPath,
			version=self.version,
			apiVersion=self.apiVersion,
			backCompatTo=self.backCompatToAPIVersion
		))
コード例 #11
0
ファイル: __init__.py プロジェクト: nishimotz/NVDARemote
	def on_options_item(self, evt):
		evt.Skip()
		config = get_config()
		dlg = dialogs.OptionsDialog(gui.mainFrame, wx.ID_ANY, title=_("Options"))
		dlg.set_from_config(config)
		def handle_dlg_complete(dlg_result):
			if dlg_result != wx.ID_OK:
				return
			dlg.write_to_config(config)
		gui.runScriptModalDialog(dlg, callback=handle_dlg_complete)
コード例 #12
0
	def doFindTextDialog(self):
		d = wx.TextEntryDialog(gui.mainFrame, 
			_("Type the text you wish to find"),
			_("Find"),
			defaultValue=self._lastFindText)
		def callback(result):
			if result == wx.ID_OK:
				# Make sure this happens after focus returns to the document.
				wx.CallLater(100, self.doFindText, d.GetValue())
		gui.runScriptModalDialog(d, callback)
コード例 #13
0
    def script_goToPosition(self, gesture):
        d = wx.TextEntryDialog(
            gui.mainFrame,
            _("Enter the value for position number you wish to jump to"),
            _("Jump to position"))

        def callback(result):
            if result == wx.ID_OK:
                wx.CallLater(100, self.jumping, d.GetValue())

        gui.runScriptModalDialog(d, callback)
コード例 #14
0
ファイル: __init__.py プロジェクト: bdorer/NVDARemote
	def on_options_item(self, evt):
		evt.Skip()
		conf = configuration.get_config()
		# Translators: The title of the add-on options dialog.
		dlg = dialogs.OptionsDialog(gui.mainFrame, wx.ID_ANY, title=_("Options"))
		dlg.set_from_config(conf)
		def handle_dlg_complete(dlg_result):
			if dlg_result != wx.ID_OK:
				return
			dlg.write_to_config(conf)
		gui.runScriptModalDialog(dlg, callback=handle_dlg_complete)
コード例 #15
0
    def script_savePosition(self, gesture):
        d = wx.TextEntryDialog(
            gui.mainFrame,
            _("Enter the value for position name you wish to save."),
            _("save position"))

        def callback(result):
            if result == wx.ID_OK:
                wx.CallLater(100, self.saving, d.GetValue())

        gui.runScriptModalDialog(d, callback)
コード例 #16
0
ファイル: cursorManager.py プロジェクト: lpintes/NVDA
	def doFindTextDialog(self):
		d = wx.TextEntryDialog(gui.mainFrame, 
			# Translators: Dialog text for NvDA's find command.
			_("Type the text you wish to find"),
			# Translators: Title of a dialog to find text.
			_("Find"),
			defaultValue=self._lastFindText)
		def callback(result):
			if result == wx.ID_OK:
				# Make sure this happens after focus returns to the document.
				wx.CallLater(100, self.doFindText, d.GetValue())
		gui.runScriptModalDialog(d, callback)
コード例 #17
0
    def doFindTextDialog(self):
        d = wx.TextEntryDialog(gui.mainFrame,
                               _("Type the text you wish to find"),
                               _("Find"),
                               defaultValue=self._lastFindText)

        def callback(result):
            if result == wx.ID_OK:
                # Make sure this happens after focus returns to the document.
                wx.CallLater(100, self.doFindText, d.GetValue())

        gui.runScriptModalDialog(d, callback)
コード例 #18
0
ファイル: encoders.py プロジェクト: josephsl/stationPlaylist
	def script_streamLabelEraser(self, gesture):
		import six
		choices = [str(pos) for pos in six.moves.range(1, self.simpleParent.childCount)]
		# Translators: The title of the stream configuration eraser dialog.
		streamEraserTitle = _("Stream label and settings eraser")
		# Translators: The text of the stream configuration eraser dialog.
		streamEraserText = _("Enter the position of the encoder you wish to delete or will delete")
		# 17.12: early versions of wxPython 4 does not have number entry dialog, so replace it with a combo box.
		dlg = wx.SingleChoiceDialog(gui.mainFrame,
		streamEraserText, streamEraserTitle, choices=choices)
		dlg.SetSelection(self.IAccessibleChildID-1)
		def callback(result):
			if result == wx.ID_OK:
				self.removeStreamConfig(dlg.GetStringSelection())
		gui.runScriptModalDialog(dlg, callback)
コード例 #19
0
	def synthsProfilesDialog(self) -> None:
		"""Dialog for manipulation of voice synthesizers profiles.
		Call using keyboard commands or menu items.
		"""
		def handleDialogComplete(dialogResult: int) -> None:
			"""Callback function to retrieve data from the dialog."""
			if dialogResult in range(10):
				self._slot = dialogResult
		# Translators: The title of the dialog box with a list of voice synthesizers profiles
		sd = SynthesizersDialog(parent=gui.mainFrame, id=wx.ID_ANY, title=_("Voice synthesizers profiles"))
		index = max(0, sd.synthsList.FindItem(-1, str(self._slot)))
		sd.refreshProfiles()
		sd.synthsList.Focus(index)
		sd.synthsList.Select(index)
		gui.runScriptModalDialog(sd, callback=handleDialogComplete)
コード例 #20
0
ファイル: encoders.py プロジェクト: josephsl/stationPlaylist
	def script_streamLabeler(self, gesture):
		curStreamLabel, title = self.getStreamLabel(getTitle=True)
		if not curStreamLabel: curStreamLabel = ""
		# Translators: The title of the stream labeler dialog (example: stream labeler for 1).
		streamTitle = _("Stream labeler for {streamEntry}").format(streamEntry = title)
		# Translators: The text of the stream labeler dialog.
		streamText = _("Enter the label for this stream")
		dlg = wx.TextEntryDialog(gui.mainFrame,
		streamText, streamTitle, value=curStreamLabel)
		def callback(result):
			if result == wx.ID_OK:
				newStreamLabel = dlg.GetValue()
				if newStreamLabel == curStreamLabel:
					return # No need to write to disk.
				else: self.setStreamLabel(newStreamLabel)
		gui.runScriptModalDialog(dlg, callback)
コード例 #21
0
	def script_editComment(self,gesture):
		commentObj=self.excelCellObject.comment
		d = wx.TextEntryDialog(gui.mainFrame, 
			# Translators: Dialog text for 
			_("Editing comment for cell {address}").format(address=self.cellCoordsText),
			# Translators: Title of a dialog edit an Excel comment 
			_("Comment"),
			defaultValue=commentObj.text() if commentObj else u"",
			style=wx.TE_MULTILINE|wx.OK|wx.CANCEL)
		def callback(result):
			if result == wx.ID_OK:
				if commentObj:
					commentObj.text(d.Value)
				else:
					self.excelCellObject.addComment(d.Value)
		gui.runScriptModalDialog(d, callback)
コード例 #22
0
ファイル: __init__.py プロジェクト: wafiqtaher/checkGestures
    def checkGestures(self, gestures: base.FilteredGestures) -> None:
        """Show a list of gestures in a separate window,
		if the gesture collection is empty, a warning is displayed.
		@param gestures: filtered collection of input gestures
		@type gestures: base.FilteredGestures
		"""
        if len(gestures) > 0:
            gui.runScriptModalDialog(
                GesturesListDialog(parent=gui.mainFrame,
                                   title=gestures.title,
                                   gestures=gestures))
        else:
            # Translators: Notification of no search results
            gui.messageBox(_("Target gestures not found"),
                           caption=gestures.title,
                           parent=gui.mainFrame)
コード例 #23
0
ファイル: excel.py プロジェクト: JamaicanUser/nvda
	def script_editComment(self,gesture):
		commentObj=self.excelCellObject.comment
		d = wx.TextEntryDialog(gui.mainFrame, 
			# Translators: Dialog text for 
			_("Editing comment for cell {address}").format(address=self.cellCoordsText),
			# Translators: Title of a dialog edit an Excel comment 
			_("Comment"),
			defaultValue=commentObj.text() if commentObj else u"",
			style=wx.TE_MULTILINE|wx.OK|wx.CANCEL)
		def callback(result):
			if result == wx.ID_OK:
				if commentObj:
					commentObj.text(d.Value)
				else:
					self.excelCellObject.addComment(d.Value)
		gui.runScriptModalDialog(d, callback)
コード例 #24
0
	def preEditDialog(self) -> None:
		"""Dialog for pre-editing text before sending it for translation."""
		def resultHandler(result: int, dlg: wx.Dialog) -> None:
			"""Processing data obtained from the dialog."""
			if result == wx.ID_OK:
				if not dlg.text:
					return
				Thread(target=self.translate, args=[dlg.text, True]).start()
		text = getSelectedText()
		ed = EditableInputDialog(
			parent=gui.mainFrame,
			id=wx.ID_ANY,
			# Translators: The title of the dialog to edit the text before sending it for translation
			title=_("edit text before sending").capitalize(),
			text=text
		)
		gui.runScriptModalDialog(ed, callback=lambda result: resultHandler(result, ed))
コード例 #25
0
ファイル: __init__.py プロジェクト: dnz3d4c/systemShutdown
    def script_dlgSystemShutdown(self, gesture):
        global openedDlg
        if openedDlg == 0:
            openedDlg = 1
            dlg = wx.TextEntryDialog(gui.mainFrame, _(u'종료 시간 입력'),
                                     _(u'시스템 종료'))

            def callback(result):
                if result == wx.ID_OK:
                    global openedDlg
                    openedDlg = 0
                    wx.CallLater(100, self.systemShutdown, dlg.GetValue())
                elif result == wx.ID_CANCEL:
                    openedDlg = 0

            gui.runScriptModalDialog(dlg, callback)
        else:
            ui.message(u"대화상자가 이미 열려잇습니다.")
コード例 #26
0
ファイル: addonGui.py プロジェクト: spoorthy23/nvda
    def onIncompatAddonsShowClick(self, evt):
        incompatibleAddons = IncompatibleAddonsDialog(
            parent=self, NVDAVersion=buildVersion.getCurrentVersionTuple())

        def afterDialog(res):
            # here we need to check if the compatibility has changed.
            # addons that have become incompat should be disabled, and a restart prompt shown
            # addons that have become compat should be visible, but not enabled unless they already were.
            from addonHandler.compatValues import MANUALLY_SET_INCOMPATIBLE
            getAddonCompatibility = AddonCompatibilityState.getAddonCompatibility
            manuallySetIncompatibleAddons = addonHandler.getAvailableAddons(
                filterFunc=lambda addon:
                (MANUALLY_SET_INCOMPATIBLE == getAddonCompatibility(
                    addon, CURRENT_NVDA_VERSION)))
            for addon in manuallySetIncompatibleAddons:
                addon.enable(shouldEnable=False)
            self.refreshAddonsList()

        from gui import runScriptModalDialog
        runScriptModalDialog(incompatibleAddons, afterDialog)
コード例 #27
0
ファイル: addonGui.py プロジェクト: MarcoZehe/nvda
	def onIncompatAddonsShowClick(self, evt):
		incompatibleAddons = IncompatibleAddonsDialog(
			parent=self,
			NVDAVersion=buildVersion.getCurrentVersionTuple()
		)
		def afterDialog(res):
			# here we need to check if the compatibility has changed.
			# addons that have become incompat should be disabled, and a restart prompt shown
			# addons that have become compat should be visible, but not enabled unless they already were.
			from addonHandler.compatValues import MANUALLY_SET_INCOMPATIBLE
			getAddonCompatibility = AddonCompatibilityState.getAddonCompatibility
			manuallySetIncompatibleAddons = addonHandler.getAvailableAddons(
				filterFunc=lambda addon: ( MANUALLY_SET_INCOMPATIBLE == getAddonCompatibility(addon, CURRENT_NVDA_VERSION))
			)
			for addon in manuallySetIncompatibleAddons:
				addon.enable(shouldEnable=False)
			self.refreshAddonsList()

		from gui import runScriptModalDialog
		runScriptModalDialog(incompatibleAddons, afterDialog)
コード例 #28
0
ファイル: core.py プロジェクト: MarcoZehe/nvda
def doStartupDialogs():
	import config
	import gui
	# Translators: The title of the dialog to tell users that there are erros in the configuration file.
	if config.conf.baseConfigError:
		import wx
		gui.messageBox(
			# Translators: A message informing the user that there are errors in the configuration file.
			_("Your configuration file contains errors. "
				"Your configuration has been reset to factory defaults.\n"
				"More details about the errors can be found in the log file."),
			# Translators: The title of the dialog to tell users that there are errors in the configuration file.
			_("Configuration File Error"),
			wx.OK | wx.ICON_EXCLAMATION)
	if config.conf["general"]["showWelcomeDialogAtStartup"]:
		gui.WelcomeDialog.run()
	if config.conf["speechViewer"]["showSpeechViewerAtStartup"]:
		gui.mainFrame.onToggleSpeechViewerCommand(evt=None)
	import inputCore
	if inputCore.manager.userGestureMap.lastUpdateContainedError:
		import wx
		gui.messageBox(_("Your gesture map file contains errors.\n"
				"More details about the errors can be found in the log file."),
			_("gesture map File Error"), wx.OK|wx.ICON_EXCLAMATION)
	try:
		import updateCheck
	except RuntimeError:
		updateCheck=None
	if not globalVars.appArgs.secure and not config.isAppX and not globalVars.appArgs.launcher:
		addonHandler.showUnknownCompatDialog()
		if updateCheck and not config.conf['update']['askedAllowUsageStats']:
			# a callback to save config after the usage stats question dialog has been answered.
			def onResult(ID):
				import wx
				if ID in (wx.ID_YES,wx.ID_NO):
					try:
						config.conf.save()
					except:
						pass
			# Ask the user if usage stats can be collected.
			gui.runScriptModalDialog(gui.AskAllowUsageStatsDialog(None),onResult)
コード例 #29
0
def showUnknownCompatDialog():
	from gui import addonGui, mainFrame, runScriptModalDialog
	if any(getAddonsWithUnknownCompatibility()):
		try:
			incompatibleAddonsDlg = addonGui.IncompatibleAddonsDialog(parent=mainFrame)
		except RuntimeError:
			log.error("Unable to open IncompatibleAddonsDialog", exc_info=True)
			return
	else:
		return
	unknownCompatAddons = incompatibleAddonsDlg.unknownCompatibilityAddonsList
	def afterDialog(res):
		# we may need to change the enabled addons / restart nvda here
		shouldPromptRestart = False
		for addon in unknownCompatAddons:
			if isAddonConsideredCompatible(addon):
				addon.enable(True)
				shouldPromptRestart = True
		saveState()
		if shouldPromptRestart:
			addonGui.promptUserForRestart()
	runScriptModalDialog(incompatibleAddonsDlg, afterDialog)
コード例 #30
0
    def script_streamLabeler(self, gesture):
        curStreamLabel, title = self.getStreamLabel(getTitle=True)
        if not curStreamLabel: curStreamLabel = ""
        # Translators: The title of the stream labeler dialog (example: stream labeler for 1).
        streamTitle = _("Stream labeler for {streamEntry}").format(
            streamEntry=title)
        # Translators: The text of the stream labeler dialog.
        streamText = _("Enter the label for this stream")
        dlg = wx.TextEntryDialog(gui.mainFrame,
                                 streamText,
                                 streamTitle,
                                 defaultValue=curStreamLabel)

        def callback(result):
            if result == wx.ID_OK:
                newStreamLabel = dlg.GetValue()
                if newStreamLabel == curStreamLabel:
                    return  # No need to write to disk.
                else:
                    self.setStreamLabel(newStreamLabel)

        gui.runScriptModalDialog(dlg, callback)
コード例 #31
0
    def do_connect(self, evt):
        if evt != 'gesture':
            evt.Skip()
        last_cons = get_config()['connections']['last_connected']
        last = ''
        if last_cons:
            last = last_cons[-1]
        # Translators: Title of the connect dialog.
        dlg = dialogs.DirectConnectDialog(parent=gui.mainFrame,
                                          id=wx.ID_ANY,
                                          title=_("Connect"))
        dlg.panel.host.SetValue(last)
        dlg.panel.host.SelectAll()

        def handle_dlg_complete(dlg_result):
            if dlg_result != wx.ID_OK:
                return
            if dlg.client_or_server.GetSelection() == 0:  #client
                server_addr = dlg.panel.host.GetValue()
                server_addr, port = address_to_hostport(server_addr)
                channel = dlg.panel.key.GetValue()
                if dlg.connection_type.GetSelection() == 0:
                    self.connect_slave((server_addr, port), channel)
                else:
                    self.connect_control((server_addr, port), channel)
            else:  #We want a server
                channel = dlg.panel.key.GetValue()
                self.server = server.Server(SERVER_PORT, channel)
                server_thread = threading.Thread(target=self.server.run)
                server_thread.daemon = True
                server_thread.start()
                if dlg.connection_type.GetSelection() == 0:
                    self.connect_slave(('127.0.0.1', SERVER_PORT), channel)
                else:
                    self.connect_control(('127.0.0.1', SERVER_PORT), channel)

        gui.runScriptModalDialog(dlg, callback=handle_dlg_complete)
コード例 #32
0
 def script_open_location_manager(self, evt):
     dlg = settingsGUI.LocationSettings(gui.mainFrame)
     gui.runScriptModalDialog(dlg)
コード例 #33
0
ファイル: updateCheck.py プロジェクト: MarcoZehe/nvda
	def _downloadSuccess(self):
		self._stopped()
		gui.runScriptModalDialog(UpdateAskInstallDialog(gui.mainFrame, self.destPath, self.version, self.versionTuple))
コード例 #34
0
ファイル: updateCheck.py プロジェクト: vincejansen/nvda
 def _downloadSuccess(self):
     self._stopped()
     gui.runScriptModalDialog(
         UpdateAskInstallDialog(gui.mainFrame, self.destPath, self.version))
コード例 #35
0
def doStartupDialogs():
    import config
    import gui

    def handleReplaceCLIArg(cliArgument: str) -> bool:
        """Since #9827 NVDA replaces a currently running instance
		and therefore `--replace` command line argument is redundant and no longer supported.
		However for backwards compatibility the desktop shortcut created by installer
		still starts NVDA with the now redundant switch.
		Its presence in command line arguments should not cause a warning on startup."""
        return cliArgument in ("-r", "--replace")

    addonHandler.isCLIParamKnown.register(handleReplaceCLIArg)
    unknownCLIParams: List[str] = list()
    for param in globalVars.unknownAppArgs:
        isParamKnown = addonHandler.isCLIParamKnown.decide(cliArgument=param)
        if not isParamKnown:
            unknownCLIParams.append(param)
    if unknownCLIParams:
        import wx
        gui.messageBox(
            # Translators: Shown when NVDA has been started with unknown command line parameters.
            _("The following command line parameters are unknown to NVDA: {params}"
              ).format(params=", ".join(unknownCLIParams)),
            # Translators: Title of the dialog letting user know
            # that command line parameters they provided are unknown.
            _("Unknown command line parameters"),
            wx.OK | wx.ICON_ERROR)
    if config.conf.baseConfigError:
        import wx
        gui.messageBox(
            # Translators: A message informing the user that there are errors in the configuration file.
            _("Your configuration file contains errors. "
              "Your configuration has been reset to factory defaults.\n"
              "More details about the errors can be found in the log file."),
            # Translators: The title of the dialog to tell users that there are errors in the configuration file.
            _("Configuration File Error"),
            wx.OK | wx.ICON_EXCLAMATION)
    if config.conf["general"]["showWelcomeDialogAtStartup"]:
        from gui.startupDialogs import WelcomeDialog
        WelcomeDialog.run()
    if config.conf["brailleViewer"]["showBrailleViewerAtStartup"]:
        gui.mainFrame.onToggleBrailleViewerCommand(evt=None)
    if config.conf["speechViewer"]["showSpeechViewerAtStartup"]:
        gui.mainFrame.onToggleSpeechViewerCommand(evt=None)
    import inputCore
    if inputCore.manager.userGestureMap.lastUpdateContainedError:
        import wx
        gui.messageBox(
            _("Your gesture map file contains errors.\n"
              "More details about the errors can be found in the log file."),
            _("gesture map File Error"), wx.OK | wx.ICON_EXCLAMATION)
    try:
        import updateCheck
    except RuntimeError:
        updateCheck = None
    if not globalVars.appArgs.secure and not config.isAppX and not globalVars.appArgs.launcher:
        if updateCheck and not config.conf['update']['askedAllowUsageStats']:
            # a callback to save config after the usage stats question dialog has been answered.
            def onResult(ID):
                import wx
                if ID in (wx.ID_YES, wx.ID_NO):
                    try:
                        config.conf.save()
                    except:
                        pass

            # Ask the user if usage stats can be collected.
            gui.runScriptModalDialog(
                gui.startupDialogs.AskAllowUsageStatsDialog(None), onResult)