Skip to content

Commit

Permalink
add all remaining changes
Browse files Browse the repository at this point in the history
cbf with the git messages anymore today, there's too many commits.
  • Loading branch information
th3w1zard1 committed May 17, 2024
1 parent dbfb229 commit 04d4420
Show file tree
Hide file tree
Showing 6 changed files with 489 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil
import subprocess
import sys
import tempfile
import time

from collections import OrderedDict
Expand Down Expand Up @@ -697,13 +698,21 @@ def _prepare_func(
if not resource.exists():
missing_files.append(resource._path_ident_obj) # noqa: SLF001
return
with TemporaryDirectory("_tmpext2", "toolset_") as tempdir:
tempdir_path = Path(tempdir)
assert tempdir_path.safe_isdir()
temp_file = tempdir_path / resource.filename()
with BinaryWriterFile.to_file(temp_file) as writer:
writer.write_bytes(resource.data())
func(temp_file, tableItem)

# Create a temporary directory that persists until application shutdown
tempdir = tempfile.mkdtemp(prefix="toolset_", suffix="_tmpext2")

# Register a cleanup function to delete the temporary directory at exit
def cleanup_tempdir():
shutil.rmtree(tempdir, ignore_errors=True)

atexit.register(cleanup_tempdir)
tempdir_path = Path(tempdir)
assert tempdir_path.safe_isdir()
temp_file = tempdir_path / resource.filename()
with BinaryWriterFile.to_file(temp_file) as writer:
writer.write_bytes(resource.data())
func(temp_file, tableItem)
else:
func(path, tableItem)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def moveCamera(self, forward: float, right: float, up: float):
self.scene.camera.y += upward.y + sideward.y + forward_vec.y
self.scene.camera.z += upward.z + sideward.z + forward_vec.z

def rotateCamera(self, yaw: float, pitch: float, snapRotations: bool = True):
def rotateCamera(self, yaw: float, pitch: float, *, snapRotations: bool = True):
"""Rotates the camera by the angles (radians) specified.
Args:
Expand Down Expand Up @@ -369,7 +369,7 @@ def mouseMoveEvent(self, e: QMouseEvent):
3. Get world position of cursor
4. Emit signal with mouse data if time since press > threshold
"""
super().mouseMoveEvent(e)
#super().mouseMoveEvent(e)
screen = Vector2(e.x(), e.y())
if self.freeCam:
screenDelta = Vector2(screen.x - self.width() / 2, screen.y - self.height() / 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def paintEvent(self, e: QPaintEvent):
def wheelEvent(self, e: QWheelEvent):
self.mouseScrolled.emit(Vector2(e.angleDelta().x(), e.angleDelta().y()), self._mouseDown, self._keysDown)

def mouseMoveEvent(self, e: QMouseEvent): # TODO: something here is causing the camera to continually zoom out while middlemouse is held down.
def mouseMoveEvent(self, e: QMouseEvent):
"""Handles mouse move events.
Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _handle_firsttime_user(self, installations: dict[str, dict[str, Any]]):
)
moduleSortOption = Settings.addSetting(
"moduleSortOption",
1,
2,
)
# endregion

Expand Down
5 changes: 5 additions & 0 deletions Tools/HolocronToolset/src/toolset/gui/windows/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,12 @@ def openModuleDesigner(self):
if self.active is None:
QMessageBox(QMessageBox.Icon.Information, "No installation loaded.", "Load an installation before opening the Module Designer.").exec_()
return
# Retrieve the icon from self (assuming it's set as window icon)
window_icon = self.windowIcon()

# Initialize the designer and set its window icon
designer = ModuleDesigner(None, self.active)
designer.setWindowIcon(window_icon)
addWindow(designer)

def openSettingsDialog(self):
Expand Down
Loading

0 comments on commit 04d4420

Please sign in to comment.