r23378 by craig - #15956: Apply patch for exif fields for scripter (ale)

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 25 21:15:23 UTC 2019


Author: craig
Date: Mon Nov 25 21:15:23 2019
New Revision: 23378

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23378
Log:
#15956: Apply patch for exif fields for scripter (ale)

Modified:
    trunk/Scribus/scribus/actionmanager.h
    trunk/Scribus/scribus/canvasmode_copyproperties.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp

Modified: trunk/Scribus/scribus/actionmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23378&path=/trunk/Scribus/scribus/actionmanager.h
==============================================================================
--- trunk/Scribus/scribus/actionmanager.h	(original)
+++ trunk/Scribus/scribus/actionmanager.h	Mon Nov 25 21:15:23 2019
@@ -91,7 +91,7 @@
 		void languageChange();
 		void handleMultipleSelections();
 		
-	protected:
+	private:
 		void initFileMenuActions();
 		void initEditMenuActions();
 		void initStyleMenuActions();

Modified: trunk/Scribus/scribus/canvasmode_copyproperties.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23378&path=/trunk/Scribus/scribus/canvasmode_copyproperties.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_copyproperties.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_copyproperties.cpp	Mon Nov 25 21:15:23 2019
@@ -124,8 +124,6 @@
 // 	const double mouseY = m->globalY();
 	const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
 
-	double Rxp = 0, Ryp = 0;
-	PageItem *currItem;
 	m_canvas->PaintSizeRect(QRect());
 	m_canvas->m_viewMode.m_MouseButtonPressed = true;
 	m_canvas->m_viewMode.operItemMoving = false;
@@ -136,9 +134,9 @@
 	m_view->registerMousePress(m->globalPos());
 	Mxp = mousePointDoc.x(); //qRound(m->x()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.x());
 	Myp = mousePointDoc.y(); //qRound(m->y()/m_canvas->scale() + 0*m_doc->minCanvasCoordinate.y());
-	Rxp = m_doc->ApplyGridF(FPoint(Mxp, Myp)).x();
+	double Rxp = m_doc->ApplyGridF(FPoint(Mxp, Myp)).x();
 	Mxp = qRound(Rxp);
-	Ryp = m_doc->ApplyGridF(FPoint(Mxp, Myp)).y();
+	double Ryp = m_doc->ApplyGridF(FPoint(Mxp, Myp)).y();
 	Myp = qRound(Ryp);
 	if (m->button() == Qt::MidButton)
 	{
@@ -150,6 +148,7 @@
 	if (m->button() != Qt::LeftButton)
 		return;
 	SeleItem(m);
+	PageItem *currItem;
 	if (GetItem(&currItem))
 	{
 		double sx, sy, ex, ey, r, skx, sky, fx, fy, ss, sk, sp;

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23378&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.cpp	Mon Nov 25 21:15:23 2019
@@ -253,6 +253,28 @@
 	if (item == nullptr)
 		return nullptr;
 	return Py_BuildValue("(ff)", item->imageXScale() / 72.0 * item->pixm.imgInfo.xres, item->imageYScale() / 72.0 * item->pixm.imgInfo.yres);
+}
+
+PyObject *scribus_getimageexiffield(PyObject* /* self */, PyObject* args)
+{
+	char *Name = const_cast<char*>("");
+	char *Field;
+	if (!PyArg_ParseTuple(args, "es|es", &Field, "utf-8", &Name))
+		return nullptr;
+	if (!checkHaveDocument())
+		return nullptr;
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
+	if (item == nullptr)
+		return nullptr;
+	if (item->itemType() != PageItem::ImageFrame)
+		return nullptr;
+
+	// ImageInfoDialog *dia = new ImageInfoDialog(this, &pageItem->pixm.imgInfo);
+	// timeInfo = new QLabel( info->exifInfo.dateTime, GenGroup);
+	ExifValues exif = item->pixm.imgInfo.exifInfo;
+
+	// return PyUnicode_FromString(item->Pfile.toUtf8());
+	return PyUnicode_FromString("abcd");
 }
 
 PyObject *scribus_getimagefile(PyObject* /* self */, PyObject* args)
@@ -460,6 +482,7 @@
 	  << scribus_getlineshade__doc__ << scribus_getlinejoin__doc__ 
 	  << scribus_getlinecap__doc__ << scribus_getlinestyle__doc__ 
 	  << scribus_getfillshade__doc__ << scribus_getcornerrad__doc__ 
+	  << scribus_getimageexiffield__doc__ 
 	  << scribus_getimgscale__doc__ << scribus_getimagefile__doc__ 
 	  << scribus_getposi__doc__ << scribus_getsize__doc__ 
 	  << scribus_getrotation__doc__ <<  scribus_getallobj__doc__

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23378&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdgetprop.h	Mon Nov 25 21:15:23 2019
@@ -177,6 +177,16 @@
 PyObject *scribus_getimagecolorspace(PyObject * /*self*/, PyObject* args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_getimageexiffield__doc__,
+QT_TR_NOOP("getImageExifField(fiel, [\"name\"]) -> string\n\
+\n\
+Returns the exif field for the image in the image frame. If \"name\" is not\n\
+given the currently selected item is used.\n\
+"));
+/*! Returns image name of the object */
+PyObject *scribus_getimageexiffield(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_getimagefile__doc__,
 QT_TR_NOOP("getImageFile([\"name\"]) -> string\n\
 \n\

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23378&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	Mon Nov 25 21:15:23 2019
@@ -363,6 +363,7 @@
 	{const_cast<char*>("getHGuides"), (PyCFunction)scribus_getHguides, METH_NOARGS, tr(scribus_getHguides__doc__)},
 	{const_cast<char*>("getImageColorSpace"), scribus_getimagecolorspace, METH_VARARGS, tr(scribus_getimagecolorspace__doc__) },
 	{const_cast<char*>("getImageFile"), scribus_getimagefile, METH_VARARGS, tr(scribus_getimagefile__doc__)},
+	{const_cast<char*>("getImageExifField"), scribus_getimageexiffield, METH_VARARGS, tr(scribus_getimageexiffield__doc__)},
 	{const_cast<char*>("getImageOffset"), scribus_getimgoffset, METH_VARARGS, tr(scribus_getimgoffset__doc__)},
 	{const_cast<char*>("getImageScale"), scribus_getimgscale, METH_VARARGS, tr(scribus_getimgscale__doc__)},
 	{const_cast<char*>("getLayers"), (PyCFunction)scribus_getlayers, METH_NOARGS, tr(scribus_getlayers__doc__)},
@@ -980,5 +981,5 @@
 void scriptplugindocwarnings()
 {
 	QStringList s;
-	s <<printer__doc__<<pdffile__doc__<<imgexp__doc__<<imgexp_dpi__doc__<<imgexp_scale__doc__ <<imgexp_quality__doc__<<imgexp_filename__doc__<<imgexp_type__doc__<<imgexp_alltypes__doc__ << imgexp_save__doc__ << imgexp_saveas__doc__;
-}
+	s <<printer__doc__<<pdffile__doc__<<imgexp__doc__<<imgexp_dpi__doc__<<imgexp_scale__doc__ << imgexp_transparentBkgnd__doc__ <<imgexp_quality__doc__<<imgexp_filename__doc__<<imgexp_type__doc__<<imgexp_alltypes__doc__ << imgexp_save__doc__ << imgexp_saveas__doc__;
+}




More information about the scribus-commit mailing list