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}->save;
|
||||
|
||||
# my $version_check = $self->{app_config}->get('version_check');
|
||||
$self->{preset_updater} = Slic3r::PresetUpdater->new($VERSION_ONLINE_EVENT);
|
||||
Slic3r::GUI::set_preset_updater($self->{preset_updater});
|
||||
eval {
|
||||
$self->{preset_updater}->slic3r_update_notify();
|
||||
$self->{preset_updater}->config_update();
|
||||
};
|
||||
eval { $self->{preset_updater}->config_update(); };
|
||||
if ($@) {
|
||||
warn $@ . "\n";
|
||||
fatal_error(undef, $@);
|
||||
}
|
||||
# my $slic3r_update = $self->{app_config}->slic3r_update_avail;
|
||||
|
||||
Slic3r::GUI::load_language();
|
||||
|
||||
@ -139,7 +134,6 @@ sub OnInit {
|
||||
);
|
||||
$self->SetTopWindow($frame);
|
||||
|
||||
#EVT_IDLE($frame, sub {
|
||||
EVT_IDLE($self->{mainframe}, sub {
|
||||
while (my $cb = shift @cb) {
|
||||
$cb->();
|
||||
@ -151,8 +145,7 @@ sub OnInit {
|
||||
# before the UI was up and running.
|
||||
$self->CallAfter(sub {
|
||||
Slic3r::GUI::config_wizard_startup($app_conf_exists);
|
||||
|
||||
# TODO: call periodically?
|
||||
$self->{preset_updater}->slic3r_update_notify();
|
||||
$self->{preset_updater}->sync($self->{preset_bundle});
|
||||
});
|
||||
|
||||
|
@ -86,7 +86,7 @@ struct UpdateNotification : wxDialog
|
||||
sizer->Add(link);
|
||||
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->AddSpacer(SPACING);
|
||||
|
||||
@ -136,6 +136,7 @@ struct PresetUpdater::priv
|
||||
bool enabled_version_check;
|
||||
bool enabled_config_update;
|
||||
std::string version_check_url;
|
||||
bool had_config_update;
|
||||
|
||||
fs::path cache_path;
|
||||
fs::path rsrc_path;
|
||||
@ -159,6 +160,7 @@ struct PresetUpdater::priv
|
||||
|
||||
PresetUpdater::priv::priv(int version_online_event) :
|
||||
version_online_event(version_online_event),
|
||||
had_config_update(false),
|
||||
cache_path(fs::path(Slic3r::data_dir()) / "cache"),
|
||||
rsrc_path(fs::path(resources_dir()) / "profiles"),
|
||||
vendor_path(fs::path(Slic3r::data_dir()) / "vendor"),
|
||||
@ -401,7 +403,8 @@ void PresetUpdater::sync(PresetBundle *preset_bundle)
|
||||
|
||||
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();
|
||||
const auto ver_slic3r = Semver::parse(SLIC3R_VERSION);
|
||||
@ -450,6 +453,8 @@ void PresetUpdater::config_update() const
|
||||
// User gave clearance, updates are go
|
||||
p->perform_updates(std::move(updates));
|
||||
}
|
||||
|
||||
p->had_config_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user