diff --git a/nexus/StationSelectDialog.py b/nexus/StationSelectDialog.py index 1c25245405dc4ba250c8160241205434c8d4ce56..8e4a1b238229774f560db67b5c40a544474502c2 100644 --- a/nexus/StationSelectDialog.py +++ b/nexus/StationSelectDialog.py @@ -28,11 +28,12 @@ def load_ui(filename): return ret class StationSelectDialog(*load_ui('StationSelectDialog.ui')): - def __init__(self, stations, copy, parent=None): + def __init__(self, stations, action, values, parent=None): super().__init__(parent) self.stations = stations self.stat_map = {} - self.copy = copy + self.action = action + self.values = values self.setupUi() def accept(self): @@ -59,12 +60,14 @@ class StationSelectDialog(*load_ui('StationSelectDialog.ui')): self.setWindowTitle('Select Stations') self.tableWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) - if self.copy == 'type & gain': - self.typeCB.setChecked(True) + if self.action == 'type & gain': self.gainCB.setChecked(True) - self.sensorCB.setParent(None) + 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) else: - self.sensorCB.setChecked(True) + self.sensor_label.setText(f"Copy Sensor Type: {self.values[0]}") self.typeCB.setParent(None) self.gainCB.setParent(None) diff --git a/nexus/StationSelectDialog.ui b/nexus/StationSelectDialog.ui index 3bcb50426f874349d34b161690d16df135873b3e..bf0bf6f6c4c1bb63fc09a983321c782b539902e8 100644 --- a/nexus/StationSelectDialog.ui +++ b/nexus/StationSelectDialog.ui @@ -22,11 +22,8 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Copy Datalogger Type</string> - </property> <property name="toolTip"> - <string>Copy datalogger type from main window to selected stations in table</string> + <string>Copy stated datalogger type to selected stations in table</string> </property> </widget> </item> @@ -38,27 +35,21 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Copy Datalogger Gain</string> - </property> <property name="toolTip"> - <string>Copy datalogger gain from main window to selected stations in table</string> + <string>Copy stated datalogger gain to selected stations in table</string> </property> </widget> </item> <item> - <widget class="QCheckBox" name="sensorCB"> + <widget class="QLabel" name="sensor_label"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>Copy Sensor Type</string> - </property> <property name="toolTip"> - <string>Copy sensor type from main window to selected stations in table</string> + <string>Copy stated sensor type to selected stations in table</string> </property> </widget> </item> diff --git a/nexus/nexus.py b/nexus/nexus.py index ed8dfd09669b8f23d7e3a8da1182096cc4fdff3a..b46d93effc689023dd8b4e79168c2c4c40c07f6a 100755 --- a/nexus/nexus.py +++ b/nexus/nexus.py @@ -1289,26 +1289,34 @@ class StationWidget(WidgetBase, *load_ui("StationWidget.ui")): def copy_dltype_and_gain(self): stations = self.get_stations() - self.copy_to_stations(stations, 'type & gain') + self.copy_to_stations( + stations, + 'type & gain', + [self.uiDLGain.text(), self.uiDLType.currentText()]) def copy_sensor(self): stations = self.get_stations() - self.copy_to_stations(stations, 'sensor') + self.copy_to_stations( + stations, + 'sensor', + [self.uiSensorType.currentText()]) - def copy_to_stations(self, stations, caller): - dialog = StationSelectDialog(stations, caller, parent=self) + def copy_to_stations(self, stations, action, values): + dialog = StationSelectDialog(stations, action, values, parent=self) if dialog.exec_(): - checked_boxes = {"DLtype": dialog.typeCB.isChecked(), - "DLgain": dialog.gainCB.isChecked(), - "Stype": dialog.sensorCB.isChecked()} - self.update_inventory(dialog.selected_stations, checked_boxes) + if dialog.sensor_label.parent() is None: + copy_this = {"DLtype": dialog.typeCB.isChecked(), + "DLgain": dialog.gainCB.isChecked()} + else: + copy_this = {"Stype": True} + self.update_stations(dialog.selected_stations, copy_this) self.stat_node_to_obj_map = {} - def update_inventory(self, stations, checked_boxes): + def update_stations(self, stations, copy_this): for stat in stations: for node, obj in self.stat_node_to_obj_map.items(): if stat == obj: - for key, value in checked_boxes.items(): + for key, value in copy_this.items(): if value: if key == "DLtype": node.set_dl_type(self.uiDLType.currentIndex()) @@ -1317,7 +1325,6 @@ class StationWidget(WidgetBase, *load_ui("StationWidget.ui")): else: node.set_sensor_type(self.uiSensorType.currentIndex()) - def get_stations(self): """ Get all stations from inventory to