Github plugin: 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:
parent
ab585f46ce
commit
6ff0092e21
|
@ -62,7 +62,7 @@ void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
|
|||
{
|
||||
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( (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
|
||||
// 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
|
||||
// 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
|
||||
// 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
|
||||
// way it gets some explanatory text.
|
||||
|
@ -344,7 +344,7 @@ bool KIWAY::PlayersClose( bool doForce )
|
|||
{
|
||||
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 );
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void KIWAY::SetLanguage( int aLanguage )
|
|||
}
|
||||
#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];
|
||||
|
||||
|
|
|
@ -101,11 +101,12 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
wxDefaultPosition, wxDefaultSize,
|
||||
aFrameType==FRAME_SCH_VIEWER_MODAL ?
|
||||
#ifdef __WINDOWS__
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP :
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
|
||||
#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
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||
: KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||
aFrameType == FRAME_SCH_VIEWER_MODAL ?
|
||||
LIB_VIEW_FRAME_NAME_MODAL : LIB_VIEW_FRAME_NAME )
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012-2015 Miguel Angel Ajo Pelayo <miguelangel@nbee.es>
|
||||
* Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
|
@ -95,7 +95,8 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
|||
#ifdef __WINDOWS__
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
|
||||
#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
|
||||
FOOTPRINT_WIZARD_FRAME_NAME )
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ I have lost my enthusiasm for local caching until a faster time stamp retrieval
|
|||
mechanism can be found, or github gets more servers. But note that the occasionally
|
||||
slow response is the exception rather than the norm. Normally the response is
|
||||
down around a 1/3 of a second. The information we would use is in the header
|
||||
named "Last-Modified" as seen below.
|
||||
named "Last-Modified" as seen below.
|
||||
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
|
@ -545,13 +545,23 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL ) throw( IO_ERROR )
|
|||
{
|
||||
UTF8 fmt( _( "%s\nCannot get/download Zip archive: '%s'\nfor library path: '%s'.\nReason: '%s'" ) );
|
||||
|
||||
std::string msg = StrPrintf( fmt.c_str(),
|
||||
zip_url.c_str(),
|
||||
std::string msg = StrPrintf( fmt.c_str(),
|
||||
zip_url.c_str(),
|
||||
TO_UTF8( aRepoURL ),
|
||||
TO_UTF8( ioe.errorText ) );
|
||||
|
||||
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)
|
||||
|
|
|
@ -142,6 +142,7 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser()
|
|||
if( viewer )
|
||||
viewer->Destroy();
|
||||
|
||||
// Creates the modal Lib browser:
|
||||
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true );
|
||||
|
||||
wxString fpid;
|
||||
|
@ -149,8 +150,6 @@ wxString PCB_BASE_FRAME::SelectFootprintFromLibBrowser()
|
|||
int ret = viewer->ShowModal( &fpid, this );
|
||||
(void) ret; // make static analyser quiet
|
||||
|
||||
//DBG(printf("%s: fpid:'%s'\n", __func__, TO_UTF8( fpid ) );)
|
||||
|
||||
viewer->Destroy();
|
||||
|
||||
return fpid;
|
||||
|
|
|
@ -97,11 +97,11 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
/* 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:
|
||||
* 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
|
||||
* reason:
|
||||
* Reason:
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
* 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,
|
||||
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
||||
#ifdef __WINDOWS__
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP :
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP
|
||||
#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
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||
|
||||
: KICAD_DEFAULT_DRAWFRAME_STYLE,
|
||||
aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
|
||||
FOOTPRINT_VIEWER_FRAME_NAME_MODAL
|
||||
: FOOTPRINT_VIEWER_FRAME_NAME )
|
||||
|
@ -631,7 +632,7 @@ void FOOTPRINT_VIEWER_FRAME::Show3D_Frame( wxCommandEvent& event )
|
|||
// Raising the window does not show the window on Windows if iconized.
|
||||
// This should work on any platform.
|
||||
if( draw3DFrame->IsIconized() )
|
||||
draw3DFrame->Iconize( false );
|
||||
draw3DFrame->Iconize( false );
|
||||
|
||||
draw3DFrame->Raise();
|
||||
|
||||
|
|
Loading…
Reference in New Issue