mirror of https://github.com/KLayout/klayout.git
Some enhancements/bug fixes for package manager
This commit is contained in:
parent
9eddeabef2
commit
7e7a5ce030
|
|
@ -35,6 +35,9 @@
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="childrenCollapsible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget_2">
|
<widget class="QWidget" name="layoutWidget_2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
|
|
@ -325,6 +328,9 @@
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="childrenCollapsible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget_3">
|
<widget class="QWidget" name="layoutWidget_3">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
|
|
@ -601,7 +607,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Current Packages</string>
|
<string>Installed Packages</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
|
|
@ -615,6 +621,9 @@
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="childrenCollapsible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
|
|
@ -650,26 +659,6 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="delete_button">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Uninstall Package</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="layResources.qrc">
|
|
||||||
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
@ -797,8 +786,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>343</width>
|
<width>537</width>
|
||||||
<height>207</height>
|
<height>284</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
|
@ -994,16 +983,19 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="create_button">
|
<widget class="QPushButton" name="delete_button">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Uninstall Package</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Create Package</string>
|
<string>Remove Package</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="layResources.qrc">
|
<iconset resource="layResources.qrc">
|
||||||
<normaloff>:/add.png</normaloff>:/add.png</iconset>
|
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -1020,6 +1012,20 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="create_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Create (Edit) Package</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/add.png</normaloff>:/add.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -1053,10 +1059,10 @@
|
||||||
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
<normaloff>:/clear.png</normaloff>:/clear.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete</string>
|
<string>Remove Package</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Delete package</string>
|
<string>Remove package</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionUnmarkAllNew">
|
<action name="actionUnmarkAllNew">
|
||||||
|
|
@ -1108,8 +1114,12 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionCreatePackage">
|
<action name="actionCreatePackage">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="layResources.qrc">
|
||||||
|
<normaloff>:/add.png</normaloff>:/add.png</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Create package</string>
|
<string>Create (edit) package</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionMarkAllUpdate">
|
<action name="actionMarkAllUpdate">
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include "tlXMLParser.h"
|
#include "tlXMLParser.h"
|
||||||
#include "tlHttpStream.h"
|
#include "tlHttpStream.h"
|
||||||
#include "tlWebDAV.h"
|
#include "tlWebDAV.h"
|
||||||
|
#include "tlFileUtils.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
@ -124,24 +125,29 @@ SaltGrain::eff_doc_url () const
|
||||||
return m_doc_url;
|
return m_doc_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! path ().empty ()) {
|
QString p = tl::to_qstring (path ());
|
||||||
|
if (! p.isEmpty ()) {
|
||||||
|
|
||||||
// if the URL is a relative URL, make it absolute relative to the grain's installation directory
|
// if the URL is a relative URL, make it absolute relative to the grain's installation directory
|
||||||
QFileInfo fi (url.toLocalFile ());
|
QFileInfo fi (url.toLocalFile ());
|
||||||
if (! fi.isAbsolute ()) {
|
if (! fi.isAbsolute ()) {
|
||||||
url = QUrl::fromLocalFile (QDir (tl::to_qstring (path ())).absoluteFilePath (fi.filePath ()));
|
fi = QFileInfo (QDir (p).absoluteFilePath (fi.filePath ()));
|
||||||
}
|
}
|
||||||
url.setScheme (tl::to_qstring ("file"));
|
|
||||||
return tl::to_string (url.toString ());
|
|
||||||
|
|
||||||
} else {
|
// if the resulting path is inside the downloaded package, use this path
|
||||||
|
QString dp = fi.canonicalFilePath ();
|
||||||
// base the documentation URL on the download URL
|
if (!dp.isEmpty () && tl::is_parent_path (p, dp)) {
|
||||||
QUrl eff_url = QUrl (tl::to_qstring (m_url));
|
url = QUrl::fromLocalFile (dp);
|
||||||
eff_url.setPath (eff_url.path () + QString::fromUtf8 ("/") + url.path ());
|
url.setScheme (tl::to_qstring ("file"));
|
||||||
return tl::to_string (eff_url.toString ());
|
return tl::to_string (url.toString ());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// base the documentation URL on the download URL
|
||||||
|
QUrl eff_url = QUrl (tl::to_qstring (m_url));
|
||||||
|
eff_url.setPath (eff_url.path () + QString::fromUtf8 ("/") + url.path ());
|
||||||
|
return tl::to_string (eff_url.toString ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,6 @@ SaltManagerDialog::SaltManagerDialog (QWidget *parent, lay::Salt *salt, const st
|
||||||
Ui::SaltManagerDialog::setupUi (this);
|
Ui::SaltManagerDialog::setupUi (this);
|
||||||
mp_properties_dialog = new lay::SaltGrainPropertiesDialog (this);
|
mp_properties_dialog = new lay::SaltGrainPropertiesDialog (this);
|
||||||
|
|
||||||
// TODO: clarify where the delete button should go ... currently it's too easy to
|
|
||||||
// mistake add and delete buttons
|
|
||||||
delete_button->hide ();
|
|
||||||
|
|
||||||
connect (edit_button, SIGNAL (clicked ()), this, SLOT (edit_properties ()));
|
connect (edit_button, SIGNAL (clicked ()), this, SLOT (edit_properties ()));
|
||||||
connect (create_button, SIGNAL (clicked ()), this, SLOT (create_grain ()));
|
connect (create_button, SIGNAL (clicked ()), this, SLOT (create_grain ()));
|
||||||
connect (delete_button, SIGNAL (clicked ()), this, SLOT (delete_grain ()));
|
connect (delete_button, SIGNAL (clicked ()), this, SLOT (delete_grain ()));
|
||||||
|
|
@ -130,6 +126,7 @@ SaltManagerDialog::SaltManagerDialog (QWidget *parent, lay::Salt *salt, const st
|
||||||
|
|
||||||
mp_salt = salt;
|
mp_salt = salt;
|
||||||
|
|
||||||
|
QApplication::setOverrideCursor (Qt::WaitCursor);
|
||||||
try {
|
try {
|
||||||
if (! m_salt_mine_url.empty ()) {
|
if (! m_salt_mine_url.empty ()) {
|
||||||
tl::log << tl::to_string (tr ("Downloading package repository from %1").arg (tl::to_qstring (m_salt_mine_url)));
|
tl::log << tl::to_string (tr ("Downloading package repository from %1").arg (tl::to_qstring (m_salt_mine_url)));
|
||||||
|
|
@ -138,6 +135,7 @@ SaltManagerDialog::SaltManagerDialog (QWidget *parent, lay::Salt *salt, const st
|
||||||
} catch (tl::Exception &ex) {
|
} catch (tl::Exception &ex) {
|
||||||
tl::error << ex.msg ();
|
tl::error << ex.msg ();
|
||||||
}
|
}
|
||||||
|
QApplication::restoreOverrideCursor ();
|
||||||
|
|
||||||
SaltModel *model = new SaltModel (this, mp_salt);
|
SaltModel *model = new SaltModel (this, mp_salt);
|
||||||
model->set_empty_explanation (tr ("No packages are present on this system"));
|
model->set_empty_explanation (tr ("No packages are present on this system"));
|
||||||
|
|
@ -258,7 +256,7 @@ SaltManagerDialog::mode_changed ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// keeps the splitters in sync
|
// keeps the splitters in sync
|
||||||
if (!sizes.empty ()) {
|
if (sizes.size () == 2 && sizes[1] > 0 /*visible*/) {
|
||||||
splitter_new->setSizes (sizes);
|
splitter_new->setSizes (sizes);
|
||||||
splitter_update->setSizes (sizes);
|
splitter_update->setSizes (sizes);
|
||||||
splitter->setSizes (sizes);
|
splitter->setSizes (sizes);
|
||||||
|
|
@ -661,9 +659,20 @@ BEGIN_PROTECTED
|
||||||
|
|
||||||
tl::log << tl::to_string (tr ("Downloading package repository from %1").arg (tl::to_qstring (m_salt_mine_url)));
|
tl::log << tl::to_string (tr ("Downloading package repository from %1").arg (tl::to_qstring (m_salt_mine_url)));
|
||||||
|
|
||||||
lay::Salt new_mine;
|
try {
|
||||||
new_mine.load (m_salt_mine_url);
|
|
||||||
m_salt_mine = new_mine;
|
QApplication::setOverrideCursor (Qt::WaitCursor);
|
||||||
|
|
||||||
|
lay::Salt new_mine;
|
||||||
|
new_mine.load (m_salt_mine_url);
|
||||||
|
m_salt_mine = new_mine;
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor ();
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
QApplication::restoreOverrideCursor ();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
salt_mine_changed ();
|
salt_mine_changed ();
|
||||||
|
|
||||||
|
|
@ -870,6 +879,8 @@ SaltManagerDialog::get_remote_grain_info (lay::SaltGrain *g, SaltGrainDetailsTex
|
||||||
// Download actual grain definition file
|
// Download actual grain definition file
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
QApplication::setOverrideCursor (Qt::WaitCursor);
|
||||||
|
|
||||||
if (g->url ().empty ()) {
|
if (g->url ().empty ()) {
|
||||||
throw tl::Exception (tl::to_string (tr ("No download link available")));
|
throw tl::Exception (tl::to_string (tr ("No download link available")));
|
||||||
}
|
}
|
||||||
|
|
@ -901,8 +912,12 @@ SaltManagerDialog::get_remote_grain_info (lay::SaltGrain *g, SaltGrainDetailsTex
|
||||||
|
|
||||||
details->set_grain (remote_grain.get ());
|
details->set_grain (remote_grain.get ());
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor ();
|
||||||
|
|
||||||
} catch (tl::Exception &ex) {
|
} catch (tl::Exception &ex) {
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor ();
|
||||||
|
|
||||||
remote_grain.reset (0);
|
remote_grain.reset (0);
|
||||||
|
|
||||||
QString html = tr (
|
QString html = tr (
|
||||||
|
|
|
||||||
|
|
@ -189,9 +189,9 @@ InputHttpStream::read (char *b, size_t n)
|
||||||
issue_request (QUrl (tl::to_qstring (m_url)));
|
issue_request (QUrl (tl::to_qstring (m_url)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @@@ TODO: progress, timeout
|
// TODO: progress, timeout
|
||||||
while (mp_reply == 0) {
|
while (mp_reply == 0) {
|
||||||
QCoreApplication::processEvents (QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents, 100);
|
QCoreApplication::processEvents (QEventLoop::ExcludeUserInputEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp_reply->error () != QNetworkReply::NoError) {
|
if (mp_reply->error () != QNetworkReply::NoError) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue