本文整理汇总了Python中plover.translation.Translator.flush方法的典型用法代码示例。如果您正苦于以下问题:Python Translator.flush方法的具体用法?Python Translator.flush怎么用?Python Translator.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plover.translation.Translator
的用法示例。
在下文中一共展示了Translator.flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: namedtuple
# 需要导入模块: from plover.translation import Translator [as 别名]
# 或者: from plover.translation.Translator import flush [as 别名]
#.........这里部分代码省略.........
do[0].replaced = undo
self._check_translations(do)
self._check_output(undo, do, None)
def test_retrospective_delete_space_with_period(self):
self.define('T/E/S/T', 'a longer key')
self.define('P-P', '{.}')
self.define('SH*', 'zshrc')
self.define('SP*', '{*!}')
self.translate('P-P')
self.translate('SH*')
self.translate('SP*')
undo = self.lt('P-P SH*')
do = self.lt('SP*')
do[0].english = '{.}{^~|^}zshrc'
do[0].is_retrospective_command = True
do[0].replaced = undo
self._check_translations(do)
self._check_output(undo, do, None)
def test_retrospective_toggle_asterisk(self):
self.define('T/E/S/T', 'a longer key')
self.define('S', 'see')
self.define('S*', 'sea')
self.define('A*', '{*}')
self.translate('S')
self.translate('A*')
self._check_translations(self.lt('S*'))
self._check_output(self.lt('S'), self.lt('S*'), None)
def test_retrospective_toggle_empty(self):
self.define('A*', '{*}')
self.translate('A*')
self._check_translations(self.lt(''))
assert self.o.output == []
def test_retrospective_toggle_asterisk_replaced1(self):
self.define('P-P', '{.}')
self.define('SKEL', 'cancel')
self.define('SKEL/TO-PB', 'skeleton')
self.define('SKEL/TO*PB', 'not skeleton!')
self.define('A*', '{*}')
self.translate('P-P')
self.translate('SKEL')
self.translate('TO-PB')
self.translate('A*')
self._check_translations(self.lt('SKEL/TO*PB'))
self._check_output(self.lt('SKEL/TO-PB'),
self.lt('SKEL/TO*PB'),
self.lt('P-P'))
def test_retrospective_toggle_asterisk_replaced2(self):
self.define('P-P', '{.}')
self.define('SKEL', 'cancel')
self.define('SKEL/TO-PB', 'skeleton')
self.define('TO*PB', '{^ton}')
self.define('A*', '{*}')
self.translate('P-P')
self.translate('SKEL')
self.translate('TO-PB')
self.translate('A*')
self._check_translations(self.lt('SKEL TO*PB'))
self._check_output(self.lt('SKEL/TO-PB'),
self.lt('SKEL TO*PB'),
self.lt('P-P'))
def test_repeat_last_stroke1(self):
self.define('T/E/S/T', 'a longer key')
self.define('TH', 'this')
self.define('R*', '{*+}')
self.translate('TH')
self.translate('R*')
undo = []
do = self.lt('TH')
state = self.lt('TH TH')
self._check_translations(state)
self._check_output(undo, do, do)
def test_repeat_last_stroke2(self):
self.define('T/E/S/T', 'a longer key')
self.define('THA', 'that')
self.define('R*', '{*+}')
self.translate('THA')
self.translate('R*')
undo = []
do = self.lt('THA')
state = self.lt('THA THA')
self._check_translations(state)
self._check_output(undo, do, do)
def test_untranslate_translation(self):
self.tlor.set_min_undo_length(2)
self.define('TH', 'this')
self.define('THA', 'that')
self.translate('TH')
self.translate('THA')
self.tlor.untranslate_translation(self.t('THA'))
self.tlor.untranslate_translation(self.t('TH'))
self.tlor.flush()
self._check_output(self.lt('TH THA'), [], None)