View Issue Details

IDProjectCategoryView StatusLast Update
0016300ScribusScripterpublic2020-11-10 16:21
Reporterale Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Product Version1.5.6.svn 
Target VersionFixed in Version 
Summary0016300: [PATCHJ] add moveToPage() to the scripter
Descriptioncurrently if you want to move an item from a page to a different one, you need to use the clipboard and copy paste.

this is not a good idea, since it changes the user's clipboard.

it would be better to use duplicate() and then add a moveToPage().

of course, this is only important for script that run while the user is working on a document...

i can propose a patch for this.
TagsNo tags attached.
PatchYes

Relationships

related to 0016318 resolvedale Add checkValidPageNumber() 
related to 0016317 new [PATCH] add GetSingleItem and deprecate GetUniqueItem 

Activities

ale

2020-11-10 13:12

manager   ~0048368

here is the first part of the patch: add moveToPage to PageItem

move-to-page.diff (17,004 bytes)
diff --git a/scribus/pageitem.cpp b/scribus/pageitem.cpp
index 53bb80446..d304c0191 100644
--- a/scribus/pageitem.cpp
+++ b/scribus/pageitem.cpp
@@ -8744,6 +8744,23 @@ void PageItem::getOldBoundingRect(double *x1, double *y1, double *x2, double *y2
 	}
 }
 
+void PageItem::moveToPage(int page)
+{
+	int iPage = m_Doc->OnPage(this);
+	if (iPage == - 1)
+		return;
+
+	auto currentPage = m_Doc->Pages->at(iPage);
+	auto targetPage = m_Doc->Pages->at(page);
+
+	auto dX = targetPage->xOffset() - currentPage->xOffset();
+	auto dY = targetPage->yOffset() - currentPage->yOffset();
+
+	m_Doc->moveItem(dX, dY, this);
+
+	m_Doc->changed();
+}
+
 void PageItem::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
 {
 	double minx =  std::numeric_limits<double>::max();
diff --git a/scribus/pageitem.h b/scribus/pageitem.h
index 4e7dc56ab..4ce5a3952 100644
--- a/scribus/pageitem.h
+++ b/scribus/pageitem.h
@@ -499,6 +499,7 @@ public: // Start public functions
 	virtual QList<PageItem*> getAllChildren() const;
 
 	//<< ********* Attributes of the item *********
+	void moveToPage(int page);
 	//Position
 	double xPos() const { return m_xPos; }
 	double yPos() const { return m_yPos; }
diff --git a/scribus/ui/outlinepalette.cpp b/scribus/ui/outlinepalette.cpp
index 8049f42e0..8e2a7fad6 100644
--- a/scribus/ui/outlinepalette.cpp
+++ b/scribus/ui/outlinepalette.cpp
@@ -82,37 +82,39 @@ void OutlineWidget::selectItems(const QList<QTreeWidgetItem*>& items)
 	selectionModel()->select(itemSelection, QItemSelectionModel::Select);
 }
 
