Browse Source

Fix regression in defining new sample roast profiles

Neal Wilson 7 years ago
parent
commit
5ea01b811d
2 changed files with 32 additions and 33 deletions
  1. 7
    9
      config/Windows/newsamplebatch.xml
  2. 25
    24
      config/Windows/productionroaster.xml

+ 7
- 9
config/Windows/newsamplebatch.xml View File

199
                 if(proceed) {
199
                 if(proceed) {
200
                     doRoast();
200
                     doRoast();
201
                 }
201
                 }
202
-                });
203
-                var doRoast = function() {
202
+            });
203
+            var doRoast = function() {
204
 				var lc = 1;
204
 				var lc = 1;
205
 				currentBatchInfo = batch;
205
 				currentBatchInfo = batch;
206
+                var targetseries = -1;
207
+                navigationwindow.loggingWindow.clearLog();
206
 				query = new QSqlQuery();
208
 				query = new QSqlQuery();
207
 				var q = "SELECT file FROM sample_roast_profiles WHERE profile_name = :name AND time = (SELECT max(time) FROM sample_roast_profiles WHERE profile_name = :again)";
209
 				var q = "SELECT file FROM sample_roast_profiles WHERE profile_name = :name AND time = (SELECT max(time) FROM sample_roast_profiles WHERE profile_name = :again)";
208
 				query.prepare(q);
210
 				query.prepare(q);
217
 					query.exec();
219
 					query.exec();
218
 					if(query.next())
220
 					if(query.next())
219
 					{
221
 					{
220
-						var targetseries = -1;
221
 						var buffer = new QBuffer(query.value(0));
222
 						var buffer = new QBuffer(query.value(0));
222
 						var input = new XMLInput(buffer, 1);
223
 						var input = new XMLInput(buffer, 1);
223
 						var graph = findChildObject(navigationwindow.loggingWindow, 'graph');
224
 						var graph = findChildObject(navigationwindow.loggingWindow, 'graph');
224
 						var log = findChildObject(navigationwindow.loggingWindow, 'log');
225
 						var log = findChildObject(navigationwindow.loggingWindow, 'log');
225
-						log.clear();
226
-						graph.clear();
227
 						input.newTemperatureColumn.connect(function(col, text) {
226
 						input.newTemperatureColumn.connect(function(col, text) {
228
 							log.setHeaderData(col, text);
227
 							log.setHeaderData(col, text);
229
 							if(text == navigationwindow.loggingWindow.targetcolumnname)
228
 							if(text == navigationwindow.loggingWindow.targetcolumnname)
235
 						input.measure.connect(graph.newMeasurement);
234
 						input.measure.connect(graph.newMeasurement);
236
 						input.measure.connect(log.newMeasurement);
235
 						input.measure.connect(log.newMeasurement);
237
 						input.measure.connect(function(data, series) {
236
 						input.measure.connect(function(data, series) {
238
-							if(series == targetseries)
239
-							{
237
+							if(series == targetseries) {
240
 								targetDetector.newMeasurement(data);
238
 								targetDetector.newMeasurement(data);
241
 							}
239
 							}
242
 						});
240
 						});
246
 							QSettings.setValue("liveColumn", c+1);
244
 							QSettings.setValue("liveColumn", c+1);
247
 							navigationwindow.loggingWindow.postLoadColumnSetup(c);
245
 							navigationwindow.loggingWindow.postLoadColumnSetup(c);
248
 						});
246
 						});
249
-						navigationwindow.loggingWindow.raise();
250
-						navigationwindow.loggingWindow.activateWindow();
251
 						log.updatesEnabled = false;
247
 						log.updatesEnabled = false;
252
 						graph.updatesEnabled = false;
248
 						graph.updatesEnabled = false;
253
 						input.input();
249
 						input.input();
256
 						log.newAnnotation(TTR("sampleRoastingBatch", "End"), 1, lc);
252
 						log.newAnnotation(TTR("sampleRoastingBatch", "End"), 1, lc);
257
 					}
253
 					}
258
 				}
254
 				}
255
+                navigationwindow.loggingWindow.raise();
256
+                navigationwindow.loggingWindow.activateWindow();
259
 				query = query.invalidate();
257
 				query = query.invalidate();
260
 				var t = TTR("sampleRoastingBatch", "Typica - Sample Roasting: [*]") + name.text;
258
 				var t = TTR("sampleRoastingBatch", "Typica - Sample Roasting: [*]") + name.text;
261
 				if(profileName.currentText != '')
259
 				if(profileName.currentText != '')

+ 25
- 24
config/Windows/productionroaster.xml View File

