FIX:fixed isses with the devices dialog

Change-Id: I5e4822786fb2105893798b44622d080a593e41bb
This commit is contained in:
tao wang 2022-10-10 10:18:43 +08:00 committed by Lane.Wei
parent 0761cbd1cb
commit 622f3da8df
3 changed files with 55 additions and 31 deletions

View file

@ -318,6 +318,7 @@ void MonitorPanel::on_printer_clicked(wxMouseEvent &event)
if (!m_side_tools->is_in_interval()) {
wxPoint pos = m_side_tools->ClientToScreen(wxPoint(0, 0));
pos.y += m_side_tools->GetRect().height;
pos.x = pos.x < 0? 0:pos.x;
m_select_machine.Position(pos, wxSize(0, 0));
#ifdef __linux__

View file

@ -550,6 +550,7 @@ void SelectMachinePopup::update_other_devices()
this->Freeze();
m_scrolledWindow->Freeze();
int i = 0;
for (auto &elem : m_free_machine_list) {
MachineObject * mobj = elem.second;
/* do not show printer bind state is empty */
@ -626,13 +627,27 @@ void SelectMachinePopup::update_other_devices()
m_other_list_machine_panel[j]->mPanel->update_machine_info(nullptr);
m_other_list_machine_panel[j]->mPanel->Hide();
}
m_sizer_other_devices->Layout();
m_scrolledWindow->Layout();
if (m_placeholder_panel != nullptr) {
m_scrolledWindow->RemoveChild(m_placeholder_panel);
m_placeholder_panel->Destroy();
m_placeholder_panel = nullptr;
}
m_placeholder_panel = new wxWindow(m_scrolledWindow, wxID_ANY, wxDefaultPosition, wxSize(-1,FromDIP(10)));
m_placeholder_panel->SetBackgroundColour(*wxWHITE);
m_sizer_other_devices->Add(m_placeholder_panel, 0, wxEXPAND, 0);
//m_sizer_other_devices->Layout();
if(m_other_devices_count != i) {
m_scrolledWindow->Fit();
}
m_scrolledWindow->Layout();
m_scrolledWindow->Thaw();
Layout();
Fit();
this->Thaw();
m_other_devices_count = i;
BOOST_LOG_TRIVIAL(trace) << "SelectMachinePopup update_other_devices end";
}
@ -653,6 +668,7 @@ void SelectMachinePopup::update_user_devices()
this->Freeze();
m_scrolledWindow->Freeze();
int i = 0;
for (auto& elem : m_bind_machine_list) {
MachineObject* mobj = elem.second;
MachineObjectPanel* op = nullptr;
@ -752,12 +768,16 @@ void SelectMachinePopup::update_user_devices()
m_user_list_machine_panel[j]->mPanel->Hide();
}
//m_sizer_my_devices->Layout();
m_scrolledWindow->Layout();
if (m_my_devices_count != i) {
m_scrolledWindow->Fit();
}
m_scrolledWindow->Layout();
m_scrolledWindow->Thaw();
Layout();
Fit();
this->Thaw();
m_my_devices_count = i;
}
bool SelectMachinePopup::search_for_printer(MachineObject* obj)

View file

@ -195,6 +195,9 @@ public:
bool was_dismiss() { return m_dismiss; }
private:
int m_my_devices_count{0};
int m_other_devices_count{0};
wxWindow* m_placeholder_panel{nullptr};
wxBoxSizer * m_sizer_body{nullptr};
wxBoxSizer * m_sizer_my_devices{nullptr};
wxBoxSizer * m_sizer_other_devices{nullptr};