Skip to content

Commit

Permalink
skio get handle if we disable wrapping, fix another issue on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesdelbeke committed Sep 18, 2023
1 parent 260caad commit 65e5834
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
11 changes: 6 additions & 5 deletions bqt/blender_applications/blender_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@ def __init__(self, *args, **kwargs):

self._active_window_hwnd = 0


if STYLESHEET_PATH.exists():
self.setStyleSheet(STYLESHEET_PATH.read_text())

QApplication.setWindowIcon(self._get_application_icon())

# Blender Window
self._hwnd = self._get_blender_hwnd()
failed_to_get_handle = self._hwnd is None

self.window_container: QWidget = None

if os.getenv("BQT_DISABLE_WRAP") == "1" or failed_to_get_handle:
self._hwnd = None
if os.getenv("BQT_DISABLE_WRAP") != "1":
self._hwnd = self._get_blender_hwnd()
failed_to_get_handle = self._hwnd is None
if failed_to_get_handle:
self._blender_window = QWindow()
self.blender_widget = QWidget.createWindowContainer(self._blender_window)
else:
Expand Down
8 changes: 5 additions & 3 deletions bqt/blender_applications/darwin_blender_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from PySide2.QtGui import QIcon
from PySide2.QtCore import QObject

import logging
from .blender_application import BlenderApplication
import bqt.focus

Expand All @@ -28,7 +28,7 @@ class DarwinBlenderApplication(BlenderApplication):

def __init__(self, *args, **kwargs):
# OSX Specific - Needs to initialize first
self._ns_window = self._get_application_window() or None
self._ns_window = self._get_application_window() or None # todo not needed when we disable wrapping

super().__init__(*args, **kwargs)

Expand All @@ -40,9 +40,11 @@ def _get_blender_hwnd(self) -> int:
Returns int: Handler Window ID
"""

# Check to ensure ns_window is set
if self._ns_window is None:
self._ns_window = self._get_application_window()
if self._ns_window is None:
logging.warning("Blender Application Window not found")
return None

return objc.pyobjc_id(self._ns_window.contentView())

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run(self):
setup(
# Metadata
name="bqt",
version="1.3.3",
version="1.3.4",
description="Files to help bootstrap PySide2 with an event loop within Blender.",
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 65e5834

Please sign in to comment.