Add Open Python directory to menus.
Fixes https://gitlab.com/kicad/code/kicad/issues/5115
This commit is contained in:
parent
3b280e4886
commit
c992570427
|
@ -741,7 +741,7 @@ void TREE_PROJECT_FRAME::OnRight( wxTreeEvent& Event )
|
|||
}
|
||||
|
||||
AddMenuItem( &popup_menu, ID_PROJECT_OPEN_DIR, text, help_text,
|
||||
KiBitmap( directory_browser_xpm ) );
|
||||
KiBitmap( directory_browser_xpm ) );
|
||||
}
|
||||
|
||||
if( can_edit )
|
||||
|
|
|
@ -502,6 +502,15 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
submenuActionPlugins->Add( _( "Refresh Plugins" ),
|
||||
_( "Reload all python plugins and refresh plugin menus" ),
|
||||
ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, reload_xpm );
|
||||
#ifdef __APPLE__
|
||||
submenuActionPlugins->Add( _( "Reveal Plugin Folder in Finder" ),
|
||||
_( "Reveals the plugins folder in a Finder window" ),
|
||||
ID_TOOLBARH_PCB_ACTION_PLUGIN_SHOW_FOLDER, folder_xpm );
|
||||
#else
|
||||
submenuActionPlugins->Add( _( "Open Plugin Directory" ),
|
||||
_( "Opens the directory in the default system file manager" ),
|
||||
ID_TOOLBARH_PCB_ACTION_PLUGIN_SHOW_FOLDER, folder_xpm );
|
||||
#endif
|
||||
submenuActionPlugins->AppendSeparator();
|
||||
|
||||
toolsMenu->AddSeparator();
|
||||
|
|
|
@ -145,6 +145,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, PCB_EDIT_FRAME::OnActionPluginRefresh )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_SHOW_FOLDER, PCB_EDIT_FRAME::OnActionPluginShowFolder )
|
||||
#endif
|
||||
|
||||
// Tracks and vias sizes general options
|
||||
|
@ -1201,20 +1202,38 @@ void PCB_EDIT_FRAME::RunEeschema()
|
|||
|
||||
void PCB_EDIT_FRAME::PythonPluginsReload()
|
||||
{
|
||||
// Reload Python plugins if they are newer than
|
||||
// the already loaded, and load new plugins
|
||||
// Reload Python plugins if they are newer than the already loaded, and load new plugins
|
||||
#if defined(KICAD_SCRIPTING)
|
||||
//Reload plugin list: reload Python plugins if they are newer than
|
||||
// the already loaded, and load new plugins
|
||||
// Reload plugin list: reload Python plugins if they are newer than the already loaded,
|
||||
// and load new plugins
|
||||
PythonPluginsReloadBase();
|
||||
|
||||
#if defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
// Action plugins can be modified, therefore the plugins menu
|
||||
// must be updated:
|
||||
ReCreateMenuBar();
|
||||
// Recreate top toolbar to add action plugin buttons
|
||||
ReCreateHToolbar();
|
||||
#endif
|
||||
#if defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
// Action plugins can be modified, therefore the plugins menu must be updated:
|
||||
ReCreateMenuBar();
|
||||
// Recreate top toolbar to add action plugin buttons
|
||||
ReCreateHToolbar();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::PythonPluginsShowFolder()
|
||||
{
|
||||
#if defined(KICAD_SCRIPTING)
|
||||
#ifdef __WXMAC__
|
||||
wxString msg;
|
||||
|
||||
// Quote in case there are spaces in the path.
|
||||
msg.Printf( "open \"%s\"", PYTHON_DEST );
|
||||
|
||||
system( msg.c_str() );
|
||||
#else
|
||||
// Quote in case there are spaces in the path.
|
||||
AddDelimiterString( pypath );
|
||||
|
||||
wxLaunchDefaultApplication( PYTHON_DEST );
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -168,6 +168,16 @@ protected:
|
|||
{
|
||||
PythonPluginsReload();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function OnActionPluginRefresh
|
||||
* Refresh plugin list (reload Python plugins)
|
||||
* @param aEvent sent by wx
|
||||
*/
|
||||
void OnActionPluginShowFolder( wxCommandEvent& aEvent)
|
||||
{
|
||||
PythonPluginsShowFolder();
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Has meaning only if KICAD_SCRIPTING_WXPYTHON option is
|
||||
|
@ -279,12 +289,18 @@ public:
|
|||
bool IsContentModified() override;
|
||||
|
||||
/**
|
||||
* Reload the Python plugins if they are newer than
|
||||
* the already loaded, and load new plugins if any
|
||||
* Do nothing if KICAD_SCRIPTING is not defined
|
||||
* Reload the Python plugins if they are newer than the already loaded, and load new
|
||||
* plugins if any.
|
||||
* Do nothing if KICAD_SCRIPTING is not defined.
|
||||
*/
|
||||
void PythonPluginsReload();
|
||||
|
||||
/**
|
||||
* Open the plugins folder in the default system file browser.
|
||||
* Do nothing if KICAD_SCRIPTING is not defined.
|
||||
*/
|
||||
void PythonPluginsShowFolder();
|
||||
|
||||
/**
|
||||
* Update the layer manager and other widgets from the board setup
|
||||
* (layer and items visibility, colors ...)
|
||||
|
|
|
@ -91,6 +91,7 @@ enum pcbnew_ids
|
|||
|
||||
ID_TOOLBARH_PCB_ACTION_PLUGIN,
|
||||
ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH,
|
||||
ID_TOOLBARH_PCB_ACTION_PLUGIN_SHOW_FOLDER,
|
||||
|
||||
ID_PCB_GEN_CMP_FILE,
|
||||
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
|
||||
|
|
Loading…
Reference in New Issue