RE TS plugin to have continues tune auto-upload feature #1605
This commit is contained in:
parent
a5389c238c
commit
5628da1b22
|
@ -7,8 +7,13 @@ import org.jetbrains.annotations.NotNull;
|
|||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
public class TsTuneReader {
|
||||
private static final String TS_USER_FILE = System.getProperty("user.home") + File.separator + ".efiAnalytics" + File.separator + "tsUser.properties";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String ecuName = "dev";
|
||||
|
||||
|
@ -23,11 +28,24 @@ public class TsTuneReader {
|
|||
|
||||
@NotNull
|
||||
public static String getTsTuneFileName(String ecuName) {
|
||||
JFileChooser fr = new JFileChooser();
|
||||
FileSystemView fw = fr.getFileSystemView();
|
||||
File defaultDirectory = fw.getDefaultDirectory();
|
||||
System.out.println(defaultDirectory);
|
||||
String projectsDir = getProjectsDir();
|
||||
|
||||
return defaultDirectory + File.separator + "TunerStudioProjects" + File.separator + ecuName + File.separator + "CurrentTune.msq";
|
||||
return projectsDir + File.separator + ecuName + File.separator + "CurrentTune.msq";
|
||||
}
|
||||
|
||||
public static String getProjectsDir() {
|
||||
try {
|
||||
Properties tsUser = new Properties();
|
||||
tsUser.load(new FileInputStream(TS_USER_FILE));
|
||||
// reading TS properties
|
||||
return tsUser.getProperty("projectsDir");
|
||||
} catch (IOException e) {
|
||||
JFileChooser fr = new JFileChooser();
|
||||
FileSystemView fw = fr.getFileSystemView();
|
||||
File defaultDirectory = fw.getDefaultDirectory();
|
||||
|
||||
// fallback mechanism just in case
|
||||
return defaultDirectory + File.separator + "TunerStudioProjects";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
package com.rusefi.ts_plugin;
|
||||
|
||||
import com.rusefi.TsTuneReader;
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileSystemView;
|
||||
import java.io.File;
|
||||
|
||||
public class LogUplodSelector {
|
||||
public class LogUploadSelector {
|
||||
private JPanel content = new JPanel(new VerticalFlowLayout());
|
||||
|
||||
public static void main(String[] args) {
|
||||
new FrameHelper().showFrame(new LogUplodSelector().getContent());
|
||||
new FrameHelper().showFrame(new LogUploadSelector().getContent());
|
||||
}
|
||||
|
||||
|
||||
public LogUplodSelector() {
|
||||
public LogUploadSelector() {
|
||||
|
||||
// https://stackoverflow.com/questions/9677692/getting-my-documents-path-in-java
|
||||
String projectName = "dev";
|
||||
String folder = FileSystemView.getFileSystemView().getDefaultDirectory().getPath() + File.separator + "TunerStudioProjects"
|
||||
String folder = TsTuneReader.getProjectsDir()
|
||||
+ File.separator + projectName + File.separator + "DataLogs";
|
||||
|
||||
|
|
@ -146,6 +146,9 @@ public class PluginEntry implements TsPluginBody {
|
|||
content.add(new URLLabel(REO));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is invoked every time we defect a switch between projects
|
||||
*/
|
||||
private void handleConfigurationChange(String configurationName) {
|
||||
Map<String, Constant> fileSystemValues = TuneUploder.getFileSystemValues(configurationName);
|
||||
Constant engineMake = fileSystemValues.get("enginemake");
|
||||
|
|
Loading…
Reference in New Issue