molde 0.1.4__tar.gz → 0.1.6__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.
Files changed (68) hide show
  1. {molde-0.1.4 → molde-0.1.6}/PKG-INFO +1 -2
  2. {molde-0.1.4 → molde-0.1.6}/molde/__main__.py +10 -7
  3. {molde-0.1.4 → molde-0.1.6}/molde/interactor_styles/box_selection_style.py +27 -10
  4. {molde-0.1.4 → molde-0.1.6}/molde/render_widgets/common_render_widget.py +1 -1
  5. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/__init__.py +2 -0
  6. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qslider.qss +1 -1
  7. {molde-0.1.4 → molde-0.1.6}/pyproject.toml +2 -2
  8. {molde-0.1.4 → molde-0.1.6}/README.md +0 -0
  9. {molde-0.1.4 → molde-0.1.6}/molde/__init__.py +0 -0
  10. {molde-0.1.4 → molde-0.1.6}/molde/actors/__init__.py +0 -0
  11. {molde-0.1.4 → molde-0.1.6}/molde/actors/common_symbols_actor.py +0 -0
  12. {molde-0.1.4 → molde-0.1.6}/molde/actors/ghost_actor.py +0 -0
  13. {molde-0.1.4 → molde-0.1.6}/molde/actors/lines_actor.py +0 -0
  14. {molde-0.1.4 → molde-0.1.6}/molde/actors/round_points_actor.py +0 -0
  15. {molde-0.1.4 → molde-0.1.6}/molde/actors/square_points_actor.py +0 -0
  16. {molde-0.1.4 → molde-0.1.6}/molde/colors/__init__.py +0 -0
  17. {molde-0.1.4 → molde-0.1.6}/molde/colors/color.py +0 -0
  18. {molde-0.1.4 → molde-0.1.6}/molde/colors/color_names.py +0 -0
  19. {molde-0.1.4 → molde-0.1.6}/molde/fonts/IBMPlexMono-Bold.ttf +0 -0
  20. {molde-0.1.4 → molde-0.1.6}/molde/fonts/IBMPlexMono-Regular.ttf +0 -0
  21. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_down_dark_theme.svg +0 -0
  22. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_down_disabled_dark_theme.svg +0 -0
  23. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_down_disabled_light_theme.svg +0 -0
  24. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_down_light_theme.svg +0 -0
  25. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_left_dark_theme.svg +0 -0
  26. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_left_light_theme.svg +0 -0
  27. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_right_dark_theme.svg +0 -0
  28. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_right_light_theme.svg +0 -0
  29. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_up_dark_theme.svg +0 -0
  30. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_up_disabled_dark_theme.svg +0 -0
  31. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_up_disabled_light_theme.svg +0 -0
  32. {molde-0.1.4 → molde-0.1.6}/molde/icons/arrow_up_light_theme.svg +0 -0
  33. {molde-0.1.4 → molde-0.1.6}/molde/icons/check_box_image.svg +0 -0
  34. {molde-0.1.4 → molde-0.1.6}/molde/interactor_styles/__init__.py +0 -0
  35. {molde-0.1.4 → molde-0.1.6}/molde/interactor_styles/arcball_camera_style.py +0 -0
  36. {molde-0.1.4 → molde-0.1.6}/molde/main_window.ui +0 -0
  37. {molde-0.1.4 → molde-0.1.6}/molde/pickers/__init__.py +0 -0
  38. {molde-0.1.4 → molde-0.1.6}/molde/pickers/cell_area_picker.py +0 -0
  39. {molde-0.1.4 → molde-0.1.6}/molde/pickers/cell_property_area_picker.py +0 -0
  40. {molde-0.1.4 → molde-0.1.6}/molde/poly_data/__init__.py +0 -0
  41. {molde-0.1.4 → molde-0.1.6}/molde/poly_data/arrows.py +0 -0
  42. {molde-0.1.4 → molde-0.1.6}/molde/poly_data/lines_data.py +0 -0
  43. {molde-0.1.4 → molde-0.1.6}/molde/poly_data/simple_shapes.py +0 -0
  44. {molde-0.1.4 → molde-0.1.6}/molde/poly_data/vertices_data.py +0 -0
  45. {molde-0.1.4 → molde-0.1.6}/molde/render_widgets/__init__.py +0 -0
  46. {molde-0.1.4 → molde-0.1.6}/molde/render_widgets/animated_render_widget.py +0 -0
  47. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/common.qss +0 -0
  48. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/create_color_page.py +0 -0
  49. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/mainwindow.ui +0 -0
  50. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qcheckbox.qss +0 -0
  51. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qinputs.qss +0 -0
  52. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qlayouts.qss +0 -0
  53. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qmenubar.qss +0 -0
  54. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qprogressbar.qss +0 -0
  55. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qpushbutton.qss +0 -0
  56. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qradiobutton.qss +0 -0
  57. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qscrollbar.qss +0 -0
  58. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qtablewidget.qss +0 -0
  59. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qtabwidget.qss +0 -0
  60. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qtoolbar.qss +0 -0
  61. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qtoolbuttons.qss +0 -0
  62. {molde-0.1.4 → molde-0.1.6}/molde/stylesheets/qtreewidget.qss +0 -0
  63. {molde-0.1.4 → molde-0.1.6}/molde/ui_files/messages/new_loading_window.ui +0 -0
  64. {molde-0.1.4 → molde-0.1.6}/molde/utils/__init__.py +0 -0
  65. {molde-0.1.4 → molde-0.1.6}/molde/utils/format_sequences.py +0 -0
  66. {molde-0.1.4 → molde-0.1.6}/molde/utils/poly_data_utils.py +0 -0
  67. {molde-0.1.4 → molde-0.1.6}/molde/utils/tree_info.py +0 -0
  68. {molde-0.1.4 → molde-0.1.6}/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.4
