View Issue Details

IDProjectCategoryView StatusLast Update
0011345ScribusScripterpublic2013-06-24 05:37
Reporterale Assigned Tocbradney  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.5.0svn 
Fixed in Version1.5.0svn 
Summary0011345: [PATCH] Scripter: missing getUnit and setUnit functions
Descriptionat the beginning of each script and at its end we need to query and restore the current units.
TagsNo tags attached.
Patch

Activities

ale

2013-01-07 19:51

manager  

scripter_unit.diff (1,620 bytes)   
Index: scribus/plugins/scripter/api_document.h
===================================================================
--- scribus/plugins/scripter/api_document.h	(revision 17926)
+++ scribus/plugins/scripter/api_document.h	(working copy)
@@ -33,6 +33,7 @@
     Q_PROPERTY(QList<QVariant> layers READ layers)
     Q_PROPERTY(QList<QVariant> masterPages READ masterPages)
     Q_PROPERTY(QList<QVariant> styles READ styles)
+    Q_PROPERTY(int unit READ unit WRITE setUnit)
 
 public:
 	DocumentAPI();
@@ -95,6 +96,8 @@
 	bool available();
 	bool modified();
 	void setModified(bool flag);
+	int unit();
+	void setUnit(int value);
 	QObject *activePage();
 	int pageCount();
 	QList<QVariant> selection();
Index: scribus/plugins/scripter/api_document.cpp
===================================================================
--- scribus/plugins/scripter/api_document.cpp	(revision 17926)
+++ scribus/plugins/scripter/api_document.cpp	(working copy)
@@ -94,7 +94,26 @@
 	return ScCore->primaryMainWindow()->doc->isModified();
 }
 
+/**
+ * Scripter.activeDocument.unit
+ * Property
+ * boolean flag current measurement unit of the document
+ *
+ * When starting a script you should query its current unit,
+ * Use your preferred unit during the script life and don't forget
+ * to set again the previous unit before finishing the script
+ */
+void DocumentAPI::setUnit(int value)
+{
+	if (!check()) return;
+	ScCore->primaryMainWindow()->doc->setUnitIndex(value);
+}
 
+int DocumentAPI::unit()
+{
+	if (!check()) return NULL;
+	return ScCore->primaryMainWindow()->doc->unitIndex();
+}
 
 /**
  * Scripter.activeDocument.close()
scripter_unit.diff (1,620 bytes)   

Issue History

Date Modified Username Field Change
2013-01-06 20:56 ale New Issue
2013-01-07 19:51 ale File Added: scripter_unit.diff
2013-01-07 19:51 ale Summary Scripter: missing getUnit and setUnit functions => [PATCH] Scripter: missing getUnit and setUnit functions
2013-01-12 09:53 cbradney Status new => resolved
2013-01-12 09:53 cbradney Fixed in Version => 1.5.0svn
2013-01-12 09:53 cbradney Resolution open => fixed
2013-01-12 09:53 cbradney Assigned To => cbradney
2013-06-24 05:37 christoph_s Status resolved => closed