def register(): for m in imported_modules + node_list: if m.__name__ != "sverchok.menu": if hasattr(m, "register"): #print("Registering module: {}".format(m.__name__)) m.register() # this is used to access preferences, should/could be hidden # in an interface data_structure.SVERCHOK_NAME = __name__ print("** version: ", get_version_string(), " **") print("** Have a nice day with sverchok **\n") ascii_print.logo() node_defaults.register_defaults() auto_gather_node_classes() # We have to register menu module after all nodes are registered menu.register() if reload_event: data_structure.RELOAD_EVENT = True menu.reload_menu() print("Sverchok is reloaded, press update")
def register(): for m in imported_modules + node_list: if m.__name__ != "sverchok.menu": if hasattr(m, "register"): #print("Registering module: {}".format(m.__name__)) m.register() # this is used to access preferences, should/could be hidden # in an interface data_structure.SVERCHOK_NAME = __name__ print("** version: ", get_version_string()," **") print("** Have a nice day with sverchok **\n") ascii_print.logo() node_defaults.register_defaults() auto_gather_node_classes() # We have to register menu module after all nodes are registered menu.register() if reload_event: data_structure.RELOAD_EVENT = True menu.reload_menu() print("Sverchok is reloaded, press update")
def try_initialize(): """ Try to initialize logging subsystem. Does nothing if everything is already initialized. Prints an error if it is called too early. """ global internal_buffer_initialized global file_initialized global initialized if sverchok.reload_event: return with sv_preferences() as prefs: if not prefs: logging.error( "Can't obtain logging preferences, it's too early. Stack:\n%s", "".join(traceback.format_stack())) return if not internal_buffer_initialized: if prefs.log_to_buffer: buffer = get_log_buffer(prefs.log_buffer_name) if buffer is not None: if prefs.log_to_buffer_clean: buffer.clear() logging.debug("Internal text buffer cleared") handler = TextBufferHandler(prefs.log_buffer_name) handler.setFormatter(logging.Formatter(log_format)) logging.getLogger().addHandler(handler) for area in bpy.context.screen.areas: if area.type == 'TEXT_EDITOR': if area.spaces[0].text is None: area.spaces[0].text = buffer break internal_buffer_initialized = True else: internal_buffer_initialized = True if not file_initialized: if prefs.log_to_file: handler = logging.handlers.RotatingFileHandler( prefs.log_file_name, maxBytes=10 * 1024 * 1024, backupCount=3) handler.setFormatter(logging.Formatter(log_format)) logging.getLogger().addHandler(handler) file_initialized = True if internal_buffer_initialized and file_initialized and not initialized: setLevel(prefs.log_level) logging.info( "Initializing Sverchok logging. Blender version %s, Sverchok version %s", bpy.app.version_string, get_version_string()) logging.debug( "Current log level: %s, log to text buffer: %s, log to file: %s", prefs.log_level, ("no" if not prefs.log_to_buffer else prefs.log_buffer_name), ("no" if not prefs.log_to_file else prefs.log_file_name)) initialized = True
def try_initialize(): """ Try to initialize logging subsystem. Does nothing if everything is already initialized. Prints an error if it is called too early. """ global internal_buffer_initialized global file_initialized global initialized if sverchok.reload_event: return with sv_preferences() as prefs: if not prefs: logging.error("Can't obtain logging preferences, it's too early. Stack:\n%s", "".join(traceback.format_stack())) return if not internal_buffer_initialized: if prefs.log_to_buffer: buffer = get_log_buffer(prefs.log_buffer_name) if buffer is not None: if prefs.log_to_buffer_clean: buffer.clear() logging.debug("Internal text buffer cleared") handler = TextBufferHandler(prefs.log_buffer_name) handler.setFormatter(logging.Formatter(log_format)) logging.getLogger().addHandler(handler) for area in bpy.context.screen.areas: if area.type == 'TEXT_EDITOR': if area.spaces[0].text is None: area.spaces[0].text = buffer break internal_buffer_initialized = True else: internal_buffer_initialized = True if not file_initialized: if prefs.log_to_file: handler = logging.handlers.RotatingFileHandler(prefs.log_file_name, maxBytes = 10*1024*1024, backupCount = 3) handler.setFormatter(logging.Formatter(log_format)) logging.getLogger().addHandler(handler) file_initialized = True if internal_buffer_initialized and file_initialized and not initialized: setLevel(prefs.log_level) if not prefs.log_to_console: # Remove console output handler. # The trick is we have to remove it *after* other handlers # have been initialized, otherwise it will be re-enabled automatically. global consoleHandler if consoleHandler is not None: logging.debug("Log output to console is disabled. Further messages will be available only in text buffer and file (if configured).") logging.getLogger().removeHandler(consoleHandler) logging.info("Initializing Sverchok logging. Blender version %s, Sverchok version %s", bpy.app.version_string, get_version_string()) logging.debug("Current log level: %s, log to text buffer: %s, log to file: %s, log to console: %s", prefs.log_level, ("no" if not prefs.log_to_buffer else prefs.log_buffer_name), ("no" if not prefs.log_to_file else prefs.log_file_name), ("yes" if prefs.log_to_console else "no")) initialized = True
def show_welcome(): print("** version: ", get_version_string(), " **") print("** Have a nice day with sverchok **\n") logo()
def show_welcome(): logo() print("\nsv: version:", get_version_string())
def try_initialize(): """ Try to initialize logging subsystem. Does nothing if everything is already initialized. Prints an error if it is called too early. """ global internal_buffer_initialized global initialized with sv_preferences() as prefs: if not prefs: logging.error("Can't obtain logging preferences, it's too early") return if not internal_buffer_initialized: if prefs.log_to_buffer: buffer = get_log_buffer(prefs.log_buffer_name) if buffer is not None: if prefs.log_to_buffer_clean: buffer.clear() logging.debug("Internal text buffer cleared") handler = logging.StreamHandler(buffer) handler.setFormatter(logging.Formatter(log_format)) logging.getLogger().addHandler(handler) for area in bpy.context.screen.areas: if area.type == 'TEXT_EDITOR': if area.spaces[0].text is None: area.spaces[0].text = buffer break internal_buffer_initialized = True else: internal_buffer_initialized = True if not initialized: if prefs.log_to_file: handler = logging.handlers.RotatingFileHandler(prefs.log_file_name, maxBytes = 10*1024*1024, backupCount = 3) handler.setFormatter(logging.Formatter(log_format)) logging.getLogger().addHandler(handler) setLevel(prefs.log_level) logging.info("Initializing Sverchok logging. Blender version %s, Sverchok version %s", bpy.app.version_string, get_version_string()) logging.debug("Current log level: %s, log to text buffer: %s, log to file: %s", prefs.log_level, ("no" if not prefs.log_to_buffer else prefs.log_buffer_name), ("no" if not prefs.log_to_file else prefs.log_file_name) ) initialized = True