ENH: Do not display unavailable storage when sent to SD card
JIRA: STUDIO-9079 1. emmc for printer is unavailable 2. When the printer is not inserted with an SD card, it cannot send either Change-Id: I59d2429ec2d13a5300e8bda46cb15f241fde614c
This commit is contained in:
parent
0a739fe087
commit
d2096efe52
|
@ -26,6 +26,7 @@ namespace GUI {
|
|||
#define INITIAL_NUMBER_OF_MACHINES 0
|
||||
#define LIST_REFRESH_INTERVAL 200
|
||||
#define MACHINE_LIST_REFRESH_INTERVAL 2000
|
||||
#define EMMC_STORAGE "emmc"
|
||||
|
||||
constexpr int timeout_period = 15000; // ms
|
||||
|
||||
|
@ -558,12 +559,14 @@ std::string SendToPrinterDialog::get_storage_selected()
|
|||
return "";
|
||||
}
|
||||
|
||||
void SendToPrinterDialog::update_storage_list(std::vector<std::string> storages)
|
||||
void SendToPrinterDialog::update_storage_list(const std::vector<std::string>& storages)
|
||||
{
|
||||
m_storage_sizer->Clear();
|
||||
m_storage_radioBox.clear();
|
||||
m_storage_panel->DestroyChildren();
|
||||
|
||||
for (int i=0; i < storages.size(); i++) {
|
||||
if (storages[i] == EMMC_STORAGE) continue;
|
||||
RadioBox* radiobox = new RadioBox(m_storage_panel);
|
||||
Label* storage_text = new Label(m_storage_panel, storages[i]);
|
||||
radiobox->SetLabel(storages[i]);
|
||||
|
@ -574,16 +577,16 @@ void SendToPrinterDialog::update_storage_list(std::vector<std::string> storages)
|
|||
radiobox->SetValue(true);
|
||||
});
|
||||
|
||||
if (m_storage_radioBox.size() > 0) {
|
||||
m_storage_sizer->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(6));
|
||||
auto radio = m_storage_radioBox.front();
|
||||
radio->SetValue(true);
|
||||
}
|
||||
|
||||
m_storage_sizer->Add(radiobox, 0, wxALIGN_CENTER, 0);
|
||||
m_storage_sizer->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(6));
|
||||
m_storage_sizer->Add(storage_text, 0, wxALIGN_CENTER,0);
|
||||
m_storage_radioBox.push_back(radiobox);
|
||||
m_storage_radioBox.push_back(radiobox);
|
||||
}
|
||||
|
||||
if (m_storage_radioBox.size() > 0) {
|
||||
m_storage_sizer->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(6));
|
||||
auto radio = m_storage_radioBox.front();
|
||||
radio->SetValue(true);
|
||||
}
|
||||
|
||||
m_storage_panel->Layout();
|
||||
|
@ -734,7 +737,7 @@ void SendToPrinterDialog::on_cancel(wxCloseEvent &event)
|
|||
|
||||
if (m_task_timer && m_task_timer->IsRunning()) {
|
||||
m_task_timer->Stop();
|
||||
m_task_timer.reset();
|
||||
m_task_timer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,6 +786,10 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
|||
}
|
||||
if (m_file_sys) {
|
||||
m_file_sys->CancelUploadTask();
|
||||
if (m_task_timer && m_task_timer->IsRunning()) {
|
||||
m_task_timer->Stop();
|
||||
m_task_timer.reset();
|
||||
}
|
||||
}
|
||||
m_is_canceled = true;
|
||||
wxCommandEvent* event = new wxCommandEvent(EVT_PRINT_JOB_CANCEL);
|
||||
|
@ -838,7 +845,7 @@ void SendToPrinterDialog::on_ok(wxCommandEvent &event)
|
|||
fs::path default_output_file_path = boost::filesystem::path(default_output_file.c_str());
|
||||
file_name = default_output_file_path.filename().string();
|
||||
}*/
|
||||
if (obj_->is_lan_mode_printer()) {
|
||||
if (!obj_->is_lan_mode_printer()) {
|
||||
update_print_status_msg(wxEmptyString, false, false);
|
||||
if (m_file_sys) {
|
||||
PrintPrepareData print_data;
|
||||
|
@ -1096,6 +1103,7 @@ void SendToPrinterDialog::on_selection_changed(wxCommandEvent &event)
|
|||
dev->set_selected_machine(m_printer_last_select, true);
|
||||
if (m_file_sys) m_file_sys.reset();
|
||||
}else if (dev->get_selected_machine()->dev_id != m_printer_last_select) {
|
||||
m_ability_list.clear();
|
||||
update_storage_list(std::vector<std::string>());
|
||||
dev->set_selected_machine(m_printer_last_select, true);
|
||||
if (m_file_sys) m_file_sys.reset();
|
||||
|
@ -1475,12 +1483,18 @@ void SendToPrinterDialog::Enable_Send_Button(bool en)
|
|||
m_button_ensure->SetBackgroundColor(wxColour(0x90, 0x90, 0x90));
|
||||
m_button_ensure->SetBorderColor(wxColour(0x90, 0x90, 0x90));
|
||||
}
|
||||
if (!m_storage_radioBox.empty()) {
|
||||
update_storage_list(std::vector<std::string>());
|
||||
}
|
||||
} else {
|
||||
if (!m_button_ensure->IsEnabled()) {
|
||||
m_button_ensure->Enable();
|
||||
m_button_ensure->SetBackgroundColor(btn_bg_enable);
|
||||
m_button_ensure->SetBorderColor(btn_bg_enable);
|
||||
}
|
||||
if (!m_ability_list.empty()) {
|
||||
update_storage_list(m_ability_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1611,6 +1625,7 @@ bool SendToPrinterDialog::Show(bool show)
|
|||
|
||||
// set default value when show this dialog
|
||||
if (show) {
|
||||
m_ability_list.clear();
|
||||
update_storage_list(std::vector<std::string>());
|
||||
wxGetApp().reset_to_active();
|
||||
set_default();
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
void show_print_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
|
||||
void update_print_error_info(int code, std::string msg, std::string extra);
|
||||
void on_change_color_mode() { wxGetApp().UpdateDlgDarkUI(this); }
|
||||
void update_storage_list(std::vector<std::string> storages);
|
||||
void update_storage_list(const std::vector<std::string>& storages);
|
||||
std::string get_storage_selected();
|
||||
|
||||
wxString format_text(wxString& m_msg);
|
||||
|
|
Loading…
Reference in New Issue