Skip to content

Commit

Permalink
Fix newSequence Lua call xLightsSequencer#5134
Browse files Browse the repository at this point in the history
  • Loading branch information
derwin12 committed Jan 21, 2025
1 parent 4193fbc commit 35a0314
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions documentation/xlDo Commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ GET /closeSequence - closes the sequence
force=true to close even if there are unsaved changes

GET /newSequence
Needs two query params:
Needs either duration or media query params:
duration= Time in seconds
media= Media filename
frameMS= frame time in MS (typically 25 or 50 or 0) optional
view= view to use for mast view ("Empty", "All Models" or a valid view name) optional
view= view to use for master view ("Empty", "All Models" or a valid view name) optional

GET /saveSequence
seq= Sequence name to save as, don't specify to use current name
Expand Down
18 changes: 14 additions & 4 deletions xLights/SeqFileUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ void xLightsFrame::NewSequence(const std::string& media, uint32_t durationMS, ui
return;
}

bool wizardactive;
if (media.empty() && durationMS == 0) {
wizardactive = true;
} else {
wizardactive = false;
}

// assign global xml file object
wxFileName xml_file;
xml_file.SetPath(CurrentDir);
Expand All @@ -119,10 +126,13 @@ void xLightsFrame::NewSequence(const std::string& media, uint32_t durationMS, ui
CurrentSeqXmlFile->setSupportsModelBlending(false);
}

SeqSettingsDialog setting_dlg(this, CurrentSeqXmlFile, mediaDirectories, wxT(""), _defaultSeqView, true, media, durationMS);
setting_dlg.Fit();
int ret_code = setting_dlg.ShowModal();
if (ret_code == wxID_CANCEL) {
SeqSettingsDialog setting_dlg(this, CurrentSeqXmlFile, mediaDirectories, wxT(""), _defaultSeqView, wizardactive, media, durationMS);
int ret_code = wxID_ANY;
if(wizardactive) {
setting_dlg.Fit();
ret_code = setting_dlg.ShowModal();
}
if (wizardactive && ret_code == wxID_CANCEL) {
delete CurrentSeqXmlFile;
CurrentSeqXmlFile = nullptr;
return;
Expand Down
8 changes: 6 additions & 2 deletions xLights/SeqSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,17 @@ SeqSettingsDialog::SeqSettingsDialog(wxWindow* parent, xLightsXmlFile* file_to_h

wxFileName name_and_path(media);
MediaLoad(name_and_path);
EndModal(wxID_OK);
if (wizard_active) {
EndModal(wxID_OK);
}

} else if (durationMS != 0) {
float d = (float)(durationMS) / 1000.0f;
TextCtrl_Xml_Seq_Duration->SetValue(wxString::Format("%f", d));
UpdateSequenceTiming();
EndModal(wxID_OK);
if (wizard_active) {
EndModal(wxID_OK);
}
}
}

Expand Down

0 comments on commit 35a0314

Please sign in to comment.