[rkward-cvs] SF.net SVN: rkward: [1827] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Apr 18 18:41:39 UTC 2007
Revision: 1827
http://svn.sourceforge.net/rkward/?rev=1827&view=rev
Author: tfry
Date: 2007-04-18 11:41:39 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Add possibility to blacklist packages from .rk.get.structure, and blacklist package GO
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/core/renvironmentobject.cpp
trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.cpp
trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2007-04-18 18:07:34 UTC (rev 1826)
+++ trunk/rkward/ChangeLog 2007-04-18 18:41:39 UTC (rev 1827)
@@ -1,3 +1,6 @@
+- add possibility to blacklist packages from fetching structure information. Package GO is blacklisted by default.
+- when fetching the structure of "promise" R objects, don't keep them in memory
+- optimize the function to retrieve the structure of R object (for display in the object browser, and completion)
- tab-completion in the console will do partial completion, if all potential completion have a common start
- fixed: file-name completion would always assume the home directory as the current directory
- compilation fix for FreeBSD (thanks to Thierry Thomas)
Modified: trunk/rkward/rkward/core/renvironmentobject.cpp
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.cpp 2007-04-18 18:07:34 UTC (rev 1826)
+++ trunk/rkward/rkward/core/renvironmentobject.cpp 2007-04-18 18:41:39 UTC (rev 1827)
@@ -16,8 +16,13 @@
***************************************************************************/
#include "renvironmentobject.h"
+
+#include <kmessagebox.h>
+#include <klocale.h>
+
#include "robjectlist.h"
#include "../rbackend/rinterface.h"
+#include "../settings/rksettingsmoduleobjectbrowser.h"
#include "../rkglobals.h"
#include "../debug.h"
@@ -81,6 +86,13 @@
void REnvironmentObject::updateFromR (RCommandChain *chain) {
RK_TRACE (OBJECTS);
+ if (type & PackageEnv) {
+ if (RKSettingsModuleObjectBrowser::isPackageBlacklisted (namespace_name)) {
+ KMessageBox::information (0, i18n ("The package '%1' (probably you just loaded it) is currently blacklisted for retrieving structure information. Practically this means, the objects in this package will not appear in the object browser, and there will be no object name completion or function argument hinting for objects in this package.\nPackages will typically be blacklisted, if they contain huge amount of data, that would take too long to load. To unlist the package, visit Settings->Configure RKWard->Workspace.").arg (namespace_name), i18n("Package blacklisted"), "packageblacklist" + namespace_name);
+ return;
+ }
+ }
+
QString options;
if (type & GlobalEnv) options = ", envlevel=-1"; // in the .GlobalEnv recurse one more level
if (type & ToplevelEnv) options.append (", namespacename=" + rQuote (namespace_name));
Modified: trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.cpp 2007-04-18 18:07:34 UTC (rev 1826)
+++ trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.cpp 2007-04-18 18:41:39 UTC (rev 1827)
@@ -19,17 +19,20 @@
#include <klocale.h>
#include <kconfig.h>
+#include <kinputdialog.h>
#include <qlayout.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include "../rkglobals.h"
+#include "../misc/multistringselector.h"
#include "rksettings.h"
#include "../debug.h"
// static
bool RKSettingsModuleObjectBrowser::settings[RKObjectListViewSettings::SettingsCount];
+QStringList RKSettingsModuleObjectBrowser::getstructure_blacklist;
RKSettingsModuleObjectBrowser::RKSettingsModuleObjectBrowser (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
RK_TRACE (SETTINGS);
@@ -69,6 +72,12 @@
checkboxes[i]->setChecked (settings[i]);
connect (checkboxes[i], SIGNAL (stateChanged (int)), this, SLOT (boxChanged (int)));
}
+
+ blacklist_choser = new MultiStringSelector (i18n ("Never fetch the structure of these packages:"), this);
+ blacklist_choser->setValues (getstructure_blacklist);
+ connect (blacklist_choser, SIGNAL (listChanged ()), this, SLOT (listChanged ()));
+ connect (blacklist_choser, SIGNAL (getNewStrings (QStringList*)), this, SLOT (addBlackList (QStringList*)));
+ layout->addWidget (blacklist_choser);
}
RKSettingsModuleObjectBrowser::~RKSettingsModuleObjectBrowser () {
@@ -81,6 +90,18 @@
return settings[setting];
}
+//static
+bool RKSettingsModuleObjectBrowser::isPackageBlacklisted (const QString &package_name) {
+ RK_TRACE (SETTINGS);
+ return getstructure_blacklist.contains (package_name);
+}
+
+void RKSettingsModuleObjectBrowser::addBlackList (QStringList *string_list) {
+ RK_TRACE (SETTINGS);
+ QString new_string = KInputDialog::getText (i18n ("Add exclusion"), i18n ("Add the name of the package that no structure should be fetched for"), QString::null, 0, this);
+ (*string_list).append (new_string);
+}
+
bool RKSettingsModuleObjectBrowser::hasChanges () {
RK_TRACE (SETTINGS);
return changed;
@@ -92,6 +113,7 @@
for (int i = 0; i < RKObjectListViewSettings::SettingsCount; ++i) {
settings[i] = checkboxes[i]->isChecked ();
}
+ getstructure_blacklist = blacklist_choser->getValues();
RKSettings::tracker ()->settingsChangedObjectBrowser ();
}
@@ -119,6 +141,8 @@
config->writeEntry ("show label field", settings[RKObjectListViewSettings::ShowFieldsLabel]);
config->writeEntry ("show type field", settings[RKObjectListViewSettings::ShowFieldsType]);
config->writeEntry ("show class field", settings[RKObjectListViewSettings::ShowFieldsClass]);
+
+ config->writeEntry ("package blacklist", getstructure_blacklist);
}
//static
@@ -134,6 +158,11 @@
settings[RKObjectListViewSettings::ShowFieldsLabel] = config->readBoolEntry ("show label field", true);
settings[RKObjectListViewSettings::ShowFieldsType] = config->readBoolEntry ("show type field", true);
settings[RKObjectListViewSettings::ShowFieldsClass] = config->readBoolEntry ("show class field", true);
+
+ getstructure_blacklist = config->readListEntry ("package blacklist");
+ if (!getstructure_blacklist.count ()) {
+ getstructure_blacklist.append ("GO");
+ }
}
void RKSettingsModuleObjectBrowser::boxChanged (int) {
@@ -141,4 +170,9 @@
change ();
}
+void RKSettingsModuleObjectBrowser::listChanged () {
+ RK_TRACE (SETTINGS);
+ change ();
+}
+
#include "rksettingsmoduleobjectbrowser.moc"
Modified: trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.h 2007-04-18 18:07:34 UTC (rev 1826)
+++ trunk/rkward/rkward/settings/rksettingsmoduleobjectbrowser.h 2007-04-18 18:41:39 UTC (rev 1827)
@@ -23,6 +23,7 @@
#include "../misc/rkobjectlistview.h"
class QCheckBox;
+class MultiStringSelector;
/** Configuration module for instances of RObjectListView
@see RKSettingsModule
@@ -50,10 +51,17 @@
static void loadSettings (KConfig *config);
static bool isSettingActive (RKObjectListViewSettings::Settings setting);
+
+ static bool isPackageBlacklisted (const QString &package_name);
public slots:
/** called when a checkbox has been changed. Signals change to RKSettings dialog to enable apply button */
void boxChanged (int);
+ void listChanged ();
+ void addBlackList (QStringList *string_list);
private:
+ MultiStringSelector *blacklist_choser;
+ static QStringList getstructure_blacklist;
+
QCheckBox **checkboxes;
static bool settings[RKObjectListViewSettings::SettingsCount];
};
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