Implement Cancel logic for TaskViewSection
This commit is contained in:
parent
17fe63598f
commit
a5b5104875
|
@ -18,6 +18,11 @@
|
|||
<UserDocu>addView(DrawView) - Add a View to this Page</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="removeView">
|
||||
<Documentation>
|
||||
<UserDocu>removeView(DrawView) - Remove a View to this Page</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPageWidth">
|
||||
<Documentation>
|
||||
<UserDocu>Return the width of this page</UserDocu>
|
||||
|
|
|
@ -45,6 +45,31 @@ PyObject* DrawPagePy::addView(PyObject* args)
|
|||
return PyInt_FromLong((long) rc);
|
||||
}
|
||||
|
||||
PyObject* DrawPagePy::removeView(PyObject* args)
|
||||
{
|
||||
//this implements iRC = pyPage.removeView(pyView) -or-
|
||||
//doCommand(Doc,"App.activeDocument().%s.removeView(App.activeDocument().%s)",PageName.c_str(),FeatName.c_str());
|
||||
PyObject *pcDocObj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O!", &(App::DocumentObjectPy::Type), &pcDocObj)) {
|
||||
Base::Console().Error("Error: DrawPagePy::removeView - Bad Arg - not DocumentObject\n");
|
||||
return NULL;
|
||||
//TODO: sb PyErr??
|
||||
//PyErr_SetString(PyExc_TypeError,"removeView expects a DrawView");
|
||||
//return -1;
|
||||
}
|
||||
|
||||
DrawPage* page = getDrawPagePtr(); //get DrawPage for pyPage
|
||||
//how to validate that obj is DrawView before use??
|
||||
DrawViewPy* pyView = static_cast<TechDraw::DrawViewPy*>(pcDocObj);
|
||||
DrawView* view = pyView->getDrawViewPtr(); //get DrawView for pyView
|
||||
|
||||
int rc = page->removeView(view);
|
||||
|
||||
return PyInt_FromLong((long) rc);
|
||||
}
|
||||
|
||||
|
||||
// double getPageWidth() const;
|
||||
PyObject* DrawPagePy::getPageWidth(PyObject *args)
|
||||
{
|
||||
|
|
|
@ -272,12 +272,20 @@ bool TaskSectionView::accept()
|
|||
{
|
||||
//calcValues();
|
||||
updateValues();
|
||||
std::string BaseName = m_base->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.ShowSectionLine=True",BaseName.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TaskSectionView::reject()
|
||||
{
|
||||
//TODO: remove viewSection
|
||||
std::string BaseName = m_base->getNameInDocument();
|
||||
std::string PageName = m_base->findParentPage()->getNameInDocument();
|
||||
std::string SectionName = m_section->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.ShowSectionLine=False",BaseName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().%s.removeView(App.activeDocument().%s)",
|
||||
PageName.c_str(),SectionName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.activeDocument().removeObject('%s')",SectionName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ public:
|
|||
~TaskSectionView();
|
||||
|
||||
public:
|
||||
bool accept();
|
||||
bool reject();
|
||||
virtual bool accept();
|
||||
virtual bool reject();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onHorizontalClicked(bool b);
|
||||
|
|
Loading…
Reference in New Issue
Block a user