All: Reformat according to new standard
This commit is contained in:
committed by
Kacper Donat
parent
eafd18dac0
commit
25c3ba7338
@@ -21,8 +21,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "Workbench.h"
|
||||
#include "WorkbenchManager.h"
|
||||
|
||||
@@ -49,72 +47,87 @@ std::string WorkbenchPy::representation() const
|
||||
}
|
||||
|
||||
/** Retrieves the workbench name */
|
||||
PyObject* WorkbenchPy::name(PyObject *args)
|
||||
PyObject* WorkbenchPy::name(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PY_TRY {
|
||||
PY_TRY
|
||||
{
|
||||
Py::String name(getWorkbenchPtr()->name());
|
||||
return Py::new_reference_to(name);
|
||||
}PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
/** Activates the workbench object */
|
||||
PyObject* WorkbenchPy::activate(PyObject *args)
|
||||
PyObject* WorkbenchPy::activate(PyObject* args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PY_TRY {
|
||||
PY_TRY
|
||||
{
|
||||
std::string name = getWorkbenchPtr()->name();
|
||||
WorkbenchManager::instance()->activate( name, getWorkbenchPtr()->getTypeId().getName() );
|
||||
WorkbenchManager::instance()->activate(name, getWorkbenchPtr()->getTypeId().getName());
|
||||
Py_Return;
|
||||
}PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
/** Shows a list of all menus */
|
||||
PyObject* WorkbenchPy::listMenus(PyObject *args)
|
||||
PyObject* WorkbenchPy::listMenus(PyObject* args)
|
||||
{
|
||||
PY_TRY {
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
PY_TRY
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::list<std::string> menus = getWorkbenchPtr()->listMenus();
|
||||
|
||||
Py::List list;
|
||||
for (const auto & menu : menus) {
|
||||
for (const auto& menu : menus) {
|
||||
list.append(Py::String(menu));
|
||||
}
|
||||
return Py::new_reference_to(list);
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
/** Shows a list of all toolbars */
|
||||
PyObject* WorkbenchPy::listToolbars(PyObject *args)
|
||||
PyObject* WorkbenchPy::listToolbars(PyObject* args)
|
||||
{
|
||||
PY_TRY {
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
PY_TRY
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::list<std::string> bars = getWorkbenchPtr()->listToolbars();
|
||||
|
||||
Py::List list;
|
||||
for (const auto & bar : bars) {
|
||||
for (const auto& bar : bars) {
|
||||
list.append(Py::String(bar));
|
||||
}
|
||||
return Py::new_reference_to(list);
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
/** Shows a dict of all toolbars and their commands*/
|
||||
PyObject* WorkbenchPy::getToolbarItems(PyObject *args)
|
||||
PyObject* WorkbenchPy::getToolbarItems(PyObject* args)
|
||||
{
|
||||
PY_TRY {
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
PY_TRY
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::list<std::pair<std::string, std::list<std::string>>> bars = getWorkbenchPtr()->getToolbarItems();
|
||||
std::list<std::pair<std::string, std::list<std::string>>> bars
|
||||
= getWorkbenchPtr()->getToolbarItems();
|
||||
|
||||
Py::Dict dict;
|
||||
for (const auto& it : bars) {
|
||||
@@ -125,38 +138,46 @@ PyObject* WorkbenchPy::getToolbarItems(PyObject *args)
|
||||
dict.setItem(it.first, list);
|
||||
}
|
||||
return Py::new_reference_to(dict);
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
/** Shows a list of all command bars */
|
||||
PyObject* WorkbenchPy::listCommandbars(PyObject *args)
|
||||
PyObject* WorkbenchPy::listCommandbars(PyObject* args)
|
||||
{
|
||||
PY_TRY {
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
PY_TRY
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::list<std::string> bars = getWorkbenchPtr()->listCommandbars();
|
||||
|
||||
Py::List list;
|
||||
for (const auto & bar : bars) {
|
||||
for (const auto& bar : bars) {
|
||||
list.append(Py::String(bar));
|
||||
}
|
||||
return Py::new_reference_to(list);
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
/** Reload the workbench */
|
||||
PyObject* WorkbenchPy::reloadActive(PyObject *args)
|
||||
PyObject* WorkbenchPy::reloadActive(PyObject* args)
|
||||
{
|
||||
PY_TRY {
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
PY_TRY
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, "")) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Workbench* active = Gui::WorkbenchManager::instance()->active();
|
||||
if (active)
|
||||
if (active) {
|
||||
active->activate();
|
||||
}
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject* WorkbenchPy::getCustomAttributes(const char*) const
|
||||
@@ -164,7 +185,7 @@ PyObject* WorkbenchPy::getCustomAttributes(const char*) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int WorkbenchPy::setCustomAttributes(const char*, PyObject *)
|
||||
int WorkbenchPy::setCustomAttributes(const char*, PyObject*)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user