Pārlūkot izejas kodu

Configuration modification for channel hiding, first attempt

Neal Wilson 11 gadus atpakaļ
vecāks
revīzija
3c3c891ed5
1 mainītis faili ar 92 papildinājumiem un 50 dzēšanām
  1. 92
    50
      config/Windows/productionroaster.xml

+ 92
- 50
config/Windows/productionroaster.xml Parādīt failu

@@ -76,6 +76,7 @@
76 76
 		var ratezeros = new Array();
77 77
 		var channelType = new Array();
78 78
 		window.scales = new Array();
79
+		var channelVisibility = new Array();
79 80
 		var indicatorPanel = findChildObject(this, 'indicators');
80 81
 		var annotationPanel = findChildObject(this, 'controlpanel');
81 82
 		var log = findChildObject(this, 'log');
@@ -154,11 +155,16 @@
154 155
 											channelType.push("T");
155 156
 											columnNames.push(channelReference.columnname);
156 157
 											DAQChannels++;
157
-											var indicator = new TemperatureDisplay;
158
-											temperatureDisplays.push(indicator);
159
-											var decorator = new WidgetDecorator(indicator, configModel.data(channelIndex, 0), 2);
160
-											channel.newData.connect(indicator.setValue);
161
-											indicatorPanel.addWidget(decorator);
158
+											if(channelReference.hidden == "true") {
159
+												channelVisibility.push(false);
160
+											} else {
161
+												channelVisibility.push(true);
162
+												var indicator = new TemperatureDisplay;
163
+												temperatureDisplays.push(indicator);
164
+												var decorator = new WidgetDecorator(indicator, configModel.data(channelIndex, 0), 2);
165
+												channel.newData.connect(indicator.setValue);
166
+												indicatorPanel.addWidget(decorator);
167
+											}
162 168
 										}
163 169
 									}
164 170
 									switch(DAQChannels) {
@@ -217,11 +223,16 @@
217 223
 								channels.push(channel);
218 224
 								channelType.push("T");
219 225
 								columnNames.push(deviceReference.columnname);
220
-								var indicator = new TemperatureDisplay;
221
-								temperatureDisplays.push(indicator);
222
-								var decorator = new WidgetDecorator(indicator, configModel.data(deviceIndex, 0), 2);
223
-								channel.newData.connect(indicator.setValue);
224
-								indicatorPanel.addWidget(decorator);
226
+								if(deviceReference.hidden == "true") {
227
+									channelVisibility.push(false);
228
+								} else {
229
+									channelVisibility.push(true);
230
+									var indicator = new TemperatureDisplay;
231
+									temperatureDisplays.push(indicator);
232
+									var decorator = new WidgetDecorator(indicator, configModel.data(deviceIndex, 0), 2);
233
+									channel.newData.connect(indicator.setValue);
234
+									indicatorPanel.addWidget(decorator);
235
+								}
225 236
 								device.start();
226 237
 								nidevices.push(device);
227 238
 							}
@@ -268,9 +279,14 @@
268 279
 							channel.newData.connect(calibrator.newMeasurement)
269 280
 							channels.push(calibrator);
270 281
 							columnNames.push(channelReference.column);
271
-							var decorator = new WidgetDecorator(indicator, configModel.data(channelIndex, 0), 2);
272
-							calibrator.newData.connect(indicator.setValue);
273
-							indicatorPanel.addWidget(decorator);
282
+							if(channelReference.hidden == "true") {
283
+								channelVisibility.push(false);
284
+							} else {
285
+								channelVisibility.push(true);
286
+								var decorator = new WidgetDecorator(indicator, configModel.data(channelIndex, 0), 2);
287
+								calibrator.newData.connect(indicator.setValue);
288
+								indicatorPanel.addWidget(decorator);
289
+							}
274 290
 						}
275 291
 						sampleRate /= configModel.rowCount(driverIndex);
276 292
 					}
@@ -286,22 +302,32 @@
286 302
 					channels.push(pvchannel);
287 303
 					channelType.push("T");
288 304
 					columnNames.push(driverReference.pvcolname);
289
-					var indicator = new TemperatureDisplay;
290
-					temperatureDisplays.push(indicator);
291
-					var decorator = new WidgetDecorator(indicator, configModel.data(driverIndex, 0) + " PV", 2);
292
-					pvchannel.newData.connect(indicator.setValue);
293
-					indicatorPanel.addWidget(decorator);
305
+					if(driverReference.pvhidden == "true") {
306
+						channelVisibility.push(false);
307
+					} else {
308
+						channelVisibility.push(true);
309
+						var indicator = new TemperatureDisplay;
310
+						temperatureDisplays.push(indicator);
311
+						var decorator = new WidgetDecorator(indicator, configModel.data(driverIndex, 0) + " PV", 2);
312
+						pvchannel.newData.connect(indicator.setValue);
313
+						indicatorPanel.addWidget(decorator);
314
+					}
294 315
 					if(driverReference.sVEnabled == "true")
