Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RazinShaikh committed Jul 29, 2024
2 parents e3ced89 + af5f97c commit f65bce0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include zxlive/icons/*.svg
include zxlive/tooltips/*.png
include zxlive/tooltips/*.png
include zxlive/sfx/*
8 changes: 8 additions & 0 deletions zxlive/proof_panel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import copy
import random
from typing import Iterator, Union, cast

import pyzx
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion zxlive/rewrite_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions zxlive/sfx.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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)

Expand Down

0 comments on commit f65bce0

Please sign in to comment.