Пример #1
0
 def __init__(self, parent_vc=None):
   super(StatisticsViewController, self).__init__(parent_vc)
   if ui_util.is_iphone():
     self.load('statistics_view_iphone')
   else:
     self.load('statistics_view')
   self.imageview_plot1 = self.find_subview_by_name('imageview_plot1')
   self.imageview_plot2 = self.find_subview_by_name('imageview_plot2')
   self.imageview_plot3 = self.find_subview_by_name('imageview_plot3')
Пример #2
0
 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', )
Пример #3
0
def main():
  
  global logger
  
  console.clear()
  logger = log.open_logging('rechtschreibung', reload=True)
  logger.info("Start application")
  default_mode = spelling_mode.spelling_mode()
  rulesets.set_default_mode(default_mode.combination)
  
  config_handler = config.ConfigHandler(app_config.AppConfig())
  conf = config_handler.read_config_file(CONFIG_FILE, SAMPLE_CONFIG_FILE)
  
  image_rechtschreibung = ui.Image.named(IMAGE_URL_RECHTSCHREIBUNG).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
  my_main_view_controller = MainViewController(conf)
  
  top_navigation_vc = ui_util.ViewController(my_main_view_controller)
  navigation_vc = ui_util.ViewController(top_navigation_vc)
  navigation_vc.load('top_navigation')
  
  top_navigation_view = ui.NavigationView(navigation_vc.view, title_bar_color = defaults.COLOR_GREY)
  top_navigation_view.title_bar_color = defaults.COLOR_LIGHT_GREY
  top_navigation_vc.view = top_navigation_view
  my_main_view_controller.add_child_controller(NAME_NAVIGATION_VIEW, top_navigation_vc)
  top_navigation_view.name = NAME_NAVIGATION_VIEW
  
  if ui_util.is_iphone():
    my_main_view_controller.load('rechtschreibung_iphone')
    app_control_vc = ui_util.ViewController(my_main_view_controller)
    app_control_vc.load('rechtschreibung_app_control_iphone')
    my_main_view_controller.add_left_button_item(NAME_NAVIGATION_VIEW_TOP_LEVEL, 'button_close_top_navigation_view', ui.ButtonItem(image=ui.Image.named('iob:close_round_32')))
    
    button_item_list = [
      ui.ButtonItem(image=ui.Image.named('lib/ios7_toggle_32.png'), action=my_main_view_controller.handle_action, title='button_open_top_navigation_view'),  
      ui.ButtonItem(image=ui.Image.named('ionicons-gear-a-32'), action=my_main_view_controller.handle_action, title='button_open_app_control_view'),
      ui.ButtonItem(image=image_rechtschreibung, action=my_main_view_controller.handle_action, title='button_icon_rechtschreibung'),
    ]
    my_main_view_controller.set_right_button_item_list('Rechtschreibung', button_item_list)
        
  else:
    my_main_view_controller.load('rechtschreibung')
    my_main_view_controller.add_right_button_item('Rechtschreibung', 'button_icon_rechtschreibung', ui.ButtonItem(image=image_rechtschreibung))
    my_main_view_controller.add_subview('view_container_navigation', top_navigation_vc.view)
    
  view = my_main_view_controller.find_subview_by_name('segmented_control_highlighting_mode')
  view.action = my_main_view_controller.handle_action

  view_controller_capitalization = ui_util.ViewController(my_main_view_controller)
  view_controller_capitalization.load('view_capitalization')
  
  view_controller_harmonization = ui_util.ViewController(my_main_view_controller)
  view_controller_harmonization.load('view_harmonization')
  view = my_main_view_controller.find_subview_by_name('segmented_control_harmonization_elongation')
  view.action = my_main_view_controller.handle_action
  
  view_controller_combinations_simplification = ui_util.ViewController(my_main_view_controller)
  view_controller_combinations_simplification.load('view_combinations_simplification')
  
  view_controller_combinations_simplification_vowels = ui_util.ViewController(my_main_view_controller)
  view_controller_combinations_simplification_vowels.load('view_combinations_simplification_vowels')
  
  view_controller_punctuation = ui_util.ViewController(my_main_view_controller) 
  view_controller_punctuation.load('view_punctuation')
  
  view_controller_legacy = ui_util.ViewController(my_main_view_controller) 
  view_controller_legacy.load('view_legacy')
  
  view_controller_layout = ui_util.ViewController(my_main_view_controller) 
  view_controller_layout.load('view_layout')

  view_controller_misc_rules = ui_util.ViewController(my_main_view_controller) 
  view_controller_misc_rules.load('view_misc_rules')

  my_main_view_controller.set_model(default_mode.combination)
  
  # Set the empty html page for displaying the sample text. The actual content will be set in
  # method "update_sample_text". We use an absolute path to load the page so that the relative
  # path reference to the style sheet can be derrived by the browser.
  text_view = my_main_view_controller.find_subview_by_name('webview_text_view')
  absolute_page_path = 'file:' + os.path.abspath('etc/text_page.html')
  logger.info('Loading HTML page at %s' % absolute_page_path)
  text_view.load_url(absolute_page_path)
  
  # Wait for a fraction of a second so that load_url() above (which seems to be aynchronous)
  # has a chance to load the page before update_sample_text() below sets the initial content.
  time.sleep(1.0 * conf.rechtschreibung.initial_update_sample_text_delay / 1000.0)
  
  my_main_view_controller.update_sample_text()
  my_main_view_controller.present('fullscreen', title_bar_color=defaults.COLOR_GREY)
  speech.stop()
  logger.info("Terminate application")