Skip to content

Commit

Permalink
WifiConfigDialog: Fixed a style for comboboxes
Browse files Browse the repository at this point in the history
+ OSX specific: Fixed layout of Password related controls

Widgets/ComboBox: Fixed DoClear(): Clear function is called for TextCtrl too
  • Loading branch information
YuSanka committed Nov 3, 2023
1 parent 2352c15 commit abd99bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/slic3r/GUI/Widgets/ComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ void ComboBox::DoClear()
datas.clear();
types.clear();
drop.Invalidate(true);
if (GetTextCtrl()->IsShown() || text_off)
GetTextCtrl()->Clear();
}

void ComboBox::DoDeleteOneItem(unsigned int pos)
Expand Down
10 changes: 5 additions & 5 deletions src/slic3r/GUI/WifiConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem
auto* ssid_sizer = new wxBoxSizer(wxHORIZONTAL);
// TRN SSID of WiFi network. It is a standard abbreviation which should probably not change in most languages.
wxStaticText* ssid_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("SSID")));
m_ssid_combo = new ::ComboBox(panel, wxID_ANY);
m_ssid_combo = new ::ComboBox(panel, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, DD_NO_CHECK_ICON);
#if __APPLE__
m_ssid_combo->SetToolTip(_L("On some versions of MacOS, this only loads SSID of connected network."));
#endif // __APPLE__
Expand All @@ -60,21 +60,23 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem
// TRN Password of WiFi network.
wxStaticText* password_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("Password")));
m_pass_textctrl = new ::TextInput(panel, "", "", "", wxDefaultPosition, wxDefaultSize);
pass_sizer->Add(m_pass_textctrl, 1, wxALIGN_CENTER_VERTICAL, 10);
#if __APPLE__
pass_sizer->Add(m_pass_textctrl, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, 10);
m_pass_button_id = NewControlId();
// TRN Text of button to retrieve password from keychain in Wifi Config dialog. Only on Mac.
wxButton* pass_button = new wxButton(panel, m_pass_button_id, _(L("Retrieve")));
pass_sizer->Add(pass_button, 0);
pass_button->Bind(wxEVT_BUTTON, &WifiConfigDialog::on_retrieve_password, this);
#else
pass_sizer->Add(m_pass_textctrl, 1, wxALIGN_CENTER_VERTICAL, 10);
#endif // __APPLE__
// show password if current ssid was selected already
fill_password();

auto* drive_sizer = new wxBoxSizer(wxHORIZONTAL);
// TRN description of Combo Box with path to USB drive.
wxStaticText* drive_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("Drive")));
m_drive_combo = new ::ComboBox(panel, wxID_ANY);
m_drive_combo = new ::ComboBox(panel, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, DD_NO_CHECK_ICON);
rescan_drives(preffered_drive);
m_drive_button_id = NewControlId();
// TRN Text of button to rescan connect usb drives in Wifi Config dialog.
Expand Down Expand Up @@ -166,7 +168,6 @@ void WifiConfigDialog::rescan_drives(const wxString& preffered_drive)
{
assert(m_drive_combo && m_removable_manager);
m_drive_combo->Clear();
m_drive_combo->GetTextCtrl()->Clear();
std::vector<DriveData> ddata = m_removable_manager->get_drive_list();
for (const auto& data : ddata) {
wxString item = boost::nowide::widen(data.path);
Expand All @@ -191,7 +192,6 @@ void WifiConfigDialog::rescan_networks(bool select)
std::string current = m_wifi_scanner->get_current_ssid();
const auto& map = m_wifi_scanner->get_map();
m_ssid_combo->Clear();
m_ssid_combo->GetTextCtrl()->Clear();
for (const auto pair : map) {
m_ssid_combo->Append(pair.first);
// select ssid of current network (if connected)
Expand Down

0 comments on commit abd99bb

Please sign in to comment.