evince r3570 - in trunk: . shell test
- From: nshmyrev svn gnome org
- To: svn-commits-list gnome org
- Subject: evince r3570 - in trunk: . shell test
- Date: Sat, 4 Apr 2009 21:34:19 +0000 (UTC)
Author: nshmyrev
Date: Sat Apr 4 21:34:19 2009
New Revision: 3570
URL: http://svn.gnome.org/viewvc/evince?rev=3570&view=rev
Log:
2009-04-05 Nickolay V. Shmyrev <nshmyrev yandex ru>
* shell/ev-print-operation.c (clamp_ranges),
(ev_print_operation_export_print_dialog_response_cb):
* test/Makefile.am:
* test/test7.py:
Patch by Juanjo MarÃn <juanj marin juntadeandalucia es> to fix
the bug 517735. Fixes preview of the empty selection.
Added:
trunk/test/test7.py (contents, props changed)
Modified:
trunk/ChangeLog
trunk/shell/ev-print-operation.c
trunk/test/Makefile.am
Modified: trunk/shell/ev-print-operation.c
==============================================================================
--- trunk/shell/ev-print-operation.c (original)
+++ trunk/shell/ev-print-operation.c Sat Apr 4 21:34:19 2009
@@ -576,12 +576,13 @@
}
}
-static void
+static gboolean
clamp_ranges (EvPrintOperationExport *export)
{
gint num_of_correct_ranges = 0;
gint n_pages_to_print = 0;
gint i;
+ gboolean null_flag = FALSE;
for (i = 0; i < export->n_ranges; i++) {
gint n_pages;
@@ -612,16 +613,27 @@
} else if (n_pages % 2 == 0) {
n_pages_to_print += n_pages / 2;
} else if (export->page_set == GTK_PAGE_SET_EVEN) {
- n_pages_to_print += export->ranges[i].start % 2 == 0 ?
+ if (n_pages==1 && export->ranges[i].start % 2 == 0)
+ null_flag = TRUE;
+ else
+ n_pages_to_print += export->ranges[i].start % 2 == 0 ?
n_pages / 2 : (n_pages / 2) + 1;
} else if (export->page_set == GTK_PAGE_SET_ODD) {
- n_pages_to_print += export->ranges[i].start % 2 == 0 ?
+ if (n_pages==1 && export->ranges[i].start % 2 != 0)
+ null_flag = TRUE;
+ else
+ n_pages_to_print += export->ranges[i].start % 2 == 0 ?
(n_pages / 2) + 1 : n_pages / 2;
}
}
- export->n_ranges = num_of_correct_ranges;
- export->n_pages_to_print = n_pages_to_print;
+ if (null_flag && !n_pages_to_print) {
+ return FALSE;
+ } else {
+ export->n_ranges = num_of_correct_ranges;
+ export->n_pages_to_print = n_pages_to_print;
+ return TRUE;
+ }
}
static void
@@ -988,8 +1000,6 @@
return;
}
- ev_print_operation_update_status (op, -1, -1, 0.0);
-
export->print_preview = (response == GTK_RESPONSE_APPLY);
printer = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (dialog));
@@ -1062,8 +1072,25 @@
break;
}
- clamp_ranges (export);
+ if (!clamp_ranges (export)) {
+ GtkWidget *message_dialog;
+
+ message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CLOSE,
+ "%s", _("Invalid page selection"));
+ gtk_window_set_title (GTK_WINDOW (message_dialog), _("Warning"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
+ "%s", _("Your print range selection does not include any page"));
+ g_signal_connect (message_dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+ gtk_widget_show (message_dialog);
+ return;
+ } else ev_print_operation_update_status (op, -1, -1, 0.0);
+
width = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS);
height = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS);
scale = gtk_print_settings_get_scale (print_settings) * 0.01;
Modified: trunk/test/Makefile.am
==============================================================================
--- trunk/test/Makefile.am (original)
+++ trunk/test/Makefile.am Sat Apr 4 21:34:19 2009
@@ -5,7 +5,8 @@
test3.py \
test4.py \
test5.py \
- test6.py
+ test6.py \
+ test7.py
TESTS = $(dist_check_SCRIPTS)
Added: trunk/test/test7.py
==============================================================================
--- (empty file)
+++ trunk/test/test7.py Sat Apr 4 21:34:19 2009
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+
+# Test printing
+
+import os
+os.environ['LANG']='C'
+srcdir = os.environ['srcdir']
+
+from dogtail.procedural import *
+
+run('evince', arguments=' '+srcdir+'/test-page-labels.pdf')
+
+#!/usr/bin/python
+from dogtail.procedural import *
+
+focus.application('evince')
+focus.frame('test-page-labels.pdf')
+click('File', roleName='menu')
+click('Print...', roleName='menu item')
+focus.dialog('Print')
+click('Pages:', roleName='radio button')
+keyCombo('Tab')
+type('1')
+click('Page Setup', roleName='page tab', raw=True)
+click('All sheets')
+click('Even sheets')
+click('Print Preview', roleName='push button')
+keyCombo('Return')
+click('Cancel')
+
+# Close evince
+click('File', roleName='menu')
+click('Close', roleName='menu item')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]