r24163 by jghali - Fix small bugs in scripter's getAllObjects()

scribus-commit scribus-commit at lists.scribus.net
Tue Nov 3 16:09:14 UTC 2020


Author: jghali
Date: Tue Nov  3 16:09:14 2020
New Revision: 24163

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24163
Log:
Fix small bugs in scripter's getAllObjects()

Modified:
    trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdgetprop.cpp

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24163&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp	Tue Nov  3 16:09:14 2020
@@ -314,15 +314,15 @@
 	uint counter = 0;
 	uint counter2 = 0;
 
+	if (!checkHaveDocument())
+		return nullptr;
+
 	ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc;
 	int pageNr = currentDoc->currentPageNumber();
 	char *kwlist[] = { const_cast<char*>("type"), const_cast<char*>("page"), const_cast<char*>("layer"), nullptr};
 	char* szLayerName = const_cast<char*>("");
 
 	if (!PyArg_ParseTupleAndKeywords(args, keywds, "|iies", kwlist, &type, &pageNr, "utf-8", &szLayerName))
-		return nullptr;
-
-	if (!checkHaveDocument())
 		return nullptr;
 
 	int numPages = currentDoc->Pages->count();
@@ -363,7 +363,7 @@
 		PageItem* item = currentDoc->Items->at(i);
 		if  (pageNr != item->OwnPage)
 			continue;
-		if ((type != -1) && (item->itemType() == type))
+		if ((type != -1) && (item->itemType() != type))
 			continue;
 		if (layer && (layer->ID != item->m_layerID))
 			continue;

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdgetprop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24163&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdgetprop.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdgetprop.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdgetprop.cpp	Tue Nov  3 16:09:14 2020
@@ -314,15 +314,15 @@
 	uint counter = 0;
 	uint counter2 = 0;
 
+	if (!checkHaveDocument())
+		return nullptr;
+
 	ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc;
 	int pageNr = currentDoc->currentPageNumber();
 	char *kwlist[] = { const_cast<char*>("type"), const_cast<char*>("page"), const_cast<char*>("layer"), nullptr};
 	char* szLayerName = const_cast<char*>("");
 
 	if (!PyArg_ParseTupleAndKeywords(args, keywds, "|ii", kwlist, &type, &pageNr))
-		return nullptr;
-
-	if (!checkHaveDocument())
 		return nullptr;
 
 	int numPages = currentDoc->Pages->count();
@@ -363,7 +363,7 @@
 		PageItem* item = currentDoc->Items->at(i);
 		if  (pageNr != item->OwnPage)
 			continue;
-		if ((type != -1) && (item->itemType() == type))
+		if ((type != -1) && (item->itemType() != type))
 			continue;
 		if (layer && (layer->ID != item->m_layerID))
 			continue;




More information about the scribus-commit mailing list