3
+ Version: 0.1.6
4
4
  Summary:
5
5
  Author: André Fernandes
6
6
  Author-email: fpf.andre@gmail.com
@@ -12,7 +12,6 @@ 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: pyside6 (>=6.8.1,<7.0.0) ; python_version >= "3.10" and python_version < "3.14"
16
15
  Requires-Dist: qtpy (>=2.4.2,<3.0.0)
17
16
  Requires-Dist: vtk (>=9.3.1,<10.0.0)
18
17
  Description-Content-Type: text/markdown
@@ -1,22 +1,21 @@
1
1
  import os, sys
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
2
+ from PySide6.QtWidgets import QMainWindow, QApplication, QMessageBox, QLineEdit, QTableWidgetItem, QPushButton, QLabel, QSlider
3
+ from PySide6.QtGui import QColor
4
+ from PySide6.QtCore import Qt
6
5
  from time import time
7
6
 
8
7
  from vtkmodules.vtkFiltersSources import vtkCylinderSource
9
8
  from vtkmodules.vtkRenderingCore import vtkPolyDataMapper, vtkActor
10
9
 
11
- from molde import MOLDE_DIR
10
+ from molde import MOLDE_DIR, load_ui
12
11
  from molde import stylesheets
13
12
  from molde.render_widgets.common_render_widget import CommonRenderWidget
14
13
 
15
14
 
16
15
  class Example(QMainWindow):
17
16
  def __init__(self, parent=None) -> None:
18
- super().__init__(parent)
19
- uic.loadUi(MOLDE_DIR / "stylesheets/mainwindow.ui", self)
17
+ super().__init__()
18
+ load_ui(MOLDE_DIR / "stylesheets/mainwindow.ui", self, MOLDE_DIR / "stylesheets")
20
19
  self.current_theme = "light"
21
20
 
22
21
  self.change_theme_button.clicked.connect(self.change_theme)
@@ -36,9 +35,13 @@ class Example(QMainWindow):
36
35
 
37
36
  self.botao1 = QPushButton()
38
37
  self.label = QLabel("Olha o sapooo")
38
+ self.slider = QSlider(Qt.Orientation.Horizontal)
39
+ self.slider.setValue(50)
39
40
  self.botao1.setText("Olha a faca")
40
41
  self.toolbar_2.addWidget(self.label)
41
42
  self.toolbar_2.addWidget(self.botao1)
43
+ self.toolbar_2.addWidget(self.slider)
44
+ self.toolbar_2.setDisabled(True)
42
45
 
43
46
  item = QTableWidgetItem("fr")
44
47
  item.setBackground(QColor("#FF0000"))
@@ -1,7 +1,8 @@
1
1
  import numpy as np
2
2
  from vtkmodules.vtkCommonCore import vtkUnsignedCharArray
3
-
4
3
  from .arcball_camera_style import ArcballCameraInteractorStyle
4
+ from vtkmodules.util.numpy_support import vtk_to_numpy, numpy_to_vtk
5
+
5
6
 
6
7
 
7
8
  class BoxSelectionInteractorStyle(ArcballCameraInteractorStyle):
@@ -42,25 +43,41 @@ class BoxSelectionInteractorStyle(ArcballCameraInteractorStyle):
42
43
  def update_selection(self):
43
44
  if not self.is_selecting:
44
45
  return
45
-
46
+
46
47
  size = self.GetInteractor().GetSize()
47
48
  min_x, max_x = sorted([self._click_position[0], self._mouse_position[0]])
48
49
  min_y, max_y = sorted([self._click_position[1], self._mouse_position[1]])
49
50
  min_x, max_x = np.clip([min_x, max_x], 0, size[0])
50
51
  min_y, max_y = np.clip([min_y, max_y], 0, size[1])
51
52
 
