gnucash master: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Wed Mar 1 06:29:49 EST 2017
Updated via https://github.com/Gnucash/gnucash/commit/8e09bae7 (commit)
via https://github.com/Gnucash/gnucash/commit/0078de0b (commit)
via https://github.com/Gnucash/gnucash/commit/22191afb (commit)
from https://github.com/Gnucash/gnucash/commit/7a394321 (commit)
commit 8e09bae7c7278bc9eef7b56280d8b901da10bb88
Author: Geert Janssens <geert at kobaltwit.be>
Date: Wed Mar 1 12:29:40 2017 +0100
Remove redundant gtk_widget_show_all call
diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
index c6fefd1..eba9662 100644
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ b/src/report/report-gnome/gnc-plugin-page-report.c
@@ -379,7 +379,6 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
// this resets the window for the progressbar to NULL
gnc_window_set_progressbar_window( NULL );
- gtk_widget_show_all( GTK_WIDGET(priv->container) );
return FALSE;
}
commit 0078de0be3212967c4a3de3cdbde7d6024d62787
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Feb 20 12:21:58 2017 +0000
Bug 778042 These are the script changes for jqplot reports.
I have added the resize function to all jqplot reports and an on load
function to bar and line charts. This last change is required when a
table is added to the report and the vertical scroll bar appears and
covers part of the plot. This was observed in the Gnucash and also when
opening the generated file in the gnome browser.
diff --git a/src/report/report-system/html-barchart.scm b/src/report/report-system/html-barchart.scm
index 79fafa2..be937f6 100644
--- a/src/report/report-system/html-barchart.scm
+++ b/src/report/report-system/html-barchart.scm
@@ -514,14 +514,41 @@ var plot = $.jqplot('")(push chart-id)(push"', data, options);
plot.axes.xaxis.ticks = getVisualTicks();
plot.replot();
var timer;
+var load_timer;
+
+// var win_width = $(window).width();
+// var win_height = $(window).height();
+// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
+
+// var doc_width = document.body.clientWidth;
+// var doc_height = document.body.clientHeight;
+// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
+
$(window).resize(function () {
clearTimeout(timer);
timer = setTimeout(function () {
plot.replot({resetAxes: true });
+ $.each(plot.series, function(index, series) {
+ series.barWidth = undefined;
+ });
plot.axes.xaxis.ticks = getVisualTicks();
+// console.log( 'Resize Timer!' );
plot.replot();
}, 100);
});
+
+$(window).on('load', function () {
+ var hasVScroll = document.body.scrollHeight > document.body.clientHeight;
+ clearTimeout(load_timer);
+ load_timer = setTimeout(function () {
+// console.log( 'Load Timer!' );
+ if(hasVScroll)
+ {
+// console.log( 'Load Timer Replot!' );
+ plot.replot();
+ }
+ },100);
+ });
});
function formatTooltip(str, seriesIndex, pointIndex) {
@@ -549,6 +576,7 @@ function getVisualTicks() {
else
visual_ticks.push (' ');
}
+// console.log( 'getVis chart_width ' + chart_width );
return visual_ticks;
}\n")
diff --git a/src/report/report-system/html-linechart.scm b/src/report/report-system/html-linechart.scm
index 110e399..ced16fc 100644
--- a/src/report/report-system/html-linechart.scm
+++ b/src/report/report-system/html-linechart.scm
@@ -552,15 +552,49 @@
(push (qof-date-format-get-string (qof-date-format-get)))
(push "';\n")
- (push "$.jqplot.config.enablePlugins = true;")
- (push "var plot = $.jqplot('")(push chart-id)(push"', data, options);
-
- function formatTooltip(str, seriesIndex, pointIndex) {
- x = $.jqplot.DateTickFormatter (options.axes.xaxis.tickOptions.formatString,
- data[seriesIndex][pointIndex][0]);
- y = data[seriesIndex][pointIndex][1].toFixed(2);
- return options.series[seriesIndex].label + ' ' + x + '<br><b>' + y + '</b>';
- }\n")
+ (push "$.jqplot.config.enablePlugins = true;\n")
+ (push "$(document).ready(function() {
+var plot = $.jqplot('")(push chart-id)(push"', data, options);
+plot.replot();
+var timer;
+var load_timer;
+
+// var win_width = $(window).width();
+// var win_height = $(window).height();
+// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
+
+// var doc_width = document.body.clientWidth;
+// var doc_height = document.body.clientHeight;
+// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
+
+$(window).resize(function () {
+ clearTimeout(timer);
+ timer = setTimeout(function () {
+// console.log( 'Resize Timer!' );
+ plot.replot();
+ }, 100);
+ });
+
+$(window).on('load', function () {
+ var hasVScroll = document.body.scrollHeight > document.body.clientHeight;
+ clearTimeout(load_timer);
+ load_timer = setTimeout(function () {
+// console.log( 'Load Timer!' );
+ if(hasVScroll)
+ {
+// console.log( 'Load Timer Replot!' );
+ plot.replot();
+ }
+ },100);
+ });
+});
+
+function formatTooltip(str, seriesIndex, pointIndex) {
+ x = $.jqplot.DateTickFormatter (options.axes.xaxis.tickOptions.formatString,
+ data[seriesIndex][pointIndex][0]);
+ y = data[seriesIndex][pointIndex][1].toFixed(2);
+ return options.series[seriesIndex].label + ' ' + x + '<br><b>' + y + '</b>';
+}\n")
(push "});\n</script>")
diff --git a/src/report/report-system/html-piechart.scm b/src/report/report-system/html-piechart.scm
index adcf29e..582c2ec 100644
--- a/src/report/report-system/html-piechart.scm
+++ b/src/report/report-system/html-piechart.scm
@@ -257,7 +257,28 @@
(push ")\";\n")))
(push "$.jqplot.config.enablePlugins = true;\n")
- (push "var plot = $.jqplot('")(push chart-id)(push "', [data], options);\n")
+ (push "$(document).ready(function() {
+var plot = $.jqplot('")(push chart-id)(push "', [data], options);
+plot.replot();
+var timer;
+
+// var win_width = $(window).width();
+// var win_height = $(window).height();
+// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
+
+// var doc_width = document.body.clientWidth;
+// var doc_height = document.body.clientHeight;
+// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
+
+$(window).resize(function () {
+ clearTimeout(timer);
+ timer = setTimeout(function () {
+// console.log( 'Resize Timer!' );
+ plot.replot();
+ }, 100);
+ });
+});\n")
+
(push "});\n</script>"))
(begin (gnc:warn "null-data, not rendering piechart")
" "))
diff --git a/src/report/report-system/html-scatter.scm b/src/report/report-system/html-scatter.scm
index 6fbe71c..13a7440 100644
--- a/src/report/report-system/html-scatter.scm
+++ b/src/report/report-system/html-scatter.scm
@@ -229,7 +229,27 @@
(push "$.jqplot.config.enablePlugins = true;\n")
- (push "var plot = $.jqplot('")(push chart-id)(push "', [data], options);\n")
+ (push "$(document).ready(function() {
+var plot = $.jqplot('")(push chart-id)(push "', [data], options);
+plot.replot();
+var timer;
+
+// var win_width = $(window).width();
+// var win_height = $(window).height();
+// console.log( 'Window Width ' + win_width + ' Height ' + win_height);
+
+// var doc_width = document.body.clientWidth;
+// var doc_height = document.body.clientHeight;
+// console.log( 'Doc Width ' + doc_width + ' Height ' + doc_height);
+
+$(window).resize(function () {
+ clearTimeout(timer);
+ timer = setTimeout(function () {
+// console.log( 'Resize Timer!' );
+ plot.replot();
+ }, 100);
+ });
+});\n")
(push "});\n</script>"))
(begin
commit 22191afb1eb1ef946f05b0e7b4b909a8f4c2c0bc
Author: Robert Fewell <14uBobIT at gmail.com>
Date: Mon Feb 20 12:16:09 2017 +0000
Bug 778042 Change the way reports are loaded in conjunction with script changes.
With these changes the reports are not created until the page is shown,
realized. It still uses the idle add to create the page but is started
from the realized call back. Doing it this way has the added advantage
that if the app is closed on a non report page, the next start up is
quicker as the reports are not created.
diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c
index 1ce7930..c6fefd1 100644
--- a/src/report/report-gnome/gnc-plugin-page-report.c
+++ b/src/report/report-gnome/gnc-plugin-page-report.c
@@ -341,7 +341,6 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
{
GncPluginPageReport *report;
GncPluginPageReportPrivate *priv;
- GtkAllocation allocation;
URLType type;
char * id_name;
char * child_name;
@@ -351,6 +350,8 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
report = GNC_PLUGIN_PAGE_REPORT(page);
priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(report);
+ // FIXME. This is f^-1(f(x)), isn't it?
+ DEBUG( "Load uri id=%d", priv->reportId );
id_name = g_strdup_printf("id=%d", priv->reportId );
child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label);
@@ -362,6 +363,8 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
g_free(id_name);
g_free(child_name);
+ gtk_widget_show_all( GTK_WIDGET(priv->container) );
+
// this sets the window for the progressbar
gnc_window_set_progressbar_window( GNC_WINDOW(page->window) );
@@ -376,9 +379,22 @@ gnc_plugin_page_report_load_uri (GncPluginPage *page)
// this resets the window for the progressbar to NULL
gnc_window_set_progressbar_window( NULL );
+ gtk_widget_show_all( GTK_WIDGET(priv->container) );
return FALSE;
}
+static void
+gnc_plugin_page_report_realize_uri (GtkWidget *widget, GncPluginPage *page)
+{
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ PINFO("Realized Container size is %dw x %dh", allocation.width, allocation.height);
+
+ /* load uri when view idle */
+ g_idle_add ((GSourceFunc)gnc_plugin_page_report_load_uri, page);
+}
+
static
GtkWidget*
gnc_plugin_page_report_create_widget( GncPluginPage *page )
@@ -386,6 +402,11 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page )
GncPluginPageReport *report;
GncPluginPageReportPrivate *priv;
GtkWindow *topLvl;
+ URLType type;
+ char * id_name;
+ char * child_name;
+ char * url_location = NULL;
+ char * url_label = NULL;
ENTER("page %p", page);
@@ -416,16 +437,25 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page )
gnc_html_set_urltype_cb(priv->html, gnc_plugin_page_report_check_urltype);
gnc_html_set_load_cb(priv->html, gnc_plugin_page_report_load_cb, report);
+ /* We need to call the load call back so the report appears to of been run
+ so it will get saved properly if the report is not realized in session */
+ id_name = g_strdup_printf("id=%d", priv->reportId );
+ child_name = gnc_build_url( URL_TYPE_REPORT, id_name, NULL );
+ type = gnc_html_parse_url( priv->html, child_name, &url_location, &url_label);
+
+ gnc_plugin_page_report_load_cb (priv->html, type, id_name, url_label, report);
+ g_free(id_name);
+ g_free(child_name);
+
// FIXME. This is f^-1(f(x)), isn't it?
DEBUG( "id=%d", priv->reportId );
- /* load uri when view idle */
- g_idle_add ((GSourceFunc)gnc_plugin_page_report_load_uri, page);
+ /* load uri when view is realized */
+ g_signal_connect (G_OBJECT(GTK_WIDGET(priv->container)), "realize",
+ G_CALLBACK(gnc_plugin_page_report_realize_uri), page);
gtk_widget_show_all( GTK_WIDGET(priv->container) );
-
LEAVE("container %p", priv->container);
-
return GTK_WIDGET( priv->container );
}
Summary of changes:
src/report/report-gnome/gnc-plugin-page-report.c | 39 +++++++++++++++---
src/report/report-system/html-barchart.scm | 28 +++++++++++++
src/report/report-system/html-linechart.scm | 52 ++++++++++++++++++++----
src/report/report-system/html-piechart.scm | 23 ++++++++++-
src/report/report-system/html-scatter.scm | 22 +++++++++-
5 files changed, 148 insertions(+), 16 deletions(-)
More information about the gnucash-changes
mailing list