[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [pykde5] /: Added KPlotting support.
From: Simon Edwards <simon () simonzone ! com>
Date: 2014-02-08 15:09:46
Message-ID: E1WC9XO-00065A-HF () scm ! kde ! org
[Download RAW message or body]
Git commit 98718cd9571ee0266f4a33d14c1b5a773f2ac10a by Simon Edwards.
Committed on 08/02/2014 at 15:08.
Pushed by sedwards into branch 'master'.
Added KPlotting support.
M +7 -2 CMakeLists.txt
A +43 -0 sip/kplotting/kplotaxis.sip
A +77 -0 sip/kplotting/kplotobject.sip
A +41 -0 sip/kplotting/kplotpoint.sip
A +34 -0 sip/kplotting/kplottingmod.sip
A +97 -0 sip/kplotting/kplotwidget.sip
http://commits.kde.org/pykde5/98718cd9571ee0266f4a33d14c1b5a773f2ac10a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7e40194..07b24b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ include(PythonMacros)
include(FeatureSummary)
include(ECMSetupVersion)
-find_package(KF5 CONFIG REQUIRED Auth ItemModels ItemViews Archive)
+find_package(KF5 CONFIG REQUIRED Auth ItemModels ItemViews Archive Plotting)
#option(PYKDEUIC4_ALTINSTALL "Enable parallel-installation of the PyKDE4 tools" FALSE)
@@ -118,7 +118,12 @@ file(GLOB karchive_files_sip sip/karchive/*.sip)
set(SIP_EXTRA_FILES_DEPEND ${karchive_files_sip})
add_sip_python_module(PyKDE5.karchive sip/karchive/karchivemod.sip KF5::Archive)
-set(PYKDE_MODULES "kitemmodels kitemviews karchive")
+# kplotting
+file(GLOB kplottin_files_sip sip/kplotting/*.sip)
+set(SIP_EXTRA_FILES_DEPEND ${kplotting_files_sip})
+add_sip_python_module(PyKDE5.kplotting sip/kplotting/kplottingmod.sip KF5::Plotting)
+
+set(PYKDE_MODULES "kitemmodels kitemviews karchive kplotting")
###############################################################################
diff --git a/sip/kplotting/kplotaxis.sip b/sip/kplotting/kplotaxis.sip
new file mode 100644
index 0000000..57d65ff
--- /dev/null
+++ b/sip/kplotting/kplotaxis.sip
@@ -0,0 +1,43 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KPlotAxis /NoDefaultCtors/
+{
+%TypeHeaderCode
+#include <kplotaxis.h>
+%End
+
+public:
+ explicit KPlotAxis (const QString& label = QString());
+ ~KPlotAxis ();
+ bool isVisible () const;
+ void setVisible (bool visible);
+ bool areTickLabelsShown () const;
+ void setTickLabelsShown (bool b);
+ void setLabel (const QString& label);
+ QString label () const;
+ QString tickLabel (double value) const;
+ void setTickLabelFormat (char format = 'g', int fieldWidth = 0, int precision = \
-1); + int tickLabelWidth () const;
+ char tickLabelFormat () const;
+ int tickLabelPrecision () const;
+ void setTickMarks (double x0, double length);
+ QList<double> majorTickMarks () const;
+ QList<double> minorTickMarks () const;
+};
diff --git a/sip/kplotting/kplotobject.sip b/sip/kplotting/kplotobject.sip
new file mode 100644
index 0000000..220b8d0
--- /dev/null
+++ b/sip/kplotting/kplotobject.sip
@@ -0,0 +1,77 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KPlotObject /NoDefaultCtors/
+{
+%TypeHeaderCode
+#include <kplotobject.h>
+%End
+
+public:
+ enum PlotType
+ {
+ UnknownType,
+ Points,
+ Lines,
+ Bars
+ };
+ typedef QFlags<KPlotObject::PlotType> PlotTypes;
+ enum PointStyle
+ {
+ NoPoints,
+ Circle,
+ Letter,
+ Triangle,
+ Square,
+ Pentagon,
+ Hexagon,
+ Asterisk,
+ Star,
+ UnknwonPoint
+ };
+ explicit KPlotObject (const QColor& color = Qt::white, KPlotObject::PlotType otype = \
KPlotObject::PlotType::Points, double size = 2, KPlotObject::PointStyle ps = \
KPlotObject::PointStyle::Circle); + ~KPlotObject ();
+ KPlotObject::PlotTypes plotTypes () const;
+ void setShowPoints (bool b);
+ void setShowLines (bool b);
+ void setShowBars (bool b);
+ double size () const;
+ void setSize (double s);
+ KPlotObject::PointStyle pointStyle () const;
+ void setPointStyle (KPlotObject::PointStyle p);
+ const QPen& pen () const;
+ void setPen (const QPen& p);
+ const QPen& linePen () const;
+ void setLinePen (const QPen& p);
+ const QPen& barPen () const;
+ void setBarPen (const QPen& p);
+ const QPen& labelPen () const;
+ void setLabelPen (const QPen& p);
+ const QBrush brush () const;
+ void setBrush (const QBrush& b);
+ const QBrush barBrush () const;
+ void setBarBrush (const QBrush& b);
+ QList<KPlotPoint*> points () const;
+ void addPoint (const QPointF& p, const QString& label = QString(), double \
barWidth = 0.0); + void addPoint (KPlotPoint* p);
+ void addPoint (double x, double y, const QString& label = QString(), double \
barWidth = 0.0); + void removePoint (int index);
+ void clearPoints ();
+ void draw (QPainter* p, KPlotWidget* pw);
+};
diff --git a/sip/kplotting/kplotpoint.sip b/sip/kplotting/kplotpoint.sip
new file mode 100644
index 0000000..f063a1b
--- /dev/null
+++ b/sip/kplotting/kplotpoint.sip
@@ -0,0 +1,41 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KPlotPoint /NoDefaultCtors/
+{
+%TypeHeaderCode
+#include <kplotpoint.h>
+%End
+
+public:
+ explicit KPlotPoint ();
+ KPlotPoint (double x, double y, const QString& label = QString(), double \
width = 0.0); + explicit KPlotPoint (const QPointF& p, const QString& label = \
QString(), double width = 0.0); + ~KPlotPoint ();
+ QPointF position () const;
+ void setPosition (const QPointF& pos);
+ double x () const;
+ void setX (double x);
+ double y () const;
+ void setY (double y);
+ QString label () const;
+ void setLabel (const QString& label);
+ double barWidth () const;
+ void setBarWidth (double w);
+};
diff --git a/sip/kplotting/kplottingmod.sip b/sip/kplotting/kplottingmod.sip
new file mode 100644
index 0000000..4a3bb0b
--- /dev/null
+++ b/sip/kplotting/kplottingmod.sip
@@ -0,0 +1,34 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+%Module PyKDE5.kplotting
+
+%ModuleHeaderCode
+#pragma GCC visibility push(default)
+%End
+
+%Import typedefs.sip
+%Import QtCore/QtCoremod.sip
+%Import QtGui/QtGuimod.sip
+%Import QtWidgets/QtWidgetsmod.sip
+
+%Include kplotaxis.sip
+%Include kplotobject.sip
+%Include kplotpoint.sip
+%Include kplotwidget.sip
diff --git a/sip/kplotting/kplotwidget.sip b/sip/kplotting/kplotwidget.sip
new file mode 100644
index 0000000..81dc3e9
--- /dev/null
+++ b/sip/kplotting/kplotwidget.sip
@@ -0,0 +1,97 @@
+// Copyright 2014 Simon Edwards <simon@simonzone.com>
+
+// Generated by twine2
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Library General Public License as
+// published by the Free Software Foundation; either version 2, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details
+
+// You should have received a copy of the GNU Library General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class KPlotWidget : QFrame
+{
+%TypeHeaderCode
+#include <kplotwidget.h>
+%End
+
+public:
+ explicit KPlotWidget (QWidget* parent = 0);
+ virtual ~KPlotWidget ();
+ enum Axis
+ {
+ LeftAxis,
+ BottomAxis,
+ RightAxis,
+ TopAxis
+ };
+ virtual QSize minimumSizeHint () const;
+ virtual QSize sizeHint () const;
+ void setLimits (double x1, double x2, double y1, double y2);
+ void setSecondaryLimits (double x1, double x2, double y1, double y2);
+ void clearSecondaryLimits ();
+ QRectF dataRect () const;
+ QRectF secondaryDataRect () const;
+ QRect pixRect () const;
+ void addPlotObject (KPlotObject* object);
+ void addPlotObjects (const QList<KPlotObject*>& objects);
+ QList<KPlotObject*> plotObjects () const;
+ void removeAllPlotObjects ();
+ void resetPlotMask ();
+ void resetPlot ();
+ void replacePlotObject (int i, KPlotObject* o);
+ QColor backgroundColor () const;
+ QColor foregroundColor () const;
+ QColor gridColor () const;
+ void setBackgroundColor (const QColor& bg);
+ void setForegroundColor (const QColor& fg);
+ void setGridColor (const QColor& gc);
+ bool isGridShown () const;
+ bool isObjectToolTipShown () const;
+ bool antialiasing () const;
+ void setAntialiasing (bool b);
+ int leftPadding () const;
+ int rightPadding () const;
+ int topPadding () const;
+ int bottomPadding () const;
+ void setLeftPadding (int padding);
+ void setRightPadding (int padding);
+ void setTopPadding (int padding);
+ void setBottomPadding (int padding);
+ void setDefaultPaddings ();
+ QPointF mapToWidget (const QPointF& p) const;
+ void maskRect (const QRectF& r, float value = 1.0);
+ void maskAlongLine (const QPointF& p1, const QPointF& p2, float value = 1.0);
+ void placeLabel (QPainter* painter, KPlotPoint* pp);
+//ig KPlotAxis* axis (KPlotWidget::Axis type);
+ const KPlotAxis* axis (KPlotWidget::Axis type) const;
+ void setShowGrid (bool show);
+ void setObjectToolTipShown (bool show);
+protected:
+ virtual bool event (QEvent*);
+ virtual void paintEvent (QPaintEvent*);
+ virtual void resizeEvent (QResizeEvent*);
+ virtual void drawAxes (QPainter* p);
+ void setPixRect ();
+ QList<KPlotPoint*> pointsUnderPoint (const QPoint& p) const;
+%ConvertToSubClassCode
+ // CTSCC for subclasses of 'QObject'
+ sipType = NULL;
+
+ if (dynamic_cast<KPlotWidget*>(sipCpp))
+ sipType = sipType_KPlotWidget;
+%End
+};
+%ModuleHeaderCode
+//ctscc
+#include <kplotwidget.h>
+#include <qobject.h>
+%End
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic