Example #1
0
	def script_reportColor(self, gesture):
		if self.officeChartObject.ChartType in (xlPie, xlPieExploded, xlPieOfPie):
			#Translators: Message to be spoken to report Slice Color in Pie Chart
			ui.message ( _( "Slice color: {colorName} ").format(colorName=colors.RGB.fromCOLORREF(int( self.officeChartObject.SeriesCollection( self.seriesIndex ).Points(self.currentPointIndex).Format.Fill.ForeColor.RGB) ).name  ) )
		else:
			#Translators: Message to be spoken to report Series Color
			ui.message ( _( "Series color: {colorName} ").format(colorName=colors.RGB.fromCOLORREF(int( self.officeChartObject.SeriesCollection( self.seriesIndex ).Interior.Color ) ).name  ) )
Example #2
0
	def reportFocus(self):
		if self.appModule.outlookVersion>=13 and self.appModule.nativeOm:
			e=self.appModule.nativeOm.activeExplorer()
			s=e.selection
			if s.count>0:
				p=s.item(1)
				try:
					start=p.start
					end=p.end
				except COMError:
					return super(CalendarView,self).reportFocus()
				t=self._generateTimeRangeText(start,end)
				# Translators: A message reported when on a calendar appointment in Microsoft Outlook
				ui.message(_("Appointment {subject}, {time}").format(subject=p.subject,time=t))
			else:
				v=e.currentView
				try:
					selectedStartTime=v.selectedStartTime
					selectedEndTime=v.selectedEndTime
				except COMError:
					return super(CalendarView,self).reportFocus()
				timeSlotText=self._generateTimeRangeText(selectedStartTime,selectedEndTime)
				startLimit=u"%s %s"%(winKernel.GetDateFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.DATE_LONGDATE, selectedStartTime, None),winKernel.GetTimeFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.TIME_NOSECONDS, selectedStartTime, None))
				endLimit=u"%s %s"%(winKernel.GetDateFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.DATE_LONGDATE, selectedEndTime, None),winKernel.GetTimeFormat(winKernel.LOCALE_USER_DEFAULT, winKernel.TIME_NOSECONDS, selectedEndTime, None))
				query=u'[Start] < "{endLimit}" And [End] > "{startLimit}"'.format(startLimit=startLimit,endLimit=endLimit)
				i=e.currentFolder.items
				i.sort('[Start]')
				i.IncludeRecurrences =True
				if i.find(query):
					# Translators: a message when the current time slot on an Outlook Calendar has an appointment
					timeSlotText=_("Has appointment")+" "+timeSlotText
				ui.message(timeSlotText)
		else:
			self.event_valueChange()
Example #3
0
def new_game():
    global player, alive, state, current_turn
    starting_items = ui.item_choice_menu()
    if starting_items is None:
        # player closed window during starting item dialog
        return
    terrain.map = mapgen.generate_map()

    pos = terrain.map.player_start_pos
    player = mob.Player(pos)
    for i in starting_items:
        player.get(i((0, 0)))

    # terrain.map.init_fov_and_pathfinding()

    for i in range(50):
        update_objects()

    terrain.map.objects.append(player)
    ui.clear_messages()

    render.init()
    compute_fov()
    render.draw_all_tiles()

    alive = True
    state = 'playing'

    current_turn = 1

    ui.message(
        'Good job! You managed to sneak into the fortress of the dwarves and nabbed a priceless artifact while the dwarves were busy repelling a seige. Unfortunately, your escape route is now encased in battle! Can you navigate 200 tiles of mayhem?')
Example #4
0
	def script_readMessage(self,gesture):
		num=int(gesture.mainKeyName[-1])
		if len(self.lastMessages)>num-1:
			ui.message(self.lastMessages[num-1])
		else:
			# Translators: This is presented to inform the user that no instant message has been received.
			ui.message(_("No message yet"))
