Browse Source

Configuration modification for channel hiding, first attempt

Neal Wilson 11 years ago
parent
commit
3c3c891ed5
1 changed files with 92 additions and 50 deletions
  1. 92
    50
      config/Windows/productionroaster.xml

+ 92
- 50
config/Windows/productionroaster.xml View File

76
 		var ratezeros = new Array();
76
 		var ratezeros = new Array();
77
 		var channelType = new Array();
77
 		var channelType = new Array();
78
 		window.scales = new Array();
78
 		window.scales = new Array();
79
+		var channelVisibility = new Array();
79
 		var indicatorPanel = findChildObject(this, 'indicators');
80
 		var indicatorPanel = findChildObject(this, 'indicators');
80
 		var annotationPanel = findChildObject(this, 'controlpanel');
81
 		var annotationPanel = findChildObject(this, 'controlpanel');
81
 		var log = findChildObject(this, 'log');
82
 		var log = findChildObject(this, 'log');
154
 											channelType.push("T");
155
 											channelType.push("T");
155
 											columnNames.push(channelReference.columnname);
156
 											columnNames.push(channelReference.columnname);
156
 											DAQChannels++;
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
 									switch(DAQChannels) {
170
 									switch(DAQChannels) {
217
 								channels.push(channel);
223
 								channels.push(channel);
218
 								channelType.push("T");
224
 								channelType.push("T");
219
 								columnNames.push(deviceReference.columnname);
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
 								device.start();
236
 								device.start();
226
 								nidevices.push(device);
237
 								nidevices.push(device);
227
 							}
238
 							}
268
 							channel.newData.connect(calibrator.newMeasurement)
279
 							channel.newData.connect(calibrator.newMeasurement)
269
 							channels.push(calibrator);
280
 							channels.push(calibrator);
270
 							columnNames.push(channelReference.column);
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
 						sampleRate /= configModel.rowCount(driverIndex);
291
 						sampleRate /= configModel.rowCount(driverIndex);
276
 					}
292
 					}
286
 					channels.push(pvchannel);
302
 					channels.push(pvchannel);
287
 					channelType.push("T");
303
 					channelType.push("T");
288
 					columnNames.push(driverReference.pvcolname);
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
 					if(driverReference.sVEnabled == "true")
315
 					if(driverReference.sVEnabled == "true")
295
 					{
316
 					{
296
 						var svchannel = device.sVChannel();
317
 						var svchannel = device.sVChannel();
297
 						channels.push(svchannel);
318
 						channels.push(svchannel);
298
 						channelType.push("C");
319
 						channelType.push("C");
299
 						columnNames.push(driverReference.svcolname);
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
 					if(driverReference.sVWritable == "true")
332
 					if(driverReference.sVWritable == "true")
307
 					{
333
 					{
430
 								channels[j].newData.connect(calibrator.newMeasurement);
456
 								channels[j].newData.connect(calibrator.newMeasurement);
431
 								calibrator.newData.connect(indicator.setValue);
457
 								calibrator.newData.connect(indicator.setValue);
432
 								channels.push(calibrator);
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
 								channelType.push(channelType[j]);
463
 								channelType.push(channelType[j]);
434
 								columnNames.push(driverReference.destination);
464
 								columnNames.push(driverReference.destination);
435
 								indicatorPanel.addWidget(decorator);
465
 								indicatorPanel.addWidget(decorator);
508
 							rate.newData.connect(indicator.setValue);
538
 							rate.newData.connect(indicator.setValue);
509
 							temperatureDisplays.push(indicator);
539
 							temperatureDisplays.push(indicator);
510
 							channels.push(rate);
540
 							channels.push(rate);
541
+							// This cannot at present be configured to be
542
+							// hidden.
543
+							channelVisibility.push(true);
511
 							channelType.push("T");
544
 							channelType.push("T");
512
 							columnNames.push(configModel.data(driverIndex, 0));
545
 							columnNames.push(configModel.data(driverIndex, 0));
513
 						}
546
 						}
531
 			setTabOrder(tabControls[i-1], tabControls[i]);
564
 			setTabOrder(tabControls[i-1], tabControls[i]);
532
 		}
565
 		}
533
 		log.setHeaderData(0, "Time");
566
 		log.setHeaderData(0, "Time");
