Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified pulse.ico
Binary file not shown.
Binary file modified pulse/interface/data/icons/logos/op_dark_theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pulse/interface/data/icons/logos/op_light_theme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pulse/interface/data/icons/pulse/pulse_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 12 additions & 7 deletions pulse/interface/others/splash_screen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from PySide6.QtCore import Qt
from PySide6.QtGui import QPixmap

from pulse import ICON_DIR
from pulse.interface.ui_generated.project.splash_ui import Splash_UI


Expand All @@ -17,16 +19,19 @@ def _config_widget(self):
self.progressBar.setStyleSheet( """ QProgressBar{background-color : rgba(255, 255, 255, 0); border-radius: 6px; border-style: ridge; border-width: 0px;}
QProgressBar::chunk {background-color : rgb(45, 110, 190); border-radius: 6px; border-style: ridge; border-width: 0px;}
""")

def _config_logo_label(self):
logo_text = f"""<html><head/><body style=\" font-size:60pt; font-family: 'Bauhaus 93'\"><p align="center"><span style=\"
color:#0055ff;\">O</span><span style=\" color:#c8c8c8;\">pen</span><span style=\"
color:#0055ff;\">P</span><span style=\" color:#c8c8c8;\">ulse</span></p></body></html>"""
logo_path = ICON_DIR / "logos/op_dark_theme.png"
pixmap = QPixmap(str(logo_path))

dpr = self.devicePixelRatioF()
pixmap = pixmap.scaledToWidth(int(360 * dpr), Qt.SmoothTransformation)
pixmap.setDevicePixelRatio(dpr)

self.logo_label.setText(logo_text)
self.logo_label.setPixmap(pixmap)

def update_position(self, app):
desktop_geometry = app.primaryScreen().geometry()
def update_position(self, qt_app):
desktop_geometry = qt_app.primaryScreen().geometry()
pos_x = int((desktop_geometry.width() - self.width())/2)
pos_y = int((desktop_geometry.height() - self.height())/2)
self.setGeometry(pos_x, pos_y, self.width(), self.height())
Expand Down
78 changes: 61 additions & 17 deletions pulse/interface/viewer_3d/render_widgets/geometry_render_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def _create_connections(self):
self.left_clicked.connect(self.click_callback)
self.left_released.connect(self.selection_callback)
app().main_window.theme_changed.connect(self.set_theme)
app().main_window.theme_changed.connect(self._apply_logo_theme)
app().main_window.visualization_changed.connect(self.visualization_changed_callback)

def update_plot(self, reset_camera=True):
Expand Down Expand Up @@ -130,32 +131,75 @@ def update_open_pulse_logo_visibility(self):
def create_logos(self):
if not hasattr(self, "_light_logo"):
self._light_logo = self.create_logo(ICON_DIR / "logos/op_light_theme.png")
self._light_logo.SetPosition(0.845, 0.89)
self._light_logo.SetPosition2(0.15, 0.15)
self._light_logo.SetShowBorderToOff()
self._light_logo.SetShowPolygonBackground(0)

if not hasattr(self, "_dark_logo"):
self._dark_logo = self.create_logo(ICON_DIR / "logos/op_dark_theme.png")
self._dark_logo.SetPosition(0.845, 0.89)
self._dark_logo.SetPosition2(0.15, 0.15)
self._dark_logo.SetShowBorderToOff()
self._dark_logo.SetShowPolygonBackground(0)

if getattr(self, "_logo_observer_id", None) is None:
self._logo_last_size = None
self._logo_observer_id = self.renderer.AddObserver("StartEvent", self._logo_size_callback)

self._apply_logo_theme()
self.update_logo_geometry()

def _apply_logo_theme(self):
if app().main_window.config.user_preferences.interface_theme == "light":
self._light_logo.VisibilityOn()
self._dark_logo.VisibilityOff()
self.open_pulse_logo = self._light_logo
else:
self._dark_logo.VisibilityOn()
self._light_logo.VisibilityOff()
self.open_pulse_logo = self._dark_logo
def _logo_size_callback(self, *args, **kwargs):

size = tuple(self.renderer.GetSize())
if size != self._logo_last_size:
self._logo_last_size = size
self.update_logo_geometry()

def update_logo_geometry(self):
width_fraction = 0.15
min_width = 90
max_width = 240
max_height_ratio = 0.12
margin = 10

width, height = self.renderer.GetSize()
if width < 2 or height < 2:
return

for logo in (self._light_logo, self._dark_logo):
image = logo.GetImage()
if image is None:
continue

image_width, image_height, _ = image.GetDimensions()
if image_width < 1 or image_height < 1:
continue

aspect = image_width / image_height
logo_width = max(width_fraction * width, min_width)
logo_width = min(logo_width, max_width, 0.4 * width, max_height_ratio * height * aspect)
logo_height = logo_width / aspect

box_x = logo_width / width
box_y = logo_height / height

logo.SetPosition(1 - box_x - margin / width, 1 - box_y - margin / height)
logo.SetPosition2(box_x, box_y)
logo.Modified()

def _apply_logo_theme(self, *args, **kwargs):
light_theme = app().main_window.config.user_preferences.interface_theme == "light"
logo_visible = getattr(self, "_logo_visible", True)

self.open_pulse_logo = self._light_logo if light_theme else self._dark_logo
self._light_logo.SetVisibility(light_theme and logo_visible)
self._dark_logo.SetVisibility(not light_theme and logo_visible)

def enable_open_pulse_logo(self):
return
# self.open_pulse_logo.VisibilityOn()
self._logo_visible = True
self._apply_logo_theme()

def disable_open_pulse_logo(self):
self.open_pulse_logo.VisibilityOff()
self._logo_visible = False
self._apply_logo_theme()

def visualization_changed_callback(self):
if not self._actor_exists():
Expand Down Expand Up @@ -311,4 +355,4 @@ def update_selection(self):
def set_default_render_tool(self):
tool = SelectionTool()
self.set_interactor_style(tool)
tool.update_mouse_cursor_in_render_widgets(tool.current_cursor)
tool.update_mouse_cursor_in_render_widgets(tool.current_cursor)
83 changes: 63 additions & 20 deletions pulse/interface/viewer_3d/render_widgets/mesh_render_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,25 +195,74 @@ def update_theme(self):
def create_logos(self):
if not hasattr(self, "_light_logo"):
self._light_logo = self.create_logo(ICON_DIR / "logos/op_light_theme.png")
self._light_logo.SetPosition(0.845, 0.89)
self._light_logo.SetPosition2(0.15, 0.15)
self._light_logo.SetShowBorderToOff()
self._light_logo.SetShowPolygonBackground(0)

if not hasattr(self, "_dark_logo"):
self._dark_logo = self.create_logo(ICON_DIR / "logos/op_dark_theme.png")
self._dark_logo.SetPosition(0.845, 0.89)
self._dark_logo.SetPosition2(0.15, 0.15)
self._dark_logo.SetShowBorderToOff()
self._dark_logo.SetShowPolygonBackground(0)

if getattr(self, "_logo_observer_id", None) is None:
self._logo_last_size = None
self._logo_observer_id = self.renderer.AddObserver("StartEvent", self._logo_size_callback)

self._apply_logo_theme()
self.update_logo_geometry()

def _logo_size_callback(self, *args, **kwargs):
size = tuple(self.renderer.GetSize())
if size != self._logo_last_size:
self._logo_last_size = size
self.update_logo_geometry()

def update_logo_geometry(self):
width_fraction = 0.15
min_width = 90
max_width = 240
max_height_ratio = 0.12
margin = 10

width, height = self.renderer.GetSize()
if width < 2 or height < 2:
return

def _apply_logo_theme(self):
if app().main_window.config.user_preferences.interface_theme == "light":
self._light_logo.VisibilityOn()
self._dark_logo.VisibilityOff()
self.open_pulse_logo = self._light_logo
else:
self._dark_logo.VisibilityOn()
self._light_logo.VisibilityOff()
self.open_pulse_logo = self._dark_logo
for logo in (self._light_logo, self._dark_logo):
image = logo.GetImage()
if image is None:
continue

image_width, image_height, _ = image.GetDimensions()
if image_width < 1 or image_height < 1:
continue

aspect = image_width / image_height
logo_width = max(width_fraction * width, min_width)
logo_width = min(logo_width, max_width, 0.4 * width, max_height_ratio * height * aspect)
logo_height = logo_width / aspect

box_x = logo_width / width
box_y = logo_height / height

logo.SetPosition(1 - box_x - margin / width, 1 - box_y - margin / height)
logo.SetPosition2(box_x, box_y)
logo.Modified()

def _apply_logo_theme(self, *args, **kwargs):
light_theme = app().main_window.config.user_preferences.interface_theme == "light"
logo_visible = getattr(self, "_logo_visible", True)

self.open_pulse_logo = self._light_logo if light_theme else self._dark_logo
self._light_logo.SetVisibility(light_theme and logo_visible)
self._dark_logo.SetVisibility(not light_theme and logo_visible)

def enable_open_pulse_logo(self):
self._logo_visible = True
self._apply_logo_theme()

def disable_open_pulse_logo(self):
self._logo_visible = False
self._apply_logo_theme()

def save_thumbnail(self):
thumbnail = app().project.thumbnail
Expand Down Expand Up @@ -267,12 +316,6 @@ def update_open_pulse_logo_visibility(self):
else:
self.disable_open_pulse_logo()