Example #5
0
	def script_saveSynth(self, gesture):
		if self.slot not in self.synths:
			self.synths[self.slot] = {}
		self.synths[self.slot]['name'] = speech.getSynth().name
		self.synths[self.slot]['config'] = dict(config.conf['speech'][speech.getSynth().name].iteritems())
		self.write()
		ui.message(_("saved"))
 def finish():
     try:
         k, v = arg.split('=', 1)
         features.set_perm(k, v)
     except Exception as e:
         traceback.print_exc()
         ui.message(str(e))
 def _callback(self):
     try:
         val = features.get(self.feature_key)
         features.set_perm(self.feature_key, not val)
     except ValueError as e:
         ui.message(str(e), type='error')
     self.make_button()
	def script_reportStatusLine(self, gesture):
		#it seems that the status bar is the last child of the forground object
		#so, get it from there
		obj = api.getForegroundObject().lastChild
		found=False
		if obj and obj.role == controlTypes.ROLE_STATUSBAR:
			text = api.getStatusBarText(obj)
			api.setNavigatorObject(obj)
			found=True
		else:
			info=api.getForegroundObject().flatReviewPosition
			if info:
				info.expand(textInfos.UNIT_STORY)
				info.collapse(True)
				info.expand(textInfos.UNIT_LINE)
				text=info.text
				info.collapse()
				api.setReviewPosition(info)
				found=True
		if not found:
			# Translators: Reported when there is no status line for the current program or window.
			ui.message(_("No status line found"))
			return
		if scriptHandler.getLastScriptRepeatCount()==0:
			ui.message(text)
		else:
			speech.speakSpelling(text)
Example #9
0
def fetchAppModule(processID,appName):
	"""Returns an appModule found in the appModules directory, for the given application name.
	@param processID: process ID for it to be associated with
	@type processID: integer
	@param appName: the application name for which an appModule should be found.
	@type appName: unicode or str
	@returns: the appModule, or None if not found
	@rtype: AppModule
	"""  
	# First, check whether the module exists.
	# We need to do this separately because even though an ImportError is raised when a module can't be found, it might also be raised for other reasons.
	# Python 2.x can't properly handle unicode module names, so convert them.
	modName = appName.encode("mbcs")

	if doesAppModuleExist(modName):
		try:
			return __import__("appModules.%s" % modName, globals(), locals(), ("appModules",)).AppModule(processID, appName)
		except:
			log.error("error in appModule %r"%modName, exc_info=True)
			# We can't present a message which isn't unicode, so use appName, not modName.
			# Translators: This is presented when errors are found in an appModule (example output: error in appModule explorer).
			ui.message(_("Error in appModule %s")%appName)

	# Use the base AppModule.
	return AppModule(processID, appName)
Example #10
0
 def cmd_descend(self):
     if not isinstance(self.player.tile, StairDownTile):
         ui.message('Stand on a down stairway to descend.')
         return
     ui.message('You climb downwards...')
     self.turns += 1
     self.start_map(self.map.level+1)
 def script_moveToParent(self, gesture):
     # Make sure we're in a editable control
     focus = api.getFocusObject()
     if focus.role != controlTypes.ROLE_EDITABLETEXT:
         ui.message("Not in an edit control.")
         return
     
     # Get the current indentation level 
     textInfo = focus.makeTextInfo(textInfos.POSITION_CARET)
     textInfo.expand(textInfos.UNIT_LINE)
     indentationLevel = len(textInfo.text) - len(textInfo.text.strip())
     onEmptyLine = len(textInfo.text) == 1 #1 because an empty line will have the \n character
     
     # Scan each line until we hit the start of the indentation block, the start of the edit area, or find a line with less indentation level
     found = False
     while textInfo.move(textInfos.UNIT_LINE, -2) == -2:
         textInfo.expand(textInfos.UNIT_LINE)
         newIndentation = len(textInfo.text) - len(textInfo.text.strip())
         
         # Skip over empty lines if we didn't start on one.
         if not onEmptyLine and len(textInfo.text) == 1:
             continue
         
         if newIndentation < indentationLevel:
             # Found it
             found = True
             textInfo.updateCaret()
             speech.speakTextInfo(textInfo, unit=textInfos.UNIT_LINE)
             break
     
     # If we didn't find it, tell the user
     if not found:
         ui.message("No parent of indentation block")
Example #12
0
def handleInputCandidateListUpdate(candidatesString,selectionIndex,inputMethod):
	candidateStrings=candidatesString.split('\n')
	import speech
	from NVDAObjects.inputComposition import InputComposition, CandidateList, CandidateItem
	focus=api.getFocusObject()
	if not (0<=selectionIndex<len(candidateStrings)):
		if isinstance(focus,CandidateItem):
			oldSpeechMode=speech.speechMode
			speech.speechMode=speech.speechMode_off
			eventHandler.executeEvent("gainFocus",focus.parent)
			speech.speechMode=oldSpeechMode
		return
	oldCandidateItemsText=None
	if isinstance(focus,CandidateItem):
		oldCandidateItemsText=focus.visibleCandidateItemsText
		parent=focus.parent
		wasCandidate=True
	else:
		parent=focus
		wasCandidate=False
	item=CandidateItem(parent=parent,candidateStrings=candidateStrings,candidateIndex=selectionIndex,inputMethod=inputMethod)
	if wasCandidate and focus.windowHandle==item.windowHandle and focus.candidateIndex==item.candidateIndex and focus.name==item.name:
		return
	if config.conf["inputComposition"]["autoReportAllCandidates"] and item.visibleCandidateItemsText!=oldCandidateItemsText:
		import ui
		ui.message(item.visibleCandidateItemsText)
	eventHandler.executeEvent("gainFocus",item)
Example #13
0
	def reportMessage(self, text):
		# Messages are ridiculously verbose.
		# Strip the time and other metadata if possible.
		m = self.RE_MESSAGE.match(text)
		if m:
			text = "%s, %s" % (m.group("from"), m.group("body"))
		ui.message(text)
Example #14
0
	def script_goToError(self, gesture):
		(file, line) = error_finder.get_file_and_line(self.get_navigator_line())
		if file is None:
			ui.message(_("Unable to find target file and line"))
			return
		arguments = "/g %s \"%s\"" % (line, file)
		win32api.ShellExecute(0, 'open', "notepad.exe", arguments, '', 1)
Example #15
0
	def reportClock(self):
		if self.quietHoursAreActive():
			return
		if config.conf["clockAndCalendar"]["timeReporting"]!=1:
			nvwave.playWaveFile(os.path.join(paths.SOUNDS_DIR, config.conf["clockAndCalendar"]["timeReportSound"]))
		if config.conf["clockAndCalendar"]["timeReporting"]!=2:
			ui.message(datetime.now().strftime(config.conf["clockAndCalendar"]["timeDisplayFormat"]))
Example #16
0
def load_game(path, user_callback=None):
    def out_callback(line):
        if 'Established control over the server. You have command access level' in line:
            ui.back(anim=False)
            start_button = ui.Dialog(ui.screen, ui.Button('Touch to start game', callback))
            start_button.back = callback
            ui.set(start_button, anim=False)
            sc_client.out_window_callback = None
    
    port = random.randint(1500, 12000)
    start_server(port, ('-f', path))
    
    sc_client = gamescreen.ScreenClient()
    sc_client.out_window_callback = out_callback
    try:
        sc_client.connect_to_server('player', localhost, port)
    except client.ConnectionError:
        ui.message('Failed to connect to game server, try again', type='error')
        return
    
    def callback():
        load_game_now(port, get_save_username(path))
        
        if user_callback:
            user_callback()
    
    ui.replace(client.client.ui)
    ui.message('Loading...')
	def event_UIA_elementSelected(self, obj, nextHandler):
		# #7273: When this is fired on categories, the first emoji from the new category is selected but not announced.
		# Therefore, move the navigator object to that item if possible.
		# However, in recent builds, name change event is also fired.
		# For consistent experience, report the new category first by traversing through controls.
		# #8189: do not announce candidates list itself (not items), as this is repeated each time candidate items are selected.
		if obj.UIAElement.cachedAutomationID == "CandidateList": return
		speech.cancelSpeech()
		# Sometimes clipboard candidates list gets selected, so ask NvDA to descend one more level.
		if obj.UIAElement.cachedAutomationID == "TEMPLATE_PART_ClipboardItemsList":
			obj = obj.firstChild
		candidate = obj
		# Sometimes, due to bad tree traversal, something other than the selected item sees this event.
		parent = obj.parent
		if obj.UIAElement.cachedClassName == "ListViewItem" and isinstance(parent, UIA) and parent.UIAElement.cachedAutomationID != "TEMPLATE_PART_ClipboardItemsList":
			# The difference between emoji panel and suggestions list is absence of categories/emoji separation.
			# Turns out automation ID for the container is different, observed in build 17666 when opening clipboard copy history.
			candidate = obj.parent.previous
			if candidate is not None:
				# Emoji categories list.
				ui.message(candidate.name)
				obj = candidate.firstChild
		if obj is not None:
			api.setNavigatorObject(obj)
			obj.reportFocus()
			braille.handler.message(braille.getBrailleTextForProperties(name=obj.name, role=obj.role, positionInfo=obj.positionInfo))
			# Cache selected item.
			self._recentlySelected = obj.name
		else:
			# Translators: presented when there is no emoji when searching for one in Windows 10 Fall Creators Update and later.
			ui.message(_("No emoji"))
		nextHandler()
