mirror of https://github.com/KLayout/klayout.git
Relative paths for includes in package index files
Plus: inhibt some deferred methods during processEvent (i.e. progress reporting, HTTP/HTTPS download).
This commit is contained in:
parent
06a1002e25
commit
b3ffa23499
|
|
@ -1371,7 +1371,11 @@ Application::process_events (QEventLoop::ProcessEventsFlags flags, bool silent)
|
|||
#endif
|
||||
|
||||
mp_mw->enter_busy_mode (true);
|
||||
QApplication::processEvents (flags);
|
||||
try {
|
||||
QApplication::processEvents (flags);
|
||||
} catch (...) {
|
||||
// ignore exceptions
|
||||
}
|
||||
mp_mw->enter_busy_mode (false);
|
||||
|
||||
if (silent) {
|
||||
|
|
|
|||
|
|
@ -190,6 +190,9 @@ ProgressReporter::update_and_yield ()
|
|||
void
|
||||
ProgressReporter::process_events ()
|
||||
{
|
||||
// Don't execute deferred methods during progress handling (undesired side effects)
|
||||
tl::NoDeferredMethods silent;
|
||||
|
||||
if (m_pw_visible && lay::MainWindow::instance () && QApplication::instance ()) {
|
||||
QApplication::instance ()->processEvents (QEventLoop::AllEvents);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,6 +371,7 @@ SaltDownloadManager::execute (lay::SaltManagerDialog *parent, lay::Salt &salt)
|
|||
dialog->setModal (true);
|
||||
dialog->show ();
|
||||
|
||||
// TODO: should not waste CPU time in processEvents loop.
|
||||
while (! dialog->is_confirmed ()) {
|
||||
QCoreApplication::processEvents (QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents, 100);
|
||||
if (dialog->is_cancelled () || ! dialog->isVisible ()) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QResource>
|
||||
#include <QUrl>
|
||||
|
||||
namespace lay
|
||||
{
|
||||
|
|
@ -245,6 +246,8 @@ static tl::XMLStruct<lay::SaltGrains> s_xml_struct ("salt-mine", s_group_struct)
|
|||
void
|
||||
SaltGrains::load (const std::string &p)
|
||||
{
|
||||
m_url = p;
|
||||
|
||||
tl::XMLFileSource source (p);
|
||||
s_xml_struct.parse (source, *this);
|
||||
}
|
||||
|
|
@ -252,14 +255,33 @@ SaltGrains::load (const std::string &p)
|
|||
void
|
||||
SaltGrains::load (tl::InputStream &p)
|
||||
{
|
||||
m_url.clear ();
|
||||
|
||||
tl::XMLStreamSource source (p);
|
||||
s_xml_struct.parse (source, *this);
|
||||
}
|
||||
|
||||
void
|
||||
SaltGrains::include (const std::string &src)
|
||||
SaltGrains::include (const std::string &src_in)
|
||||
{
|
||||
if (! src.empty ()) {
|
||||
if (! src_in.empty ()) {
|
||||
|
||||
std::string src = src_in;
|
||||
|
||||
// base relative URL's on the parent URL
|
||||
if (!m_url.empty () && src.find ("http:") != 0 && src.find ("https:") != 0 && src.find ("file:") != 0 && !src.empty() && src[0] != '/' && src[0] != '\\') {
|
||||
|
||||
// replace the last component ("repository.xml") by the given path
|
||||
QUrl url (tl::to_qstring (m_url));
|
||||
QStringList path_comp = url.path ().split (QString::fromUtf8 ("/"));
|
||||
if (!path_comp.isEmpty ()) {
|
||||
path_comp.back () = tl::to_qstring (src);
|
||||
}
|
||||
url.setPath (path_comp.join (QString::fromUtf8 ("/")));
|
||||
|
||||
src = tl::to_string (url.toString ());
|
||||
|
||||
}
|
||||
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::log << "Including package index from " << src;
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ private:
|
|||
std::string m_path;
|
||||
collections_type m_collections;
|
||||
grains_type m_grains;
|
||||
std::string m_url;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "tlHttpStream.h"
|
||||
#include "tlStaticObjects.h"
|
||||
#include "tlDeferredExecution.h"
|
||||
|
||||
#include "ui_PasswordDialog.h"
|
||||
|
||||
|
|
@ -185,6 +186,9 @@ InputHttpStream::issue_request (const QUrl &url)
|
|||
size_t
|
||||
InputHttpStream::read (char *b, size_t n)
|
||||
{
|
||||
// Prevents deferred methods to be executed during the processEvents below (undesired side effects)
|
||||
tl::NoDeferredMethods silent;
|
||||
|
||||
if (mp_reply == 0) {
|
||||
issue_request (QUrl (tl::to_qstring (m_url)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue