Ejemplo n.º 1
0
	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)
Ejemplo n.º 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)
Ejemplo n.º 3
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)
Ejemplo n.º 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)
Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 7
0
	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)
Ejemplo n.º 8
0
Archivo: core.py Proyecto: 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))
Ejemplo n.º 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)
Ejemplo n.º 10
0
	def _downloadSuccess(self):
		self._stopped()
		gui.runScriptModalDialog(UpdateAskInstallDialog(
			parent=gui.mainFrame,
			destPath=self.destPath,
			version=self.version,
			apiVersion=self.apiVersion,
			backCompatTo=self.backCompatToAPIVersion
		))
Ejemplo n.º 11
0
	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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 14
0
	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)
Ejemplo n.º 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)
Ejemplo n.º 16
0
	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)
Ejemplo n.º 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)
Ejemplo n.º 18
0
	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)
Ejemplo n.º 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)
Ejemplo n.º 20
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, 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)
Ejemplo n.º 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)
Ejemplo n.º 22
0
    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)
Ejemplo n.º 23
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)
Ejemplo n.º 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))
Ejemplo n.º 25
0
    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"대화상자가 이미 열려잇습니다.")
Ejemplo n.º 26
0
    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)
Ejemplo n.º 27
0
	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)
Ejemplo n.º 28
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)
	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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 32
0
 def script_open_location_manager(self, evt):
     dlg = settingsGUI.LocationSettings(gui.mainFrame)
     gui.runScriptModalDialog(dlg)
Ejemplo n.º 33
0
	def _downloadSuccess(self):
		self._stopped()
		gui.runScriptModalDialog(UpdateAskInstallDialog(gui.mainFrame, self.destPath, self.version, self.versionTuple))
Ejemplo n.º 34
0
 def _downloadSuccess(self):
     self._stopped()
     gui.runScriptModalDialog(
         UpdateAskInstallDialog(gui.mainFrame, self.destPath, self.version))
Ejemplo n.º 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)