mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Improved UX for editing task durations
This commit is contained in:
@@ -43,9 +43,9 @@ def updateTaskIdentification(self, context):
|
||||
self.file,
|
||||
**{"task": self.file.by_id(self.ifc_definition_id), "attributes": {"Identification": self.identification}},
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
Data.load(self.file)
|
||||
if props.active_task_id == self.ifc_definition_id:
|
||||
attribute = context.scene.BIMWorkScheduleProperties.task_attributes.get("Identification")
|
||||
attribute = props.task_attributes.get("Identification")
|
||||
attribute.string_value = self.identification
|
||||
|
||||
|
||||
@@ -107,6 +107,28 @@ def updateTaskTimeDateTime(self, context, startfinish):
|
||||
setattr(self, startfinish, canonicalise_time(startfinish_datetime))
|
||||
|
||||
|
||||
def updateTaskduration(self, context):
|
||||
props = context.scene.BIMWorkScheduleProperties
|
||||
if not props.is_task_update_enabled:
|
||||
return
|
||||
self.file = IfcStore.get_file()
|
||||
task = self.file.by_id(self.ifc_definition_id)
|
||||
if task.TaskTime:
|
||||
task_time = task.TaskTime
|
||||
else:
|
||||
task_time = ifcopenshell.api.run("sequence.add_task_time", self.file, task=task)
|
||||
Data.load(IfcStore.get_file())
|
||||
ifcopenshell.api.run(
|
||||
"sequence.edit_task_time",
|
||||
self.file,
|
||||
**{"task_time":task_time, "attributes": {"ScheduleDuration": self.duration}},
|
||||
)
|
||||
Data.load(IfcStore.get_file())
|
||||
if props.active_task_id == self.ifc_definition_id:
|
||||
attribute = props.task_attributes.get("Duration")
|
||||
attribute.string_value = self.duration
|
||||
|
||||
|
||||
def updateVisualisationStart(self, context):
|
||||
updateVisualisationStartFinish(self, context, "visualisation_start")
|
||||
|
||||
@@ -153,7 +175,7 @@ class Task(PropertyGroup):
|
||||
has_children: BoolProperty(name="Has Children")
|
||||
is_expanded: BoolProperty(name="Is Expanded")
|
||||
level_index: IntProperty(name="Level Index")
|
||||
duration: StringProperty(name="Duration")
|
||||
duration: StringProperty(name="Duration", update=updateTaskduration)
|
||||
start: StringProperty(name="Start", update=updateTaskTimeStart)
|
||||
finish: StringProperty(name="Finish", update=updateTaskTimeFinish)
|
||||
calendar: StringProperty(name="Calendar")
|
||||
|
||||
@@ -12,8 +12,6 @@ class Usecase:
|
||||
|
||||
def execute(self):
|
||||
# If the user specifies both an end date and a duration, the duration takes priority
|
||||
if "ScheduleDuration" in self.settings["attributes"].keys():
|
||||
del self.settings["attributes"]["ScheduleFinish"]
|
||||
if "ActualDuration" in self.settings["attributes"].keys():
|
||||
del self.settings["attributes"]["ActualFinish"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user