Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 17aff5220114
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c2fde78a1166
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on May 25, 2020

  1. Verified

    This commit was signed with the committer’s verified signature.
    makenowjust Hiroya Fujinami
    Copy the full SHA
    e22d2f9 View commit details
  2. Copy the full SHA
    c2fde78 View commit details
Showing with 63 additions and 28 deletions.
  1. +45 −27 glscopeclient/OscilloscopeWindow.cpp
  2. +14 −0 glscopeclient/main.cpp
  3. +4 −1 glscopeclient/styles/glscopeclient.css
72 changes: 45 additions & 27 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -776,45 +776,63 @@ void OscilloscopeWindow::LoadInstruments(const YAML::Node& node, bool reconnect,
{
auto inst = it.second;

Oscilloscope* scope;
Oscilloscope* scope = NULL;

if(reconnect)
{
//Create the scope
auto transport = SCPITransport::CreateTransport(inst["transport"].as<string>(), inst["args"].as<string>());
scope = Oscilloscope::CreateOscilloscope(inst["driver"].as<string>(), transport);

//Sanity check make/model/serial. If mismatch, stop
string message;
bool fail = false;
if(inst["name"].as<string>() != scope->GetName())
//Check if the transport failed to initialize
if(!transport->IsConnected())
{
message = string("Unable to connect to oscilloscope: instrument has model name \"") +
scope->GetName() + "\", save file has model name \"" + inst["name"].as<string>() + "\"";
fail = true;
}
else if(inst["vendor"].as<string>() != scope->GetVendor())
{
message = string("Unable to connect to oscilloscope: instrument has vendor \"") +
scope->GetVendor() + "\", save file has vendor \"" + inst["vendor"].as<string>() + "\"";
fail = true;
}
else if(inst["serial"].as<string>() != scope->GetSerial())
{
message = string("Unable to connect to oscilloscope: instrument has serial \"") +
scope->GetSerial() + "\", save file has serial \"" + inst["serial"].as<string>() + "\"";
fail = true;
Gtk::MessageDialog dlg(
*this,
string("Failed to connect to instrument using connection string ") + inst["args"].as<string>(),
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
true);
dlg.run();
}
if(fail)

//All good, try to connect
else
{
Gtk::MessageDialog dlg(*this, message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dlg.run();
delete scope;
continue;
scope = Oscilloscope::CreateOscilloscope(inst["driver"].as<string>(), transport);

//Sanity check make/model/serial. If mismatch, stop
string message;
bool fail = false;
if(inst["name"].as<string>() != scope->GetName())
{
message = string("Unable to connect to oscilloscope: instrument has model name \"") +
scope->GetName() + "\", save file has model name \"" + inst["name"].as<string>() + "\"";
fail = true;
}
else if(inst["vendor"].as<string>() != scope->GetVendor())
{
message = string("Unable to connect to oscilloscope: instrument has vendor \"") +
scope->GetVendor() + "\", save file has vendor \"" + inst["vendor"].as<string>() + "\"";
fail = true;
}
else if(inst["serial"].as<string>() != scope->GetSerial())
{
message = string("Unable to connect to oscilloscope: instrument has serial \"") +
scope->GetSerial() + "\", save file has serial \"" + inst["serial"].as<string>() + "\"";
fail = true;
}
if(fail)
{
Gtk::MessageDialog dlg(*this, message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
dlg.run();
delete scope;
scope = NULL;
}
}
}

else
if(!scope)
{
//Create the mock scope
scope = new MockOscilloscope(
14 changes: 14 additions & 0 deletions glscopeclient/main.cpp
Original file line number Diff line number Diff line change
@@ -174,6 +174,20 @@ int main(int argc, char* argv[])
if(transport == NULL)
continue;

//Check if the transport failed to initialize
if(!transport->IsConnected())
{
Gtk::MessageDialog dlg(
string("Failed to connect to instrument using connection string ") + s,
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
true);
dlg.run();

continue;
}

//Create the scope
Oscilloscope* scope = Oscilloscope::CreateOscilloscope(driver, transport);
if(scope == NULL)
5 changes: 4 additions & 1 deletion glscopeclient/styles/glscopeclient.css
Original file line number Diff line number Diff line change
@@ -48,9 +48,12 @@ entry:disabled
background-color: @glscopeclient_inactive_color;
}

dialog
dialog,
dialog.*,
messagedialog *
{
background-color: @glscopeclient_bg_color;
background-image: none;
}

treeview