From 46ac7a5aefd4ea18d713fc71616e26d81c736ba7 Mon Sep 17 00:00:00 2001
From: Jacob Wahlman <jacwa448@student.liu.se>
Date: Thu, 21 May 2020 08:48:52 +0200
Subject: [PATCH] fixed value setting of delay in properties

---
 b_asic/GUI/properties_window.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/b_asic/GUI/properties_window.py b/b_asic/GUI/properties_window.py
index 4b8ef020..580ce409 100644
--- a/b_asic/GUI/properties_window.py
+++ b/b_asic/GUI/properties_window.py
@@ -22,11 +22,15 @@ class PropertiesWindow(QDialog):
         self.vertical_layout = QVBoxLayout()
         self.vertical_layout.addLayout(self.name_layout)
 
-        if hasattr(self.operation.operation, "value"):
+        if hasattr(self.operation.operation, "value") or hasattr(self.operation.operation, "initial_value"):
             self.constant_layout = QHBoxLayout()
             self.constant_layout.setSpacing(50)
             self.constant_value = QLabel("Value:")
-            self.edit_constant = QLineEdit(str(self.operation.operation.value))
+            if hasattr(self.operation.operation, "value"):
+                self.edit_constant = QLineEdit(str(self.operation.operation.value))
+            else:
+                self.edit_constant = QLineEdit(str(self.operation.operation.initial_value))
+
             self.only_accept_float = QDoubleValidator()
             self.edit_constant.setValidator(self.only_accept_float)
             self.constant_layout.addWidget(self.constant_value)
@@ -126,6 +130,9 @@ class PropertiesWindow(QDialog):
         self.operation.label.setPlainText(self.operation.name)
         if hasattr(self.operation.operation, "value"):
             self.operation.operation.value = float(self.edit_constant.text().replace(",", "."))
+        elif hasattr(self.operation.operation, "initial_value"):
+            self.operation.operation.initial_value = float(self.edit_constant.text().replace(",", "."))
+
         if self.check_show_name.isChecked():
             self.operation.label.setOpacity(1)
             self.operation.is_show_name = True
-- 
GitLab