Skip to content

Commit 29504f5

Browse files
chaterpaulADO Sync
andauthored
Sync changes from v24-0-1 (#8)
Co-authored-by: ADO Sync <ado-sync@bentley.com>
1 parent b3262d5 commit 29504f5

157 files changed

Lines changed: 37309 additions & 60165 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
* @chaterpaul
1313

14-
.github/CODEOWNERS @chaterpaul
14+
.github/CODEOWNERS.* @chaterpaul
1515

1616
.gitignore @chaterpaul
1717

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ You may be asked to clarify things or try different approaches, so please follow
6565
We'd love to accept your contributions to MicroStation Python.
6666
There are just a few guidelines you need to follow.
6767

68+
### Contributor License Agreement (CLA)
69+
70+
A [Contribution License Agreement with Bentley](https://gist.github.com/imodeljs-admin/9a071844d3a8d420092b5cf360e978ca) must be signed before your contributions will be accepted. Upon opening a pull request, you will be prompted to use [cla-assistant](https://cla-assistant.io/) for a one-time acceptance applicable for all Bentley projects.
71+
You can read more about [Contributor License Agreements](https://en.wikipedia.org/wiki/Contributor_License_Agreement) on Wikipedia.
72+
6873
### Pull Requests
6974

7075
All submissions go through a review process.

InternalAPI/CallbackHelper.h

Lines changed: 910 additions & 0 deletions
Large diffs are not rendered by default.

InternalAPI/MSPyBindTemplates.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@
77
+--------------------------------------------------------------------------------------*/
88
#pragma once
99

10+
template <typename T>
11+
struct TypeWrapper
12+
{
13+
public:
14+
T value;
15+
TypeWrapper()
16+
{
17+
}
18+
TypeWrapper(T val)
19+
{
20+
value = val;
21+
}
22+
};
23+
24+
template <typename T>
25+
py::class_<TypeWrapper<T>> bind_TypeWrapper(py::handle scope, std::string const& name)
26+
{
27+
py::class_<TypeWrapper<T>> cl(scope, name.c_str());
28+
29+
cl.def(py::init<>());
30+
cl.def(py::init<T>());
31+
cl.def_readwrite("value", &TypeWrapper<T>::value);
32+
33+
return cl;
34+
};
35+
36+
typedef TypeWrapper<int> IntWrapper;
37+
typedef TypeWrapper<double> DoubleWrapper;
38+
typedef TypeWrapper<bool> BoolWrapper;
39+
1040
// template<typename T> struct ValueSizeSize
1141
template <typename ValueType, typename holder_type = std::unique_ptr< ValueSizeSize<ValueType> >, typename... Args>
1242
py::class_<ValueSizeSize<ValueType>, holder_type> bind_ValueSizeSize(py::handle scope, std::string const& name, Args &&...args)

InternalAPI/MSPythonEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ struct PythonScriptEngine : public ScriptEngine
131131
virtual ScriptValuePtr eval(WCharCP expr, ScriptContext* global = nullptr, ScriptContext* locals = nullptr);
132132
virtual void exec(WCharCP stms, WCharCP funcName, ScriptContext* global = nullptr, ScriptContext* locals = nullptr);
133133
virtual void eval_file(WCharCP fileName, WCharCP funcName, ScriptContext* global = nullptr, ScriptContext* locals = nullptr);
134-
135134
private:
136135
void InitSearchPath();
137136
};
@@ -160,6 +159,7 @@ struct ScopeMapManager
160159

161160
MSPYTHONDLL_EXPORT static PythonScopeMap& GetScopeMapInstance();
162161
MSPYTHONDLL_EXPORT static void ReleaseScopeMapInstance();
162+
163163
};
164164

165165
END_BENTLEY_MSTNPLATFORM_MSPYTHON_NAMESPACE

InternalAPI/OpqueTypes_DgnPlatform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ DEFINE_BVECTOR_TYPE(DgnRasterP, DgnRasterVector);
1818
DEFINE_BVECTOR_TYPE(DgnPlatform::GeoreferencePriority, GeoreferencePriorityVector);
1919

2020
DEFINE_BVECTOR_TYPE(DgnECInstancePtr, DgnECInstanceVector);
21+
DEFINE_BVECTOR_TYPE(DgnTagDefinition, DgnTagDefinitionArray);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*--------------------------------------------------------------------------------------+
2+
|
3+
| $Source: MSPython\InternalAPI\OpqueTypes_MstnPlatform.h $
4+
|
5+
| $Copyright: (c) 2023 Bentley Systems, Incorporated. All rights reserved. $
6+
|
7+
+--------------------------------------------------------------------------------------*/
8+
#pragma once
9+
#include <Mstn/Plot/PlotApi.h>
10+
#include <Mstn/Plot/IPrintDescription.h>
11+
#include <Mstn/Plot/IPlotElemDisplayParams.h>
12+
#include <Mstn/Plot/IPlotter.h>
13+
#include <Mstn/Plot/IPrintEngine.h>
14+
#include <Mstn/Plot/IPrinterDriver.h>
15+
#include <Mstn/Plot/IPlotHook.h>
16+
17+
// Opaque types
18+
DEFINE_BVECTOR_TYPE(PrintStyleName, PrintStyleNameArray);
19+
DEFINE_BVECTOR_TYPE(PlotPaperSizeInfo, PlotPaperSizeInfoArray);
20+
DEFINE_BVECTOR_TYPE(LevelOverrideInfo, LevelOverrideInfoArray);
21+
DEFINE_BVECTOR_TYPE(ReferenceOverrideInfo, ReferenceOverrideInfoArray);

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright © Bentley Systems, Incorporated. All rights reserved.
3+
Copyright © 2017-2024 Bentley Systems, Incorporated. All rights reserved.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

MSPythonCore/ScriptEngineManager/source/MSPythonEngine.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,14 @@ bool PythonScriptValue::asString(Utf8StringR outVal)
183183
+---------------+---------------+---------------+---------------+---------------+------*/
184184
PythonScriptContext::PythonScriptContext(bool global)
185185
{
186-
m_dict = global ? py::globals() : py::dict();
186+
if (global)
187+
{
188+
m_dict = py::dict();
189+
for (auto item : py::globals())
190+
m_dict[item.first] = item.second;
191+
}
192+
else
193+
m_dict = py::dict();
187194
}
188195

189196
/*---------------------------------------------------------------------------------**//**
@@ -638,7 +645,7 @@ bool PythonScriptEngine::AddCmdLineArgs(bvector<WString>& args)
638645
if (!argvList)
639646
return false;
640647
if (!argvList.empty())
641-
argvList.attr("pop")(); // remove first empty element
648+
argvList.attr("clear")(); // remove last used arguments
642649

643650
for (auto& it : args)
644651
{
@@ -870,6 +877,9 @@ void PythonScriptEngine::eval_file(WCharCP scriptFile, WCharCP funcName, ScriptC
870877

871878
}
872879

880+
/*---------------------------------------------------------------------------------**//***
881+
@bsimethod
882+
+---------------+---------------+---------------+---------------+---------------+------*/
873883
void PythonScriptEngine::InitSearchPath ()
874884
{
875885
BeFileName rootPath(Py_GetProgramFullPath());

MSPythonPCH.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ USING_NAMESPACE_BENTLEY_MSTNPLATFORM
5454
USING_NAMESPACE_BENTLEY_MSTNPLATFORM_ELEMENT
5555
USING_NAMESPACE_BENTLEY_DGNPLATFORM
5656
USING_NAMESPACE_BENTLEY_ECOBJECT
57+
USING_NAMESPACE_BENTLEY_MSTNPLATFORM_PRINT
5758

5859
namespace py = pybind11;
5960
using namespace py::literals;

0 commit comments

Comments
 (0)