def enable_open_pulse_logo(self):
self.open_pulse_logo.VisibilityOn()

def disable_open_pulse_logo(self):
self.open_pulse_logo.VisibilityOff()

def update_scale_bar_visibility(self):
user_preferences = app().config.user_preferences

Expand Down Expand Up @@ -435,4 +478,4 @@ def _apply_section_plane(self, position, rotation, inverted, show_plane=True):
def set_default_render_tool(self):
tool = SelectionTool()
self.set_interactor_style(tool)
tool.update_mouse_cursor_in_render_widgets(tool.current_cursor)
tool.update_mouse_cursor_in_render_widgets(tool.current_cursor)
83 changes: 63 additions & 20 deletions pulse/interface/viewer_3d/render_widgets/results_render_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,25 +392,74 @@ def update_theme(self):
def create_logos(self):
if not hasattr(self, "_light_logo"):
self._light_logo = self.create_logo(ICON_DIR / "logos/op_light_theme.png")
self._light_logo.SetPosition(0.845, 0.89)
self._light_logo.SetPosition2(0.15, 0.15)
self._light_logo.SetShowBorderToOff()
self._light_logo.SetShowPolygonBackground(0)

if not hasattr(self, "_dark_logo"):
self._dark_logo = self.create_logo(ICON_DIR / "logos/op_dark_theme.png")
self._dark_logo.SetPosition(0.845, 0.89)
self._dark_logo.SetPosition2(0.15, 0.15)
self._dark_logo.SetShowBorderToOff()
self._dark_logo.SetShowPolygonBackground(0)

if getattr(self, "_logo_observer_id", None) is None:
self._logo_last_size = None
self._logo_observer_id = self.renderer.AddObserver("StartEvent", self._logo_size_callback)

self._apply_logo_theme()
self.update_logo_geometry()

def _logo_size_callback(self, *args, **kwargs):
size = tuple(self.renderer.GetSize())
if size != self._logo_last_size:
self._logo_last_size = size
self.update_logo_geometry()

def update_logo_geometry(self):
width_fraction = 0.15
min_width = 90
max_width = 240
max_height_ratio = 0.12
margin = 10

width, height = self.renderer.GetSize()
if width < 2 or height < 2:
return

def _apply_logo_theme(self):
if app().main_window.config.user_preferences.interface_theme == "light":
self._light_logo.VisibilityOn()
self._dark_logo.VisibilityOff()
self.open_pulse_logo = self._light_logo
else:
self._dark_logo.VisibilityOn()
self._light_logo.VisibilityOff()
self.open_pulse_logo = self._dark_logo
for logo in (self._light_logo, self._dark_logo):
image = logo.GetImage()
if image is None:
continue

image_width, image_height, _ = image.GetDimensions()
if image_width < 1 or image_height < 1:
continue

aspect = image_width / image_height
logo_width = max(width_fraction * width, min_width)
logo_width = min(logo_width, max_width, 0.4 * width, max_height_ratio * height * aspect)
logo_height = logo_width / aspect

box_x = logo_width / width
box_y = logo_height / height

logo.SetPosition(1 - box_x - margin / width, 1 - box_y - margin / height)
logo.SetPosition2(box_x, box_y)
logo.Modified()

def _apply_logo_theme(self, *args, **kwargs):
light_theme = app().main_window.config.user_preferences.interface_theme == "light"
logo_visible = getattr(self, "_logo_visible", True)

self.open_pulse_logo = self._light_logo if light_theme else self._dark_logo
self._light_logo.SetVisibility(light_theme and logo_visible)
self._dark_logo.SetVisibility(not light_theme and logo_visible)

def enable_open_pulse_logo(self):
self._logo_visible = True
self._apply_logo_theme()

def disable_open_pulse_logo(self):
self._logo_visible = False
self._apply_logo_theme()

def apply_user_preferences(self):
self.update_open_pulse_logo_visibility()
Expand All @@ -437,12 +486,6 @@ def update_open_pulse_logo_visibility(self):
else:
self.disable_open_pulse_logo()

def enable_open_pulse_logo(self):
self.open_pulse_logo.VisibilityOn()

def disable_open_pulse_logo(self):
self.open_pulse_logo.VisibilityOff()

def update_scale_bar_visibility(self):
user_preferences = app().config.user_preferences

Expand Down Expand Up @@ -732,4 +775,4 @@ def update_render_tool_according_to_results_viewer_widget(self, has_selection=Tr
def set_default_render_tool(self, base_tool=False):
tool = RenderTool()
self.set_interactor_style(tool)
tool.update_mouse_cursor_in_render_widgets(tool.current_cursor)
tool.update_mouse_cursor_in_render_widgets(tool.current_cursor)
Loading
Loading