ENH: refine model uploading logics

1. change the url of product env to makerworld
2. always show the uploading button without checking permission

Signed-off-by: yifan.wu <yifan.wu@bambulab.com>
Change-Id: I666042a216d1a4aca69e2a50d430532f722d9b00
(cherry picked from commit 94daddc0aa593778fbf4a9d44d92a68883292a7f)
This commit is contained in:
yifan.wu 2023-04-18 20:40:27 +08:00 committed by Lane.Wei
parent 693af0c98f
commit bd2df4801a
5 changed files with 5 additions and 58 deletions

View File

@ -254,7 +254,7 @@ void BBLTopbar::Init(wxFrame* parent)
m_publish_item = this->AddTool(ID_PUBLISH, "", m_publish_bitmap);
m_publish_disable_bitmap = create_scaled_bitmap("topbar_publish_disable", nullptr, TOPBAR_ICON_SIZE);
m_publish_item->SetDisabledBitmap(m_publish_disable_bitmap);
this->EnableTool(m_publish_item->GetId(), false);
this->EnableTool(m_publish_item->GetId(), true);
this->AddSpacer(FromDIP(4));
/*wxBitmap model_store_bitmap = create_scaled_bitmap("topbar_store", nullptr, TOPBAR_ICON_SIZE);
@ -317,12 +317,6 @@ BBLTopbar::~BBLTopbar()
m_file_menu = nullptr;
}
void BBLTopbar::show_publish_button(bool show)
{
this->EnableTool(m_publish_item->GetId(), show);
Refresh();
}
void BBLTopbar::OnOpenProject(wxAuiToolBarEvent& event)
{
MainFrame* main_frame = dynamic_cast<MainFrame*>(m_frame);

View File

@ -16,7 +16,6 @@ public:
BBLTopbar(wxFrame* parent);
void Init(wxFrame *parent);
~BBLTopbar();
void show_publish_button(bool show);
void UpdateToolbarWidth(int width);
void Rescale();
void OnIconize(wxAuiToolBarEvent& event);

View File

@ -1383,10 +1383,10 @@ std::string GUI_App::get_model_http_url(std::string country_code)
{
std::string url;
if (country_code == "US") {
url = "https://makerhub.bambu-lab.com/";
url = "https://makerworld.com/";
}
else if (country_code == "CN") {
url = "https://makerhub.bambu-lab.com/zh/";
url = "https://makerworld.com/";
}
else if (country_code == "ENV_CN_DEV") {
url = "https://makerhub-dev.bambu-lab.com/";
@ -3279,21 +3279,6 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
// config_wizard_startup(true);
// });
//show publish button
if (m_agent && m_agent->is_user_login() && mainframe) {
int identifier;
int result = m_agent->get_user_info(&identifier);
auto publish_identifier = identifier & 1;
#ifdef __WINDOWS__
if (result == 0 && publish_identifier >= 0) {
mainframe->m_topbar->show_publish_button(publish_identifier == 0 ? false : true);
}
#else
mainframe->show_publish_button(publish_identifier == 0 ? false : true);
#endif
}
m_is_recreating_gui = false;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "recreate_GUI exit";
@ -3621,12 +3606,6 @@ void GUI_App::request_user_logout()
m_device_manager->clean_user_info();
GUI::wxGetApp().sidebar().load_ams_list({}, {});
GUI::wxGetApp().stop_sync_user_preset();
#ifdef __WINDOWS__
wxGetApp().mainframe->topbar()->show_publish_button(false);
#else
wxGetApp().mainframe->show_publish_button(false);
#endif
}
}
@ -3971,20 +3950,6 @@ void GUI_App::on_user_login_handle(wxCommandEvent &evt)
} else {
enable_user_preset_folder(false);
}
//show publish button
if (m_agent->is_user_login() && mainframe) {
int identifier;
int result = m_agent->get_user_info(&identifier);
auto publish_identifier = identifier & 1;
#ifdef __WINDOWS__
if (result == 0 && publish_identifier >= 0) {
mainframe->m_topbar->show_publish_button(publish_identifier == 0 ? false : true);
}
#else
mainframe->show_publish_button(publish_identifier == 0 ? false : true);
#endif
}
}
void GUI_App::check_track_enable()
@ -5729,6 +5694,7 @@ void GUI_App::open_publish_page_dialog()
wxString language_code = this->current_language_code().BeforeFirst('_');
model_url += (language_code.ToStdString() + "/my/models/publish");
#if 0
if (getAgent() && mainframe) {
//login already
@ -5741,6 +5707,7 @@ void GUI_App::open_publish_page_dialog()
}
}
}
#endif
if (result < 0) {
link_url = host_url + model_url;

View File

@ -2573,18 +2573,6 @@ void MainFrame::init_menubar_as_editor()
#endif // __APPLE__
}
void MainFrame::show_publish_button(bool show)
{
if (!m_menubar) return;
if (show){
m_menubar->Insert(4, publishMenu, wxString::Format("&%s", _L("3D Models")));
}
else {
m_menubar->Remove(4);
}
}
void MainFrame::set_max_recent_count(int max)
{
max = max < 0 ? 0 : max > 10000 ? 10000 : max;

View File

@ -244,7 +244,6 @@ public:
BBLTopbar* topbar() { return m_topbar; }
void update_title();
void show_publish_button(bool show);
void set_max_recent_count(int max);
void update_title_colour_after_set_title();