本文整理汇总了Python中ui.message函数的典型用法代码示例。如果您正苦于以下问题:Python message函数的具体用法?Python message怎么用?Python message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: script_readMessage
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"))
示例2: _callback
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()
示例3: script_saveSynth
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"))
示例4: script_moveToParent
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")
示例5: fetchAppModule
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)
示例6: reportClock
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"]))
示例7: reportMessage
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)
示例8: take_turn
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
示例9: script_saveBookmark
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
示例10: script_reportFormatting
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)
示例11: script_toggleRightMouseButton
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)
示例12: script_previousSynthSetting
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))
示例13: script_nextSynthSetting
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))
示例14: script_decreaseSynthSetting
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))
示例15: event_UIA_elementSelected
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()
开发者ID:MarcoZehe,项目名称:nvda,代码行数:32,代码来源:windowsinternal_composableshell_experiences_textinput_inputapp.py