[rkward] /: Expand root level objects (esp. data.frames) by default in plugin object lists. Add tool button to toggle back to collapsed.

Thomas Friedrichsmeier null at kde.org
Tue May 15 07:29:22 UTC 2018


Git commit 102f0d290f80e6224bfb9cf057391dd3e1bd91c9 by Thomas Friedrichsmeier.
Committed on 15/05/2018 at 07:27.
Pushed by tfry into branch 'master'.

Expand root level objects (esp. data.frames) by default in plugin object lists. Add tool button to toggle back to collapsed.

The setting is implicitly remebered within a session, as depending on context, one or the other may be more useful as default.

M  +3    -0    ChangeLog
M  +26   -1    rkward/plugin/rkvarselector.cpp
M  +5    -1    rkward/plugin/rkvarselector.h
M  +1    -0    rkward/plugins/plots/piechart.xml

https://commits.kde.org/rkward/102f0d290f80e6224bfb9cf057391dd3e1bd91c9

diff --git a/ChangeLog b/ChangeLog
index 5c78f261..db45b39e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
 --- Version 0.7.1 - UNRELEASED
+- Expand root level objects (esp. data.frames) by default in plugin object lists. Add button to toggle back to collapsed.
+- Allow Tab-key to advance to the next row of data in data editor
+- Fix highlighting of "trailing" rows and columns in data editor
 - Fixed: Loading existing workspace from startup dialog failed silently.
 - Support handling of help:/ pages (e.g. RKWard plugins documentation) inside the RKWard help window, again.
 - Do not attempt object name hinting behind empty quoted strings or spaces.
diff --git a/rkward/plugin/rkvarselector.cpp b/rkward/plugin/rkvarselector.cpp
index cd1a0232..98c49114 100644
--- a/rkward/plugin/rkvarselector.cpp
+++ b/rkward/plugin/rkvarselector.cpp
@@ -2,7 +2,7 @@
                           rkvarselector.cpp  -  description
                              -------------------
     begin                : Thu Nov 7 2002
-    copyright            : (C) 2002-2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2002-2018 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -30,11 +30,14 @@
 #include "../rkglobals.h"
 #include "../misc/rkobjectlistview.h"
 #include "../misc/rkstandardicons.h"
+#include "../misc/rkcommonfunctions.h"
 #include "../core/robjectlist.h"
 #include "../core/renvironmentobject.h"
 
 #include "../debug.h"
 
+bool RKVarSelector::expanded = true;
+
 RKVarSelector::RKVarSelector (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
 	RK_TRACE (PLUGIN);
 
@@ -55,6 +58,11 @@ RKVarSelector::RKVarSelector (const QDomElement &element, RKComponent *parent_co
 	vbox->addLayout (hbox);
 	QLabel *label = new QLabel (xml->i18nStringAttribute (element, "label", i18n ("Select Variable(s)"), DL_INFO), this);
 	hbox->addWidget (label);
+	expand_collapse_button = new QToolButton (this);
+	expand_collapse_button->setPopupMode (QToolButton::InstantPopup);
+	expand_collapse_button->setAutoRaise (true);
+	connect (expand_collapse_button, &QToolButton::clicked, this, &RKVarSelector::toggleLevel1);
+	hbox->addWidget (expand_collapse_button);
 	QToolButton *advanced_button = new QToolButton (this);
 	advanced_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionConfigureGeneric));
 	advanced_button->setPopupMode (QToolButton::InstantPopup);
@@ -89,6 +97,8 @@ RKVarSelector::RKVarSelector (const QDomElement &element, RKComponent *parent_co
 	advanced_button->setMenu (list_view->contextMenu ());
 
 	rootChanged ();
+	expanded = !expanded; // toggled right back, below
+	toggleLevel1 ();
 }
 
 RKVarSelector::~RKVarSelector () {
@@ -120,6 +130,21 @@ void RKVarSelector::rootChanged () {
 	list_view->setRootObject (object);
 }
 
+void RKVarSelector::toggleLevel1 () {
+	RK_TRACE (PLUGIN);
+
+	if (expanded) {
+		expand_collapse_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionExpandDown));
+		RKCommonFunctions::setTips (i18n ("Expand all root level objects (show columns of data.frames)"), expand_collapse_button);
+		list_view->collapseAll ();
+	} else {
+		expand_collapse_button->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionCollapseUp));
+		RKCommonFunctions::setTips (i18n ("Collapse all root level objects (hide columns of data.frames)"), expand_collapse_button);
+		list_view->expandToDepth (1);
+	}
+	expanded = !expanded;
+}
+
 void RKVarSelector::objectSelectionChanged () {
 	RK_TRACE (PLUGIN);
 
diff --git a/rkward/plugin/rkvarselector.h b/rkward/plugin/rkvarselector.h
index fdb96752..0af828c6 100644
--- a/rkward/plugin/rkvarselector.h
+++ b/rkward/plugin/rkvarselector.h
@@ -2,7 +2,7 @@
                           rkvarselector.h  -  description
                              -------------------
     begin                : Thu Nov 7 2002
-    copyright            : (C) 2002-2015 by Thomas Friedrichsmeier
+    copyright            : (C) 2002-2018 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -25,6 +25,7 @@ class RKObjectListView;
 class QDomElement;
 class QAction;
 class QVBoxLayout;
+class QToolButton;
 
 /** This is an especially important RK-plugin-widget. It provides a list of variables, that
 can be selected for statistical analysis.
@@ -44,6 +45,7 @@ private slots:
 	void objectSelectionChanged ();
 	void rootChanged ();
 	void showFilterWidget ();
+	void toggleLevel1 ();
 private:
 	RKObjectListView *list_view;
 	RKComponentPropertyRObjects *selected;
@@ -52,6 +54,8 @@ private:
 	QAction *show_all_envs_action;
 	QWidget *filter_widget;
 	QVBoxLayout *filter_widget_placeholder;
+	QToolButton *expand_collapse_button;
+	static bool expanded;
 };
 
 #endif
diff --git a/rkward/plugins/plots/piechart.xml b/rkward/plugins/plots/piechart.xml
index 408f5132..9f2e026d 100644
--- a/rkward/plugins/plots/piechart.xml
+++ b/rkward/plugins/plots/piechart.xml
@@ -43,6 +43,7 @@
 					<varselector id="vars"/>
 					<column>
 						<varslot min_vars="1" id="x" source="vars" required="true" label="Variable"/>
+						<text>- or -</text>
 						<frame id="tabulate" label="Tabulate data before plotting" checkable="true" checked="false">
 							<embed id="tabulate_options" component="rkward::one_var_tabulation" as_button="false" label="Tabulation Options"/>
 						</frame>



More information about the rkward-tracker mailing list