Example #18
0
	def event_gainFocus(self) :
		#Incremento al massimo il livello di punteggiatura
		if (self.origLevel == None) :
			self.origLevel = config.conf["speech"]["symbolLevel"]
			config.conf["speech"]["symbolLevel"] = 300
		#Ripeto la prossima lettera
		ui.message(u"prossima lettera "+self.parent.parent.getNextChar())
Example #19
0
	def event_liveRegionChange(self):
		"""
		A base implementation for live region change events.
		"""
		name=self.name
		if name:
			ui.message(name)
Example #20
0
 def _callback(self):
     val = uidialog.inputbox('Value for %s' % self.feature_key)
     try:
         features.set_perm(self.feature_key, val)
     except ValueError as e:
         ui.message(str(e), type='error')
     self.make_button()
Example #21
0
 def change_feature():
     arg = uidialog.inputbox('name=key')
     try:
         features._parse_arg(arg)
     except Exception as e:
         traceback.print_exc()
         ui.message(str(e))
Example #22
0
	def _tableMovementScriptHelper(self, movement="next", axis=None):
		if isScriptWaiting():
			return
		formatConfig=config.conf["documentFormatting"].copy()
		formatConfig["reportTables"]=True
		formatConfig["includeLayoutTables"]=True
		try:
			tableID, origRow, origCol, origRowSpan, origColSpan = self._getTableCellCoords(self.selection)
		except LookupError:
			# Translators: The message reported when a user attempts to use a table movement command
			# when the cursor is not within a table.
			ui.message(_("Not in a table cell"))
			return

		try:
			info = self._getNearestTableCell(tableID, self.selection, origRow, origCol, origRowSpan, origColSpan, movement, axis)
		except LookupError:
			# Translators: The message reported when a user attempts to use a table movement command
			# but the cursor can't be moved in that direction because it is at the edge of the table.
			ui.message(_("Edge of table"))
			# Retrieve the cell on which we started.
			info = next(self._iterTableCells(tableID, row=origRow, column=origCol))

		speech.speakTextInfo(info,formatConfig=formatConfig,reason=controlTypes.REASON_CARET)
		info.collapse()
		self.selection = info
