pyvguicom 1.1.1__py3-none-any.whl → 1.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyvguicom might be problematic. Click here for more details.

@@ -0,0 +1,2277 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
6
+ <meta name="generator" content="pdoc 0.10.0" />
7
+ <title>pgwkit API documentation</title>
8
+ <meta name="description" content="This encapsulates the webkit import and failure thereof" />
9
+ <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
10
+ <link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
11
+ <link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
12
+ <style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
13
+ <style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
14
+ <style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
15
+ <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
16
+ <script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
17
+ </head>
18
+ <body>
19
+ <main>
20
+ <article id="content">
21
+ <header>
22
+ <h1 class="title">Module <code>pgwkit</code></h1>
23
+ </header>
24
+ <section id="section-intro">
25
+ <p>This encapsulates the webkit import and failure thereof</p>
26
+ <details class="source">
27
+ <summary>
28
+ <span>Expand source code</span>
29
+ </summary>
30
+ <pre><code class="python">#!/usr/bin/env python
31
+
32
+ &#39;&#39;&#39; This encapsulates the webkit import and failure thereof &#39;&#39;&#39;
33
+
34
+ import os, sys, getopt, signal, random, time, warnings
35
+ import inspect
36
+
37
+ #realinc = os.path.realpath(os.path.dirname(__file__) + os.sep + &#34;../pycommon&#34;)
38
+ #sys.path.append(realinc)
39
+
40
+ from pgutils import *
41
+ from pggui import *
42
+ from pgsimp import *
43
+ from pgtextview import *
44
+
45
+ import gi
46
+ gi.require_version(&#34;Gtk&#34;, &#34;3.0&#34;)
47
+
48
+ from gi.repository import Gtk
49
+ from gi.repository import Gdk
50
+ from gi.repository import GLib
51
+ from gi.repository import GObject
52
+ from gi.repository import Pango
53
+
54
+ WebKit2 = None
55
+
56
+ class dummywebview(Gtk.VBox):
57
+
58
+ def __int__(self):
59
+ super().__init__(self)
60
+ #self.pack_start(Gtk.Label(label=&#34;No WebView&#34;), 1, 1, 0)
61
+ def set_editable(self, flag):
62
+ self.pack_start(Gtk.Label(label=&#34;No WebView Available&#34;), 1, 1, 0)
63
+ pass
64
+ def load_html(self, ff, kk = None):
65
+ pass
66
+ def connect(self, aa, bb):
67
+ pass
68
+
69
+ class dummywebkit():
70
+ WebView = dummywebview
71
+
72
+ try:
73
+ gi.require_version(&#34;WebKit2&#34;, &#39;4.1&#39;)
74
+ from gi.repository import WebKit2
75
+ #present = 1
76
+ except:
77
+ try:
78
+ #print(&#34;Trying V 4.0:&#34;, sys.exc_info())
79
+ gi.require_version(&#34;WebKit2&#34;, &#39;4.0&#39;)
80
+ from gi.repository import WebKit2
81
+ except:
82
+ try:
83
+ #print(&#34;Trying with jno qualifier&#34;)
84
+ #gi.require_version(&#34;WebKit2&#34;, &#39;4.0&#39;)
85
+ from gi.repository import WebKit2
86
+ except:
87
+ # Giving up, patch fake one
88
+ print(&#34;Cannot import:&#34;, sys.exc_info())
89
+ print(&#34;WebWiew is not available.&#34;)
90
+ try:
91
+ WebKit2 = dummywebkit
92
+ except:
93
+ print(&#34;Fake kit Exc:&#34;, sys.exc_info())
94
+ #print(&#34;Fake kit:&#34;, WebKit2)
95
+ #raise
96
+
97
+ ui_def = &#34;&#34;&#34;
98
+ &lt;ui&gt;
99
+ &lt;toolbar name=&#34;toolbar_format&#34;&gt;
100
+ &lt;toolitem action=&#34;cut&#34; /&gt;
101
+ &lt;toolitem action=&#34;copy&#34; /&gt;
102
+ &lt;toolitem action=&#34;paste&#34; /&gt;
103
+ &lt;separator /&gt;
104
+ &lt;toolitem action=&#34;removeformat&#34; /&gt;
105
+ &lt;toolitem action=&#34;bold&#34; /&gt;
106
+ &lt;toolitem action=&#34;italic&#34; /&gt;
107
+ &lt;toolitem action=&#34;underline&#34; /&gt;
108
+ &lt;toolitem action=&#34;strikethrough&#34; /&gt;
109
+ &lt;separator /&gt;
110
+ &lt;toolitem action=&#34;justifyleft&#34; /&gt;
111
+ &lt;toolitem action=&#34;justifyright&#34; /&gt;
112
+ &lt;toolitem action=&#34;justifycenter&#34; /&gt;
113
+ &lt;toolitem action=&#34;justifyfull&#34; /&gt;
114
+ &lt;separator /&gt;
115
+ &lt;toolitem action=&#34;undo&#34; /&gt;
116
+ &lt;toolitem action=&#34;redo&#34; /&gt;
117
+ &lt;separator /&gt;
118
+ &lt;toolitem action=&#34;font&#34; /&gt;
119
+ &lt;toolitem action=&#34;fontsize&#34; /&gt;
120
+ &lt;toolitem action=&#34;color&#34; /&gt;
121
+ &lt;toolitem action=&#34;backgroundcolor&#34; /&gt;
122
+ &lt;separator /&gt;
123
+ &lt;toolitem action=&#34;insertimage&#34; /&gt;
124
+ &lt;toolitem action=&#34;insertlink&#34; /&gt;
125
+ &lt;toolitem action=&#34;inserttable&#34; /&gt;
126
+ &lt;toolitem action=&#34;editmarker&#34; /&gt;
127
+ &lt;toolitem action=&#34;H1&#34; /&gt;
128
+ &lt;toolitem action=&#34;H2&#34; /&gt;
129
+ &lt;toolitem action=&#34;H3&#34; /&gt;
130
+ &lt;toolitem action=&#34;H4&#34; /&gt;
131
+ &lt;/toolbar&gt;
132
+ &lt;/ui&gt;
133
+ &#34;&#34;&#34;
134
+
135
+ #unmask_reserved = Gdk.ModifierType.GDK_MODIFIER_RESERVED_13_MASK | \
136
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_14_MASK | \
137
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_15_MASK | \
138
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_16_MASK | \
139
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_17_MASK | \
140
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_18_MASK | \
141
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_19_MASK | \
142
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_20_MASK | \
143
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_21_MASK | \
144
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_22_MASK | \
145
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_23_MASK | \
146
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_24_MASK | \
147
+ # Gdk.ModifierType.GDK_MODIFIER_RESERVED_25_MASK
148
+
149
+ # These are not setting the modified flag
150
+
151
+ navkeys = [ \
152
+ Gdk.KEY_Up, Gdk.KEY_KP_Up,
153
+ Gdk.KEY_Down, Gdk.KEY_KP_Down ,
154
+ Gdk.KEY_Left, Gdk.KEY_KP_Left,
155
+ Gdk.KEY_Right, Gdk.KEY_KP_Right,
156
+ Gdk.KEY_Page_Up, Gdk.KEY_KP_Page_Up,
157
+ Gdk.KEY_Page_Down, Gdk.KEY_KP_Page_Down,
158
+ Gdk.KEY_Home, Gdk.KEY_KP_Home,
159
+ Gdk.KEY_End, Gdk.KEY_KP_End,
160
+
161
+ # Also the modifier keys themselves
162
+ Gdk.KEY_Alt_L, Gdk.KEY_Alt_R,
163
+ Gdk.KEY_Control_L, Gdk.KEY_Control_R,
164
+ Gdk.KEY_Super_L, Gdk.KEY_Super_R,
165
+ Gdk.KEY_Shift_L, Gdk.KEY_Shift_R,
166
+
167
+ ]
168
+
169
+ # ------------------------------------------------------------------------
170
+
171
+ class pgwebw(WebKit2.WebView):
172
+
173
+ &#39;&#39;&#39; Define our override of the webkit class &#39;&#39;&#39;
174
+
175
+ def __init__(self, xlink=None):
176
+ try:
177
+ GObject.GObject.__init__(self)
178
+ except:
179
+ print(&#34;Cannot ??? in parent object&#34;, sys.exc_info())
180
+ pass
181
+ self.xlink = xlink
182
+ self.set_editable(True)
183
+
184
+ #if editable:
185
+ # self.set_editable(True)
186
+
187
+ self.fname = &#34;&#34;
188
+ self.load_html(&#34;&#34;, &#34;file:///&#34;)
189
+ self.ui = self.generate_ui()
190
+ self.connect(&#34;key-release-event&#34;, self.keypress)
191
+ self.modified = False
192
+
193
+ def _get_response_data_finish(self, resource, result, user_data=None):
194
+ self.old_html = resource.get_data_finish(result)
195
+ #print((self.old_html))
196
+
197
+ def keypress(self, arg, arg2):
198
+
199
+ &#39;&#39;&#39; Here we imitate the way the accelerator works &#39;&#39;&#39;
200
+
201
+ state = arg2.get_state() &amp; Gdk.ModifierType.MODIFIER_MASK
202
+ key = arg2.get_keyval()[1]
203
+ #print(&#34;key&#34;, key, &#34;state&#34;, state)
204
+
205
+ #GDK_MODIFIER_RESERVED_25_MASK
206
+
207
+ # Feeding off the accelarator&#39;s definitions
208
+ ag = self.ui.get_action_groups()[0]
209
+ acts = ag.list_actions()
210
+
211
+ # Scan - Fire
212
+ for aa in acts:
213
+ if aa.accel:
214
+ #print(nnn, aa.accel, aa.accel_parsed)
215
+ if state == aa.accel_parsed[1]:
216
+ #print(&#34;state match&#34;)
217
+ if key == aa.accel_parsed[0]:
218
+ #print(&#34;Fire &#34;, aa.get_name(), aa.get_label())
219
+ #lab = aa.get_label()
220
+ aa.activate()
221
+ break # Only one accel the other is a mistake
222
+
223
+ # See if nav key
224
+ navkey = False
225
+ for aa in navkeys:
226
+ if key == aa:
227
+ #print(&#34;Navkey&#34;, aa)
228
+ navkey = True
229
+ if not navkey:
230
+ # Exclude Ctrl-s
231
+ if state == Gdk.ModifierType.CONTROL_MASK and key == 115:
232
+ #print(&#34;Control s&#34;)
233
+ pass
234
+ else:
235
+ #print(&#34;set on key&#34;, key)
236
+ self.modified = True
237
+
238
+ def do_ready_to_show(self):
239
+ print(&#34;do_ready_to_show() was called&#34;)
240
+ pass
241
+
242
+ def do_load_changed(self, status):
243
+
244
+ #print(&#34;do_load_changed()&#34;, status)
245
+ if status == WebKit2.LoadEvent.FINISHED:
246
+ &#39;&#39;&#39; Create a shadow of content &#39;&#39;&#39;
247
+
248
+ # This gets it without spaces
249
+ #resource = self.get_main_resource()
250
+ #resource.get_data(None, self._get_response_data_finish, None)
251
+
252
+ # Get it by JS
253
+ def completion(html, user_data):
254
+ self.old_html = html
255
+ self.get_html(completion, &#39;&#39;)
256
+
257
+
258
+ if self.get_uri():
259
+ if self.xlink:
260
+ self.xlink.set_status(&#34;Loading ... &#34; + self.get_uri()[:64])
261
+
262
+ if status == 3: #WebKit2.LoadEvent.WEBKIT_LOAD_FINISHED:
263
+ #print(&#34;got WEBKIT_LOAD_FINISHED&#34;)
264
+ if self.get_uri():
265
+ if self.xlink:
266
+ self.xlink.edit.set_text(self.get_uri()[:64])
267
+ self.xlink.set_status(&#34;Finished: &#34; + self.get_uri()[:64])
268
+ self.grab_focus()
269
+
270
+ def do_load_failed(self, load_event, failing_uri, error):
271
+ print(&#34;do_load_failed() was called&#34;, failing_uri)
272
+ if self.xlink:
273
+ self.xlink.set_status(&#34;Failed: &#34; + failing_uri[:64])
274
+
275
+ def on_header(self, action):
276
+ #print(&#34;on_aheader&#34;, action.get_name())
277
+ ddd = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
278
+ ccc = None
279
+ while True:
280
+ #target = Gdk.Atom.intern (&#34;text/html&#34;, True);
281
+ #ccc = ddd.wait_for_contents(target)
282
+ #if ccc:
283
+ # break
284
+ target2 = Gdk.Atom.intern (&#34;text/plain&#34;, True);
285
+ ccc = ddd.wait_for_contents(target2)
286
+ if ccc:
287
+ break
288
+ break
289
+
290
+ if not ccc:
291
+ return
292
+
293
+ dddd = ccc.get_data().decode()
294
+ if not dddd:
295
+ return
296
+ #print(&#34;dddd&#34;, dddd)
297
+ htmlx = &#34;&lt;%s&gt;%s&lt;/%s&gt;&#34; % (action.get_name(), dddd, action.get_name())
298
+ self.run_javascript(&#34;document.execCommand \
299
+ (&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
300
+ Gtk.Clipboard.clear(ddd)
301
+ self.modified = True
302
+
303
+ def on_action(self, action):
304
+ #print(&#34;on_action&#34;, action.get_name())
305
+ # Make it caller neutral
306
+ if type(action) == str:
307
+ nnn = action
308
+ else:
309
+ nnn = action.get_name()
310
+ self.run_javascript(&#34;document.execCommand(&#39;%s&#39;, false, false);&#34; % nnn)
311
+ self.modified = True
312
+
313
+ def on_paste(self, action = &#34;&#34;):
314
+ print(&#34;Paste&#34;)
315
+ self.execute_editing_command(WebKit2.EDITING_COMMAND_PASTE)
316
+
317
+ def on_new(self, action):
318
+ self.load_html(&#34;&#34;, &#34;file:///&#34;)
319
+ self.modified = False
320
+
321
+ def on_fontsize(self, action):
322
+ #print(&#34;on_fontsize&#34;)
323
+ sizex = sizedialog()
324
+ #print(&#34;sizex&#34;, sizex)
325
+ if not sizex:
326
+ return
327
+
328
+ c = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
329
+ sel = c.wait_for_targets()
330
+ #print(&#34;sel&#34;, sel)
331
+ target = Gdk.Atom.intern (&#34;text/plain&#34;, True);
332
+ ccc = c.wait_for_contents(target)
333
+ if not ccc:
334
+ htmlx = &#34;&lt;span style=\&#34;font-size: %dpx;\&#34;&gt;%s&lt;/span&gt;&#34; % (int(sizex), &#34;&#34;)
335
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
336
+ return
337
+
338
+ ddd = ccc.get_data().decode()
339
+ if not ddd:
340
+ return
341
+
342
+ #print(&#34;ddd&#34;, ddd)
343
+ htmlx = &#34;&lt;span style=\&#34;font-size: %dpx;\&#34;&gt;%s&lt;/span&gt;&#34; % (int(sizex), ddd)
344
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
345
+ Gtk.Clipboard.clear(c)
346
+ self.modified = True
347
+
348
+ def on_select_font(self, action):
349
+ dialog = Gtk.FontChooserDialog(&#34;Select a font&#34;)
350
+ if dialog.run() == Gtk.ResponseType.OK:
351
+ fname = dialog.get_font_desc().get_family()
352
+ fsize = dialog.get_font_desc().get_size() / Pango.SCALE
353
+ ttt = int(1 + round(fsize / 10)) % 9
354
+ print(&#34;Setting font&#34;, fname, fsize, ttt)
355
+ self.run_javascript(&#34;document.execCommand(&#39;fontname&#39;, null, &#39;%s&#39;);&#34; % fname)
356
+ self.run_javascript(&#34;document.execCommand(&#39;fontsize&#39;, null, &#39;%s&#39;);&#34; % ttt)
357
+ dialog.destroy()
358
+
359
+ def on_select_color(self, action):
360
+ dialog = Gtk.ColorChooserDialog(&#34;Select Color&#34;)
361
+ if dialog.run() == Gtk.ResponseType.OK:
362
+ (r, g, b, a) = dialog.get_rgba()
363
+ color = &#34;#%0.2x%0.2x%0.2x%0.2x&#34; % (
364
+ int(r * 255),
365
+ int(g * 255),
366
+ int(b * 255),
367
+ int(a * 255))
368
+ self.run_javascript(&#34;document.execCommand(&#39;forecolor&#39;, null, &#39;%s&#39;);&#34; % color)
369
+ dialog.destroy()
370
+
371
+ def on_select_bgcolor(self, action):
372
+ dialog = Gtk.ColorChooserDialog(&#34;Select Background Color&#34;)
373
+ if dialog.run() == Gtk.ResponseType.OK:
374
+ (r, g, b, a) = dialog.get_rgba()
375
+ color = &#34;#%0.2x%0.2x%0.2x%0.2x&#34; % (
376
+ int(r * 255),
377
+ int(g * 255),
378
+ int(b * 255),
379
+ int(a * 255))
380
+ self.run_javascript(&#34;document.execCommand(&#39;backcolor&#39;, null, &#39;%s&#39;);&#34; % color)
381
+ dialog.destroy()
382
+
383
+ def on_edit_marker(self, action):
384
+ print(&#34;on_edit_marker&#34;, action.get_name())
385
+
386
+ c = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
387
+ sel = c.wait_for_targets()
388
+ target = Gdk.Atom.intern (&#34;text/html&#34;, True);
389
+ ccc = c.wait_for_contents(target)
390
+ #print(&#34;sel&#34;, ccc.get_data())
391
+ #ccc.free()
392
+ htmlx = markdialog(ccc.get_data().decode())
393
+ if htmlx:
394
+ print(&#34;markdialog result:\n&#34;, htmlx)
395
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
396
+
397
+ def on_insert_table(self, action):
398
+ htmlx = &#34;&lt;table align=center border=0 contentEditable=true&gt;&#34; + \
399
+ &#34;&lt;tr&gt;&lt;td&gt;TR1 C1 &lt;td&gt;| TR1 C2 &lt;tr&gt;&lt;td&gt;TR2 C1&lt;td&gt;| TR2 C1&lt;/table&gt;&lt;br&gt;&#34;
400
+
401
+ #print(&#34;table&#34;, htmlx)
402
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
403
+ self.modified = True
404
+
405
+ def on_insert_link(self, action):
406
+ dialog = Gtk.Dialog(&#34; Enter a URL: &#34;, None, 0,
407
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
408
+
409
+ entry = Gtk.Entry()
410
+ dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
411
+ hbox = Gtk.HBox()
412
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
413
+ hbox.pack_start(entry, False, False, 0)
414
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
415
+ dialog.vbox.pack_start(hbox, False, False, 0)
416
+
417
+ dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
418
+ dialog.show_all()
419
+
420
+ if dialog.run() == Gtk.ResponseType.OK:
421
+ self.run_javascript(
422
+ &#34;document.execCommand(&#39;createLink&#39;, True, &#39;%s&#39;);&#34; % entry.get_text())
423
+ dialog.destroy()
424
+ self.modified = True
425
+
426
+ def on_insert_image(self, action):
427
+ dialog = Gtk.FileChooserDialog(&#34;Select an image file&#34;, None, Gtk.FileChooserAction.OPEN,
428
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
429
+
430
+ if dialog.run() == Gtk.ResponseType.OK:
431
+ fn = dialog.get_filename()
432
+ if os.path.exists(fn):
433
+ self.run_javascript(
434
+ &#34;document.execCommand(&#39;insertImage&#39;, null, &#39;%s&#39;);&#34; % fn)
435
+ dialog.destroy()
436
+ self.modified = True
437
+
438
+ def on_open(self, action):
439
+ dialog = Gtk.FileChooserDialog(&#34;Select an HTML file&#34;, self, Gtk.FileChooserAction.OPEN,
440
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
441
+
442
+ if dialog.run() == Gtk.ResponseType.OK:
443
+ fn = dialog.get_filename()
444
+ if os.path.exists(fn):
445
+ self.fname = fn
446
+ with open(fn) as fd:
447
+ self.load_html(fd.read(), &#34;file:///&#34;)
448
+ dialog.destroy()
449
+
450
+ def on_save(self, action):
451
+ def completion(html, user_data):
452
+ open_mode = user_data
453
+ with open(self.fname, open_mode) as fd:
454
+ fd.write(html)
455
+
456
+ if self.fname:
457
+ self.get_html(completion, &#39;w&#39;)
458
+ else:
459
+ dialog = Gtk.FileChooserDialog(&#34;Select an HTML file&#34;, None,
460
+ Gtk.FileChooserAction.SAVE,
461
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
462
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
463
+
464
+ if dialog.run() == Gtk.ResponseType.OK:
465
+ self.fname = dialog.get_filename()
466
+ print(&#34;Saving&#34;, self.fname)
467
+ self.get_html(completion, &#34;w+&#34;)
468
+ dialog.destroy()
469
+
470
+ def get_html(self, completion_function, user_data):
471
+
472
+ #print(&#34;get_html&#34;)
473
+ def javascript_completion(obj, result, user_data):
474
+ #print(&#34;javascript_completion&#34;, result)
475
+ fin = self.run_javascript_finish(result)
476
+ #print(&#34;fin&#34;, fin)
477
+ html = fin.get_js_value().to_string()
478
+ #print(&#34;len html&#34;, len(html), &#34;\n&#34;)
479
+ completion_function(html, user_data)
480
+ self.run_javascript(&#34;document.documentElement.innerHTML;&#34;,
481
+ None,
482
+ javascript_completion,
483
+ user_data)
484
+
485
+ def get_lastmod(self, completion_function, user_data):
486
+
487
+ print(&#34;get_lastmod&#34;)
488
+ def javascript_completion(obj, result, user_data):
489
+ print(&#34;javascript_completion&#34;, result)
490
+ fin = self.run_javascript_finish(result)
491
+ #print(&#34;fin&#34;, fin)
492
+ html = fin.get_js_value().to_string()
493
+ print(&#34;lastmod&#34;, html, &#34;\n&#34;)
494
+ #completion_function(html, user_data)
495
+ self.run_javascript(&#34;document.lastModified&#34;,
496
+ None,
497
+ javascript_completion,
498
+ user_data)
499
+
500
+
501
+ def generate_ui(self):
502
+
503
+ &#39;&#39;&#39; define toolbar items and actions here &#39;&#39;&#39;
504
+
505
+ actions = Gtk.ActionGroup(&#34;Actions&#34;)
506
+ # ----------------------------------------------------------------
507
+ # Name, Stock Icon, Accelerator, ToolTip, Action
508
+
509
+ # Some already has app accels
510
+
511
+ accel_arr = [ \
512
+
513
+ #(&#34;menuFile&#34;, None, &#34;_File&#34;),
514
+ #(&#34;menuEdit&#34;, None, &#34;_Edit&#34;),
515
+ #(&#34;menuInsert&#34;, None, &#34;_Insert&#34;),
516
+ #(&#34;menuFormat&#34;, None, &#34;_Format&#34;),
517
+ #(&#34;new&#34;, Gtk.STOCK_NEW, &#34;_New&#34;, None, None, self.on_new),
518
+ #(&#34;open&#34;, Gtk.STOCK_OPEN, &#34;_Open&#34;, None, None, self.on_open),
519
+ #(&#34;save&#34;, Gtk.STOCK_SAVE, &#34;_Save&#34;, None, None, self.on_save),
520
+
521
+ (&#34;cut&#34;, Gtk.STOCK_CUT, &#34;_Cut&#34;, None, None, self.on_action),
522
+ (&#34;copy&#34;, Gtk.STOCK_COPY, &#34;_Copy&#34;, None, None, self.on_action),
523
+ (&#34;paste&#34;, Gtk.STOCK_PASTE, &#34;_Paste&#34;, None, None, self.on_paste),
524
+
525
+ (&#34;undo&#34;, Gtk.STOCK_UNDO, &#34;_Undo&#34;, &#34;&lt;Control&gt;z&#34;, &#34;Undo Last Edit&#34;, self.on_action),
526
+ (&#34;redo&#34;, Gtk.STOCK_REDO, &#34;_Redo&#34;, &#34;&lt;Control&gt;y&#34;, &#34;Redo Last Undo&#34;, self.on_action),
527
+
528
+ (&#34;removeformat&#34;, Gtk.STOCK_PROPERTIES, &#34;_removeFormat&#34;, &#34;&lt;Control&gt;M&#34;, &#34;Remove Formatting&#34;, self.on_action),
529
+ (&#34;bold&#34;, Gtk.STOCK_BOLD, &#34;_Bold&#34;, &#34;&#34;, &#34;Bold / UnBold Selection&#34;, self.on_action),
530
+ (&#34;italic&#34;, Gtk.STOCK_ITALIC, &#34;_Italic&#34;, &#34;&#34;, None, self.on_action),
531
+ (&#34;underline&#34;, Gtk.STOCK_UNDERLINE, &#34;_Underline&#34;, &#34;&#34;, None, self.on_action),
532
+ (&#34;strikethrough&#34;, Gtk.STOCK_STRIKETHROUGH, &#34;_Strike&#34;, &#34;&#34;, None, self.on_action),
533
+ (&#34;font&#34;, Gtk.STOCK_SELECT_FONT, &#34;Select _Font&#34;, &#34;&#34;, None, self.on_select_font),
534
+ (&#34;fontsize&#34;, None, &#34;Select Font _Size&#34;, &#34;&lt;Control&gt;f&#34;, &#34;Set Absolute Size (removes color)&#34;, self.on_fontsize),
535
+ (&#34;color&#34;, Gtk.STOCK_SELECT_COLOR, &#34;Select _Color&#34;, None, None, self.on_select_color),
536
+ (&#34;backgroundcolor&#34;, Gtk.STOCK_COLOR_PICKER, &#34;Select Back Color&#34;, None, None, self.on_select_bgcolor),
537
+
538
+ (&#34;justifyleft&#34;, Gtk.STOCK_JUSTIFY_LEFT, &#34;Justify _Left&#34;, None, None, self.on_action),
539
+ (&#34;justifyright&#34;, Gtk.STOCK_JUSTIFY_RIGHT, &#34;Justify _Right&#34;, None, None, self.on_action),
540
+ (&#34;justifycenter&#34;, Gtk.STOCK_JUSTIFY_CENTER, &#34;Justify _Center&#34;, None, None, self.on_action),
541
+ (&#34;justifyfull&#34;, Gtk.STOCK_JUSTIFY_FILL, &#34;Justify _Full&#34;, None, None, self.on_action),
542
+
543
+ # Pad Images by name (may not be present in all styles)
544
+ (&#34;insertimage&#34;, &#34;insert-image&#34;, &#34;Insert _Image&#34;, None, None, self.on_insert_image),
545
+ (&#34;insertlink&#34;, &#34;insert-link&#34;, &#34;Insert _Link&#34;, None, None, self.on_insert_link),
546
+ (&#34;inserttable&#34;, &#34;insert-table&#34;, &#34;Insert _Table&#34;, None, None, self.on_insert_table),
547
+ (&#34;editmarker&#34;, &#34;edit-marker&#34;, &#34;edit _Marker&#34;, None, None, self.on_edit_marker),
548
+
549
+ (&#34;H1&#34;, Gtk.STOCK_EXECUTE, &#34;Header 1&#34;, None, &#34;Insert Header 1&#34;, self.on_header),
550
+ (&#34;H2&#34;, Gtk.STOCK_EXECUTE, &#34;Header 2&#34;, None, &#34;Insert Header 2&#34;, self.on_header),
551
+ (&#34;H3&#34;, Gtk.STOCK_EXECUTE, &#34;Header 3&#34;, None, &#34;Insert Header 3&#34;, self.on_header),
552
+ (&#34;H4&#34;, Gtk.STOCK_EXECUTE, &#34;Header 4&#34;, None, &#34;Insert Header 4&#34;, self.on_header),
553
+
554
+ ]
555
+
556
+ actions.add_actions(accel_arr)
557
+
558
+ #print(dir(actions))
559
+ for aa in accel_arr:
560
+ # print(&#34;acc arr&#34;, dir(aa))
561
+ # break
562
+ # act = actions.get_action(aa[0])
563
+ # print(&#34;act&#34;, act.get_name(), act.get_tooltip())
564
+ pass
565
+ # try:
566
+ # act = Gtk.Action.new(aa[0], aa[2], aa[4], aa[1])
567
+ # actions.add_action_with_accel(act, aa[3])
568
+ # except:
569
+ # #print(&#34;Exc on&#34;, aa)
570
+ # pass
571
+
572
+ actions.get_action(&#34;insertimage&#34;).set_property(&#34;icon-name&#34;, &#34;insert-image&#34;)
573
+ actions.get_action(&#34;insertlink&#34;).set_property(&#34;icon-name&#34;, &#34;insert-link&#34;)
574
+ actions.get_action(&#34;inserttable&#34;).set_property(&#34;icon-name&#34;, &#34;appointment-new&#34;)
575
+ actions.get_action(&#34;editmarker&#34;).set_property(&#34;icon-name&#34;, &#34;text-editor&#34;)
576
+ actions.get_action(&#34;fontsize&#34;).set_property(&#34;icon-name&#34;, &#34;preferences-desktop-font&#34;)
577
+ actions.get_action(&#34;removeformat&#34;).set_property(&#34;icon-name&#34;, &#34;text-direction&#34;)
578
+
579
+ ui = Gtk.UIManager()
580
+ ui.insert_action_group(actions)
581
+ ui.add_ui_from_string(ui_def)
582
+
583
+ # Fill in defaults
584
+ xxx = ui.get_action_groups()[0].list_actions()
585
+ for aa in xxx:
586
+ nnn = aa.get_name()
587
+ # Find the original, patth missing info
588
+ for bb in accel_arr:
589
+ # Convert tuple
590
+ bbb = list(bb)
591
+ if bb[0] == nnn:
592
+ # Pad for this round
593
+ for cc in range(5 - len(bbb)):
594
+ bbb.append(&#34;&#34;)
595
+
596
+ #print(&#34;lab&#34;, bb[2], aa.get_label())
597
+ #print(&#34;found&#34;, nnn, bbb[3])
598
+
599
+ setattr(aa, &#34;accel&#34;, bbb[3])
600
+ if bbb[3]:
601
+ try:
602
+ nn, ss = Gtk.accelerator_parse(bbb[3])
603
+ setattr(aa, &#34;accel_parsed&#34;, (nn, ss))
604
+ except:
605
+ pass
606
+
607
+ # Pad it with capitalize name if not there
608
+ if not aa.get_tooltip():
609
+ aa.set_tooltip(nnn[0].upper() + nnn[1:])
610
+
611
+ return ui
612
+
613
+ # This is kicked in if there is no library (is it used?)
614
+
615
+ class pgwebw_fake(Gtk.VBox):
616
+
617
+ def __init__(self):
618
+ super(pgwebw_fake, self).__init__();
619
+ pass
620
+
621
+ def load_uri(self, url):
622
+ pass
623
+
624
+ def markdialog(sss):
625
+
626
+ spaceneed = 64
627
+ # Wrap tesxt if long
628
+ ssss = &#34;&#34;
629
+ cnt = 0; fff = 0
630
+ for aa in sss:
631
+ if cnt &gt; spaceneed:
632
+ fff = 1
633
+ if fff and aa.isspace():
634
+ cnt = 0; fff = 0
635
+ ssss += &#34;\n&#34;
636
+ ssss += aa
637
+ cnt += 1
638
+
639
+ dialog = Gtk.Dialog(&#34; Edit markup &#34;, None, 0,
640
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
641
+
642
+ textview = Gtk.TextView()
643
+ textview.set_editable(True)
644
+
645
+ textbuffer = textview.get_buffer()
646
+ textbuffer.set_text(ssss)
647
+
648
+ scrolledwindow = Gtk.ScrolledWindow()
649
+ scrolledwindow.set_hexpand(True)
650
+ scrolledwindow.set_vexpand(True)
651
+ scrolledwindow.add(textview)
652
+ scrolledwindow.set_size_request(640, 480)
653
+
654
+ hhh = &#34;\n &#34; \
655
+ &#34;In general, any valid html can go here. Keep it simple.\n&#34; \
656
+ &#34;The editor already decorated this sufficiently, &#34;\
657
+ &#34;try to edit existing items in place.\n&#34;
658
+
659
+ lll = Gtk.Label(hhh)
660
+ fd = Pango.FontDescription(&#34;Sans 9&#34;)
661
+ lll.override_font(fd)
662
+ thbox = Gtk.HBox()
663
+ thbox.pack_start(lll, 1, 1, 1)
664
+ dialog.vbox.pack_start(thbox, False, False, 0)
665
+ hbox = Gtk.HBox()
666
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
667
+ hbox.pack_start(scrolledwindow, 1, 1, 0)
668
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
669
+ dialog.vbox.pack_start(hbox, 1, 1, 0)
670
+ #dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
671
+ dialog.show_all()
672
+
673
+ htmlx = &#34;&#34;
674
+ if dialog.run() == Gtk.ResponseType.OK:
675
+ bi = textbuffer.get_start_iter()
676
+ ei = textbuffer.get_end_iter()
677
+ htmlx = textbuffer.get_text(bi, ei, False)
678
+
679
+ dialog.destroy()
680
+
681
+ # Unwrap it
682
+ usss = &#34;&#34;
683
+ cnt = 0; fff = 0
684
+ for aa in htmlx:
685
+ if aa == &#39;\n&#39;:
686
+ pass
687
+ else:
688
+ usss += aa
689
+ return usss
690
+
691
+ def treecallb(ddd):
692
+ global sizex
693
+ #print(&#34;tree cb&#34;, ddd[0])
694
+ sizex = ddd[0]
695
+
696
+ def sizedialog():
697
+
698
+ &#39;&#39;&#39; Present a selection Dialog for font sizes &#39;&#39;&#39;
699
+
700
+ dialog = Gtk.Dialog(&#34; Font Size &#34;, None, 0, () )
701
+
702
+ #(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
703
+
704
+ global sizex
705
+ sizex = &#34;&#34;
706
+ treedat = [&#34;8&#34;, &#34;9&#34;, &#34;10&#34;, &#34;12&#34;, &#34;14&#34;, &#34;20&#34;, &#34;24&#34;, &#34;32&#34;, &#34;48&#34;, &#34;56&#34;, &#34;64&#34;,
707
+ &#34;72&#34;, &#34;96&#34;, &#34;128&#34;]
708
+
709
+ tree = SimpleTree([&#34;Font Sizes&#34;])
710
+ for aa in treedat:
711
+ tree.append((aa,))
712
+
713
+ def actcallb(ddd):
714
+ #print(&#34;Activate cb&#34;, ddd, dialog)
715
+ dialog.response(Gtk.ResponseType.OK)
716
+ #print(&#34;Activate cb2&#34;, ddd, dialog)
717
+
718
+ scrolledwindow = Gtk.ScrolledWindow()
719
+ scrolledwindow.set_hexpand(True)
720
+ scrolledwindow.set_vexpand(True)
721
+ scrolledwindow.add(tree)
722
+ scrolledwindow.set_size_request(120, 300)
723
+
724
+ tree.setcallb(treecallb)
725
+ tree.setActcallb(actcallb)
726
+
727
+ hhh = &#34;\n &#34; \
728
+ &#34;In general, any valid html can go here. Keep it simple.\n&#34; \
729
+ &#34;The editor already decorated this sufficiently, &#34;\
730
+ &#34;try to edit existing items in place.\n&#34;
731
+
732
+ lll = Gtk.Label(hhh)
733
+ fd = Pango.FontDescription(&#34;Sans 9&#34;)
734
+ lll.override_font(fd)
735
+ thbox = Gtk.HBox()
736
+ thbox.pack_start(lll, 1, 1, 1)
737
+ #dialog.vbox.pack_start(thbox, False, False, 0)
738
+
739
+ hbox = Gtk.HBox()
740
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
741
+ hbox.pack_start(scrolledwindow, 1, 1, 0)
742
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
743
+ dialog.vbox.pack_start(hbox, 1, 1, 0)
744
+ #dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
745
+ dialog.show_all()
746
+
747
+ if dialog.run() == Gtk.ResponseType.OK:
748
+ #print(&#34;ok&#34;, sizex)
749
+ pass
750
+ else:
751
+ sizex = 0
752
+
753
+ dialog.destroy()
754
+ return sizex
755
+
756
+ # EOF</code></pre>
757
+ </details>
758
+ </section>
759
+ <section>
760
+ </section>
761
+ <section>
762
+ </section>
763
+ <section>
764
+ <h2 class="section-title" id="header-functions">Functions</h2>
765
+ <dl>
766
+ <dt id="pgwkit.markdialog"><code class="name flex">
767
+ <span>def <span class="ident">markdialog</span></span>(<span>sss)</span>
768
+ </code></dt>
769
+ <dd>
770
+ <div class="desc"></div>
771
+ <details class="source">
772
+ <summary>
773
+ <span>Expand source code</span>
774
+ </summary>
775
+ <pre><code class="python">def markdialog(sss):
776
+
777
+ spaceneed = 64
778
+ # Wrap tesxt if long
779
+ ssss = &#34;&#34;
780
+ cnt = 0; fff = 0
781
+ for aa in sss:
782
+ if cnt &gt; spaceneed:
783
+ fff = 1
784
+ if fff and aa.isspace():
785
+ cnt = 0; fff = 0
786
+ ssss += &#34;\n&#34;
787
+ ssss += aa
788
+ cnt += 1
789
+
790
+ dialog = Gtk.Dialog(&#34; Edit markup &#34;, None, 0,
791
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
792
+
793
+ textview = Gtk.TextView()
794
+ textview.set_editable(True)
795
+
796
+ textbuffer = textview.get_buffer()
797
+ textbuffer.set_text(ssss)
798
+
799
+ scrolledwindow = Gtk.ScrolledWindow()
800
+ scrolledwindow.set_hexpand(True)
801
+ scrolledwindow.set_vexpand(True)
802
+ scrolledwindow.add(textview)
803
+ scrolledwindow.set_size_request(640, 480)
804
+
805
+ hhh = &#34;\n &#34; \
806
+ &#34;In general, any valid html can go here. Keep it simple.\n&#34; \
807
+ &#34;The editor already decorated this sufficiently, &#34;\
808
+ &#34;try to edit existing items in place.\n&#34;
809
+
810
+ lll = Gtk.Label(hhh)
811
+ fd = Pango.FontDescription(&#34;Sans 9&#34;)
812
+ lll.override_font(fd)
813
+ thbox = Gtk.HBox()
814
+ thbox.pack_start(lll, 1, 1, 1)
815
+ dialog.vbox.pack_start(thbox, False, False, 0)
816
+ hbox = Gtk.HBox()
817
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
818
+ hbox.pack_start(scrolledwindow, 1, 1, 0)
819
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
820
+ dialog.vbox.pack_start(hbox, 1, 1, 0)
821
+ #dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
822
+ dialog.show_all()
823
+
824
+ htmlx = &#34;&#34;
825
+ if dialog.run() == Gtk.ResponseType.OK:
826
+ bi = textbuffer.get_start_iter()
827
+ ei = textbuffer.get_end_iter()
828
+ htmlx = textbuffer.get_text(bi, ei, False)
829
+
830
+ dialog.destroy()
831
+
832
+ # Unwrap it
833
+ usss = &#34;&#34;
834
+ cnt = 0; fff = 0
835
+ for aa in htmlx:
836
+ if aa == &#39;\n&#39;:
837
+ pass
838
+ else:
839
+ usss += aa
840
+ return usss</code></pre>
841
+ </details>
842
+ </dd>
843
+ <dt id="pgwkit.sizedialog"><code class="name flex">
844
+ <span>def <span class="ident">sizedialog</span></span>(<span>)</span>
845
+ </code></dt>
846
+ <dd>
847
+ <div class="desc"><p>Present a selection Dialog for font sizes</p></div>
848
+ <details class="source">
849
+ <summary>
850
+ <span>Expand source code</span>
851
+ </summary>
852
+ <pre><code class="python">def sizedialog():
853
+
854
+ &#39;&#39;&#39; Present a selection Dialog for font sizes &#39;&#39;&#39;
855
+
856
+ dialog = Gtk.Dialog(&#34; Font Size &#34;, None, 0, () )
857
+
858
+ #(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
859
+
860
+ global sizex
861
+ sizex = &#34;&#34;
862
+ treedat = [&#34;8&#34;, &#34;9&#34;, &#34;10&#34;, &#34;12&#34;, &#34;14&#34;, &#34;20&#34;, &#34;24&#34;, &#34;32&#34;, &#34;48&#34;, &#34;56&#34;, &#34;64&#34;,
863
+ &#34;72&#34;, &#34;96&#34;, &#34;128&#34;]
864
+
865
+ tree = SimpleTree([&#34;Font Sizes&#34;])
866
+ for aa in treedat:
867
+ tree.append((aa,))
868
+
869
+ def actcallb(ddd):
870
+ #print(&#34;Activate cb&#34;, ddd, dialog)
871
+ dialog.response(Gtk.ResponseType.OK)
872
+ #print(&#34;Activate cb2&#34;, ddd, dialog)
873
+
874
+ scrolledwindow = Gtk.ScrolledWindow()
875
+ scrolledwindow.set_hexpand(True)
876
+ scrolledwindow.set_vexpand(True)
877
+ scrolledwindow.add(tree)
878
+ scrolledwindow.set_size_request(120, 300)
879
+
880
+ tree.setcallb(treecallb)
881
+ tree.setActcallb(actcallb)
882
+
883
+ hhh = &#34;\n &#34; \
884
+ &#34;In general, any valid html can go here. Keep it simple.\n&#34; \
885
+ &#34;The editor already decorated this sufficiently, &#34;\
886
+ &#34;try to edit existing items in place.\n&#34;
887
+
888
+ lll = Gtk.Label(hhh)
889
+ fd = Pango.FontDescription(&#34;Sans 9&#34;)
890
+ lll.override_font(fd)
891
+ thbox = Gtk.HBox()
892
+ thbox.pack_start(lll, 1, 1, 1)
893
+ #dialog.vbox.pack_start(thbox, False, False, 0)
894
+
895
+ hbox = Gtk.HBox()
896
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
897
+ hbox.pack_start(scrolledwindow, 1, 1, 0)
898
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
899
+ dialog.vbox.pack_start(hbox, 1, 1, 0)
900
+ #dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
901
+ dialog.show_all()
902
+
903
+ if dialog.run() == Gtk.ResponseType.OK:
904
+ #print(&#34;ok&#34;, sizex)
905
+ pass
906
+ else:
907
+ sizex = 0
908
+
909
+ dialog.destroy()
910
+ return sizex</code></pre>
911
+ </details>
912
+ </dd>
913
+ <dt id="pgwkit.treecallb"><code class="name flex">
914
+ <span>def <span class="ident">treecallb</span></span>(<span>ddd)</span>
915
+ </code></dt>
916
+ <dd>
917
+ <div class="desc"></div>
918
+ <details class="source">
919
+ <summary>
920
+ <span>Expand source code</span>
921
+ </summary>
922
+ <pre><code class="python">def treecallb(ddd):
923
+ global sizex
924
+ #print(&#34;tree cb&#34;, ddd[0])
925
+ sizex = ddd[0]</code></pre>
926
+ </details>
927
+ </dd>
928
+ </dl>
929
+ </section>
930
+ <section>
931
+ <h2 class="section-title" id="header-classes">Classes</h2>
932
+ <dl>
933
+ <dt id="pgwkit.dummywebkit"><code class="flex name class">
934
+ <span>class <span class="ident">dummywebkit</span></span>
935
+ </code></dt>
936
+ <dd>
937
+ <div class="desc"></div>
938
+ <details class="source">
939
+ <summary>
940
+ <span>Expand source code</span>
941
+ </summary>
942
+ <pre><code class="python">class dummywebkit():
943
+ WebView = dummywebview</code></pre>
944
+ </details>
945
+ <h3>Class variables</h3>
946
+ <dl>
947
+ <dt id="pgwkit.dummywebkit.WebView"><code class="name">var <span class="ident">WebView</span></code></dt>
948
+ <dd>
949
+ <div class="desc"><p>:Constructors:</p>
950
+ <p>::</p>
951
+ <pre><code>VBox(**properties)
952
+ new(homogeneous:bool, spacing:int) -&gt; Gtk.Widget
953
+ </code></pre></div>
954
+ </dd>
955
+ </dl>
956
+ </dd>
957
+ <dt id="pgwkit.dummywebview"><code class="flex name class">
958
+ <span>class <span class="ident">dummywebview</span></span>
959
+ <span>(</span><span>*args, **kwargs)</span>
960
+ </code></dt>
961
+ <dd>
962
+ <div class="desc"><p>:Constructors:</p>
963
+ <p>::</p>
964
+ <pre><code>VBox(**properties)
965
+ new(homogeneous:bool, spacing:int) -&gt; Gtk.Widget
966
+ </code></pre>
967
+ <p>Initializer for a GObject based classes with support for property
968
+ sets through the use of explicit keyword arguments.</p></div>
969
+ <details class="source">
970
+ <summary>
971
+ <span>Expand source code</span>
972
+ </summary>
973
+ <pre><code class="python">class dummywebview(Gtk.VBox):
974
+
975
+ def __int__(self):
976
+ super().__init__(self)
977
+ #self.pack_start(Gtk.Label(label=&#34;No WebView&#34;), 1, 1, 0)
978
+ def set_editable(self, flag):
979
+ self.pack_start(Gtk.Label(label=&#34;No WebView Available&#34;), 1, 1, 0)
980
+ pass
981
+ def load_html(self, ff, kk = None):
982
+ pass
983
+ def connect(self, aa, bb):
984
+ pass</code></pre>
985
+ </details>
986
+ <h3>Ancestors</h3>
987
+ <ul class="hlist">
988
+ <li>gi.repository.Gtk.VBox</li>
989
+ <li>gi.overrides.Gtk.Box</li>
990
+ <li>gi.repository.Gtk.Box</li>
991
+ <li>gi.overrides.Gtk.Container</li>
992
+ <li>gi.repository.Gtk.Container</li>
993
+ <li>gi.overrides.Gtk.Widget</li>
994
+ <li>gi.repository.Gtk.Widget</li>
995
+ <li>gi.repository.GObject.InitiallyUnowned</li>
996
+ <li>gi.overrides.GObject.Object</li>
997
+ <li>gi.repository.GObject.Object</li>
998
+ <li>gi._gi.GObject</li>
999
+ <li>gi.repository.Atk.ImplementorIface</li>
1000
+ <li>gi.repository.Gtk.Buildable</li>
1001
+ <li>gi.repository.Gtk.Orientable</li>
1002
+ <li>gobject.GInterface</li>
1003
+ </ul>
1004
+ <h3>Methods</h3>
1005
+ <dl>
1006
+ <dt id="pgwkit.dummywebview.connect"><code class="name flex">
1007
+ <span>def <span class="ident">connect</span></span>(<span>self, aa, bb)</span>
1008
+ </code></dt>
1009
+ <dd>
1010
+ <div class="desc"></div>
1011
+ <details class="source">
1012
+ <summary>
1013
+ <span>Expand source code</span>
1014
+ </summary>
1015
+ <pre><code class="python">def connect(self, aa, bb):
1016
+ pass</code></pre>
1017
+ </details>
1018
+ </dd>
1019
+ <dt id="pgwkit.dummywebview.load_html"><code class="name flex">
1020
+ <span>def <span class="ident">load_html</span></span>(<span>self, ff, kk=None)</span>
1021
+ </code></dt>
1022
+ <dd>
1023
+ <div class="desc"></div>
1024
+ <details class="source">
1025
+ <summary>
1026
+ <span>Expand source code</span>
1027
+ </summary>
1028
+ <pre><code class="python">def load_html(self, ff, kk = None):
1029
+ pass</code></pre>
1030
+ </details>
1031
+ </dd>
1032
+ <dt id="pgwkit.dummywebview.set_editable"><code class="name flex">
1033
+ <span>def <span class="ident">set_editable</span></span>(<span>self, flag)</span>
1034
+ </code></dt>
1035
+ <dd>
1036
+ <div class="desc"></div>
1037
+ <details class="source">
1038
+ <summary>
1039
+ <span>Expand source code</span>
1040
+ </summary>
1041
+ <pre><code class="python">def set_editable(self, flag):
1042
+ self.pack_start(Gtk.Label(label=&#34;No WebView Available&#34;), 1, 1, 0)
1043
+ pass</code></pre>
1044
+ </details>
1045
+ </dd>
1046
+ </dl>
1047
+ </dd>
1048
+ <dt id="pgwkit.pgwebw"><code class="flex name class">
1049
+ <span>class <span class="ident">pgwebw</span></span>
1050
+ <span>(</span><span>xlink=None)</span>
1051
+ </code></dt>
1052
+ <dd>
1053
+ <div class="desc"><p>Define our override of the webkit class</p></div>
1054
+ <details class="source">
1055
+ <summary>
1056
+ <span>Expand source code</span>
1057
+ </summary>
1058
+ <pre><code class="python">class pgwebw(WebKit2.WebView):
1059
+
1060
+ &#39;&#39;&#39; Define our override of the webkit class &#39;&#39;&#39;
1061
+
1062
+ def __init__(self, xlink=None):
1063
+ try:
1064
+ GObject.GObject.__init__(self)
1065
+ except:
1066
+ print(&#34;Cannot ??? in parent object&#34;, sys.exc_info())
1067
+ pass
1068
+ self.xlink = xlink
1069
+ self.set_editable(True)
1070
+
1071
+ #if editable:
1072
+ # self.set_editable(True)
1073
+
1074
+ self.fname = &#34;&#34;
1075
+ self.load_html(&#34;&#34;, &#34;file:///&#34;)
1076
+ self.ui = self.generate_ui()
1077
+ self.connect(&#34;key-release-event&#34;, self.keypress)
1078
+ self.modified = False
1079
+
1080
+ def _get_response_data_finish(self, resource, result, user_data=None):
1081
+ self.old_html = resource.get_data_finish(result)
1082
+ #print((self.old_html))
1083
+
1084
+ def keypress(self, arg, arg2):
1085
+
1086
+ &#39;&#39;&#39; Here we imitate the way the accelerator works &#39;&#39;&#39;
1087
+
1088
+ state = arg2.get_state() &amp; Gdk.ModifierType.MODIFIER_MASK
1089
+ key = arg2.get_keyval()[1]
1090
+ #print(&#34;key&#34;, key, &#34;state&#34;, state)
1091
+
1092
+ #GDK_MODIFIER_RESERVED_25_MASK
1093
+
1094
+ # Feeding off the accelarator&#39;s definitions
1095
+ ag = self.ui.get_action_groups()[0]
1096
+ acts = ag.list_actions()
1097
+
1098
+ # Scan - Fire
1099
+ for aa in acts:
1100
+ if aa.accel:
1101
+ #print(nnn, aa.accel, aa.accel_parsed)
1102
+ if state == aa.accel_parsed[1]:
1103
+ #print(&#34;state match&#34;)
1104
+ if key == aa.accel_parsed[0]:
1105
+ #print(&#34;Fire &#34;, aa.get_name(), aa.get_label())
1106
+ #lab = aa.get_label()
1107
+ aa.activate()
1108
+ break # Only one accel the other is a mistake
1109
+
1110
+ # See if nav key
1111
+ navkey = False
1112
+ for aa in navkeys:
1113
+ if key == aa:
1114
+ #print(&#34;Navkey&#34;, aa)
1115
+ navkey = True
1116
+ if not navkey:
1117
+ # Exclude Ctrl-s
1118
+ if state == Gdk.ModifierType.CONTROL_MASK and key == 115:
1119
+ #print(&#34;Control s&#34;)
1120
+ pass
1121
+ else:
1122
+ #print(&#34;set on key&#34;, key)
1123
+ self.modified = True
1124
+
1125
+ def do_ready_to_show(self):
1126
+ print(&#34;do_ready_to_show() was called&#34;)
1127
+ pass
1128
+
1129
+ def do_load_changed(self, status):
1130
+
1131
+ #print(&#34;do_load_changed()&#34;, status)
1132
+ if status == WebKit2.LoadEvent.FINISHED:
1133
+ &#39;&#39;&#39; Create a shadow of content &#39;&#39;&#39;
1134
+
1135
+ # This gets it without spaces
1136
+ #resource = self.get_main_resource()
1137
+ #resource.get_data(None, self._get_response_data_finish, None)
1138
+
1139
+ # Get it by JS
1140
+ def completion(html, user_data):
1141
+ self.old_html = html
1142
+ self.get_html(completion, &#39;&#39;)
1143
+
1144
+
1145
+ if self.get_uri():
1146
+ if self.xlink:
1147
+ self.xlink.set_status(&#34;Loading ... &#34; + self.get_uri()[:64])
1148
+
1149
+ if status == 3: #WebKit2.LoadEvent.WEBKIT_LOAD_FINISHED:
1150
+ #print(&#34;got WEBKIT_LOAD_FINISHED&#34;)
1151
+ if self.get_uri():
1152
+ if self.xlink:
1153
+ self.xlink.edit.set_text(self.get_uri()[:64])
1154
+ self.xlink.set_status(&#34;Finished: &#34; + self.get_uri()[:64])
1155
+ self.grab_focus()
1156
+
1157
+ def do_load_failed(self, load_event, failing_uri, error):
1158
+ print(&#34;do_load_failed() was called&#34;, failing_uri)
1159
+ if self.xlink:
1160
+ self.xlink.set_status(&#34;Failed: &#34; + failing_uri[:64])
1161
+
1162
+ def on_header(self, action):
1163
+ #print(&#34;on_aheader&#34;, action.get_name())
1164
+ ddd = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
1165
+ ccc = None
1166
+ while True:
1167
+ #target = Gdk.Atom.intern (&#34;text/html&#34;, True);
1168
+ #ccc = ddd.wait_for_contents(target)
1169
+ #if ccc:
1170
+ # break
1171
+ target2 = Gdk.Atom.intern (&#34;text/plain&#34;, True);
1172
+ ccc = ddd.wait_for_contents(target2)
1173
+ if ccc:
1174
+ break
1175
+ break
1176
+
1177
+ if not ccc:
1178
+ return
1179
+
1180
+ dddd = ccc.get_data().decode()
1181
+ if not dddd:
1182
+ return
1183
+ #print(&#34;dddd&#34;, dddd)
1184
+ htmlx = &#34;&lt;%s&gt;%s&lt;/%s&gt;&#34; % (action.get_name(), dddd, action.get_name())
1185
+ self.run_javascript(&#34;document.execCommand \
1186
+ (&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1187
+ Gtk.Clipboard.clear(ddd)
1188
+ self.modified = True
1189
+
1190
+ def on_action(self, action):
1191
+ #print(&#34;on_action&#34;, action.get_name())
1192
+ # Make it caller neutral
1193
+ if type(action) == str:
1194
+ nnn = action
1195
+ else:
1196
+ nnn = action.get_name()
1197
+ self.run_javascript(&#34;document.execCommand(&#39;%s&#39;, false, false);&#34; % nnn)
1198
+ self.modified = True
1199
+
1200
+ def on_paste(self, action = &#34;&#34;):
1201
+ print(&#34;Paste&#34;)
1202
+ self.execute_editing_command(WebKit2.EDITING_COMMAND_PASTE)
1203
+
1204
+ def on_new(self, action):
1205
+ self.load_html(&#34;&#34;, &#34;file:///&#34;)
1206
+ self.modified = False
1207
+
1208
+ def on_fontsize(self, action):
1209
+ #print(&#34;on_fontsize&#34;)
1210
+ sizex = sizedialog()
1211
+ #print(&#34;sizex&#34;, sizex)
1212
+ if not sizex:
1213
+ return
1214
+
1215
+ c = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
1216
+ sel = c.wait_for_targets()
1217
+ #print(&#34;sel&#34;, sel)
1218
+ target = Gdk.Atom.intern (&#34;text/plain&#34;, True);
1219
+ ccc = c.wait_for_contents(target)
1220
+ if not ccc:
1221
+ htmlx = &#34;&lt;span style=\&#34;font-size: %dpx;\&#34;&gt;%s&lt;/span&gt;&#34; % (int(sizex), &#34;&#34;)
1222
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1223
+ return
1224
+
1225
+ ddd = ccc.get_data().decode()
1226
+ if not ddd:
1227
+ return
1228
+
1229
+ #print(&#34;ddd&#34;, ddd)
1230
+ htmlx = &#34;&lt;span style=\&#34;font-size: %dpx;\&#34;&gt;%s&lt;/span&gt;&#34; % (int(sizex), ddd)
1231
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1232
+ Gtk.Clipboard.clear(c)
1233
+ self.modified = True
1234
+
1235
+ def on_select_font(self, action):
1236
+ dialog = Gtk.FontChooserDialog(&#34;Select a font&#34;)
1237
+ if dialog.run() == Gtk.ResponseType.OK:
1238
+ fname = dialog.get_font_desc().get_family()
1239
+ fsize = dialog.get_font_desc().get_size() / Pango.SCALE
1240
+ ttt = int(1 + round(fsize / 10)) % 9
1241
+ print(&#34;Setting font&#34;, fname, fsize, ttt)
1242
+ self.run_javascript(&#34;document.execCommand(&#39;fontname&#39;, null, &#39;%s&#39;);&#34; % fname)
1243
+ self.run_javascript(&#34;document.execCommand(&#39;fontsize&#39;, null, &#39;%s&#39;);&#34; % ttt)
1244
+ dialog.destroy()
1245
+
1246
+ def on_select_color(self, action):
1247
+ dialog = Gtk.ColorChooserDialog(&#34;Select Color&#34;)
1248
+ if dialog.run() == Gtk.ResponseType.OK:
1249
+ (r, g, b, a) = dialog.get_rgba()
1250
+ color = &#34;#%0.2x%0.2x%0.2x%0.2x&#34; % (
1251
+ int(r * 255),
1252
+ int(g * 255),
1253
+ int(b * 255),
1254
+ int(a * 255))
1255
+ self.run_javascript(&#34;document.execCommand(&#39;forecolor&#39;, null, &#39;%s&#39;);&#34; % color)
1256
+ dialog.destroy()
1257
+
1258
+ def on_select_bgcolor(self, action):
1259
+ dialog = Gtk.ColorChooserDialog(&#34;Select Background Color&#34;)
1260
+ if dialog.run() == Gtk.ResponseType.OK:
1261
+ (r, g, b, a) = dialog.get_rgba()
1262
+ color = &#34;#%0.2x%0.2x%0.2x%0.2x&#34; % (
1263
+ int(r * 255),
1264
+ int(g * 255),
1265
+ int(b * 255),
1266
+ int(a * 255))
1267
+ self.run_javascript(&#34;document.execCommand(&#39;backcolor&#39;, null, &#39;%s&#39;);&#34; % color)
1268
+ dialog.destroy()
1269
+
1270
+ def on_edit_marker(self, action):
1271
+ print(&#34;on_edit_marker&#34;, action.get_name())
1272
+
1273
+ c = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
1274
+ sel = c.wait_for_targets()
1275
+ target = Gdk.Atom.intern (&#34;text/html&#34;, True);
1276
+ ccc = c.wait_for_contents(target)
1277
+ #print(&#34;sel&#34;, ccc.get_data())
1278
+ #ccc.free()
1279
+ htmlx = markdialog(ccc.get_data().decode())
1280
+ if htmlx:
1281
+ print(&#34;markdialog result:\n&#34;, htmlx)
1282
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1283
+
1284
+ def on_insert_table(self, action):
1285
+ htmlx = &#34;&lt;table align=center border=0 contentEditable=true&gt;&#34; + \
1286
+ &#34;&lt;tr&gt;&lt;td&gt;TR1 C1 &lt;td&gt;| TR1 C2 &lt;tr&gt;&lt;td&gt;TR2 C1&lt;td&gt;| TR2 C1&lt;/table&gt;&lt;br&gt;&#34;
1287
+
1288
+ #print(&#34;table&#34;, htmlx)
1289
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1290
+ self.modified = True
1291
+
1292
+ def on_insert_link(self, action):
1293
+ dialog = Gtk.Dialog(&#34; Enter a URL: &#34;, None, 0,
1294
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
1295
+
1296
+ entry = Gtk.Entry()
1297
+ dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1298
+ hbox = Gtk.HBox()
1299
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1300
+ hbox.pack_start(entry, False, False, 0)
1301
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1302
+ dialog.vbox.pack_start(hbox, False, False, 0)
1303
+
1304
+ dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1305
+ dialog.show_all()
1306
+
1307
+ if dialog.run() == Gtk.ResponseType.OK:
1308
+ self.run_javascript(
1309
+ &#34;document.execCommand(&#39;createLink&#39;, True, &#39;%s&#39;);&#34; % entry.get_text())
1310
+ dialog.destroy()
1311
+ self.modified = True
1312
+
1313
+ def on_insert_image(self, action):
1314
+ dialog = Gtk.FileChooserDialog(&#34;Select an image file&#34;, None, Gtk.FileChooserAction.OPEN,
1315
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
1316
+
1317
+ if dialog.run() == Gtk.ResponseType.OK:
1318
+ fn = dialog.get_filename()
1319
+ if os.path.exists(fn):
1320
+ self.run_javascript(
1321
+ &#34;document.execCommand(&#39;insertImage&#39;, null, &#39;%s&#39;);&#34; % fn)
1322
+ dialog.destroy()
1323
+ self.modified = True
1324
+
1325
+ def on_open(self, action):
1326
+ dialog = Gtk.FileChooserDialog(&#34;Select an HTML file&#34;, self, Gtk.FileChooserAction.OPEN,
1327
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
1328
+
1329
+ if dialog.run() == Gtk.ResponseType.OK:
1330
+ fn = dialog.get_filename()
1331
+ if os.path.exists(fn):
1332
+ self.fname = fn
1333
+ with open(fn) as fd:
1334
+ self.load_html(fd.read(), &#34;file:///&#34;)
1335
+ dialog.destroy()
1336
+
1337
+ def on_save(self, action):
1338
+ def completion(html, user_data):
1339
+ open_mode = user_data
1340
+ with open(self.fname, open_mode) as fd:
1341
+ fd.write(html)
1342
+
1343
+ if self.fname:
1344
+ self.get_html(completion, &#39;w&#39;)
1345
+ else:
1346
+ dialog = Gtk.FileChooserDialog(&#34;Select an HTML file&#34;, None,
1347
+ Gtk.FileChooserAction.SAVE,
1348
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
1349
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
1350
+
1351
+ if dialog.run() == Gtk.ResponseType.OK:
1352
+ self.fname = dialog.get_filename()
1353
+ print(&#34;Saving&#34;, self.fname)
1354
+ self.get_html(completion, &#34;w+&#34;)
1355
+ dialog.destroy()
1356
+
1357
+ def get_html(self, completion_function, user_data):
1358
+
1359
+ #print(&#34;get_html&#34;)
1360
+ def javascript_completion(obj, result, user_data):
1361
+ #print(&#34;javascript_completion&#34;, result)
1362
+ fin = self.run_javascript_finish(result)
1363
+ #print(&#34;fin&#34;, fin)
1364
+ html = fin.get_js_value().to_string()
1365
+ #print(&#34;len html&#34;, len(html), &#34;\n&#34;)
1366
+ completion_function(html, user_data)
1367
+ self.run_javascript(&#34;document.documentElement.innerHTML;&#34;,
1368
+ None,
1369
+ javascript_completion,
1370
+ user_data)
1371
+
1372
+ def get_lastmod(self, completion_function, user_data):
1373
+
1374
+ print(&#34;get_lastmod&#34;)
1375
+ def javascript_completion(obj, result, user_data):
1376
+ print(&#34;javascript_completion&#34;, result)
1377
+ fin = self.run_javascript_finish(result)
1378
+ #print(&#34;fin&#34;, fin)
1379
+ html = fin.get_js_value().to_string()
1380
+ print(&#34;lastmod&#34;, html, &#34;\n&#34;)
1381
+ #completion_function(html, user_data)
1382
+ self.run_javascript(&#34;document.lastModified&#34;,
1383
+ None,
1384
+ javascript_completion,
1385
+ user_data)
1386
+
1387
+
1388
+ def generate_ui(self):
1389
+
1390
+ &#39;&#39;&#39; define toolbar items and actions here &#39;&#39;&#39;
1391
+
1392
+ actions = Gtk.ActionGroup(&#34;Actions&#34;)
1393
+ # ----------------------------------------------------------------
1394
+ # Name, Stock Icon, Accelerator, ToolTip, Action
1395
+
1396
+ # Some already has app accels
1397
+
1398
+ accel_arr = [ \
1399
+
1400
+ #(&#34;menuFile&#34;, None, &#34;_File&#34;),
1401
+ #(&#34;menuEdit&#34;, None, &#34;_Edit&#34;),
1402
+ #(&#34;menuInsert&#34;, None, &#34;_Insert&#34;),
1403
+ #(&#34;menuFormat&#34;, None, &#34;_Format&#34;),
1404
+ #(&#34;new&#34;, Gtk.STOCK_NEW, &#34;_New&#34;, None, None, self.on_new),
1405
+ #(&#34;open&#34;, Gtk.STOCK_OPEN, &#34;_Open&#34;, None, None, self.on_open),
1406
+ #(&#34;save&#34;, Gtk.STOCK_SAVE, &#34;_Save&#34;, None, None, self.on_save),
1407
+
1408
+ (&#34;cut&#34;, Gtk.STOCK_CUT, &#34;_Cut&#34;, None, None, self.on_action),
1409
+ (&#34;copy&#34;, Gtk.STOCK_COPY, &#34;_Copy&#34;, None, None, self.on_action),
1410
+ (&#34;paste&#34;, Gtk.STOCK_PASTE, &#34;_Paste&#34;, None, None, self.on_paste),
1411
+
1412
+ (&#34;undo&#34;, Gtk.STOCK_UNDO, &#34;_Undo&#34;, &#34;&lt;Control&gt;z&#34;, &#34;Undo Last Edit&#34;, self.on_action),
1413
+ (&#34;redo&#34;, Gtk.STOCK_REDO, &#34;_Redo&#34;, &#34;&lt;Control&gt;y&#34;, &#34;Redo Last Undo&#34;, self.on_action),
1414
+
1415
+ (&#34;removeformat&#34;, Gtk.STOCK_PROPERTIES, &#34;_removeFormat&#34;, &#34;&lt;Control&gt;M&#34;, &#34;Remove Formatting&#34;, self.on_action),
1416
+ (&#34;bold&#34;, Gtk.STOCK_BOLD, &#34;_Bold&#34;, &#34;&#34;, &#34;Bold / UnBold Selection&#34;, self.on_action),
1417
+ (&#34;italic&#34;, Gtk.STOCK_ITALIC, &#34;_Italic&#34;, &#34;&#34;, None, self.on_action),
1418
+ (&#34;underline&#34;, Gtk.STOCK_UNDERLINE, &#34;_Underline&#34;, &#34;&#34;, None, self.on_action),
1419
+ (&#34;strikethrough&#34;, Gtk.STOCK_STRIKETHROUGH, &#34;_Strike&#34;, &#34;&#34;, None, self.on_action),
1420
+ (&#34;font&#34;, Gtk.STOCK_SELECT_FONT, &#34;Select _Font&#34;, &#34;&#34;, None, self.on_select_font),
1421
+ (&#34;fontsize&#34;, None, &#34;Select Font _Size&#34;, &#34;&lt;Control&gt;f&#34;, &#34;Set Absolute Size (removes color)&#34;, self.on_fontsize),
1422
+ (&#34;color&#34;, Gtk.STOCK_SELECT_COLOR, &#34;Select _Color&#34;, None, None, self.on_select_color),
1423
+ (&#34;backgroundcolor&#34;, Gtk.STOCK_COLOR_PICKER, &#34;Select Back Color&#34;, None, None, self.on_select_bgcolor),
1424
+
1425
+ (&#34;justifyleft&#34;, Gtk.STOCK_JUSTIFY_LEFT, &#34;Justify _Left&#34;, None, None, self.on_action),
1426
+ (&#34;justifyright&#34;, Gtk.STOCK_JUSTIFY_RIGHT, &#34;Justify _Right&#34;, None, None, self.on_action),
1427
+ (&#34;justifycenter&#34;, Gtk.STOCK_JUSTIFY_CENTER, &#34;Justify _Center&#34;, None, None, self.on_action),
1428
+ (&#34;justifyfull&#34;, Gtk.STOCK_JUSTIFY_FILL, &#34;Justify _Full&#34;, None, None, self.on_action),
1429
+
1430
+ # Pad Images by name (may not be present in all styles)
1431
+ (&#34;insertimage&#34;, &#34;insert-image&#34;, &#34;Insert _Image&#34;, None, None, self.on_insert_image),
1432
+ (&#34;insertlink&#34;, &#34;insert-link&#34;, &#34;Insert _Link&#34;, None, None, self.on_insert_link),
1433
+ (&#34;inserttable&#34;, &#34;insert-table&#34;, &#34;Insert _Table&#34;, None, None, self.on_insert_table),
1434
+ (&#34;editmarker&#34;, &#34;edit-marker&#34;, &#34;edit _Marker&#34;, None, None, self.on_edit_marker),
1435
+
1436
+ (&#34;H1&#34;, Gtk.STOCK_EXECUTE, &#34;Header 1&#34;, None, &#34;Insert Header 1&#34;, self.on_header),
1437
+ (&#34;H2&#34;, Gtk.STOCK_EXECUTE, &#34;Header 2&#34;, None, &#34;Insert Header 2&#34;, self.on_header),
1438
+ (&#34;H3&#34;, Gtk.STOCK_EXECUTE, &#34;Header 3&#34;, None, &#34;Insert Header 3&#34;, self.on_header),
1439
+ (&#34;H4&#34;, Gtk.STOCK_EXECUTE, &#34;Header 4&#34;, None, &#34;Insert Header 4&#34;, self.on_header),
1440
+
1441
+ ]
1442
+
1443
+ actions.add_actions(accel_arr)
1444
+
1445
+ #print(dir(actions))
1446
+ for aa in accel_arr:
1447
+ # print(&#34;acc arr&#34;, dir(aa))
1448
+ # break
1449
+ # act = actions.get_action(aa[0])
1450
+ # print(&#34;act&#34;, act.get_name(), act.get_tooltip())
1451
+ pass
1452
+ # try:
1453
+ # act = Gtk.Action.new(aa[0], aa[2], aa[4], aa[1])
1454
+ # actions.add_action_with_accel(act, aa[3])
1455
+ # except:
1456
+ # #print(&#34;Exc on&#34;, aa)
1457
+ # pass
1458
+
1459
+ actions.get_action(&#34;insertimage&#34;).set_property(&#34;icon-name&#34;, &#34;insert-image&#34;)
1460
+ actions.get_action(&#34;insertlink&#34;).set_property(&#34;icon-name&#34;, &#34;insert-link&#34;)
1461
+ actions.get_action(&#34;inserttable&#34;).set_property(&#34;icon-name&#34;, &#34;appointment-new&#34;)
1462
+ actions.get_action(&#34;editmarker&#34;).set_property(&#34;icon-name&#34;, &#34;text-editor&#34;)
1463
+ actions.get_action(&#34;fontsize&#34;).set_property(&#34;icon-name&#34;, &#34;preferences-desktop-font&#34;)
1464
+ actions.get_action(&#34;removeformat&#34;).set_property(&#34;icon-name&#34;, &#34;text-direction&#34;)
1465
+
1466
+ ui = Gtk.UIManager()
1467
+ ui.insert_action_group(actions)
1468
+ ui.add_ui_from_string(ui_def)
1469
+
1470
+ # Fill in defaults
1471
+ xxx = ui.get_action_groups()[0].list_actions()
1472
+ for aa in xxx:
1473
+ nnn = aa.get_name()
1474
+ # Find the original, patth missing info
1475
+ for bb in accel_arr:
1476
+ # Convert tuple
1477
+ bbb = list(bb)
1478
+ if bb[0] == nnn:
1479
+ # Pad for this round
1480
+ for cc in range(5 - len(bbb)):
1481
+ bbb.append(&#34;&#34;)
1482
+
1483
+ #print(&#34;lab&#34;, bb[2], aa.get_label())
1484
+ #print(&#34;found&#34;, nnn, bbb[3])
1485
+
1486
+ setattr(aa, &#34;accel&#34;, bbb[3])
1487
+ if bbb[3]:
1488
+ try:
1489
+ nn, ss = Gtk.accelerator_parse(bbb[3])
1490
+ setattr(aa, &#34;accel_parsed&#34;, (nn, ss))
1491
+ except:
1492
+ pass
1493
+
1494
+ # Pad it with capitalize name if not there
1495
+ if not aa.get_tooltip():
1496
+ aa.set_tooltip(nnn[0].upper() + nnn[1:])
1497
+
1498
+ return ui</code></pre>
1499
+ </details>
1500
+ <h3>Ancestors</h3>
1501
+ <ul class="hlist">
1502
+ <li>gi.repository.WebKit2.WebView</li>
1503
+ <li>gi.repository.WebKit2.WebViewBase</li>
1504
+ <li>gi.overrides.Gtk.Container</li>
1505
+ <li>gi.repository.Gtk.Container</li>
1506
+ <li>gi.overrides.Gtk.Widget</li>
1507
+ <li>gi.repository.Gtk.Widget</li>
1508
+ <li>gi.repository.GObject.InitiallyUnowned</li>
1509
+ <li>gi.overrides.GObject.Object</li>
1510
+ <li>gi.repository.GObject.Object</li>
1511
+ <li>gi._gi.GObject</li>
1512
+ <li>gi.repository.Atk.ImplementorIface</li>
1513
+ <li>gi.repository.Gtk.Buildable</li>
1514
+ <li>gobject.GInterface</li>
1515
+ </ul>
1516
+ <h3>Methods</h3>
1517
+ <dl>
1518
+ <dt id="pgwkit.pgwebw.do_load_changed"><code class="name flex">
1519
+ <span>def <span class="ident">do_load_changed</span></span>(<span>self, status)</span>
1520
+ </code></dt>
1521
+ <dd>
1522
+ <div class="desc"><p>load_changed(self, load_event:WebKit2.LoadEvent)</p></div>
1523
+ <details class="source">
1524
+ <summary>
1525
+ <span>Expand source code</span>
1526
+ </summary>
1527
+ <pre><code class="python">def do_load_changed(self, status):
1528
+
1529
+ #print(&#34;do_load_changed()&#34;, status)
1530
+ if status == WebKit2.LoadEvent.FINISHED:
1531
+ &#39;&#39;&#39; Create a shadow of content &#39;&#39;&#39;
1532
+
1533
+ # This gets it without spaces
1534
+ #resource = self.get_main_resource()
1535
+ #resource.get_data(None, self._get_response_data_finish, None)
1536
+
1537
+ # Get it by JS
1538
+ def completion(html, user_data):
1539
+ self.old_html = html
1540
+ self.get_html(completion, &#39;&#39;)
1541
+
1542
+
1543
+ if self.get_uri():
1544
+ if self.xlink:
1545
+ self.xlink.set_status(&#34;Loading ... &#34; + self.get_uri()[:64])
1546
+
1547
+ if status == 3: #WebKit2.LoadEvent.WEBKIT_LOAD_FINISHED:
1548
+ #print(&#34;got WEBKIT_LOAD_FINISHED&#34;)
1549
+ if self.get_uri():
1550
+ if self.xlink:
1551
+ self.xlink.edit.set_text(self.get_uri()[:64])
1552
+ self.xlink.set_status(&#34;Finished: &#34; + self.get_uri()[:64])
1553
+ self.grab_focus()</code></pre>
1554
+ </details>
1555
+ </dd>
1556
+ <dt id="pgwkit.pgwebw.do_load_failed"><code class="name flex">
1557
+ <span>def <span class="ident">do_load_failed</span></span>(<span>self, load_event, failing_uri, error)</span>
1558
+ </code></dt>
1559
+ <dd>
1560
+ <div class="desc"><p>load_failed(self, load_event:WebKit2.LoadEvent, failing_uri:str, error:error) -&gt; bool</p></div>
1561
+ <details class="source">
1562
+ <summary>
1563
+ <span>Expand source code</span>
1564
+ </summary>
1565
+ <pre><code class="python">def do_load_failed(self, load_event, failing_uri, error):
1566
+ print(&#34;do_load_failed() was called&#34;, failing_uri)
1567
+ if self.xlink:
1568
+ self.xlink.set_status(&#34;Failed: &#34; + failing_uri[:64])</code></pre>
1569
+ </details>
1570
+ </dd>
1571
+ <dt id="pgwkit.pgwebw.do_ready_to_show"><code class="name flex">
1572
+ <span>def <span class="ident">do_ready_to_show</span></span>(<span>self)</span>
1573
+ </code></dt>
1574
+ <dd>
1575
+ <div class="desc"><p>ready_to_show(self)</p></div>
1576
+ <details class="source">
1577
+ <summary>
1578
+ <span>Expand source code</span>
1579
+ </summary>
1580
+ <pre><code class="python">def do_ready_to_show(self):
1581
+ print(&#34;do_ready_to_show() was called&#34;)
1582
+ pass</code></pre>
1583
+ </details>
1584
+ </dd>
1585
+ <dt id="pgwkit.pgwebw.generate_ui"><code class="name flex">
1586
+ <span>def <span class="ident">generate_ui</span></span>(<span>self)</span>
1587
+ </code></dt>
1588
+ <dd>
1589
+ <div class="desc"><p>define toolbar items and actions here</p></div>
1590
+ <details class="source">
1591
+ <summary>
1592
+ <span>Expand source code</span>
1593
+ </summary>
1594
+ <pre><code class="python">def generate_ui(self):
1595
+
1596
+ &#39;&#39;&#39; define toolbar items and actions here &#39;&#39;&#39;
1597
+
1598
+ actions = Gtk.ActionGroup(&#34;Actions&#34;)
1599
+ # ----------------------------------------------------------------
1600
+ # Name, Stock Icon, Accelerator, ToolTip, Action
1601
+
1602
+ # Some already has app accels
1603
+
1604
+ accel_arr = [ \
1605
+
1606
+ #(&#34;menuFile&#34;, None, &#34;_File&#34;),
1607
+ #(&#34;menuEdit&#34;, None, &#34;_Edit&#34;),
1608
+ #(&#34;menuInsert&#34;, None, &#34;_Insert&#34;),
1609
+ #(&#34;menuFormat&#34;, None, &#34;_Format&#34;),
1610
+ #(&#34;new&#34;, Gtk.STOCK_NEW, &#34;_New&#34;, None, None, self.on_new),
1611
+ #(&#34;open&#34;, Gtk.STOCK_OPEN, &#34;_Open&#34;, None, None, self.on_open),
1612
+ #(&#34;save&#34;, Gtk.STOCK_SAVE, &#34;_Save&#34;, None, None, self.on_save),
1613
+
1614
+ (&#34;cut&#34;, Gtk.STOCK_CUT, &#34;_Cut&#34;, None, None, self.on_action),
1615
+ (&#34;copy&#34;, Gtk.STOCK_COPY, &#34;_Copy&#34;, None, None, self.on_action),
1616
+ (&#34;paste&#34;, Gtk.STOCK_PASTE, &#34;_Paste&#34;, None, None, self.on_paste),
1617
+
1618
+ (&#34;undo&#34;, Gtk.STOCK_UNDO, &#34;_Undo&#34;, &#34;&lt;Control&gt;z&#34;, &#34;Undo Last Edit&#34;, self.on_action),
1619
+ (&#34;redo&#34;, Gtk.STOCK_REDO, &#34;_Redo&#34;, &#34;&lt;Control&gt;y&#34;, &#34;Redo Last Undo&#34;, self.on_action),
1620
+
1621
+ (&#34;removeformat&#34;, Gtk.STOCK_PROPERTIES, &#34;_removeFormat&#34;, &#34;&lt;Control&gt;M&#34;, &#34;Remove Formatting&#34;, self.on_action),
1622
+ (&#34;bold&#34;, Gtk.STOCK_BOLD, &#34;_Bold&#34;, &#34;&#34;, &#34;Bold / UnBold Selection&#34;, self.on_action),
1623
+ (&#34;italic&#34;, Gtk.STOCK_ITALIC, &#34;_Italic&#34;, &#34;&#34;, None, self.on_action),
1624
+ (&#34;underline&#34;, Gtk.STOCK_UNDERLINE, &#34;_Underline&#34;, &#34;&#34;, None, self.on_action),
1625
+ (&#34;strikethrough&#34;, Gtk.STOCK_STRIKETHROUGH, &#34;_Strike&#34;, &#34;&#34;, None, self.on_action),
1626
+ (&#34;font&#34;, Gtk.STOCK_SELECT_FONT, &#34;Select _Font&#34;, &#34;&#34;, None, self.on_select_font),
1627
+ (&#34;fontsize&#34;, None, &#34;Select Font _Size&#34;, &#34;&lt;Control&gt;f&#34;, &#34;Set Absolute Size (removes color)&#34;, self.on_fontsize),
1628
+ (&#34;color&#34;, Gtk.STOCK_SELECT_COLOR, &#34;Select _Color&#34;, None, None, self.on_select_color),
1629
+ (&#34;backgroundcolor&#34;, Gtk.STOCK_COLOR_PICKER, &#34;Select Back Color&#34;, None, None, self.on_select_bgcolor),
1630
+
1631
+ (&#34;justifyleft&#34;, Gtk.STOCK_JUSTIFY_LEFT, &#34;Justify _Left&#34;, None, None, self.on_action),
1632
+ (&#34;justifyright&#34;, Gtk.STOCK_JUSTIFY_RIGHT, &#34;Justify _Right&#34;, None, None, self.on_action),
1633
+ (&#34;justifycenter&#34;, Gtk.STOCK_JUSTIFY_CENTER, &#34;Justify _Center&#34;, None, None, self.on_action),
1634
+ (&#34;justifyfull&#34;, Gtk.STOCK_JUSTIFY_FILL, &#34;Justify _Full&#34;, None, None, self.on_action),
1635
+
1636
+ # Pad Images by name (may not be present in all styles)
1637
+ (&#34;insertimage&#34;, &#34;insert-image&#34;, &#34;Insert _Image&#34;, None, None, self.on_insert_image),
1638
+ (&#34;insertlink&#34;, &#34;insert-link&#34;, &#34;Insert _Link&#34;, None, None, self.on_insert_link),
1639
+ (&#34;inserttable&#34;, &#34;insert-table&#34;, &#34;Insert _Table&#34;, None, None, self.on_insert_table),
1640
+ (&#34;editmarker&#34;, &#34;edit-marker&#34;, &#34;edit _Marker&#34;, None, None, self.on_edit_marker),
1641
+
1642
+ (&#34;H1&#34;, Gtk.STOCK_EXECUTE, &#34;Header 1&#34;, None, &#34;Insert Header 1&#34;, self.on_header),
1643
+ (&#34;H2&#34;, Gtk.STOCK_EXECUTE, &#34;Header 2&#34;, None, &#34;Insert Header 2&#34;, self.on_header),
1644
+ (&#34;H3&#34;, Gtk.STOCK_EXECUTE, &#34;Header 3&#34;, None, &#34;Insert Header 3&#34;, self.on_header),
1645
+ (&#34;H4&#34;, Gtk.STOCK_EXECUTE, &#34;Header 4&#34;, None, &#34;Insert Header 4&#34;, self.on_header),
1646
+
1647
+ ]
1648
+
1649
+ actions.add_actions(accel_arr)
1650
+
1651
+ #print(dir(actions))
1652
+ for aa in accel_arr:
1653
+ # print(&#34;acc arr&#34;, dir(aa))
1654
+ # break
1655
+ # act = actions.get_action(aa[0])
1656
+ # print(&#34;act&#34;, act.get_name(), act.get_tooltip())
1657
+ pass
1658
+ # try:
1659
+ # act = Gtk.Action.new(aa[0], aa[2], aa[4], aa[1])
1660
+ # actions.add_action_with_accel(act, aa[3])
1661
+ # except:
1662
+ # #print(&#34;Exc on&#34;, aa)
1663
+ # pass
1664
+
1665
+ actions.get_action(&#34;insertimage&#34;).set_property(&#34;icon-name&#34;, &#34;insert-image&#34;)
1666
+ actions.get_action(&#34;insertlink&#34;).set_property(&#34;icon-name&#34;, &#34;insert-link&#34;)
1667
+ actions.get_action(&#34;inserttable&#34;).set_property(&#34;icon-name&#34;, &#34;appointment-new&#34;)
1668
+ actions.get_action(&#34;editmarker&#34;).set_property(&#34;icon-name&#34;, &#34;text-editor&#34;)
1669
+ actions.get_action(&#34;fontsize&#34;).set_property(&#34;icon-name&#34;, &#34;preferences-desktop-font&#34;)
1670
+ actions.get_action(&#34;removeformat&#34;).set_property(&#34;icon-name&#34;, &#34;text-direction&#34;)
1671
+
1672
+ ui = Gtk.UIManager()
1673
+ ui.insert_action_group(actions)
1674
+ ui.add_ui_from_string(ui_def)
1675
+
1676
+ # Fill in defaults
1677
+ xxx = ui.get_action_groups()[0].list_actions()
1678
+ for aa in xxx:
1679
+ nnn = aa.get_name()
1680
+ # Find the original, patth missing info
1681
+ for bb in accel_arr:
1682
+ # Convert tuple
1683
+ bbb = list(bb)
1684
+ if bb[0] == nnn:
1685
+ # Pad for this round
1686
+ for cc in range(5 - len(bbb)):
1687
+ bbb.append(&#34;&#34;)
1688
+
1689
+ #print(&#34;lab&#34;, bb[2], aa.get_label())
1690
+ #print(&#34;found&#34;, nnn, bbb[3])
1691
+
1692
+ setattr(aa, &#34;accel&#34;, bbb[3])
1693
+ if bbb[3]:
1694
+ try:
1695
+ nn, ss = Gtk.accelerator_parse(bbb[3])
1696
+ setattr(aa, &#34;accel_parsed&#34;, (nn, ss))
1697
+ except:
1698
+ pass
1699
+
1700
+ # Pad it with capitalize name if not there
1701
+ if not aa.get_tooltip():
1702
+ aa.set_tooltip(nnn[0].upper() + nnn[1:])
1703
+
1704
+ return ui</code></pre>
1705
+ </details>
1706
+ </dd>
1707
+ <dt id="pgwkit.pgwebw.get_html"><code class="name flex">
1708
+ <span>def <span class="ident">get_html</span></span>(<span>self, completion_function, user_data)</span>
1709
+ </code></dt>
1710
+ <dd>
1711
+ <div class="desc"></div>
1712
+ <details class="source">
1713
+ <summary>
1714
+ <span>Expand source code</span>
1715
+ </summary>
1716
+ <pre><code class="python">def get_html(self, completion_function, user_data):
1717
+
1718
+ #print(&#34;get_html&#34;)
1719
+ def javascript_completion(obj, result, user_data):
1720
+ #print(&#34;javascript_completion&#34;, result)
1721
+ fin = self.run_javascript_finish(result)
1722
+ #print(&#34;fin&#34;, fin)
1723
+ html = fin.get_js_value().to_string()
1724
+ #print(&#34;len html&#34;, len(html), &#34;\n&#34;)
1725
+ completion_function(html, user_data)
1726
+ self.run_javascript(&#34;document.documentElement.innerHTML;&#34;,
1727
+ None,
1728
+ javascript_completion,
1729
+ user_data)</code></pre>
1730
+ </details>
1731
+ </dd>
1732
+ <dt id="pgwkit.pgwebw.get_lastmod"><code class="name flex">
1733
+ <span>def <span class="ident">get_lastmod</span></span>(<span>self, completion_function, user_data)</span>
1734
+ </code></dt>
1735
+ <dd>
1736
+ <div class="desc"></div>
1737
+ <details class="source">
1738
+ <summary>
1739
+ <span>Expand source code</span>
1740
+ </summary>
1741
+ <pre><code class="python">def get_lastmod(self, completion_function, user_data):
1742
+
1743
+ print(&#34;get_lastmod&#34;)
1744
+ def javascript_completion(obj, result, user_data):
1745
+ print(&#34;javascript_completion&#34;, result)
1746
+ fin = self.run_javascript_finish(result)
1747
+ #print(&#34;fin&#34;, fin)
1748
+ html = fin.get_js_value().to_string()
1749
+ print(&#34;lastmod&#34;, html, &#34;\n&#34;)
1750
+ #completion_function(html, user_data)
1751
+ self.run_javascript(&#34;document.lastModified&#34;,
1752
+ None,
1753
+ javascript_completion,
1754
+ user_data)</code></pre>
1755
+ </details>
1756
+ </dd>
1757
+ <dt id="pgwkit.pgwebw.keypress"><code class="name flex">
1758
+ <span>def <span class="ident">keypress</span></span>(<span>self, arg, arg2)</span>
1759
+ </code></dt>
1760
+ <dd>
1761
+ <div class="desc"><p>Here we imitate the way the accelerator works</p></div>
1762
+ <details class="source">
1763
+ <summary>
1764
+ <span>Expand source code</span>
1765
+ </summary>
1766
+ <pre><code class="python">def keypress(self, arg, arg2):
1767
+
1768
+ &#39;&#39;&#39; Here we imitate the way the accelerator works &#39;&#39;&#39;
1769
+
1770
+ state = arg2.get_state() &amp; Gdk.ModifierType.MODIFIER_MASK
1771
+ key = arg2.get_keyval()[1]
1772
+ #print(&#34;key&#34;, key, &#34;state&#34;, state)
1773
+
1774
+ #GDK_MODIFIER_RESERVED_25_MASK
1775
+
1776
+ # Feeding off the accelarator&#39;s definitions
1777
+ ag = self.ui.get_action_groups()[0]
1778
+ acts = ag.list_actions()
1779
+
1780
+ # Scan - Fire
1781
+ for aa in acts:
1782
+ if aa.accel:
1783
+ #print(nnn, aa.accel, aa.accel_parsed)
1784
+ if state == aa.accel_parsed[1]:
1785
+ #print(&#34;state match&#34;)
1786
+ if key == aa.accel_parsed[0]:
1787
+ #print(&#34;Fire &#34;, aa.get_name(), aa.get_label())
1788
+ #lab = aa.get_label()
1789
+ aa.activate()
1790
+ break # Only one accel the other is a mistake
1791
+
1792
+ # See if nav key
1793
+ navkey = False
1794
+ for aa in navkeys:
1795
+ if key == aa:
1796
+ #print(&#34;Navkey&#34;, aa)
1797
+ navkey = True
1798
+ if not navkey:
1799
+ # Exclude Ctrl-s
1800
+ if state == Gdk.ModifierType.CONTROL_MASK and key == 115:
1801
+ #print(&#34;Control s&#34;)
1802
+ pass
1803
+ else:
1804
+ #print(&#34;set on key&#34;, key)
1805
+ self.modified = True</code></pre>
1806
+ </details>
1807
+ </dd>
1808
+ <dt id="pgwkit.pgwebw.on_action"><code class="name flex">
1809
+ <span>def <span class="ident">on_action</span></span>(<span>self, action)</span>
1810
+ </code></dt>
1811
+ <dd>
1812
+ <div class="desc"></div>
1813
+ <details class="source">
1814
+ <summary>
1815
+ <span>Expand source code</span>
1816
+ </summary>
1817
+ <pre><code class="python">def on_action(self, action):
1818
+ #print(&#34;on_action&#34;, action.get_name())
1819
+ # Make it caller neutral
1820
+ if type(action) == str:
1821
+ nnn = action
1822
+ else:
1823
+ nnn = action.get_name()
1824
+ self.run_javascript(&#34;document.execCommand(&#39;%s&#39;, false, false);&#34; % nnn)
1825
+ self.modified = True</code></pre>
1826
+ </details>
1827
+ </dd>
1828
+ <dt id="pgwkit.pgwebw.on_edit_marker"><code class="name flex">
1829
+ <span>def <span class="ident">on_edit_marker</span></span>(<span>self, action)</span>
1830
+ </code></dt>
1831
+ <dd>
1832
+ <div class="desc"></div>
1833
+ <details class="source">
1834
+ <summary>
1835
+ <span>Expand source code</span>
1836
+ </summary>
1837
+ <pre><code class="python">def on_edit_marker(self, action):
1838
+ print(&#34;on_edit_marker&#34;, action.get_name())
1839
+
1840
+ c = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
1841
+ sel = c.wait_for_targets()
1842
+ target = Gdk.Atom.intern (&#34;text/html&#34;, True);
1843
+ ccc = c.wait_for_contents(target)
1844
+ #print(&#34;sel&#34;, ccc.get_data())
1845
+ #ccc.free()
1846
+ htmlx = markdialog(ccc.get_data().decode())
1847
+ if htmlx:
1848
+ print(&#34;markdialog result:\n&#34;, htmlx)
1849
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)</code></pre>
1850
+ </details>
1851
+ </dd>
1852
+ <dt id="pgwkit.pgwebw.on_fontsize"><code class="name flex">
1853
+ <span>def <span class="ident">on_fontsize</span></span>(<span>self, action)</span>
1854
+ </code></dt>
1855
+ <dd>
1856
+ <div class="desc"></div>
1857
+ <details class="source">
1858
+ <summary>
1859
+ <span>Expand source code</span>
1860
+ </summary>
1861
+ <pre><code class="python">def on_fontsize(self, action):
1862
+ #print(&#34;on_fontsize&#34;)
1863
+ sizex = sizedialog()
1864
+ #print(&#34;sizex&#34;, sizex)
1865
+ if not sizex:
1866
+ return
1867
+
1868
+ c = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
1869
+ sel = c.wait_for_targets()
1870
+ #print(&#34;sel&#34;, sel)
1871
+ target = Gdk.Atom.intern (&#34;text/plain&#34;, True);
1872
+ ccc = c.wait_for_contents(target)
1873
+ if not ccc:
1874
+ htmlx = &#34;&lt;span style=\&#34;font-size: %dpx;\&#34;&gt;%s&lt;/span&gt;&#34; % (int(sizex), &#34;&#34;)
1875
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1876
+ return
1877
+
1878
+ ddd = ccc.get_data().decode()
1879
+ if not ddd:
1880
+ return
1881
+
1882
+ #print(&#34;ddd&#34;, ddd)
1883
+ htmlx = &#34;&lt;span style=\&#34;font-size: %dpx;\&#34;&gt;%s&lt;/span&gt;&#34; % (int(sizex), ddd)
1884
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1885
+ Gtk.Clipboard.clear(c)
1886
+ self.modified = True</code></pre>
1887
+ </details>
1888
+ </dd>
1889
+ <dt id="pgwkit.pgwebw.on_header"><code class="name flex">
1890
+ <span>def <span class="ident">on_header</span></span>(<span>self, action)</span>
1891
+ </code></dt>
1892
+ <dd>
1893
+ <div class="desc"></div>
1894
+ <details class="source">
1895
+ <summary>
1896
+ <span>Expand source code</span>
1897
+ </summary>
1898
+ <pre><code class="python">def on_header(self, action):
1899
+ #print(&#34;on_aheader&#34;, action.get_name())
1900
+ ddd = Gtk.Clipboard.get(Gdk.SELECTION_PRIMARY)
1901
+ ccc = None
1902
+ while True:
1903
+ #target = Gdk.Atom.intern (&#34;text/html&#34;, True);
1904
+ #ccc = ddd.wait_for_contents(target)
1905
+ #if ccc:
1906
+ # break
1907
+ target2 = Gdk.Atom.intern (&#34;text/plain&#34;, True);
1908
+ ccc = ddd.wait_for_contents(target2)
1909
+ if ccc:
1910
+ break
1911
+ break
1912
+
1913
+ if not ccc:
1914
+ return
1915
+
1916
+ dddd = ccc.get_data().decode()
1917
+ if not dddd:
1918
+ return
1919
+ #print(&#34;dddd&#34;, dddd)
1920
+ htmlx = &#34;&lt;%s&gt;%s&lt;/%s&gt;&#34; % (action.get_name(), dddd, action.get_name())
1921
+ self.run_javascript(&#34;document.execCommand \
1922
+ (&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1923
+ Gtk.Clipboard.clear(ddd)
1924
+ self.modified = True</code></pre>
1925
+ </details>
1926
+ </dd>
1927
+ <dt id="pgwkit.pgwebw.on_insert_image"><code class="name flex">
1928
+ <span>def <span class="ident">on_insert_image</span></span>(<span>self, action)</span>
1929
+ </code></dt>
1930
+ <dd>
1931
+ <div class="desc"></div>
1932
+ <details class="source">
1933
+ <summary>
1934
+ <span>Expand source code</span>
1935
+ </summary>
1936
+ <pre><code class="python">def on_insert_image(self, action):
1937
+ dialog = Gtk.FileChooserDialog(&#34;Select an image file&#34;, None, Gtk.FileChooserAction.OPEN,
1938
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
1939
+
1940
+ if dialog.run() == Gtk.ResponseType.OK:
1941
+ fn = dialog.get_filename()
1942
+ if os.path.exists(fn):
1943
+ self.run_javascript(
1944
+ &#34;document.execCommand(&#39;insertImage&#39;, null, &#39;%s&#39;);&#34; % fn)
1945
+ dialog.destroy()
1946
+ self.modified = True</code></pre>
1947
+ </details>
1948
+ </dd>
1949
+ <dt id="pgwkit.pgwebw.on_insert_link"><code class="name flex">
1950
+ <span>def <span class="ident">on_insert_link</span></span>(<span>self, action)</span>
1951
+ </code></dt>
1952
+ <dd>
1953
+ <div class="desc"></div>
1954
+ <details class="source">
1955
+ <summary>
1956
+ <span>Expand source code</span>
1957
+ </summary>
1958
+ <pre><code class="python">def on_insert_link(self, action):
1959
+ dialog = Gtk.Dialog(&#34; Enter a URL: &#34;, None, 0,
1960
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK))
1961
+
1962
+ entry = Gtk.Entry()
1963
+ dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1964
+ hbox = Gtk.HBox()
1965
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1966
+ hbox.pack_start(entry, False, False, 0)
1967
+ hbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1968
+ dialog.vbox.pack_start(hbox, False, False, 0)
1969
+
1970
+ dialog.vbox.pack_start(Gtk.Label(&#34; &#34;), False, False, 0)
1971
+ dialog.show_all()
1972
+
1973
+ if dialog.run() == Gtk.ResponseType.OK:
1974
+ self.run_javascript(
1975
+ &#34;document.execCommand(&#39;createLink&#39;, True, &#39;%s&#39;);&#34; % entry.get_text())
1976
+ dialog.destroy()
1977
+ self.modified = True</code></pre>
1978
+ </details>
1979
+ </dd>
1980
+ <dt id="pgwkit.pgwebw.on_insert_table"><code class="name flex">
1981
+ <span>def <span class="ident">on_insert_table</span></span>(<span>self, action)</span>
1982
+ </code></dt>
1983
+ <dd>
1984
+ <div class="desc"></div>
1985
+ <details class="source">
1986
+ <summary>
1987
+ <span>Expand source code</span>
1988
+ </summary>
1989
+ <pre><code class="python">def on_insert_table(self, action):
1990
+ htmlx = &#34;&lt;table align=center border=0 contentEditable=true&gt;&#34; + \
1991
+ &#34;&lt;tr&gt;&lt;td&gt;TR1 C1 &lt;td&gt;| TR1 C2 &lt;tr&gt;&lt;td&gt;TR2 C1&lt;td&gt;| TR2 C1&lt;/table&gt;&lt;br&gt;&#34;
1992
+
1993
+ #print(&#34;table&#34;, htmlx)
1994
+ self.run_javascript(&#34;document.execCommand(&#39;insertHTML&#39;, null, &#39;%s&#39;);&#34; % htmlx)
1995
+ self.modified = True</code></pre>
1996
+ </details>
1997
+ </dd>
1998
+ <dt id="pgwkit.pgwebw.on_new"><code class="name flex">
1999
+ <span>def <span class="ident">on_new</span></span>(<span>self, action)</span>
2000
+ </code></dt>
2001
+ <dd>
2002
+ <div class="desc"></div>
2003
+ <details class="source">
2004
+ <summary>
2005
+ <span>Expand source code</span>
2006
+ </summary>
2007
+ <pre><code class="python">def on_new(self, action):
2008
+ self.load_html(&#34;&#34;, &#34;file:///&#34;)
2009
+ self.modified = False</code></pre>
2010
+ </details>
2011
+ </dd>
2012
+ <dt id="pgwkit.pgwebw.on_open"><code class="name flex">
2013
+ <span>def <span class="ident">on_open</span></span>(<span>self, action)</span>
2014
+ </code></dt>
2015
+ <dd>
2016
+ <div class="desc"></div>
2017
+ <details class="source">
2018
+ <summary>
2019
+ <span>Expand source code</span>
2020
+ </summary>
2021
+ <pre><code class="python">def on_open(self, action):
2022
+ dialog = Gtk.FileChooserDialog(&#34;Select an HTML file&#34;, self, Gtk.FileChooserAction.OPEN,
2023
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
2024
+
2025
+ if dialog.run() == Gtk.ResponseType.OK:
2026
+ fn = dialog.get_filename()
2027
+ if os.path.exists(fn):
2028
+ self.fname = fn
2029
+ with open(fn) as fd:
2030
+ self.load_html(fd.read(), &#34;file:///&#34;)
2031
+ dialog.destroy()</code></pre>
2032
+ </details>
2033
+ </dd>
2034
+ <dt id="pgwkit.pgwebw.on_paste"><code class="name flex">
2035
+ <span>def <span class="ident">on_paste</span></span>(<span>self, action='')</span>
2036
+ </code></dt>
2037
+ <dd>
2038
+ <div class="desc"></div>
2039
+ <details class="source">
2040
+ <summary>
2041
+ <span>Expand source code</span>
2042
+ </summary>
2043
+ <pre><code class="python">def on_paste(self, action = &#34;&#34;):
2044
+ print(&#34;Paste&#34;)
2045
+ self.execute_editing_command(WebKit2.EDITING_COMMAND_PASTE)</code></pre>
2046
+ </details>
2047
+ </dd>
2048
+ <dt id="pgwkit.pgwebw.on_save"><code class="name flex">
2049
+ <span>def <span class="ident">on_save</span></span>(<span>self, action)</span>
2050
+ </code></dt>
2051
+ <dd>
2052
+ <div class="desc"></div>
2053
+ <details class="source">
2054
+ <summary>
2055
+ <span>Expand source code</span>
2056
+ </summary>
2057
+ <pre><code class="python">def on_save(self, action):
2058
+ def completion(html, user_data):
2059
+ open_mode = user_data
2060
+ with open(self.fname, open_mode) as fd:
2061
+ fd.write(html)
2062
+
2063
+ if self.fname:
2064
+ self.get_html(completion, &#39;w&#39;)
2065
+ else:
2066
+ dialog = Gtk.FileChooserDialog(&#34;Select an HTML file&#34;, None,
2067
+ Gtk.FileChooserAction.SAVE,
2068
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
2069
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
2070
+
2071
+ if dialog.run() == Gtk.ResponseType.OK:
2072
+ self.fname = dialog.get_filename()
2073
+ print(&#34;Saving&#34;, self.fname)
2074
+ self.get_html(completion, &#34;w+&#34;)
2075
+ dialog.destroy()</code></pre>
2076
+ </details>
2077
+ </dd>
2078
+ <dt id="pgwkit.pgwebw.on_select_bgcolor"><code class="name flex">
2079
+ <span>def <span class="ident">on_select_bgcolor</span></span>(<span>self, action)</span>
2080
+ </code></dt>
2081
+ <dd>
2082
+ <div class="desc"></div>
2083
+ <details class="source">
2084
+ <summary>
2085
+ <span>Expand source code</span>
2086
+ </summary>
2087
+ <pre><code class="python">def on_select_bgcolor(self, action):
2088
+ dialog = Gtk.ColorChooserDialog(&#34;Select Background Color&#34;)
2089
+ if dialog.run() == Gtk.ResponseType.OK:
2090
+ (r, g, b, a) = dialog.get_rgba()
2091
+ color = &#34;#%0.2x%0.2x%0.2x%0.2x&#34; % (
2092
+ int(r * 255),
2093
+ int(g * 255),
2094
+ int(b * 255),
2095
+ int(a * 255))
2096
+ self.run_javascript(&#34;document.execCommand(&#39;backcolor&#39;, null, &#39;%s&#39;);&#34; % color)
2097
+ dialog.destroy()</code></pre>
2098
+ </details>
2099
+ </dd>
2100
+ <dt id="pgwkit.pgwebw.on_select_color"><code class="name flex">
2101
+ <span>def <span class="ident">on_select_color</span></span>(<span>self, action)</span>
2102
+ </code></dt>
2103
+ <dd>
2104
+ <div class="desc"></div>
2105
+ <details class="source">
2106
+ <summary>
2107
+ <span>Expand source code</span>
2108
+ </summary>
2109
+ <pre><code class="python">def on_select_color(self, action):
2110
+ dialog = Gtk.ColorChooserDialog(&#34;Select Color&#34;)
2111
+ if dialog.run() == Gtk.ResponseType.OK:
2112
+ (r, g, b, a) = dialog.get_rgba()
2113
+ color = &#34;#%0.2x%0.2x%0.2x%0.2x&#34; % (
2114
+ int(r * 255),
2115
+ int(g * 255),
2116
+ int(b * 255),
2117
+ int(a * 255))
2118
+ self.run_javascript(&#34;document.execCommand(&#39;forecolor&#39;, null, &#39;%s&#39;);&#34; % color)
2119
+ dialog.destroy()</code></pre>
2120
+ </details>
2121
+ </dd>
2122
+ <dt id="pgwkit.pgwebw.on_select_font"><code class="name flex">
2123
+ <span>def <span class="ident">on_select_font</span></span>(<span>self, action)</span>
2124
+ </code></dt>
2125
+ <dd>
2126
+ <div class="desc"></div>
2127
+ <details class="source">
2128
+ <summary>
2129
+ <span>Expand source code</span>
2130
+ </summary>
2131
+ <pre><code class="python">def on_select_font(self, action):
2132
+ dialog = Gtk.FontChooserDialog(&#34;Select a font&#34;)
2133
+ if dialog.run() == Gtk.ResponseType.OK:
2134
+ fname = dialog.get_font_desc().get_family()
2135
+ fsize = dialog.get_font_desc().get_size() / Pango.SCALE
2136
+ ttt = int(1 + round(fsize / 10)) % 9
2137
+ print(&#34;Setting font&#34;, fname, fsize, ttt)
2138
+ self.run_javascript(&#34;document.execCommand(&#39;fontname&#39;, null, &#39;%s&#39;);&#34; % fname)
2139
+ self.run_javascript(&#34;document.execCommand(&#39;fontsize&#39;, null, &#39;%s&#39;);&#34; % ttt)
2140
+ dialog.destroy()</code></pre>
2141
+ </details>
2142
+ </dd>
2143
+ </dl>
2144
+ </dd>
2145
+ <dt id="pgwkit.pgwebw_fake"><code class="flex name class">
2146
+ <span>class <span class="ident">pgwebw_fake</span></span>
2147
+ </code></dt>
2148
+ <dd>
2149
+ <div class="desc"><p>:Constructors:</p>
2150
+ <p>::</p>
2151
+ <pre><code>VBox(**properties)
2152
+ new(homogeneous:bool, spacing:int) -&gt; Gtk.Widget
2153
+ </code></pre>
2154
+ <p>Initializer for a GObject based classes with support for property
2155
+ sets through the use of explicit keyword arguments.</p></div>
2156
+ <details class="source">
2157
+ <summary>
2158
+ <span>Expand source code</span>
2159
+ </summary>
2160
+ <pre><code class="python">class pgwebw_fake(Gtk.VBox):
2161
+
2162
+ def __init__(self):
2163
+ super(pgwebw_fake, self).__init__();
2164
+ pass
2165
+
2166
+ def load_uri(self, url):
2167
+ pass</code></pre>
2168
+ </details>
2169
+ <h3>Ancestors</h3>
2170
+ <ul class="hlist">
2171
+ <li>gi.repository.Gtk.VBox</li>
2172
+ <li>gi.overrides.Gtk.Box</li>
2173
+ <li>gi.repository.Gtk.Box</li>
2174
+ <li>gi.overrides.Gtk.Container</li>
2175
+ <li>gi.repository.Gtk.Container</li>
2176
+ <li>gi.overrides.Gtk.Widget</li>
2177
+ <li>gi.repository.Gtk.Widget</li>
2178
+ <li>gi.repository.GObject.InitiallyUnowned</li>
2179
+ <li>gi.overrides.GObject.Object</li>
2180
+ <li>gi.repository.GObject.Object</li>
2181
+ <li>gi._gi.GObject</li>
2182
+ <li>gi.repository.Atk.ImplementorIface</li>
2183
+ <li>gi.repository.Gtk.Buildable</li>
2184
+ <li>gi.repository.Gtk.Orientable</li>
2185
+ <li>gobject.GInterface</li>
2186
+ </ul>
2187
+ <h3>Methods</h3>
2188
+ <dl>
2189
+ <dt id="pgwkit.pgwebw_fake.load_uri"><code class="name flex">
2190
+ <span>def <span class="ident">load_uri</span></span>(<span>self, url)</span>
2191
+ </code></dt>
2192
+ <dd>
2193
+ <div class="desc"></div>
2194
+ <details class="source">
2195
+ <summary>
2196
+ <span>Expand source code</span>
2197
+ </summary>
2198
+ <pre><code class="python">def load_uri(self, url):
2199
+ pass</code></pre>
2200
+ </details>
2201
+ </dd>
2202
+ </dl>
2203
+ </dd>
2204
+ </dl>
2205
+ </section>
2206
+ </article>
2207
+ <nav id="sidebar">
2208
+ <h1>Index</h1>
2209
+ <div class="toc">
2210
+ <ul></ul>
2211
+ </div>
2212
+ <ul id="index">
2213
+ <li><h3><a href="#header-functions">Functions</a></h3>
2214
+ <ul class="">
2215
+ <li><code><a title="pgwkit.markdialog" href="#pgwkit.markdialog">markdialog</a></code></li>
2216
+ <li><code><a title="pgwkit.sizedialog" href="#pgwkit.sizedialog">sizedialog</a></code></li>
2217
+ <li><code><a title="pgwkit.treecallb" href="#pgwkit.treecallb">treecallb</a></code></li>
2218
+ </ul>
2219
+ </li>
2220
+ <li><h3><a href="#header-classes">Classes</a></h3>
2221
+ <ul>
2222
+ <li>
2223
+ <h4><code><a title="pgwkit.dummywebkit" href="#pgwkit.dummywebkit">dummywebkit</a></code></h4>
2224
+ <ul class="">
2225
+ <li><code><a title="pgwkit.dummywebkit.WebView" href="#pgwkit.dummywebkit.WebView">WebView</a></code></li>
2226
+ </ul>
2227
+ </li>
2228
+ <li>
2229
+ <h4><code><a title="pgwkit.dummywebview" href="#pgwkit.dummywebview">dummywebview</a></code></h4>
2230
+ <ul class="">
2231
+ <li><code><a title="pgwkit.dummywebview.connect" href="#pgwkit.dummywebview.connect">connect</a></code></li>
2232
+ <li><code><a title="pgwkit.dummywebview.load_html" href="#pgwkit.dummywebview.load_html">load_html</a></code></li>
2233
+ <li><code><a title="pgwkit.dummywebview.set_editable" href="#pgwkit.dummywebview.set_editable">set_editable</a></code></li>
2234
+ </ul>
2235
+ </li>
2236
+ <li>
2237
+ <h4><code><a title="pgwkit.pgwebw" href="#pgwkit.pgwebw">pgwebw</a></code></h4>
2238
+ <ul class="two-column">
2239
+ <li><code><a title="pgwkit.pgwebw.do_load_changed" href="#pgwkit.pgwebw.do_load_changed">do_load_changed</a></code></li>
2240
+ <li><code><a title="pgwkit.pgwebw.do_load_failed" href="#pgwkit.pgwebw.do_load_failed">do_load_failed</a></code></li>
2241
+ <li><code><a title="pgwkit.pgwebw.do_ready_to_show" href="#pgwkit.pgwebw.do_ready_to_show">do_ready_to_show</a></code></li>
2242
+ <li><code><a title="pgwkit.pgwebw.generate_ui" href="#pgwkit.pgwebw.generate_ui">generate_ui</a></code></li>
2243
+ <li><code><a title="pgwkit.pgwebw.get_html" href="#pgwkit.pgwebw.get_html">get_html</a></code></li>
2244
+ <li><code><a title="pgwkit.pgwebw.get_lastmod" href="#pgwkit.pgwebw.get_lastmod">get_lastmod</a></code></li>
2245
+ <li><code><a title="pgwkit.pgwebw.keypress" href="#pgwkit.pgwebw.keypress">keypress</a></code></li>
2246
+ <li><code><a title="pgwkit.pgwebw.on_action" href="#pgwkit.pgwebw.on_action">on_action</a></code></li>
2247
+ <li><code><a title="pgwkit.pgwebw.on_edit_marker" href="#pgwkit.pgwebw.on_edit_marker">on_edit_marker</a></code></li>
2248
+ <li><code><a title="pgwkit.pgwebw.on_fontsize" href="#pgwkit.pgwebw.on_fontsize">on_fontsize</a></code></li>
2249
+ <li><code><a title="pgwkit.pgwebw.on_header" href="#pgwkit.pgwebw.on_header">on_header</a></code></li>
2250
+ <li><code><a title="pgwkit.pgwebw.on_insert_image" href="#pgwkit.pgwebw.on_insert_image">on_insert_image</a></code></li>
2251
+ <li><code><a title="pgwkit.pgwebw.on_insert_link" href="#pgwkit.pgwebw.on_insert_link">on_insert_link</a></code></li>
2252
+ <li><code><a title="pgwkit.pgwebw.on_insert_table" href="#pgwkit.pgwebw.on_insert_table">on_insert_table</a></code></li>
2253
+ <li><code><a title="pgwkit.pgwebw.on_new" href="#pgwkit.pgwebw.on_new">on_new</a></code></li>
2254
+ <li><code><a title="pgwkit.pgwebw.on_open" href="#pgwkit.pgwebw.on_open">on_open</a></code></li>
2255
+ <li><code><a title="pgwkit.pgwebw.on_paste" href="#pgwkit.pgwebw.on_paste">on_paste</a></code></li>
2256
+ <li><code><a title="pgwkit.pgwebw.on_save" href="#pgwkit.pgwebw.on_save">on_save</a></code></li>
2257
+ <li><code><a title="pgwkit.pgwebw.on_select_bgcolor" href="#pgwkit.pgwebw.on_select_bgcolor">on_select_bgcolor</a></code></li>
2258
+ <li><code><a title="pgwkit.pgwebw.on_select_color" href="#pgwkit.pgwebw.on_select_color">on_select_color</a></code></li>
2259
+ <li><code><a title="pgwkit.pgwebw.on_select_font" href="#pgwkit.pgwebw.on_select_font">on_select_font</a></code></li>
2260
+ </ul>
2261
+ </li>
2262
+ <li>
2263
+ <h4><code><a title="pgwkit.pgwebw_fake" href="#pgwkit.pgwebw_fake">pgwebw_fake</a></code></h4>
2264
+ <ul class="">
2265
+ <li><code><a title="pgwkit.pgwebw_fake.load_uri" href="#pgwkit.pgwebw_fake.load_uri">load_uri</a></code></li>
2266
+ </ul>
2267
+ </li>
2268
+ </ul>
2269
+ </li>
2270
+ </ul>
2271
+ </nav>
2272
+ </main>
2273
+ <footer id="footer">
2274
+ <p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
2275
+ </footer>
2276
+ </body>
2277
+ </html>