QuiltiX Plugins 0.0.1
Custom Plugins for QuiltiX
Loading...
Searching...
No Matches
plugin Namespace Reference

Classes

class  glTFEnginePage
 Custom web engine page for the glTF viewer. More...
 
class  GLTFHighlighter
 Highlighter for glTF text. More...
 
class  QuiltiX_glTF_serializer
 glTF serializer for MaterialX More...
 

Functions

 load_qt_modules ()
 Function to delay loading of Qt modules until after the QuiltiX UI is initialized.
 
 after_ui_init ("quiltix.QuiltiXWindow" editor)
 After UI initialization, add the MaterialX glTF serializer to the editor.
 
str plugin_name ()
 Get the name of the plugin.
 
bool is_valid ()
 Check if the plugin is valid.
 
 __init__ (self)
 Initialize the JSON highlighter.
 
 highlight (self, text)
 Highlight the given JSON text.
 

Variables

bool have_highliting = True
 
 logger = logging.getLogger(__name__)
 
bool haveGLTF = False
 
bool has_materialxjsoncore = True
 
 lexer = JsonLexer()
 
 formatter = HtmlFormatter(linenos=False, style='github-dark')
 
bool use_pygments = False
 
bool have_support_modules = True
 

Function Documentation

◆ __init__()

plugin.__init__ ( self)

Initialize the JSON highlighter.

Definition at line 43 of file materialxjson/plugin.py.

43 def __init__(self):
44 '''
45 @brief Initialize the JSON highlighter
46 '''
47 self.lexer = JsonLexer()
48 # We don't add line numbers since this get's copied with
49 # copy-paste.
50 self.formatter = HtmlFormatter(linenos=False, style='github-dark')
51

◆ after_ui_init()

plugin.after_ui_init ( "quiltix.QuiltiXWindow" editor)

After UI initialization, add the MaterialX glTF serializer to the editor.

Definition at line 609 of file materialxgltf/plugin.py.

609def after_ui_init(editor: "quiltix.QuiltiXWindow"):
610 '''
611 @brief After UI initialization, add the MaterialX glTF serializer to the editor.
612 '''
613 logger.info("Adding MaterialX glTF serializer")
614 loaded_qt = load_qt_modules()
615 if loaded_qt:
616 editor.gltf_serializer = QuiltiX_glTF_serializer(editor, constants.ROOT)
617

◆ highlight()

plugin.highlight ( self,
text )

Highlight the given JSON text.

Parameters
textThe JSON text to highlight
Returns
The highlighted HTML

Definition at line 52 of file materialxjson/plugin.py.

52 def highlight(self, text):
53 '''
54 @brief Highlight the given JSON text
55 @param text The JSON text to highlight
56 @return The highlighted HTML
57 '''
58 highlighted_html = highlight(text, self.lexer, self.formatter)
59 styles = (
60 f"<style>"
61 f"{self.formatter.get_style_defs('.highlight')}"
62 f"pre {{ line-height: 1.0; margin: 0; }}"
63 f"</style>"
64 )
65 full_html = f"<html><head>{styles}</head><body>{highlighted_html}</body></html>"
66 return full_html
67

◆ is_valid()

bool plugin.is_valid ( )

Check if the plugin is valid.

That is the glTF serializer module is installed.

Returns
True if the plugin is valid), False otherwise.

Definition at line 626 of file materialxgltf/plugin.py.

626def is_valid() -> bool:
627 '''
628 @brief Check if the plugin is valid. That is the glTF serializer module is installed.
629 @return True if the plugin is valid), False otherwise.
630 '''
631 return haveGLTF

◆ load_qt_modules()

plugin.load_qt_modules ( )

Function to delay loading of Qt modules until after the QuiltiX UI is initialized.

Definition at line 21 of file materialxgltf/plugin.py.

21def load_qt_modules():
22 global QtCore, QAction, QTextEdit, QDockWidget, QVBoxLayout, QWidget
23 try:
24 from qtpy import QtCore # type: ignore
25 from qtpy.QtWidgets import QAction, QDockWidget, QVBoxLayout, QTextEdit, QWidget
26 logger.info("qtpy modules loaded successfully")
27 return True
28 except ImportError as e:
29 logger.error(f"Failed to import qtpy modules: {e}")
30 return False
31

◆ plugin_name()

str plugin.plugin_name ( )

Get the name of the plugin.

Returns
The name of the plugin.

Definition at line 618 of file materialxgltf/plugin.py.

618def plugin_name() -> str:
619 '''
620 @brief Get the name of the plugin.
621 @return The name of the plugin.'''
622 if haveGLTF:
623 return "MaterialX glTF Serializer"
624 return ""
625

Variable Documentation

◆ formatter

plugin.formatter = HtmlFormatter(linenos=False, style='github-dark')

Definition at line 50 of file materialxjson/plugin.py.

◆ has_materialxjsoncore

bool plugin.has_materialxjsoncore = True

Definition at line 27 of file materialxjson/plugin.py.

◆ have_highliting

bool plugin.have_highliting = True

Definition at line 11 of file materialxgltf/plugin.py.

◆ have_support_modules

bool plugin.have_support_modules = True

Definition at line 46 of file materialxslx/plugin.py.

◆ haveGLTF

bool plugin.haveGLTF = False

Definition at line 47 of file materialxgltf/plugin.py.

◆ lexer

plugin.lexer = JsonLexer()

Definition at line 47 of file materialxjson/plugin.py.

◆ logger

plugin.logger = logging.getLogger(__name__)

Definition at line 42 of file materialxgltf/plugin.py.

◆ use_pygments

bool plugin.use_pygments = False

Definition at line 17 of file materialxslx/plugin.py.