52
- # Copy the saved screen state and draw over it
53
- selected_pixels = vtkUnsignedCharArray()
54
- selected_pixels.DeepCopy(self._saved_pixels)
53
+ # Copy the saved screen state, transform to numpy and draw over it
54
+ selected_pixels = (
55
+ vtk_to_numpy(self._saved_pixels)
56
+ .reshape(size[1], size[0], 4)
57
+ .copy()
58
+ )
55
59
 
56
- for x in range(min_x, max_x, 2):
57
- for y in range(min_y, max_y, 2):
58
- pixel = y * size[0] + x
59
- selected_pixels.SetTuple(pixel, self.selection_color)
60
+ # Draw the borders
61
+ line_width = 2
62
+ selected_pixels[min_y : min_y + line_width, min_x:max_x] = self.selection_color # bottom
63
+ selected_pixels[max_y : max_y + line_width, min_x:max_x] = self.selection_color # top
64
+ selected_pixels[min_y:max_y, min_x : min_x + line_width] = self.selection_color # left
65
+ selected_pixels[min_y:max_y, max_x : max_x + line_width] = self.selection_color # right
66
+
67
+ # Fill the box with a transparent color
68
+ transparency = 0.3
69
+ def lerp(a, b, t):
70
+ return t*a + (1-t) * b
71
+
72
+ selected_pixels[min_y:max_y, min_x:max_x] = lerp(
73
+ np.array(self.selection_color),
74
+ selected_pixels[min_y:max_y, min_x:max_x],
75
+ transparency
76
+ )
60
77
 
61
78
  renderWindow = self.GetInteractor().GetRenderWindow()
62
79
  renderWindow.SetRGBACharPixelData(
63
- 0, 0, size[0] - 1, size[1] - 1, selected_pixels, 0
80
+ 0, 0, size[0] - 1, size[1] - 1, numpy_to_vtk(selected_pixels.reshape(-1, 4)), 0
64
81
  )
65
82
  renderWindow.Frame()
66
83
 
@@ -164,7 +164,7 @@ class CommonRenderWidget(QFrame):
164
164
  Supported formats are JPEG, JPG, PNG, BMP, ICO, TIFF, PPM and others.
165
165
  """
166
166
  image = self.get_screenshot()
167
- with open(path, "w") as file:
167
+ with open(path, "wb") as file:
168
168
  image.save(file)
169
169
 
170
170
  def create_axes(self):
@@ -40,6 +40,7 @@ def get_variables(theme:Literal["light", "dark"] = "light") -> dict:
40
40
 
41
41
  "@disabled-background": color_names.GRAY_8.to_hex(),
42
42
  "@disabled-color": color_names.GRAY_7.to_hex(),
43
+ "@alternative-disabled-background" : color_names.GRAY_6.to_hex(),
43
44
 
44
45
  "@hover-arrow-color": color_names.GRAY_8.to_hex(),
45
46
  "@arrow-up-image-icon": str(MOLDE_DIR / "icons/arrow_up_light_theme.svg").replace("\\", "/"),
@@ -77,6 +78,7 @@ def get_variables(theme:Literal["light", "dark"] = "light") -> dict:
77
78
 
78
79
  "@disabled-background": color_names.GRAY_0.to_hex(),
79
80
  "@disabled-color": color_names.GRAY_4.to_hex(),
81
+ "@alternative-disabled-background" : color_names.GRAY_2.to_hex(),
80
82
 
81
83
  "@hover-arrow-color": color_names.GRAY_1.to_hex(),
82
84
  "@arrow-up-image-icon": str(MOLDE_DIR / "icons/arrow_up_dark_theme.svg").replace("\\", "/"),
@@ -27,7 +27,7 @@ QSlider::handle {
27
27
  QSlider::sub-page:horizontal:disabled,
28
28
  QSlider::add-page:vertical:disabled,
29
29
  QSlider::handle:disabled {
30
- background: @disabled-background;
30
+ background: "@alternative-disabled-background";
31
31
  }
32
32
 
33
33
  QSlider::add-page:horizontal,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "molde"
3
- version = "0.1.4"
3
+ version = "0.1.6"
4
4
  description = ""
5
5
  authors = ["André Fernandes <fpf.andre@gmail.com>"]
6
6
  readme = "README.md"
@@ -13,12 +13,12 @@ vtk = "^9.3.1"
13
13
  numpy = "^2.0"
14
14
  moviepy = "^1.0.3"
15
15
  qtpy = "^2.4.2"
16
- pyside6 = {version = "^6.8.1", python = ">=3.10,<3.14"}
17
16
 
18
17
  [tool.poetry.group.dev.dependencies]
19
18
  black = "^23.12.1"
20
19
  isort = "^5.13.2"
21
20
  pytest = "^7.4.4"
21
+ pyside6 = {version = "^6.8.1", python = ">=3.10,<3.14"}
22
22
 
23
23
  [tool.isort]
24
24
  profile = "black"
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