Implement empty workbench to access from python
This commit is contained in:
parent
570b493793
commit
6a77635bdb
|
@ -928,7 +928,7 @@ bool Application::activateWorkbench(const char* name)
|
||||||
Py::Tuple args;
|
Py::Tuple args;
|
||||||
Py::String result(method.apply(args));
|
Py::String result(method.apply(args));
|
||||||
type = result.as_std_string();
|
type = result.as_std_string();
|
||||||
if (type == "Gui::PythonWorkbench") {
|
if (Base::Type::fromName(type.c_str()).isDerivedFrom(Gui::PythonBaseWorkbench::getClassTypeId())) {
|
||||||
Workbench* wb = WorkbenchManager::instance()->createWorkbench(name, type);
|
Workbench* wb = WorkbenchManager::instance()->createWorkbench(name, type);
|
||||||
handler.setAttr(std::string("__Workbench__"), Py::Object(wb->getPyObject(), true));
|
handler.setAttr(std::string("__Workbench__"), Py::Object(wb->getPyObject(), true));
|
||||||
}
|
}
|
||||||
|
@ -1411,6 +1411,8 @@ void Application::initTypes(void)
|
||||||
Gui::BlankWorkbench ::init();
|
Gui::BlankWorkbench ::init();
|
||||||
Gui::NoneWorkbench ::init();
|
Gui::NoneWorkbench ::init();
|
||||||
Gui::TestWorkbench ::init();
|
Gui::TestWorkbench ::init();
|
||||||
|
Gui::PythonBaseWorkbench ::init();
|
||||||
|
Gui::PythonBlankWorkbench ::init();
|
||||||
Gui::PythonWorkbench ::init();
|
Gui::PythonWorkbench ::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<PythonExport
|
<PythonExport
|
||||||
Father="WorkbenchPy"
|
Father="WorkbenchPy"
|
||||||
Name="PythonWorkbenchPy"
|
Name="PythonWorkbenchPy"
|
||||||
Twin="PythonWorkbench"
|
Twin="PythonBaseWorkbench"
|
||||||
TwinPointer="PythonWorkbench"
|
TwinPointer="PythonBaseWorkbench"
|
||||||
Include="Gui/Workbench.h"
|
Include="Gui/Workbench.h"
|
||||||
Namespace="Gui"
|
Namespace="Gui"
|
||||||
FatherInclude="Gui/WorkbenchPy.h"
|
FatherInclude="Gui/WorkbenchPy.h"
|
||||||
|
|
|
@ -96,7 +96,7 @@ PyObject* PythonWorkbenchPy::appendMenu(PyObject *args)
|
||||||
return NULL; // NULL triggers exception
|
return NULL; // NULL triggers exception
|
||||||
}
|
}
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->appendMenu( path, items );
|
getPythonBaseWorkbenchPtr()->appendMenu( path, items );
|
||||||
|
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
|
@ -110,7 +110,7 @@ PyObject* PythonWorkbenchPy::removeMenu(PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "s", &psMenu)) // convert args: Python->C
|
if (!PyArg_ParseTuple(args, "s", &psMenu)) // convert args: Python->C
|
||||||
return NULL; // NULL triggers exception
|
return NULL; // NULL triggers exception
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->removeMenu( psMenu );
|
getPythonBaseWorkbenchPtr()->removeMenu( psMenu );
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ PyObject* PythonWorkbenchPy::removeMenu(PyObject *args)
|
||||||
PyObject* PythonWorkbenchPy::listMenus(PyObject *args)
|
PyObject* PythonWorkbenchPy::listMenus(PyObject *args)
|
||||||
{
|
{
|
||||||
PY_TRY {
|
PY_TRY {
|
||||||
std::list<std::string> menus = getPythonWorkbenchPtr()->listMenus();
|
std::list<std::string> menus = getPythonBaseWorkbenchPtr()->listMenus();
|
||||||
|
|
||||||
PyObject* pyList = PyList_New(menus.size());
|
PyObject* pyList = PyList_New(menus.size());
|
||||||
int i=0;
|
int i=0;
|
||||||
|
@ -180,7 +180,7 @@ PyObject* PythonWorkbenchPy::appendContextMenu(PyObject *args)
|
||||||
return NULL; // NULL triggers exception
|
return NULL; // NULL triggers exception
|
||||||
}
|
}
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->appendContextMenu( path, items );
|
getPythonBaseWorkbenchPtr()->appendContextMenu( path, items );
|
||||||
|
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
|
@ -194,7 +194,7 @@ PyObject* PythonWorkbenchPy::removeContextMenu(PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "s", &psMenu)) // convert args: Python->C
|
if (!PyArg_ParseTuple(args, "s", &psMenu)) // convert args: Python->C
|
||||||
return NULL; // NULL triggers exception
|
return NULL; // NULL triggers exception
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->removeContextMenu( psMenu );
|
getPythonBaseWorkbenchPtr()->removeContextMenu( psMenu );
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ PyObject* PythonWorkbenchPy::appendToolbar(PyObject *args)
|
||||||
items.push_back(pItem);
|
items.push_back(pItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->appendToolbar( psToolBar, items );
|
getPythonBaseWorkbenchPtr()->appendToolbar( psToolBar, items );
|
||||||
|
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
|
@ -236,7 +236,7 @@ PyObject* PythonWorkbenchPy::removeToolbar(PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "s", &psToolBar)) // convert args: Python->C
|
if (!PyArg_ParseTuple(args, "s", &psToolBar)) // convert args: Python->C
|
||||||
return NULL; // NULL triggers exception
|
return NULL; // NULL triggers exception
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->removeToolbar( psToolBar );
|
getPythonBaseWorkbenchPtr()->removeToolbar( psToolBar );
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ PyObject* PythonWorkbenchPy::removeToolbar(PyObject *args)
|
||||||
PyObject* PythonWorkbenchPy::listToolbars(PyObject *args)
|
PyObject* PythonWorkbenchPy::listToolbars(PyObject *args)
|
||||||
{
|
{
|
||||||
PY_TRY {
|
PY_TRY {
|
||||||
std::list<std::string> bars = getPythonWorkbenchPtr()->listToolbars();
|
std::list<std::string> bars = getPythonBaseWorkbenchPtr()->listToolbars();
|
||||||
|
|
||||||
PyObject* pyList = PyList_New(bars.size());
|
PyObject* pyList = PyList_New(bars.size());
|
||||||
int i=0;
|
int i=0;
|
||||||
|
@ -280,7 +280,7 @@ PyObject* PythonWorkbenchPy::appendCommandbar(PyObject *args)
|
||||||
items.push_back(pItem);
|
items.push_back(pItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->appendCommandbar( psToolBar, items );
|
getPythonBaseWorkbenchPtr()->appendCommandbar( psToolBar, items );
|
||||||
|
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
|
@ -294,7 +294,7 @@ PyObject* PythonWorkbenchPy::removeCommandbar(PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "s", &psToolBar)) // convert args: Python->C
|
if (!PyArg_ParseTuple(args, "s", &psToolBar)) // convert args: Python->C
|
||||||
return NULL; // NULL triggers exception
|
return NULL; // NULL triggers exception
|
||||||
|
|
||||||
getPythonWorkbenchPtr()->removeCommandbar( psToolBar );
|
getPythonBaseWorkbenchPtr()->removeCommandbar( psToolBar );
|
||||||
Py_Return;
|
Py_Return;
|
||||||
} PY_CATCH;
|
} PY_CATCH;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ PyObject* PythonWorkbenchPy::removeCommandbar(PyObject *args)
|
||||||
PyObject* PythonWorkbenchPy::listCommandbars(PyObject *args)
|
PyObject* PythonWorkbenchPy::listCommandbars(PyObject *args)
|
||||||
{
|
{
|
||||||
PY_TRY {
|
PY_TRY {
|
||||||
std::list<std::string> bars = getPythonWorkbenchPtr()->listCommandbars();
|
std::list<std::string> bars = getPythonBaseWorkbenchPtr()->listCommandbars();
|
||||||
|
|
||||||
PyObject* pyList = PyList_New(bars.size());
|
PyObject* pyList = PyList_New(bars.size());
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
|
@ -173,6 +173,7 @@ using namespace Gui;
|
||||||
* \section moredetails More details and limitations
|
* \section moredetails More details and limitations
|
||||||
* One of the key concepts of the workbench framework is to load a module at runtime when the user needs some function that it
|
* One of the key concepts of the workbench framework is to load a module at runtime when the user needs some function that it
|
||||||
* provides. So, if the user doesn't need a module it never gets loaded into RAM. This speeds up the startup procedure of
|
* provides. So, if the user doesn't need a module it never gets loaded into RAM. This speeds up the startup procedure of
|
||||||
|
|
||||||
* FreeCAD and saves memory.
|
* FreeCAD and saves memory.
|
||||||
* At startup FreeCAD scans all module directories and invokes InitGui.py. So an item for a workbench gets created. If the user
|
* At startup FreeCAD scans all module directories and invokes InitGui.py. So an item for a workbench gets created. If the user
|
||||||
* clicks on such an item the matching module gets loaded, the C++ workbench gets registered and activated.
|
* clicks on such an item the matching module gets loaded, the C++ workbench gets registered and activated.
|
||||||
|
@ -750,30 +751,26 @@ ToolBarItem* TestWorkbench::setupCommandBars() const
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
TYPESYSTEM_SOURCE(Gui::PythonWorkbench, Gui::Workbench)
|
TYPESYSTEM_SOURCE(Gui::PythonBaseWorkbench, Gui::Workbench)
|
||||||
|
|
||||||
PythonWorkbench::PythonWorkbench() : _workbenchPy(0)
|
PythonBaseWorkbench::PythonBaseWorkbench()
|
||||||
|
: _menuBar(0), _contextMenu(0), _toolBar(0), _commandBar(0), _workbenchPy(0)
|
||||||
{
|
{
|
||||||
_menuBar = StdWorkbench::setupMenuBar();
|
|
||||||
_contextMenu = new MenuItem;
|
|
||||||
_toolBar = StdWorkbench::setupToolBars();
|
|
||||||
_commandBar = new ToolBarItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PythonWorkbench::~PythonWorkbench()
|
PythonBaseWorkbench::~PythonBaseWorkbench()
|
||||||
{
|
{
|
||||||
delete _menuBar;
|
delete _menuBar;
|
||||||
delete _contextMenu;
|
delete _contextMenu;
|
||||||
delete _toolBar;
|
delete _toolBar;
|
||||||
delete _commandBar;
|
delete _commandBar;
|
||||||
if (_workbenchPy)
|
if (_workbenchPy) {
|
||||||
{
|
|
||||||
_workbenchPy->setInvalid();
|
_workbenchPy->setInvalid();
|
||||||
_workbenchPy->DecRef();
|
_workbenchPy->DecRef();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* PythonWorkbench::getPyObject()
|
PyObject* PythonBaseWorkbench::getPyObject()
|
||||||
{
|
{
|
||||||
if (!_workbenchPy)
|
if (!_workbenchPy)
|
||||||
{
|
{
|
||||||
|
@ -786,31 +783,35 @@ PyObject* PythonWorkbench::getPyObject()
|
||||||
return _workbenchPy;
|
return _workbenchPy;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem* PythonWorkbench::setupMenuBar() const
|
MenuItem* PythonBaseWorkbench::setupMenuBar() const
|
||||||
{
|
{
|
||||||
return _menuBar->copy();
|
return _menuBar->copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolBarItem* PythonWorkbench::setupToolBars() const
|
ToolBarItem* PythonBaseWorkbench::setupToolBars() const
|
||||||
{
|
{
|
||||||
return _toolBar->copy();
|
return _toolBar->copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolBarItem* PythonWorkbench::setupCommandBars() const
|
ToolBarItem* PythonBaseWorkbench::setupCommandBars() const
|
||||||
{
|
{
|
||||||
return _commandBar->copy();
|
return _commandBar->copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::setupContextMenu(const char* recipient, MenuItem* item) const
|
DockWindowItems* PythonBaseWorkbench::setupDockWindows() const
|
||||||
|
{
|
||||||
|
return new DockWindowItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PythonBaseWorkbench::setupContextMenu(const char* recipient, MenuItem* item) const
|
||||||
{
|
{
|
||||||
StdWorkbench::setupContextMenu(recipient, item);
|
|
||||||
QList<MenuItem*> items = _contextMenu->getItems();
|
QList<MenuItem*> items = _contextMenu->getItems();
|
||||||
for (QList<MenuItem*>::Iterator it = items.begin(); it != items.end(); ++it) {
|
for (QList<MenuItem*>::Iterator it = items.begin(); it != items.end(); ++it) {
|
||||||
item->appendItem((*it)->copy());
|
item->appendItem((*it)->copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::appendMenu(const std::list<std::string>& menu, const std::list<std::string>& items) const
|
void PythonBaseWorkbench::appendMenu(const std::list<std::string>& menu, const std::list<std::string>& items) const
|
||||||
{
|
{
|
||||||
if ( menu.empty() || items.empty() )
|
if ( menu.empty() || items.empty() )
|
||||||
return;
|
return;
|
||||||
|
@ -841,7 +842,7 @@ void PythonWorkbench::appendMenu(const std::list<std::string>& menu, const std::
|
||||||
*item << *it;
|
*item << *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::removeMenu(const std::string& menu) const
|
void PythonBaseWorkbench::removeMenu(const std::string& menu) const
|
||||||
{
|
{
|
||||||
MenuItem* item = _menuBar->findItem(menu);
|
MenuItem* item = _menuBar->findItem(menu);
|
||||||
if ( item ) {
|
if ( item ) {
|
||||||
|
@ -850,7 +851,7 @@ void PythonWorkbench::removeMenu(const std::string& menu) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> PythonWorkbench::listMenus() const
|
std::list<std::string> PythonBaseWorkbench::listMenus() const
|
||||||
{
|
{
|
||||||
std::list<std::string> menus;
|
std::list<std::string> menus;
|
||||||
QList<MenuItem*> items = _menuBar->getItems();
|
QList<MenuItem*> items = _menuBar->getItems();
|
||||||
|
@ -859,7 +860,7 @@ std::list<std::string> PythonWorkbench::listMenus() const
|
||||||
return menus;
|
return menus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::appendContextMenu(const std::list<std::string>& menu, const std::list<std::string>& items) const
|
void PythonBaseWorkbench::appendContextMenu(const std::list<std::string>& menu, const std::list<std::string>& items) const
|
||||||
{
|
{
|
||||||
MenuItem* item = _contextMenu;
|
MenuItem* item = _contextMenu;
|
||||||
for (std::list<std::string>::const_iterator jt=menu.begin();jt!=menu.end();++jt) {
|
for (std::list<std::string>::const_iterator jt=menu.begin();jt!=menu.end();++jt) {
|
||||||
|
@ -875,7 +876,7 @@ void PythonWorkbench::appendContextMenu(const std::list<std::string>& menu, cons
|
||||||
*item << *it;
|
*item << *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::removeContextMenu(const std::string& menu) const
|
void PythonBaseWorkbench::removeContextMenu(const std::string& menu) const
|
||||||
{
|
{
|
||||||
MenuItem* item = _contextMenu->findItem(menu);
|
MenuItem* item = _contextMenu->findItem(menu);
|
||||||
if (item) {
|
if (item) {
|
||||||
|
@ -884,12 +885,12 @@ void PythonWorkbench::removeContextMenu(const std::string& menu) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::clearContextMenu()
|
void PythonBaseWorkbench::clearContextMenu()
|
||||||
{
|
{
|
||||||
_contextMenu->clear();
|
_contextMenu->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::appendToolbar(const std::string& bar, const std::list<std::string>& items) const
|
void PythonBaseWorkbench::appendToolbar(const std::string& bar, const std::list<std::string>& items) const
|
||||||
{
|
{
|
||||||
ToolBarItem* item = _toolBar->findItem(bar);
|
ToolBarItem* item = _toolBar->findItem(bar);
|
||||||
if (!item)
|
if (!item)
|
||||||
|
@ -902,7 +903,7 @@ void PythonWorkbench::appendToolbar(const std::string& bar, const std::list<std:
|
||||||
*item << *it;
|
*item << *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::removeToolbar(const std::string& bar) const
|
void PythonBaseWorkbench::removeToolbar(const std::string& bar) const
|
||||||
{
|
{
|
||||||
ToolBarItem* item = _toolBar->findItem(bar);
|
ToolBarItem* item = _toolBar->findItem(bar);
|
||||||
if (item) {
|
if (item) {
|
||||||
|
@ -911,7 +912,7 @@ void PythonWorkbench::removeToolbar(const std::string& bar) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> PythonWorkbench::listToolbars() const
|
std::list<std::string> PythonBaseWorkbench::listToolbars() const
|
||||||
{
|
{
|
||||||
std::list<std::string> bars;
|
std::list<std::string> bars;
|
||||||
QList<ToolBarItem*> items = _toolBar->getItems();
|
QList<ToolBarItem*> items = _toolBar->getItems();
|
||||||
|
@ -920,7 +921,7 @@ std::list<std::string> PythonWorkbench::listToolbars() const
|
||||||
return bars;
|
return bars;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::appendCommandbar(const std::string& bar, const std::list<std::string>& items) const
|
void PythonBaseWorkbench::appendCommandbar(const std::string& bar, const std::list<std::string>& items) const
|
||||||
{
|
{
|
||||||
ToolBarItem* item = _commandBar->findItem( bar );
|
ToolBarItem* item = _commandBar->findItem( bar );
|
||||||
if ( !item )
|
if ( !item )
|
||||||
|
@ -933,7 +934,7 @@ void PythonWorkbench::appendCommandbar(const std::string& bar, const std::list<s
|
||||||
*item << *it;
|
*item << *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonWorkbench::removeCommandbar(const std::string& bar) const
|
void PythonBaseWorkbench::removeCommandbar(const std::string& bar) const
|
||||||
{
|
{
|
||||||
ToolBarItem* item = _commandBar->findItem(bar);
|
ToolBarItem* item = _commandBar->findItem(bar);
|
||||||
if ( item ) {
|
if ( item ) {
|
||||||
|
@ -942,7 +943,7 @@ void PythonWorkbench::removeCommandbar(const std::string& bar) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> PythonWorkbench::listCommandbars() const
|
std::list<std::string> PythonBaseWorkbench::listCommandbars() const
|
||||||
{
|
{
|
||||||
std::list<std::string> bars;
|
std::list<std::string> bars;
|
||||||
QList<ToolBarItem*> items = _commandBar->getItems();
|
QList<ToolBarItem*> items = _commandBar->getItems();
|
||||||
|
@ -951,3 +952,69 @@ std::list<std::string> PythonWorkbench::listCommandbars() const
|
||||||
return bars;
|
return bars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
TYPESYSTEM_SOURCE(Gui::PythonBlankWorkbench, Gui::PythonBaseWorkbench)
|
||||||
|
|
||||||
|
PythonBlankWorkbench::PythonBlankWorkbench()
|
||||||
|
{
|
||||||
|
_menuBar = new MenuItem;
|
||||||
|
_contextMenu = new MenuItem;
|
||||||
|
_toolBar = new ToolBarItem;
|
||||||
|
_commandBar = new ToolBarItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
PythonBlankWorkbench::~PythonBlankWorkbench()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
TYPESYSTEM_SOURCE(Gui::PythonWorkbench, Gui::PythonBaseWorkbench)
|
||||||
|
|
||||||
|
PythonWorkbench::PythonWorkbench()
|
||||||
|
{
|
||||||
|
StdWorkbench wb;
|
||||||
|
_menuBar = wb.setupMenuBar();
|
||||||
|
_contextMenu = new MenuItem;
|
||||||
|
_toolBar = wb.setupToolBars();
|
||||||
|
_commandBar = new ToolBarItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
PythonWorkbench::~PythonWorkbench()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem* PythonWorkbench::setupMenuBar() const
|
||||||
|
{
|
||||||
|
return _menuBar->copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolBarItem* PythonWorkbench::setupToolBars() const
|
||||||
|
{
|
||||||
|
return _toolBar->copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolBarItem* PythonWorkbench::setupCommandBars() const
|
||||||
|
{
|
||||||
|
return _commandBar->copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
DockWindowItems* PythonWorkbench::setupDockWindows() const
|
||||||
|
{
|
||||||
|
StdWorkbench wb;
|
||||||
|
return wb.setupDockWindows();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PythonWorkbench::setupContextMenu(const char* recipient, MenuItem* item) const
|
||||||
|
{
|
||||||
|
StdWorkbench wb;
|
||||||
|
wb.setupContextMenu(recipient, item);
|
||||||
|
PythonBaseWorkbench::setupContextMenu(recipient, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PythonWorkbench::createMainWindowPopupMenu(MenuItem* item) const
|
||||||
|
{
|
||||||
|
StdWorkbench wb;
|
||||||
|
wb.createMainWindowPopupMenu(item);
|
||||||
|
}
|
||||||
|
|
|
@ -144,6 +144,8 @@ protected:
|
||||||
virtual ToolBarItem* setupCommandBars() const;
|
virtual ToolBarItem* setupCommandBars() const;
|
||||||
/** Returns a DockWindowItems structure of dock windows this workbench. */
|
/** Returns a DockWindowItems structure of dock windows this workbench. */
|
||||||
virtual DockWindowItems* setupDockWindows() const;
|
virtual DockWindowItems* setupDockWindows() const;
|
||||||
|
|
||||||
|
friend class PythonWorkbench;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,17 +219,17 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PythonWorkbench class allows the manipulation of the workbench from Python.
|
* The PythonBaseWorkbench class allows the manipulation of the workbench from Python.
|
||||||
* Therefore PythonWorkbenchPy provides the required Python interface.
|
* Therefore PythonWorkbenchPy provides the required Python interface.
|
||||||
* @author Werner Mayer
|
* @author Werner Mayer
|
||||||
*/
|
*/
|
||||||
class GuiExport PythonWorkbench : public StdWorkbench
|
class GuiExport PythonBaseWorkbench : public Workbench
|
||||||
{
|
{
|
||||||
TYPESYSTEM_HEADER();
|
TYPESYSTEM_HEADER();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PythonWorkbench();
|
PythonBaseWorkbench();
|
||||||
~PythonWorkbench();
|
~PythonBaseWorkbench();
|
||||||
/**
|
/**
|
||||||
* Creates and returns immediately the corresponding Python workbench object.
|
* Creates and returns immediately the corresponding Python workbench object.
|
||||||
*/
|
*/
|
||||||
|
@ -268,8 +270,9 @@ protected:
|
||||||
MenuItem* setupMenuBar() const;
|
MenuItem* setupMenuBar() const;
|
||||||
ToolBarItem* setupToolBars() const;
|
ToolBarItem* setupToolBars() const;
|
||||||
ToolBarItem* setupCommandBars() const;
|
ToolBarItem* setupCommandBars() const;
|
||||||
|
DockWindowItems* setupDockWindows() const;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
MenuItem* _menuBar;
|
MenuItem* _menuBar;
|
||||||
MenuItem* _contextMenu;
|
MenuItem* _contextMenu;
|
||||||
ToolBarItem* _toolBar;
|
ToolBarItem* _toolBar;
|
||||||
|
@ -277,6 +280,39 @@ private:
|
||||||
Base::PyObjectBase* _workbenchPy;
|
Base::PyObjectBase* _workbenchPy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class GuiExport PythonBlankWorkbench : public PythonBaseWorkbench
|
||||||
|
{
|
||||||
|
TYPESYSTEM_HEADER();
|
||||||
|
|
||||||
|
public:
|
||||||
|
PythonBlankWorkbench();
|
||||||
|
~PythonBlankWorkbench();
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The PythonWorkbench class allows the manipulation of the workbench from Python.
|
||||||
|
* Therefore PythonWorkbenchPy provides the required Python interface.
|
||||||
|
* @author Werner Mayer
|
||||||
|
*/
|
||||||
|
class GuiExport PythonWorkbench : public PythonBaseWorkbench
|
||||||
|
{
|
||||||
|
TYPESYSTEM_HEADER();
|
||||||
|
|
||||||
|
public:
|
||||||
|
PythonWorkbench();
|
||||||
|
~PythonWorkbench();
|
||||||
|
|
||||||
|
/** Defines the standard context menu. */
|
||||||
|
virtual void setupContextMenu(const char* recipient, MenuItem*) const;
|
||||||
|
virtual void createMainWindowPopupMenu(MenuItem*) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
MenuItem* setupMenuBar() const;
|
||||||
|
ToolBarItem* setupToolBars() const;
|
||||||
|
ToolBarItem* setupCommandBars() const;
|
||||||
|
DockWindowItems* setupDockWindows() const;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Gui
|
} // namespace Gui
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ SUBDIRS=Resources
|
||||||
lib_LTLIBRARIES=libSketcherGui.la SketcherGui.la
|
lib_LTLIBRARIES=libSketcherGui.la SketcherGui.la
|
||||||
|
|
||||||
BUILT_SOURCES=\
|
BUILT_SOURCES=\
|
||||||
|
moc_SketchOrientationDialog.cpp \
|
||||||
moc_TaskSketcherConstrains.cpp \
|
moc_TaskSketcherConstrains.cpp \
|
||||||
moc_TaskSketcherCreateCommands.cpp \
|
moc_TaskSketcherCreateCommands.cpp \
|
||||||
moc_TaskSketcherGeneral.cpp \
|
moc_TaskSketcherGeneral.cpp \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user