567
+		var channelSkip = 0;
534
 		for(var i = 0; i < columnNames.length; i++) {
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
 		var timer = new TimerDisplay;
578
 		var timer = new TimerDisplay;
542
 		timer.displayFormat = "mm:ss";
579
 		timer.displayFormat = "mm:ss";
543
 		timer.autoReset = true;
580
 		timer.autoReset = true;
578
 		var offsets = new Array();
615
 		var offsets = new Array();
579
 		var zeroemitters = new Array();
616
 		var zeroemitters = new Array();
580
 		var adapters = new Array();
617
 		var adapters = new Array();
618
+		channelSkip = 0;
581
 		for(var i = 0; i < channels.length; i++) {
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
         start.clicked.connect(function() {
636
         start.clicked.connect(function() {
595
 			start.enabled = false;
637
 			start.enabled = false;
635
 			{
677
 			{
636
 				annotationButtons[i].annotation.connect(log.newAnnotation);
678
 				annotationButtons[i].annotation.connect(log.newAnnotation);
637
 				annotationButtons[i].setTemperatureColumn(1);
679
 				annotationButtons[i].setTemperatureColumn(1);
638
-				annotationButtons[i].setAnnotationColumn(channels.length + 1);
680
+				annotationButtons[i].setAnnotationColumn(channels.length - channelSkip + 1);
639
 				annotationButtons[i].annotation.connect(function(note, tcol, ncol) {
681
 				annotationButtons[i].annotation.connect(function(note, tcol, ncol) {
640
 					for(var i = tcol; i < ncol; i++) {
682
 					for(var i = tcol; i < ncol; i++) {
641
 						log.newAnnotation(note, i, ncol);
683
 						log.newAnnotation(note, i, ncol);
647
         stop.annotation.connect(log.newAnnotation);
689
         stop.annotation.connect(log.newAnnotation);
648
         stop.clicked.connect(timer.stopTimer);
690
         stop.clicked.connect(timer.stopTimer);
649
 		stop.setTemperatureColumn(1);
691
 		stop.setTemperatureColumn(1);
650
-		stop.setAnnotationColumn(channels.length + 1);
692
+		stop.setAnnotationColumn(channels.length - channelSkip + 1);
651
 		QSettings.setValue("liveColumn", 1);
693
 		QSettings.setValue("liveColumn", 1);
652
         var lc = 1;
694
         var lc = 1;
653
         stop.clicked.connect(function() {
695
         stop.clicked.connect(function() {
807
 				zeroemitters[i].setColumn(c + i + 1);
849
 				zeroemitters[i].setColumn(c + i + 1);
808
 				log.setHeaderData(c + i + 1, columnNames[i]);
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
             stop.setTemperatureColumn(c + 1);
853
             stop.setTemperatureColumn(c + 1);
812
-			stop.setAnnotationColumn(c + columnNames.length + 1);
854
+			stop.setAnnotationColumn(c + columnNames.length + 1 - channelSkip);
813
 			for(var i = 0; i < annotationButtons.length; i++)
855
 			for(var i = 0; i < annotationButtons.length; i++)
814
 			{
856
 			{
815
 				annotationButtons[i].setTemperatureColumn(c + 1);
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
 			log.clearCurrentColumnSet();
860
 			log.clearCurrentColumnSet();
819
-			for(var i = 0; i < channels.length; i++) {
861
+			for(var i = 0; i < channels.length - channelSkip; i++) {
820
 				log.addToCurrentColumnSet(c + i + 1);
862
 				log.addToCurrentColumnSet(c + i + 1);
821
 			}
863
 			}
822
 			window.firstTempColumn = c + 1;
864
 			window.firstTempColumn = c + 1;
823
-			window.annotationColumn = c + columnNames.length + 1;
865
+			window.annotationColumn = c + columnNames.length - channelSkip + 1;
824
 		}
866
 		}
825
 		var saveMenu = findChildObject(this, 'save');
867
 		var saveMenu = findChildObject(this, 'save');
826
         saveMenu.triggered.connect(function() {
868
         saveMenu.triggered.connect(function() {
829
                 var lc = Number(QSettings.value("liveColumn"));
871
                 var lc = Number(QSettings.value("liveColumn"));
830
                 var file = new QFile(filename);
872
                 var file = new QFile(filename);
831
                 log.clearOutputColumns();
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
 					if(channelType[i] == "T") {
876
 					if(channelType[i] == "T") {
835
 						log.addOutputTemperatureColumn(lc + i);
877
 						log.addOutputTemperatureColumn(lc + i);
838
 						log.addOutputControlColumn(lc + i);
880
 						log.addOutputControlColumn(lc + i);
839
 					}
881
 					}
840
 				}
882
 				}
841
-				log.addOutputAnnotationColumn(lc + columnNames.length);
883
+				log.addOutputAnnotationColumn(lc + columnNames.length - channelSkip);
842
                 log.saveXML(file);
884
                 log.saveXML(file);
843
                 QSettings.setValue("script/lastDir", dir(filename));
885
                 QSettings.setValue("script/lastDir", dir(filename));
844
             }
886
             }
850
                 var lc = Number(QSettings.value("liveColumn"));
892
                 var lc = Number(QSettings.value("liveColumn"));
851
                 var file = new QFile(filename);
893
                 var file = new QFile(filename);
852
                 log.clearOutputColumns();
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
 					log.addOutputTemperatureColumn(lc + i);
897
 					log.addOutputTemperatureColumn(lc + i);
856
 				}
898
 				}
857
-				log.addOutputAnnotationColumn(lc + columnNames.length);
899
+				log.addOutputAnnotationColumn(lc + columnNames.length - channelSkip);
858
                 log.saveCSV(file);
900
                 log.saveCSV(file);
859
                 QSettings.setValue("script/lastDir", dir(filename));
901
                 QSettings.setValue("script/lastDir", dir(filename));
860
             }
902
             }

Loading…
Cancel
Save