Moved the "Flash firmware" menu to "Configuration",

removed the "Check for updates" from the "Configuration" menu,
added an "Open file explorer at the datadir" item to the Help menu.
This commit is contained in:
bubnikv 2018-05-21 21:04:03 +02:00
parent 2fab254ff6
commit 7b4aeef40c
4 changed files with 33 additions and 33 deletions

View File

@ -334,6 +334,9 @@ sub _init_menubar {
$self->_append_menu_item($helpMenu, L("System Info"), L('Show system information'), sub {
wxTheApp->system_info;
});
$self->_append_menu_item($helpMenu, L("Show &Configuration Folder"), L('Show user configuration folder (datadir)'), sub {
Slic3r::GUI::desktop_open_datadir_folder();
});
$self->_append_menu_item($helpMenu, L("Report an Issue"), L('Report an issue on the Slic3r Prusa Edition'), sub {
Wx::LaunchDefaultBrowser('http://github.com/prusa3d/slic3r/issues/new');
});

View File

@ -305,6 +305,7 @@ enum ConfigMenuIDs {
ConfigMenuUpdate,
ConfigMenuPreferences,
ConfigMenuLanguage,
ConfigMenuFlashFirmware,
ConfigMenuCnt,
};
@ -318,11 +319,15 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
local_menu->Append(config_id_base + ConfigMenuWizard, ConfigWizard::name() + "\u2026", config_wizard_tooltip);
local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("Configuration Snapshots"))+"\u2026", _(L("Inspect / activate configuration snapshots")));
local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _(L("Take Configuration Snapshot")), _(L("Capture a configuration snapshot")));
local_menu->Append(config_id_base + ConfigMenuUpdate, _(L("Check for updates")), _(L("Check for configuration updates")));
// local_menu->Append(config_id_base + ConfigMenuUpdate, _(L("Check for updates")), _(L("Check for configuration updates")));
local_menu->AppendSeparator();
local_menu->Append(config_id_base + ConfigMenuPreferences, _(L("Preferences"))+"\u2026\tCtrl+,", _(L("Application preferences")));
local_menu->AppendSeparator();
local_menu->Append(config_id_base + ConfigMenuLanguage, _(L("Change Application Language")));
local_menu->AppendSeparator();
local_menu->Append(config_id_base + ConfigMenuFlashFirmware, _(L("Flash printer firmware")), _(L("Upload a firmware image into an Arduino based printer")));
// TODO: for when we're able to flash dictionaries
// local_menu->Append(config_id_base + FirmwareMenuDict, _(L("Flash language file")), _(L("Upload a language dictionary file into a Prusa printer")));
local_menu->Bind(wxEVT_MENU, [config_id_base, event_language_change, event_preferences_changed](wxEvent &event){
switch (event.GetId() - config_id_base) {
case ConfigMenuWizard:
@ -377,47 +382,20 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
}
}
break;
}
}
});
menu->Append(local_menu, _(L("&Configuration")));
}
enum FirmwareMenuIDs {
FirmwareMenuFlash,
FirmwareMenuDict,
FirmwareMenuCnt,
};
void add_firmware_menu(wxMenuBar *top_menu)
{
auto *menu = new wxMenu();
wxWindowID id_base = wxWindow::NewControlId(FirmwareMenuCnt);
menu->Append(id_base + FirmwareMenuFlash, _(L("Flash printer firmware")), _(L("Upload a firmware image into a Prusa printer")));
// TODO: for when we're able to flash dictionaries
// menu->Append(id_base + FirmwareMenuDict, _(L("Flash language file")), _(L("Upload a language dictionary file into a Prusa printer")));
menu->Bind(wxEVT_MENU, [id_base](wxEvent &event) {
switch (event.GetId() - id_base) {
case FirmwareMenuFlash:
case ConfigMenuFlashFirmware:
FirmwareDialog::run(g_wxMainFrame);
break;
case FirmwareMenuDict:
// TODO
break;
default:
break;
}
});
top_menu->Append(menu, _(L("Fir&mware")));
menu->Append(local_menu, _(L("&Configuration")));
}
void add_menus(wxMenuBar *menu, int event_preferences_changed, int event_language_change)
{
add_config_menu(menu, event_language_change, event_language_change);
add_firmware_menu(menu);
}
// This is called when closing the application, when loading a config file or when starting the config wizard
@ -951,4 +929,19 @@ void about()
dlg.Destroy();
}
void desktop_open_datadir_folder()
{
std::string cmd =
#ifdef _WIN32
"explorer "
#elif __APPLE__
"open "
#else
"xdg-open "
#endif
;
cmd += data_dir();
::wxExecute(wxString::FromUTF8(cmd.c_str()), wxEXEC_ASYNC, nullptr);
}
} }

View File

@ -158,7 +158,9 @@ void add_export_option(wxFileDialog* dlg, const std::string& format);
int get_export_option(wxFileDialog* dlg);
// Display an About dialog
void about();
extern void about();
// Ask the destop to open the datadir using the default file explorer.
extern void desktop_open_datadir_folder();
} // namespace GUI
} // namespace Slic3r

View File

@ -95,4 +95,6 @@ void add_export_option(SV *ui, std::string format)
int get_export_option(SV *ui)
%code%{ RETVAL = Slic3r::GUI::get_export_option((wxFileDialog*)wxPli_sv_2_object(aTHX_ ui, "Wx::FileDialog")); %};
void desktop_open_datadir_folder()
%code%{ Slic3r::GUI::desktop_open_datadir_folder(); %};