forked from hlorus/CAD_Sketcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolver_state.py
37 lines (25 loc) · 1.04 KB
/
solver_state.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from bpy.types import Operator, Context
from bpy.props import IntProperty
from bpy.utils import register_classes_factory
from ..declarations import Operators
class View3D_OT_slvs_show_solver_state(Operator):
"""Show details about solver status"""
bl_idname = Operators.ShowSolverState
bl_label = "Solver Status"
index: IntProperty(default=-1)
def execute(self, context: Context):
index = self.index
if index == -1:
return {"CANCELLED"}
def draw_item(self, context: Context):
layout = self.layout
sketch = context.scene.sketcher.entities.get(index)
state = sketch.get_solver_state()
row = layout.row(align=True)
row.alignment = "LEFT"
row.label(text=state.name, icon=state.icon)
layout.separator()
layout.label(text=state.description)
context.window_manager.popup_menu(draw_item)
return {"FINISHED"}
register, unregister = register_classes_factory((View3D_OT_slvs_show_solver_state,))