CellModules
viewer Namespace Reference

Classes

class  StepHandler
 
class  Viewer
 

Functions

def find_free_port (start=8000, end=9000, host='localhost')
 
def find_vscode_settings ()
 VSCODE THEME COLOR ####################################. More...
 
def get_default_theme_resources ()
 
def normalize (text)
 
def matches (norm_name, norm_target)
 
def scan_for_theme (base_dir, norm_target)
 
def find_theme_file (theme_name=None)
 
def load_theme_colors (theme_path)
 
def get_colors ()
 
def render_template (file, context=None)
 
def _cleanup (server, thread)
 

Variables

string STATIC_DIR = Path(__file__).resolve().parent / 'static'
 

Function Documentation

◆ _cleanup()

def viewer._cleanup (   server,
  thread 
)
private
Stop the HTTPServer and join its thread.

Definition at line 306 of file viewer.py.

◆ find_free_port()

def viewer.find_free_port (   start = 8000,
  end = 9000,
  host = 'localhost' 
)

Definition at line 18 of file viewer.py.

◆ find_theme_file()

def viewer.find_theme_file (   theme_name = None)
Find the JSON file for the given VS Code theme.

Definition at line 124 of file viewer.py.

◆ find_vscode_settings()

def viewer.find_vscode_settings ( )

VSCODE THEME COLOR ####################################.

Return the path to settings.json: workspace first, then user.

Definition at line 35 of file viewer.py.

◆ get_colors()

def viewer.get_colors ( )

Definition at line 171 of file viewer.py.

◆ get_default_theme_resources()

def viewer.get_default_theme_resources ( )
Return the default theme name and the VS Code resources directory.

Definition at line 64 of file viewer.py.

◆ load_theme_colors()

def viewer.load_theme_colors (   theme_path)
Load and return the 'colors' dict from the theme JSON, following includes if needed.

Definition at line 150 of file viewer.py.

◆ matches()

def viewer.matches (   norm_name,
  norm_target 
)
Return True if either normalized name matches or contains the target.

Definition at line 94 of file viewer.py.

◆ normalize()

def viewer.normalize (   text)
Normalize a string to lowercase alphanumeric only.

Definition at line 89 of file viewer.py.

◆ render_template()

def viewer.render_template (   file,
  context = None 
)
Lit le fichier à `path`, puis pour chaque {{ expr }} dans le texte
évalue `expr` avec eval(expr, {}, context) et remplace par str(result).

context : dict des variables disponibles dans vos expressions.

Definition at line 180 of file viewer.py.

◆ scan_for_theme()

def viewer.scan_for_theme (   base_dir,
  norm_target 
)
Scan base_dir/*/themes/*.json to find a matching theme.

Definition at line 101 of file viewer.py.

Variable Documentation

◆ STATIC_DIR

string viewer.STATIC_DIR = Path(__file__).resolve().parent / 'static'

Definition at line 16 of file viewer.py.