mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 11:53:48 +00:00
ENH: update print button enable status
Change-Id: Ieb4a74a336ef9f4a552b104df88d4e73967b8a5d
This commit is contained in:
@@ -1357,7 +1357,6 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||||||
export_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
export_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
||||||
m_print_btn->SetLabel(_L("Export G-code file"));
|
m_print_btn->SetLabel(_L("Export G-code file"));
|
||||||
m_print_select = eExportGcode;
|
m_print_select = eExportGcode;
|
||||||
if (m_print_enable)
|
|
||||||
m_print_enable = get_enable_print_status();
|
m_print_enable = get_enable_print_status();
|
||||||
m_print_btn->Enable(m_print_enable);
|
m_print_btn->Enable(m_print_enable);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
@@ -1370,8 +1369,7 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||||||
send_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
send_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
||||||
m_print_btn->SetLabel(_L("Send and Print"));
|
m_print_btn->SetLabel(_L("Send and Print"));
|
||||||
m_print_select = eSendGcode;
|
m_print_select = eSendGcode;
|
||||||
if (m_print_enable)
|
m_print_enable = get_enable_print_status();
|
||||||
m_print_enable = get_enable_print_status() && can_send_gcode();
|
|
||||||
m_print_btn->Enable(m_print_enable);
|
m_print_btn->Enable(m_print_enable);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
p->Dismiss();
|
p->Dismiss();
|
||||||
@@ -1383,8 +1381,7 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||||||
upload_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
upload_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
||||||
m_print_btn->SetLabel(_L("Send"));
|
m_print_btn->SetLabel(_L("Send"));
|
||||||
m_print_select = eUploadGcode;
|
m_print_select = eUploadGcode;
|
||||||
if (m_print_enable)
|
m_print_enable = get_enable_print_status();
|
||||||
m_print_enable = get_enable_print_status() && can_send_gcode();
|
|
||||||
m_print_btn->Enable(m_print_enable);
|
m_print_btn->Enable(m_print_enable);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
p->Dismiss();
|
p->Dismiss();
|
||||||
@@ -1416,7 +1413,6 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||||||
send_to_printer_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
send_to_printer_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
||||||
m_print_btn->SetLabel(_L("Send"));
|
m_print_btn->SetLabel(_L("Send"));
|
||||||
m_print_select = eSendToPrinter;
|
m_print_select = eSendToPrinter;
|
||||||
if (m_print_enable)
|
|
||||||
m_print_enable = get_enable_print_status();
|
m_print_enable = get_enable_print_status();
|
||||||
m_print_btn->Enable(m_print_enable);
|
m_print_btn->Enable(m_print_enable);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
@@ -1426,7 +1422,6 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||||||
export_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
export_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
|
||||||
m_print_btn->SetLabel(_L("Export Sliced File"));
|
m_print_btn->SetLabel(_L("Export Sliced File"));
|
||||||
m_print_select = eExportSlicedFile;
|
m_print_select = eExportSlicedFile;
|
||||||
if (m_print_enable)
|
|
||||||
m_print_enable = get_enable_print_status();
|
m_print_enable = get_enable_print_status();
|
||||||
m_print_btn->Enable(m_print_enable);
|
m_print_btn->Enable(m_print_enable);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
@@ -1522,6 +1517,20 @@ bool MainFrame::get_enable_print_status()
|
|||||||
enable = false;
|
enable = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (m_print_select == eSendGcode)
|
||||||
|
{
|
||||||
|
if (!current_plate->is_slice_result_valid())
|
||||||
|
enable = false;
|
||||||
|
if (!can_send_gcode())
|
||||||
|
enable = false;
|
||||||
|
}
|
||||||
|
else if (m_print_select == eUploadGcode)
|
||||||
|
{
|
||||||
|
if (!current_plate->is_slice_result_valid())
|
||||||
|
enable = false;
|
||||||
|
if (!can_send_gcode())
|
||||||
|
enable = false;
|
||||||
|
}
|
||||||
else if (m_print_select == eExportSlicedFile)
|
else if (m_print_select == eExportSlicedFile)
|
||||||
{
|
{
|
||||||
if (!current_plate->is_slice_result_ready_for_print())
|
if (!current_plate->is_slice_result_ready_for_print())
|
||||||
@@ -2698,7 +2707,7 @@ void MainFrame::set_print_button_to_default(PrintSelectType select_type)
|
|||||||
m_print_btn->SetLabel(_L("Send and Print"));
|
m_print_btn->SetLabel(_L("Send and Print"));
|
||||||
m_print_select = eSendGcode;
|
m_print_select = eSendGcode;
|
||||||
if (m_print_enable)
|
if (m_print_enable)
|
||||||
m_print_enable = get_enable_print_status() && can_send_gcode();
|
m_print_enable = get_enable_print_status();
|
||||||
m_print_btn->Enable(m_print_enable);
|
m_print_btn->Enable(m_print_enable);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user