[rkward-cvs] SF.net SVN: rkward: [1253] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Jan 30 15:27:11 UTC 2007
Revision: 1253
http://svn.sourceforge.net/rkward/?rev=1253&view=rev
Author: tfry
Date: 2007-01-30 07:27:11 -0800 (Tue, 30 Jan 2007)
Log Message:
-----------
Some fixes to last commit, and add a widget to select the name of an R object to save to, for use in plugins
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/dialogs/rkimportdialog.cpp
trunk/rkward/rkward/dialogs/rkimportdialog.h
trunk/rkward/rkward/misc/rksaveobjectchooser.cpp
trunk/rkward/rkward/misc/rksaveobjectchooser.h
trunk/rkward/rkward/plugin/Makefile.am
trunk/rkward/rkward/plugin/rkcomponent.h
trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml
Added Paths:
-----------
trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp
trunk/rkward/rkward/plugin/rkpluginsaveobject.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/ChangeLog 2007-01-30 15:27:11 UTC (rev 1253)
@@ -1,3 +1,4 @@
+- new plugin element to select name of an R object to save to TODO: document
- analysis folder for analysis plugins (Wilcoxon and Ansari-Bradley tests moved to analysis)
- new plugin: Ansari-Bradley two-sample test TODO: document, make it stable
- place internal objects .rk.rkreply and .rk.available.packages.cache into rkward package environment
Modified: trunk/rkward/rkward/dialogs/rkimportdialog.cpp
===================================================================
--- trunk/rkward/rkward/dialogs/rkimportdialog.cpp 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/dialogs/rkimportdialog.cpp 2007-01-30 15:27:11 UTC (rev 1253)
@@ -89,10 +89,10 @@
}
}
-void RKImportDialog::slotOk () {
+void RKImportDialog::accept () {
RK_TRACE (DIALOGS);
- KFileDialog::slotOk ();
+ KFileDialog::accept ();
int index = format_combo->currentItem ();
QString cid = component_ids[index];
@@ -112,10 +112,10 @@
deleteLater ();
}
-void RKImportDialog::slotCancel () {
+void RKImportDialog::reject () {
RK_TRACE (DIALOGS);
- KFileDialog::slotCancel ();
+ KFileDialog::reject ();
deleteLater ();
}
Modified: trunk/rkward/rkward/dialogs/rkimportdialog.h
===================================================================
--- trunk/rkward/rkward/dialogs/rkimportdialog.h 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/dialogs/rkimportdialog.h 2007-01-30 15:27:11 UTC (rev 1253)
@@ -34,8 +34,8 @@
public slots:
void filterChanged ();
protected:
- void slotOk ();
- void slotCancel ();
+ void accept ();
+ void reject ();
private:
int format_count;
QHBox *format_selection_box;
Modified: trunk/rkward/rkward/misc/rksaveobjectchooser.cpp
===================================================================
--- trunk/rkward/rkward/misc/rksaveobjectchooser.cpp 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/misc/rksaveobjectchooser.cpp 2007-01-30 15:27:11 UTC (rev 1253)
@@ -2,7 +2,7 @@
rksaveobjectchooser - description
-------------------
begin : Mon Nov 27 2006
- copyright : (C) 2006 by Thomas Friedrichsmeier
+ copyright : (C) 2006, 2007 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -61,6 +61,13 @@
RK_TRACE (MISC);
}
+void RKSaveObjectChooser::setObjectName (const QString &name) {
+ RK_TRACE (MISC);
+
+ name_edit->setText (name);
+ nameEditChanged (name);
+}
+
QString RKSaveObjectChooser::validizedSelectedObjectName () {
RK_TRACE (MISC);
@@ -94,12 +101,19 @@
prev_ok = isOk ();
emit (okStatusChanged (isOk ()));
}
+ emit (changed ());
}
-void RKSaveObjectChooser::overwriteConfirmChanged (int checked) {
+void RKSaveObjectChooser::overwriteConfirmChanged (int) {
RK_TRACE (MISC);
nameEditChanged (QString ());
}
+void RKSaveObjectChooser::setBackgroundColor (const QColor &color) {
+ RK_TRACE (MISC);
+
+ name_edit->setBackgroundColor (color);
+}
+
#include "rksaveobjectchooser.moc"
Modified: trunk/rkward/rkward/misc/rksaveobjectchooser.h
===================================================================
--- trunk/rkward/rkward/misc/rksaveobjectchooser.h 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/misc/rksaveobjectchooser.h 2007-01-30 15:27:11 UTC (rev 1253)
@@ -2,7 +2,7 @@
rksaveobjectchooser - description
-------------------
begin : Mon Nov 27 2006
- copyright : (C) 2006 by Thomas Friedrichsmeier
+ copyright : (C) 2006, 2007 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -33,11 +33,14 @@
QString validizedSelectedObjectName ();
bool isOk () const;
+ void setObjectName (const QString &name);
+ void setBackgroundColor (const QColor &color);
public slots:
void nameEditChanged (const QString &);
- void overwriteConfirmChanged (int checked);
+ void overwriteConfirmChanged (int);
signals:
void okStatusChanged (bool);
+ void changed ();
private:
bool allow_overwrite;
bool object_exists;
Modified: trunk/rkward/rkward/plugin/Makefile.am
===================================================================
--- trunk/rkward/rkward/plugin/Makefile.am 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/plugin/Makefile.am 2007-01-30 15:27:11 UTC (rev 1253)
@@ -5,12 +5,12 @@
rkstandardcomponent.cpp rkvarselector.cpp rkvarslot.cpp rkformula.cpp rkradio.cpp \
rkcheckbox.cpp rkpluginspinbox.cpp rkinput.cpp rkpluginbrowser.cpp rktext.cpp \
rktabpage.cpp rkstandardcomponentgui.cpp rkdropdown.cpp rkcomponentcontext.cpp \
- rkpreviewbox.cpp
+ rkpreviewbox.cpp rkpluginsaveobject.cpp
noinst_HEADERS = rkcomponentmap.h rkcomponentproperties.h rkcomponent.h \
rkstandardcomponent.h rkvarselector.h rkvarslot.h rkformula.h rkradio.h \
rkcheckbox.h rkpluginspinbox.h rkinput.h rkpluginbrowser.h rktext.h \
rktabpage.h rkstandardcomponentgui.h rkdropdown.h rkcomponentcontext.h \
- rkpreviewbox.h
+ rkpreviewbox.h rkpluginsaveobject.h
Modified: trunk/rkward/rkward/plugin/rkcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.h 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/plugin/rkcomponent.h 2007-01-30 15:27:11 UTC (rev 1253)
@@ -56,6 +56,7 @@
ComponentTab = 2012,
ComponentDropDown = 2013,
ComponentPreviewBox = 2014,
+ ComponentSaveObject = 2015,
ComponentStandard = 2100,
ComponentUser = 3000 /**< for user expansion */
};
Added: trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp (rev 0)
+++ trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp 2007-01-30 15:27:11 UTC (rev 1253)
@@ -0,0 +1,89 @@
+/***************************************************************************
+ rkpluginsaveobject - description
+ -------------------
+ begin : Tue Jan 30 2007
+ copyright : (C) 2007 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "rkpluginsaveobject.h"
+
+#include <qlayout.h>
+
+#include <klocale.h>
+
+#include "../misc/xmlhelper.h"
+#include "../misc/rksaveobjectchooser.h"
+#include "../rkglobals.h"
+#include "../debug.h"
+
+RKPluginSaveObject::RKPluginSaveObject (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
+ RK_TRACE (PLUGIN);
+
+ // get xml-helper
+ XMLHelper *xml = XMLHelper::getStaticHelper ();
+
+ // create and add property
+ addChild ("selection", selection = new RKComponentPropertyBase (this, xml->getBoolAttribute (element, "required", true, DL_INFO)));
+ connect (selection, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (selectionChanged (RKComponentPropertyBase *)));
+
+ QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
+
+ selector = new RKSaveObjectChooser (this, true, xml->getStringAttribute (element, "initial", i18n ("my.data"), DL_INFO), xml->getStringAttribute (element, "label", i18n ("Save to:"), DL_INFO));
+ connect (selector, SIGNAL (changed ()), SLOT (selectionChanged ()));
+ connect (selector, SIGNAL (okStatusChanged (bool)), SLOT (selectionChanged (bool)));
+
+ vbox->addWidget (selector);
+
+ // initialize
+ updating = true;
+ selectionChanged ();
+ updating = false;
+}
+
+RKPluginSaveObject::~RKPluginSaveObject () {
+ RK_TRACE (PLUGIN);
+}
+
+void RKPluginSaveObject::selectionChanged (RKComponentPropertyBase *) {
+ RK_TRACE (PLUGIN);
+
+ if (updating) return;
+ updating = true;
+
+ selector->setObjectName (selection->value ());
+
+ updating = false;
+ if (isSatisfied ()) selector->setBackgroundColor (QColor (255, 255, 255));
+ else selector->setBackgroundColor (QColor (255, 0, 0));
+ changed ();
+}
+
+void RKPluginSaveObject::selectionChanged () {
+ RK_TRACE (PLUGIN);
+
+ selection->setValue (selector->validizedSelectedObjectName ());
+}
+
+void RKPluginSaveObject::selectionChanged (bool) {
+ RK_TRACE (PLUGIN);
+
+ selectionChanged ();
+}
+
+bool RKPluginSaveObject::isValid () {
+ RK_TRACE (PLUGIN);
+
+ return (RKComponent::isValid () && selector->isOk ());
+}
+
+#include "rkpluginsaveobject.moc"
Added: trunk/rkward/rkward/plugin/rkpluginsaveobject.h
===================================================================
--- trunk/rkward/rkward/plugin/rkpluginsaveobject.h (rev 0)
+++ trunk/rkward/rkward/plugin/rkpluginsaveobject.h 2007-01-30 15:27:11 UTC (rev 1253)
@@ -0,0 +1,52 @@
+/***************************************************************************
+ rkpluginsaveobject - description
+ -------------------
+ begin : Tue Jan 30 2007
+ copyright : (C) 2007 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef RKPLUGINSAVEOBJECT_H
+#define RKPLUGINSAVEOBJECT_H
+
+#include "rkcomponent.h"
+
+#include "rkcomponentproperties.h"
+
+class RKSaveObjectChooser;
+class QDomElement;
+
+/** RKComponent to select an object name to save something to
+
+ at author Thomas Friedrichsmeier
+*/
+
+class RKPluginSaveObject : public RKComponent {
+ Q_OBJECT
+public:
+ RKPluginSaveObject (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget);
+ ~RKPluginSaveObject ();
+
+ RKComponentPropertyBase *selection;
+ QString value (const QString &modifier) { return (selection->value (modifier)); };
+ int type () { return ComponentSaveObject; };
+ bool isValid ();
+public slots:
+ void selectionChanged ();
+ void selectionChanged (bool);
+ void selectionChanged (RKComponentPropertyBase *);
+private:
+ RKSaveObjectChooser *selector;
+ bool updating;
+};
+
+#endif
Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp 2007-01-30 15:27:11 UTC (rev 1253)
@@ -45,6 +45,7 @@
#include "rkpluginspinbox.h"
#include "rkinput.h"
#include "rkpluginbrowser.h"
+#include "rkpluginsaveobject.h"
#include "rkpreviewbox.h"
#include "rktext.h"
#include "rktabpage.h"
@@ -503,6 +504,8 @@
widget = new RKText (e, component (), parent_widget);
} else if (e.tagName () == "preview") {
widget = new RKPreviewBox (e, component (), parent_widget);
+ } else if (e.tagName () == "saveobject") {
+ widget = new RKPluginSaveObject (e, component (), parent_widget);
} else if (e.tagName () == "embed") {
QString component_id = xml->getStringAttribute (e, "component", QString::null, DL_ERROR);
RKComponentHandle *handle = RKComponentMap::getComponentHandle (component_id);
Modified: trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml 2007-01-30 14:40:42 UTC (rev 1252)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_spss.xml 2007-01-30 15:27:11 UTC (rev 1253)
@@ -11,7 +11,7 @@
<dialog label="Import SPSS file">
<browser size="small" id="file" label="File name" />
<stretch/>
- <text>TODO: add selector for object to save to, here</text>
+ <saveobject id="saveto" initial="my.spss.data" label="Object to save to"/>
<stretch/>
<checkbox id="data_frame" checked="true" label="Import as a data.frame"/>
<frame label="Labels">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list