[KiRi] Avoid including data in the HTML that will be replaced
The JS changes various things at start-up, in particular: - List of layers - List of sheets
This commit is contained in:
parent
a291a8fde1
commit
4fb3870d12
|
|
@ -222,10 +222,10 @@ class KiRiOptions(VariantOptions):
|
||||||
f.write(ln+'\n')
|
f.write(ln+'\n')
|
||||||
if ln.endswith('<!-- FILL_COMMITS_HERE -->'):
|
if ln.endswith('<!-- FILL_COMMITS_HERE -->'):
|
||||||
self.create_commits(f, commits)
|
self.create_commits(f, commits)
|
||||||
elif ln.endswith('<!-- FILL_PAGES_HERE -->'):
|
# elif ln.endswith('<!-- FILL_PAGES_HERE -->'):
|
||||||
self.create_pages(f)
|
# self.create_pages(f)
|
||||||
elif ln.endswith('<!-- FILL_LAYERS_HERE -->'):
|
# elif ln.endswith('<!-- FILL_LAYERS_HERE -->'):
|
||||||
self.create_layers(f)
|
# self.create_layers(f)
|
||||||
|
|
||||||
def create_commits(self, f, commits):
|
def create_commits(self, f, commits):
|
||||||
template = self.load_html_template('commits', 8)
|
template = self.load_html_template('commits', 8)
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,7 @@ function update_sheets_list(commit1, commit2) {
|
||||||
selected_sheet = pages[selected_page].id;
|
selected_sheet = pages[selected_page].id;
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
selected_page = "";
|
selected_sheet = "";
|
||||||
console.log("There isn't a sheet selected");
|
console.log("There isn't a sheet selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -807,11 +807,13 @@ function update_sheets_list(commit1, commit2) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If old selection does not exist, maybe the list is now shorter, then select the last item...
|
// If old selection does not exist, maybe the list is now shorter, then select the last item...
|
||||||
|
if (optionLabels.length) {
|
||||||
pages[optionLabels.length-1].checked = true;
|
pages[optionLabels.length-1].checked = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If nothing is selected still, select the first item
|
// If nothing is selected still, select the first item
|
||||||
if (!pages.filter(':checked').length) {
|
if (pages.length && !pages.filter(':checked').length) {
|
||||||
pages[0].checked = true;
|
pages[0].checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -937,8 +939,10 @@ function update_layers_list(commit1, commit2, selected_layer_idx, selected_layer
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If old selection does not exist, maybe the list is now shorter, then select the last item...
|
// If old selection does not exist, maybe the list is now shorter, then select the last item...
|
||||||
|
if (optionLabels.length) {
|
||||||
layers[optionLabels.length-1].checked = true;
|
layers[optionLabels.length-1].checked = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// restore previously selected index
|
// restore previously selected index
|
||||||
layers = $("#layers_list input:radio[name='layers']");
|
layers = $("#layers_list input:radio[name='layers']");
|
||||||
|
|
@ -975,12 +979,18 @@ function update_layer() {
|
||||||
layer_id = layers[selected_layer].id.split("-")[1];
|
layer_id = layers[selected_layer].id.split("-")[1];
|
||||||
console.log(">>>> [label_id_ELSE] = ", layer_id);
|
console.log(">>>> [label_id_ELSE] = ", layer_id);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (layers.length == 0) {
|
||||||
|
selected_layer = -1
|
||||||
|
layer_id = ""
|
||||||
|
}
|
||||||
|
else {
|
||||||
console.log("[PCB] Images may not exist and Kicad layout may be missing.");
|
console.log("[PCB] Images may not exist and Kicad layout may be missing.");
|
||||||
show_sch();
|
show_sch();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
console.log("[PCB] Images may not exist and Kicad layout may be missing.");
|
console.log("[PCB] Images may not exist and Kicad layout may be missing.");
|
||||||
show_sch();
|
show_sch();
|
||||||
|
|
@ -1012,7 +1022,7 @@ function update_layer() {
|
||||||
removeEmbed();
|
removeEmbed();
|
||||||
lastEmbed = createNewEmbed(image_path_timestamp_1, image_path_timestamp_2);
|
lastEmbed = createNewEmbed(image_path_timestamp_1, image_path_timestamp_2);
|
||||||
}
|
}
|
||||||
else
|
else if (layer_id != "")
|
||||||
{
|
{
|
||||||
document.getElementById("diff-xlink-1").href.baseVal = image_path_timestamp_1;
|
document.getElementById("diff-xlink-1").href.baseVal = image_path_timestamp_1;
|
||||||
document.getElementById("diff-xlink-2").href.baseVal = image_path_timestamp_2;
|
document.getElementById("diff-xlink-2").href.baseVal = image_path_timestamp_2;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue