Selaa lähdekoodia

Add XML and CSV export in view target profiles window

Neal Wilson 3 vuotta sitten
vanhempi
commit
196e7f252b
Allekirjoittanut: Neal Wilson <neal@typica.us> GPG Key ID: 2A0BDDE701E66EB9
1 muutettua tiedostoa jossa 25 lisäystä ja 1 poistoa
  1. 25
    1
      config/Windows/profilehistory.xml

+ 25
- 1
config/Windows/profilehistory.xml Näytä tiedosto

@@ -28,6 +28,10 @@
28 28
 			</widget>
29 29
 		</splitter>
30 30
 	</layout>
31
+	<menu name="File">
32
+		<item id="save" shortcut="Ctrl+S">Save...</item>
33
+		<item id="export">Export CSV...</item>
34
+	</menu>
31 35
 	<menu name="Log">
32 36
 		<item id="showC">Display Celsius</item>
33 37
 		<item id="showF">Display Fahrenheit</item>
@@ -75,8 +79,11 @@
75 79
 			{
76 80
 				var buffer = new QBuffer(query.value(0));
77 81
 				var input = new XMLInput(buffer, 1);
82
+				log.clearOutputColumns();
78 83
 				input.newTemperatureColumn.connect(log.setHeaderData);
84
+				input.newTemperatureColumn.connect(log.addOutputTemperatureColumn);
79 85
 				input.newAnnotationColumn.connect(log.setHeaderData);
86
+				input.newAnnotationColumn.connect(log.addOutputAnnotationColumn);
80 87
 				input.measure.connect(graph.newMeasurement);
81 88
 				input.measure.connect(log.newMeasurement);
82 89
 				var lc;
@@ -132,6 +139,23 @@
132 139
 			log.setDisplayUnits(Units.Fahrenheit);
133 140
 			graph.showF();
134 141
 		});
142
+		var saveMenu = findChildObject(this, 'save');
143
+        saveMenu.triggered.connect(function() {
144
+            var filename = QFileDialog.getSaveFileName(window, TTR("basicWindow", "Save Log As..."), QSettings.value("script/lastDir", "") + "/");
145
+            if(filename != "") {
146
+                var file = new QFile(filename);
147
+                log.saveXML(file);
148
+                QSettings.setValue("script/lastDir", dir(filename));
149
+            }
150
+        });
151
+		var exportMenu = findChildObject(this, 'export');
152
+        exportMenu.triggered.connect(function() {
153
+            var filename = QFileDialog.getSaveFileName(window, TTR("basicWindow", "Export CSV As..."), QSettings.value("script/lastDir", "") + "/");
154
+            if(filename != "") {
155
+                log.saveCSV(file);
156
+                QSettings.setValue("script/lastDir", dir(filename));
157
+            }
158
+        });
135 159
 	]]>
136 160
 	</program>
137
-</window>
161
+</window>

Loading…
Peruuta
Tallenna