mirror of https://github.com/KLayout/klayout.git
Merge branch 'master' of github.com:KLayout/klayout
This commit is contained in:
commit
0dca716e55
|
|
@ -32,6 +32,9 @@ jobs:
|
|||
cp311-cp311-win_amd64.whl:
|
||||
python.version: '3.11'
|
||||
python.architecture: 'x64'
|
||||
cp312-cp312-win_amd64.whl:
|
||||
python.version: '3.12'
|
||||
python.architecture: 'x64'
|
||||
cp36-cp36m-win32.whl:
|
||||
python.version: '3.6'
|
||||
python.architecture: 'x86'
|
||||
|
|
@ -50,6 +53,9 @@ jobs:
|
|||
cp311-cp311-win32.whl:
|
||||
python.version: '3.11'
|
||||
python.architecture: 'x86'
|
||||
cp312-cp312-win32.whl:
|
||||
python.version: '3.12'
|
||||
python.architecture: 'x86'
|
||||
maxParallel: 6
|
||||
|
||||
steps:
|
||||
|
|
@ -130,6 +136,11 @@ jobs:
|
|||
vmImage: 'windows-2019' # other options: 'macOS-10.13', 'ubuntu-16.04'
|
||||
steps:
|
||||
- checkout: none #skip checking out the default repository resource
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download Build Artifacts wheel-3.12.x64'
|
||||
inputs:
|
||||
artifactName: 'wheel-3.12.x64'
|
||||
downloadPath: '$(System.DefaultWorkingDirectory)'
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download Build Artifacts wheel-3.11.x64'
|
||||
inputs:
|
||||
|
|
@ -160,6 +171,11 @@ jobs:
|
|||
inputs:
|
||||
artifactName: 'wheel-3.6.x64'
|
||||
downloadPath: '$(System.DefaultWorkingDirectory)'
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download Build Artifacts wheel-3.12.x86'
|
||||
inputs:
|
||||
artifactName: 'wheel-3.12.x86'
|
||||
downloadPath: '$(System.DefaultWorkingDirectory)'
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: 'Download Build Artifacts wheel-3.11.x86'
|
||||
inputs:
|
||||
|
|
|
|||
|
|
@ -118,6 +118,12 @@ Optional, named parameters are
|
|||
@li
|
||||
@b:unit@/b: the unit string
|
||||
@/li
|
||||
@li
|
||||
@b:min_value@/b: the minimum value (effective for numerical types and if no choices are present)
|
||||
@/li
|
||||
@li
|
||||
@b:max_value@/b: the maximum value (effective for numerical types and if no choices are present)
|
||||
@/li
|
||||
@li
|
||||
@b:default@/b: the default value
|
||||
@/li
|
||||
|
|
@ -335,6 +341,8 @@ module RBA
|
|||
# :hidden -> (boolean) true, if the parameter is not shown in the dialog
|
||||
# :readonly -> (boolean) true, if the parameter cannot be edited
|
||||
# :unit -> the unit string
|
||||
# :min_value -> the minimum value (only effective for numerical types and if no choices are present)
|
||||
# :max_value -> the maximum value (only effective for numerical types and if no choices are present)
|
||||
# :default -> the default value
|
||||
# :choices -> ([ [ d, v ], ...) choice descriptions/value for choice type
|
||||
# this method defines accessor methods for the parameters
|
||||
|
|
@ -373,6 +381,8 @@ module RBA
|
|||
args[:hidden] && pdecl.hidden = args[:hidden]
|
||||
args[:readonly] && pdecl.readonly = args[:readonly]
|
||||
args[:unit] && pdecl.unit = args[:unit]
|
||||
args[:min_value] && pdecl.min_value = args[:min_value]
|
||||
args[:max_value] && pdecl.max_value = args[:max_value]
|
||||
if args[:choices]
|
||||
if !args[:choices].is_a?(Array)
|
||||
raise ":choices value must be an array of two-element arrays (description, value)"
|
||||
|
|
|
|||
|
|
@ -127,6 +127,12 @@ Optional, named parameters are
|
|||
@li
|
||||
@bunit@/b: the unit string
|
||||
@/li
|
||||
@li
|
||||
@bmin_value@/b: the minimum value (effective for numerical types and if no choices are present)
|
||||
@/li
|
||||
@li
|
||||
@bmax_value@/b: the maximum value (effective for numerical types and if no choices are present)
|
||||
@/li
|
||||
@li
|
||||
@bdefault@/b: the default value
|
||||
@/li
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "dbLayout.h"
|
||||
#include "tlVariant.h"
|
||||
#include "tlObject.h"
|
||||
#include "tlOptional.h"
|
||||
|
||||
namespace db
|
||||
{
|
||||
|
|
@ -267,6 +268,56 @@ public:
|
|||
m_choice_descriptions = choice_descriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the minimum value
|
||||
*
|
||||
* The minimum value is a visual feature and limits the allowed values for numerical
|
||||
* entry boxes. This applies to parameters of type int or double. The minimum value
|
||||
* is not effective if choices are present.
|
||||
*
|
||||
* The minimum value is not enforced - for example there is no restriction implemented
|
||||
* when setting values programmatically.
|
||||
*
|
||||
* Setting this attribute to "nil" (the default) implies "no limit".
|
||||
*/
|
||||
void set_min_value (const tl::Variant &min)
|
||||
{
|
||||
m_min_value = min;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the minimum value (see \set_min_value)
|
||||
*/
|
||||
const tl::Variant &min_value () const
|
||||
{
|
||||
return m_min_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the maximum value
|
||||
*
|
||||
* The maximum value is a visual feature and limits the allowed values for numerical
|
||||
* entry boxes. This applies to parameters of type int or double. The maximum value
|
||||
* is not effective if choices are present.
|
||||
*
|
||||
* The maximum value is not enforced - for example there is no restriction implemented
|
||||
* when setting values programmatically.
|
||||
*
|
||||
* Setting this attribute to "nil" (the default) implies "no limit".
|
||||
*/
|
||||
void set_max_value (const tl::Variant &max)
|
||||
{
|
||||
m_max_value = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the maximum value (see \set_max_value)
|
||||
*/
|
||||
const tl::Variant &max_value () const
|
||||
{
|
||||
return m_max_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Equality
|
||||
*/
|
||||
|
|
@ -280,7 +331,9 @@ public:
|
|||
m_type == d.m_type &&
|
||||
m_name == d.m_name &&
|
||||
m_description == d.m_description &&
|
||||
m_unit == d.m_unit;
|
||||
m_unit == d.m_unit &&
|
||||
m_min_value == d.m_min_value &&
|
||||
m_max_value == d.m_max_value;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -291,6 +344,7 @@ private:
|
|||
type m_type;
|
||||
std::string m_name;
|
||||
std::string m_description, m_unit;
|
||||
tl::Variant m_min_value, m_max_value;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "dbPCellDeclaration.h"
|
||||
#include "dbLibrary.h"
|
||||
#include "dbLibraryManager.h"
|
||||
#include "tlLog.h"
|
||||
|
||||
namespace gsi
|
||||
{
|
||||
|
|
@ -701,23 +702,23 @@ Class<PCellDeclarationImpl> decl_PCellDeclaration (decl_PCellDeclaration_Native,
|
|||
// ---------------------------------------------------------------
|
||||
// db::PCellParameterDeclaration binding
|
||||
|
||||
unsigned int get_type (const db::PCellParameterDeclaration *pd)
|
||||
static unsigned int get_type (const db::PCellParameterDeclaration *pd)
|
||||
{
|
||||
return (unsigned int) pd->get_type ();
|
||||
}
|
||||
|
||||
void set_type (db::PCellParameterDeclaration *pd, unsigned int t)
|
||||
static void set_type (db::PCellParameterDeclaration *pd, unsigned int t)
|
||||
{
|
||||
pd->set_type (db::PCellParameterDeclaration::type (t));
|
||||
}
|
||||
|
||||
void clear_choices (db::PCellParameterDeclaration *pd)
|
||||
static void clear_choices (db::PCellParameterDeclaration *pd)
|
||||
{
|
||||
pd->set_choices (std::vector<tl::Variant> ());
|
||||
pd->set_choice_descriptions (std::vector<std::string> ());
|
||||
}
|
||||
|
||||
void add_choice (db::PCellParameterDeclaration *pd, const std::string &d, const tl::Variant &v)
|
||||
static void add_choice (db::PCellParameterDeclaration *pd, const std::string &d, const tl::Variant &v)
|
||||
{
|
||||
std::vector<tl::Variant> vv = pd->get_choices ();
|
||||
std::vector<std::string> dd = pd->get_choice_descriptions ();
|
||||
|
|
@ -772,26 +773,7 @@ static unsigned int pd_type_none ()
|
|||
return (unsigned int) db::PCellParameterDeclaration::t_none;
|
||||
}
|
||||
|
||||
db::PCellParameterDeclaration *ctor_pcell_parameter (const std::string &name, unsigned int type, const std::string &description)
|
||||
{
|
||||
db::PCellParameterDeclaration *pd = new db::PCellParameterDeclaration ();
|
||||
pd->set_name (name);
|
||||
pd->set_type (db::PCellParameterDeclaration::type (type));
|
||||
pd->set_description (description);
|
||||
return pd;
|
||||
}
|
||||
|
||||
db::PCellParameterDeclaration *ctor_pcell_parameter_2 (const std::string &name, unsigned int type, const std::string &description, const tl::Variant &def)
|
||||
{
|
||||
db::PCellParameterDeclaration *pd = new db::PCellParameterDeclaration ();
|
||||
pd->set_name (name);
|
||||
pd->set_type (db::PCellParameterDeclaration::type (type));
|
||||
pd->set_description (description);
|
||||
pd->set_default (def);
|
||||
return pd;
|
||||
}
|
||||
|
||||
db::PCellParameterDeclaration *ctor_pcell_parameter_3 (const std::string &name, unsigned int type, const std::string &description, const tl::Variant &def, const std::string &unit)
|
||||
db::PCellParameterDeclaration *ctor_pcell_parameter (const std::string &name, unsigned int type, const std::string &description, const tl::Variant &def, const std::string &unit)
|
||||
{
|
||||
db::PCellParameterDeclaration *pd = new db::PCellParameterDeclaration ();
|
||||
pd->set_name (name);
|
||||
|
|
@ -803,20 +785,7 @@ db::PCellParameterDeclaration *ctor_pcell_parameter_3 (const std::string &name,
|
|||
}
|
||||
|
||||
Class<db::PCellParameterDeclaration> decl_PCellParameterDeclaration ("db", "PCellParameterDeclaration",
|
||||
gsi::constructor ("new", &ctor_pcell_parameter, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"),
|
||||
"@brief Create a new parameter declaration with the given name and type\n"
|
||||
"@param name The parameter name\n"
|
||||
"@param type One of the Type... constants describing the type of the parameter\n"
|
||||
"@param description The description text\n"
|
||||
) +
|
||||
gsi::constructor ("new", &ctor_pcell_parameter_2, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"), gsi::arg ("default"),
|
||||
"@brief Create a new parameter declaration with the given name, type and default value\n"
|
||||
"@param name The parameter name\n"
|
||||
"@param type One of the Type... constants describing the type of the parameter\n"
|
||||
"@param description The description text\n"
|
||||
"@param default The default (initial) value\n"
|
||||
) +
|
||||
gsi::constructor ("new", &ctor_pcell_parameter_3, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"), gsi::arg ("default"), gsi::arg ("unit"),
|
||||
gsi::constructor ("new", &ctor_pcell_parameter, gsi::arg ("name"), gsi::arg ("type"), gsi::arg ("description"), gsi::arg ("default", tl::Variant (), "nil"), gsi::arg ("unit", std::string ()),
|
||||
"@brief Create a new parameter declaration with the given name, type, default value and unit string\n"
|
||||
"@param name The parameter name\n"
|
||||
"@param type One of the Type... constants describing the type of the parameter\n"
|
||||
|
|
@ -874,6 +843,7 @@ Class<db::PCellParameterDeclaration> decl_PCellParameterDeclaration ("db", "PCel
|
|||
"This method will add the given value with the given description to the list of\n"
|
||||
"choices. If choices are defined, KLayout will show a drop-down box instead of an\n"
|
||||
"entry field in the parameter user interface.\n"
|
||||
"If a range is already set for this parameter the choice will not be added and a warning message is showed.\n"
|
||||
) +
|
||||
gsi::method ("choice_values", &db::PCellParameterDeclaration::get_choices,
|
||||
"@brief Returns a list of choice values\n"
|
||||
|
|
@ -881,6 +851,44 @@ Class<db::PCellParameterDeclaration> decl_PCellParameterDeclaration ("db", "PCel
|
|||
gsi::method ("choice_descriptions", &db::PCellParameterDeclaration::get_choice_descriptions,
|
||||
"@brief Returns a list of choice descriptions\n"
|
||||
) +
|
||||
gsi::method ("min_value", &db::PCellParameterDeclaration::min_value,
|
||||
"@brief Gets the minimum value allowed\n"
|
||||
"See \\min_value= for a description of this attribute.\n"
|
||||
"\n"
|
||||
"This attribute has been added in version 0.29."
|
||||
) +
|
||||
gsi::method ("min_value=", &db::PCellParameterDeclaration::set_min_value, gsi::arg ("value"),
|
||||
"@brief Sets the minimum value allowed\n"
|
||||
"The minimum value is a visual feature and limits the allowed values for numerical\n"
|
||||
"entry boxes. This applies to parameters of type int or double. The minimum value\n"
|
||||
"is not effective if choices are present.\n"
|
||||
"\n"
|
||||
"The minimum value is not enforced - for example there is no restriction implemented\n"
|
||||
"when setting values programmatically.\n"
|
||||
"\n"
|
||||
"Setting this attribute to \"nil\" (the default) implies \"no limit\".\n"
|
||||
"\n"
|
||||
"This attribute has been added in version 0.29."
|
||||
) +
|
||||
gsi::method ("max_value", &db::PCellParameterDeclaration::max_value,
|
||||
"@brief Gets the maximum value allowed\n"
|
||||
"See \\max_value= for a description of this attribute.\n"
|
||||
"\n"
|
||||
"This attribute has been added in version 0.29."
|
||||
) +
|
||||
gsi::method ("max_value=", &db::PCellParameterDeclaration::set_max_value, gsi::arg ("value"),
|
||||
"@brief Sets the maximum value allowed\n"
|
||||
"The maximum value is a visual feature and limits the allowed values for numerical\n"
|
||||
"entry boxes. This applies to parameters of type int or double. The maximum value\n"
|
||||
"is not effective if choices are present.\n"
|
||||
"\n"
|
||||
"The maximum value is not enforced - for example there is no restriction implemented\n"
|
||||
"when setting values programmatically.\n"
|
||||
"\n"
|
||||
"Setting this attribute to \"nil\" (the default) implies \"no limit\".\n"
|
||||
"\n"
|
||||
"This attribute has been added in version 0.29."
|
||||
) +
|
||||
gsi::method ("default", &db::PCellParameterDeclaration::get_default,
|
||||
"@brief Gets the default value\n"
|
||||
) +
|
||||
|
|
|
|||
|
|
@ -399,6 +399,16 @@ PCellParametersPage::setup (lay::LayoutViewBase *view, int cv_index, const db::P
|
|||
m_icon_widgets.push_back (icon_label);
|
||||
m_all_widgets.back ().push_back (icon_label);
|
||||
|
||||
std::string range;
|
||||
|
||||
if (! p->min_value ().is_nil () || ! p->max_value ().is_nil ()) {
|
||||
range = tl::sprintf (
|
||||
" [%s, %s]" ,
|
||||
p->min_value ().is_nil () ? "-\u221e" /*infinity*/ : p->min_value ().to_string (),
|
||||
p->max_value ().is_nil () ? "\u221e" /*infinity*/ : p->max_value ().to_string ()
|
||||
);
|
||||
}
|
||||
|
||||
if (p->get_type () != db::PCellParameterDeclaration::t_callback) {
|
||||
|
||||
std::string leader;
|
||||
|
|
@ -406,7 +416,8 @@ PCellParametersPage::setup (lay::LayoutViewBase *view, int cv_index, const db::P
|
|||
leader = tl::sprintf ("[%s] ", p->get_name ());
|
||||
}
|
||||
|
||||
QLabel *l = new QLabel (tl::to_qstring (leader + description), inner_frame);
|
||||
QLabel *l = new QLabel (tl::to_qstring (leader + description + range), inner_frame);
|
||||
|
||||
inner_grid->addWidget (l, row, 1);
|
||||
m_all_widgets.back ().push_back (l);
|
||||
|
||||
|
|
@ -702,9 +713,11 @@ PCellParametersPage::do_parameter_changed ()
|
|||
bool ok = true;
|
||||
db::ParameterStates states = m_states;
|
||||
get_parameters (states, &ok); // includes coerce
|
||||
update_widgets_from_states (states);
|
||||
if (ok && ! lazy_evaluation ()) {
|
||||
emit edited ();
|
||||
if (ok) {
|
||||
update_widgets_from_states (states);
|
||||
if (! lazy_evaluation ()) {
|
||||
emit edited ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -762,6 +775,8 @@ PCellParametersPage::get_parameters_internal (db::ParameterStates &states, bool
|
|||
ps.set_value (tl::Variant (v));
|
||||
lay::indicate_error (le, (tl::Exception *) 0);
|
||||
|
||||
check_range(tl::Variant (v), *p);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
|
||||
lay::indicate_error (le, &ex);
|
||||
|
|
@ -786,6 +801,8 @@ PCellParametersPage::get_parameters_internal (db::ParameterStates &states, bool
|
|||
ps.set_value (tl::Variant (v));
|
||||
lay::indicate_error (le, (tl::Exception *) 0);
|
||||
|
||||
check_range(tl::Variant (v), *p);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
|
||||
lay::indicate_error (le, &ex);
|
||||
|
|
@ -1085,6 +1102,18 @@ PCellParametersPage::states_from_parameters (db::ParameterStates &states, const
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
PCellParametersPage::check_range (const tl::Variant &value, const db::PCellParameterDeclaration &decl)
|
||||
{
|
||||
if (! decl.min_value ().is_nil () && value < decl.min_value ()) {
|
||||
throw tl::Exception (tl::sprintf (tl::to_string (tr ("The value is lower than the minimum allowed value: given value is %s, minimum value is %s")), value.to_string (), decl.min_value ().to_string ()));
|
||||
}
|
||||
|
||||
if (! decl.max_value ().is_nil () && ! (value < decl.max_value () || value == decl.max_value ())) {
|
||||
throw tl::Exception (tl::sprintf (tl::to_string (tr ("The value is higher than the maximum allowed value: given value is %s, maximum value is %s")), value.to_string (), decl.max_value ().to_string ()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ private:
|
|||
void get_parameters_internal (db::ParameterStates &states, bool &edit_error);
|
||||
std::vector<tl::Variant> parameter_from_states (const db::ParameterStates &states) const;
|
||||
void states_from_parameters (db::ParameterStates &states, const std::vector<tl::Variant> ¶meters);
|
||||
void check_range (const tl::Variant& value, const db::PCellParameterDeclaration &decl);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class _PCellDeclarationHelperMixin:
|
|||
self.layer = None
|
||||
self.cell = None
|
||||
|
||||
def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None):
|
||||
def param(self, name, value_type, description, hidden = False, readonly = False, unit = None, default = None, choices = None, min_value = None, max_value = None):
|
||||
"""
|
||||
Defines a parameter
|
||||
name -> the short name of the parameter
|
||||
|
|
@ -76,6 +76,8 @@ class _PCellDeclarationHelperMixin:
|
|||
hidden -> (boolean) true, if the parameter is not shown in the dialog
|
||||
readonly -> (boolean) true, if the parameter cannot be edited
|
||||
unit -> the unit string
|
||||
min_value -> the minimum value (only effective for numerical types and if no choices are present)
|
||||
max_value -> the maximum value (only effective for numerical types and if no choices are present)
|
||||
default -> the default value
|
||||
choices -> ([ [ d, v ], ...) choice descriptions/value for choice type
|
||||
this method defines accessor methods for the parameters
|
||||
|
|
@ -102,6 +104,8 @@ class _PCellDeclarationHelperMixin:
|
|||
pdecl.readonly = readonly
|
||||
if not (default is None):
|
||||
pdecl.default = default
|
||||
pdecl.min_value = min_value
|
||||
pdecl.max_value = max_value
|
||||
if not (unit is None):
|
||||
pdecl.unit = unit
|
||||
if not (choices is None):
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -838,6 +838,13 @@ class Annotation(BasicAnnotation):
|
|||
|
||||
This constant has been introduced in version 0.25
|
||||
"""
|
||||
RulerModeAutoMetricEdge: ClassVar[int]
|
||||
r"""
|
||||
@brief Specifies edge-sensitive auto-metric ruler mode for the \register_template method
|
||||
In auto-metric mode, a ruler can be placed with a single click and p1/p2 will be determined from the edge it is placed on.
|
||||
|
||||
This constant has been introduced in version 0.29
|
||||
"""
|
||||
RulerModeNormal: ClassVar[int]
|
||||
r"""
|
||||
@brief Specifies normal ruler mode for the \register_template method
|
||||
|
|
@ -4249,7 +4256,7 @@ class LayerProperties:
|
|||
This method has been introduced in version 0.22.
|
||||
"""
|
||||
@overload
|
||||
def lower_hier_level_mode(self, arg0: bool) -> int:
|
||||
def lower_hier_level_mode(self, real: bool) -> int:
|
||||
r"""
|
||||
@brief Gets the mode for the lower hierarchy level.
|
||||
@param real If true, the computed value is returned, otherwise the local node value
|
||||
|
|
@ -4994,6 +5001,10 @@ class LayoutViewBase:
|
|||
r"""
|
||||
@brief Compares two enums
|
||||
"""
|
||||
def __hash__(self) -> int:
|
||||
r"""
|
||||
@brief Gets the hash value from the enum
|
||||
"""
|
||||
@overload
|
||||
def __init__(self, i: int) -> None:
|
||||
r"""
|
||||
|
|
@ -5004,6 +5015,10 @@ class LayoutViewBase:
|
|||
r"""
|
||||
@brief Creates an enum from a string value
|
||||
"""
|
||||
def __int__(self) -> int:
|
||||
r"""
|
||||
@brief Gets the integer value from the enum
|
||||
"""
|
||||
@overload
|
||||
def __lt__(self, other: LayoutViewBase.SelectionMode) -> bool:
|
||||
r"""
|
||||
|
|
@ -5032,6 +5047,10 @@ class LayoutViewBase:
|
|||
r"""
|
||||
@brief Gets the symbolic string from an enum
|
||||
"""
|
||||
def hash(self) -> int:
|
||||
r"""
|
||||
@brief Gets the hash value from the enum
|
||||
"""
|
||||
def inspect(self) -> str:
|
||||
r"""
|
||||
@brief Converts an enum to a visual string
|
||||
|
|
@ -6364,6 +6383,13 @@ class LayoutViewBase:
|
|||
This method returns true, if self is a const reference.
|
||||
In that case, only const methods may be called on self.
|
||||
"""
|
||||
def is_dirty(self) -> bool:
|
||||
r"""
|
||||
@brief Gets a flag indicating whether one of the layouts displayed needs saving
|
||||
A layout is 'dirty' if it is modified and needs saving. This method returns true if this is the case for at least one of the layouts shown in the view.
|
||||
|
||||
This method has been introduced in version 0.29.
|
||||
"""
|
||||
def is_editable(self) -> bool:
|
||||
r"""
|
||||
@brief Returns true if the view is in editable mode
|
||||
|
|
@ -6681,7 +6707,7 @@ class LayoutViewBase:
|
|||
|
||||
See \set_title and \title for a description about how titles are handled.
|
||||
"""
|
||||
def resize(self, arg0: int, arg1: int) -> None:
|
||||
def resize(self, w: int, h: int) -> None:
|
||||
r"""
|
||||
@brief Resizes the layout view to the given dimension
|
||||
|
||||
|
|
@ -7062,7 +7088,7 @@ class LayoutViewBase:
|
|||
|
||||
It is very important to stop the redraw thread before applying changes to the layout or the cell views and the LayoutView configuration. This is usually done automatically. For rare cases, where this is not the case, this method is provided.
|
||||
"""
|
||||
def switch_mode(self, arg0: str) -> None:
|
||||
def switch_mode(self, mode: str) -> None:
|
||||
r"""
|
||||
@brief Switches the mode.
|
||||
|
||||
|
|
@ -7204,12 +7230,16 @@ class Macro:
|
|||
@overload
|
||||
def __eq__(self, other: object) -> bool:
|
||||
r"""
|
||||
@brief Compares two enums
|
||||
@brief Compares an enum with an integer value
|
||||
"""
|
||||
@overload
|
||||
def __eq__(self, other: object) -> bool:
|
||||
r"""
|
||||
@brief Compares an enum with an integer value
|
||||
@brief Compares two enums
|
||||
"""
|
||||
def __hash__(self) -> int:
|
||||
r"""
|
||||
@brief Gets the hash value from the enum
|
||||
"""
|
||||
@overload
|
||||
def __init__(self, i: int) -> None:
|
||||
|
|
@ -7221,6 +7251,10 @@ class Macro:
|
|||
r"""
|
||||
@brief Creates an enum from a string value
|
||||
"""
|
||||
def __int__(self) -> int:
|
||||
r"""
|
||||
@brief Gets the integer value from the enum
|
||||
"""
|
||||
@overload
|
||||
def __lt__(self, other: Macro.Format) -> bool:
|
||||
r"""
|
||||
|
|
@ -7249,6 +7283,10 @@ class Macro:
|
|||
r"""
|
||||
@brief Gets the symbolic string from an enum
|
||||
"""
|
||||
def hash(self) -> int:
|
||||
r"""
|
||||
@brief Gets the hash value from the enum
|
||||
"""
|
||||
def inspect(self) -> str:
|
||||
r"""
|
||||
@brief Converts an enum to a visual string
|
||||
|
|
@ -7308,6 +7346,10 @@ class Macro:
|
|||
r"""
|
||||
@brief Compares two enums
|
||||
"""
|
||||
def __hash__(self) -> int:
|
||||
r"""
|
||||
@brief Gets the hash value from the enum
|
||||
"""
|
||||
@overload
|
||||
def __init__(self, i: int) -> None:
|
||||
r"""
|
||||
|
|
@ -7318,6 +7360,10 @@ class Macro:
|
|||
r"""
|
||||
@brief Creates an enum from a string value
|
||||
"""
|
||||
def __int__(self) -> int:
|
||||
r"""
|
||||
@brief Gets the integer value from the enum
|
||||
"""
|
||||
@overload
|
||||
def __lt__(self, other: Macro.Interpreter) -> bool:
|
||||
r"""
|
||||
|
|
@ -7331,12 +7377,12 @@ class Macro:
|
|||
@overload
|
||||
def __ne__(self, other: object) -> bool:
|
||||
r"""
|
||||
@brief Compares two enums for inequality
|
||||
@brief Compares an enum with an integer for inequality
|
||||
"""
|
||||
@overload
|
||||
def __ne__(self, other: object) -> bool:
|
||||
r"""
|
||||
@brief Compares an enum with an integer for inequality
|
||||
@brief Compares two enums for inequality
|
||||
"""
|
||||
def __repr__(self) -> str:
|
||||
r"""
|
||||
|
|
@ -7346,6 +7392,10 @@ class Macro:
|
|||
r"""
|
||||
@brief Gets the symbolic string from an enum
|
||||
"""
|
||||
def hash(self) -> int:
|
||||
r"""
|
||||
@brief Gets the hash value from the enum
|
||||
"""
|
||||
def inspect(self) -> str:
|
||||
r"""
|
||||
@brief Converts an enum to a visual string
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ class ArgType:
|
|||
r"""
|
||||
@brief Creates a copy of self
|
||||
"""
|
||||
def __eq__(self, arg0: object) -> bool:
|
||||
def __eq__(self, other: object) -> bool:
|
||||
r"""
|
||||
@brief Equality of two types
|
||||
"""
|
||||
|
|
@ -316,7 +316,7 @@ class ArgType:
|
|||
r"""
|
||||
@brief Creates a new object of this class
|
||||
"""
|
||||
def __ne__(self, arg0: object) -> bool:
|
||||
def __ne__(self, other: object) -> bool:
|
||||
r"""
|
||||
@brief Inequality of two types
|
||||
"""
|
||||
|
|
@ -1423,6 +1423,20 @@ class Method:
|
|||
r"""
|
||||
@brief Creates a new object of this class
|
||||
"""
|
||||
def __repr__(self) -> str:
|
||||
r"""
|
||||
@brief Describes the method
|
||||
This attribute returns a string description of the method and its signature.
|
||||
|
||||
This method has been introduced in version 0.29.
|
||||
"""
|
||||
def __str__(self) -> str:
|
||||
r"""
|
||||
@brief Describes the method
|
||||
This attribute returns a string description of the method and its signature.
|
||||
|
||||
This method has been introduced in version 0.29.
|
||||
"""
|
||||
def _create(self) -> None:
|
||||
r"""
|
||||
@brief Ensures the C++ object is created
|
||||
|
|
@ -1460,7 +1474,7 @@ class Method:
|
|||
|
||||
Usually it's not required to call this method. It has been introduced in version 0.24.
|
||||
"""
|
||||
def accepts_num_args(self, arg0: int) -> bool:
|
||||
def accepts_num_args(self, n: int) -> bool:
|
||||
r"""
|
||||
@brief True, if this method is compatible with the given number of arguments
|
||||
|
||||
|
|
@ -1569,6 +1583,13 @@ class Method:
|
|||
r"""
|
||||
@brief The return type of this method
|
||||
"""
|
||||
def to_s(self) -> str:
|
||||
r"""
|
||||
@brief Describes the method
|
||||
This attribute returns a string description of the method and its signature.
|
||||
|
||||
This method has been introduced in version 0.29.
|
||||
"""
|
||||
|
||||
class MethodOverload:
|
||||
r"""
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ INSTALLS = lib_target
|
|||
QMAKE_POST_LINK += && $(MKDIR) $$DESTDIR_PYMOD/$$REALMODULE && $(COPY) $$PWD/distutils_src/klayout/$$REALMODULE/*.py $$DESTDIR_PYMOD/$$REALMODULE
|
||||
}
|
||||
|
||||
POST_TARGETDEPS += $$files($$PWD/distutils_src/klayout/$$REALMODULE/*.py, false)
|
||||
|
||||
# INSTALLS needs to be inside a lib or app templates.
|
||||
modsrc_target.path = $$PREFIX/pymod/klayout/$$REALMODULE
|
||||
# This would be nice:
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ SOURCES = \
|
|||
tlEquivalenceClusters.cc \
|
||||
tlUniqueName.cc \
|
||||
tlRecipe.cc \
|
||||
tlEnv.cc
|
||||
tlEnv.cc \
|
||||
tlOptional.cc
|
||||
|
||||
HEADERS = \
|
||||
tlAlgorithm.h \
|
||||
|
|
@ -121,7 +122,8 @@ HEADERS = \
|
|||
tlUniqueName.h \
|
||||
tlRecipe.h \
|
||||
tlSelect.h \
|
||||
tlEnv.h
|
||||
tlEnv.h \
|
||||
tlOptional.h
|
||||
|
||||
equals(HAVE_GIT2, "1") {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2024 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "tlOptional.h"
|
||||
|
||||
namespace tl
|
||||
{
|
||||
|
||||
extern const nullopt_t nullopt = nullopt_t ();
|
||||
|
||||
} // namespace tl
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2024 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HDR_tlOptional
|
||||
#define HDR_tlOptional
|
||||
|
||||
#include "tlAssert.h"
|
||||
#include "tlString.h"
|
||||
#include "tlCommon.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace tl
|
||||
{
|
||||
|
||||
struct nullopt_t {};
|
||||
|
||||
extern const nullopt_t nullopt;
|
||||
|
||||
/**
|
||||
* @brief Poor man's partial implementation of C++17's std::optional
|
||||
*/
|
||||
template<typename T>
|
||||
class TL_PUBLIC_TEMPLATE optional
|
||||
{
|
||||
public:
|
||||
optional () :
|
||||
m_value (),
|
||||
m_is_valid (false)
|
||||
{}
|
||||
|
||||
optional (const nullopt_t &) :
|
||||
m_value (),
|
||||
m_is_valid (false)
|
||||
{}
|
||||
|
||||
optional (const T &value) :
|
||||
m_value (value),
|
||||
m_is_valid (true)
|
||||
{}
|
||||
|
||||
void reset ()
|
||||
{
|
||||
m_is_valid = false;
|
||||
}
|
||||
|
||||
bool has_value() const { return m_is_valid; }
|
||||
|
||||
T &value ()
|
||||
{
|
||||
tl_assert (m_is_valid);
|
||||
|
||||
return m_value;
|
||||
}
|
||||
|
||||
const T &value () const
|
||||
{
|
||||
tl_assert (m_is_valid);
|
||||
|
||||
return m_value;
|
||||
}
|
||||
|
||||
T& operator* ()
|
||||
{
|
||||
return value ();
|
||||
}
|
||||
|
||||
const T& operator* () const
|
||||
{
|
||||
return value ();
|
||||
}
|
||||
|
||||
T* operator-> ()
|
||||
{
|
||||
return m_is_valid ? &m_value : 0;
|
||||
}
|
||||
|
||||
const T* operator-> () const
|
||||
{
|
||||
return m_is_valid ? &m_value : 0;
|
||||
}
|
||||
|
||||
private:
|
||||
T m_value;
|
||||
bool m_is_valid;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
optional<T> make_optional (const T &value)
|
||||
{
|
||||
return optional<T> (value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool operator== (const optional<T> &lhs, const optional<T> &rhs)
|
||||
{
|
||||
if (lhs.has_value () != rhs.has_value ()) {
|
||||
return false;
|
||||
}
|
||||
if (!lhs.has_value ()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return lhs.value() == rhs.value();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool operator!= (const optional<T> &lhs, const optional<T> &rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::ostream &operator<< (std::ostream &ostr, const optional<T> &rhs)
|
||||
{
|
||||
if (rhs.has_value()) {
|
||||
ostr << rhs.value();
|
||||
} else {
|
||||
ostr << "<invalid>";
|
||||
}
|
||||
|
||||
return ostr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::string to_string (const optional<T> &opt)
|
||||
{
|
||||
if (opt.has_value ()) {
|
||||
return tl::to_string (*opt);
|
||||
} else {
|
||||
return std::string ();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace tl
|
||||
|
||||
#endif /* HDR_tlOptional */
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
|
||||
/*
|
||||
|
||||
KLayout Layout Viewer
|
||||
Copyright (C) 2006-2024 Matthias Koefferlein
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#include "tlOptional.h"
|
||||
#include "tlUnitTest.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
TEST(1_Basic)
|
||||
{
|
||||
tl::optional<int> opt;
|
||||
|
||||
// value not set
|
||||
|
||||
EXPECT_EQ (opt.has_value (), false);
|
||||
EXPECT_EQ (opt.operator-> (), (int *) 0);
|
||||
EXPECT_EQ (((const tl::optional<int> &) opt).operator-> (), (const int *) 0);
|
||||
EXPECT_EQ (tl::to_string (opt), "");
|
||||
|
||||
try {
|
||||
opt.value (); // asserts
|
||||
EXPECT_EQ (true, false);
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
// make_optional, assignment
|
||||
|
||||
opt = tl::make_optional (17);
|
||||
|
||||
// value set
|
||||
|
||||
EXPECT_EQ (opt.has_value (), true);
|
||||
EXPECT_EQ (opt.value (), 17);
|
||||
EXPECT_EQ (tl::to_string (opt), "17");
|
||||
EXPECT_EQ (((const tl::optional<int> &) opt).value (), 17);
|
||||
EXPECT_EQ (*opt, 17);
|
||||
EXPECT_EQ (*((const tl::optional<int> &) opt), 17);
|
||||
EXPECT_EQ (*(opt.operator-> ()), 17);
|
||||
EXPECT_EQ (*(((const tl::optional<int> &) opt).operator-> ()), 17);
|
||||
|
||||
// compare operators
|
||||
|
||||
EXPECT_EQ (opt == tl::make_optional (-1), false);
|
||||
EXPECT_EQ (opt == tl::make_optional (17), true);
|
||||
EXPECT_EQ (opt == tl::optional<int> (), false);
|
||||
|
||||
EXPECT_EQ (opt != tl::make_optional (-1), true);
|
||||
EXPECT_EQ (opt != tl::make_optional (17), false);
|
||||
EXPECT_EQ (opt != tl::optional<int> (), true);
|
||||
|
||||
// copy ctor
|
||||
|
||||
tl::optional<int> opt2 (opt);
|
||||
|
||||
EXPECT_EQ (opt2.has_value (), true);
|
||||
EXPECT_EQ (opt2.value (), 17);
|
||||
|
||||
// reset method
|
||||
|
||||
opt = tl::make_optional (17);
|
||||
opt.reset ();
|
||||
|
||||
EXPECT_EQ (opt.has_value (), false);
|
||||
EXPECT_EQ (opt == tl::optional<int> (), true);
|
||||
EXPECT_EQ (opt != tl::optional<int> (), false);
|
||||
|
||||
// tl::nullopt tag
|
||||
|
||||
opt = tl::make_optional (17);
|
||||
opt = tl::optional<int> (tl::nullopt);
|
||||
|
||||
EXPECT_EQ (opt.has_value (), false);
|
||||
EXPECT_EQ (opt == tl::optional<int> (), true);
|
||||
EXPECT_EQ (opt != tl::optional<int> (), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ SOURCES = \
|
|||
tlLongIntTests.cc \
|
||||
tlMathTests.cc \
|
||||
tlObjectTests.cc \
|
||||
tlOptionalTests.cc \
|
||||
tlPixelBufferTests.cc \
|
||||
tlResourcesTests.cc \
|
||||
tlReuseVectorTests.cc \
|
||||
|
|
|
|||
|
|
@ -190,6 +190,78 @@ def norm_hash(hash)
|
|||
end
|
||||
|
||||
|
||||
class DBPCellAPI_TestClass < TestBase
|
||||
|
||||
def test_1
|
||||
|
||||
# PCellParameterDeclaration
|
||||
|
||||
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description")
|
||||
|
||||
assert_equal(decl.name, "name")
|
||||
assert_equal(decl.description, "description")
|
||||
assert_equal(decl.default.inspect, "nil")
|
||||
assert_equal(decl.unit, "")
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
|
||||
|
||||
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17")
|
||||
|
||||
assert_equal(decl.name, "name")
|
||||
assert_equal(decl.description, "description")
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
|
||||
assert_equal(decl.default.to_s, "17")
|
||||
assert_equal(decl.unit, "")
|
||||
|
||||
decl = RBA::PCellParameterDeclaration::new("name", RBA::PCellParameterDeclaration::TypeString, "description", "17", "unit")
|
||||
|
||||
assert_equal(decl.name, "name")
|
||||
assert_equal(decl.description, "description")
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeString)
|
||||
assert_equal(decl.default.to_s, "17")
|
||||
assert_equal(decl.unit, "unit")
|
||||
|
||||
decl.name = "n"
|
||||
assert_equal(decl.name, "n")
|
||||
decl.description = "d"
|
||||
assert_equal(decl.description, "d")
|
||||
decl.unit = "u"
|
||||
assert_equal(decl.unit, "u")
|
||||
decl.type = RBA::PCellParameterDeclaration::TypeBoolean
|
||||
assert_equal(decl.type, RBA::PCellParameterDeclaration::TypeBoolean)
|
||||
decl.default = true
|
||||
assert_equal(decl.default.to_s, "true")
|
||||
|
||||
decl.type = RBA::PCellParameterDeclaration::TypeInt
|
||||
assert_equal(decl.min_value.inspect, "nil")
|
||||
assert_equal(decl.max_value.inspect, "nil")
|
||||
decl.min_value = "-1"
|
||||
assert_equal(decl.min_value.to_s, "-1")
|
||||
decl.max_value = "42"
|
||||
assert_equal(decl.max_value.to_s, "42")
|
||||
decl.min_value = nil
|
||||
decl.max_value = nil
|
||||
assert_equal(decl.min_value.inspect, "nil")
|
||||
assert_equal(decl.max_value.inspect, "nil")
|
||||
|
||||
assert_equal(decl.hidden?, false)
|
||||
decl.hidden = true
|
||||
assert_equal(decl.hidden?, true)
|
||||
|
||||
assert_equal(decl.readonly?, false)
|
||||
decl.readonly = true
|
||||
assert_equal(decl.readonly?, true)
|
||||
|
||||
decl.add_choice("first", 42)
|
||||
assert_equal(decl.choice_values, [42])
|
||||
assert_equal(decl.choice_descriptions, ["first"])
|
||||
decl.clear_choices
|
||||
assert_equal(decl.choice_values, [])
|
||||
assert_equal(decl.choice_descriptions, [])
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class DBPCell_TestClass < TestBase
|
||||
|
||||
def test_1
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
# This script is sourced to define the main version parameters
|
||||
|
||||
# The main version
|
||||
KLAYOUT_VERSION="0.28.17"
|
||||
KLAYOUT_VERSION="0.29.0"
|
||||
|
||||
# The version used for PyPI (don't use variables here!)
|
||||
KLAYOUT_PYPI_VERSION="0.28.17"
|
||||
KLAYOUT_PYPI_VERSION="0.29.0"
|
||||
|
||||
# The build date
|
||||
KLAYOUT_VERSION_DATE=$(date "+%Y-%m-%d")
|
||||
|
|
|
|||
Loading…
Reference in New Issue