Display app update notification with the main frame
This commit is contained in:
parent
df03b8e4e8
commit
c884f3b213
@ -102,18 +102,13 @@ sub OnInit {
|
|||||||
$self->{app_config}->set('version', $Slic3r::VERSION);
|
$self->{app_config}->set('version', $Slic3r::VERSION);
|
||||||
$self->{app_config}->save;
|
$self->{app_config}->save;
|
||||||
|
|
||||||
# my $version_check = $self->{app_config}->get('version_check');
|
|
||||||
$self->{preset_updater} = Slic3r::PresetUpdater->new($VERSION_ONLINE_EVENT);
|
$self->{preset_updater} = Slic3r::PresetUpdater->new($VERSION_ONLINE_EVENT);
|
||||||
Slic3r::GUI::set_preset_updater($self->{preset_updater});
|
Slic3r::GUI::set_preset_updater($self->{preset_updater});
|
||||||
eval {
|
eval { $self->{preset_updater}->config_update(); };
|
||||||
$self->{preset_updater}->slic3r_update_notify();
|
|
||||||
$self->{preset_updater}->config_update();
|
|
||||||
};
|
|
||||||
if ($@) {
|
if ($@) {
|
||||||
warn $@ . "\n";
|
warn $@ . "\n";
|
||||||
fatal_error(undef, $@);
|
fatal_error(undef, $@);
|
||||||
}
|
}
|
||||||
# my $slic3r_update = $self->{app_config}->slic3r_update_avail;
|
|
||||||
|
|
||||||
Slic3r::GUI::load_language();
|
Slic3r::GUI::load_language();
|
||||||
|
|
||||||
@ -139,7 +134,6 @@ sub OnInit {
|
|||||||
);
|
);
|
||||||
$self->SetTopWindow($frame);
|
$self->SetTopWindow($frame);
|
||||||
|
|
||||||
#EVT_IDLE($frame, sub {
|
|
||||||
EVT_IDLE($self->{mainframe}, sub {
|
EVT_IDLE($self->{mainframe}, sub {
|
||||||
while (my $cb = shift @cb) {
|
while (my $cb = shift @cb) {
|
||||||
$cb->();
|
$cb->();
|
||||||
@ -151,8 +145,7 @@ sub OnInit {
|
|||||||
# before the UI was up and running.
|
# before the UI was up and running.
|
||||||
$self->CallAfter(sub {
|
$self->CallAfter(sub {
|
||||||
Slic3r::GUI::config_wizard_startup($app_conf_exists);
|
Slic3r::GUI::config_wizard_startup($app_conf_exists);
|
||||||
|
$self->{preset_updater}->slic3r_update_notify();
|
||||||
# TODO: call periodically?
|
|
||||||
$self->{preset_updater}->sync($self->{preset_bundle});
|
$self->{preset_updater}->sync($self->{preset_bundle});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ struct UpdateNotification : wxDialog
|
|||||||
sizer->Add(link);
|
sizer->Add(link);
|
||||||
sizer->AddSpacer(2*SPACING);
|
sizer->AddSpacer(2*SPACING);
|
||||||
|
|
||||||
cbox = new wxCheckBox(this, wxID_ANY, _(L("Don't notify about new versions any more")));
|
cbox = new wxCheckBox(this, wxID_ANY, _(L("Don't notify about new releases any more")));
|
||||||
sizer->Add(cbox);
|
sizer->Add(cbox);
|
||||||
sizer->AddSpacer(SPACING);
|
sizer->AddSpacer(SPACING);
|
||||||
|
|
||||||
@ -136,6 +136,7 @@ struct PresetUpdater::priv
|
|||||||
bool enabled_version_check;
|
bool enabled_version_check;
|
||||||
bool enabled_config_update;
|
bool enabled_config_update;
|
||||||
std::string version_check_url;
|
std::string version_check_url;
|
||||||
|
bool had_config_update;
|
||||||
|
|
||||||
fs::path cache_path;
|
fs::path cache_path;
|
||||||
fs::path rsrc_path;
|
fs::path rsrc_path;
|
||||||
@ -159,6 +160,7 @@ struct PresetUpdater::priv
|
|||||||
|
|
||||||
PresetUpdater::priv::priv(int version_online_event) :
|
PresetUpdater::priv::priv(int version_online_event) :
|
||||||
version_online_event(version_online_event),
|
version_online_event(version_online_event),
|
||||||
|
had_config_update(false),
|
||||||
cache_path(fs::path(Slic3r::data_dir()) / "cache"),
|
cache_path(fs::path(Slic3r::data_dir()) / "cache"),
|
||||||
rsrc_path(fs::path(resources_dir()) / "profiles"),
|
rsrc_path(fs::path(resources_dir()) / "profiles"),
|
||||||
vendor_path(fs::path(Slic3r::data_dir()) / "vendor"),
|
vendor_path(fs::path(Slic3r::data_dir()) / "vendor"),
|
||||||
@ -401,7 +403,8 @@ void PresetUpdater::sync(PresetBundle *preset_bundle)
|
|||||||
|
|
||||||
void PresetUpdater::slic3r_update_notify()
|
void PresetUpdater::slic3r_update_notify()
|
||||||
{
|
{
|
||||||
if (! p->enabled_version_check) { return; }
|
if (! p->enabled_version_check || p->had_config_update) { return; }
|
||||||
|
// ^ We don't want to bother the user with updates multiple times, put off till next time.
|
||||||
|
|
||||||
auto* app_config = GUI::get_app_config();
|
auto* app_config = GUI::get_app_config();
|
||||||
const auto ver_slic3r = Semver::parse(SLIC3R_VERSION);
|
const auto ver_slic3r = Semver::parse(SLIC3R_VERSION);
|
||||||
@ -450,6 +453,8 @@ void PresetUpdater::config_update() const
|
|||||||
// User gave clearance, updates are go
|
// User gave clearance, updates are go
|
||||||
p->perform_updates(std::move(updates));
|
p->perform_updates(std::move(updates));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->had_config_update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user