molde 0.1.2__tar.gz → 0.1.4__tar.gz
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.
- {molde-0.1.2 → molde-0.1.4}/PKG-INFO +3 -3
- molde-0.1.4/molde/__init__.py +12 -0
- {molde-0.1.2 → molde-0.1.4}/molde/__main__.py +11 -11
- {molde-0.1.2 → molde-0.1.4}/molde/actors/common_symbols_actor.py +27 -11
- {molde-0.1.2 → molde-0.1.4}/molde/colors/color.py +31 -1
- {molde-0.1.2 → molde-0.1.4}/molde/poly_data/__init__.py +0 -6
- {molde-0.1.2 → molde-0.1.4}/molde/poly_data/arrows.py +1 -1
- {molde-0.1.2 → molde-0.1.4}/molde/poly_data/simple_shapes.py +1 -1
- {molde-0.1.2 → molde-0.1.4}/molde/render_widgets/common_render_widget.py +24 -28
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/__init__.py +4 -3
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qcheckbox.qss +5 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qinputs.qss +8 -5
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qlayouts.qss +2 -1
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qpushbutton.qss +2 -2
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qtabwidget.qss +0 -1
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qtoolbar.qss +0 -10
- {molde-0.1.2 → molde-0.1.4}/molde/utils/__init__.py +1 -1
- molde-0.1.4/molde/utils/poly_data_utils.py +66 -0
- {molde-0.1.2 → molde-0.1.4}/pyproject.toml +3 -3
- molde-0.1.2/molde/__init__.py +0 -6
- molde-0.1.2/molde/poly_data/complex_shapes.py +0 -26
- molde-0.1.2/molde/utils/poly_data_utils.py +0 -25
- {molde-0.1.2 → molde-0.1.4}/README.md +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/actors/__init__.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/actors/ghost_actor.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/actors/lines_actor.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/actors/round_points_actor.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/actors/square_points_actor.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/colors/__init__.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/colors/color_names.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/fonts/IBMPlexMono-Bold.ttf +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/fonts/IBMPlexMono-Regular.ttf +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_down_dark_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_down_disabled_dark_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_down_disabled_light_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_down_light_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_left_dark_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_left_light_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_right_dark_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_right_light_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_up_dark_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_up_disabled_dark_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_up_disabled_light_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/arrow_up_light_theme.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/icons/check_box_image.svg +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/interactor_styles/__init__.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/interactor_styles/arcball_camera_style.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/interactor_styles/box_selection_style.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/main_window.ui +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/pickers/__init__.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/pickers/cell_area_picker.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/pickers/cell_property_area_picker.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/poly_data/lines_data.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/poly_data/vertices_data.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/render_widgets/__init__.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/render_widgets/animated_render_widget.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/common.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/create_color_page.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/mainwindow.ui +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qmenubar.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qprogressbar.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qradiobutton.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qscrollbar.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qslider.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qtablewidget.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qtoolbuttons.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/stylesheets/qtreewidget.qss +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/ui_files/messages/new_loading_window.ui +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/utils/format_sequences.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/utils/tree_info.py +0 -0
- {molde-0.1.2 → molde-0.1.4}/molde/windows/loading_window.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: molde
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.4
|
4
4
|
Summary:
|
5
5
|
Author: André Fernandes
|
6
6
|
Author-email: fpf.andre@gmail.com
|
@@ -12,8 +12,8 @@ Classifier: Programming Language :: Python :: 3.12
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.13
|
13
13
|
Requires-Dist: moviepy (>=1.0.3,<2.0.0)
|
14
14
|
Requires-Dist: numpy (>=2.0,<3.0)
|
15
|
-
Requires-Dist:
|
16
|
-
Requires-Dist:
|
15
|
+
Requires-Dist: pyside6 (>=6.8.1,<7.0.0) ; python_version >= "3.10" and python_version < "3.14"
|
16
|
+
Requires-Dist: qtpy (>=2.4.2,<3.0.0)
|
17
17
|
Requires-Dist: vtk (>=9.3.1,<10.0.0)
|
18
18
|
Description-Content-Type: text/markdown
|
19
19
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from qtpy.uic import loadUi
|
3
|
+
from .colors import Color
|
4
|
+
from PySide6.QtCore import QDir
|
5
|
+
|
6
|
+
MOLDE_DIR = Path(__file__).parent
|
7
|
+
UI_DIR = MOLDE_DIR / "ui_files/"
|
8
|
+
|
9
|
+
def load_ui(uifile: str | Path, baseinstance, working_directory: str| Path = None):
|
10
|
+
if working_directory is not None:
|
11
|
+
working_directory = QDir(working_directory)
|
12
|
+
return loadUi(uifile, baseinstance, working_directory)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import os, sys
|
2
|
-
from
|
3
|
-
from
|
4
|
-
from
|
5
|
-
from
|
2
|
+
from qtpy.QtWidgets import QMainWindow, QApplication, QMessageBox, QLineEdit, QTableWidgetItem, QPushButton, QLabel
|
3
|
+
from qtpy.QtGui import QColor
|
4
|
+
from qtpy import uic
|
5
|
+
from qtpy.QtCore import Qt
|
6
6
|
from time import time
|
7
7
|
|
8
8
|
from vtkmodules.vtkFiltersSources import vtkCylinderSource
|
@@ -20,11 +20,11 @@ class Example(QMainWindow):
|
|
20
20
|
self.current_theme = "light"
|
21
21
|
|
22
22
|
self.change_theme_button.clicked.connect(self.change_theme)
|
23
|
-
self.render_widget: CommonRenderWidget
|
24
|
-
self.render_widget.create_axes()
|
25
|
-
self.render_widget.create_scale_bar()
|
26
|
-
self.render_widget.create_color_bar()
|
27
|
-
self.render_widget.set_info_text("Hola\nque\ntal?")
|
23
|
+
# self.render_widget: CommonRenderWidget
|
24
|
+
# self.render_widget.create_axes()
|
25
|
+
# self.render_widget.create_scale_bar()
|
26
|
+
# self.render_widget.create_color_bar()
|
27
|
+
# self.render_widget.set_info_text("Hola\nque\ntal?")
|
28
28
|
|
29
29
|
cylinder = vtkCylinderSource()
|
30
30
|
cylinder.SetResolution(8)
|
@@ -32,7 +32,7 @@ class Example(QMainWindow):
|
|
32
32
|
cylinder_mapper.SetInputConnection(cylinder.GetOutputPort())
|
33
33
|
cylinder_actor = vtkActor()
|
34
34
|
cylinder_actor.SetMapper(cylinder_mapper)
|
35
|
-
self.render_widget.add_actors(cylinder_actor)
|
35
|
+
# self.render_widget.add_actors(cylinder_actor)
|
36
36
|
|
37
37
|
self.botao1 = QPushButton()
|
38
38
|
self.label = QLabel("Olha o sapooo")
|
@@ -51,7 +51,7 @@ class Example(QMainWindow):
|
|
51
51
|
else:
|
52
52
|
self.current_theme = "light"
|
53
53
|
|
54
|
-
self.render_widget.set_theme(self.current_theme)
|
54
|
+
# self.render_widget.set_theme(self.current_theme)
|
55
55
|
stylesheets.set_theme(self.current_theme)
|
56
56
|
|
57
57
|
def closeEvent(self, event):
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
2
|
|
3
3
|
from molde import Color
|
4
|
+
from molde.utils import transform_polydata
|
4
5
|
from vtkmodules.vtkCommonCore import (
|
5
6
|
vtkDoubleArray,
|
6
7
|
vtkIntArray,
|
@@ -27,8 +28,20 @@ class CommonSymbolsActor(vtkActor):
|
|
27
28
|
self._shapes: dict[str, vtkPolyData] = dict()
|
28
29
|
self._symbols: list[Symbol] = list()
|
29
30
|
|
30
|
-
def register_shape(
|
31
|
-
self
|
31
|
+
def register_shape(
|
32
|
+
self,
|
33
|
+
name: str,
|
34
|
+
shape: vtkPolyData,
|
35
|
+
position: Triple = (0, 0, 0),
|
36
|
+
rotation: Triple = (0, 0, 0),
|
37
|
+
scale: Triple = (1, 1, 1),
|
38
|
+
):
|
39
|
+
self._shapes[name] = transform_polydata(
|
40
|
+
shape,
|
41
|
+
position,
|
42
|
+
rotation,
|
43
|
+
scale,
|
44
|
+
)
|
32
45
|
|
33
46
|
def add_symbol(
|
34
47
|
self,
|
@@ -96,6 +109,18 @@ class CommonSymbolsActor(vtkActor):
|
|
96
109
|
self.data.GetPointData().AddArray(scales)
|
97
110
|
self.data.GetPointData().SetScalars(colors)
|
98
111
|
|
112
|
+
def set_zbuffer_offsets(self, factor: float, units: float):
|
113
|
+
"""
|
114
|
+
This functions is usefull to make a object appear in front of the others.
|
115
|
+
If the object should never be hidden, the parameters should be set to
|
116
|
+
factor = 1 and offset = -66000.
|
117
|
+
"""
|
118
|
+
self.mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
119
|
+
self.mapper.SetRelativeCoincidentTopologyLineOffsetParameters(factor, units)
|
120
|
+
self.mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(factor, units)
|
121
|
+
self.mapper.SetRelativeCoincidentTopologyPointOffsetParameter(units)
|
122
|
+
self.mapper.Update()
|
123
|
+
|
99
124
|
|
100
125
|
class CommonSymbolsActorFixedSize(CommonSymbolsActor):
|
101
126
|
def build(self):
|
@@ -136,13 +161,4 @@ class CommonSymbolsActorVariableSize(CommonSymbolsActor):
|
|
136
161
|
self.mapper.SetScalarModeToUsePointData()
|
137
162
|
self.mapper.SetOrientationModeToDirection()
|
138
163
|
|
139
|
-
# shows the actor in front of everything else
|
140
|
-
# offset = -66000
|
141
|
-
offset = 0
|
142
|
-
factor = 1.3
|
143
|
-
self.mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
144
|
-
self.mapper.SetRelativeCoincidentTopologyLineOffsetParameters(factor, offset)
|
145
|
-
self.mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(factor, offset)
|
146
|
-
self.mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|
147
|
-
|
148
164
|
self.mapper.Update()
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import typing
|
2
|
-
from
|
2
|
+
from qtpy.QtGui import QColor
|
3
3
|
import numpy as np
|
4
4
|
|
5
5
|
|
@@ -35,6 +35,12 @@ class Color:
|
|
35
35
|
Initialize the color class with an instance of QColor
|
36
36
|
'''
|
37
37
|
|
38
|
+
@typing.overload
|
39
|
+
def __init__(self, color: "Color"):
|
40
|
+
'''
|
41
|
+
Initialize the color class with an instance it's own class
|
42
|
+
'''
|
43
|
+
|
38
44
|
@typing.overload
|
39
45
|
def __init__(self):
|
40
46
|
'''
|
@@ -54,6 +60,9 @@ class Color:
|
|
54
60
|
|
55
61
|
elif len(args) == 1 and isinstance(args[0], QColor):
|
56
62
|
self.from_qcolor(*args)
|
63
|
+
|
64
|
+
elif len(args) == 1 and isinstance(args[0], Color):
|
65
|
+
self.from_color(*args)
|
57
66
|
|
58
67
|
elif len(args) in [3, 4] and all_int:
|
59
68
|
self.from_rgba(*args)
|
@@ -98,6 +107,13 @@ class Color:
|
|
98
107
|
def from_qcolor(self, color: QColor) -> "Color":
|
99
108
|
return self.from_rgba(color.red(), color.green(), color.blue(), color.alpha())
|
100
109
|
|
110
|
+
def from_color(self, color: "Color"):
|
111
|
+
self.r = color.r
|
112
|
+
self.g = color.g
|
113
|
+
self.b = color.b
|
114
|
+
self.a = color.a
|
115
|
+
return self
|
116
|
+
|
101
117
|
def to_rgb(self) -> tuple[int, int, int]:
|
102
118
|
return (self.r, self.g, self.b)
|
103
119
|
|
@@ -118,3 +134,17 @@ class Color:
|
|
118
134
|
|
119
135
|
def to_qt(self) -> QColor:
|
120
136
|
return QColor(self.r, self.g, self.b, self.a)
|
137
|
+
|
138
|
+
def copy(self):
|
139
|
+
return Color(self.r, self.g, self.b, self.a)
|
140
|
+
|
141
|
+
def apply_factor(self, factor: float|int):
|
142
|
+
new_color = self.copy()
|
143
|
+
new_color.r = int(np.clip(self.r*factor, 0, 255))
|
144
|
+
new_color.g = int(np.clip(self.g*factor, 0, 255))
|
145
|
+
new_color.b = int(np.clip(self.b*factor, 0, 255))
|
146
|
+
|
147
|
+
return new_color
|
148
|
+
|
149
|
+
|
150
|
+
|
@@ -3,8 +3,8 @@ from threading import Lock
|
|
3
3
|
from typing import Literal
|
4
4
|
|
5
5
|
from PIL import Image
|
6
|
-
from
|
7
|
-
from
|
6
|
+
from qtpy.QtCore import Signal
|
7
|
+
from qtpy.QtWidgets import QFrame, QStackedLayout
|
8
8
|
from vtkmodules.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
|
9
9
|
from vtkmodules.util.numpy_support import vtk_to_numpy
|
10
10
|
from vtkmodules.vtkCommonCore import VTK_FONT_FILE, vtkLookupTable
|
@@ -40,10 +40,10 @@ class CommonRenderWidget(QFrame):
|
|
40
40
|
A vtk widget must always have a renderer, even if it is empty.
|
41
41
|
"""
|
42
42
|
|
43
|
-
left_clicked =
|
44
|
-
left_released =
|
45
|
-
right_clicked =
|
46
|
-
right_released =
|
43
|
+
left_clicked = Signal(int, int)
|
44
|
+
left_released = Signal(int, int)
|
45
|
+
right_clicked = Signal(int, int)
|
46
|
+
right_released = Signal(int, int)
|
47
47
|
|
48
48
|
def __init__(self, parent=None, *, theme="dark"):
|
49
49
|
super().__init__(parent)
|
@@ -58,22 +58,10 @@ class CommonRenderWidget(QFrame):
|
|
58
58
|
|
59
59
|
self.renderer.ResetCamera()
|
60
60
|
|
61
|
-
self.render_interactor.AddObserver(
|
62
|
-
|
63
|
-
|
64
|
-
)
|
65
|
-
self.render_interactor.AddObserver(
|
66
|
-
"LeftButtonReleaseEvent",
|
67
|
-
self.left_click_release_event
|
68
|
-
)
|
69
|
-
self.render_interactor.AddObserver(
|
70
|
-
"RightButtonPressEvent",
|
71
|
-
self.right_click_press_event
|
72
|
-
)
|
73
|
-
self.render_interactor.AddObserver(
|
74
|
-
"RightButtonReleaseEvent",
|
75
|
-
self.right_click_release_event
|
76
|
-
)
|
61
|
+
self.render_interactor.AddObserver("LeftButtonPressEvent", self.left_click_press_event)
|
62
|
+
self.render_interactor.AddObserver("LeftButtonReleaseEvent", self.left_click_release_event)
|
63
|
+
self.render_interactor.AddObserver("RightButtonPressEvent", self.right_click_press_event)
|
64
|
+
self.render_interactor.AddObserver("RightButtonReleaseEvent", self.right_click_release_event)
|
77
65
|
|
78
66
|
layout = QStackedLayout()
|
79
67
|
layout.addWidget(self.render_interactor)
|
@@ -105,7 +93,7 @@ class CommonRenderWidget(QFrame):
|
|
105
93
|
|
106
94
|
def remove_all_actors(self):
|
107
95
|
self.remove_actors(*self.get_widget_actors())
|
108
|
-
|
96
|
+
|
109
97
|
def remove_all_props(self):
|
110
98
|
self.renderer.RemoveAllViewProps()
|
111
99
|
|
@@ -158,15 +146,23 @@ class CommonRenderWidget(QFrame):
|
|
158
146
|
image = Image.fromarray(array).transpose(Image.FLIP_TOP_BOTTOM)
|
159
147
|
return image
|
160
148
|
|
161
|
-
def get_thumbnail(self):
|
149
|
+
def get_thumbnail(self) -> Image.Image:
|
162
150
|
image = self.get_screenshot()
|
163
|
-
|
151
|
+
w, h = image.size
|
152
|
+
s = min(w, h)
|
153
|
+
box = (
|
154
|
+
(w - s) // 2,
|
155
|
+
(h - s) // 2,
|
156
|
+
(w + s) // 2,
|
157
|
+
(h + s) // 2,
|
158
|
+
)
|
159
|
+
return image.crop(box).resize((512, 512))
|
164
160
|
|
165
161
|
def save_image(self, path: str | Path):
|
166
|
-
|
162
|
+
"""
|
167
163
|
Saves the render as an image.
|
168
164
|
Supported formats are JPEG, JPG, PNG, BMP, ICO, TIFF, PPM and others.
|
169
|
-
|
165
|
+
"""
|
170
166
|
image = self.get_screenshot()
|
171
167
|
with open(path, "w") as file:
|
172
168
|
image.save(file)
|
@@ -261,7 +257,7 @@ class CommonRenderWidget(QFrame):
|
|
261
257
|
colorbar_title.SetFontFamily(VTK_FONT_FILE)
|
262
258
|
colorbar_title.SetFontFile(font_file)
|
263
259
|
|
264
|
-
colorbar_label:vtkTextProperty = self.colorbar_actor.GetLabelTextProperty()
|
260
|
+
colorbar_label: vtkTextProperty = self.colorbar_actor.GetLabelTextProperty()
|
265
261
|
colorbar_label.ShadowOff()
|
266
262
|
colorbar_label.ItalicOff()
|
267
263
|
colorbar_label.BoldOn()
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from typing import Literal
|
2
|
-
from
|
2
|
+
from qtpy.QtWidgets import QApplication, QWidget
|
3
3
|
from molde import MOLDE_DIR
|
4
4
|
from molde.colors import color_names
|
5
5
|
|
@@ -31,12 +31,12 @@ def get_variables(theme:Literal["light", "dark"] = "light") -> dict:
|
|
31
31
|
"@background": color_names.GRAY_9.to_hex(),
|
32
32
|
"@background-variant": color_names.GRAY_8.to_hex(),
|
33
33
|
|
34
|
-
"@input-color": "#F0F0F5",
|
35
34
|
"@on-primary": color_names.WHITE.to_hex(),
|
36
35
|
"@on-background": color_names.BLACK.to_hex(),
|
37
36
|
|
38
37
|
"@border-color": color_names.GRAY_7.to_hex(),
|
39
|
-
"@
|
38
|
+
"@checkbox-border-color": color_names.GRAY_6.to_hex(),
|
39
|
+
"@input-color": color_names.GRAY_8.to_hex(),
|
40
40
|
|
41
41
|
"@disabled-background": color_names.GRAY_8.to_hex(),
|
42
42
|
"@disabled-color": color_names.GRAY_7.to_hex(),
|
@@ -72,6 +72,7 @@ def get_variables(theme:Literal["light", "dark"] = "light") -> dict:
|
|
72
72
|
"@on-primary": color_names.WHITE.to_hex(),
|
73
73
|
|
74
74
|
"@border-color": color_names.GRAY_2.to_hex(),
|
75
|
+
"@checkbox-border-color": color_names.GRAY_4.to_hex(),
|
75
76
|
"@input-color": color_names.GRAY_3.to_hex(),
|
76
77
|
|
77
78
|
"@disabled-background": color_names.GRAY_0.to_hex(),
|
@@ -3,8 +3,6 @@ QLineEdit, QLineEdit::clear-button, QDoubleSpinBox, QSpinBox, QComboBox {
|
|
3
3
|
border: 1px solid @border-color;
|
4
4
|
border-radius: 5px;
|
5
5
|
padding: 4px 4px;
|
6
|
-
min-width: 40px;
|
7
|
-
min-height: 15px;
|
8
6
|
}
|
9
7
|
|
10
8
|
QLineEdit::disabled,
|
@@ -14,6 +12,12 @@ QSpinBox::disabled {
|
|
14
12
|
color: @disabled-color;
|
15
13
|
}
|
16
14
|
|
15
|
+
QLineEdit[status=information] {
|
16
|
+
background-color: @disabled-background;
|
17
|
+
border: 0px;
|
18
|
+
color: @on-background;
|
19
|
+
}
|
20
|
+
|
17
21
|
QSpinBox::up-button,
|
18
22
|
QDoubleSpinBox::up-button {
|
19
23
|
background-image: url("@arrow-up-image-icon");
|
@@ -73,7 +77,6 @@ QComboBox::drop-down:disabled {
|
|
73
77
|
background-color: @disabled-background;
|
74
78
|
}
|
75
79
|
|
76
|
-
|
77
|
-
|
78
|
-
border: 2px solid @background;
|
80
|
+
QComboBox QAbstractItemView::item:hover{
|
81
|
+
background-color: @background-variant;
|
79
82
|
}
|
@@ -5,7 +5,6 @@ QPushButton {
|
|
5
5
|
border-radius: 5px;
|
6
6
|
text-align: center;
|
7
7
|
padding: 4px 8px;
|
8
|
-
min-width: 50px;
|
9
8
|
}
|
10
9
|
|
11
10
|
QPushButton::hover {
|
@@ -88,4 +87,5 @@ QPushButton[status=danger]::disabled {
|
|
88
87
|
|
89
88
|
QDialogButtonBox QPushButton {
|
90
89
|
min-width: 65px;
|
91
|
-
}
|
90
|
+
}
|
91
|
+
|
@@ -31,20 +31,10 @@ QToolBar QComboBox {
|
|
31
31
|
height: 15px;
|
32
32
|
}
|
33
33
|
|
34
|
-
/* QToolBar QLineEdit:disabled {
|
35
|
-
background-color: @disabled-color;
|
36
|
-
color: rgb(100, 100, 100)
|
37
|
-
}
|
38
|
-
*/
|
39
|
-
|
40
34
|
QToolBar QSlider:disabled {
|
41
35
|
background-color: @disabled-background;
|
42
36
|
}
|
43
37
|
|
44
|
-
QToolBar QPushButton {
|
45
|
-
min-width: 0px;
|
46
|
-
}
|
47
|
-
|
48
38
|
QToolBar QLabel {
|
49
39
|
margin: 2px;
|
50
40
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from .format_sequences import format_long_sequence
|
2
|
-
from .poly_data_utils import set_polydata_colors, set_polydata_property
|
2
|
+
from .poly_data_utils import set_polydata_colors, set_polydata_property, read_obj_file, read_stl_file, transform_polydata
|
3
3
|
from .tree_info import TreeInfo
|
4
4
|
|
5
5
|
|
@@ -0,0 +1,66 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
from vtkmodules.vtkCommonCore import vtkUnsignedCharArray, vtkUnsignedIntArray
|
4
|
+
from vtkmodules.vtkCommonDataModel import vtkPolyData
|
5
|
+
from vtkmodules.vtkCommonTransforms import vtkTransform
|
6
|
+
from vtkmodules.vtkFiltersGeneral import vtkTransformPolyDataFilter
|
7
|
+
from vtkmodules.vtkIOGeometry import vtkOBJReader, vtkSTLReader
|
8
|
+
|
9
|
+
|
10
|
+
def set_polydata_colors(data: vtkPolyData, color: tuple) -> vtkUnsignedCharArray:
|
11
|
+
n_cells = data.GetNumberOfCells()
|
12
|
+
cell_colors = vtkUnsignedCharArray()
|
13
|
+
cell_colors.SetName("colors")
|
14
|
+
cell_colors.SetNumberOfComponents(3)
|
15
|
+
cell_colors.SetNumberOfTuples(n_cells)
|
16
|
+
cell_colors.FillComponent(0, color[0])
|
17
|
+
cell_colors.FillComponent(1, color[1])
|
18
|
+
cell_colors.FillComponent(2, color[2])
|
19
|
+
data.GetCellData().SetScalars(cell_colors)
|
20
|
+
return cell_colors
|
21
|
+
|
22
|
+
|
23
|
+
def set_polydata_property(
|
24
|
+
data: vtkPolyData, property_data: int, property_name: str
|
25
|
+
) -> vtkUnsignedIntArray:
|
26
|
+
n_cells = data.GetNumberOfCells()
|
27
|
+
cell_identifier = vtkUnsignedIntArray()
|
28
|
+
cell_identifier.SetName(property_name)
|
29
|
+
cell_identifier.SetNumberOfTuples(n_cells)
|
30
|
+
cell_identifier.Fill(property_data)
|
31
|
+
data.GetCellData().AddArray(cell_identifier)
|
32
|
+
return cell_identifier
|
33
|
+
|
34
|
+
|
35
|
+
def read_obj_file(path: str | Path) -> vtkPolyData:
|
36
|
+
reader = vtkOBJReader()
|
37
|
+
reader.SetFileName(str(path))
|
38
|
+
reader.Update()
|
39
|
+
return reader.GetOutput()
|
40
|
+
|
41
|
+
|
42
|
+
def read_stl_file(path: str | Path) -> vtkPolyData:
|
43
|
+
reader = vtkSTLReader()
|
44
|
+
reader.SetFileName(str(path))
|
45
|
+
reader.Update()
|
46
|
+
return reader.GetOutput()
|
47
|
+
|
48
|
+
|
49
|
+
def transform_polydata(
|
50
|
+
polydata: vtkPolyData,
|
51
|
+
position=(0, 0, 0),
|
52
|
+
rotation=(0, 0, 0),
|
53
|
+
scale=(1, 1, 1),
|
54
|
+
) -> vtkPolyData:
|
55
|
+
transform = vtkTransform()
|
56
|
+
transform.Translate(position)
|
57
|
+
transform.Scale(scale)
|
58
|
+
transform.RotateX(rotation[0])
|
59
|
+
transform.RotateY(rotation[1])
|
60
|
+
transform.RotateZ(rotation[2])
|
61
|
+
transform.Update()
|
62
|
+
transformation = vtkTransformPolyDataFilter()
|
63
|
+
transformation.SetTransform(transform)
|
64
|
+
transformation.SetInputData(polydata)
|
65
|
+
transformation.Update()
|
66
|
+
return transformation.GetOutput()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "molde"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.4"
|
4
4
|
description = ""
|
5
5
|
authors = ["André Fernandes <fpf.andre@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -10,10 +10,10 @@ packages = [{ include = "molde" }]
|
|
10
10
|
[tool.poetry.dependencies]
|
11
11
|
python = ">=3.10"
|
12
12
|
vtk = "^9.3.1"
|
13
|
-
pyqt5-qt5 = "5.15.2"
|
14
|
-
pyqt5 = "^5.15.10"
|
15
13
|
numpy = "^2.0"
|
16
14
|
moviepy = "^1.0.3"
|
15
|
+
qtpy = "^2.4.2"
|
16
|
+
pyside6 = {version = "^6.8.1", python = ">=3.10,<3.14"}
|
17
17
|
|
18
18
|
[tool.poetry.group.dev.dependencies]
|
19
19
|
black = "^23.12.1"
|
molde-0.1.2/molde/__init__.py
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
from vibra import SYMBOLS_DIR
|
2
|
-
from vibra.utils.polydata_utils import read_obj_file, read_stl_file, transform_polydata
|
3
|
-
|
4
|
-
|
5
|
-
def create_spring_source():
|
6
|
-
polydata = read_stl_file(SYMBOLS_DIR / "stl_files/spring_symbol.STL")
|
7
|
-
return transform_polydata(
|
8
|
-
polydata,
|
9
|
-
position=(-1.25, -0.18, 0.18),
|
10
|
-
rotation=(0, 90, 0),
|
11
|
-
)
|
12
|
-
|
13
|
-
|
14
|
-
def create_damper_source():
|
15
|
-
polydata = read_obj_file(SYMBOLS_DIR / "structural/lumped_damper.obj")
|
16
|
-
return transform_polydata(
|
17
|
-
polydata,
|
18
|
-
position=(-0.145, 0, 0),
|
19
|
-
)
|
20
|
-
|
21
|
-
|
22
|
-
def create_mass_source():
|
23
|
-
return transform_polydata(
|
24
|
-
read_obj_file(SYMBOLS_DIR / "structural/new_lumped_mass.obj"),
|
25
|
-
rotation=(0, -90, 0),
|
26
|
-
)
|
@@ -1,25 +0,0 @@
|
|
1
|
-
from vtkmodules.vtkCommonCore import vtkUnsignedCharArray, vtkUnsignedIntArray
|
2
|
-
from vtkmodules.vtkCommonDataModel import vtkPolyData
|
3
|
-
|
4
|
-
|
5
|
-
def set_polydata_colors(data: vtkPolyData, color: tuple) -> vtkUnsignedCharArray:
|
6
|
-
n_cells = data.GetNumberOfCells()
|
7
|
-
cell_colors = vtkUnsignedCharArray()
|
8
|
-
cell_colors.SetName("colors")
|
9
|
-
cell_colors.SetNumberOfComponents(3)
|
10
|
-
cell_colors.SetNumberOfTuples(n_cells)
|
11
|
-
cell_colors.FillComponent(0, color[0])
|
12
|
-
cell_colors.FillComponent(1, color[1])
|
13
|
-
cell_colors.FillComponent(2, color[2])
|
14
|
-
data.GetCellData().SetScalars(cell_colors)
|
15
|
-
return cell_colors
|
16
|
-
|
17
|
-
|
18
|
-
def set_polydata_property(data: vtkPolyData, property_data: int, property_name: str) -> vtkUnsignedIntArray:
|
19
|
-
n_cells = data.GetNumberOfCells()
|
20
|
-
cell_identifier = vtkUnsignedIntArray()
|
21
|
-
cell_identifier.SetName(property_name)
|
22
|
-
cell_identifier.SetNumberOfTuples(n_cells)
|
23
|
-
cell_identifier.Fill(property_data)
|
24
|
-
data.GetCellData().AddArray(cell_identifier)
|
25
|
-
return cell_identifier
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|