Github plugin with curl: fix lack of message when trying to download a non existing footprint library (Curl does not return an error: the message "Not Fount" is stored in buffer, and the zip handler returns a not suitable error message)
Minor and very minor other fixes.
This commit is contained in:
commit
2016e92132
|
@ -62,7 +62,7 @@ void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
|
||||||
{
|
{
|
||||||
wxWindow* w = event.GetWindow();
|
wxWindow* w = event.GetWindow();
|
||||||
|
|
||||||
for( unsigned i=0; i<DIM(m_player); ++i )
|
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
|
||||||
{
|
{
|
||||||
// if destroying one of our flock, then mark it as deceased.
|
// if destroying one of our flock, then mark it as deceased.
|
||||||
if( (wxWindow*) m_player[i] == w )
|
if( (wxWindow*) m_player[i] == w )
|
||||||
|
@ -273,7 +273,7 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
|
||||||
{
|
{
|
||||||
// Since this will be called from python, cannot assume that code will
|
// Since this will be called from python, cannot assume that code will
|
||||||
// not pass a bad aFrameType.
|
// not pass a bad aFrameType.
|
||||||
if( unsigned( aFrameType ) >= DIM( m_player ) )
|
if( unsigned( aFrameType ) >= KIWAY_PLAYER_COUNT )
|
||||||
{
|
{
|
||||||
// @todo : throw an exception here for python's benefit, at least that
|
// @todo : throw an exception here for python's benefit, at least that
|
||||||
// way it gets some explanatory text.
|
// way it gets some explanatory text.
|
||||||
|
@ -316,7 +316,7 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
|
||||||
{
|
{
|
||||||
// Since this will be called from python, cannot assume that code will
|
// Since this will be called from python, cannot assume that code will
|
||||||
// not pass a bad aFrameType.
|
// not pass a bad aFrameType.
|
||||||
if( unsigned( aFrameType ) >= DIM( m_player ) )
|
if( unsigned( aFrameType ) >= KIWAY_PLAYER_COUNT )
|
||||||
{
|
{
|
||||||
// @todo : throw an exception here for python's benefit, at least that
|
// @todo : throw an exception here for python's benefit, at least that
|
||||||
// way it gets some explanatory text.
|
// way it gets some explanatory text.
|
||||||
|
@ -344,7 +344,7 @@ bool KIWAY::PlayersClose( bool doForce )
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
|
|
||||||
for( unsigned i=0; i < DIM( m_player ); ++i )
|
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
|
||||||
{
|
{
|
||||||
ret = ret && PlayerClose( FRAME_T( i ), doForce );
|
ret = ret && PlayerClose( FRAME_T( i ), doForce );
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ void KIWAY::SetLanguage( int aLanguage )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for( unsigned i=0; i < DIM( m_player ); ++i )
|
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
|
||||||
{
|
{
|
||||||
KIWAY_PLAYER* frame = m_player[i];
|
KIWAY_PLAYER* frame = m_player[i];
|
||||||
|
|
||||||
|
|
|
@ -101,11 +101,12 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
aFrameType==FRAME_SCH_VIEWER_MODAL ?
|
aFrameType==FRAME_SCH_VIEWER_MODAL ?
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP :
|
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
|
||||||
#else
|
#else
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT :
|
aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
|
||||||
|
: KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
|
||||||
#endif
|
#endif
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE,
|
: KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||||
aFrameType == FRAME_SCH_VIEWER_MODAL ?
|
aFrameType == FRAME_SCH_VIEWER_MODAL ?
|
||||||
LIB_VIEW_FRAME_NAME_MODAL : LIB_VIEW_FRAME_NAME )
|
LIB_VIEW_FRAME_NAME_MODAL : LIB_VIEW_FRAME_NAME )
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,7 +95,8 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
|
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
|
||||||
#else
|
#else
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
|
aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
|
||||||
|
: KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
|
||||||
#endif
|
#endif
|
||||||
FOOTPRINT_WIZARD_FRAME_NAME )
|
FOOTPRINT_WIZARD_FRAME_NAME )
|
||||||
{
|
{
|
||||||
|
|
|
@ -552,6 +552,16 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL ) throw( IO_ERROR )
|
||||||
|
|
||||||
THROW_IO_ERROR( msg );
|
THROW_IO_ERROR( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the zip archive is not existing, the received data is "Not Found",
|
||||||
|
// and no error is returned by kcurl.Perform().
|
||||||
|
if( m_zip_image.compare( 0, 9, "Not Found" ) == 0 )
|
||||||
|
{
|
||||||
|
UTF8 fmt( _( "Cannot download library '%s'.\nThe library does not exist on the server" ) );
|
||||||
|
std::string msg = StrPrintf( fmt.c_str(), TO_UTF8( aRepoURL ) );
|
||||||
|
|
||||||
|
THROW_IO_ERROR( msg );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 && defined(STANDALONE)
|
#if 0 && defined(STANDALONE)
|
||||||
|
|
|
@ -142,6 +142,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser()
|
||||||
if( viewer )
|
if( viewer )
|
||||||
viewer->Destroy();
|
viewer->Destroy();
|
||||||
|
|
||||||
|
// Creates the modal Lib browser:
|
||||||
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
|
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
|
||||||
|
|
||||||
wxString fpid;
|
wxString fpid;
|
||||||
|
@ -149,8 +150,6 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser()
|
||||||
int ret = viewer->ShowModal( &fpid, this );
|
int ret = viewer->ShowModal( &fpid, this );
|
||||||
(void) ret; // make static analyser quiet
|
(void) ret; // make static analyser quiet
|
||||||
|
|
||||||
//DBG(printf("%s: fpid:'%s'\n", __func__, TO_UTF8( fpid ) );)
|
|
||||||
|
|
||||||
viewer->Destroy();
|
viewer->Destroy();
|
||||||
|
|
||||||
return fpid;
|
return fpid;
|
||||||
|
|
|
@ -97,11 +97,11 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/* Note:
|
/* Note:
|
||||||
* FOOTPRINT_VIEWER_FRAME can be build in "modal mode", or as a usual frame.
|
* FOOTPRINT_VIEWER_FRAME can be created in "modal mode", or as a usual frame.
|
||||||
* In modal mode:
|
* In modal mode:
|
||||||
* a tool to export the selected footprint is shown in the toolbar
|
* a tool to export the selected footprint is shown in the toolbar
|
||||||
* the style is wxSTAY_ON_TOP on Windows and wxFRAME_FLOAT_ON_PARENT on unix
|
* the style is wxSTAY_ON_TOP on Windows and wxFRAME_FLOAT_ON_PARENT on unix
|
||||||
* reason:
|
* Reason:
|
||||||
* the parent is usually the kicad window manager (not easy to change)
|
* the parent is usually the kicad window manager (not easy to change)
|
||||||
* On windows, when the frame with stype wxFRAME_FLOAT_ON_PARENT is displayed
|
* On windows, when the frame with stype wxFRAME_FLOAT_ON_PARENT is displayed
|
||||||
* its parent frame is brought to the foreground, on the top of the calling frame.
|
* its parent frame is brought to the foreground, on the top of the calling frame.
|
||||||
|
@ -109,7 +109,7 @@ END_EVENT_TABLE()
|
||||||
* this issue does not happen on unix
|
* this issue does not happen on unix
|
||||||
*
|
*
|
||||||
* So we use wxSTAY_ON_TOP on Windows, and wxFRAME_FLOAT_ON_PARENT on unix
|
* So we use wxSTAY_ON_TOP on Windows, and wxFRAME_FLOAT_ON_PARENT on unix
|
||||||
* to simulate a dialog called by ShowModal.
|
* to force FOOTPRINT_VIEWER_FRAME to stay on parent when it is Modal.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,12 +122,13 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP :
|
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
|
||||||
#else
|
#else
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT :
|
aParent ?
|
||||||
|
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
|
||||||
|
: KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
|
||||||
#endif
|
#endif
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE,
|
: KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||||
|
|
||||||
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
||||||
FOOTPRINT_VIEWER_FRAME_NAME_MODAL
|
FOOTPRINT_VIEWER_FRAME_NAME_MODAL
|
||||||
: FOOTPRINT_VIEWER_FRAME_NAME )
|
: FOOTPRINT_VIEWER_FRAME_NAME )
|
||||||
|
|
Loading…
Reference in New Issue