mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-03 13:30:37 -07:00
NEW:Support direct connection to LAN printers
jira:[connect printer] Change-Id: Ifdc25651f4effde8e2a2d2a4e690aa20e0ef7022 (cherry picked from commit 0ec49c3588c1f81c159193de352f8a47d39ffe74)
This commit is contained in:
parent
5c11aed655
commit
9ab3107304
9 changed files with 181 additions and 103 deletions
|
|
@ -400,11 +400,13 @@ SelectMachinePopup::SelectMachinePopup(wxWindow *parent)
|
|||
m_sizer_other_devices = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
|
||||
m_panel_ping_code = new PinCodePanel(m_scrolledWindow, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_ITEM_SIZE);
|
||||
m_panel_ping_code = new PinCodePanel(m_scrolledWindow, 0, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_ITEM_SIZE);
|
||||
m_panel_direct_connection = new PinCodePanel(m_scrolledWindow, 1, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_ITEM_SIZE);
|
||||
|
||||
m_sizxer_scrolledWindow->Add(own_title, 0, wxEXPAND | wxLEFT, FromDIP(15));
|
||||
m_sizxer_scrolledWindow->Add(m_sizer_my_devices, 0, wxEXPAND, 0);
|
||||
m_sizxer_scrolledWindow->Add(m_panel_ping_code, 0, wxEXPAND, 0);
|
||||
m_sizxer_scrolledWindow->Add(m_panel_direct_connection, 0, wxEXPAND, 0);
|
||||
m_sizxer_scrolledWindow->Add(other_title, 0, wxEXPAND | wxLEFT, FromDIP(15));
|
||||
m_sizxer_scrolledWindow->Add(m_sizer_other_devices, 0, wxEXPAND, 0);
|
||||
|
||||
|
|
@ -879,14 +881,16 @@ void SelectMachinePopup::OnLeftUp(wxMouseEvent &event)
|
|||
//pin code
|
||||
auto pc_rect = m_panel_ping_code->ClientToScreen(wxPoint(0, 0));
|
||||
if (mouse_pos.x > pc_rect.x && mouse_pos.y > pc_rect.y && mouse_pos.x < (pc_rect.x + m_panel_ping_code->GetSize().x) && mouse_pos.y < (pc_rect.y + m_panel_ping_code->GetSize().y)) {
|
||||
/*wxMouseEvent event(wxEVT_LEFT_UP);
|
||||
auto tag_pos = m_panel_ping_code->ScreenToClient(mouse_pos);
|
||||
event.SetPosition(tag_pos);
|
||||
event.SetEventObject(m_panel_ping_code);
|
||||
wxPostEvent(m_panel_ping_code, event);*/
|
||||
wxGetApp().popup_ping_bind_dialog();
|
||||
}
|
||||
|
||||
//bind with access code
|
||||
auto dc_rect = m_panel_direct_connection->ClientToScreen(wxPoint(0, 0));
|
||||
if (mouse_pos.x > dc_rect.x && mouse_pos.y > dc_rect.y && mouse_pos.x < (dc_rect.x + m_panel_direct_connection->GetSize().x) && mouse_pos.y < (dc_rect.y + m_panel_direct_connection->GetSize().y)) {
|
||||
InputIpAddressDialog dlgo;
|
||||
dlgo.ShowModal();
|
||||
}
|
||||
|
||||
//hyper link
|
||||
auto h_rect = m_hyperlink->ClientToScreen(wxPoint(0, 0));
|
||||
if (mouse_pos.x > h_rect.x && mouse_pos.y > h_rect.y && mouse_pos.x < (h_rect.x + m_hyperlink->GetSize().x) && mouse_pos.y < (h_rect.y + m_hyperlink->GetSize().y)) {
|
||||
|
|
@ -1450,30 +1454,6 @@ void SelectMachineDialog::init_bind()
|
|||
m_comboBox_printer->SetValue(obj->dev_name + "(LAN)");
|
||||
}
|
||||
}
|
||||
/*else if (e.GetInt() == 1 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
||||
on_send_print();
|
||||
}
|
||||
else if (e.GetInt() == -2 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
||||
show_status(PrintDialogStatus::PrintStatusInit);
|
||||
prepare_mode();
|
||||
MessageDialog msg_wingow(nullptr, _L("Printer local connection failed, please try again."), "", wxAPPLY | wxOK);
|
||||
msg_wingow.ShowModal();
|
||||
}
|
||||
else if (e.GetInt() == 5 && (m_print_type == PrintFromType::FROM_SDCARD_VIEW)) {
|
||||
show_status(PrintDialogStatus::PrintStatusInit);
|
||||
prepare_mode();
|
||||
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
ConnectPrinterDialog dlg(wxGetApp().mainframe, wxID_ANY, _L("Input access code"));
|
||||
dlg.go_connect_printer(false);
|
||||
if (dev->get_selected_machine()) {
|
||||
dlg.set_machine_object(dev->get_selected_machine());
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
this->connect_printer_mqtt();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
});
|
||||
|
||||
m_bitmap_last_plate->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||
|
|
@ -4854,7 +4834,7 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
|
|||
|
||||
ThumbnailPanel::~ThumbnailPanel() {}
|
||||
|
||||
PinCodePanel::PinCodePanel(wxWindow* parent, wxWindowID winid /*= wxID_ANY*/, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/)
|
||||
PinCodePanel::PinCodePanel(wxWindow* parent, int type, wxWindowID winid /*= wxID_ANY*/, const wxPoint& pos /*= wxDefaultPosition*/, const wxSize& size /*= wxDefaultSize*/)
|
||||
{
|
||||
wxPanel::Create(parent, winid, pos, SELECT_MACHINE_ITEM_SIZE);
|
||||
Bind(wxEVT_PAINT, &PinCodePanel::OnPaint, this);
|
||||
|
|
@ -4862,6 +4842,7 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
|
|||
SetMaxSize(SELECT_MACHINE_ITEM_SIZE);
|
||||
SetMinSize(SELECT_MACHINE_ITEM_SIZE);
|
||||
|
||||
m_type = type;
|
||||
m_bitmap = ScalableBitmap(this, "bind_device_ping_code",10);
|
||||
|
||||
this->Bind(wxEVT_ENTER_WINDOW, &PinCodePanel::on_mouse_enter, this);
|
||||
|
|
@ -4899,12 +4880,15 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
|
|||
void PinCodePanel::doRender(wxDC& dc)
|
||||
{
|
||||
auto size = GetSize();
|
||||
dc.DrawBitmap(m_bitmap.bmp(), wxPoint(FromDIP(20), (size.y - m_bitmap.GetBmpSize().y) / 2));
|
||||
dc.DrawBitmap(m_bitmap.bmp(), wxPoint(FromDIP(12), (size.y - m_bitmap.GetBmpSize().y) / 2));
|
||||
dc.SetFont(::Label::Head_13);
|
||||
dc.SetTextForeground(StateColor::darkModeColorFor(wxColour("#262E30"))); // ORCA fix text not visible on dark theme
|
||||
wxString txt = _L("Bind with Pin Code");
|
||||
wxString txt;
|
||||
if (m_type == 0) { txt = _L("Bind with Pin Code"); }
|
||||
else if (m_type == 1) { txt = _L("Bind with Access Code"); }
|
||||
|
||||
auto txt_size = dc.GetTextExtent(txt);
|
||||
dc.DrawText(txt, wxPoint(FromDIP(40), (size.y - txt_size.y) / 2));
|
||||
dc.DrawText(txt, wxPoint(FromDIP(28), (size.y - txt_size.y) / 2));
|
||||
|
||||
if (m_hover) {
|
||||
dc.SetPen(SELECT_MACHINE_BRAND);
|
||||
|
|
@ -4927,7 +4911,13 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
|
|||
|
||||
void PinCodePanel::on_mouse_left_up(wxMouseEvent& evt)
|
||||
{
|
||||
wxGetApp().popup_ping_bind_dialog();
|
||||
if (m_type == 0) {
|
||||
wxGetApp().popup_ping_bind_dialog();
|
||||
}
|
||||
else if (m_type == 1) {
|
||||
InputIpAddressDialog dlgo;
|
||||
dlgo.ShowModal();
|
||||
}
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue