1
/***************************************************************************
2
* Copyright (c) 2007 Werner Mayer <wmayer@users.sourceforge.net> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
24
#include "PreCompiled.h"
26
#include "Workbench.h"
27
#include "WorkbenchManager.h"
29
// inclusion of the generated files (generated out of WorkbenchPy.xml)
30
#include "WorkbenchPy.h"
31
#include "WorkbenchPy.cpp"
35
/** @class WorkbenchPy
36
* The workbench Python base class doesn't allow you to manipulate the C++ workbench class behind.
37
* You're only allowed either to activate the workbench class or get its name.
38
* The WorkbenchPy class is associated to all C++ workbench classes except of PythonWorkbench.
40
* @see PythonWorkbench
41
* @see PythonWorkbenchPy
42
* @author Werner Mayer
45
// returns a string which represent the object e.g. when printed in python
46
const char *WorkbenchPy::representation(void) const
48
return "<Workbench object>";
51
/** Retrieves the workbench name */
52
PyObject* WorkbenchPy::name(PyObject *args)
55
std::string name = getWorkbenchPtr()->name();
56
PyObject* pyName = PyString_FromString(name.c_str());
61
/** Activates the workbench object */
62
PyObject* WorkbenchPy::activate(PyObject *args)
65
std::string name = getWorkbenchPtr()->name();
66
WorkbenchManager::instance()->activate( name, getWorkbenchPtr()->getTypeId().getName() );
71
PyObject *WorkbenchPy::getCustomAttributes(const char* attr) const
76
int WorkbenchPy::setCustomAttributes(const char* attr, PyObject *obj)