Merge lp:~gatesphere/leo-editor/printing into lp:leo-editor

Proposed by Jake Peck
Status: Merged
Merged at revision: 5779
Proposed branch: lp:~gatesphere/leo-editor/printing
Merge into: lp:leo-editor
Diff against target: 514 lines (+351/-18)
4 files modified
leo/config/leoSettings.leo (+22/-9)
leo/core/LeoPyRef.leo (+7/-7)
leo/plugins/leoPluginsRef.leo (+5/-2)
leo/plugins/printing.py (+317/-0)
To merge this branch: bzr merge lp:~gatesphere/leo-editor/printing
Reviewer Review Type Date Requested Status
The Leo editor team Pending
Review via email: mp+163725@code.launchpad.net

Description of the change

Adds a printing plugin that allows printing and print-previewing from the Qt GUI. Offers several printing modes, including single node, marked nodes, and expanded node (filling in all @others, <<sections>>, etc.). All of these are available in two modes - body only, or with headlines.

All unit tests pass.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'leo/config/leoSettings.leo'
2--- leo/config/leoSettings.leo 2013-05-13 05:40:49 +0000
3+++ leo/config/leoSettings.leo 2013-05-14 14:51:04 +0000
4@@ -93,9 +93,9 @@
5 <v t="ekr.20041119035704.3"><vh>\@type type-name: base-type = [list of valid values]</vh></v>
6 <v t="ekr.20041120155431.2"><vh>\@type type-name: script: script-name</vh></v>
7 </v>
8-<v t="ekr.20061011082224"><vh>Candidates for settings in myLeoSettings.leo</vh>
9+<v t="ekr.20061011082224" a="E"><vh>Candidates for settings in myLeoSettings.leo</vh>
10 <v t="ekr.20070224073109.1"><vh>@enabled-plugins</vh></v>
11-<v t="ekr.20110611092035.16470"><vh>Appearance</vh>
12+<v t="ekr.20110611092035.16470" a="E"><vh>Appearance</vh>
13 <v t="ekr.20111024091133.16701"><vh>@@@int qt-tab-width = 40</vh></v>
14 <v t="ekr.20081018053140.12"><vh>@data qt-gui-plugin-style-sheet</vh></v>
15 <v t="ekr.20081023060109.13"><vh>@int qt-rich-text-zoom-in = 10</vh></v>
16@@ -103,7 +103,7 @@
17 <v t="ekr.20070604075218"><vh>@bool use_chapter_tabs = True</vh></v>
18 <v t="ekr.20070318065601"><vh>@bool use_chapters = True</vh></v>
19 </v>
20-<v t="ekr.20110611092035.16471"><vh>Colorizer &amp; colors</vh>
21+<v t="ekr.20110611092035.16471" a="E"><vh>Colorizer &amp; colors</vh>
22 <v t="ekr.20060201111002"><vh>@bool use_syntax_coloring = True</vh></v>
23 <v t="ekr.20041119034357.67"><vh>@color split_bar_color = LightSteelBlue2</vh></v>
24 <v t="ekr.20081018053140.12"></v>
25@@ -515,7 +515,7 @@
26 </v>
27 </v>
28 <v t="ekr.20070224073109.1"></v>
29-<v t="ekr.20041119034357.1"><vh>@settings</vh>
30+<v t="ekr.20041119034357.1" a="E"><vh>@settings</vh>
31 <v t="ekr.20100904134301.11000"><vh>Abbreviations</vh>
32 <v t="ekr.20100904134301.11006"><vh>@bool enable-abbreviations = False</vh></v>
33 <v t="ekr.20100904134301.11002"><vh>@data global-abbreviations</vh></v>
34@@ -527,7 +527,7 @@
35 <v t="tbrown.20120821183537.18663"><vh>@string abbreviations-place-start = &lt;|</vh></v>
36 <v t="tbrown.20120821183537.18662"><vh>@string abbreviations-place-end = |&gt;</vh></v>
37 </v>
38-<v t="ekr.20110611092035.16470"></v>
39+<v t="ekr.20110611092035.16470" a="E"></v>
40 <v t="ekr.20110510071925.14588"><vh>Autocompleter</vh>
41 <v t="ekr.20110512085854.14461"><vh>@bool auto_tab_complete = False</vh></v>
42 <v t="ekr.20051027175030"><vh>@bool autocomplete-brackets = False</vh></v>
43@@ -536,7 +536,7 @@
44 <v t="ekr.20110510071925.14590"><vh>@@@bool use_codewise = False</vh></v>
45 <v t="ekr.20110510071925.14589"><vh>@bool use_qcompleter = True</vh></v>
46 </v>
47-<v t="ekr.20110611092035.16471"></v>
48+<v t="ekr.20110611092035.16471" a="E"></v>
49 <v t="ekr.20041119034357.10"><vh>Command options</vh>
50 <v t="ekr.20111115083813.12518"><vh>@bool indent_added_comments = True</vh></v>
51 <v t="ekr.20041119041019.1"><vh>@string remove_sentinels_extension = .txt</vh></v>
52@@ -1389,7 +1389,7 @@
53 <v t="ekr.20110611092035.16492"><vh>Mouse</vh>
54 <v t="ekr.20080324105006.6"><vh>@bool allow_middle_button_paste = False</vh></v>
55 </v>
56-<v t="ekr.20051123100536"><vh>Plugins</vh>
57+<v t="ekr.20051123100536" a="E"><vh>Plugins</vh>
58 <v t="ekr.20041119034357.13"><vh>@bool use_plugins = True</vh></v>
59 <v t="ekr.20071113084330"><vh>@bool warn_when_plugins_fail_to_load = True</vh></v>
60 <v t="ekr.20070224073109.1"></v>
61@@ -1453,6 +1453,10 @@
62 <v t="ekr.20060922110220"><vh>@bool opml_write_uAs = True</vh></v>
63 <v t="ekr.20060919171527.2"><vh>@string opml_namespace = leo:com:leo-opml-version-1</vh></v>
64 </v>
65+<v t="peckj.20130514082859.5599" a="E"><vh>printing plugin</vh>
66+<v t="peckj.20130514082859.5600"><vh>@string printing-font-size = 12</vh></v>
67+<v t="peckj.20130514082859.5601"><vh>@string printing-font-family = DejaVu Sans Mono</vh></v>
68+</v>
69 <v t="ekr.20081018053140.11"><vh>qtGui plugin</vh>
70 <v t="ekr.20110611092035.16472"><vh>Don't change these unless you know what you are doing</vh>
71 <v t="ekr.20081023060109.14"><vh>@bool qt-use-scintilla = False</vh></v>
72@@ -1462,7 +1466,7 @@
73 </v>
74 </v>
75 <v t="ekr.20071213060239"><vh>rst3 plugin</vh>
76-<v t="ekr.20071213060239.1"><vh>rst3 http options</vh>
77+<v t="ekr.20071213060239.1" a="E"><vh>rst3 http options</vh>
78 <v t="ekr.20071213061454"><vh>@bool rst3_clear_http_attributes = False</vh></v>
79 <v t="ekr.20071213061454.1"><vh>@bool rst3_http_server_support = False</vh></v>
80 <v t="ekr.20071213061454.2"><vh>@string rst3_http_attributename = rst_http_attribute</vh></v>
81@@ -1487,7 +1491,7 @@
82 <v t="ekr.20071213061923.2"><vh>@bool rst3_generate_rst = True</vh></v>
83 <v t="ekr.20090430075506.7"><vh>@bool rst3_generate_rst_header_comment = True</vh></v>
84 </v>
85-<v t="ekr.20071213060514.2"><vh>rst3 formatting options</vh>
86+<v t="ekr.20071213060514.2" a="E"><vh>rst3 formatting options</vh>
87 <v t="ekr.20071213061930.1"><vh>@bool rst3_show_headlines = True</vh></v>
88 <v t="ekr.20071213061930.2"><vh>@bool rst3_show_organizer_nodes = True</vh></v>
89 <v t="ekr.20071213061930.3"><vh>@bool rst3_show_options_nodes = False</vh></v>
90@@ -4461,6 +4465,7 @@
91 stickynotes.py
92 todo.py
93 viewrendered.py
94+printing.py
95
96 # Alphabetical list of all Leo plugins.
97
98@@ -9733,6 +9738,14 @@
99 action will be used instead.</t>
100 <t tx="leohag.20081204085551.13"></t>
101 <t tx="nh910.20110621123823.3423"></t>
102+<t tx="peckj.20130514082859.5599"></t>
103+<t tx="peckj.20130514082859.5600">This defines the font size for body text in print outs.
104+
105+Size is in px. Default 12.</t>
106+<t tx="peckj.20130514082859.5601">This determines the font family for print outs. It's highly recommended
107+to choose a monospaced font.
108+
109+Default: DejaVu Sans Mono</t>
110 <t tx="tbrown.20081003103821.1">True: if the same file (basename) occurs more than once in the recent files
111 list, i.e. on two different paths it will appear as a submenu with the basename
112 as its heading, and the two (or more) paths as its entries. This is easier to
113
114=== modified file 'leo/core/LeoPyRef.leo'
115--- leo/core/LeoPyRef.leo 2013-05-01 16:19:39 +0000
116+++ leo/core/LeoPyRef.leo 2013-05-14 14:51:04 +0000
117@@ -27,8 +27,7 @@
118 expanded="ekr.20120329072206.9701,"><vh>@file ../doc/leoProjects.txt</vh></v>
119 </v>
120 <v t="EKR.20040519090151.2"><vh>To do</vh>
121-<v t="ekr.20100119205347.6015"
122-marks="ekr.20111116103733.9818,"><vh>@file ../doc/leoToDo.txt</vh></v>
123+<v t="ekr.20100119205347.6015"><vh>@file ../doc/leoToDo.txt</vh></v>
124 </v>
125 <v t="ekr.20031218072017.2406" a="E"><vh>Code</vh>
126 <v t="ekr.20090802181029.5988"><vh>Version</vh>
127@@ -42,7 +41,7 @@
128 <v t="ekr.20120519121124.9919"><vh>@file ../external/leosax.py</vh></v>
129 <v t="ekr.20031218072017.2605"><vh>@file runLeo.py </vh></v>
130 </v>
131-<v t="ekr.20031218072017.2604" a="E"><vh>Core classes</vh>
132+<v t="ekr.20031218072017.2604"><vh>Core classes</vh>
133 <v t="ekr.20031218072017.2608"><vh>@file leoApp.py</vh></v>
134 <v t="ekr.20041005105605.1"><vh>@file leoAtFile.py</vh></v>
135 <v t="ekr.20070227091955.1"><vh>@file leoBridge.py</vh></v>
136@@ -51,7 +50,7 @@
137 <v t="ekr.20031218072017.2794"><vh>@file leoColor.py</vh></v>
138 <v t="ekr.20031218072017.2810"><vh>@file leoCommands.py</vh></v>
139 <v t="ekr.20041117062700"><vh>@file leoConfig.py</vh></v>
140-<v t="ekr.20050710142719" a="E"
141+<v t="ekr.20050710142719"
142 expanded="ekr.20050920084036.13,ekr.20100901080826.6002,ekr.20100901080826.6155,ekr.20050920084036.53,ekr.20071114081313,ekr.20080108092811,"><vh>@file leoEditCommands.py</vh></v>
143 <v t="ekr.20031218072017.3018"><vh>@file leoFileCommands.py</vh></v>
144 <v t="ekr.20031218072017.3093" descendentVnodeUnknownAttributes="7d71005506302e31352e3071017d71025808000000616e6e6f7461746571037d710473732e"><vh>@file leoGlobals.py</vh></v>
145@@ -78,12 +77,13 @@
146 </v>
147 <v t="ekr.20110605121601.17862" a="E"><vh>Qt gui</vh>
148 <v t="ekr.20110605121601.17863"><vh>@file ../plugins/baseNativeTree.py</vh></v>
149-<v t="ekr.20120419093256.10048" a="E"
150+<v t="ekr.20120419093256.10048"
151 expanded="ekr.20110318080425.14389,"><vh>@file ../plugins/free_layout.py</vh></v>
152-<v t="ekr.20110605121601.17954" a="E"
153+<v t="ekr.20110605121601.17954"
154 expanded="tbrown.20120418121002.25711,ekr.20110605121601.17961,ekr.20110605121601.17966,ekr.20110605121601.17969,"><vh>@file ../plugins/nested_splitter.py</vh></v>
155 <v t="ekr.20110605121601.17996"><vh>@file ../plugins/qtframecommands.py</vh></v>
156-<v t="ekr.20110605121601.18002" a="E"><vh>@file ../plugins/qtGui.py</vh></v>
157+<v t="ekr.20110605121601.18002" a="E"
158+expanded="ekr.20110605121601.18136,ekr.20110605121601.18340,ekr.20110605121601.18342,ekr.20110605121601.18343,ekr.20110605121601.18354,ekr.20110605121601.18361,"><vh>@file ../plugins/qtGui.py</vh></v>
159 <v t="ekr.20110605121601.18695"><vh>QDesigner files</vh>
160 <v t="ekr.20110605121601.18696"><vh>@auto ../test/qtui_generate.py</vh></v>
161 <v t="ekr.20110605121601.18698"><vh>@auto ../plugins/qt_main.py</vh></v>
162
163=== modified file 'leo/plugins/leoPluginsRef.leo'
164--- leo/plugins/leoPluginsRef.leo 2013-04-20 15:05:19 +0000
165+++ leo/plugins/leoPluginsRef.leo 2013-05-14 14:51:04 +0000
166@@ -58,7 +58,7 @@
167 </v>
168 </v>
169 </v>
170-<v t="ekr.20101110150056.9453"><vh> Qt only plugins</vh>
171+<v t="ekr.20101110150056.9453" a="E"><vh> Qt only plugins</vh>
172 <v t="tbrown.20091029123555.5319" descendentVnodeUnknownAttributes="7d71005503302e3571017d710258040000007465737471037d710458050000005f6564697471057d7106580400000074686973710758120000006f6b20686f77206120626f757420746869737108737373732e"><vh>@file attrib_edit.py</vh></v>
173 <v t="ville.20090310191936.10"><vh>@file colorize_headlines.py</vh></v>
174 <v t="ekr.20090701111504.5294"><vh>@file contextmenu.py</vh></v>
175@@ -72,7 +72,9 @@
176 <v t="tbrown.20100318101414.5990"><vh>@file viewrendered.py</vh></v>
177 <v t="tbrown.20090206153748.1"><vh>@file graphcanvas.py</vh></v>
178 <v t="ville.20110403115003.10348"><vh>@file valuespace.py</vh></v>
179-<v t="ville.20130127035134.3685"><vh>@file internal_ipkernel.py</vh></v>
180+<v t="ville.20130127035134.3685" a="O"><vh>@file internal_ipkernel.py</vh></v>
181+<v t="peckj.20130514093558.4062" a="E"
182+expanded="peckj.20130513115943.16249,"><vh>@file printing.py</vh></v>
183 <v t="tbrown.20130420091241.44181"><vh>@file screen_capture.py</vh></v>
184 </v>
185 <v t="ekr.20100103093121.5365"><vh>Auto completion</vh>
186@@ -541,5 +543,6 @@
187 <t tx="ekr.20121126102050.10134"></t>
188 <t tx="rogererens.20041130095659">@ It is possible to link to nodes within the same file. However clones might be better.
189 </t>
190+<t tx="ville.20130127035134.3685"></t>
191 </tnodes>
192 </leo_file>
193
194=== added file 'leo/plugins/printing.py'
195--- leo/plugins/printing.py 1970-01-01 00:00:00 +0000
196+++ leo/plugins/printing.py 2013-05-14 14:51:04 +0000
197@@ -0,0 +1,317 @@
198+#@+leo-ver=5-thin
199+#@+node:peckj.20130513115943.16246: * @file printing.py
200+#@@language python
201+#@@tabwidth -4
202+
203+#@+<< docstring >>
204+#@+node:peckj.20130513115943.16252: ** << docstring >>
205+'''Supports printing from the Qt GUI.
206+
207+Jacob M. Peck, 2013
208+
209+Commands
210+========
211+
212+This plugin supports the following twelve commands:
213+
214+print-selected-node
215+-------------------
216+
217+Opens up the print dialog to print the selected headline and node.
218+
219+print-preview-selected-node
220+---------------------------
221+
222+Opens up the print preview dialog to preview the selected headline
223+and node.
224+
225+print-selected-node-body
226+------------------------
227+
228+Opens up the print dialog to print the selected node body.
229+
230+print-preview-selected-node-body
231+--------------------------------
232+
233+Opens up the print preview dialog to preview the selected node body.
234+
235+print-expanded-node
236+-------------------
237+
238+Opens up the print dialog to print the expanded contents of the
239+selected node, with top-level headline.
240+
241+print-preview-expanded-node
242+---------------------------
243+
244+Opens up the print preview dialog to preview the expanded contents
245+of theselected node, with top-level headline.
246+
247+print-expanded-node-body
248+------------------------
249+
250+Opens up the print dialog to print the expanded node body.
251+
252+print-preview-expanded-node-body
253+--------------------------------
254+
255+Opens up the print preview dialog to preview the expanded node
256+body.
257+
258+print-marked-nodes
259+------------------
260+
261+Opens up the print dialog to print all marked nodes in the current
262+outline, with headlines.
263+
264+print-preview-marked-nodes
265+--------------------------
266+
267+Opens up the print preview dialog to preview all marked nodes in \
268+the current outline, with headlines.
269+
270+print-marked-node-bodies
271+------------------------
272+
273+Opens up the print dialog to print the bodies of all marked nodes
274+in the current outline.
275+
276+print-preview-marked-node-bodies
277+--------------------------------
278+
279+Opens up the print preview dialog to preview the bodies of all
280+marked nodes in the current outline.
281+
282+Settings
283+========
284+
285+- ``@string printing-font-family = DejaVu Sans Mono``
286+ The font family for printing. A monospaced font is recommended.
287+
288+- ``@string printing-font-size = 12``
289+ The font size for printing bodies, in px. Due to limitations
290+ of PyQt, the size of headlines cannot be changed.
291+
292+'''
293+#@-<< docstring >>
294+#@+<< version history >>
295+#@+node:peckj.20130513115943.16254: ** << version history >>
296+#@+at
297+#
298+# version 0.1 (2013-05-14) - initial release
299+#
300+#@@c
301+#@-<< version history >>
302+#@+<< imports >>
303+#@+node:peckj.20130513115943.16253: ** << imports >>
304+import leo.core.leoGlobals as g
305+import leo.plugins.qtGui as qtGui
306+from PyQt4 import QtGui
307+from PyQt4 import QtCore
308+#@-<< imports >>
309+
310+__version__ = '0.1'
311+
312+#@+others
313+#@+node:peckj.20130513115943.16247: ** init
314+def init ():
315+
316+ if g.app.gui is None:
317+ g.app.createQtGui(__file__)
318+
319+ ok = g.app.gui.guiName().startswith('qt')
320+
321+ if ok:
322+ g.registerHandler(('new','open2'),onCreate)
323+ g.plugin_signon(__name__)
324+
325+ return ok
326+#@+node:peckj.20130513115943.16248: ** onCreate
327+def onCreate (tag, keys):
328+
329+ '''Handle the onCreate event in the printing plugin.'''
330+
331+ c = keys.get('c')
332+
333+ if c:
334+ pc = printingController(c)
335+ c.thePrintingController = pc
336+
337+#@+node:peckj.20130513115943.16249: ** class printingController
338+class printingController:
339+
340+ #@+others
341+ #@+node:peckj.20130513115943.16250: *3* __init__
342+ def __init__ (self,c):
343+ self.c = c
344+
345+ # gather settings
346+ self.font_size = c.config.getString('printing-font-size') or '12'
347+ self.font_family = c.config.getString('printing-font-family') or 'DejaVu Sans Mono'
348+
349+ # initialize
350+ self.stylesheet = self.construct_stylesheet()
351+
352+ # register commands
353+ ## selected node
354+ c.k.registerCommand('print-selected-node-body',shortcut=None,func=self.print_selected_node_body)
355+ c.k.registerCommand('print-preview-selected-node-body',
356+ shortcut=None,func=self.print_preview_selected_node_body)
357+ c.k.registerCommand('print-selected-node',shortcut=None,func=self.print_selected_node)
358+ c.k.registerCommand('print-preview-selected-node',
359+ shortcut=None,func=self.print_preview_selected_node)
360+ ## expanded node
361+ c.k.registerCommand('print-expanded-node-body',shortcut=None,func=self.print_expanded_node_body)
362+ c.k.registerCommand('print-preview-expanded-node-body',
363+ shortcut=None,func=self.print_preview_expanded_node_body)
364+ c.k.registerCommand('print-expanded-node',shortcut=None,func=self.print_expanded_node)
365+ c.k.registerCommand('print-preview-expanded-node',
366+ shortcut=None,func=self.print_preview_expanded_node)
367+ ## marked nodes
368+ c.k.registerCommand('print-marked-node-bodies',shortcut=None,func=self.print_marked_node_bodies)
369+ c.k.registerCommand('print-preview-marked-node-bodies',
370+ shortcut=None,func=self.print_preview_marked_node_bodies)
371+ c.k.registerCommand('print-marked-nodes',shortcut=None,func=self.print_marked_nodes)
372+ c.k.registerCommand('print-preview-marked-nodes',
373+ shortcut=None,func=self.print_preview_marked_nodes)
374+
375+ #@+node:peckj.20130513115943.22457: *3* helpers
376+ #@+node:peckj.20130513115943.22458: *4* construct stylesheet
377+ def construct_stylesheet(self):
378+ s = 'h1 {font-family: %s}\n' % self.font_family
379+ s += 'pre {font-family: %s; font-size: %spx}' % (self.font_family, self.font_size)
380+ return s
381+ #@+node:peckj.20130513115943.22459: *4* construct document
382+ def construct_document(self, text, head=None):
383+ doc = QtGui.QTextDocument()
384+ doc.setDefaultStyleSheet(self.stylesheet)
385+ text = self.sanitize_html(text)
386+ if head:
387+ head = self.sanitize_html(head)
388+ contents = "<h1>%s</h1>\n<pre>%s</pre>" % (head, text)
389+ else:
390+ contents = "<pre>%s<pre>" % text
391+ doc.setHtml(contents)
392+ return doc
393+ #@+node:peckj.20130514082859.5603: *4* construct complex document
394+ def construct_complex_document(self, nodes, heads=False):
395+ doc = QtGui.QTextDocument()
396+ doc.setDefaultStyleSheet(self.stylesheet)
397+ contents = ''
398+ for n in nodes:
399+ if heads:
400+ contents += '<h1>%s</h1>\n' % (self.sanitize_html(n.h))
401+ contents += '<pre>%s</pre>\n' % (self.sanitize_html(n.b))
402+ doc.setHtml(contents)
403+ return doc
404+ #@+node:peckj.20130513115943.22661: *4* print dialog
405+ def print_doc(self, doc):
406+ dialog = QtGui.QPrintDialog()
407+ if dialog.exec_() == QtGui.QDialog.Accepted:
408+ doc.print_(dialog.printer())
409+ #@+node:peckj.20130513115943.22662: *4* print preview dialog
410+ def print_preview_doc(self, doc):
411+ dialog = QtGui.QPrintPreviewDialog()
412+ dialog.paintRequested.connect(doc.print_)
413+ dialog.exec_()
414+ #@+node:peckj.20130514082859.5604: *4* sanitize html
415+ def sanitize_html(self, html):
416+ ''' quick and dirty way to make sure html is escaped properly for printing '''
417+ return html.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
418+ #@+node:peckj.20130514082859.5610: *4* untangle
419+ def untangle(self,p):
420+ return g.getScript(self.c,p,
421+ useSelectedText=False,
422+ useSentinels=False)
423+ #@+node:peckj.20130513115943.22666: *3* selected node
424+ #@+node:peckj.20130513193024.6336: *4* print_selected_node_body
425+ def print_selected_node_body (self,event=None):
426+ ''' prints the selected node body'''
427+
428+ doc = self.construct_document(self.c.p.b)
429+ self.print_doc(doc)
430+ #@+node:peckj.20130513193024.6337: *4* print_preview_selected_node_body
431+ def print_preview_selected_node_body (self,event=None):
432+ ''' print previews the selected node body'''
433+
434+ doc = self.construct_document(self.c.p.b)
435+ self.print_preview_doc(doc)
436+ #@+node:peckj.20130513115943.16251: *4* print_selected_node
437+ def print_selected_node (self,event=None):
438+ ''' prints the selected node '''
439+
440+ doc = self.construct_document(self.c.p.b, head=self.c.p.h)
441+ self.print_doc(doc)
442+ #@+node:peckj.20130513115943.22456: *4* print_preview_selected_node
443+ def print_preview_selected_node (self,event=None):
444+ ''' prints the selected node '''
445+
446+ doc = self.construct_document(self.c.p.b, head=self.c.p.h)
447+ self.print_preview_doc(doc)
448+ #@+node:peckj.20130514082859.5616: *3* expanded selected node
449+ #@+node:peckj.20130514082859.5617: *4* print_expanded_node_body
450+ def print_expanded_node_body (self,event=None):
451+ ''' prints the expanded selected node body '''
452+
453+ doc = self.construct_document(self.untangle(self.c.p))
454+ self.print_doc(doc)
455+ #@+node:peckj.20130514082859.5618: *4* print_preview_expanded_node_body
456+ def print_preview_expanded_node_body (self,event=None):
457+ ''' print previews the expanded selected node body'''
458+
459+ doc = self.construct_document(self.untangle(self.c.p))
460+ self.print_preview_doc(doc)
461+ #@+node:peckj.20130514082859.5619: *4* print_expanded_node
462+ def print_expanded_node (self,event=None):
463+ ''' prints the expanded selected node '''
464+
465+ p = self.c.p
466+ doc = self.construct_document(self.untangle(p), head=p.h)
467+ self.print_doc(doc)
468+ #@+node:peckj.20130514082859.5620: *4* print_preview_expanded_node
469+ def print_preview_expanded_node (self,event=None):
470+ ''' prints the expanced selected node '''
471+
472+ p = self.c.p
473+ doc = self.construct_document(self.untangle(p), head=p.h)
474+ self.print_preview_doc(doc)
475+ #@+node:peckj.20130514082859.5605: *3* marked nodes
476+ #@+node:peckj.20130514082859.5606: *4* print_marked_node_bodies
477+ def print_marked_node_bodies (self,event=None):
478+ ''' prints the marked node bodies'''
479+ nodes = []
480+ for n in self.c.all_positions():
481+ if n.isMarked():
482+ nodes.append(n.v)
483+ doc = self.construct_complex_document(nodes)
484+ self.print_doc(doc)
485+ #@+node:peckj.20130514082859.5607: *4* print_preview_marked_node_bodies
486+ def print_preview_marked_node_bodies (self,event=None):
487+ ''' print previews the marked node bodies'''
488+ nodes = []
489+ for n in self.c.all_positions():
490+ if n.isMarked():
491+ nodes.append(n.v)
492+ doc = self.construct_complex_document(nodes)
493+ self.print_preview_doc(doc)
494+ #@+node:peckj.20130514082859.5608: *4* print_marked_nodes
495+ def print_marked_nodes (self,event=None):
496+ ''' prints the marked nodes'''
497+ nodes = []
498+ for n in self.c.all_positions():
499+ if n.isMarked():
500+ nodes.append(n.v)
501+ doc = self.construct_complex_document(nodes, heads=True)
502+ self.print_doc(doc)
503+ #@+node:peckj.20130514082859.5609: *4* print_preview_marked_nodes
504+ def print_preview_marked_nodes (self,event=None):
505+ ''' print previews the marked nodes'''
506+ nodes = []
507+ for n in self.c.all_positions():
508+ if n.isMarked():
509+ nodes.append(n.v)
510+ doc = self.construct_complex_document(nodes, heads=True)
511+ self.print_preview_doc(doc)
512+ #@-others
513+#@-others
514+#@-leo

Subscribers

People subscribed via source and target branches

to all changes: