Variables: Import… in the panel menu reads a CSV or an XML data source

The Variables panel menu gets Import…, which opens one file dialog for
CSV, TSV, TXT and XML files. `variable.import {path}` picks the reader by
the file's extension, in any case: a .csv, .tsv or .txt file is read as
Import Data Sets… reads it, and an .xml file as Load Variable Library…
reads it. Any other extension, or none, is refused before the file is
read. Import Data Sets… and Load Variable Library… stay in the menu.

Docs: docs/mcp.md, docs/target-app-parity.md.
This commit is contained in:
dotCooCoo
2026-11-15 06:28:41 -08:00
parent 0995c130d1
commit bd19ed1623
29 changed files with 142 additions and 0 deletions
+26
View File
@@ -11,6 +11,7 @@
//! visibility, `@` for image, no prefix for text). `variable.loadLibrary` replaces the variables and data sets with the
//! variables and data sets of a variable library, the XML file of the reference app's Save
//! Variable Library, and `variable.saveLibrary` writes the variables and data sets as one.
//! `variable.import` (the panel's Import…) runs one of the two readers by the file's extension.
//! Agents reach every command through `run_command`, like all engine commands.
use std::collections::{BTreeMap, BTreeSet};
@@ -697,6 +698,22 @@ fn dataset_step(s: &mut Session, cmd: &str, forward: bool) -> Result<Value> {
apply_dataset(s, &name)
}
/// The Variables panel's Import…: a data source file read by its extension, a CSV, TSV or TXT
/// file as `dataset.import` reads it and an XML file as `variable.loadLibrary` reads it. The
/// result is that command's, with `format` set to `csv` or `xml`.
fn variable_import(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "variable.import";
let path = str_param(p, "path").ok_or_else(|| bad(C, "missing `path`"))?;
let ext = std::path::Path::new(path).extension().and_then(|e| e.to_str()).map(str::to_ascii_lowercase);
let (format, mut out) = match ext.as_deref() {
Some("csv" | "tsv" | "txt") => ("csv", dataset_import(s, &json!({"path": path}))?),
Some("xml") => ("xml", load_library(s, &json!({"path": path}))?),
_ => return Err(bad(C, "Import reads a data source file ending in .csv, .tsv, .txt or .xml")),
};
out["format"] = json!(format);
Ok(out)
}
pub fn specs() -> Vec<CommandSpec> {
vec![
cmd!(
@@ -872,6 +889,15 @@ pub fn specs() -> Vec<CommandSpec> {
has_doc,
dataset_import
),
cmd!(
"variable.import",
"Import…",
["Window", "Variables"],
None,
"{path} import a data source file, chosen by its extension (any case): a .csv, .tsv or .txt file is read as dataset.import reads it, and an .xml file as variable.loadLibrary reads it, with their refusals and undo steps; any other extension, or none, is refused before the file is read → the result of that command with `format`: `csv` or `xml`",
has_doc,
variable_import
),
cmd!(
query "dataset.export",
"Export Data Sets…",
+63
View File
@@ -2316,6 +2316,69 @@ fn a_variable_library_defines_text_variables_and_data_sets() {
assert_eq!(s.doc().unwrap().doc.variables.datasets.len(), 2);
}
/// The Variables panel's Import… reads a data source by its extension, in any case: a .csv, .tsv
/// or .txt file as Import Data Sets… reads it, and an .xml file as Load Variable Library… reads it.
/// Any other extension, or none, is refused before the file is read.
#[test]
fn variable_import_reads_a_data_source_by_its_extension() {
let dir = Folder::new("vars-import");
let mut s = session();
let t = text(&mut s, "Alice");
s.execute("variable.define", &json!({"name": "Name", "kind": "text"})).unwrap();
s.execute("variable.bind", &json!({"variable": "Name", "ids": [t.0]})).unwrap();
for name in ["rows.csv", "rows.TSV", "rows.txt"] {
let path = dir.file(name);
write(&path, b"Name\nAnn\nBob\n");
let r = s.execute("variable.import", &json!({"path": path})).unwrap();
assert_eq!((r["format"].clone(), r["names"].clone()), (json!("csv"), json!(["Data Set 1", "Data Set 2"])), "{name}");
}
s.execute("dataset.select", &json!({"name": "Data Set 2"})).unwrap();
assert_eq!(plain(&s, t), "Bob");
let xml = r#"<variableSets><variableSet><variables><variable varName="Name" trait="textcontent"/></variables><sampleDataSets><sampleDataSet dataSetName="Row 1"><Name><p>Charlie</p></Name></sampleDataSet></sampleDataSets></variableSet></variableSets>"#;
let path = dir.file("library.Xml");
write(&path, xml.as_bytes());
let r = s.execute("variable.import", &json!({"path": path})).unwrap();
assert_eq!((r["format"].clone(), r["names"].clone(), r["deleted"].clone()), (json!("xml"), json!(["Row 1"]), json!([])));
// The library declares the bound text variable, so its binding stays.
s.execute("dataset.select", &json!({"name": "Row 1"})).unwrap();
assert_eq!(plain(&s, t), "Charlie");
// The extension picks the reader: CSV text in an .xml file goes to the library reader, which
// refuses it, and a library in a .csv file goes to the CSV reader.
let csv_in_xml = dir.file("rows.xml");
write(&csv_in_xml, b"Name\nAnn\n");
let e = s.execute("variable.import", &json!({"path": csv_in_xml})).unwrap_err().to_string();
assert!(e.contains("variable.loadLibrary"), "{e}");
let xml_in_csv = dir.file("library.csv");
write(&xml_in_csv, xml.as_bytes());
let e = s.execute("variable.import", &json!({"path": xml_in_csv})).unwrap_err().to_string();
assert!(e.contains("dataset.import"), "{e}");
// Other extensions, or none, are refused before the file is read, so a missing file gives the
// same error; the data sets stay as they were.
let refused = "Import reads a data source file ending in .csv, .tsv, .txt or .xml";
for (name, exists) in [("rows.json", true), ("rows", true), ("rows.csv.bak", true), ("missing.ai", false)] {
let path = dir.file(name);
if exists {
write(&path, b"Name\nAnn\n");
}
let e = s.execute("variable.import", &json!({"path": path})).unwrap_err().to_string();
assert!(e.contains(refused), "{name}: {e}");
}
let names: Vec<String> = s.doc().unwrap().doc.variables.datasets.iter().map(|d| d.name.clone()).collect();
assert_eq!(names, ["Row 1"]);
// `path` is required, and the command takes no other parameter.
for bad in [json!({}), json!({"path": 3})] {
let e = s.execute("variable.import", &bad).unwrap_err().to_string();
assert!(e.contains("missing `path`"), "{bad}: {e}");
}
let e = s.execute("variable.import", &json!({"path": dir.file("rows.csv"), "csv": "Name\nX\n"})).unwrap_err().to_string();
assert!(e.contains("unknown parameter `csv`"), "{e}");
}
/// Load Variable Library replaces the document's variables and data sets: every variable goes with
/// its bindings and values, a variable of another kind with a library variable's name included,
/// and every data set goes, the active one included. A text variable the library also declares
+1
View File
@@ -2440,6 +2440,7 @@ digits Malayalam Malaiàlam
Load Variable Library Carrega la biblioteca de variables
Load Variable Library… Carrega la biblioteca de variables…
Save Variable Library… Desa la biblioteca de variables…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml «Importa» llegeix un fitxer d’origen de dades amb l’extensió .csv, .tsv, .txt o .xml
@msg a variable library holds text variables, and the document has none una biblioteca de variables conté variables de text, i el document no en té cap
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` la variable `{name}` no es pot desar en una biblioteca de variables: canvieu-li el nom perquè comenci amb una lletra o `_`, sense espais ni símbols que no siguin `-`, `_` i `.`
@msg data set `{name}` holds a control character, which a variable library can't hold el conjunt de dades `{name}` conté un caràcter de control, que una biblioteca de variables no pot contenir
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -6231,6 +6231,7 @@ mark-style Japanese Japonské
Export Data Sets… Exportovat sady dat…
Load Variable Library… Načíst knihovnu proměnných…
Save Variable Library… Uložit knihovnu proměnných…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml „Importovat“ čte soubor zdroje dat s příponou .csv, .tsv, .txt nebo .xml
@msg a variable library holds text variables, and the document has none knihovna proměnných obsahuje textové proměnné a dokument žádné nemá
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` proměnnou `{name}` nelze uložit do knihovny proměnných: přejmenujte ji tak, aby začínala písmenem nebo `_` a neobsahovala mezery ani jiné symboly než `-`, `_` a `.`
@msg data set `{name}` holds a control character, which a variable library can't hold sada dat `{name}` obsahuje řídicí znak, který knihovna proměnných nemůže obsahovat
Can't render this file because it is too large.
+1
View File
@@ -6262,6 +6262,7 @@ mark-style Japanese Japansk
Export Data Sets… Eksportér datasæt…
Load Variable Library… Indlæs variabelbibliotek…
Save Variable Library… Gem variabelbibliotek…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml »Importér« læser en datakildefil med filtypenavnet .csv, .tsv, .txt eller .xml
@msg a variable library holds text variables, and the document has none et variabelbibliotek indeholder tekstvariabler, og dokumentet har ingen
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` variablen `{name}` kan ikke gemmes i et variabelbibliotek: omdøb den, så den begynder med et bogstav eller `_`, uden mellemrum eller andre symboler end `-`, `_` og `.`
@msg data set `{name}` holds a control character, which a variable library can't hold datasættet `{name}` indeholder et kontroltegn, som et variabelbibliotek ikke kan indeholde
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -5814,6 +5814,7 @@ effect Soft Weich
Export Data Sets… Datensätze exportieren…
Load Variable Library… Variablenbibliothek laden…
Save Variable Library… Variablenbibliothek speichern…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml „Importieren“ liest eine Datenquelldatei mit der Endung .csv, .tsv, .txt oder .xml
@msg a variable library holds text variables, and the document has none eine Variablenbibliothek enthält Textvariablen, und das Dokument hat keine
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` die Variable `{name}` kann nicht in einer Variablenbibliothek gespeichert werden: Benennen Sie sie so um, dass sie mit einem Buchstaben oder `_` beginnt, ohne Leerzeichen oder andere Symbole als `-`, `_` und `.`
@msg data set `{name}` holds a control character, which a variable library can't hold der Datensatz `{name}` enthält ein Steuerzeichen, das eine Variablenbibliothek nicht enthalten kann
Can't render this file because it is too large.
+1
View File
@@ -6088,6 +6088,7 @@ effect Points Σημεία
Export Data Sets… Εξαγωγή συνόλων δεδομένων…
Load Variable Library… Φόρτωση βιβλιοθήκης μεταβλητών…
Save Variable Library… Αποθήκευση βιβλιοθήκης μεταβλητών…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml Η «Εισαγωγή» διαβάζει αρχείο προέλευσης δεδομένων με κατάληξη .csv, .tsv, .txt ή .xml
@msg a variable library holds text variables, and the document has none μια βιβλιοθήκη μεταβλητών περιέχει μεταβλητές κειμένου και το έγγραφο δεν έχει καμία
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` η μεταβλητή `{name}` δεν μπορεί να αποθηκευτεί σε βιβλιοθήκη μεταβλητών: μετονομάστε την ώστε να ξεκινά με γράμμα ή `_`, χωρίς κενά ή σύμβολα εκτός από `-`, `_` και `.`
@msg data set `{name}` holds a control character, which a variable library can't hold το σύνολο δεδομένων `{name}` περιέχει χαρακτήρα ελέγχου, τον οποίο δεν μπορεί να περιέχει μια βιβλιοθήκη μεταβλητών
Can't render this file because it is too large.
+1
View File
@@ -6176,6 +6176,7 @@ mark-style Japanese Japonesas
Export Data Sets… Exportar conjuntos de datos…
Load Variable Library… Cargar biblioteca de variables…
Save Variable Library… Guardar biblioteca de variables…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml «Importar» lee un archivo de origen de datos con extensión .csv, .tsv, .txt o .xml
@msg a variable library holds text variables, and the document has none una biblioteca de variables contiene variables de texto y el documento no tiene ninguna
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` la variable `{name}` no se puede guardar en una biblioteca de variables: cámbiele el nombre para que empiece por una letra o `_`, sin espacios ni símbolos distintos de `-`, `_` y `.`
@msg data set `{name}` holds a control character, which a variable library can't hold el conjunto de datos `{name}` contiene un carácter de control, que una biblioteca de variables no puede contener
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -6099,6 +6099,7 @@ mark-style Japanese Japanilainen
Export Data Sets… Vie tietojoukot…
Load Variable Library… Lataa muuttujakirjasto…
Save Variable Library… Tallenna muuttujakirjasto…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml ”Tuo” lukee tietolähdetiedoston, jonka tunniste on .csv, .tsv, .txt tai .xml
@msg a variable library holds text variables, and the document has none muuttujakirjasto sisältää tekstimuuttujia, eikä asiakirjassa ole yhtään
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` muuttujaa `{name}` ei voi tallentaa muuttujakirjastoon: nimeä se uudelleen niin, että se alkaa kirjaimella tai merkillä `_` eikä sisällä välilyöntejä tai muita symboleja kuin `-`, `_` ja `.`
@msg data set `{name}` holds a control character, which a variable library can't hold tietojoukko `{name}` sisältää ohjausmerkin, jota muuttujakirjasto ei voi sisältää
Can't render this file because it contains an unexpected character in line 2 and column 73.
+1
View File
@@ -6226,6 +6226,7 @@ theme Appearance Apparence
Export Data Sets… Exporter des jeux de données…
Load Variable Library… Charger une bibliothèque de variables…
Save Variable Library… Enregistrer une bibliothèque de variables…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml « Importer » lit un fichier de source de données d’extension .csv, .tsv, .txt ou .xml
@msg a variable library holds text variables, and the document has none une bibliothèque de variables contient des variables de texte, et le document n’en a aucune
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` la variable `{name}` ne peut pas être enregistrée dans une bibliothèque de variables : renommez-la pour qu’elle commence par une lettre ou `_`, sans espaces ni symboles autres que `-`, `_` et `.`
@msg data set `{name}` holds a control character, which a variable library can't hold le jeu de données `{name}` contient un caractère de contrôle, qu’une bibliothèque de variables ne peut pas contenir
Can't render this file because it is too large.
+1
View File
@@ -4263,6 +4263,7 @@ antiAlias Sharp शार्प
Save Transparency Flattener Preset ट्रांसपेरेंसी फ़्लैटनर प्रीसेट सेव करें
Save Transparency Flattener Preset… ट्रांसपेरेंसी फ़्लैटनर प्रीसेट सेव करें…
Save Variable Library… वेरिएबल लाइब्रेरी सेव करें…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml "इम्पोर्ट करें" .csv, .tsv, .txt या .xml एक्सटेंशन वाली डेटा स्रोत फ़ाइल पढ़ता है
Save… सेव…
Saved सेव किए गए
SAVED सेव किए गए
Can't render this file because it is too large.
+1
View File
@@ -6214,6 +6214,7 @@ imageTrace Outline Körvonal
Export Data Sets… Adatkészletek exportálása…
Load Variable Library… Változókönyvtár betöltése…
Save Variable Library… Változókönyvtár mentése…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml Az „Importálás” .csv, .tsv, .txt vagy .xml kiterjesztésű adatforrásfájlt olvas be
@msg a variable library holds text variables, and the document has none a változókönyvtár szöveges változókat tartalmaz, a dokumentumban pedig nincs ilyen
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` a(z) `{name}` változó nem menthető változókönyvtárba: nevezze át úgy, hogy betűvel vagy `_` jellel kezdődjön, szóközök és a `-`, `_` és `.` jeltől eltérő szimbólumok nélkül
@msg data set `{name}` holds a control character, which a variable library can't hold a(z) `{name}` adatkészlet vezérlőkaraktert tartalmaz, amelyet a változókönyvtár nem tartalmazhat
Can't render this file because it is too large.
+1
View File
@@ -5851,6 +5851,7 @@ lighting Light Luce
Export Data Sets… Esporta set di dati…
Load Variable Library… Carica libreria di variabili…
Save Variable Library… Salva libreria di variabili…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml «Importa» legge un file di origine dati con estensione .csv, .tsv, .txt o .xml
@msg a variable library holds text variables, and the document has none una libreria di variabili contiene variabili di testo e il documento non ne ha
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` la variabile `{name}` non può essere salvata in una libreria di variabili: rinominala in modo che inizi con una lettera o `_`, senza spazi né simboli diversi da `-`, `_` e `.`
@msg data set `{name}` holds a control character, which a variable library can't hold il set di dati `{name}` contiene un carattere di controllo, che una libreria di variabili non può contenere
Can't render this file because it is too large.
+1
View File
@@ -5895,6 +5895,7 @@ lighting Light ライト
Export Data Sets… データセットを書き出し…
Load Variable Library… 変数ライブラリを読み込み…
Save Variable Library… 変数ライブラリを保存…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml 「読み込み」は拡張子が .csv、.tsv、.txt、.xml のデータソースファイルを読み込みます
@msg a variable library holds text variables, and the document has none 変数ライブラリにはテキスト変数を保存しますが、このドキュメントにはテキスト変数がありません
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` 変数 `{name}` は変数ライブラリに保存できません: 英字または `_` で始まり、スペースや `-`、`_`、`.` 以外の記号を含まない名前に変更してください
@msg data set `{name}` holds a control character, which a variable library can't hold データセット `{name}` に変数ライブラリに保存できない制御文字が含まれています
Can't render this file because it is too large.
+1
View File
@@ -5893,6 +5893,7 @@ imageTrace Outline კონტური
Export Data Sets… მონაცემთა ნაკრებების ექსპორტი…
Load Variable Library… ცვლადების ბიბლიოთეკის ჩატვირთვა…
Save Variable Library… ცვლადების ბიბლიოთეკის შენახვა…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml „იმპორტი“ კითხულობს მონაცემთა წყაროს ფაილს გაფართოებით .csv, .tsv, .txt ან .xml
@msg a variable library holds text variables, and the document has none ცვლადების ბიბლიოთეკა ტექსტურ ცვლადებს შეიცავს, დოკუმენტს კი არცერთი არ აქვს
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` ცვლადი `{name}` ვერ შეინახება ცვლადების ბიბლიოთეკაში: გადაარქვით სახელი ისე, რომ იწყებოდეს ასოთი ან `_`-ით, ჰარეების და `-`, `_` და `.`-ის გარდა სხვა სიმბოლოების გარეშე
@msg data set `{name}` holds a control character, which a variable library can't hold მონაცემთა ნაკრები `{name}` შეიცავს მმართველ სიმბოლოს, რომელსაც ცვლადების ბიბლიოთეკა ვერ შეინახავს
Can't render this file because it is too large.
+1
View File
@@ -5812,6 +5812,7 @@ lighting Light 광원
Export Data Sets… 데이터 세트 내보내기…
Load Variable Library… 변수 라이브러리 불러오기…
Save Variable Library… 변수 라이브러리 저장…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml "가져오기"는 확장자가 .csv, .tsv, .txt 또는 .xml인 데이터 소스 파일을 읽습니다
@msg a variable library holds text variables, and the document has none 변수 라이브러리에는 텍스트 변수가 들어가는데 문서에 텍스트 변수가 없습니다
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` 변수 `{name}`은(는) 변수 라이브러리에 저장할 수 없습니다: 문자나 `_`로 시작하고 공백이나 `-`, `_`, `.` 이외의 기호가 없도록 이름을 바꾸세요
@msg data set `{name}` holds a control character, which a variable library can't hold 데이터 세트 `{name}`에 변수 라이브러리에 담을 수 없는 제어 문자가 있습니다
Can't render this file because it is too large.
+1
View File
@@ -8056,6 +8056,7 @@ mark-style Japanese Japans
Export Data Sets… Gegevenssets exporteren…
Load Variable Library… Variabelenbibliotheek laden…
Save Variable Library… Variabelenbibliotheek opslaan…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml ‘Importeren’ leest een gegevensbronbestand met de extensie .csv, .tsv, .txt of .xml
@msg a variable library holds text variables, and the document has none een variabelenbibliotheek bevat tekstvariabelen, en het document heeft er geen
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` variabele `{name}` kan niet in een variabelenbibliotheek worden opgeslagen: geef haar een naam die met een letter of `_` begint, zonder spaties of andere symbolen dan `-`, `_` en `.`
@msg data set `{name}` holds a control character, which a variable library can't hold gegevensset `{name}` bevat een stuurteken, dat een variabelenbibliotheek niet kan bevatten
Can't render this file because it is too large.
+1
View File
@@ -6085,6 +6085,7 @@ mark-style Japanese Japońskie
Export Data Sets… Eksportuj zestawy danych…
Load Variable Library… Wczytaj bibliotekę zmiennych…
Save Variable Library… Zapisz bibliotekę zmiennych…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml „Importuj” wczytuje plik źródła danych z rozszerzeniem .csv, .tsv, .txt lub .xml
@msg a variable library holds text variables, and the document has none biblioteka zmiennych zawiera zmienne tekstowe, a dokument nie ma żadnej
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` nie można zapisać zmiennej `{name}` w bibliotece zmiennych: zmień jej nazwę tak, aby zaczynała się literą lub `_`, bez spacji i symboli innych niż `-`, `_` i `.`
@msg data set `{name}` holds a control character, which a variable library can't hold zestaw danych `{name}` zawiera znak sterujący, którego biblioteka zmiennych nie może zawierać
Can't render this file because it is too large.
+1
View File
@@ -1040,6 +1040,7 @@ antiAlias Sharp Nítido
Export Data Sets… Exportar Conjuntos de Dados…
Load Variable Library… Carregar Biblioteca de Variáveis…
Save Variable Library… Salvar Biblioteca de Variáveis…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml "Importar" lê um arquivo de fonte de dados com extensão .csv, .tsv, .txt ou .xml
@msg a variable library holds text variables, and the document has none uma biblioteca de variáveis contém variáveis de texto, e o documento não tem nenhuma
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` a variável `{name}` não pode ser salva em uma biblioteca de variáveis: renomeie-a para começar com uma letra ou `_`, sem espaços nem símbolos além de `-`, `_` e `.`
@msg data set `{name}` holds a control character, which a variable library can't hold o conjunto de dados `{name}` contém um caractere de controle, que uma biblioteca de variáveis não pode conter
Can't render this file because it is too large.
+1
View File
@@ -5838,6 +5838,7 @@ lighting Light Свет
Export Data Sets… Экспортировать наборы данных…
Load Variable Library… Загрузить библиотеку переменных…
Save Variable Library… Сохранить библиотеку переменных…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml «Импорт» читает файл источника данных с расширением .csv, .tsv, .txt или .xml
@msg a variable library holds text variables, and the document has none библиотека переменных содержит текстовые переменные, а в документе их нет
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` переменную `{name}` нельзя сохранить в библиотеке переменных: переименуйте её так, чтобы имя начиналось с буквы или `_` и не содержало пробелов и символов, кроме `-`, `_` и `.`
@msg data set `{name}` holds a control character, which a variable library can't hold набор данных `{name}` содержит управляющий символ, который не может храниться в библиотеке переменных
Can't render this file because it is too large.
+1
View File
@@ -6083,6 +6083,7 @@ theme Appearance Utseende
Export Data Sets… Exportera datauppsättningar…
Load Variable Library… Läs in variabelbibliotek…
Save Variable Library… Spara variabelbibliotek…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml ”Importera” läser en datakällfil med filändelsen .csv, .tsv, .txt eller .xml
@msg a variable library holds text variables, and the document has none ett variabelbibliotek innehåller textvariabler, och dokumentet har inga
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` variabeln `{name}` kan inte sparas i ett variabelbibliotek: byt namn på den så att den börjar med en bokstav eller `_`, utan mellanslag eller andra symboler än `-`, `_` och `.`
@msg data set `{name}` holds a control character, which a variable library can't hold datauppsättningen `{name}` innehåller ett kontrolltecken, som ett variabelbibliotek inte kan innehålla
Can't render this file because it is too large.
+1
View File
@@ -6336,6 +6336,7 @@ theme Appearance Görünüm
Kashidas Keşide
Load Variable Library… Değişken Kitaplığı Yükle…
Save Variable Library… Değişken Kitaplığını Kaydet…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml "İthalat" uzantısı .csv, .tsv, .txt veya .xml olan bir veri kaynağı dosyasını okur
@msg a variable library holds text variables, and the document has none değişken kitaplığı metin değişkenleri içerir ve belgede hiç metin değişkeni yok
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` `{name}` değişkeni değişken kitaplığına kaydedilemiyor: adını bir harf veya `_` ile başlayacak, boşluk ya da `-`, `_` ve `.` dışında simge içermeyecek şekilde değiştirin
@msg data set `{name}` holds a control character, which a variable library can't hold `{name}` veri kümesi, değişken kitaplığının tutamayacağı bir denetim karakteri içeriyor
Can't render this file because it is too large.
+1
View File
@@ -5831,6 +5831,7 @@ lighting Light Світло
Export Data Sets… Експортувати набори даних…
Load Variable Library… Завантажити бібліотеку змінних…
Save Variable Library… Зберегти бібліотеку змінних…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml «Імпорт» читає файл джерела даних із розширенням .csv, .tsv, .txt або .xml
@msg a variable library holds text variables, and the document has none бібліотека змінних містить текстові змінні, а в документі їх немає
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` змінну `{name}` не можна зберегти в бібліотеці змінних: перейменуйте її так, щоб ім’я починалося з літери або `_` і не містило пробілів і символів, крім `-`, `_` і `.`
@msg data set `{name}` holds a control character, which a variable library can't hold набір даних `{name}` містить керівний символ, який бібліотека змінних не може містити
Can't render this file because it is too large.
+1
View File
@@ -5836,6 +5836,7 @@ theme Appearance Giao diện
Export Data Sets… Xuất tập dữ liệu…
Load Variable Library… Tải thư viện biến số…
Save Variable Library… Lưu thư viện biến số…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml "Nhập" đọc tệp nguồn dữ liệu có phần mở rộng .csv, .tsv, .txt hoặc .xml
@msg a variable library holds text variables, and the document has none thư viện biến số chứa các biến số văn bản, và tài liệu không có biến số văn bản nào
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` không thể lưu biến số `{name}` vào thư viện biến số: hãy đổi tên để bắt đầu bằng một chữ cái hoặc `_`, không có khoảng trắng hay ký hiệu nào ngoài `-`, `_` và `.`
@msg data set `{name}` holds a control character, which a variable library can't hold tập dữ liệu `{name}` chứa ký tự điều khiển mà thư viện biến số không thể chứa
Can't render this file because it contains an unexpected character in line 204 and column 5.
+1
View File
@@ -6073,6 +6073,7 @@ lighting Light 光源
Export Data Sets… 导出数据集…
Load Variable Library… 载入变量库…
Save Variable Library… 保存变量库…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml “导入”读取扩展名为 .csv、.tsv、.txt 或 .xml 的数据源文件
@msg a variable library holds text variables, and the document has none 变量库包含文本变量,而文档中没有文本变量
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` 无法将变量 `{name}` 保存到变量库中:请重命名,使其以字母或 `_` 开头,且不含空格或 `-`、`_`、`.` 以外的符号
@msg data set `{name}` holds a control character, which a variable library can't hold 数据集 `{name}` 包含变量库无法保存的控制字符
Can't render this file because it is too large.
+1
View File
@@ -5907,6 +5907,7 @@ lighting Light 光源
Export Data Sets… 匯出資料集…
Load Variable Library… 載入變數資料庫…
Save Variable Library… 儲存變數資料庫…
@msg Import reads a data source file ending in .csv, .tsv, .txt or .xml 「匯入」讀取副檔名為 .csv、.tsv、.txt 或 .xml 的資料來源檔案
@msg a variable library holds text variables, and the document has none 變數資料庫包含文字變數,但文件中沒有文字變數
@msg variable `{name}` can't be saved in a variable library: rename it to start with a letter or `_`, without spaces or symbols other than `-`, `_` and `.` 無法將變數 `{name}` 儲存到變數資料庫:請重新命名,使其以字母或 `_` 開頭,且不含空格或 `-`、`_`、`.` 以外的符號
@msg data set `{name}` holds a control character, which a variable library can't hold 資料集 `{name}` 包含變數資料庫無法儲存的控制字元
Can't render this file because it is too large.
+23
View File
@@ -321,6 +321,10 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) {
delete_active_dataset(app);
}
ui.separator();
// One file dialog for either kind of data source; the extension picks the reader.
if widgets::menu_item(ui, tl!("Import…"), true, false) {
crate::picks::button(app, import_data_source);
}
if widgets::menu_item(ui, tl!("Import Data Sets…"), true, false) {
crate::picks::button(app, import_datasets);
}
@@ -344,6 +348,23 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) {
}
}
/// Variables panel: Import… opens one file dialog for a CSV, TSV, TXT or XML file and runs
/// `variable.import` on the chosen file, which reads it by its extension.
fn import_data_source(app: &mut VectorcraftApp) {
let pick = crate::FilePick {
filters: vec![
crate::FilePick::filter("Data sources", &["csv", "tsv", "txt", "xml"]),
crate::FilePick::filter("CSV", &["csv", "tsv", "txt"]),
crate::FilePick::filter("XML", &["xml"]),
],
..Default::default()
};
let Some(path) = crate::picks::open(app, &pick) else { return };
if let Err(e) = app.run("variable.import", json!({"path": path})) {
app.status(e);
}
}
/// Variables panel: Import Data Sets… opens a file dialog for a comma- or tab-separated file and runs `dataset.import` on the chosen file.
fn import_datasets(app: &mut VectorcraftApp) {
let pick = crate::FilePick { filters: vec![crate::FilePick::filter("CSV", &["csv", "tsv", "txt"])], ..Default::default() };
@@ -469,6 +490,8 @@ mod tests {
"Update Data Set",
"Rename Data Set…",
"Delete Data Set",
"Import…",
"Import Data Sets…",
"Load Variable Library…",
"Save Variable Library…",
"Select Bound Object",
+5
View File
@@ -3498,6 +3498,11 @@ already walks Image Trace. Short agent entry points:
image value that isn't a file's absolute path, and past `variable.loadLibrary`'s caps (256 variables, 1,000 data
sets, 8 MiB). Without `path` the reply is `{xml, variables, datasets}`; with it, the file is written and the reply
is `{path, variables, datasets}`.
- Import a data source: `variable.import {path}` (the Variables panel menu's Import…) reads a data source file by its
extension, in any case: a `.csv`, `.tsv` or `.txt` file as `dataset.import {path}` reads it, and an `.xml` file as
`variable.loadLibrary {path}` reads it, with that command's refusals, undo step and reply, plus `format` (`csv` or
`xml`). A path with any other extension, or none, is refused before the file is read. The panel menu's Import Data
Sets… and Load Variable Library… stay.
- Batch: `action.batch {commands, source?: folder|datasets, folder?, destination?: none|saveAndClose|folder,
destinationFolder?, overrideOpen?, overrideSave?, overrideExport?, includeSubdirs?, stopOnError?}` plays an
action on every file in a folder or every data set (the Actions panel menu's Batch…). Override Save and Override
+1
View File
@@ -830,6 +830,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- Variables: Import Data Sets… (`dataset.import`) defines the variables a file's header names that the document lacks, unbound. `#Shown` defines a visibility variable, `@Photo` defines an image variable, and a header without a prefix defines a text variable. A header that is a variable's exact name keeps naming it, and any other `%` header (graph data files) is refused.
- Variables: Load Variable Library… in the Variables panel menu (`variable.loadLibrary`) replaces the document's variables and data sets with a variable library's, read from its XML file, in one undo step: every data set is deleted, and every variable is deleted with its bindings and values, except a variable the library also declares with the same kind, which stays bound so the library's data sets change its objects (#4136); then the library's other variables are defined, unbound: text, visibility, image (linked file) and graph variables, and variables without a known `trait` as unknown. Its data sets take text values from each value's `p` elements, one paragraph each, visibility values from `true` or `false`, image values from a file's absolute path or `file:` URL, and graph values from a `data` element of series names and rows.
- Variables: Save Variable Library… in the Variables panel menu (`variable.saveLibrary`) writes the document's variables of every kind and its data sets as a variable library's XML file, which Load Variable Library reads back with the same variables, kinds, data set names and values.
- Variables: Import… in the Variables panel menu (`variable.import`) opens one file dialog for a data source and reads it by its extension: a CSV, TSV or TXT file as Import Data Sets… reads it, and an XML file as Load Variable Library… reads it. Other extensions are refused.
- JSON-lines control channel with real egui pointer and keyboard injection.
- Variables: a type object holds one text variable. `variable.bind` and Make Text Dynamic refuse a second one and name the text variable the object has; a visibility variable can still share the object, and a document saved with two text variables on one object opens with both.
- Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709).