Example #23
0
	def take_turn(self):
		monster = self.owner

		actiontime = 0
			
		oldx = monster.x
		oldy = monster.y

		#Can it see the player?
		if v.detect_player(monster):
			#Send a message about it if it couldn't already see you
			if not self.can_see_player:
				if v.player_can_see(monster.x, monster.y):
					ui.message("The " + monster.name + " sees you!", libtcod.red)

					self.seesPlayerFunc(monster)

			self.can_see_player = True
			#monster.fighter.look_towards = (g.player.x, g.player.y)
		else:
			self.can_see_player = False

		#Do the onstep whatever it is
		#if self.eachStepFunc:
		#	self.eachStepFunc(monster)

		#If we're next to the player, attack it
		if self.attacksPlayer and self.can_see_player and (monster.distance_to(g.player) < 2):
			actiontime = monster.fighter.attack(g.player)

		#actiontime = monster.move_towards(self.dest[0], self.dest[1])
		actiontime = 10

		return actiontime
	def script_reportFormatting(self,gesture):
		formatConfig={
			"detectFormatAfterCursor":False,
			"reportFontName":True,"reportFontSize":True,"reportFontAttributes":True,"reportColor":True,
			"reportStyle":True,"reportAlignment":True,"reportSpellingErrors":True,
			"reportPage":False,"reportLineNumber":False,"reportTables":False,
			"reportLinks":False,"reportHeadings":False,"reportLists":False,
			"reportBlockQuotes":False,
		}
		o=api.getFocusObject()
		v=o.treeInterceptor
		if v and not v.passThrough:
			o=v
		try:
			info=o.makeTextInfo(textInfos.POSITION_CARET)
		except (NotImplementedError, RuntimeError):
			info=o.makeTextInfo(textInfos.POSITION_FIRST)
		info.expand(textInfos.UNIT_CHARACTER)
		formatField=textInfos.FormatField()
		for field in info.getTextWithFields(formatConfig):
			if isinstance(field,textInfos.FieldCommand) and isinstance(field.field,textInfos.FormatField):
				formatField.update(field.field)
		text=speech.getFormatFieldSpeech(formatField,formatConfig=formatConfig) if formatField else None
		if not text:
			ui.message(_("No formatting information"))
			return
		ui.message(text)
	def script_toggleRightMouseButton(self,gesture):
		if winUser.getKeyState(winUser.VK_RBUTTON)&32768:
			ui.message(_("right mouse button unlock"))
			winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTUP,0,0,None,None)
		else:
			ui.message(_("right mouse button lock"))
			winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTDOWN,0,0,None,None)
	def script_nextSynthSetting(self,gesture):
		nextSettingName=globalVars.settingsRing.next()
		if not nextSettingName:
			ui.message(_("No settings"))
			return
		nextSettingValue=globalVars.settingsRing.currentSettingValue
		ui.message("%s %s"%(nextSettingName,nextSettingValue))
	def script_previousSynthSetting(self,gesture):
		previousSettingName=globalVars.settingsRing.previous()
		if not previousSettingName:
			ui.message(_("No settings"))
			return
		previousSettingValue=globalVars.settingsRing.currentSettingValue
		ui.message("%s %s"%(previousSettingName,previousSettingValue))
Example #28
0
	def script_saveBookmark(self, gesture):
		obj = api.getFocusObject()
		appName=appModuleHandler.getAppNameFromProcessID(obj.processID,True)
		if appName == "MicrosoftEdgeCP.exe":
			gesture.send()
			return
		treeInterceptor=obj.treeInterceptor
		if isinstance(treeInterceptor, BrowseModeDocumentTreeInterceptor) and not treeInterceptor.passThrough:
			obj=treeInterceptor
		else:
			gesture.send()
			return
		bookmark = obj.makeTextInfo(textInfos.POSITION_CARET).bookmark
		bookmarks = getSavedBookmarks()
		noteTitle = obj.makeTextInfo(textInfos.POSITION_SELECTION).text[:100].encode("utf-8")
		if bookmark.startOffset in bookmarks:
			noteBody = bookmarks[bookmark.startOffset].body
		else:
			noteBody = ""
		bookmarks[bookmark.startOffset] = Note(noteTitle, noteBody)
		fileName = getFileBookmarks()
		try:
			pickle.dump(bookmarks, file(fileName, "wb"))
			ui.message(
				# Translators: message presented when a position is saved as a bookmark.
				_("Saved position at character %d") % bookmark.startOffset)
		except Exception as e:
			log.debugWarning("Error saving bookmark", exc_info=True)
			ui.message(
				# Translators: message presented when a bookmark cannot be saved.
				_("Cannot save bookmark"))
			raise e
	def script_decreaseSynthSetting(self,gesture):
		settingName=globalVars.settingsRing.currentSettingName
		if not settingName:
			ui.message(_("No settings"))
			return
		settingValue=globalVars.settingsRing.decrease()
		ui.message("%s %s" % (settingName,settingValue))
