NEW:Update data only on device pages
jira:[STUDIO-6776] Change-Id: I33b0c9f35c1dc6df2db3b6bd4f446f46b31ecf6c
This commit is contained in:
parent
7ee6e62ec4
commit
d14f37b00f
|
@ -284,17 +284,20 @@ void MonitorPanel::select_machine(std::string machine_sn)
|
||||||
|
|
||||||
void MonitorPanel::on_update_all(wxMouseEvent &event)
|
void MonitorPanel::on_update_all(wxMouseEvent &event)
|
||||||
{
|
{
|
||||||
|
if (update_flag) {
|
||||||
update_all();
|
update_all();
|
||||||
Layout();
|
Layout();
|
||||||
Refresh();
|
Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorPanel::on_timer(wxTimerEvent& event)
|
void MonitorPanel::on_timer(wxTimerEvent& event)
|
||||||
{
|
{
|
||||||
|
if (update_flag) {
|
||||||
update_all();
|
update_all();
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
Refresh();
|
Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorPanel::on_select_printer(wxCommandEvent& event)
|
void MonitorPanel::on_select_printer(wxCommandEvent& event)
|
||||||
|
@ -453,6 +456,8 @@ bool MonitorPanel::Show(bool show)
|
||||||
NetworkAgent* m_agent = wxGetApp().getAgent();
|
NetworkAgent* m_agent = wxGetApp().getAgent();
|
||||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (show) {
|
if (show) {
|
||||||
|
start_update();
|
||||||
|
|
||||||
m_refresh_timer->Stop();
|
m_refresh_timer->Stop();
|
||||||
m_refresh_timer->SetOwner(this);
|
m_refresh_timer->SetOwner(this);
|
||||||
m_refresh_timer->Start(REFRESH_INTERVAL);
|
m_refresh_timer->Start(REFRESH_INTERVAL);
|
||||||
|
@ -471,6 +476,7 @@ bool MonitorPanel::Show(bool show)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
stop_update();
|
||||||
m_refresh_timer->Stop();
|
m_refresh_timer->Stop();
|
||||||
}
|
}
|
||||||
return wxPanel::Show(show);
|
return wxPanel::Show(show);
|
||||||
|
|
|
@ -104,6 +104,7 @@ private:
|
||||||
int last_wifi_signal = -1;
|
int last_wifi_signal = -1;
|
||||||
int last_status;
|
int last_status;
|
||||||
bool m_initialized { false };
|
bool m_initialized { false };
|
||||||
|
bool update_flag{false};
|
||||||
wxTimer* m_refresh_timer = nullptr;
|
wxTimer* m_refresh_timer = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -151,6 +152,9 @@ public:
|
||||||
|
|
||||||
MachineObject *obj { nullptr };
|
MachineObject *obj { nullptr };
|
||||||
std::string last_conn_type = "undedefined";
|
std::string last_conn_type = "undedefined";
|
||||||
|
|
||||||
|
void stop_update() {update_flag = false;};
|
||||||
|
void start_update() {update_flag = true;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue