From a681a7937b0afdb8c19f5754a1e684ce4af25d2a Mon Sep 17 00:00:00 2001
From: Maeva Pourpoint <maeva@passcal.nmt.edu>
Date: Mon, 11 Mar 2024 15:31:30 -0600
Subject: [PATCH] Rename widgets in StationSelectDialog.ui and resize Station
 Select window

---
 nexus/StationSelectDialog.py | 18 +++----
 nexus/StationSelectDialog.ui | 96 ++++++++++++++++++++----------------
 nexus/nexus.py               |  6 +--
 3 files changed, 66 insertions(+), 54 deletions(-)

diff --git a/nexus/StationSelectDialog.py b/nexus/StationSelectDialog.py
index 8e4a1b23..e4a580c4 100644
--- a/nexus/StationSelectDialog.py
+++ b/nexus/StationSelectDialog.py
@@ -61,16 +61,16 @@ class StationSelectDialog(*load_ui('StationSelectDialog.ui')):
         self.tableWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
 
         if self.action == 'type & gain':
-            self.gainCB.setChecked(True)
-            self.gainCB.setText(f"Copy Datalogger Gain: {self.values[0]}")
-            self.typeCB.setChecked(True)
-            self.typeCB.setText(f"Copy Datalogger Type: {self.values[1]}")
-            self.sensor_label.setParent(None)
+            self.uiGainCB.setChecked(True)
+            self.uiGainCB.setText(f"Copy Datalogger Gain: {self.values[0]}")
+            self.uiTypeCB.setChecked(True)
+            self.uiTypeCB.setText(f"Copy Datalogger Type: {self.values[1]}")
+            self.uiSensorLabel.setParent(None)
         else:
-            self.sensor_label.setText(f"Copy Sensor Type: {self.values[0]}")
-            self.typeCB.setParent(None)
-            self.gainCB.setParent(None)
-        
+            self.uiSensorLabel.setText(f"Copy Sensor Type: {self.values[0]}")
+            self.uiTypeCB.setParent(None)
+            self.uiGainCB.setParent(None)
+        self.tableWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
         self.tableWidget.setRowCount(len(self.stations))
         self.tableWidget.horizontalHeader().sectionClicked.connect(self.sort_table)
         # Add stations to table
diff --git a/nexus/StationSelectDialog.ui b/nexus/StationSelectDialog.ui
index bf0bf6f6..4d960766 100644
--- a/nexus/StationSelectDialog.ui
+++ b/nexus/StationSelectDialog.ui
@@ -6,55 +6,67 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>469</width>
-    <height>612</height>
+    <width>359</width>
+    <height>576</height>
    </rect>
   </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle">
    <string>Dialog</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
-        <item>
-          <widget class="QCheckBox" name="typeCB">
-            <property name="sizePolicy">
-              <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-              </sizepolicy>
-            </property>
-            <property name="toolTip">
-                <string>Copy stated datalogger type to selected stations in table</string>
-              </property>
-          </widget>
-        </item>
-          <item>
-            <widget class="QCheckBox" name="gainCB">
-            <property name="sizePolicy">
-                <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-                </sizepolicy>
-              </property>
-              <property name="toolTip">
-                <string>Copy stated datalogger gain to selected stations in table</string>
-              </property>
-            </widget>
-          </item>
-          <item>
-            <widget class="QLabel" name="sensor_label">
-            <property name="sizePolicy">
-                <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-                </sizepolicy>
-              </property>
-              <property name="toolTip">
-                <string>Copy stated sensor type to selected stations in table</string>
-              </property>
-            </widget>
-          </item>
+   <item>
+    <widget class="QCheckBox" name="uiTypeCB">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip">
+      <string>Copy stated datalogger type to selected stations in table</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="uiGainCB">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip">
+      <string>Copy stated datalogger gain to selected stations in table</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="uiSensorLabel">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="toolTip">
+      <string>Copy stated sensor type to selected stations in table</string>
+     </property>
+    </widget>
+   </item>
    <item>
     <widget class="QTableWidget" name="tableWidget">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="horizontalScrollBarPolicy">
       <enum>Qt::ScrollBarAlwaysOff</enum>
      </property>
@@ -167,4 +179,4 @@
    </hints>
   </connection>
  </connections>
-</ui>
\ No newline at end of file
+</ui>
diff --git a/nexus/nexus.py b/nexus/nexus.py
index b46d93ef..1448a5b8 100755
--- a/nexus/nexus.py
+++ b/nexus/nexus.py
@@ -1304,9 +1304,9 @@ class StationWidget(WidgetBase, *load_ui("StationWidget.ui")):
     def copy_to_stations(self, stations, action, values):
         dialog = StationSelectDialog(stations, action, values, parent=self)
         if dialog.exec_():
-            if dialog.sensor_label.parent() is None:
-                copy_this = {"DLtype": dialog.typeCB.isChecked(),
-                                "DLgain": dialog.gainCB.isChecked()}
+            if dialog.uiSensorLabel.parent() is None:
+                copy_this = {"DLtype": dialog.uiTypeCB.isChecked(),
+                             "DLgain": dialog.uiGainCB.isChecked()}
             else:
                 copy_this = {"Stype": True}
             self.update_stations(dialog.selected_stations, copy_this)
-- 
GitLab