295 316
 					{
296 317
 						var svchannel = device.sVChannel();
297 318
 						channels.push(svchannel);
298 319
 						channelType.push("C");
299 320
 						columnNames.push(driverReference.svcolname);
300
-						var indicator = new TemperatureDisplay;
301
-						temperatureDisplays.push(indicator);
302
-						var decorator = new WidgetDecorator(indicator, configModel.data(driverIndex, 0) + " SV", 2);
303
-						svchannel.newData.connect(indicator.setValue);
304
-						indicatorPanel.addWidget(decorator);
321
+						if(driverReference.svhidden == "true") {
322
+							channelVisibility.push(false);
323
+						} else {
324
+							channelVisibility.push(true);
325
+							var indicator = new TemperatureDisplay;
326
+							temperatureDisplays.push(indicator);
327
+							var decorator = new WidgetDecorator(indicator, configModel.data(driverIndex, 0) + " SV", 2);
328
+							svchannel.newData.connect(indicator.setValue);
329
+							indicatorPanel.addWidget(decorator);
330
+						}
305 331
 					}
306 332
 					if(driverReference.sVWritable == "true")
307 333
 					{
@@ -430,6 +456,10 @@
430 456
 								channels[j].newData.connect(calibrator.newMeasurement);
431 457
 								calibrator.newData.connect(indicator.setValue);
432 458
 								channels.push(calibrator);
459
+								// Channel hiding is not yet configurable for this.
460
+								// I'm not sure if there's any need to allow this
461
+								// to be hidden at present.
462
+								channelVisibility.push(true);
433 463
 								channelType.push(channelType[j]);
434 464
 								columnNames.push(driverReference.destination);
435 465
 								indicatorPanel.addWidget(decorator);
@@ -508,6 +538,9 @@
508 538
 							rate.newData.connect(indicator.setValue);
509 539
 							temperatureDisplays.push(indicator);
510 540
 							channels.push(rate);
541
+							// This cannot at present be configured to be
542
+							// hidden.
543
+							channelVisibility.push(true);
511 544
 							channelType.push("T");
512 545
 							columnNames.push(configModel.data(driverIndex, 0));
513 546
 						}
@@ -531,13 +564,17 @@
531 564
 			setTabOrder(tabControls[i-1], tabControls[i]);
532 565
 		}
533 566
 		log.setHeaderData(0, "Time");
567
+		var channelSkip = 0;
534 568
 		for(var i = 0; i < columnNames.length; i++) {
535
-			log.setHeaderData(i + 1, columnNames[i]);
536
-		}
537
-		log.setHeaderData(columnNames.length + 1, "Note");
538
-		for(var i = 0; i < channels.length; i++) {
539
-			log.addToCurrentColumnSet(i + 1);
569
+			if(channelVisibility[i]) {
570
+				log.setHeaderData(i + 1 - channelSkip, columnNames[i]);
571
+				log.addToCurrentColumnSet(i + 1 - channelSkip);
572
+			}
573
+			else {
574
+				channelSkip++;
575
+			}
540 576
 		}
577
+		log.setHeaderData(columnNames.length + 1 - channelSkip, "Note");
541 578
 		var timer = new TimerDisplay;
542 579
 		timer.displayFormat = "mm:ss";
543 580
 		timer.autoReset = true;
@@ -578,18 +615,23 @@
578 615
 		var offsets = new Array();
579 616
 		var zeroemitters = new Array();
580 617
 		var adapters = new Array();
618
+		channelSkip = 0;
581 619
 		for(var i = 0; i < channels.length; i++) {
582
-			var offset = new MeasurementTimeOffset(epoch);
583
-			offsets.push(offset);
584
-			channels[i].newData.connect(offset.newMeasurement);
585
-			var adapter = new MeasurementAdapter(i + 1);
586
-			adapters.push(adapter);
587
-			offset.measurement.connect(adapter.newMeasurement);
588
-			var emitter = new ZeroEmitter(i + 1);
589
-			zeroemitters.push(emitter);
590
-			channels[i].newData.connect(emitter.newMeasurement);
591
-			emitter.measurement.connect(log.newMeasurement);
592
-			emitter.measurement.connect(graph.newMeasurement);
620
+			if(channelVisibility[i]) {
621
+				var offset = new MeasurementTimeOffset(epoch);
622
+				offsets.push(offset);
623
+				channels[i].newData.connect(offset.newMeasurement);
624
+				var adapter = new MeasurementAdapter(i + 1 - channelSkip);
625
+				adapters.push(adapter);
626
+				offset.measurement.connect(adapter.newMeasurement);
627
+				var emitter = new ZeroEmitter(i + 1);
628
+				zeroemitters.push(emitter);
629
+				channels[i].newData.connect(emitter.newMeasurement);
630
+				emitter.measurement.connect(log.newMeasurement);
631
+				emitter.measurement.connect(graph.newMeasurement);
632
+			} else {
633
+				channelSkip++;
634
+			}
593 635
 		}