1163
 		if(QSettings.value("temperatureUnit", "F") == "C") {
1163
 		if(QSettings.value("temperatureUnit", "F") == "C") {
1164
 			showC.trigger();
1164
 			showC.trigger();
1165
 		}
1165
 		}
1166
+        window.postLoadColumnSetup = function(c) {
1167
+			for(var i = 0; i < adapters.length; i++) {
1168
+				adapters[i].setColumn(c + i + 1);
1169
+				zeroemitters[i].setColumn(c + i + 1);
1170
+				log.setHeaderData(c + i + 1, columnName(i));
1171
+			}
1172
+			log.setHeaderData(c + columnNames.length + 1 - channelSkip, TTR("basicWindow", "Note"));
1173
+            stop.setTemperatureColumn(c + 1);
1174
+			stop.setAnnotationColumn(c + columnNames.length + 1 - channelSkip);
1175
+			for(var i = 0; i < annotationButtons.length; i++) {
1176
+				annotationButtons[i].setTemperatureColumn(c + 1);
1177
+				annotationButtons[i].setAnnotationColumn(c + columnNames.length + 1 - channelSkip);
1178
+			}
1179
+			log.clearCurrentColumnSet();
1180
+			for(var i = 0; i < channels.length - channelSkip; i++) {
1181
+				log.addToCurrentColumnSet(c + i + 1);
1182
+			}
1183
+			window.firstTempColumn = c + 1;
1184
+			window.annotationColumn = c + columnNames.length - channelSkip + 1;
1185
+		}
1166
 		var clear = findChildObject(this, 'clear');
1186
 		var clear = findChildObject(this, 'clear');
1167
-        clear.triggered.connect(log.clear);
1168
-        clear.triggered.connect(graph.clear);
1169
-        clear.triggered.connect(function() {
1187
+        window.clearLog = function() {
1188
+            log.clear();
1189
+            graph.clear();
1170
             window.windowTitle = "Typica [*]";
1190
             window.windowTitle = "Typica [*]";
1171
 			log.setHeaderData(0, "Time");
1191
 			log.setHeaderData(0, "Time");
1172
             QSettings.setValue("liveColumn", 1);
1192
             QSettings.setValue("liveColumn", 1);
1176
 			}
1196
 			}
1177
 			resetTranslation.enabled = false;
1197
 			resetTranslation.enabled = false;
1178
 			setTranslation.enabled = false;
1198
 			setTranslation.enabled = false;
1179
-        });
1199
+        };
1200
+        clear.triggered.connect(window.clearLog);
1180
 		var openMenu = findChildObject(this, 'open');
1201
 		var openMenu = findChildObject(this, 'open');
1181
         var compareMenu = findChildObject(this, 'compare');
1202
         var compareMenu = findChildObject(this, 'compare');
1182
         compareMenu.triggered.connect(function() {
1203
         compareMenu.triggered.connect(function() {
1252
 			}
1273
 			}
1253
 			return "";
1274
 			return "";
1254
 		};
1275
 		};
1255
-		window.postLoadColumnSetup = function(c) {
1256
-			for(var i = 0; i < adapters.length; i++) {
1257
-				adapters[i].setColumn(c + i + 1);
1258
-				zeroemitters[i].setColumn(c + i + 1);
1259
-				log.setHeaderData(c + i + 1, columnName(i));
1260
-			}
1261
-			log.setHeaderData(c + columnNames.length + 1 - channelSkip, TTR("basicWindow", "Note"));
1262
-            stop.setTemperatureColumn(c + 1);
1263
-			stop.setAnnotationColumn(c + columnNames.length + 1 - channelSkip);
1264
-			for(var i = 0; i < annotationButtons.length; i++) {
1265
-				annotationButtons[i].setTemperatureColumn(c + 1);
1266
-				annotationButtons[i].setAnnotationColumn(c + columnNames.length + 1 - channelSkip);
1267
-			}
1268
-			log.clearCurrentColumnSet();
1269
-			for(var i = 0; i < channels.length - channelSkip; i++) {
1270
-				log.addToCurrentColumnSet(c + i + 1);
1271
-			}
1272
-			window.firstTempColumn = c + 1;
1273
-			window.annotationColumn = c + columnNames.length - channelSkip + 1;
1274
-		}
1275
 		var saveMenu = findChildObject(this, 'save');
1276
 		var saveMenu = findChildObject(this, 'save');
1276
         saveMenu.triggered.connect(function() {
1277
         saveMenu.triggered.connect(function() {
1277
             var filename = QFileDialog.getSaveFileName(window, TTR("basicWindow", "Save Log As..."), QSettings.value("script/lastDir", "") + "/");
1278
             var filename = QFileDialog.getSaveFileName(window, TTR("basicWindow", "Save Log As..."), QSettings.value("script/lastDir", "") + "/");

Loading…
Cancel
Save