Example #30
0
	def event_liveRegionChange(self):
		# The base liveRegionChange event is not enough as Skype for Business concatinates recent chat messages from the same person within the same minute
		# Therefore, specifically strip out the chat content and only report the most recent part added.
		# The object's name contains the full message (I.e. person: content, timestamp) loosely separated by commas.
		# Example string: "Michael Curran : , , Hello\r\n\r\nThis is a test , 10:45 am."
		# Where person is "Michael Curran", content is "Hello\nThis is a test" and timestamp is "10:45 am" 
		# The object's value just contains the content.
		# Example: "Hello\rThis is a test"
		# We are only interested in person and content
		# Therefore use value (content) to  locate and split off the person from the name (fullText)
		# Normalize the usage of end-of-line characters (name and value seem to expose them differently, which would break comparison)
		content=self.value.replace('\r','\n').strip()
		fullText=self.name.replace('\r\n\r\n','\n')
		contentLines=content.split('\n')
		contentStartIndex=fullText.find(content)
		pretext=fullText[:contentStartIndex]
		# There are some annoying comma characters  after the person's name 
		pretext=pretext.replace(' ,','')
		# If the objects are the same, the person is the same, and the new content is the old content but with more appended, report the appended content
		# Otherwise, report the person and the initial content
		runtimeID=self.UIAElement.getRuntimeId()
		lastRuntimeID,lastPretext,lastContentLines=self.appModule._lastLiveChatMessageData
		contentLinesLen=len(contentLines)
		lastContentLinesLen=len(lastContentLines)
		if runtimeID==lastRuntimeID and pretext==lastPretext and contentLinesLen>lastContentLinesLen and contentLines[:lastContentLinesLen]==lastContentLines:
			message="\n".join(contentLines[lastContentLinesLen:])
		else:
			message=pretext+content
		ui.message(message)
		# Cache the message data for later possible comparisons 
		self.appModule._lastLiveChatMessageData=runtimeID,pretext,contentLines
Example #31
0
	def getElapsedAndTotalIfPlaying(self):
		elapsedAndTotalTime = self.getElapsedAndTotal()
		if elapsedAndTotalTime.elapsed is None and elapsedAndTotalTime.total is None:
			# Translators: Reported when no track is playing in Foobar 2000.
			ui.message(_("No track playing"))
		return elapsedAndTotalTime
Example #32
0
	def reportText(self):
		ui.message(_("page {page} line {line}").format (page = self.pageStart, line = self.lineStart))
Example #33
0
def quit_program():
    ui.message('Good bye!')
 def script_TCArcon(self, gesture):
     ui.message(_('Abriendo restablecer   contraseñas de Windows'))
     subprocess.Popen('RunDll32.exe keymgr.dll,PRShowSaveWizardExW')
 def script_TCAcopy_sys(self, gesture):
     tsu.T_h(self, 4)
     ui.message(_('información del sistema copiada al portapapeles'))
Example #36
0
def quit_program():
    ui.message('Bye!!')
Example #37
0
	def script_reportElapsedTime(self,gesture):
		elapsedTime = self.getElapsedAndTotalIfPlaying()[0]
		if elapsedTime is not None:
			ui.message(elapsedTime)
Example #38
0
 def script_announceWindowControlID(self, gesture):
     focusObj = api.getFocusObject()
     name = focusObj.name
     windowControlID = focusObj.windowControlID
     ui.message("Control ID for %s window: %d" % (name, windowControlID))
Example #39
0
def quit_program():
    ui.message('Thanks and bye!')
 def script_reportLineInfo(self, gesture):
     ui.message(self.parent.next.next.firstChild.getChild(2).name)
Example #41
0
 def on_disconnected_as_master(self):
     # Translators: Presented when connection to a remote computer was interupted.
     ui.message(_("Connection interrupted"))
Example #42
0
 def script_announceWindowClassName(self, gesture):
     focusObj = api.getFocusObject()
     name = focusObj.name
     windowClassName = focusObj.windowClassName
     ui.message("class for %s window: %s" % (name, windowClassName))
Example #43
0
 def script_copy_link(self, gesture):
     self.on_copy_link_item(None)
     ui.message(_("Copied link"))
Example #44
0
 def script_sendKeys(self, gesture):
     # Translators: Presented when sending keyboard keys from the controlling computer to the controlled computer.
     ui.message(_("Controlling remote machine."))
     self.sending_keys = True
     self.set_receiving_braille(True)
	def script_test(self, gesture):
		ui.message("test")
Example #46
0
 def script_disconnect(self, gesture):
     if self.master_transport is None and self.slave_transport is None:
         ui.message(_("Not connected."))
         return
     self.disconnect()
Example #47
0
def message(text, fileName):
    ui.message(text)
    path = os.path.join(MODULE_DIR, fileName)
    if os.path.exists(path):
        winsound.PlaySound(path, winsound.SND_ASYNC)
