Salt: added font, macro and mymacro templates.

Fixed two small bugs in the properties dialog (accept
wasn't possible if the doc link could not be read)
and remove_from_collection (infinite loop).
This commit is contained in:
Matthias Koefferlein 2017-04-26 23:19:36 +02:00
parent b3e823ca28
commit f79b14d0e4
12 changed files with 197 additions and 13 deletions

View File

@ -248,11 +248,8 @@ bool remove_from_collection (SaltGrains &collection, const std::string &name)
for (SaltGrains::grain_iterator g = collection.begin_grains (); g != collection.end_grains (); ++g) {
if (g->name () == name) {
SaltGrains::grain_iterator gnext = g;
++gnext;
collection.remove_grain (g, true);
res = true;
g = gnext;
res = collection.remove_grain (g, true);
break;
}
}

View File

@ -536,8 +536,8 @@ SaltGrainPropertiesDialog::accept ()
// doc URL
doc_url_alert->clear ();
if (! m_grain.doc_url ().empty ()) {
tl::InputStream stream (m_grain.doc_url ());
try {
tl::InputStream stream (m_grain.eff_doc_url ());
if (! stream.get (1)) {
throw tl::Exception (tl::to_string (tr ("Empty document")));
}

View File

@ -7,6 +7,10 @@
<file alias="grain.xml">salt_templates/font/grain.xml</file>
</qresource>
<qresource prefix="/salt_templates/font/fonts">
<file alias="new_font.gds">salt_templates/font/fonts/new_font.gds</file>
</qresource>
<qresource prefix="/salt_templates/font/doc">
<file alias="readme.html">salt_templates/font/doc/readme.html</file>
</qresource>
<!-- lib template -->
@ -39,6 +43,10 @@
<file alias="grain.xml">salt_templates/pymacro/grain.xml</file>
</qresource>
<qresource prefix="/salt_templates/pymacro/pymacros">
<file alias="new_macro.lym">salt_templates/pymacro/pymacros/new_macro.lym</file>
</qresource>
<qresource prefix="/salt_templates/pymacro/doc">
<file alias="readme.html">salt_templates/pymacro/doc/readme.html</file>
</qresource>
<!-- tech template -->

View File

@ -0,0 +1,43 @@
<html>
<body>
<h1>Your new Package</h1>
<p>
Your new package is there! You can edit the package properties in the package manager.
Use the edit button in the upper right corner of the package details panel to
open the package editor.
</p>
<p>
Here is what you should do:
</p>
<ul>
<li>Change the name of the font layout file to a unique name</li>
<li>Choose a license model</li>
<li>Provide an icon and optionally a screenshot image</li>
</ul>
<p>
Edit the font's layout to define the glyphs. Don't forget to update the metadata
in the "COMMENT" cell. The metadata helps the PCell to compute properties
of the font.
</p>
<p>
In the package details you will find the local path to your package
data under "Installation". You can use any versioning system to manage your
files there.
</p>
<p>
Once you have finished your package, don't forget to specify the package version
so users of you package will be informed of updates. Finally you can publish the
package files to a place of your choice and submit the download URL to the
Salt Mine server.
</p>
</body>
</html>

Binary file not shown.

View File

@ -3,8 +3,8 @@
<name>font</name>
<version>0.0</version>
<title>Font package</title>
<doc>This template provides a font for the Basic.TEXT PCell</doc>
<doc-url/>
<doc>This template provides a font for the Basic.TEXT PCell.</doc>
<doc-url>doc/readme.html</doc-url>
<url/>
<license>GPLv3</license>
<author/>

View File

@ -0,0 +1,46 @@
<html>
<body>
<h1>Your new Package</h1>
<p>
Your new package is there! You can edit the package properties in the package manager.
Use the edit button in the upper right corner of the package details panel to
open the package editor.
</p>
<p>
Here is what you should do:
</p>
<ul>
<li>Enter your author details</li>
<li>Choose a license model</li>
<li>Provide an icon and optionally a screenshot image</li>
<li>Specify dependencies if you plan to use items from other packages</li>
</ul>
<p>
Of course, the most interesting thing is how to add, edit and develop macros within
your macro package. When the package was initialized, a "macros" folder with a single
sample macro has been created. You will find this folder in the macro editor
under the name you have given the package. The name of the sample macro is "new_macro".
You can add more macros, Ruby and other files there or modify the sample macro.
</p>
<p>
In the package details you will find the local path to your package
data under "Installation". You can use any versioning system to manage your
files there.
</p>
<p>
Once you have finished your package, don't forget to specify the package version
so users of you package will be informed of updates. Finally you can publish the
package files to a place of your choice and submit the download URL to the
Salt Mine server.
</p>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<klayout-macro>
<description>The New Macro</description>
<prolog/>
<epilog/>
<autorun>false</autorun>
<autorun-early>false</autorun-early>
<shortcut/>
<show-in-menu>false</show-in-menu>
<group-name/>
<menu-path/>
<interpreter>ruby</interpreter>
<dsl-interpreter-name/>
<text># This is the new macro created with the sample macro package
RBA::MessageBox::information("Information", "This is the new macro created with the sample macro package", RBA::MessageBox::Ok)</text>
# In order pull in classes from other packages, just specify these classes
# in the dependencies of this package. Provided those packages contain macros
# which are marked as "autorun-early", the will be loaded before this package
# and their modules and classes will be available.
</klayout-macro>

View File

@ -0,0 +1,46 @@
<html>
<body>
<h1>Your new Package</h1>
<p>
Your new package is there! You can edit the package properties in the package manager.
Use the edit button in the upper right corner of the package details panel to
open the package editor.
</p>
<p>
Here is what you should do:
</p>
<ul>
<li>Enter your author details</li>
<li>Choose a license model</li>
<li>Provide an icon and optionally a screenshot image</li>
<li>Specify dependencies if you plan to use items from other packages</li>
</ul>
<p>
Of course, the most interesting thing is how to add, edit and develop macros within
your macro package. When the package was initialized, a "macros" folder with a single
sample macro has been created. You will find this folder in the macro editor
under the name you have given the package. The name of the sample macro is "new_macro".
You can add more macros, Python and other files there or modify the sample macro.
</p>
<p>
In the package details you will find the local path to your package
data under "Installation". You can use any versioning system to manage your
files there.
</p>
<p>
Once you have finished your package, don't forget to specify the package version
so users of you package will be informed of updates. Finally you can publish the
package files to a place of your choice and submit the download URL to the
Salt Mine server.
</p>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<klayout-macro>
<description>The New Macro</description>
<prolog/>
<epilog/>
<autorun>false</autorun>
<autorun-early>false</autorun-early>
<shortcut/>
<show-in-menu>false</show-in-menu>
<group-name/>
<menu-path/>
<interpreter>ruby</interpreter>
<dsl-interpreter-name/>
<text># This is the new macro created with the sample macro package
RBA::MessageBox::information("Information", "This is the new macro created with the sample macro package", RBA::MessageBox::Ok)</text>
# In order pull in classes from other packages, just specify these classes
# in the dependencies of this package. Provided those packages contain macros
# which are marked as "autorun-early", they will be loaded before this package
# and their modules and classes will become available.
</klayout-macro>