diff --git a/MANIFEST.in b/MANIFEST.in index c18e721..584792d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include zxlive/icons/*.svg -include zxlive/tooltips/*.png \ No newline at end of file +include zxlive/tooltips/*.png +include zxlive/sfx/* diff --git a/zxlive/proof_panel.py b/zxlive/proof_panel.py index 71953f3..75e8c5d 100644 --- a/zxlive/proof_panel.py +++ b/zxlive/proof_panel.py @@ -1,6 +1,7 @@ from __future__ import annotations import copy +import random from typing import Iterator, Union, cast import pyzx @@ -175,6 +176,7 @@ def _wand_trace_finished(self, trace: WandTrace) -> None: elif self._magic_identity(trace): return elif self._magic_hopf(trace): + self.play_sound_signal.emit(SFXEnum.THEY_FALL_OFF) return def _magic_hopf(self, trace: WandTrace) -> bool: @@ -304,6 +306,12 @@ def _remove_id(self, v: VT) -> None: cmd = AddRewriteStep(self.graph_view, new_g, self.step_view, "id") self.undo_stack.push(cmd, anim_before=anim) + s = random.choice([ + SFXEnum.THATS_JUST_WIRE_1, + SFXEnum.THATS_JUST_WIRE_2 + ]) + self.play_sound_signal.emit(s) + def _unfuse_w(self, v: VT, left_edge_items: list[EItem], mouse_dir: QPointF) -> None: new_g = copy.deepcopy(self.graph) diff --git a/zxlive/rewrite_action.py b/zxlive/rewrite_action.py index 5d520f0..e7658da 100644 --- a/zxlive/rewrite_action.py +++ b/zxlive/rewrite_action.py @@ -108,7 +108,7 @@ def update_active(self, g: GraphT, verts: list[VT], edges: list[ET]) -> None: @property def tooltip(self) -> str: - if self.picture_path is None: + if self.picture_path is None or display_setting.previews_show == False: return self.tooltip_str if self.picture_path == 'custom': # We will create a custom tooltip picture representing the custom rewrite diff --git a/zxlive/sfx.py b/zxlive/sfx.py index aa84591..c52cd9f 100644 --- a/zxlive/sfx.py +++ b/zxlive/sfx.py @@ -1,12 +1,16 @@ from enum import Enum -from PySide6.QtCore import QDir, QUrl +from PySide6.QtCore import QUrl from PySide6.QtMultimedia import QSoundEffect +from .common import get_data + class SFXEnum(Enum): BOOM_BOOM_BOOM = "boom-boom-boom.wav" IRANIAN_BUS = "iranian-bus.wav" OK_IM_GONNA_START = "ok-im-gonna-start.wav" THATS_A_SPIDER = "thats-a-spider.wav" + THATS_JUST_WIRE_1 = "thats-just-wire-1.wav" + THATS_JUST_WIRE_2 = "thats-just-wire-2.wav" THATS_SPIDER_FUSION = "thats-spider-fusion.wav" THEY_FALL_OFF = "they-fall-off.wav" WELCOME_EVERYBODY = "welcome-everybody.wav" @@ -15,7 +19,7 @@ class SFXEnum(Enum): def load_sfx(e: SFXEnum) -> QSoundEffect: """Load a sound effect from a file.""" effect = QSoundEffect() - fullpath = QDir.current().absoluteFilePath("zxlive/sfx/" + e.value) + fullpath = get_data("sfx/" + e.value) url = QUrl.fromLocalFile(fullpath) effect.setSource(url)