示例#1
0
def test():
  
  global logger
  
  logger.info("Test started")
  saver = SpellingModeSaver()
  
  current_mode = spelling_mode.spelling_mode()
  saver.select(mode_manager.get_available_modes(False), current_mode)
  result = saver.get_selected_mode()
  
  if result:
    logger.info("selected_mode='%s' comment='%s'" % (result.control.name, result.control.comment))
  else:
    logger.info("selection cancelled")
  logger.info("Test finished")
 def __init__(self, conf):
   
   super(MainViewController, self).__init__()
   self.conf = conf
   self.previousSampleText = None
   self.currentSampleText = None
   self.highlightingMode = HIGHLIGHT_DELTA
   self.autoHide = True
   self.suppressShowChanges = False
   self.rule_doc_manager = rules_doc_manager.RulesDocManager(rules_doc_manager.RULE_DOC_FILE)
   self.selectModeVC = mode_selector.SpellingModeSelector(self)
   self.selectModeForSaveVC = mode_saver.SpellingModeSaver(self)
   self.statistics_view_vc = statistics_view.StatisticsViewController(self)
   self.info_popup = popup.PopupViewController()
   self.set_reference_mode(filter(lambda m:m.control.isReference, mode_manager.get_available_modes())[0])
   self.loadedMode = spelling_mode.spelling_mode()
   self.currentMode = spelling_mode.spelling_mode()
   self.delay_show_changes = False
   self.load_mode_type = LOAD_MODE_RULESET
   if ui_util.is_iphone():
     self.orientations = ( 'portrait', )
   else:
     self.orientations = ( 'landscape', )
 def save_mode_start(self):
   self.selectModeForSaveVC.select(mode_manager.get_available_modes(), self.currentMode, cancel_label=words.abbrechen(c=rulesets.C_BOS), save_label=words.speichern(c=rulesets.C_BOS), overwrite_label=words.ueberschreiben(c=rulesets.C_BOS), style='sheet')
 def load_mode_start(self, load_mode_type):
   self.load_mode_type = load_mode_type
   self.selectModeVC.select(
       mode_manager.get_available_modes(), cancel_label=words.abbrechen(c=rulesets.C_BOS), 
       close_label=words.schlieszen(c=rulesets.C_BOS),
       title = 'Regelsatz laden' if load_mode_type == LOAD_MODE_RULESET else 'Referenz laden')