+/*
+- use a list with both the item and its parent
+- use range loops
+- it is for iterators, not items...
+- if item is nullptr, don't bothe rwith adding to items
+ */
 void OutlineWidget::dropEvent(QDropEvent *e)
 {
-	bool haveLayers = false;
-	QModelIndex id;
-	QList<QTreeWidgetItem*> its;
-	QList<OutlineTreeItem*> itemPars;
-	QList<QModelIndex> idxs = selectedIndexes();
-	for (int i = 0; i < idxs.count(); ++i)
+	bool haveLayers = false; // TODO: shouldn't it just count if the layers in doc are > 1?
+	QList<QPair<QTreeWidgetItem*, OutlineTreeItem*>> items;
+	for (const auto& index: selectedIndexes())
 	{
-		id = idxs.at(i);
-		QTreeWidgetItem* it = id.isValid() ? itemFromIndex(id) : nullptr;
-		OutlineTreeItem *itemPar = it ? dynamic_cast<OutlineTreeItem*>(it->parent()) : nullptr;
-		while (itemPar && (itemPar->type != 2))
+		if (!index.isValid())
+			continue;
+		QTreeWidgetItem* item = itemFromIndex(index);
+		OutlineTreeItem *itemParent = dynamic_cast<OutlineTreeItem*>(item->parent());
+		while (itemParent && (itemParent->type != 2))
 		{
-			if (itemPar->type == 5)
+			if (itemParent->type == 5)
 				haveLayers = true;
-			itemPar = dynamic_cast<OutlineTreeItem*>(itemPar->parent());
+			itemParent = dynamic_cast<OutlineTreeItem*>(itemParent->parent());
 		}
-		its.append(it);
-		itemPars.append(itemPar);
+		items.append(qMakePair(item, itemParent));
 	}
 
 	QTreeWidget::dropEvent(e);
 
 	QList<QTreeWidgetItem*> selList;
-	for (int i = 0; i < its.count(); ++i)
+	for (const auto& itemPair: items)
 	{
-		QTreeWidgetItem* it = its.at(i);
-		if (it == nullptr)
-			continue;
-		OutlineTreeItem *itemPar = itemPars.at(i);
+		QTreeWidgetItem* it = itemPair.first; // widgetItem
+		OutlineTreeItem *itemPar = itemPair.second;
+
 		OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(it);
 		if (!item)
 			qFatal("OutlineWidget::dropEvent !item");
@@ -1089,91 +1091,87 @@ void OutlinePalette::BuildTree(bool storeVals)
 	if (storeVals)
 		buildReopenVals();
 	clearPalette();
-	OutlineTreeItem * item = new OutlineTreeItem( reportDisplay, nullptr );
+	OutlineTreeItem* item = new OutlineTreeItem(reportDisplay, nullptr);
 	rootObject = item;
-	item->setText( 0, currDoc->documentFileName().section( '/', -1 ) );
+	item->setText(0, currDoc->documentFileName().section('/', -1));
 	item->type = -2;
 	item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
 	OutlineTreeItem * pagep = nullptr;
 	freeObjects = nullptr;
-	PageItem* pgItem;
-	QString tmp;
 	if (currDoc->symbolEditMode() || currDoc->inlineEditMode())
 	{
 		OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
 		page->PageObject = currDoc->Pages->at(0);
 		page->type = 2;
 		page->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
+		if (currDoc->symbolEditMode())
+			page->setText(0, currDoc->getEditedSymbol());
+		else
+			page->setText(0, tr("Inline Frame"));
+
 		pagep = page;
-		for (int b = 0; b < currDoc->Items->count(); ++b)
+
+		for (auto pageItem: *currDoc->Items)
 		{
-			pgItem = currDoc->Items->at(b);
-			if (!pgItem->isGroup())
+			OutlineTreeItem *object = new OutlineTreeItem(page, nullptr);
+			object->PageItemObject = pageItem;
+			object->PageObject = currDoc->DocPages.at(0);
+			object->DocObject = currDoc;
+			object->type = 3;
+			object->setText(0, pageItem->itemName());
+
+			if (!pageItem->isGroup())
 			{
-				OutlineTreeItem *object = new OutlineTreeItem( page, nullptr );
-				object->PageItemObject = pgItem;
-				object->PageObject = currDoc->DocPages.at(0);
-				object->DocObject = currDoc;
-				object->type = 3;
-				object->setText(0, pgItem->itemName());
-				setItemIcon(object, pgItem);
+				setItemIcon(object, pageItem);
 				object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
 			}
 			else
 			{
-				OutlineTreeItem *object = new OutlineTreeItem( page, nullptr );
-				object->PageItemObject = pgItem;
-				object->PageObject = currDoc->DocPages.at(0);
-				object->DocObject = currDoc;
-				object->type = 3;
-				object->setText(0, pgItem->itemName());
-				object->setIcon( 0, groupIcon );
+				object->setIcon(0, groupIcon);
 				object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
-				parseSubGroup(object, &pgItem->groupItemList, 3, currDoc->Pages->at(0));
+				parseSubGroup(object, &pageItem->groupItemList, 3, currDoc->Pages->at(0));
 			}
 		}
-		if (currDoc->symbolEditMode())
-			page->setText(0, currDoc->getEditedSymbol());
-		else
-			page->setText(0, tr("Inline Frame"));
 	}
 	else
 	{
+		// TODO check if masterPage has OwnPage and it is a... or otherwise has the value of a
 		for (int a = 0; a < static_cast<int>(currDoc->MasterPages.count()); ++a)
 		{
+			const auto masterPage = currDoc->MasterPages.at(a);
 			OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
+			qDebug() << a << masterPage->pageNr();
 			page->PageObject = currDoc->MasterPages.at(a);
 			page->type = 0;
 			page->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
 			QString pageNam = currDoc->MasterPages.at(a)->pageName();
 			pagep = page;
-			for (int b = 0; b < currDoc->MasterItems.count(); ++b)
+			for (const auto& pageItem: currDoc->MasterItems)
 			{
-				pgItem = currDoc->MasterItems.at(b);
-				if (((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam)))
+				if (((pageItem->OwnPage == a) || (pageItem->OnMasterPage == pageNam)))
 				{
-					if (!pgItem->isGroup())
+					if (!pageItem->isGroup())
 					{
 						OutlineTreeItem *object = new OutlineTreeItem( page, nullptr );
-						object->PageItemObject = pgItem;
+						object->PageItemObject = pageItem;
 						object->PageObject = currDoc->MasterPages.at(a);
 						object->DocObject = currDoc;
 						object->type = 1;
-						object->setText(0, pgItem->itemName());
-						setItemIcon(object, pgItem);
+						object->setText(0, pageItem->itemName());
+						setItemIcon(object, pageItem);
 						object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
 					}
 					else
 					{
 						OutlineTreeItem * object = new OutlineTreeItem(page, nullptr);
-						object->PageItemObject = pgItem;
+						object->PageItemObject = pageItem;
 						object->PageObject = currDoc->MasterPages.at(a);
 						object->DocObject = currDoc;
 						object->type = 1;
-						object->setText(0, pgItem->itemName());
+						object->setText(0, pageItem->itemName());
 						object->setIcon( 0, groupIcon );
 						object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-						parseSubGroup(object, &pgItem->groupItemList, 1, currDoc->MasterPages.at(a));
+						parseSubGroup(object, &pageItem->groupItemList, 1, currDoc->MasterPages.at(a));
 					}
 				}
 			}
@@ -1191,13 +1189,12 @@ void OutlinePalette::BuildTree(bool storeVals)
 			if (layerCount > 1)
 			{
 				QList<PageItem*> pgItems;
-				for (int b = 0; b < currDoc->DocItems.count(); ++b)
+				for (auto pageItem: currDoc->DocItems)
 				{
-					pgItem = currDoc->DocItems.at(b);
-					if (pgItem->OwnPage == -1)
+					if (pageItem->OwnPage == -1)
 						hasfreeItems = true;
-					if (pgItem->OwnPage == a)
-						pgItems.append(pgItem);
+					if (pageItem->OwnPage == a)
+						pgItems.append(pageItem);
 				}
 				ScLayer layer;
 				layer.ID = 0;
@@ -1210,73 +1207,71 @@ void OutlinePalette::BuildTree(bool storeVals)
 					ObjLayer->DocObject = currDoc;
 					ObjLayer->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
 					ObjLayer->setText(0, tr("Layer: \"") + layer.Name + "\"");
-					for (int it = 0; it < pgItems.count(); ++it)
+					for (auto pageItem: pgItems)
 					{
-						pgItem = pgItems.at(it);
-						if (pgItem->m_layerID != layer.ID)
+						if (pageItem->m_layerID != layer.ID)
 							continue;
-						if (!pgItem->isGroup())
+						if (!pageItem->isGroup())
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(ObjLayer, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = currDoc->DocPages.at(a);
 							object->DocObject = currDoc;
 							object->type = 3;
-							object->setText(0, pgItem->itemName());
-							setItemIcon(object, pgItem);
+							object->setText(0, pageItem->itemName());
+							setItemIcon(object, pageItem);
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
 						}
 						else
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(ObjLayer, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = currDoc->DocPages.at(a);
 							object->DocObject = currDoc;
 							object->type = 3;
-							object->setText(0, pgItem->itemName());
+							object->setText(0, pageItem->itemName());
 							object->setIcon( 0, groupIcon );
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
-							parseSubGroup(object, &pgItem->groupItemList, 3, currDoc->DocPages.at(a));
+							parseSubGroup(object, &pageItem->groupItemList, 3, currDoc->DocPages.at(a));
 						}
 					}
 				}
 			}
 			else
 			{
-				for (int b = 0; b < currDoc->DocItems.count(); ++b)
+				for (auto pageItem: currDoc->DocItems)
 				{
-					pgItem = currDoc->DocItems.at(b);
-					if (pgItem->OwnPage == -1)
+					if (pageItem->OwnPage == -1)
 						hasfreeItems = true;
-					if (pgItem->OwnPage == a)
+					if (pageItem->OwnPage == a)
 					{
-						if (!pgItem->isGroup())
+						if (!pageItem->isGroup())
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(page, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = currDoc->DocPages.at(a);
 							object->DocObject = currDoc;
 							object->type = 3;
-							object->setText(0, pgItem->itemName());
-							setItemIcon(object, pgItem);
+							object->setText(0, pageItem->itemName());
+							setItemIcon(object, pageItem);
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
 						}
 						else
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(page, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = currDoc->DocPages.at(a);
 							object->DocObject = currDoc;
 							object->type = 3;
-							object->setText(0, pgItem->itemName());
+							object->setText(0, pageItem->itemName());
 							object->setIcon( 0, groupIcon );
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
-							parseSubGroup(object, &pgItem->groupItemList, 3, currDoc->DocPages.at(a));
+							parseSubGroup(object, &pageItem->groupItemList, 3, currDoc->DocPages.at(a));
 						}
 					}
 				}
 			}
-			page->setText(0, tr("Page ")+tmp.setNum(a+1));
+			page->setText(0, tr("Page %1").arg(a + 1));
 		}
 		if (hasfreeItems)
 		{
@@ -1289,11 +1284,10 @@ void OutlinePalette::BuildTree(bool storeVals)
 			if (layerCount > 1)
 			{
 				QList<PageItem*> pgItems;
-				for (int b = 0; b < currDoc->DocItems.count(); ++b)
+				for (auto pageItem: currDoc->DocItems)
 				{
-					pgItem = currDoc->DocItems.at(b);
-					if (pgItem->OwnPage == -1)
-						pgItems.append(pgItem);
+					if (pageItem->OwnPage == -1)
+						pgItems.append(pageItem);
 				}
 				ScLayer layer;
 				layer.ID = 0;
@@ -1306,66 +1300,64 @@ void OutlinePalette::BuildTree(bool storeVals)
 					ObjLayer->DocObject = currDoc;
 					ObjLayer->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
 					ObjLayer->setText(0, tr("Layer: \"") + layer.Name + "\"");
-					for (int it = 0; it < pgItems.count(); ++it)
+					for (auto pageItem: pgItems)
 					{
-						pgItem = pgItems.at(it);
-						if (pgItem->m_layerID != layer.ID)
+						if (pageItem->m_layerID != layer.ID)
 							continue;
-						if (!pgItem->isGroup())
+						if (!pageItem->isGroup())
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(ObjLayer, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = nullptr;
 							object->DocObject = currDoc;
 							object->type = 4;
-							object->setText(0, pgItem->itemName());
-							setItemIcon(object, pgItem);
+							object->setText(0, pageItem->itemName());
+							setItemIcon(object, pageItem);
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
 						}
 						else
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(ObjLayer, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = nullptr;
 							object->DocObject = currDoc;
 							object->type = 4;
-							object->setText(0, pgItem->itemName());
+							object->setText(0, pageItem->itemName());
 							object->setIcon( 0, groupIcon );
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-							parseSubGroup(object, &pgItem->groupItemList, 4, nullptr);
+							parseSubGroup(object, &pageItem->groupItemList, 4, nullptr);
 						}
 					}
 				}
 			}
 			else
 			{
-				for (int b = 0; b < currDoc->DocItems.count(); ++b)
+				for (auto pageItem: currDoc->DocItems)
 				{
-					pgItem = currDoc->DocItems.at(b);
-					if (pgItem->OwnPage == -1)
+					if (pageItem->OwnPage == -1)
 					{
-						if (!pgItem->isGroup())
+						if (!pageItem->isGroup())
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(page, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = nullptr;
 							object->DocObject = currDoc;
 							object->type = 4;
-							object->setText(0, pgItem->itemName());
-							setItemIcon(object, pgItem);
+							object->setText(0, pageItem->itemName());
+							setItemIcon(object, pageItem);
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
 						}
 						else
 						{
 							OutlineTreeItem *object = new OutlineTreeItem(page, nullptr);
-							object->PageItemObject = pgItem;
+							object->PageItemObject = pageItem;
 							object->PageObject = nullptr;
 							object->DocObject = currDoc;
 							object->type = 4;
-							object->setText(0, pgItem->itemName());
+							object->setText(0, pageItem->itemName());
 							object->setIcon( 0, groupIcon );
 							object->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-							parseSubGroup(object, &pgItem->groupItemList, 4, nullptr);
+							parseSubGroup(object, &pageItem->groupItemList, 4, nullptr);
 						}
 					}
 				}
diff --git a/scribus/ui/outlinepalette.h b/scribus/ui/outlinepalette.h
index 4ad9d4173..75640f5a5 100644
--- a/scribus/ui/outlinepalette.h
+++ b/scribus/ui/outlinepalette.h
@@ -34,7 +34,7 @@ public:
 	ScPage *PageObject;
 	ScribusDoc *DocObject;
 	int LayerID;
-	int type; //1=PageItem on Master Page,2=,3=PageItem,4=,5=,...
+	int type; //-3, -2, 0=,1=PageItem on Master Page,2=InlineFrame,3=PageItem,4=,5=Layer,...
 };
 
 class SCRIBUS_API OutlineWidget : public QTreeWidget
move-to-page.diff (17,004 bytes)

ale

2020-11-10 13:16

manager   ~0048369

the final patch will depend on 0016317 and 0016318

digirew

2020-11-10 14:15

reporter   ~0048371

we do this a lot in our script (copy/paste) to move objects from one page to another. I agree with @ale and that having a moveToPage() type command would be ideal and the best way to do it.

ale

2020-11-10 16:21

manager   ~0048374

voilĂ , the fourth part of the patch

as said this needs:

- the patch above for moveToPage in PageItem
- the two patches for checking for the valid page number and the single selection

move-to-page-script.diff (3,157 bytes)
diff --git a/scribus/plugins/scriptplugin/cmdobj.cpp b/scribus/plugins/scriptplugin/cmdobj.cpp
index fc76020ee..7953f9e36 100644
--- a/scribus/plugins/scriptplugin/cmdobj.cpp
+++ b/scribus/plugins/scriptplugin/cmdobj.cpp
@@ -1071,6 +1071,29 @@ PyObject *scribus_pasteobjects(PyObject * /* self */, PyObject * /*args*/)
 	return pyList;
 }
 
+PyObject *scribus_moveitemtopage(PyObject * /* self */, PyObject *args)
+{
+	if (!checkHaveDocument())
+		return nullptr;
+
+	uint page = 0;
+	char* name = const_cast<char*>("");
+
+	if (!PyArg_ParseTuple(args, "i|es", &page, "utf-8", &name))
+		return nullptr;
+
+	PageItem *pageItem = GetSingleItem(name);
+	if (pageItem == nullptr)
+		return nullptr;
+
+	if (!checkValidPageNumber(page))
+		return nullptr;
+
+	pageItem->moveToPage(page);
+
+	Py_RETURN_NONE;
+}
+
 /*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
 with header files structure untouched (docstrings are kept near declarations)
 PV */
@@ -1096,6 +1119,7 @@ void cmdobjdocwarnings()
 	  << scribus_getparagraphstyle__doc__
 	  << scribus_getstyle__doc__
 	  << scribus_gettextflowmode__doc__
+	  << scribus_moveitemtopage__doc__
 	  << scribus_objectexists__doc__
 	  << scribus_pasteobject__doc__
 	  << scribus_pasteobjects__doc__
diff --git a/scribus/plugins/scriptplugin/cmdobj.h b/scribus/plugins/scriptplugin/cmdobj.h
index 8835045ae..6853e1e25 100644
--- a/scribus/plugins/scriptplugin/cmdobj.h
+++ b/scribus/plugins/scriptplugin/cmdobj.h
@@ -401,5 +401,13 @@ Returns the names of the newly created object in a list.\n\
 "));
 PyObject *scribus_pasteobjects(PyObject * /* self */, PyObject *args);
 
-#endif
+/*! docstring */
+PyDoc_STRVAR(scribus_moveitemtopage__doc__,
+QT_TR_NOOP("moveItemToPage(page:int, name:string = None) -> void\n\
+\n\
+Move the item to the given page (the first page being 0).\n\
+If \"name\" is not given the currently selected item is moved.\n\
+"));
+PyObject *scribus_moveitemtopage(PyObject * /* self */, PyObject *args);
 
+#endif
diff --git a/scribus/plugins/scriptplugin/scriptplugin.cpp b/scribus/plugins/scriptplugin/scriptplugin.cpp
index 37bfb84ba..4eae0aeb7 100644
--- a/scribus/plugins/scriptplugin/scriptplugin.cpp
+++ b/scribus/plugins/scriptplugin/scriptplugin.cpp
@@ -447,6 +447,7 @@ PyMethodDef scribus_methods[] = {
 	{const_cast<char*>("mergeTableCells"), scribus_mergetablecells, METH_VARARGS, tr(scribus_mergetablecells__doc__)},
 	{const_cast<char*>("messageBox"), (PyCFunction)scribus_messagebox, METH_VARARGS|METH_KEYWORDS, tr(scribus_messagebox__doc__)},
 	{const_cast<char*>("messagebarText"), scribus_statusmessage, METH_VARARGS, tr(scribus_statusmessage__doc__)}, // Deprecated
+	{const_cast<char*>("moveItemToPage"), scribus_moveitemtopage, METH_VARARGS, tr(scribus_moveitemtopage__doc__)},
 	{const_cast<char*>("moveObject"), scribus_moveobjectrel, METH_VARARGS, tr(scribus_moveobjectrel__doc__)},
 	{const_cast<char*>("moveObjectAbs"), scribus_moveobjectabs, METH_VARARGS, tr(scribus_moveobjectabs__doc__)},
 	{const_cast<char*>("moveSelectionToBack"), (PyCFunction)scribus_moveselectiontoback, METH_NOARGS, tr(scribus_moveselectiontoback__doc__) },
move-to-page-script.diff (3,157 bytes)

Issue History

Date Modified Username Field Change
2020-11-01 20:06 ale New Issue
2020-11-10 13:12 ale File Added: move-to-page.diff
2020-11-10 13:12 ale Note Added: 0048368
2020-11-10 13:16 ale Relationship added related to 0016318
2020-11-10 13:16 ale Relationship added related to 0016317
2020-11-10 13:16 ale Note Added: 0048369
2020-11-10 14:15 digirew Note Added: 0048371
2020-11-10 16:21 ale File Added: move-to-page-script.diff
2020-11-10 16:21 ale Note Added: 0048374
2020-11-10 16:21 ale Summary add moveToPage() to the scripter => [PATCHJ] add moveToPage() to the scripter
2020-11-10 16:21 ale Patch No => Yes