mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +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"
|
||||
|
||||
@@ -72,7 +72,6 @@ class Data:
|
||||
for cost_value in cost_item.CostValues or []:
|
||||
cls.load_cost_item_value(cost_item, cost_value)
|
||||
data["CostValues"].append(cost_value.id())
|
||||
print('applied value is', cls.cost_values[cost_value.id()]["AppliedValue"])
|
||||
data["TotalAppliedValue"] += cls.cost_values[cost_value.id()]["AppliedValue"]
|
||||
data["TotalCostValue"] = data["TotalCostQuantity"] * data["TotalAppliedValue"]
|
||||
|
||||
@@ -127,7 +126,6 @@ class Data:
|
||||
|
||||
@classmethod
|
||||
def get_primitive_applied_value(cls, applied_value):
|
||||
print('applied value is ', applied_value)
|
||||
if not applied_value:
|
||||
return 0.0
|
||||
elif isinstance(applied_value, float):
|
||||
|
||||
Reference in New Issue
Block a user