Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.example.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ui_language": "en",
"esys_dir": "C:\\EC-Apps\\ESG\\E-Sys",
"psdzdata_dir": "",
"series": "G020",
Expand Down
15 changes: 8 additions & 7 deletions esys/cheatsheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//
// Loaded by tools.js. The FDL Editor is E-Sys's real module (same view object); this file only docks a pane next to it.
(function (h) {
var tr = h.tr;
var File = java.io.File;
var Sw = javax.swing;
var Awt = java.awt;
Expand Down Expand Up @@ -330,23 +331,23 @@
p.setMinimumSize(new Awt.Dimension(320, 100));

var head = new Sw.JPanel(new Awt.GridBagLayout());
head.setBorder(Sw.BorderFactory.createTitledBorder("Cheat sheets (Open CAFD Map)"));
head.setBorder(Sw.BorderFactory.createTitledBorder(tr("Cheat sheets (Open CAFD Map)", "速查表(Open CAFD Map)")));
var GBC = Awt.GridBagConstraints;
function gbc(x, y, wx, w) {
var c = new GBC(); c.gridx = x; c.gridy = y; c.weightx = wx; c.gridwidth = w || 1;
c.fill = wx ? GBC.HORIZONTAL : GBC.NONE; c.anchor = GBC.WEST; c.insets = new Awt.Insets(2, 4, 2, 4); return c;
}
var info = new Sw.JLabel("Load an NCD (or CAF) in the FDL editor on the left.");
var info = new Sw.JLabel(tr("Load an NCD (or CAF) in the FDL editor on the left.", "请在左侧 FDL 编辑器中加载 NCD(或 CAF)。"));
var show = new Sw.JComboBox(Java.to(["Compatible", "All for this CAFD"], "java.lang.Object[]"));
var sheetBox = new Sw.JComboBox();
var search = new Sw.JTextField();
var refresh = new Sw.JButton("Refresh");
var refresh = new Sw.JButton(tr("Refresh", "刷新"));
head.add(info, gbc(0, 0, 1, 4));
head.add(new Sw.JLabel("Show:"), gbc(0, 1, 0));
head.add(new Sw.JLabel(tr("Show:", "显示:")), gbc(0, 1, 0));
head.add(show, gbc(1, 1, 0));
head.add(new Sw.JLabel("Sheet:"), gbc(2, 1, 0));
head.add(new Sw.JLabel(tr("Sheet:", "速查表:")), gbc(2, 1, 0));
head.add(sheetBox, gbc(3, 1, 1));
head.add(new Sw.JLabel("Search:"), gbc(0, 2, 0));
head.add(new Sw.JLabel(tr("Search:", "搜索:")), gbc(0, 2, 0));
head.add(search, gbc(1, 2, 1, 2));
head.add(refresh, gbc(3, 2, 0));
p.add(head, Awt.BorderLayout.NORTH);
Expand Down Expand Up @@ -400,7 +401,7 @@
stepTable.setDefaultRenderer(java.lang.Object.class, statusRenderer(function (r) { return state.sel.results[r].status; }));
stepTable.setSelectionMode(Sw.ListSelectionModel.SINGLE_SELECTION);
var detail = new Sw.JLabel(" ");
var bGo = new Sw.JButton("Go to"), bApply = new Sw.JButton("Apply"), status = new Sw.JLabel(" ");
var bGo = new Sw.JButton(tr("Go to", "转到")), bApply = new Sw.JButton(tr("Apply", "应用")), status = new Sw.JLabel(" ");
bGo.setToolTipText("Select this function in the FDL tree (the selected step, or the first one)");
bApply.setToolTipText("Pick these values in the FDL editor (only the open NCD changes; save and code in E-Sys as usual)");
if (h.applyEnabled === false) { // untested E-Sys version without "Try anyway"
Expand Down
16 changes: 9 additions & 7 deletions esys/dtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// Fault texts come from Open CAFD Map's shipped table (data\dtc\, built from ISTA by ocm\dtc_tables.py), by
// diagnostic address + fault code. Loaded by tools.js. Nothing here touches coding data, the FA or the SVT.
(function (h) {
var tr = h.tr;
var System = java.lang.System, File = java.io.File, Sw = javax.swing, Awt = java.awt;
var log = h.log, cls = h.cls;
var TESTER = 0xF4, FUNCTIONAL = 0xDF;
Expand Down Expand Up @@ -348,17 +349,17 @@
var root = new Sw.JPanel(new Awt.BorderLayout(0, 6));
root.setBorder(Sw.BorderFactory.createEmptyBorder(4, 4, 4, 4));
var top = new Sw.JPanel(new Awt.GridBagLayout());
top.setBorder(Sw.BorderFactory.createTitledBorder("DTC"));
top.setBorder(Sw.BorderFactory.createTitledBorder(tr("DTC", "故障码")));
var GBC = Awt.GridBagConstraints;
function gbc(x, y, wx, w) {
var c = new GBC(); c.gridx = x; c.gridy = y; c.weightx = wx; c.gridwidth = w || 1;
c.fill = wx ? GBC.HORIZONTAL : GBC.NONE; c.insets = new Awt.Insets(2, 4, 2, 4); c.anchor = GBC.WEST; return c;
}
var gw = new Sw.JTextField(esysUrl() || "", 22);
var bFromEsys = new Sw.JButton("From E-Sys"), bRead = new Sw.JButton("Read faults"), bClear = new Sw.JButton("Clear all faults...");
var info = new Sw.JCheckBox("Also clear info memory", false);
var status = new Sw.JLabel("Connect E-Sys to the car, then Read faults.");
top.add(new Sw.JLabel("Gateway"), gbc(0, 0, 0)); top.add(gw, gbc(1, 0, 0.4)); top.add(bFromEsys, gbc(2, 0, 0));
var bFromEsys = new Sw.JButton(tr("From E-Sys", "来自 E-Sys")), bRead = new Sw.JButton(tr("Read faults", "读取故障码")), bClear = new Sw.JButton(tr("Clear all faults...", "清除全部故障码..."));
var info = new Sw.JCheckBox(tr("Also clear info memory", "同时清除信息存储器"), false);
var status = new Sw.JLabel(tr("Connect E-Sys to the car, then Read faults.", "先用 E-Sys 连接车辆,再读取故障码。"));
top.add(new Sw.JLabel(tr("Gateway", "网关")), gbc(0, 0, 0)); top.add(gw, gbc(1, 0, 0.4)); top.add(bFromEsys, gbc(2, 0, 0));
top.add(bRead, gbc(3, 0, 0)); top.add(bClear, gbc(4, 0, 0)); top.add(info, gbc(5, 0, 0));
top.add(status, gbc(0, 1, 1, 6));
root.add(top, Awt.BorderLayout.NORTH);
Expand Down Expand Up @@ -481,8 +482,9 @@
});
bRead.addActionListener(function () { work("Reading", function (s, addrs) { readInto(s, addrs); }); });
bClear.addActionListener(function () {
var msg = "Clear all faults" + (info.isSelected() ? " and the info memory" : "") + "?";
if (Sw.JOptionPane.showConfirmDialog(root, msg, "Clear all faults", Sw.JOptionPane.OK_CANCEL_OPTION,
var msg = info.isSelected() ? tr("Clear all faults and the info memory?", "清除全部故障码和信息存储器?") :
tr("Clear all faults?", "清除全部故障码?");
if (Sw.JOptionPane.showConfirmDialog(root, msg, tr("Clear all faults", "清除全部故障码"), Sw.JOptionPane.OK_CANCEL_OPTION,
Sw.JOptionPane.QUESTION_MESSAGE) !== Sw.JOptionPane.OK_OPTION) return;
var withInfo = info.isSelected();
work("Clearing", function (s, addrs) {
Expand Down
21 changes: 11 additions & 10 deletions esys/fahelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// Apply hands the edited FA to E-Sys's FA editor (E-Sys marks it changed); saving it and writing it to the car stay in
// E-Sys, as always. Nothing here writes to the car. Loaded by tools.js.
(function (h) {
var tr = h.tr;
var System = java.lang.System, File = java.io.File, Sw = javax.swing, Awt = java.awt;
var log = h.log, cls = h.cls;
var DATA = new File(h.dataDir, "fa");
Expand Down Expand Up @@ -321,18 +322,18 @@

// --- top: source, type key, build date, I-step
var top = new Sw.JPanel(new Awt.GridBagLayout());
top.setBorder(Sw.BorderFactory.createTitledBorder("FA / VO Helper (Open CAFD Map)"));
var src = new Sw.JLabel("No FA yet: read E-Sys's FA (Coding > Vehicle order) or open an FA file.");
var bRead = new Sw.JButton("Read from E-Sys"), bOpen = new Sw.JButton("Open FA file...");
top.setBorder(Sw.BorderFactory.createTitledBorder(tr("FA / VO Helper (Open CAFD Map)", "FA / VO 助手(Open CAFD Map)")));
var src = new Sw.JLabel(tr("No FA yet: read E-Sys's FA (Coding > Vehicle order) or open an FA file.", "还没有 FA:读取 E-Sys 中的 FA(设码 > 车辆订单),或打开 FA 文件。"));
var bRead = new Sw.JButton(tr("Read from E-Sys", "从 E-Sys 读取")), bOpen = new Sw.JButton(tr("Open FA file...", "打开 FA 文件..."));
var tkBox = new Sw.JComboBox(); tkBox.setEditable(true); tkBox.setPrototypeDisplayValue("8888 G20 · 330i xDrive · SEDAN · USA · AWD · B46 ·····");
var tkInfo = new Sw.JLabel(" ");
var dateField = new Sw.JTextField(5); dateField.setToolTipText("Build date as in the FA: MMYY, e.g. 0722 = July 2022");
var iStepBox = new Sw.JComboBox(); iStepBox.setPrototypeDisplayValue("S18A-26-07-560 ····");
var only = new Sw.JCheckBox("Only this type key's options", true);
var only = new Sw.JCheckBox(tr("Only this type key's options", "仅此型号代码的配置"), true);
top.add(src, gbc(0, 0, 1, GBC.HORIZONTAL, 4)); top.add(bRead, gbc(4, 0, 0)); top.add(bOpen, gbc(5, 0, 0));
top.add(new Sw.JLabel("Type key"), gbc(0, 1, 0)); top.add(tkBox, gbc(1, 1, 0.5, GBC.HORIZONTAL));
top.add(new Sw.JLabel("Build date (MMYY)"), gbc(2, 1, 0)); top.add(dateField, gbc(3, 1, 0));
top.add(new Sw.JLabel("I-step"), gbc(4, 1, 0)); top.add(iStepBox, gbc(5, 1, 0));
top.add(new Sw.JLabel(tr("Type key", "型号代码")), gbc(0, 1, 0)); top.add(tkBox, gbc(1, 1, 0.5, GBC.HORIZONTAL));
top.add(new Sw.JLabel(tr("Build date (MMYY)", "生产日期(月年)")), gbc(2, 1, 0)); top.add(dateField, gbc(3, 1, 0));
top.add(new Sw.JLabel(tr("I-step", "I 级")), gbc(4, 1, 0)); top.add(iStepBox, gbc(5, 1, 0));
top.add(tkInfo, gbc(0, 2, 1, GBC.HORIZONTAL, 4)); top.add(only, gbc(4, 2, 0, GBC.NONE, 2));
root.add(top, Awt.BorderLayout.NORTH);

Expand Down Expand Up @@ -383,7 +384,7 @@
var p = new Sw.JPanel(new Awt.BorderLayout(0, 2));
var head = new Sw.JPanel(new Awt.BorderLayout(4, 0));
head.add(label, Awt.BorderLayout.NORTH);
head.add(new Sw.JLabel("Search"), Awt.BorderLayout.WEST); head.add(search, Awt.BorderLayout.CENTER);
head.add(new Sw.JLabel(tr("Search", "搜索")), Awt.BorderLayout.WEST); head.add(search, Awt.BorderLayout.CENTER);
p.add(head, Awt.BorderLayout.NORTH); p.add(new Sw.JScrollPane(table), Awt.BorderLayout.CENTER);
var col = { kind: kind, title: title, panel: p, label: label, model: model, table: table, search: search,
set: function (r) { rows = r; model.fireTableDataChanged(); } };
Expand All @@ -405,8 +406,8 @@

// --- bottom: PsdZ check, Apply, Save
var bottom = new Sw.JPanel(new Awt.FlowLayout(Awt.FlowLayout.LEFT, 6, 2));
var bCafd = new Sw.JButton("Check CAFDs (PsdZ)"), bApply = new Sw.JButton("Apply to E-Sys FA"),
bSave = new Sw.JButton("Save FA as..."), bRevert = new Sw.JButton("Revert");
var bCafd = new Sw.JButton(tr("Check CAFDs (PsdZ)", "检查 CAFD(PsdZ)")), bApply = new Sw.JButton(tr("Apply to E-Sys FA", "应用到 E-Sys FA")),
bSave = new Sw.JButton(tr("Save FA as...", "FA 另存为...")), bRevert = new Sw.JButton(tr("Revert", "还原"));
bCafd.setToolTipText("Calculate the target SVT for this FA with E-Sys's PsdZ and list CAFDs your psdzdata doesn't have");
bApply.setToolTipText("Hand the edited FA to E-Sys's FA editor (E-Sys marks it changed; save or write it in E-Sys as usual)");
var status = new Sw.JLabel(" ");
Expand Down
28 changes: 15 additions & 13 deletions esys/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
var Awt = java.awt;
var BAR_NAME = "OpenLauncher";
var log = api.log;
var chinese = String(System.getProperty("ocm.ui")) === "zh-CN";
function tr(english, translated) { return chinese ? translated : english; }

var DEF_DIR = api.defDir;
var CAF_DIR = System.getProperty("ocm.cafdir") ? String(System.getProperty("ocm.cafdir")) : null;
Expand Down Expand Up @@ -257,7 +259,7 @@

// --- top: file pickers + buttons (E-Sys Plus style)
var top = new Sw.JPanel(new Awt.GridBagLayout());
top.setBorder(Sw.BorderFactory.createTitledBorder("Compare Net Coding Data (Open CAFD Map)"));
top.setBorder(Sw.BorderFactory.createTitledBorder(tr("Compare Net Coding Data (Open CAFD Map)", "比较净编码数据(Open CAFD Map)")));
var f1 = new Sw.JTextField(), f2 = new Sw.JTextField();
var GBC = Awt.GridBagConstraints;
function gbc(x, y, wx, fill) {
Expand All @@ -276,15 +278,15 @@
b1.setToolTipText("Pick NCD 1"); b2.setToolTipText("Pick NCD 2");
b1.addActionListener(function () { chooser(f1); });
b2.addActionListener(function () { chooser(f2); });
var bCompare = new Sw.JButton("Compare"), bClear = new Sw.JButton("Clear"), bSave = new Sw.JButton("Save diff");
var onlyDiff = new Sw.JCheckBox("Differences only", true);
var bCompare = new Sw.JButton(tr("Compare", "比较")), bClear = new Sw.JButton(tr("Clear", "清空")), bSave = new Sw.JButton(tr("Save diff", "保存差异"));
var onlyDiff = new Sw.JCheckBox(tr("Differences only", "仅显示差异"), true);
bSave.setEnabled(false);
top.add(new Sw.JLabel("NCD File 1:"), gbc(0, 0, 0));
top.add(new Sw.JLabel(tr("NCD File 1:", "NCD 文件 1:")), gbc(0, 0, 0));
top.add(f1, gbc(1, 0, 1, GBC.HORIZONTAL));
top.add(b1, gbc(2, 0, 0));
top.add(bCompare, gbc(3, 0, 0, GBC.HORIZONTAL));
top.add(onlyDiff, gbc(4, 0, 0));
top.add(new Sw.JLabel("NCD File 2:"), gbc(0, 1, 0));
top.add(new Sw.JLabel(tr("NCD File 2:", "NCD 文件 2:")), gbc(0, 1, 0));
top.add(f2, gbc(1, 1, 1, GBC.HORIZONTAL));
top.add(b2, gbc(2, 1, 0));
top.add(bClear, gbc(3, 1, 0, GBC.HORIZONTAL));
Expand Down Expand Up @@ -476,7 +478,7 @@
try {
var CONTRIB = System.getProperty("ocm.contrib") ? String(System.getProperty("ocm.contrib")) : null;
cheat = load(new File(new File(String(System.getProperty("ocm.agent"))).getParentFile(), "cheatsheet.js").getPath())({
log: log, cls: cls, field: field, esysFrame: esysFrame, selectOurBar: selectOurBar,
tr: tr, log: log, cls: cls, field: field, esysFrame: esysFrame, selectOurBar: selectOurBar,
contribDir: CONTRIB, // every FDL cheat sheet under definitions\ (community-cheatsheets and contributed ones)
localDir: System.getProperty("ocm.cheatdir") ? String(System.getProperty("ocm.cheatdir")) : null,
applyEnabled: TESTED || TRY,
Expand All @@ -493,7 +495,7 @@
var dataDir = api.tools ? new File(new File(api.tools).getParentFile(), "data") : null;
if (dataDir && new File(dataDir, "fa").isDirectory()) {
faHelper = load(new File(new File(String(System.getProperty("ocm.agent"))).getParentFile(), "fahelper.js").getPath())({
log: log, cls: cls, dataDir: dataDir,
tr: tr, log: log, cls: cls, dataDir: dataDir,
esysDataDir: System.getProperty("ocm.datadir") ? String(System.getProperty("ocm.datadir")) : null,
// same soft gate as Cheat Sheet Apply: editing E-Sys's documents only on tested versions unless "Try anyway"
applyEnabled: TESTED || TRY,
Expand All @@ -513,7 +515,7 @@
var dtcData = api.tools ? new File(new File(api.tools).getParentFile(), "data") : null;
if (dtcData && new File(dtcData, "dtc").isDirectory()) {
dtc = load(new File(new File(String(System.getProperty("ocm.agent"))).getParentFile(), "dtc.js").getPath())({
log: log, cls: cls, dataDir: dtcData
tr: tr, log: log, cls: cls, dataDir: dtcData
});
} else {
log("DTC not added: no data\\dtc\\ tables (Check for updates in OpenLauncher)");
Expand Down Expand Up @@ -615,21 +617,21 @@
p.setBackground(bg);
p.setOpaque(true);
p.add(Sw.Box.createVerticalStrut(6));
p.add(toolButton("compare", "Compare NCD", compareIcon(32), "Compare two NCD files side by side (Open CAFD Map)",
p.add(toolButton("compare", tr("Compare NCD", "比较 NCD"), compareIcon(32), tr("Compare two NCD files side by side (Open CAFD Map)", "并排比较两个 NCD 文件(Open CAFD Map)"),
function () { openTool("compare", buildCompareView); }));
if (cheat) { // E-Sys's FDL Editor wrapped with the cheat sheet pane: marked while that view is shown
p.add(Sw.Box.createVerticalStrut(10));
p.add(toolButton("cheat", "Cheat Sheet", sheetIcon(32), "FDL Editor with community cheat sheets, checked against the open CAFD",
p.add(toolButton("cheat", tr("Cheat Sheet", "速查表"), sheetIcon(32), tr("FDL Editor with community cheat sheets, checked against the open CAFD", "带社区速查表的 FDL 编辑器,并对照当前打开的 CAFD 检查"),
function () { try { cheat.open(); selectTool("cheat"); } catch (e) { log("Cheat Sheet failed: " + e); } }));
}
if (faHelper) {
p.add(Sw.Box.createVerticalStrut(10));
p.add(toolButton("fahelper", "FA Helper", faIcon(32), "Vehicle order (FA / VO) editor: options checked against the type key, " +
"conflicts and the CAFDs your psdzdata has", function () { openTool("fahelper", faHelper.build); }));
p.add(toolButton("fahelper", tr("FA Helper", "FA 助手"), faIcon(32), tr("Vehicle order (FA / VO) editor: options checked against the type key, " +
"conflicts and the CAFDs your psdzdata has", "车辆订单(FA / VO)编辑器:检查型号配置、冲突和本地 CAFD"), function () { openTool("fahelper", faHelper.build); }));
}
if (dtc) {
p.add(Sw.Box.createVerticalStrut(10));
p.add(toolButton("dtc", "DTC", dtcIcon(32), "Read and clear fault codes", function () { openTool("dtc", dtc.build); }));
p.add(toolButton("dtc", tr("DTC", "故障码"), dtcIcon(32), tr("Read and clear fault codes", "读取并清除故障码"), function () { openTool("dtc", dtc.build); }));
}
p.add(Sw.Box.createVerticalGlue());
return p;
Expand Down
Loading