mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-20 04:04:00 +00:00
Make cha-ching noise whenever you're checking out cost schedules
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import bpy
|
||||
import json
|
||||
import ifcopenshell.api
|
||||
@@ -98,6 +99,21 @@ class EnableEditingCostItems(bpy.types.Operator):
|
||||
cost_schedule: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
if context.preferences.addons["blenderbim"].preferences.should_play_chaching_sound:
|
||||
# lol
|
||||
# TODO: make pitch higher as costs rise
|
||||
try:
|
||||
import aud
|
||||
|
||||
device = aud.Device()
|
||||
sound = aud.Sound(os.path.join(context.scene.BIMProperties.data_dir, "chaching.mp3"))
|
||||
handle = device.play(sound)
|
||||
sound_buffered = aud.Sound.buffer(sound)
|
||||
handle_buffered = device.play(sound_buffered)
|
||||
handle.stop()
|
||||
handle_buffered.stop()
|
||||
except:
|
||||
pass # ah well
|
||||
self.props = context.scene.BIMCostProperties
|
||||
self.props.active_cost_schedule_id = self.cost_schedule
|
||||
while len(self.props.cost_items) > 0:
|
||||
|
||||
@@ -190,13 +190,22 @@ class BIM_ADDON_preferences(bpy.types.AddonPreferences):
|
||||
svg_command: StringProperty(name="SVG Command", description="E.g. [['firefox-bin', path]]")
|
||||
pdf_command: StringProperty(name="PDF Command", description="E.g. [['firefox-bin', path]]")
|
||||
should_hide_empty_props: BoolProperty(name="Should Hide Empty Properties", default=True)
|
||||
should_play_chaching_sound: BoolProperty(
|
||||
name="Should Make A Cha-Ching Sound When Project Costs Updates", default=False
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
row = layout.row()
|
||||
row.label(text="To upgrade, first uninstall your current BlenderBIM Add-on, then install the new version.", icon="ERROR")
|
||||
row.label(
|
||||
text="To upgrade, first uninstall your current BlenderBIM Add-on, then install the new version.",
|
||||
icon="ERROR",
|
||||
)
|
||||
row = layout.row()
|
||||
row.label(text="To uninstall, first disable the add-on. Then restart Blender before pressing the 'Remove' button.", icon="ERROR")
|
||||
row.label(
|
||||
text="To uninstall, first disable the add-on. Then restart Blender before pressing the 'Remove' button.",
|
||||
icon="ERROR",
|
||||
)
|
||||
row = layout.row()
|
||||
row.operator("bim.open_upstream", text="Visit Homepage").page = "home"
|
||||
row.operator("bim.open_upstream", text="Visit Documentation").page = "docs"
|
||||
|
||||
Reference in New Issue
Block a user