Example #48
0
    def script_dictionaryStatistics(self, gesture: InputGesture) -> None:
        """Available statistical information on the use of the current online service.
		Service summary, the number of executed requests in the current session, the balance of the daily quota,
		time remaining until the daily quota is updated, cache status information.
		@param gesture: gesture assigned to this method
		@type gesture: InputGesture
		"""
        service = services[config.conf[addonName]['active']]
        ui.message(service.summary)
        # Translators: Information about the online service
        ui.message(
            _("supports {number} languages").format(
                number=len(service.langs.all)))
        if config.conf[addonName][service.name].get('source'):
            ui.message(
                # Translators: The name of the field displayed in the statistics and in the settings panel
                "{title} - {source}".format(
                    title=_("&Dictionary:").replace('&', ''),
                    source=config.conf[addonName][service.name]['source']))
        if not service.stat:
            # Translators: Information about the online service
            ui.message(_("There is no dictionary queries"))
        if service.stat.get('count'):
            # Translators: Information about the online service
            ui.message(
                _("performed {count} requests").format(
                    count=service.stat['count']))
        if service.stat.get('remain'):
            # Translators: Information about the online service
            ui.message(
                _("available {remain}").format(remain=service.stat['remain']))
        from datetime import datetime, timedelta
        if isinstance(service.stat.get('delta'), timedelta):
            tomorrow = datetime.now() + timedelta(days=1)
            middle = datetime(tomorrow.year, tomorrow.month, tomorrow.day)
            hours, seconds = divmod(
                (middle + service.stat['delta'] - datetime.now()).seconds,
                3600)
            minutes, seconds = divmod(seconds, 60)
            # Translators: Information about the online service
            ui.message(
                _("the limit will be reset in {hours} hours {minutes} minutes"
                  ).format(hours=hours, minutes=minutes))
        if self._cacheInfo:
            # Translators: Information about the cache state
            ui.message("%s: %s" % (_("state of cache"), self._cacheInfo))
Example #49
0
 def _reportToggleKey(self):
     toggleState = winUser.getKeyState(self.vkCode) & 1
     key = self.mainKeyName
     ui.message(u"{key} {state}".format(
         key=localizedKeyLabels.get(key.lower(), key),
         state=_("on") if toggleState else _("off")))
	def script_reportSearchResult(self, gesture):
		if hasattr(self, "searchResultObject"):
			ui.message(self.searchResultObject.name)
Example #51
0
	def Start(self):
		self.timer = wx.PyTimer(self.countdown)
		ui.message(_("Countdown started"))
		# #58 (18.04.1): timers must be started from main thread.
		wx.CallAfter(self.timer.Start, 1000)
Example #52
0
	def script_findPrevious(self, gesture):
		# Translators: Reported when a user tries to use a find command when it isn't supported.
		ui.message(_("Not supported in this document"))
Example #53
0
	def script_mark(self, gesture):
		with SectionManager() as manager:
			if manager.pointer and manager.pointer['type'] == 'text':
				A8MMarkCommandView().setFocus()
			else:
				ui.message(_("In math section. Please leave math section first and try again."))
Example #54
0
def playlist2clipboard(start, end):
	import api
	playlistTranscripts = playlist2msaa(start, end)
	api.copyToClip("\r\n".join(playlistTranscripts))
	ui.message(_("Playlist data copied to clipboard"))
Example #55
0
	def script_rawdataToClip(self, gesture):
		#api.copyToClip(self.raw_data)
		api.copyToClip(self.mathcontent.root.get_mathml())
		ui.message(_("copy"))
Example #56
0
	def script_latex_command(self, gesture):
		with SectionManager() as manager:
			if manager.pointer and manager.pointer['type'] == 'math':
				A8MLaTeXCommandView().setFocus()
			else:
				ui.message(_("Not in math section. Please insert LaTeX mark first and try again."))
Example #57
0
 def show_trade_routes(self):
     ui.message(self.city.get_trade_routes())
Example #58
0
	def script_snapshot(self, gesture):
		ui.message(_("snapshot"))
Example #59
0
def reportWithSpeech(evt):
    if evt["type"] == TimerEvent.TICK and evt["counter"] != 0:
        ui.message(str(evt["currentTime"]))
Example #60
0
	def OnRawdataToClip(self, event):
		api.copyToClip(self.mathcontent.root.get_mathml())
		ui.message(_("copy"))