statable 3.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codegen/__init__.py +38 -0
- codegen/c_code_generator.py +1752 -0
- codegen/code_merger.py +371 -0
- codegen/code_templates.py +509 -0
- codegen/config.py +167 -0
- codegen/enum_generator.py +377 -0
- codegen/event_queue_generator.py +303 -0
- codegen/interrupt_generator.py +345 -0
- codegen/naming_convention.py +171 -0
- codegen/osal_generator.py +282 -0
- codegen/role_function_generator.py +1244 -0
- codegen/sample_data.py +269 -0
- codegen/state_actions_generator.py +395 -0
- codegen/struct_generator.py +721 -0
- codegen/timer_generator.py +299 -0
- codegen/transition_generator.py +907 -0
- codegen/type_mapper.py +69 -0
- codegen/validate/__init__.py +38 -0
- codegen/validate/change_actions.py +90 -0
- codegen/validate/change_applier.py +416 -0
- codegen/validate/clipboard_manager.py +47 -0
- codegen/validate/data/__init__.py +30 -0
- codegen/validate/data/action_definitions.py +200 -0
- codegen/validate/data/keywords.py +46 -0
- codegen/validate/data/prompt_templates.py +176 -0
- codegen/validate/data/validation_rules.py +205 -0
- codegen/validate/items/__init__.py +30 -0
- codegen/validate/items/base_validator.py +25 -0
- codegen/validate/items/cell_validator.py +275 -0
- codegen/validate/items/custom_type_validator.py +75 -0
- codegen/validate/items/event_validator.py +78 -0
- codegen/validate/items/flag_validator.py +74 -0
- codegen/validate/items/interrupt_validator.py +75 -0
- codegen/validate/items/queue_validator.py +73 -0
- codegen/validate/items/role_function_validator.py +175 -0
- codegen/validate/items/state_validator.py +88 -0
- codegen/validate/items/timer_validator.py +120 -0
- codegen/validate/items/transition_validator.py +113 -0
- codegen/validate/items/variable_validator.py +132 -0
- codegen/validate/logger.py +52 -0
- codegen/validate/models.py +177 -0
- codegen/validate/prompt_generator.py +724 -0
- codegen/validate/response_parser.py +154 -0
- codegen/validate/response_validator.py +275 -0
- codegen/validate/validation_dialog.py +322 -0
- codegen/validate/validator.py +94 -0
- codegen/variable_generator.py +419 -0
- statable/__init__.py +71 -0
- statable/__main__.py +49 -0
- statable/cli.py +251 -0
- statable/global_defs.py +256 -0
- statable/mermaid_gen.py +144 -0
- statable/model.py +426 -0
- statable/parser.py +64 -0
- statable/sample_data.py +435 -0
- statable/shared/__init__.py +24 -0
- statable/shared/condition_library.py +63 -0
- statable/shared/literal_library.py +66 -0
- statable/shared/role_function_library.py +150 -0
- statable/state_machine.py +121 -0
- statable/xml_io.py +1164 -0
- statable-3.1.0.dist-info/METADATA +151 -0
- statable-3.1.0.dist-info/RECORD +117 -0
- statable-3.1.0.dist-info/WHEEL +5 -0
- statable-3.1.0.dist-info/entry_points.txt +2 -0
- statable-3.1.0.dist-info/top_level.txt +3 -0
- statable_gui/__init__.py +23 -0
- statable_gui/action_edit_dialog.py +214 -0
- statable_gui/code_generation_dialog.py +486 -0
- statable_gui/code_generation_settings_dialog.py +522 -0
- statable_gui/common_widgets.py +537 -0
- statable_gui/condition_builder_dialog.py +500 -0
- statable_gui/condition_edit_dialog.py +123 -0
- statable_gui/condition_template_dialog.py +58 -0
- statable_gui/config.py +21 -0
- statable_gui/dialogs.py +439 -0
- statable_gui/event_definition_dialog.py +605 -0
- statable_gui/event_delivery_settings_dialog.py +191 -0
- statable_gui/event_queue_dialog.py +245 -0
- statable_gui/global_defs.py +167 -0
- statable_gui/global_defs_dialog.py +796 -0
- statable_gui/i18n/__init__.py +118 -0
- statable_gui/interrupt_handler_edit_dialog.py +810 -0
- statable_gui/layer_settings_dialog.py +180 -0
- statable_gui/libcntrl/__init__.py +23 -0
- statable_gui/libcntrl/condition_library.py +13 -0
- statable_gui/libcntrl/literal_library.py +13 -0
- statable_gui/libcntrl/literal_management_dialog.py +185 -0
- statable_gui/libcntrl/role_function_edit_dialog.py +145 -0
- statable_gui/libcntrl/role_function_library.py +13 -0
- statable_gui/literal_definition_dialog.py +62 -0
- statable_gui/logger.py +83 -0
- statable_gui/main_window.py +1380 -0
- statable_gui/matrix_table.py +413 -0
- statable_gui/preference_keys.py +18 -0
- statable_gui/preferences.py +74 -0
- statable_gui/role_function_dialog.py +244 -0
- statable_gui/sample_data.py +11 -0
- statable_gui/state_actions_dialog.py +398 -0
- statable_gui/symbol_picker.py +170 -0
- statable_gui/traceball.py +37 -0
- statable_gui/transition_editor_direct/__init__.py +15 -0
- statable_gui/transition_editor_direct/actions_tab.py +856 -0
- statable_gui/transition_editor_direct/code_widget.py +344 -0
- statable_gui/transition_editor_direct/coverage_analyzer.py +163 -0
- statable_gui/transition_editor_direct/dialog.py +335 -0
- statable_gui/transition_editor_direct/draft.py +270 -0
- statable_gui/transition_editor_direct/edit_dialogs.py +160 -0
- statable_gui/transition_editor_direct/overview_tab.py +173 -0
- statable_gui/transition_editor_direct/palette_widget.py +233 -0
- statable_gui/transition_editor_direct/relations_edit_dialog.py +156 -0
- statable_gui/transition_editor_direct/relations_tab.py +230 -0
- statable_gui/transition_editor_direct/system_global_dialog.py +52 -0
- statable_gui/transition_editor_direct/transition_actions_dialog.py +109 -0
- statable_gui/transition_editor_direct/transitions_tab.py +620 -0
- statable_gui/validation_dialog.py +285 -0
- statable_gui/widgets.py +1315 -0
statable_gui/logger.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import sys
|
|
3
|
+
from typing import Optional, Callable
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class StaTableLogger:
|
|
7
|
+
"""StaTable dedicated logger (singleton)"""
|
|
8
|
+
_instance: Optional['StaTableLogger'] = None
|
|
9
|
+
_log_callback: Optional[Callable[[str], None]] = None
|
|
10
|
+
|
|
11
|
+
def __new__(cls):
|
|
12
|
+
if cls._instance is None:
|
|
13
|
+
cls._instance = super().__new__(cls)
|
|
14
|
+
cls._instance._init_logger()
|
|
15
|
+
return cls._instance
|
|
16
|
+
|
|
17
|
+
def _init_logger(self):
|
|
18
|
+
self.logger = logging.getLogger("StaTable")
|
|
19
|
+
self.logger.setLevel(logging.DEBUG)
|
|
20
|
+
|
|
21
|
+
console = logging.StreamHandler(sys.stdout)
|
|
22
|
+
console.setLevel(logging.DEBUG)
|
|
23
|
+
formatter = logging.Formatter(
|
|
24
|
+
'%(asctime)s [%(levelname)s] %(name)s: %(message)s'
|
|
25
|
+
)
|
|
26
|
+
console.setFormatter(formatter)
|
|
27
|
+
self.logger.addHandler(console)
|
|
28
|
+
|
|
29
|
+
self.trace_handler = _TraceBallHandler()
|
|
30
|
+
self.trace_handler.setLevel(logging.DEBUG)
|
|
31
|
+
self.trace_handler.setFormatter(formatter)
|
|
32
|
+
self.logger.addHandler(self.trace_handler)
|
|
33
|
+
|
|
34
|
+
def set_log_callback(self, callback: Callable[[str], None]):
|
|
35
|
+
self._log_callback = callback
|
|
36
|
+
self.trace_handler.set_callback(callback)
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def get_logger(cls) -> logging.Logger:
|
|
40
|
+
return cls().logger
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def debug(cls, msg: str, *args, **kwargs):
|
|
44
|
+
cls.get_logger().debug(msg, *args, **kwargs)
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def info(cls, msg: str, *args, **kwargs):
|
|
48
|
+
cls.get_logger().info(msg, *args, **kwargs)
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def warning(cls, msg: str, *args, **kwargs):
|
|
52
|
+
cls.get_logger().warning(msg, *args, **kwargs)
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def error(cls, msg: str, *args, **kwargs):
|
|
56
|
+
cls.get_logger().error(msg, *args, **kwargs)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class _TraceBallHandler(logging.Handler):
|
|
60
|
+
def __init__(self):
|
|
61
|
+
super().__init__()
|
|
62
|
+
self.callback: Optional[Callable[[str], None]] = None
|
|
63
|
+
|
|
64
|
+
def set_callback(self, callback: Optional[Callable[[str], None]]):
|
|
65
|
+
self.callback = callback
|
|
66
|
+
|
|
67
|
+
def emit(self, record: logging.LogRecord):
|
|
68
|
+
"""Forward the record to the callback (TraceBall widget).
|
|
69
|
+
|
|
70
|
+
[v2.3 fix] If the callback target has been deleted by Qt
|
|
71
|
+
(e.g. the TraceBallWidget was destroyed when a MainWindow was
|
|
72
|
+
garbage-collected), the C++ object access raises RuntimeError.
|
|
73
|
+
In that case, clear the callback so subsequent records do not
|
|
74
|
+
keep retrying; a new widget will install a new callback in its
|
|
75
|
+
own __init__.
|
|
76
|
+
"""
|
|
77
|
+
if self.callback:
|
|
78
|
+
try:
|
|
79
|
+
msg = self.format(record)
|
|
80
|
+
self.callback(msg)
|
|
81
|
+
except RuntimeError:
|
|
82
|
+
# Target widget was deleted; drop the stale callback.
|
|
83
|
+
self.callback = None
|