Commits

Panagiotis Mavrogiorgos committed 6840c56

Added support for loadcase identification.

Comments (0)

Files changed (2)

controllers/controllers.py

 
     s = "\n".join(s)
     return s
+
+
+def get_loading_cases_identification(filename):
+    s = []
+    sa = s.append
+
+    with open(filename, "r") as f:
+        reader = Reader(Reactions, f)
+        columns = reader.get_columns()
+
+    number_of_cases = len(set(columns["case"]))
+
+    for i in range(number_of_cases):
+        sa("{0:10d}  {1:<78s}".format(i + 3, columns["case"][i]))
+
+    s = "\n".join(s)
+    return s
 from various.pyqt_helpers import get_std_icon
 
 from controllers.controllers import (get_rmode_nodes, get_rmode_reactions,
-                                     get_smode_nodes, get_smode_reactions)
+                                     get_smode_nodes, get_smode_reactions,
+                                     get_loading_cases_identification)
 
 
 class MyTextDialog(QDialog):
         smode_nodes_label = QLabel("S-Mode nodes", self)
         rmode_reactions_label = QLabel("R-Mode reactions", self)
         smode_reactions_label = QLabel("S-Mode reactions", self)
+        lcases_identification_label = QLabel("Loading Cases Identification", self)
 
         rmode_nodes_lineedit = QLineEdit(self)
         smode_nodes_lineedit = QLineEdit(self)
         rmode_reactions_lineedit = QLineEdit(self)
         smode_reactions_lineedit = QLineEdit(self)
+        lcases_identification_lineedit = QLineEdit(self)
 
-        rmode_nodes_button = QPushButton(get_std_icon("SP_DialogOpenButton"), "")
-        smode_nodes_button = QPushButton(get_std_icon("SP_DialogOpenButton"), "")
-        rmode_reactions_button = QPushButton(get_std_icon("SP_DialogOpenButton"), "")
-        smode_reactions_button = QPushButton(get_std_icon("SP_DialogOpenButton"), "")
+        icon = get_std_icon("SP_DialogOpenButton")
+        rmode_nodes_button = QPushButton(icon, "")
+        smode_nodes_button = QPushButton(icon, "")
+        rmode_reactions_button = QPushButton(icon, "")
+        smode_reactions_button = QPushButton(icon, "")
+        lcases_identification_button = QPushButton(icon, "")
 
         rmode_nodes_process = QPushButton("Process")
         smode_nodes_process = QPushButton("Process")
         rmode_reactions_process = QPushButton("Process")
         smode_reactions_process = QPushButton("Process")
+        lcases_identification_process = QPushButton("Process")
 
         grid.addWidget(rmode_nodes_label, 0, 0)
         grid.addWidget(smode_nodes_label, 1, 0)
         grid.addWidget(rmode_reactions_label, 2, 0)
         grid.addWidget(smode_reactions_label, 3, 0)
+        grid.addWidget(lcases_identification_label, 4, 0)
 
         grid.addWidget(rmode_nodes_lineedit, 0, 1)
         grid.addWidget(smode_nodes_lineedit, 1, 1)
         grid.addWidget(rmode_reactions_lineedit, 2, 1)
         grid.addWidget(smode_reactions_lineedit, 3, 1)
+        grid.addWidget(lcases_identification_lineedit, 4, 1)
 
         grid.addWidget(rmode_nodes_button, 0, 2)
         grid.addWidget(smode_nodes_button, 1, 2)
         grid.addWidget(rmode_reactions_button, 2, 2)
         grid.addWidget(smode_reactions_button, 3, 2)
+        grid.addWidget(lcases_identification_button, 4, 2)
 
         grid.addWidget(rmode_nodes_process, 0, 3)
         grid.addWidget(smode_nodes_process, 1, 3)
         grid.addWidget(rmode_reactions_process, 2, 3)
         grid.addWidget(smode_reactions_process, 3, 3)
+        grid.addWidget(lcases_identification_process, 4, 3)
 
         # Bind buttons
         rmode_nodes_button.pressed.connect(
             lambda: self.on_open_file(rmode_reactions_lineedit))
         smode_reactions_button.pressed.connect(
             lambda: self.on_open_file(smode_reactions_lineedit))
+        lcases_identification_button.pressed.connect(
+            lambda: self.on_open_file(lcases_identification_lineedit))
 
         rmode_nodes_process.pressed.connect(
             lambda: self.on_process(rmode_nodes_lineedit.text(), get_rmode_nodes))
             lambda: self.on_process(rmode_reactions_lineedit.text(), get_rmode_reactions))
         smode_reactions_process.pressed.connect(
             lambda: self.on_process(smode_reactions_lineedit.text(), get_smode_reactions))
+        lcases_identification_process.pressed.connect(
+            lambda: self.on_process(lcases_identification_lineedit.text(), get_loading_cases_identification))
 
         self.setLayout(grid)