Example #1
0
File: app.py Project: anish/phatch
def main(config_paths, app_file):
    """init should be called first!"""
    parse_locale(config_paths)
    options, paths = parse_options()
    from core.settings import create_settings
    settings = create_settings(config_paths, options)
    if settings['verbose']:
        from lib import system
        system.VERBOSE = True
    if 'safe' in settings:
        from lib import formField
        formField.set_safe(settings['safe'])
        del settings['safe']
    if settings['image_inspector']:
        _inspect(app_file, paths)
        return
    if settings['init_fonts']:
        _init_fonts()
        return
    else:
        config.check_fonts()
    if paths and not (paths[0] == 'recent' or \
            has_ext(paths[0], INFO['extension'])):
        settings['droplet'] = True
        paths.insert(0, 'recent')
    if settings['droplet']:
        if not paths:
            paths = ['recent']
        _droplet(app_file, paths, settings)
    elif len(paths) > 1 or settings['console'] or settings['interactive']:
        _console(paths, settings)
    else:
        _gui(app_file, paths, settings)
Example #2
0
def main(config_paths, app_file):
    """init should be called first!"""
    parse_locale(config_paths)
    options, paths = parse_options()
    from core.settings import create_settings
    settings = create_settings(config_paths, options)
    if settings['verbose']:
        from lib import system
        system.VERBOSE = True
    if 'safe' in settings:
        from lib import formField
        formField.set_safe(settings['safe'])
        del settings['safe']
    if settings['image_inspector']:
        _inspect(app_file, paths)
        return
    if settings['init_fonts']:
        _init_fonts()
        return
    else:
        config.check_fonts()
    if paths and not (paths[0] == 'recent' or \
            has_ext(paths[0], INFO['extension'])):
        settings['droplet'] = True
        paths.insert(0, 'recent')
    if settings['droplet']:
        if not paths:
            paths = ['recent']
        _droplet(app_file, paths, settings)
    elif len(paths) > 1 or settings['console'] or settings['interactive']:
        _console(paths, settings)
    else:
        _gui(app_file, paths, settings)
Example #3
0
 def set_safe_mode(self, state):
     if state == False:
         answer = self.show_question(
             _('Safe mode protects you from the execution of possibly '\
             'harmful scripts.\nAre you sure you want to disable it?'),
             style=wx.YES_NO | wx.ICON_QUESTION | wx.NO_DEFAULT)
         if answer != wx.ID_YES:
             self.menu_tools.Check(self.menu_tools_safe.GetId(), True)
             return
     formField.set_safe(state)
Example #4
0
def main():
    """init should be called first!"""
    # process settings
    options, paths = parse_options()
    settings = create_settings(options)
    init_log(options.log_level)
    if options.list_context:
        show_context()
        return
    if hasattr(options, 'associate') and options.associate:
        associate_image_types()
        return
    if hasattr(options, 'deassociate') and options.deassociate:
        deassociate_image_types()
        return
    if settings['verbose']:
        system.VERBOSE = True
    # safe can only be set by the command line or the ui, and is not permanent
    if 'safe' in settings:
        from lib import formField
        formField.set_safe(settings['safe'])
        del settings['safe']
    # initialize font.cache -> can be done at root level
    set_font_cache()
    if settings['init_fonts']:
        init_fonts()
        return
    # apply pil patches
    apply_pil_patches()
    # start inspector
    if settings['image_inspector']:
        start_inspector(paths)
        return
    # check for font.cache, geek.txt
    check_user_paths()
    # force to choose from recent action lists if no action list is given
    if paths and not (paths[0] == 'recent' or \
            system.has_ext(paths[0], CONTEXT['app_extension'])):
        settings['droplet'] = True
        paths.insert(0, 'recent')
    # start droplet, console or gui
    if settings['droplet']:
        if not paths:
            paths = ['recent']
        start_droplet(paths, settings)
    elif len(paths) > 1 or settings['console'] or settings['interactive']:
        start_console(paths, settings)
    else:
        start_gui(paths, settings)