594 636
         start.clicked.connect(function() {
595 637
 			start.enabled = false;
@@ -635,7 +677,7 @@
635 677
 			{
636 678
 				annotationButtons[i].annotation.connect(log.newAnnotation);
637 679
 				annotationButtons[i].setTemperatureColumn(1);
638
-				annotationButtons[i].setAnnotationColumn(channels.length + 1);
680
+				annotationButtons[i].setAnnotationColumn(channels.length - channelSkip + 1);
639 681
 				annotationButtons[i].annotation.connect(function(note, tcol, ncol) {
640 682
 					for(var i = tcol; i < ncol; i++) {
641 683
 						log.newAnnotation(note, i, ncol);
@@ -647,7 +689,7 @@
647 689
         stop.annotation.connect(log.newAnnotation);
648 690
         stop.clicked.connect(timer.stopTimer);
649 691
 		stop.setTemperatureColumn(1);
650
-		stop.setAnnotationColumn(channels.length + 1);
692
+		stop.setAnnotationColumn(channels.length - channelSkip + 1);
651 693
 		QSettings.setValue("liveColumn", 1);
652 694
         var lc = 1;
653 695
         stop.clicked.connect(function() {
@@ -807,20 +849,20 @@
807 849
 				zeroemitters[i].setColumn(c + i + 1);
808 850
 				log.setHeaderData(c + i + 1, columnNames[i]);
809 851
 			}
810
-			log.setHeaderData(c + columnNames.length + 1, "Note");
852
+			log.setHeaderData(c + columnNames.length + 1 - channelSkip, "Note");
811 853
             stop.setTemperatureColumn(c + 1);
812
-			stop.setAnnotationColumn(c + columnNames.length + 1);
854
+			stop.setAnnotationColumn(c + columnNames.length + 1 - channelSkip);
813 855
 			for(var i = 0; i < annotationButtons.length; i++)
814 856
 			{
815 857
 				annotationButtons[i].setTemperatureColumn(c + 1);
816
-				annotationButtons[i].setAnnotationColumn(c + columnNames.length + 1);
858
+				annotationButtons[i].setAnnotationColumn(c + columnNames.length + 1 - channelSkip);
817 859
 			}
818 860
 			log.clearCurrentColumnSet();
819
-			for(var i = 0; i < channels.length; i++) {
861
+			for(var i = 0; i < channels.length - channelSkip; i++) {
820 862
 				log.addToCurrentColumnSet(c + i + 1);
821 863
 			}
822 864
 			window.firstTempColumn = c + 1;
823
-			window.annotationColumn = c + columnNames.length + 1;
865
+			window.annotationColumn = c + columnNames.length - channelSkip + 1;
824 866
 		}
825 867
 		var saveMenu = findChildObject(this, 'save');
826 868
         saveMenu.triggered.connect(function() {
@@ -829,7 +871,7 @@
829 871
                 var lc = Number(QSettings.value("liveColumn"));
830 872
                 var file = new QFile(filename);
831 873
                 log.clearOutputColumns();
832
-				for(var i = 0; i < columnNames.length; i++)
874
+				for(var i = 0; i < columnNames.length - channelSkip; i++)
833 875
 				{
834 876
 					if(channelType[i] == "T") {
835 877
 						log.addOutputTemperatureColumn(lc + i);
@@ -838,7 +880,7 @@
838 880
 						log.addOutputControlColumn(lc + i);
839 881
 					}
840 882
 				}
841
-				log.addOutputAnnotationColumn(lc + columnNames.length);
883
+				log.addOutputAnnotationColumn(lc + columnNames.length - channelSkip);
842 884
                 log.saveXML(file);
843 885
                 QSettings.setValue("script/lastDir", dir(filename));
844 886
             }
@@ -850,11 +892,11 @@
850 892
                 var lc = Number(QSettings.value("liveColumn"));
851 893
                 var file = new QFile(filename);
852 894
                 log.clearOutputColumns();
853
-				for(var i = 0; i < columnNames.length; i++)
895
+				for(var i = 0; i < columnNames.length - channelSkip; i++)
854 896
 				{
855 897
 					log.addOutputTemperatureColumn(lc + i);
856 898
 				}
857
-				log.addOutputAnnotationColumn(lc + columnNames.length);
899
+				log.addOutputAnnotationColumn(lc + columnNames.length - channelSkip);
858 900
                 log.saveCSV(file);
859 901
                 QSettings.setValue("script/lastDir", dir(filename));
860 902
             }

Notiek ielāde…
Atcelt
Saglabāt