pyvguicom 1.0.1__py3-none-any.whl → 1.1.2__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.
- pyvguicom/browsewin.py +10 -11
- pyvguicom/docs/__index__.py +0 -0
- pyvguicom/docs/browsewin.html +956 -0
- pyvguicom/docs/htmledit.html +903 -0
- pyvguicom/docs/pgbox.html +2470 -0
- pyvguicom/docs/pgbutt.html +727 -0
- pyvguicom/docs/pgentry.html +1024 -0
- pyvguicom/docs/pggui.html +5476 -0
- pyvguicom/docs/pgsel.html +1539 -0
- pyvguicom/docs/pgsimp.html +1048 -0
- pyvguicom/docs/pgtextview.html +2421 -0
- pyvguicom/docs/pgutils.html +2664 -0
- pyvguicom/docs/pgwkit.html +2277 -0
- pyvguicom/docs/sutil.html +907 -0
- pyvguicom/pgentry.py +75 -9
- pyvguicom/pggui.py +191 -92
- pyvguicom/pgsel.py +9 -7
- pyvguicom/pgtests.py +128 -0
- pyvguicom/pgutils.py +42 -394
- pyvguicom/pgwkit.py +36 -27
- pyvguicom/testbutt.py +1 -1
- pyvguicom/testcust.py +1 -1
- pyvguicom/testentry.py +19 -7
- pyvguicom/testgui.py +125 -0
- pyvguicom/testlettsel.py +1 -1
- pyvguicom/testmsgs.py +142 -0
- pyvguicom/testnums.py +1 -1
- pyvguicom/testsimple.py +4 -3
- pyvguicom/testtests.py +79 -0
- pyvguicom/testtextv.py +2 -2
- pyvguicom/testutils.py +139 -0
- {pyvguicom-1.0.1.dist-info → pyvguicom-1.1.2.dist-info}/METADATA +8 -11
- pyvguicom-1.1.2.dist-info/RECORD +45 -0
- pyvguicom-1.0.1.dist-info/RECORD +0 -27
- {pyvguicom-1.0.1.dist-info → pyvguicom-1.1.2.dist-info}/WHEEL +0 -0
- {pyvguicom-1.0.1.dist-info → pyvguicom-1.1.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,2421 @@
|
|
|
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>pgtextview API documentation</title>
|
|
8
|
+
<meta name="description" content="" />
|
|
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>pgtextview</code></h1>
|
|
23
|
+
</header>
|
|
24
|
+
<section id="section-intro">
|
|
25
|
+
<details class="source">
|
|
26
|
+
<summary>
|
|
27
|
+
<span>Expand source code</span>
|
|
28
|
+
</summary>
|
|
29
|
+
<pre><code class="python">#!/usr/bin/env python
|
|
30
|
+
|
|
31
|
+
import os, sys, getopt, signal, random, time, warnings
|
|
32
|
+
|
|
33
|
+
#from pgutil import *
|
|
34
|
+
#from pgui import *
|
|
35
|
+
|
|
36
|
+
import pgutils
|
|
37
|
+
|
|
38
|
+
import gi
|
|
39
|
+
gi.require_version("Gtk", "3.0")
|
|
40
|
+
from gi.repository import Gtk
|
|
41
|
+
from gi.repository import Gdk
|
|
42
|
+
from gi.repository import GLib
|
|
43
|
+
from gi.repository import GObject
|
|
44
|
+
from gi.repository import Pango
|
|
45
|
+
|
|
46
|
+
import pgbox
|
|
47
|
+
|
|
48
|
+
# Colors for editor selection. Use X11 color names.
|
|
49
|
+
|
|
50
|
+
font_colors = \
|
|
51
|
+
(
|
|
52
|
+
# Color name; RGBA for display
|
|
53
|
+
("Black", "#000000ff"), ("White", "#ffffffff"),
|
|
54
|
+
("Red", "#ff0000ff"), ("Green", "#00ff00ff"),
|
|
55
|
+
("Blue", "#0000ffff"), ("Orange", "#ff8800ff"),
|
|
56
|
+
("Yellow", "#ffff00ff"), ("Brown", "#885500ff"),
|
|
57
|
+
("Cyan" , "#00ffffff"), ("Purple", "#ff00ffff"),
|
|
58
|
+
("OrangeRed", "#ff8888ff"), ("LightBlue", "#8888ffff"),
|
|
59
|
+
("LightGreen", "#88ff88ff"), ("Gray", "#888888ff"),
|
|
60
|
+
("LightGray", "#aaaaaaff"), ("Gold", "#FFD700FF"),
|
|
61
|
+
("LightYellow", "#aaaaaa99ff"), ("Gold", "#FFD700FF"),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
font_sizes = \
|
|
65
|
+
(
|
|
66
|
+
"7", "8", "9", "10", "12", "14", "18", "22", "24", "32", "36", "48", "64"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class pgTextView(Gtk.VBox):
|
|
71
|
+
|
|
72
|
+
def __init__(self, status = False):
|
|
73
|
+
|
|
74
|
+
self.statstr = None
|
|
75
|
+
Gtk.VBox.__init__(self)
|
|
76
|
+
|
|
77
|
+
self.tagtablex = []
|
|
78
|
+
self.callb = None
|
|
79
|
+
self.grid = Gtk.Grid()
|
|
80
|
+
self.add(self.grid)
|
|
81
|
+
|
|
82
|
+
self._create_textview()
|
|
83
|
+
self._create_toolbar()
|
|
84
|
+
self._create_toolbar2()
|
|
85
|
+
self._create_buttons()
|
|
86
|
+
|
|
87
|
+
# Status bar
|
|
88
|
+
self.statstr = Gtk.Label.new("Idle")
|
|
89
|
+
self.statstr.set_halign(Gtk.Align.START)
|
|
90
|
+
|
|
91
|
+
if status:
|
|
92
|
+
hstat = Gtk.HBox()
|
|
93
|
+
hstat.pack_start(Gtk.Label.new(" Status: "), 0, 0, 0)
|
|
94
|
+
hstat.pack_start(Gtk.Label.new(" "), 0, 0, 0)
|
|
95
|
+
hstat.pack_start(self.statstr, 1, 1, 0)
|
|
96
|
+
|
|
97
|
+
self.grid.attach(hstat, 0, 4, 3, 1)
|
|
98
|
+
|
|
99
|
+
self.textview.connect("key-press-event", self.area_key)
|
|
100
|
+
self.textview.connect("move-cursor", self.area_curs)
|
|
101
|
+
self.connect("button-press-event", self.area_button)
|
|
102
|
+
#self.textview.connect("focus-out-event", self.focus_out)
|
|
103
|
+
self.findcall = None;
|
|
104
|
+
|
|
105
|
+
def area_curs(self, ext_view, step, count, extend_selection):
|
|
106
|
+
#print("step", step, "count", count)
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
def _create_toolbar(self):
|
|
110
|
+
|
|
111
|
+
nnn = 0
|
|
112
|
+
toolbar = Gtk.Toolbar()
|
|
113
|
+
self.grid.attach(toolbar, 0, 1, 3, 1)
|
|
114
|
+
|
|
115
|
+
button_norm = Gtk.ToolButton()
|
|
116
|
+
button_norm.set_icon_name("format-text-none-symbolic")
|
|
117
|
+
button_norm.set_tooltip_text("Remove ALL Formatting")
|
|
118
|
+
toolbar.insert(button_norm, nnn) ; nnn += 1
|
|
119
|
+
|
|
120
|
+
button_bold = Gtk.ToolButton()
|
|
121
|
+
button_bold.set_icon_name("format-text-bold-symbolic")
|
|
122
|
+
button_bold.set_tooltip_text("Set Bold")
|
|
123
|
+
toolbar.insert(button_bold, nnn) ; nnn += 1
|
|
124
|
+
|
|
125
|
+
button_italic = Gtk.ToolButton()
|
|
126
|
+
button_italic.set_icon_name("format-text-italic-symbolic")
|
|
127
|
+
button_italic.set_tooltip_text("Set Italic")
|
|
128
|
+
toolbar.insert(button_italic, nnn) ; nnn += 1
|
|
129
|
+
|
|
130
|
+
button_underline = Gtk.ToolButton()
|
|
131
|
+
button_underline.set_icon_name("format-text-underline-symbolic")
|
|
132
|
+
button_underline.set_tooltip_text("Set Underline")
|
|
133
|
+
toolbar.insert(button_underline, nnn) ; nnn += 1
|
|
134
|
+
|
|
135
|
+
button_sel = Gtk.ToolItem()
|
|
136
|
+
|
|
137
|
+
combo = pgbox.ComboBox(font_sizes, self.combo_sel)
|
|
138
|
+
#combo.sel_text("12")
|
|
139
|
+
#print("str(self.mysize)", str(self.mysize))
|
|
140
|
+
combo.sel_text(str(int(self.mysize)))
|
|
141
|
+
combo.set_tooltip_text("Set Font Size")
|
|
142
|
+
|
|
143
|
+
#hb = Gtk.HBox()
|
|
144
|
+
#hb.pack_start(Gtk.Label.new("Font Size:"), 0, 0, 2)
|
|
145
|
+
#hb.pack_start(combo, 0, 0, 0)
|
|
146
|
+
button_sel.add(combo)
|
|
147
|
+
toolbar.insert(button_sel, nnn) ; nnn += 1
|
|
148
|
+
|
|
149
|
+
button_sel2 = Gtk.ToolItem()
|
|
150
|
+
|
|
151
|
+
#print("mmm", mmm)
|
|
152
|
+
#hb2 = Gtk.HBox()
|
|
153
|
+
combo2 = pgbox.ColorCombo(font_colors, self.combo_sel2)
|
|
154
|
+
combo2.sel_text("Black")
|
|
155
|
+
combo2.set_tooltip_text("Set Font Color")
|
|
156
|
+
|
|
157
|
+
#hb2.pack_start(Gtk.Label.new("Font Color:"), 0, 0, 2)
|
|
158
|
+
#hb2.pack_start(combo2, 0, 0, 0)
|
|
159
|
+
button_sel2.add(combo2)
|
|
160
|
+
toolbar.insert(button_sel2, nnn) ; nnn += 1
|
|
161
|
+
|
|
162
|
+
# ----------------------------------------------------------------
|
|
163
|
+
|
|
164
|
+
button_sel3 = Gtk.ToolItem()
|
|
165
|
+
#hb3 = Gtk.HBox()
|
|
166
|
+
combo3 = pgbox.ColorCombo(font_colors, self.combo_sel3)
|
|
167
|
+
combo3.sel_text("White")
|
|
168
|
+
combo3.set_tooltip_text("Set Background Color")
|
|
169
|
+
#hb3.pack_start(Gtk.Label.new("Font Back:"), 0, 0, 2)
|
|
170
|
+
#hb3.pack_start(combo3, 0, 0, 0)
|
|
171
|
+
button_sel3.add(combo3)
|
|
172
|
+
toolbar.insert(button_sel3, nnn) ; nnn += 1
|
|
173
|
+
|
|
174
|
+
button_color = Gtk.ToolButton()
|
|
175
|
+
button_color.set_icon_name("preferences-desktop-theme")
|
|
176
|
+
button_color.set_tooltip_text("Remove Color Attributes")
|
|
177
|
+
button_color.connect("clicked", self.on_rm_color)
|
|
178
|
+
toolbar.insert(button_color, nnn) ; nnn += 1
|
|
179
|
+
|
|
180
|
+
button_norm.connect("clicked", self.on_rm_clicked, self.tag_norm)
|
|
181
|
+
button_bold.connect("clicked", self.on_button_clicked, self.tag_bold)
|
|
182
|
+
button_italic.connect("clicked", self.on_button_clicked, self.tag_italic)
|
|
183
|
+
button_underline.connect("clicked", self.on_button_clicked, self.tag_underline)
|
|
184
|
+
|
|
185
|
+
#toolbar.insert(Gtk.SeparatorToolItem(), nnn) ; nnn += 1
|
|
186
|
+
|
|
187
|
+
def _create_toolbar2(self):
|
|
188
|
+
|
|
189
|
+
nnn = 0
|
|
190
|
+
toolbar = Gtk.Toolbar()
|
|
191
|
+
self.grid.attach(toolbar, 0, 0, 3, 1)
|
|
192
|
+
|
|
193
|
+
radio_justifyleft = Gtk.RadioToolButton()
|
|
194
|
+
radio_justifyleft.set_icon_name("format-justify-left-symbolic")
|
|
195
|
+
toolbar.insert(radio_justifyleft, nnn) ; nnn += 1
|
|
196
|
+
|
|
197
|
+
radio_justifycenter = Gtk.RadioToolButton.new_from_widget(radio_justifyleft)
|
|
198
|
+
radio_justifycenter.set_icon_name("format-justify-center-symbolic")
|
|
199
|
+
toolbar.insert(radio_justifycenter, nnn) ; nnn += 1
|
|
200
|
+
|
|
201
|
+
radio_justifyright = Gtk.RadioToolButton.new_from_widget(radio_justifyleft)
|
|
202
|
+
radio_justifyright.set_icon_name("format-justify-right-symbolic")
|
|
203
|
+
toolbar.insert(radio_justifyright, nnn) ; nnn += 1
|
|
204
|
+
|
|
205
|
+
radio_justifyfill = Gtk.RadioToolButton.new_from_widget(radio_justifyleft)
|
|
206
|
+
radio_justifyfill.set_icon_name("format-justify-fill-symbolic")
|
|
207
|
+
toolbar.insert(radio_justifyfill, nnn) ; nnn += 1
|
|
208
|
+
|
|
209
|
+
radio_justifyleft.connect(
|
|
210
|
+
#"toggled", self.on_justify_toggled, Gtk.Justification.LEFT
|
|
211
|
+
"toggled", self.on_justify_toggled, self.tag_left
|
|
212
|
+
)
|
|
213
|
+
radio_justifycenter.connect(
|
|
214
|
+
#"toggled", self.on_justify_toggled, Gtk.Justification.CENTER
|
|
215
|
+
"toggled", self.on_justify_toggled, self.tag_center
|
|
216
|
+
)
|
|
217
|
+
radio_justifyright.connect(
|
|
218
|
+
"toggled", self.on_justify_toggled, self.tag_right
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
radio_justifyfill.connect(
|
|
222
|
+
"toggled", self.on_justify_toggled, self.tag_fill
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
button_big = Gtk.ToolButton()
|
|
226
|
+
button_big.set_icon_name("format-text-larger-symbolic")
|
|
227
|
+
button_big.set_tooltip_text("Set Superscript")
|
|
228
|
+
button_big.connect("clicked", self.on_super_button, self.tag_super)
|
|
229
|
+
toolbar.insert(button_big, nnn) ; nnn += 1
|
|
230
|
+
|
|
231
|
+
button_big = Gtk.ToolButton()
|
|
232
|
+
button_big.set_icon_name("format-text-smaller-symbolic")
|
|
233
|
+
button_big.set_tooltip_text("Set Subscript")
|
|
234
|
+
button_big.connect("clicked", self.on_super_button, self.tag_sub)
|
|
235
|
+
toolbar.insert(button_big, nnn) ; nnn += 1
|
|
236
|
+
|
|
237
|
+
button_big = Gtk.ToolButton()
|
|
238
|
+
button_big.set_icon_name("tools-check-spelling")
|
|
239
|
+
button_big.set_tooltip_text("Set XX Large font")
|
|
240
|
+
button_big.connect("clicked", self.on_button_clicked, self.tag_xbig)
|
|
241
|
+
toolbar.insert(button_big, nnn) ; nnn += 1
|
|
242
|
+
|
|
243
|
+
button_color = Gtk.ToolButton()
|
|
244
|
+
button_color.set_icon_name("font-x-generic")
|
|
245
|
+
button_color.set_tooltip_text("Set Font")
|
|
246
|
+
#button_color.connect("clicked", self.on_color_clicked, 0)
|
|
247
|
+
toolbar.insert(button_color, nnn) ; nnn += 1
|
|
248
|
+
|
|
249
|
+
toolbar.insert(Gtk.SeparatorToolItem(), nnn) ; nnn += 1
|
|
250
|
+
|
|
251
|
+
button_clear = Gtk.ToolButton()
|
|
252
|
+
button_clear.set_icon_name("edit-clear-symbolic")
|
|
253
|
+
button_clear.set_tooltip_text("Remove ALL formatting")
|
|
254
|
+
button_clear.connect("clicked", self.on_clear_clicked)
|
|
255
|
+
toolbar.insert(button_clear, nnn) ; nnn += 1
|
|
256
|
+
|
|
257
|
+
toolbar.insert(Gtk.SeparatorToolItem(), nnn) ; nnn += 1
|
|
258
|
+
|
|
259
|
+
button_search = Gtk.ToolButton()
|
|
260
|
+
button_search.set_icon_name("system-search-symbolic")
|
|
261
|
+
button_search.set_tooltip_text("Search current text")
|
|
262
|
+
button_search.connect("clicked", self.on_search_clicked)
|
|
263
|
+
toolbar.insert(button_search, nnn) ; nnn += 1
|
|
264
|
+
|
|
265
|
+
button_mag = Gtk.ToolButton()
|
|
266
|
+
button_mag.set_icon_name("zoom-fit-best")
|
|
267
|
+
button_mag.set_tooltip_text("Magnify Font")
|
|
268
|
+
button_mag.connect("clicked", self.on_zoom_clicked)
|
|
269
|
+
toolbar.insert(button_mag, nnn) ; nnn += 1
|
|
270
|
+
|
|
271
|
+
button_mag = Gtk.ToolButton()
|
|
272
|
+
button_mag.set_icon_name("zoom-in-symbolic")
|
|
273
|
+
button_mag.set_tooltip_text("Set larger font")
|
|
274
|
+
button_mag.connect("clicked", self.on_zoom_clicked)
|
|
275
|
+
toolbar.insert(button_mag, nnn) ; nnn += 1
|
|
276
|
+
|
|
277
|
+
button_mag2 = Gtk.ToolButton()
|
|
278
|
+
button_mag2.set_icon_name("zoom-out-symbolic")
|
|
279
|
+
button_mag2.set_tooltip_text("Set smaller Font")
|
|
280
|
+
button_mag2.connect("clicked", self.on_unzoom_clicked)
|
|
281
|
+
toolbar.insert(button_mag2, nnn) ; nnn += 1
|
|
282
|
+
|
|
283
|
+
def area_key(self, widget, event):
|
|
284
|
+
#print("TextViewWin keypress", event.string, event.keyval)
|
|
285
|
+
if event.state & Gdk.ModifierType.CONTROL_MASK:
|
|
286
|
+
print("TextViewWin control keypress", event.string, event.keyval)
|
|
287
|
+
|
|
288
|
+
if event.keyval == 102:
|
|
289
|
+
#print("control find")
|
|
290
|
+
if self.findcall:
|
|
291
|
+
# Call with object argument
|
|
292
|
+
self.findcall[0](self.findcall[1])
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def area_button(self, but, event):
|
|
296
|
+
#print("click", event.x, event.y)
|
|
297
|
+
# textview
|
|
298
|
+
endd = self.textbuffer.get_end_iter()
|
|
299
|
+
isx, iter = self.textview.get_iter_at_location(event.x, event.y)
|
|
300
|
+
if isx:
|
|
301
|
+
txt = self.textbuffer.get_text(iter, endd, False)
|
|
302
|
+
#print("[", txt[:4], "]")
|
|
303
|
+
|
|
304
|
+
#defvals = self.textview.get_default_attributes()
|
|
305
|
+
#print(defvals.appearance.rise)
|
|
306
|
+
|
|
307
|
+
#ixy, attr = iter.get_attributes()
|
|
308
|
+
#if ixy:
|
|
309
|
+
# #attr.ref()
|
|
310
|
+
# #print(attr.refcount)
|
|
311
|
+
# print(dir(attr))
|
|
312
|
+
# #print(attr.refcount)
|
|
313
|
+
# #print(attr.appearance.rise)
|
|
314
|
+
# attr.unref()
|
|
315
|
+
#else:
|
|
316
|
+
# print("no artt")
|
|
317
|
+
|
|
318
|
+
#attr.unref()
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def on_rm_color(self, arg1):
|
|
322
|
+
print( "on_rm_color", arg1)
|
|
323
|
+
|
|
324
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
325
|
+
|
|
326
|
+
if not len(bounds):
|
|
327
|
+
if self.statstr:
|
|
328
|
+
self.statstr.set_text("No selection")
|
|
329
|
+
#print("No selection")
|
|
330
|
+
return
|
|
331
|
+
else:
|
|
332
|
+
start, end = bounds
|
|
333
|
+
|
|
334
|
+
# Clear out old colors
|
|
335
|
+
for cc in range(len(font_colors)):
|
|
336
|
+
rrr = "backgr%d" % cc
|
|
337
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
338
|
+
|
|
339
|
+
for cc in range(len(font_colors)):
|
|
340
|
+
rrr = "color%d" % cc
|
|
341
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
342
|
+
|
|
343
|
+
self.textbuffer.set_modified(1)
|
|
344
|
+
|
|
345
|
+
def on_combo_clicked(self, arg1, arg2):
|
|
346
|
+
#print("on_combo_clicked")
|
|
347
|
+
#cont = ("12", "32", "64")
|
|
348
|
+
#combo_box = pgbox.ComboBox(cont)
|
|
349
|
+
#combo_box.show()
|
|
350
|
+
pass
|
|
351
|
+
|
|
352
|
+
def combo_sel(self, sel):
|
|
353
|
+
#print("combo_sel", sel)
|
|
354
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
355
|
+
if not len(bounds):
|
|
356
|
+
if self.statstr:
|
|
357
|
+
self.statstr.set_text("No selection")
|
|
358
|
+
#print("No selection")
|
|
359
|
+
return
|
|
360
|
+
else:
|
|
361
|
+
nnn = "size%d" % int(sel);
|
|
362
|
+
start, end = bounds
|
|
363
|
+
|
|
364
|
+
# Femove size tags from here
|
|
365
|
+
for aa in font_sizes:
|
|
366
|
+
rrr = "size%d" % int(aa);
|
|
367
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
368
|
+
try:
|
|
369
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
370
|
+
self.textbuffer.set_modified(1)
|
|
371
|
+
except:
|
|
372
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())
|
|
373
|
+
|
|
374
|
+
def combo_sel2(self, sel):
|
|
375
|
+
#print("combo_sel2", sel)
|
|
376
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
377
|
+
|
|
378
|
+
if not len(bounds):
|
|
379
|
+
if self.statstr:
|
|
380
|
+
self.statstr.set_text("No selection")
|
|
381
|
+
#print("No selection")
|
|
382
|
+
return
|
|
383
|
+
else:
|
|
384
|
+
# Clear out old colors
|
|
385
|
+
start, end = bounds
|
|
386
|
+
for cc in range(len(font_colors)):
|
|
387
|
+
rrr = "color%d" % cc
|
|
388
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
389
|
+
|
|
390
|
+
# Find out the offset:
|
|
391
|
+
cnt = 0
|
|
392
|
+
for aa, bb in font_colors:
|
|
393
|
+
if aa == sel:
|
|
394
|
+
break
|
|
395
|
+
cnt += 1
|
|
396
|
+
nnn = "color%d" % cnt
|
|
397
|
+
#print("nnn", nnn)
|
|
398
|
+
start, end = bounds
|
|
399
|
+
try:
|
|
400
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
401
|
+
self.textbuffer.set_modified(1)
|
|
402
|
+
except:
|
|
403
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())
|
|
404
|
+
|
|
405
|
+
def combo_sel3(self, sel):
|
|
406
|
+
#print("combo_sel3", sel)
|
|
407
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
408
|
+
|
|
409
|
+
if not len(bounds):
|
|
410
|
+
if self.statstr:
|
|
411
|
+
self.statstr.set_text("No selection")
|
|
412
|
+
#print("No selection")
|
|
413
|
+
return
|
|
414
|
+
else:
|
|
415
|
+
start, end = bounds
|
|
416
|
+
|
|
417
|
+
# Clear out old colors
|
|
418
|
+
for cc in range(len(font_colors)):
|
|
419
|
+
rrr = "backgr%d" % cc
|
|
420
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
421
|
+
|
|
422
|
+
# Find out the offset:
|
|
423
|
+
cnt = 0
|
|
424
|
+
for aa, bb in font_colors:
|
|
425
|
+
if aa == sel:
|
|
426
|
+
break
|
|
427
|
+
cnt += 1
|
|
428
|
+
|
|
429
|
+
nnn = "backgr%d" % cnt
|
|
430
|
+
#print("nnn", nnn)
|
|
431
|
+
|
|
432
|
+
try:
|
|
433
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
434
|
+
self.textbuffer.set_modified(1)
|
|
435
|
+
except:
|
|
436
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
def on_zoom_clicked(self, arg1):
|
|
440
|
+
|
|
441
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
442
|
+
myfd = pg.get_font_description()
|
|
443
|
+
mysize = myfd.get_size() / Pango.SCALE
|
|
444
|
+
|
|
445
|
+
fd = Pango.FontDescription()
|
|
446
|
+
fd.set_size((mysize + 1) * Pango.SCALE)
|
|
447
|
+
self.textview.modify_font(fd)
|
|
448
|
+
|
|
449
|
+
def on_unzoom_clicked(self, arg1):
|
|
450
|
+
|
|
451
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
452
|
+
myfd = pg.get_font_description()
|
|
453
|
+
mysize = myfd.get_size() / Pango.SCALE
|
|
454
|
+
|
|
455
|
+
fd = Pango.FontDescription()
|
|
456
|
+
fd.set_size((mysize - 1) * Pango.SCALE)
|
|
457
|
+
self.textview.modify_font(fd)
|
|
458
|
+
|
|
459
|
+
def _create_textview(self):
|
|
460
|
+
|
|
461
|
+
self.textview = Gtk.TextView()
|
|
462
|
+
self.textbuffer = self.textview.get_buffer()
|
|
463
|
+
|
|
464
|
+
scrolledwindow = Gtk.ScrolledWindow()
|
|
465
|
+
scrolledwindow.set_hexpand(True)
|
|
466
|
+
scrolledwindow.set_vexpand(True)
|
|
467
|
+
self.grid.attach(scrolledwindow, 0, 2, 3, 1)
|
|
468
|
+
|
|
469
|
+
scrolledwindow.add(self.textview)
|
|
470
|
+
|
|
471
|
+
self.fd = Pango.FontDescription()
|
|
472
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
473
|
+
myfd = pg.get_font_description()
|
|
474
|
+
self.mysize = myfd.get_size() / Pango.SCALE
|
|
475
|
+
self.myfam = myfd.get_family()
|
|
476
|
+
#print(self.mysize)
|
|
477
|
+
|
|
478
|
+
#self.textview.set_has_window(True)
|
|
479
|
+
|
|
480
|
+
#self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
481
|
+
|
|
482
|
+
self.tag_regular = self.textbuffer.create_tag("regular", size=self.mysize * Pango.SCALE)
|
|
483
|
+
self.tag_super = self.textbuffer.create_tag("super", rise=5 * Pango.SCALE)
|
|
484
|
+
self.tag_sub = self.textbuffer.create_tag("sub", rise=-5 * Pango.SCALE)
|
|
485
|
+
self.tag_norm = self.textbuffer.create_tag("norm", weight=14*Pango.SCALE)
|
|
486
|
+
self.tag_xbig = self.textbuffer.create_tag("xbig", size=30*Pango.SCALE)
|
|
487
|
+
self.tag_big = self.textbuffer.create_tag("big", size=20*Pango.SCALE)
|
|
488
|
+
#self.tag_red = self.textbuffer.create_tag("red", foreground="red")
|
|
489
|
+
#self.tag_redbg = self.textbuffer.create_tag("redbg", background="red")
|
|
490
|
+
self.tag_norm = self.textbuffer.create_tag("normal", style=Pango.Style.NORMAL)
|
|
491
|
+
self.tag_bold = self.textbuffer.create_tag("bold", weight=Pango.Weight.BOLD)
|
|
492
|
+
self.tag_italic = self.textbuffer.create_tag("italic", style=Pango.Style.ITALIC)
|
|
493
|
+
self.tag_underline = self.textbuffer.create_tag("underline", underline=Pango.Underline.SINGLE)
|
|
494
|
+
self.tag_found = self.textbuffer.create_tag("found", background="yellow")
|
|
495
|
+
self.tag_left = self.textbuffer.create_tag("justleft", justification=Gtk.Justification.LEFT)
|
|
496
|
+
self.tag_center = self.textbuffer.create_tag("justcent", justification=Gtk.Justification.CENTER)
|
|
497
|
+
self.tag_right = self.textbuffer.create_tag("justright", justification=Gtk.Justification.RIGHT)
|
|
498
|
+
self.tag_fill = self.textbuffer.create_tag("justfill", justification=Gtk.Justification.FILL)
|
|
499
|
+
|
|
500
|
+
self.textview.set_wrap_mode(Gtk.WrapMode.WORD)
|
|
501
|
+
|
|
502
|
+
# We create the attributes for all possible size tags
|
|
503
|
+
for aa in font_sizes:
|
|
504
|
+
nnn = "size%d" % int(aa);
|
|
505
|
+
ttt = self.textbuffer.create_tag(nnn, size=int(aa) * Pango.SCALE)
|
|
506
|
+
setattr(self, nnn, ttt)
|
|
507
|
+
|
|
508
|
+
# We create the attributes for all possible color tags
|
|
509
|
+
cnt = 0
|
|
510
|
+
for aa, bb in font_colors:
|
|
511
|
+
print
|
|
512
|
+
nnn = "color%d" % cnt;
|
|
513
|
+
ttt = self.textbuffer.create_tag(nnn, foreground=aa)
|
|
514
|
+
setattr(self, nnn, ttt)
|
|
515
|
+
cnt += 1
|
|
516
|
+
|
|
517
|
+
cnt = 0
|
|
518
|
+
for aa, bb in font_colors:
|
|
519
|
+
nnn = "backgr%d" % int(cnt);
|
|
520
|
+
ttt = self.textbuffer.create_tag(nnn, background=aa)
|
|
521
|
+
setattr(self, nnn, ttt)
|
|
522
|
+
cnt += 1
|
|
523
|
+
|
|
524
|
+
#print(dir(self))
|
|
525
|
+
|
|
526
|
+
def _create_buttons(self):
|
|
527
|
+
|
|
528
|
+
#check_editable = Gtk.CheckButton(label="Editable")
|
|
529
|
+
#check_editable.set_active(True)
|
|
530
|
+
#check_editable.connect("toggled", self.on_editable_toggled)
|
|
531
|
+
#self.grid.attach(check_editable, 0, 2, 1, 1)
|
|
532
|
+
##
|
|
533
|
+
#check_cursor = Gtk.CheckButton(label="Cursor Visible")
|
|
534
|
+
#check_cursor.set_active(True)
|
|
535
|
+
#check_editable.connect("toggled", self.on_cursor_toggled)
|
|
536
|
+
#self.grid.attach_next_to(
|
|
537
|
+
# check_cursor, check_editable, Gtk.PositionType.RIGHT, 1, 1)
|
|
538
|
+
|
|
539
|
+
# ---------------------------------------------------------------------------------
|
|
540
|
+
|
|
541
|
+
radio_wrapword = Gtk.RadioButton.new_with_label_from_widget(None, "Word")
|
|
542
|
+
self.grid.attach(radio_wrapword, 0, 3, 1, 1)
|
|
543
|
+
|
|
544
|
+
radio_wrapchar = Gtk.RadioButton.new_with_label_from_widget(radio_wrapword, "Character")
|
|
545
|
+
self.grid.attach_next_to(
|
|
546
|
+
radio_wrapchar, radio_wrapword, Gtk.PositionType.RIGHT, 1, 1)
|
|
547
|
+
|
|
548
|
+
radio_wrapnone = Gtk.RadioButton.new_with_label_from_widget(radio_wrapword, "None")
|
|
549
|
+
self.grid.attach_next_to(
|
|
550
|
+
radio_wrapnone, radio_wrapchar, Gtk.PositionType.RIGHT, 1, 1)
|
|
551
|
+
|
|
552
|
+
radio_wrapnone.connect("toggled", self.on_wrap_toggled, Gtk.WrapMode.NONE)
|
|
553
|
+
radio_wrapchar.connect("toggled", self.on_wrap_toggled, Gtk.WrapMode.CHAR)
|
|
554
|
+
radio_wrapword.connect("toggled", self.on_wrap_toggled, Gtk.WrapMode.WORD)
|
|
555
|
+
|
|
556
|
+
def get_text(self):
|
|
557
|
+
startt = self.textbuffer.get_start_iter()
|
|
558
|
+
endd = self.textbuffer.get_end_iter()
|
|
559
|
+
txt = self.textbuffer.get_text(startt, endd, False)
|
|
560
|
+
return txt
|
|
561
|
+
|
|
562
|
+
#def get_all(self):
|
|
563
|
+
# print("Get_all called")
|
|
564
|
+
# startt = self.buffer.get_start_iter()
|
|
565
|
+
# endd = self.buffer.get_end_iter()
|
|
566
|
+
# return self.buffer.get_text(startt, endd, True)
|
|
567
|
+
|
|
568
|
+
def get_modified(self):
|
|
569
|
+
return self.textbuffer.get_modified()
|
|
570
|
+
|
|
571
|
+
def set_modified(self, valx):
|
|
572
|
+
return self.textbuffer.set_modified(valx)
|
|
573
|
+
|
|
574
|
+
def set_text(self, txt):
|
|
575
|
+
if self.textbuffer.get_modified():
|
|
576
|
+
startt = self.textbuffer.get_start_iter()
|
|
577
|
+
endd = self.textbuffer.get_end_iter()
|
|
578
|
+
old = self.textbuffer.get_text(startt, endd, False)
|
|
579
|
+
if self.callb:
|
|
580
|
+
self.callb(old)
|
|
581
|
+
#print("old_content", old)
|
|
582
|
+
self.textbuffer.set_text(txt)
|
|
583
|
+
|
|
584
|
+
def on_rm_clicked(self, widget, tag):
|
|
585
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
586
|
+
if len(bounds) != 0:
|
|
587
|
+
start, end = bounds
|
|
588
|
+
self.textbuffer.remove_all_tags(start, end)
|
|
589
|
+
self.textbuffer.set_modified(1)
|
|
590
|
+
|
|
591
|
+
# This was the old clear -- now clearing ALL
|
|
592
|
+
#self.textbuffer.remove_tag(self.tag_bold, start, end)
|
|
593
|
+
#self.textbuffer.remove_tag(self.tag_italic, start, end)
|
|
594
|
+
#self.textbuffer.remove_tag(self.tag_underline, start, end)
|
|
595
|
+
#self.textbuffer.remove_tag(self.tag_red, start, end)
|
|
596
|
+
#self.textbuffer.remove_tag(self.tag_redbg, start, end)
|
|
597
|
+
#self.textbuffer.remove_tag(self.tag_big, start, end)
|
|
598
|
+
#self.textbuffer.remove_tag(self.tag_xbig, start, end)
|
|
599
|
+
#self.textbuffer.remove_tag(self.tag_regular, start, end)
|
|
600
|
+
|
|
601
|
+
def on_button_clicked(self, widget, tag):
|
|
602
|
+
|
|
603
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
604
|
+
if not len(bounds):
|
|
605
|
+
if self.statstr:
|
|
606
|
+
self.statstr.set_text("No style selection.")
|
|
607
|
+
else:
|
|
608
|
+
start, end = bounds
|
|
609
|
+
#print("Apply Tag", tag, start, end)
|
|
610
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
611
|
+
self.textbuffer.set_modified(1)
|
|
612
|
+
|
|
613
|
+
def on_super_button(self, widget, tag):
|
|
614
|
+
|
|
615
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
616
|
+
if not len(bounds):
|
|
617
|
+
if self.statstr:
|
|
618
|
+
self.statstr.set_text("No style selection.")
|
|
619
|
+
else:
|
|
620
|
+
start, end = bounds
|
|
621
|
+
|
|
622
|
+
self.textbuffer.remove_tag(self.tag_super, start, end)
|
|
623
|
+
self.textbuffer.remove_tag(self.tag_sub, start, end)
|
|
624
|
+
|
|
625
|
+
#print("Apply Tag", tag, start, end)
|
|
626
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
627
|
+
self.textbuffer.set_modified(1)
|
|
628
|
+
|
|
629
|
+
def on_size_button(self, widget, tag):
|
|
630
|
+
|
|
631
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
632
|
+
if not len(bounds):
|
|
633
|
+
if self.statstr:
|
|
634
|
+
self.statstr.set_text("No style selection.")
|
|
635
|
+
else:
|
|
636
|
+
start, end = bounds
|
|
637
|
+
|
|
638
|
+
self.textbuffer.remove_tag(self.tag_super, start, end)
|
|
639
|
+
self.textbuffer.remove_tag(self.tag_sub, start, end)
|
|
640
|
+
|
|
641
|
+
#print("Apply Tag", tag, start, end)
|
|
642
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
643
|
+
self.textbuffer.set_modified(1)
|
|
644
|
+
|
|
645
|
+
def on_clear_clicked(self, widget):
|
|
646
|
+
start = self.textbuffer.get_start_iter()
|
|
647
|
+
end = self.textbuffer.get_end_iter()
|
|
648
|
+
self.textbuffer.remove_all_tags(start, end)
|
|
649
|
+
self.textbuffer.set_modified(1)
|
|
650
|
+
|
|
651
|
+
def on_editable_toggled(self, widget):
|
|
652
|
+
self.textview.set_editable(widget.get_active())
|
|
653
|
+
self.textbuffer.set_modified(1)
|
|
654
|
+
|
|
655
|
+
def on_cursor_toggled(self, widget):
|
|
656
|
+
self.textview.set_cursor_visible(widget.get_active())
|
|
657
|
+
|
|
658
|
+
def on_wrap_toggled(self, widget, mode):
|
|
659
|
+
self.textview.set_wrap_mode(mode)
|
|
660
|
+
|
|
661
|
+
def on_justify_toggled(self, widget, justification):
|
|
662
|
+
#print("on_justify_toggled", justification)
|
|
663
|
+
#self.textview.set_justification(justification)
|
|
664
|
+
#start = self.textbuffer.get_start_iter()
|
|
665
|
+
#end = self.textbuffer.get_end_iter()
|
|
666
|
+
|
|
667
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
668
|
+
if not len(bounds):
|
|
669
|
+
if self.statstr:
|
|
670
|
+
self.statstr.set_text("No selection.")
|
|
671
|
+
else:
|
|
672
|
+
start, end = bounds
|
|
673
|
+
#print("Apply Just Tag", justification, start, end)
|
|
674
|
+
|
|
675
|
+
# Remove old justification
|
|
676
|
+
self.textbuffer.remove_tag(self.tag_left, start, end)
|
|
677
|
+
self.textbuffer.remove_tag(self.tag_center, start, end)
|
|
678
|
+
self.textbuffer.remove_tag(self.tag_right, start, end)
|
|
679
|
+
self.textbuffer.remove_tag(self.tag_fill, start, end)
|
|
680
|
+
|
|
681
|
+
self.textbuffer.apply_tag(justification, start, end)
|
|
682
|
+
self.textbuffer.set_modified(1)
|
|
683
|
+
|
|
684
|
+
def on_search_clicked(self, widget):
|
|
685
|
+
|
|
686
|
+
if self.findcall:
|
|
687
|
+
# Call with object argument
|
|
688
|
+
self.findcall[0](self.findcall[1])
|
|
689
|
+
|
|
690
|
+
dialog.destroy()
|
|
691
|
+
|
|
692
|
+
def search_and_mark(self, text, start):
|
|
693
|
+
end = self.textbuffer.get_end_iter()
|
|
694
|
+
match = start.forward_search(text, 0, end)
|
|
695
|
+
|
|
696
|
+
if match is not None:
|
|
697
|
+
match_start, match_end = match
|
|
698
|
+
self.textbuffer.apply_tag(self.tag_found, match_start, match_end)
|
|
699
|
+
self.search_and_mark(text, match_end)
|
|
700
|
+
|
|
701
|
+
# --------------------------------------------------------------------
|
|
702
|
+
# Load it here
|
|
703
|
+
|
|
704
|
+
def deser_buff(self, buffx):
|
|
705
|
+
|
|
706
|
+
if not buffx:
|
|
707
|
+
return
|
|
708
|
+
|
|
709
|
+
#print("UnSer buff")
|
|
710
|
+
|
|
711
|
+
fmt = self.textbuffer.register_deserialize_tagset()
|
|
712
|
+
self.textbuffer.deserialize_set_can_create_tags(fmt, True)
|
|
713
|
+
self.textbuffer.deserialize(self.textbuffer, fmt,
|
|
714
|
+
self.textbuffer.get_start_iter(), buffx)
|
|
715
|
+
self.textbuffer.set_modified(0)
|
|
716
|
+
|
|
717
|
+
# --------------------------------------------------------------------
|
|
718
|
+
# Save it here
|
|
719
|
+
|
|
720
|
+
def ser_buff(self):
|
|
721
|
+
|
|
722
|
+
#print("Ser buff")
|
|
723
|
+
|
|
724
|
+
startt = self.textbuffer.get_start_iter()
|
|
725
|
+
endd = self.textbuffer.get_end_iter()
|
|
726
|
+
|
|
727
|
+
fmt = self.textbuffer.register_serialize_tagset()
|
|
728
|
+
sss = self.textbuffer.serialize(self.textbuffer, fmt, startt, endd)
|
|
729
|
+
if not sss: sss = b""
|
|
730
|
+
return sss
|
|
731
|
+
|
|
732
|
+
# Print TextTag (testing)
|
|
733
|
+
def ptag(self, ttt, tt):
|
|
734
|
+
|
|
735
|
+
global cnt # Print only one
|
|
736
|
+
if cnt: return
|
|
737
|
+
cnt += 1
|
|
738
|
+
|
|
739
|
+
print(ttt)
|
|
740
|
+
#print(dir(ttt))
|
|
741
|
+
ll = ttt.list_properties()
|
|
742
|
+
for aa in ll:
|
|
743
|
+
#print(nnnn, end= " ")
|
|
744
|
+
try:
|
|
745
|
+
nn = tt.lookup(aa.name)
|
|
746
|
+
if nn:
|
|
747
|
+
#nnn = nn.get_property("size")
|
|
748
|
+
#print("size", nnn)
|
|
749
|
+
|
|
750
|
+
lll = nn.list_properties()
|
|
751
|
+
for bb in lll:
|
|
752
|
+
nnn = bb.name #get_property("name")
|
|
753
|
+
try:
|
|
754
|
+
pp = nn.get_property(nnn)
|
|
755
|
+
except:
|
|
756
|
+
pass
|
|
757
|
+
print(aa.name, "prop", "'" + nnn + "'" , "val =", pp)
|
|
758
|
+
print()
|
|
759
|
+
|
|
760
|
+
except:
|
|
761
|
+
print(sys.exc_info())
|
|
762
|
+
pass
|
|
763
|
+
#print()
|
|
764
|
+
|
|
765
|
+
return
|
|
766
|
+
|
|
767
|
+
# --------------------------------------------------------------------
|
|
768
|
+
|
|
769
|
+
def print_tags(self):
|
|
770
|
+
|
|
771
|
+
#startt = self.textbuffer.get_start_iter()
|
|
772
|
+
#endd = self.textbuffer.get_end_iter()
|
|
773
|
+
|
|
774
|
+
# TagTable
|
|
775
|
+
#tt = self.textbuffer.get_property("tag-table")
|
|
776
|
+
#print("table", tt)
|
|
777
|
+
|
|
778
|
+
tt = self.textbuffer.get_tag_table()
|
|
779
|
+
print("table", tt)
|
|
780
|
+
tt.foreach(self.ptag, tt)
|
|
781
|
+
print()
|
|
782
|
+
|
|
783
|
+
return
|
|
784
|
+
|
|
785
|
+
txt = self.textbuffer.get_text(startt, endd, False)
|
|
786
|
+
lc = self.textbuffer.get_char_count()
|
|
787
|
+
for aa in range(lc):
|
|
788
|
+
iii = self.textbuffer.get_iter_at_offset(aa)
|
|
789
|
+
eee = self.textbuffer.get_iter_at_offset(aa+1)
|
|
790
|
+
ccc = self.textbuffer.get_text(iii, eee, False)
|
|
791
|
+
#print("aa", ccc)
|
|
792
|
+
|
|
793
|
+
return txt
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
#all = self.edview.get_all()
|
|
797
|
+
#print("serialize", self.edview.textbuffer.get_deserialize_formats())
|
|
798
|
+
#print("str", self.edview.serial_str())
|
|
799
|
+
#print("serialize", self.edview.textbuffer.get_deserialize_formats())
|
|
800
|
+
|
|
801
|
+
#vv = self.edview.textbuffer
|
|
802
|
+
#startt = vv.get_start_iter(); endd = vv.get_end_iter()
|
|
803
|
+
#while True:
|
|
804
|
+
# prev = startt.copy()
|
|
805
|
+
# nextok = startt.forward_line()
|
|
806
|
+
# ttt = vv.get_text(prev, startt, False)
|
|
807
|
+
# prevc = prev.copy()
|
|
808
|
+
# while True:
|
|
809
|
+
# sss = prevc.get_toggled_tags(True)
|
|
810
|
+
# if sss:
|
|
811
|
+
# print("tags on toggle", sss)
|
|
812
|
+
# for cc in sss:
|
|
813
|
+
# print("cc", cc.get_property("name"))
|
|
814
|
+
# print("pos", prevc.get_line(), prevc.get_line_offset())
|
|
815
|
+
# beg = prevc.copy()
|
|
816
|
+
# nextokc = prevc.forward_char()
|
|
817
|
+
# if not nextokc:
|
|
818
|
+
# break
|
|
819
|
+
# if startt == prevc:
|
|
820
|
+
# break
|
|
821
|
+
# chh = vv.get_text(beg, prevc, False)
|
|
822
|
+
# print(chh, end="")
|
|
823
|
+
#
|
|
824
|
+
# #print("tags", prev.get_tags())
|
|
825
|
+
# #print("line:", ttt, end="")
|
|
826
|
+
# if not nextok:
|
|
827
|
+
# break
|
|
828
|
+
#
|
|
829
|
+
##print("tags:", self.edview.textbuffer.get_tags())</code></pre>
|
|
830
|
+
</details>
|
|
831
|
+
</section>
|
|
832
|
+
<section>
|
|
833
|
+
</section>
|
|
834
|
+
<section>
|
|
835
|
+
</section>
|
|
836
|
+
<section>
|
|
837
|
+
</section>
|
|
838
|
+
<section>
|
|
839
|
+
<h2 class="section-title" id="header-classes">Classes</h2>
|
|
840
|
+
<dl>
|
|
841
|
+
<dt id="pgtextview.pgTextView"><code class="flex name class">
|
|
842
|
+
<span>class <span class="ident">pgTextView</span></span>
|
|
843
|
+
<span>(</span><span>status=False)</span>
|
|
844
|
+
</code></dt>
|
|
845
|
+
<dd>
|
|
846
|
+
<div class="desc"><p>:Constructors:</p>
|
|
847
|
+
<p>::</p>
|
|
848
|
+
<pre><code>VBox(**properties)
|
|
849
|
+
new(homogeneous:bool, spacing:int) -> Gtk.Widget
|
|
850
|
+
</code></pre>
|
|
851
|
+
<p>Initializer for a GObject based classes with support for property
|
|
852
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
853
|
+
<details class="source">
|
|
854
|
+
<summary>
|
|
855
|
+
<span>Expand source code</span>
|
|
856
|
+
</summary>
|
|
857
|
+
<pre><code class="python">class pgTextView(Gtk.VBox):
|
|
858
|
+
|
|
859
|
+
def __init__(self, status = False):
|
|
860
|
+
|
|
861
|
+
self.statstr = None
|
|
862
|
+
Gtk.VBox.__init__(self)
|
|
863
|
+
|
|
864
|
+
self.tagtablex = []
|
|
865
|
+
self.callb = None
|
|
866
|
+
self.grid = Gtk.Grid()
|
|
867
|
+
self.add(self.grid)
|
|
868
|
+
|
|
869
|
+
self._create_textview()
|
|
870
|
+
self._create_toolbar()
|
|
871
|
+
self._create_toolbar2()
|
|
872
|
+
self._create_buttons()
|
|
873
|
+
|
|
874
|
+
# Status bar
|
|
875
|
+
self.statstr = Gtk.Label.new("Idle")
|
|
876
|
+
self.statstr.set_halign(Gtk.Align.START)
|
|
877
|
+
|
|
878
|
+
if status:
|
|
879
|
+
hstat = Gtk.HBox()
|
|
880
|
+
hstat.pack_start(Gtk.Label.new(" Status: "), 0, 0, 0)
|
|
881
|
+
hstat.pack_start(Gtk.Label.new(" "), 0, 0, 0)
|
|
882
|
+
hstat.pack_start(self.statstr, 1, 1, 0)
|
|
883
|
+
|
|
884
|
+
self.grid.attach(hstat, 0, 4, 3, 1)
|
|
885
|
+
|
|
886
|
+
self.textview.connect("key-press-event", self.area_key)
|
|
887
|
+
self.textview.connect("move-cursor", self.area_curs)
|
|
888
|
+
self.connect("button-press-event", self.area_button)
|
|
889
|
+
#self.textview.connect("focus-out-event", self.focus_out)
|
|
890
|
+
self.findcall = None;
|
|
891
|
+
|
|
892
|
+
def area_curs(self, ext_view, step, count, extend_selection):
|
|
893
|
+
#print("step", step, "count", count)
|
|
894
|
+
pass
|
|
895
|
+
|
|
896
|
+
def _create_toolbar(self):
|
|
897
|
+
|
|
898
|
+
nnn = 0
|
|
899
|
+
toolbar = Gtk.Toolbar()
|
|
900
|
+
self.grid.attach(toolbar, 0, 1, 3, 1)
|
|
901
|
+
|
|
902
|
+
button_norm = Gtk.ToolButton()
|
|
903
|
+
button_norm.set_icon_name("format-text-none-symbolic")
|
|
904
|
+
button_norm.set_tooltip_text("Remove ALL Formatting")
|
|
905
|
+
toolbar.insert(button_norm, nnn) ; nnn += 1
|
|
906
|
+
|
|
907
|
+
button_bold = Gtk.ToolButton()
|
|
908
|
+
button_bold.set_icon_name("format-text-bold-symbolic")
|
|
909
|
+
button_bold.set_tooltip_text("Set Bold")
|
|
910
|
+
toolbar.insert(button_bold, nnn) ; nnn += 1
|
|
911
|
+
|
|
912
|
+
button_italic = Gtk.ToolButton()
|
|
913
|
+
button_italic.set_icon_name("format-text-italic-symbolic")
|
|
914
|
+
button_italic.set_tooltip_text("Set Italic")
|
|
915
|
+
toolbar.insert(button_italic, nnn) ; nnn += 1
|
|
916
|
+
|
|
917
|
+
button_underline = Gtk.ToolButton()
|
|
918
|
+
button_underline.set_icon_name("format-text-underline-symbolic")
|
|
919
|
+
button_underline.set_tooltip_text("Set Underline")
|
|
920
|
+
toolbar.insert(button_underline, nnn) ; nnn += 1
|
|
921
|
+
|
|
922
|
+
button_sel = Gtk.ToolItem()
|
|
923
|
+
|
|
924
|
+
combo = pgbox.ComboBox(font_sizes, self.combo_sel)
|
|
925
|
+
#combo.sel_text("12")
|
|
926
|
+
#print("str(self.mysize)", str(self.mysize))
|
|
927
|
+
combo.sel_text(str(int(self.mysize)))
|
|
928
|
+
combo.set_tooltip_text("Set Font Size")
|
|
929
|
+
|
|
930
|
+
#hb = Gtk.HBox()
|
|
931
|
+
#hb.pack_start(Gtk.Label.new("Font Size:"), 0, 0, 2)
|
|
932
|
+
#hb.pack_start(combo, 0, 0, 0)
|
|
933
|
+
button_sel.add(combo)
|
|
934
|
+
toolbar.insert(button_sel, nnn) ; nnn += 1
|
|
935
|
+
|
|
936
|
+
button_sel2 = Gtk.ToolItem()
|
|
937
|
+
|
|
938
|
+
#print("mmm", mmm)
|
|
939
|
+
#hb2 = Gtk.HBox()
|
|
940
|
+
combo2 = pgbox.ColorCombo(font_colors, self.combo_sel2)
|
|
941
|
+
combo2.sel_text("Black")
|
|
942
|
+
combo2.set_tooltip_text("Set Font Color")
|
|
943
|
+
|
|
944
|
+
#hb2.pack_start(Gtk.Label.new("Font Color:"), 0, 0, 2)
|
|
945
|
+
#hb2.pack_start(combo2, 0, 0, 0)
|
|
946
|
+
button_sel2.add(combo2)
|
|
947
|
+
toolbar.insert(button_sel2, nnn) ; nnn += 1
|
|
948
|
+
|
|
949
|
+
# ----------------------------------------------------------------
|
|
950
|
+
|
|
951
|
+
button_sel3 = Gtk.ToolItem()
|
|
952
|
+
#hb3 = Gtk.HBox()
|
|
953
|
+
combo3 = pgbox.ColorCombo(font_colors, self.combo_sel3)
|
|
954
|
+
combo3.sel_text("White")
|
|
955
|
+
combo3.set_tooltip_text("Set Background Color")
|
|
956
|
+
#hb3.pack_start(Gtk.Label.new("Font Back:"), 0, 0, 2)
|
|
957
|
+
#hb3.pack_start(combo3, 0, 0, 0)
|
|
958
|
+
button_sel3.add(combo3)
|
|
959
|
+
toolbar.insert(button_sel3, nnn) ; nnn += 1
|
|
960
|
+
|
|
961
|
+
button_color = Gtk.ToolButton()
|
|
962
|
+
button_color.set_icon_name("preferences-desktop-theme")
|
|
963
|
+
button_color.set_tooltip_text("Remove Color Attributes")
|
|
964
|
+
button_color.connect("clicked", self.on_rm_color)
|
|
965
|
+
toolbar.insert(button_color, nnn) ; nnn += 1
|
|
966
|
+
|
|
967
|
+
button_norm.connect("clicked", self.on_rm_clicked, self.tag_norm)
|
|
968
|
+
button_bold.connect("clicked", self.on_button_clicked, self.tag_bold)
|
|
969
|
+
button_italic.connect("clicked", self.on_button_clicked, self.tag_italic)
|
|
970
|
+
button_underline.connect("clicked", self.on_button_clicked, self.tag_underline)
|
|
971
|
+
|
|
972
|
+
#toolbar.insert(Gtk.SeparatorToolItem(), nnn) ; nnn += 1
|
|
973
|
+
|
|
974
|
+
def _create_toolbar2(self):
|
|
975
|
+
|
|
976
|
+
nnn = 0
|
|
977
|
+
toolbar = Gtk.Toolbar()
|
|
978
|
+
self.grid.attach(toolbar, 0, 0, 3, 1)
|
|
979
|
+
|
|
980
|
+
radio_justifyleft = Gtk.RadioToolButton()
|
|
981
|
+
radio_justifyleft.set_icon_name("format-justify-left-symbolic")
|
|
982
|
+
toolbar.insert(radio_justifyleft, nnn) ; nnn += 1
|
|
983
|
+
|
|
984
|
+
radio_justifycenter = Gtk.RadioToolButton.new_from_widget(radio_justifyleft)
|
|
985
|
+
radio_justifycenter.set_icon_name("format-justify-center-symbolic")
|
|
986
|
+
toolbar.insert(radio_justifycenter, nnn) ; nnn += 1
|
|
987
|
+
|
|
988
|
+
radio_justifyright = Gtk.RadioToolButton.new_from_widget(radio_justifyleft)
|
|
989
|
+
radio_justifyright.set_icon_name("format-justify-right-symbolic")
|
|
990
|
+
toolbar.insert(radio_justifyright, nnn) ; nnn += 1
|
|
991
|
+
|
|
992
|
+
radio_justifyfill = Gtk.RadioToolButton.new_from_widget(radio_justifyleft)
|
|
993
|
+
radio_justifyfill.set_icon_name("format-justify-fill-symbolic")
|
|
994
|
+
toolbar.insert(radio_justifyfill, nnn) ; nnn += 1
|
|
995
|
+
|
|
996
|
+
radio_justifyleft.connect(
|
|
997
|
+
#"toggled", self.on_justify_toggled, Gtk.Justification.LEFT
|
|
998
|
+
"toggled", self.on_justify_toggled, self.tag_left
|
|
999
|
+
)
|
|
1000
|
+
radio_justifycenter.connect(
|
|
1001
|
+
#"toggled", self.on_justify_toggled, Gtk.Justification.CENTER
|
|
1002
|
+
"toggled", self.on_justify_toggled, self.tag_center
|
|
1003
|
+
)
|
|
1004
|
+
radio_justifyright.connect(
|
|
1005
|
+
"toggled", self.on_justify_toggled, self.tag_right
|
|
1006
|
+
)
|
|
1007
|
+
|
|
1008
|
+
radio_justifyfill.connect(
|
|
1009
|
+
"toggled", self.on_justify_toggled, self.tag_fill
|
|
1010
|
+
)
|
|
1011
|
+
|
|
1012
|
+
button_big = Gtk.ToolButton()
|
|
1013
|
+
button_big.set_icon_name("format-text-larger-symbolic")
|
|
1014
|
+
button_big.set_tooltip_text("Set Superscript")
|
|
1015
|
+
button_big.connect("clicked", self.on_super_button, self.tag_super)
|
|
1016
|
+
toolbar.insert(button_big, nnn) ; nnn += 1
|
|
1017
|
+
|
|
1018
|
+
button_big = Gtk.ToolButton()
|
|
1019
|
+
button_big.set_icon_name("format-text-smaller-symbolic")
|
|
1020
|
+
button_big.set_tooltip_text("Set Subscript")
|
|
1021
|
+
button_big.connect("clicked", self.on_super_button, self.tag_sub)
|
|
1022
|
+
toolbar.insert(button_big, nnn) ; nnn += 1
|
|
1023
|
+
|
|
1024
|
+
button_big = Gtk.ToolButton()
|
|
1025
|
+
button_big.set_icon_name("tools-check-spelling")
|
|
1026
|
+
button_big.set_tooltip_text("Set XX Large font")
|
|
1027
|
+
button_big.connect("clicked", self.on_button_clicked, self.tag_xbig)
|
|
1028
|
+
toolbar.insert(button_big, nnn) ; nnn += 1
|
|
1029
|
+
|
|
1030
|
+
button_color = Gtk.ToolButton()
|
|
1031
|
+
button_color.set_icon_name("font-x-generic")
|
|
1032
|
+
button_color.set_tooltip_text("Set Font")
|
|
1033
|
+
#button_color.connect("clicked", self.on_color_clicked, 0)
|
|
1034
|
+
toolbar.insert(button_color, nnn) ; nnn += 1
|
|
1035
|
+
|
|
1036
|
+
toolbar.insert(Gtk.SeparatorToolItem(), nnn) ; nnn += 1
|
|
1037
|
+
|
|
1038
|
+
button_clear = Gtk.ToolButton()
|
|
1039
|
+
button_clear.set_icon_name("edit-clear-symbolic")
|
|
1040
|
+
button_clear.set_tooltip_text("Remove ALL formatting")
|
|
1041
|
+
button_clear.connect("clicked", self.on_clear_clicked)
|
|
1042
|
+
toolbar.insert(button_clear, nnn) ; nnn += 1
|
|
1043
|
+
|
|
1044
|
+
toolbar.insert(Gtk.SeparatorToolItem(), nnn) ; nnn += 1
|
|
1045
|
+
|
|
1046
|
+
button_search = Gtk.ToolButton()
|
|
1047
|
+
button_search.set_icon_name("system-search-symbolic")
|
|
1048
|
+
button_search.set_tooltip_text("Search current text")
|
|
1049
|
+
button_search.connect("clicked", self.on_search_clicked)
|
|
1050
|
+
toolbar.insert(button_search, nnn) ; nnn += 1
|
|
1051
|
+
|
|
1052
|
+
button_mag = Gtk.ToolButton()
|
|
1053
|
+
button_mag.set_icon_name("zoom-fit-best")
|
|
1054
|
+
button_mag.set_tooltip_text("Magnify Font")
|
|
1055
|
+
button_mag.connect("clicked", self.on_zoom_clicked)
|
|
1056
|
+
toolbar.insert(button_mag, nnn) ; nnn += 1
|
|
1057
|
+
|
|
1058
|
+
button_mag = Gtk.ToolButton()
|
|
1059
|
+
button_mag.set_icon_name("zoom-in-symbolic")
|
|
1060
|
+
button_mag.set_tooltip_text("Set larger font")
|
|
1061
|
+
button_mag.connect("clicked", self.on_zoom_clicked)
|
|
1062
|
+
toolbar.insert(button_mag, nnn) ; nnn += 1
|
|
1063
|
+
|
|
1064
|
+
button_mag2 = Gtk.ToolButton()
|
|
1065
|
+
button_mag2.set_icon_name("zoom-out-symbolic")
|
|
1066
|
+
button_mag2.set_tooltip_text("Set smaller Font")
|
|
1067
|
+
button_mag2.connect("clicked", self.on_unzoom_clicked)
|
|
1068
|
+
toolbar.insert(button_mag2, nnn) ; nnn += 1
|
|
1069
|
+
|
|
1070
|
+
def area_key(self, widget, event):
|
|
1071
|
+
#print("TextViewWin keypress", event.string, event.keyval)
|
|
1072
|
+
if event.state & Gdk.ModifierType.CONTROL_MASK:
|
|
1073
|
+
print("TextViewWin control keypress", event.string, event.keyval)
|
|
1074
|
+
|
|
1075
|
+
if event.keyval == 102:
|
|
1076
|
+
#print("control find")
|
|
1077
|
+
if self.findcall:
|
|
1078
|
+
# Call with object argument
|
|
1079
|
+
self.findcall[0](self.findcall[1])
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
def area_button(self, but, event):
|
|
1083
|
+
#print("click", event.x, event.y)
|
|
1084
|
+
# textview
|
|
1085
|
+
endd = self.textbuffer.get_end_iter()
|
|
1086
|
+
isx, iter = self.textview.get_iter_at_location(event.x, event.y)
|
|
1087
|
+
if isx:
|
|
1088
|
+
txt = self.textbuffer.get_text(iter, endd, False)
|
|
1089
|
+
#print("[", txt[:4], "]")
|
|
1090
|
+
|
|
1091
|
+
#defvals = self.textview.get_default_attributes()
|
|
1092
|
+
#print(defvals.appearance.rise)
|
|
1093
|
+
|
|
1094
|
+
#ixy, attr = iter.get_attributes()
|
|
1095
|
+
#if ixy:
|
|
1096
|
+
# #attr.ref()
|
|
1097
|
+
# #print(attr.refcount)
|
|
1098
|
+
# print(dir(attr))
|
|
1099
|
+
# #print(attr.refcount)
|
|
1100
|
+
# #print(attr.appearance.rise)
|
|
1101
|
+
# attr.unref()
|
|
1102
|
+
#else:
|
|
1103
|
+
# print("no artt")
|
|
1104
|
+
|
|
1105
|
+
#attr.unref()
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
def on_rm_color(self, arg1):
|
|
1109
|
+
print( "on_rm_color", arg1)
|
|
1110
|
+
|
|
1111
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1112
|
+
|
|
1113
|
+
if not len(bounds):
|
|
1114
|
+
if self.statstr:
|
|
1115
|
+
self.statstr.set_text("No selection")
|
|
1116
|
+
#print("No selection")
|
|
1117
|
+
return
|
|
1118
|
+
else:
|
|
1119
|
+
start, end = bounds
|
|
1120
|
+
|
|
1121
|
+
# Clear out old colors
|
|
1122
|
+
for cc in range(len(font_colors)):
|
|
1123
|
+
rrr = "backgr%d" % cc
|
|
1124
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1125
|
+
|
|
1126
|
+
for cc in range(len(font_colors)):
|
|
1127
|
+
rrr = "color%d" % cc
|
|
1128
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1129
|
+
|
|
1130
|
+
self.textbuffer.set_modified(1)
|
|
1131
|
+
|
|
1132
|
+
def on_combo_clicked(self, arg1, arg2):
|
|
1133
|
+
#print("on_combo_clicked")
|
|
1134
|
+
#cont = ("12", "32", "64")
|
|
1135
|
+
#combo_box = pgbox.ComboBox(cont)
|
|
1136
|
+
#combo_box.show()
|
|
1137
|
+
pass
|
|
1138
|
+
|
|
1139
|
+
def combo_sel(self, sel):
|
|
1140
|
+
#print("combo_sel", sel)
|
|
1141
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1142
|
+
if not len(bounds):
|
|
1143
|
+
if self.statstr:
|
|
1144
|
+
self.statstr.set_text("No selection")
|
|
1145
|
+
#print("No selection")
|
|
1146
|
+
return
|
|
1147
|
+
else:
|
|
1148
|
+
nnn = "size%d" % int(sel);
|
|
1149
|
+
start, end = bounds
|
|
1150
|
+
|
|
1151
|
+
# Femove size tags from here
|
|
1152
|
+
for aa in font_sizes:
|
|
1153
|
+
rrr = "size%d" % int(aa);
|
|
1154
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1155
|
+
try:
|
|
1156
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
1157
|
+
self.textbuffer.set_modified(1)
|
|
1158
|
+
except:
|
|
1159
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())
|
|
1160
|
+
|
|
1161
|
+
def combo_sel2(self, sel):
|
|
1162
|
+
#print("combo_sel2", sel)
|
|
1163
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1164
|
+
|
|
1165
|
+
if not len(bounds):
|
|
1166
|
+
if self.statstr:
|
|
1167
|
+
self.statstr.set_text("No selection")
|
|
1168
|
+
#print("No selection")
|
|
1169
|
+
return
|
|
1170
|
+
else:
|
|
1171
|
+
# Clear out old colors
|
|
1172
|
+
start, end = bounds
|
|
1173
|
+
for cc in range(len(font_colors)):
|
|
1174
|
+
rrr = "color%d" % cc
|
|
1175
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1176
|
+
|
|
1177
|
+
# Find out the offset:
|
|
1178
|
+
cnt = 0
|
|
1179
|
+
for aa, bb in font_colors:
|
|
1180
|
+
if aa == sel:
|
|
1181
|
+
break
|
|
1182
|
+
cnt += 1
|
|
1183
|
+
nnn = "color%d" % cnt
|
|
1184
|
+
#print("nnn", nnn)
|
|
1185
|
+
start, end = bounds
|
|
1186
|
+
try:
|
|
1187
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
1188
|
+
self.textbuffer.set_modified(1)
|
|
1189
|
+
except:
|
|
1190
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())
|
|
1191
|
+
|
|
1192
|
+
def combo_sel3(self, sel):
|
|
1193
|
+
#print("combo_sel3", sel)
|
|
1194
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1195
|
+
|
|
1196
|
+
if not len(bounds):
|
|
1197
|
+
if self.statstr:
|
|
1198
|
+
self.statstr.set_text("No selection")
|
|
1199
|
+
#print("No selection")
|
|
1200
|
+
return
|
|
1201
|
+
else:
|
|
1202
|
+
start, end = bounds
|
|
1203
|
+
|
|
1204
|
+
# Clear out old colors
|
|
1205
|
+
for cc in range(len(font_colors)):
|
|
1206
|
+
rrr = "backgr%d" % cc
|
|
1207
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1208
|
+
|
|
1209
|
+
# Find out the offset:
|
|
1210
|
+
cnt = 0
|
|
1211
|
+
for aa, bb in font_colors:
|
|
1212
|
+
if aa == sel:
|
|
1213
|
+
break
|
|
1214
|
+
cnt += 1
|
|
1215
|
+
|
|
1216
|
+
nnn = "backgr%d" % cnt
|
|
1217
|
+
#print("nnn", nnn)
|
|
1218
|
+
|
|
1219
|
+
try:
|
|
1220
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
1221
|
+
self.textbuffer.set_modified(1)
|
|
1222
|
+
except:
|
|
1223
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
def on_zoom_clicked(self, arg1):
|
|
1227
|
+
|
|
1228
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
1229
|
+
myfd = pg.get_font_description()
|
|
1230
|
+
mysize = myfd.get_size() / Pango.SCALE
|
|
1231
|
+
|
|
1232
|
+
fd = Pango.FontDescription()
|
|
1233
|
+
fd.set_size((mysize + 1) * Pango.SCALE)
|
|
1234
|
+
self.textview.modify_font(fd)
|
|
1235
|
+
|
|
1236
|
+
def on_unzoom_clicked(self, arg1):
|
|
1237
|
+
|
|
1238
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
1239
|
+
myfd = pg.get_font_description()
|
|
1240
|
+
mysize = myfd.get_size() / Pango.SCALE
|
|
1241
|
+
|
|
1242
|
+
fd = Pango.FontDescription()
|
|
1243
|
+
fd.set_size((mysize - 1) * Pango.SCALE)
|
|
1244
|
+
self.textview.modify_font(fd)
|
|
1245
|
+
|
|
1246
|
+
def _create_textview(self):
|
|
1247
|
+
|
|
1248
|
+
self.textview = Gtk.TextView()
|
|
1249
|
+
self.textbuffer = self.textview.get_buffer()
|
|
1250
|
+
|
|
1251
|
+
scrolledwindow = Gtk.ScrolledWindow()
|
|
1252
|
+
scrolledwindow.set_hexpand(True)
|
|
1253
|
+
scrolledwindow.set_vexpand(True)
|
|
1254
|
+
self.grid.attach(scrolledwindow, 0, 2, 3, 1)
|
|
1255
|
+
|
|
1256
|
+
scrolledwindow.add(self.textview)
|
|
1257
|
+
|
|
1258
|
+
self.fd = Pango.FontDescription()
|
|
1259
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
1260
|
+
myfd = pg.get_font_description()
|
|
1261
|
+
self.mysize = myfd.get_size() / Pango.SCALE
|
|
1262
|
+
self.myfam = myfd.get_family()
|
|
1263
|
+
#print(self.mysize)
|
|
1264
|
+
|
|
1265
|
+
#self.textview.set_has_window(True)
|
|
1266
|
+
|
|
1267
|
+
#self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
1268
|
+
|
|
1269
|
+
self.tag_regular = self.textbuffer.create_tag("regular", size=self.mysize * Pango.SCALE)
|
|
1270
|
+
self.tag_super = self.textbuffer.create_tag("super", rise=5 * Pango.SCALE)
|
|
1271
|
+
self.tag_sub = self.textbuffer.create_tag("sub", rise=-5 * Pango.SCALE)
|
|
1272
|
+
self.tag_norm = self.textbuffer.create_tag("norm", weight=14*Pango.SCALE)
|
|
1273
|
+
self.tag_xbig = self.textbuffer.create_tag("xbig", size=30*Pango.SCALE)
|
|
1274
|
+
self.tag_big = self.textbuffer.create_tag("big", size=20*Pango.SCALE)
|
|
1275
|
+
#self.tag_red = self.textbuffer.create_tag("red", foreground="red")
|
|
1276
|
+
#self.tag_redbg = self.textbuffer.create_tag("redbg", background="red")
|
|
1277
|
+
self.tag_norm = self.textbuffer.create_tag("normal", style=Pango.Style.NORMAL)
|
|
1278
|
+
self.tag_bold = self.textbuffer.create_tag("bold", weight=Pango.Weight.BOLD)
|
|
1279
|
+
self.tag_italic = self.textbuffer.create_tag("italic", style=Pango.Style.ITALIC)
|
|
1280
|
+
self.tag_underline = self.textbuffer.create_tag("underline", underline=Pango.Underline.SINGLE)
|
|
1281
|
+
self.tag_found = self.textbuffer.create_tag("found", background="yellow")
|
|
1282
|
+
self.tag_left = self.textbuffer.create_tag("justleft", justification=Gtk.Justification.LEFT)
|
|
1283
|
+
self.tag_center = self.textbuffer.create_tag("justcent", justification=Gtk.Justification.CENTER)
|
|
1284
|
+
self.tag_right = self.textbuffer.create_tag("justright", justification=Gtk.Justification.RIGHT)
|
|
1285
|
+
self.tag_fill = self.textbuffer.create_tag("justfill", justification=Gtk.Justification.FILL)
|
|
1286
|
+
|
|
1287
|
+
self.textview.set_wrap_mode(Gtk.WrapMode.WORD)
|
|
1288
|
+
|
|
1289
|
+
# We create the attributes for all possible size tags
|
|
1290
|
+
for aa in font_sizes:
|
|
1291
|
+
nnn = "size%d" % int(aa);
|
|
1292
|
+
ttt = self.textbuffer.create_tag(nnn, size=int(aa) * Pango.SCALE)
|
|
1293
|
+
setattr(self, nnn, ttt)
|
|
1294
|
+
|
|
1295
|
+
# We create the attributes for all possible color tags
|
|
1296
|
+
cnt = 0
|
|
1297
|
+
for aa, bb in font_colors:
|
|
1298
|
+
print
|
|
1299
|
+
nnn = "color%d" % cnt;
|
|
1300
|
+
ttt = self.textbuffer.create_tag(nnn, foreground=aa)
|
|
1301
|
+
setattr(self, nnn, ttt)
|
|
1302
|
+
cnt += 1
|
|
1303
|
+
|
|
1304
|
+
cnt = 0
|
|
1305
|
+
for aa, bb in font_colors:
|
|
1306
|
+
nnn = "backgr%d" % int(cnt);
|
|
1307
|
+
ttt = self.textbuffer.create_tag(nnn, background=aa)
|
|
1308
|
+
setattr(self, nnn, ttt)
|
|
1309
|
+
cnt += 1
|
|
1310
|
+
|
|
1311
|
+
#print(dir(self))
|
|
1312
|
+
|
|
1313
|
+
def _create_buttons(self):
|
|
1314
|
+
|
|
1315
|
+
#check_editable = Gtk.CheckButton(label="Editable")
|
|
1316
|
+
#check_editable.set_active(True)
|
|
1317
|
+
#check_editable.connect("toggled", self.on_editable_toggled)
|
|
1318
|
+
#self.grid.attach(check_editable, 0, 2, 1, 1)
|
|
1319
|
+
##
|
|
1320
|
+
#check_cursor = Gtk.CheckButton(label="Cursor Visible")
|
|
1321
|
+
#check_cursor.set_active(True)
|
|
1322
|
+
#check_editable.connect("toggled", self.on_cursor_toggled)
|
|
1323
|
+
#self.grid.attach_next_to(
|
|
1324
|
+
# check_cursor, check_editable, Gtk.PositionType.RIGHT, 1, 1)
|
|
1325
|
+
|
|
1326
|
+
# ---------------------------------------------------------------------------------
|
|
1327
|
+
|
|
1328
|
+
radio_wrapword = Gtk.RadioButton.new_with_label_from_widget(None, "Word")
|
|
1329
|
+
self.grid.attach(radio_wrapword, 0, 3, 1, 1)
|
|
1330
|
+
|
|
1331
|
+
radio_wrapchar = Gtk.RadioButton.new_with_label_from_widget(radio_wrapword, "Character")
|
|
1332
|
+
self.grid.attach_next_to(
|
|
1333
|
+
radio_wrapchar, radio_wrapword, Gtk.PositionType.RIGHT, 1, 1)
|
|
1334
|
+
|
|
1335
|
+
radio_wrapnone = Gtk.RadioButton.new_with_label_from_widget(radio_wrapword, "None")
|
|
1336
|
+
self.grid.attach_next_to(
|
|
1337
|
+
radio_wrapnone, radio_wrapchar, Gtk.PositionType.RIGHT, 1, 1)
|
|
1338
|
+
|
|
1339
|
+
radio_wrapnone.connect("toggled", self.on_wrap_toggled, Gtk.WrapMode.NONE)
|
|
1340
|
+
radio_wrapchar.connect("toggled", self.on_wrap_toggled, Gtk.WrapMode.CHAR)
|
|
1341
|
+
radio_wrapword.connect("toggled", self.on_wrap_toggled, Gtk.WrapMode.WORD)
|
|
1342
|
+
|
|
1343
|
+
def get_text(self):
|
|
1344
|
+
startt = self.textbuffer.get_start_iter()
|
|
1345
|
+
endd = self.textbuffer.get_end_iter()
|
|
1346
|
+
txt = self.textbuffer.get_text(startt, endd, False)
|
|
1347
|
+
return txt
|
|
1348
|
+
|
|
1349
|
+
#def get_all(self):
|
|
1350
|
+
# print("Get_all called")
|
|
1351
|
+
# startt = self.buffer.get_start_iter()
|
|
1352
|
+
# endd = self.buffer.get_end_iter()
|
|
1353
|
+
# return self.buffer.get_text(startt, endd, True)
|
|
1354
|
+
|
|
1355
|
+
def get_modified(self):
|
|
1356
|
+
return self.textbuffer.get_modified()
|
|
1357
|
+
|
|
1358
|
+
def set_modified(self, valx):
|
|
1359
|
+
return self.textbuffer.set_modified(valx)
|
|
1360
|
+
|
|
1361
|
+
def set_text(self, txt):
|
|
1362
|
+
if self.textbuffer.get_modified():
|
|
1363
|
+
startt = self.textbuffer.get_start_iter()
|
|
1364
|
+
endd = self.textbuffer.get_end_iter()
|
|
1365
|
+
old = self.textbuffer.get_text(startt, endd, False)
|
|
1366
|
+
if self.callb:
|
|
1367
|
+
self.callb(old)
|
|
1368
|
+
#print("old_content", old)
|
|
1369
|
+
self.textbuffer.set_text(txt)
|
|
1370
|
+
|
|
1371
|
+
def on_rm_clicked(self, widget, tag):
|
|
1372
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1373
|
+
if len(bounds) != 0:
|
|
1374
|
+
start, end = bounds
|
|
1375
|
+
self.textbuffer.remove_all_tags(start, end)
|
|
1376
|
+
self.textbuffer.set_modified(1)
|
|
1377
|
+
|
|
1378
|
+
# This was the old clear -- now clearing ALL
|
|
1379
|
+
#self.textbuffer.remove_tag(self.tag_bold, start, end)
|
|
1380
|
+
#self.textbuffer.remove_tag(self.tag_italic, start, end)
|
|
1381
|
+
#self.textbuffer.remove_tag(self.tag_underline, start, end)
|
|
1382
|
+
#self.textbuffer.remove_tag(self.tag_red, start, end)
|
|
1383
|
+
#self.textbuffer.remove_tag(self.tag_redbg, start, end)
|
|
1384
|
+
#self.textbuffer.remove_tag(self.tag_big, start, end)
|
|
1385
|
+
#self.textbuffer.remove_tag(self.tag_xbig, start, end)
|
|
1386
|
+
#self.textbuffer.remove_tag(self.tag_regular, start, end)
|
|
1387
|
+
|
|
1388
|
+
def on_button_clicked(self, widget, tag):
|
|
1389
|
+
|
|
1390
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1391
|
+
if not len(bounds):
|
|
1392
|
+
if self.statstr:
|
|
1393
|
+
self.statstr.set_text("No style selection.")
|
|
1394
|
+
else:
|
|
1395
|
+
start, end = bounds
|
|
1396
|
+
#print("Apply Tag", tag, start, end)
|
|
1397
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
1398
|
+
self.textbuffer.set_modified(1)
|
|
1399
|
+
|
|
1400
|
+
def on_super_button(self, widget, tag):
|
|
1401
|
+
|
|
1402
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1403
|
+
if not len(bounds):
|
|
1404
|
+
if self.statstr:
|
|
1405
|
+
self.statstr.set_text("No style selection.")
|
|
1406
|
+
else:
|
|
1407
|
+
start, end = bounds
|
|
1408
|
+
|
|
1409
|
+
self.textbuffer.remove_tag(self.tag_super, start, end)
|
|
1410
|
+
self.textbuffer.remove_tag(self.tag_sub, start, end)
|
|
1411
|
+
|
|
1412
|
+
#print("Apply Tag", tag, start, end)
|
|
1413
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
1414
|
+
self.textbuffer.set_modified(1)
|
|
1415
|
+
|
|
1416
|
+
def on_size_button(self, widget, tag):
|
|
1417
|
+
|
|
1418
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1419
|
+
if not len(bounds):
|
|
1420
|
+
if self.statstr:
|
|
1421
|
+
self.statstr.set_text("No style selection.")
|
|
1422
|
+
else:
|
|
1423
|
+
start, end = bounds
|
|
1424
|
+
|
|
1425
|
+
self.textbuffer.remove_tag(self.tag_super, start, end)
|
|
1426
|
+
self.textbuffer.remove_tag(self.tag_sub, start, end)
|
|
1427
|
+
|
|
1428
|
+
#print("Apply Tag", tag, start, end)
|
|
1429
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
1430
|
+
self.textbuffer.set_modified(1)
|
|
1431
|
+
|
|
1432
|
+
def on_clear_clicked(self, widget):
|
|
1433
|
+
start = self.textbuffer.get_start_iter()
|
|
1434
|
+
end = self.textbuffer.get_end_iter()
|
|
1435
|
+
self.textbuffer.remove_all_tags(start, end)
|
|
1436
|
+
self.textbuffer.set_modified(1)
|
|
1437
|
+
|
|
1438
|
+
def on_editable_toggled(self, widget):
|
|
1439
|
+
self.textview.set_editable(widget.get_active())
|
|
1440
|
+
self.textbuffer.set_modified(1)
|
|
1441
|
+
|
|
1442
|
+
def on_cursor_toggled(self, widget):
|
|
1443
|
+
self.textview.set_cursor_visible(widget.get_active())
|
|
1444
|
+
|
|
1445
|
+
def on_wrap_toggled(self, widget, mode):
|
|
1446
|
+
self.textview.set_wrap_mode(mode)
|
|
1447
|
+
|
|
1448
|
+
def on_justify_toggled(self, widget, justification):
|
|
1449
|
+
#print("on_justify_toggled", justification)
|
|
1450
|
+
#self.textview.set_justification(justification)
|
|
1451
|
+
#start = self.textbuffer.get_start_iter()
|
|
1452
|
+
#end = self.textbuffer.get_end_iter()
|
|
1453
|
+
|
|
1454
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1455
|
+
if not len(bounds):
|
|
1456
|
+
if self.statstr:
|
|
1457
|
+
self.statstr.set_text("No selection.")
|
|
1458
|
+
else:
|
|
1459
|
+
start, end = bounds
|
|
1460
|
+
#print("Apply Just Tag", justification, start, end)
|
|
1461
|
+
|
|
1462
|
+
# Remove old justification
|
|
1463
|
+
self.textbuffer.remove_tag(self.tag_left, start, end)
|
|
1464
|
+
self.textbuffer.remove_tag(self.tag_center, start, end)
|
|
1465
|
+
self.textbuffer.remove_tag(self.tag_right, start, end)
|
|
1466
|
+
self.textbuffer.remove_tag(self.tag_fill, start, end)
|
|
1467
|
+
|
|
1468
|
+
self.textbuffer.apply_tag(justification, start, end)
|
|
1469
|
+
self.textbuffer.set_modified(1)
|
|
1470
|
+
|
|
1471
|
+
def on_search_clicked(self, widget):
|
|
1472
|
+
|
|
1473
|
+
if self.findcall:
|
|
1474
|
+
# Call with object argument
|
|
1475
|
+
self.findcall[0](self.findcall[1])
|
|
1476
|
+
|
|
1477
|
+
dialog.destroy()
|
|
1478
|
+
|
|
1479
|
+
def search_and_mark(self, text, start):
|
|
1480
|
+
end = self.textbuffer.get_end_iter()
|
|
1481
|
+
match = start.forward_search(text, 0, end)
|
|
1482
|
+
|
|
1483
|
+
if match is not None:
|
|
1484
|
+
match_start, match_end = match
|
|
1485
|
+
self.textbuffer.apply_tag(self.tag_found, match_start, match_end)
|
|
1486
|
+
self.search_and_mark(text, match_end)
|
|
1487
|
+
|
|
1488
|
+
# --------------------------------------------------------------------
|
|
1489
|
+
# Load it here
|
|
1490
|
+
|
|
1491
|
+
def deser_buff(self, buffx):
|
|
1492
|
+
|
|
1493
|
+
if not buffx:
|
|
1494
|
+
return
|
|
1495
|
+
|
|
1496
|
+
#print("UnSer buff")
|
|
1497
|
+
|
|
1498
|
+
fmt = self.textbuffer.register_deserialize_tagset()
|
|
1499
|
+
self.textbuffer.deserialize_set_can_create_tags(fmt, True)
|
|
1500
|
+
self.textbuffer.deserialize(self.textbuffer, fmt,
|
|
1501
|
+
self.textbuffer.get_start_iter(), buffx)
|
|
1502
|
+
self.textbuffer.set_modified(0)
|
|
1503
|
+
|
|
1504
|
+
# --------------------------------------------------------------------
|
|
1505
|
+
# Save it here
|
|
1506
|
+
|
|
1507
|
+
def ser_buff(self):
|
|
1508
|
+
|
|
1509
|
+
#print("Ser buff")
|
|
1510
|
+
|
|
1511
|
+
startt = self.textbuffer.get_start_iter()
|
|
1512
|
+
endd = self.textbuffer.get_end_iter()
|
|
1513
|
+
|
|
1514
|
+
fmt = self.textbuffer.register_serialize_tagset()
|
|
1515
|
+
sss = self.textbuffer.serialize(self.textbuffer, fmt, startt, endd)
|
|
1516
|
+
if not sss: sss = b""
|
|
1517
|
+
return sss
|
|
1518
|
+
|
|
1519
|
+
# Print TextTag (testing)
|
|
1520
|
+
def ptag(self, ttt, tt):
|
|
1521
|
+
|
|
1522
|
+
global cnt # Print only one
|
|
1523
|
+
if cnt: return
|
|
1524
|
+
cnt += 1
|
|
1525
|
+
|
|
1526
|
+
print(ttt)
|
|
1527
|
+
#print(dir(ttt))
|
|
1528
|
+
ll = ttt.list_properties()
|
|
1529
|
+
for aa in ll:
|
|
1530
|
+
#print(nnnn, end= " ")
|
|
1531
|
+
try:
|
|
1532
|
+
nn = tt.lookup(aa.name)
|
|
1533
|
+
if nn:
|
|
1534
|
+
#nnn = nn.get_property("size")
|
|
1535
|
+
#print("size", nnn)
|
|
1536
|
+
|
|
1537
|
+
lll = nn.list_properties()
|
|
1538
|
+
for bb in lll:
|
|
1539
|
+
nnn = bb.name #get_property("name")
|
|
1540
|
+
try:
|
|
1541
|
+
pp = nn.get_property(nnn)
|
|
1542
|
+
except:
|
|
1543
|
+
pass
|
|
1544
|
+
print(aa.name, "prop", "'" + nnn + "'" , "val =", pp)
|
|
1545
|
+
print()
|
|
1546
|
+
|
|
1547
|
+
except:
|
|
1548
|
+
print(sys.exc_info())
|
|
1549
|
+
pass
|
|
1550
|
+
#print()
|
|
1551
|
+
|
|
1552
|
+
return
|
|
1553
|
+
|
|
1554
|
+
# --------------------------------------------------------------------
|
|
1555
|
+
|
|
1556
|
+
def print_tags(self):
|
|
1557
|
+
|
|
1558
|
+
#startt = self.textbuffer.get_start_iter()
|
|
1559
|
+
#endd = self.textbuffer.get_end_iter()
|
|
1560
|
+
|
|
1561
|
+
# TagTable
|
|
1562
|
+
#tt = self.textbuffer.get_property("tag-table")
|
|
1563
|
+
#print("table", tt)
|
|
1564
|
+
|
|
1565
|
+
tt = self.textbuffer.get_tag_table()
|
|
1566
|
+
print("table", tt)
|
|
1567
|
+
tt.foreach(self.ptag, tt)
|
|
1568
|
+
print()
|
|
1569
|
+
|
|
1570
|
+
return
|
|
1571
|
+
|
|
1572
|
+
txt = self.textbuffer.get_text(startt, endd, False)
|
|
1573
|
+
lc = self.textbuffer.get_char_count()
|
|
1574
|
+
for aa in range(lc):
|
|
1575
|
+
iii = self.textbuffer.get_iter_at_offset(aa)
|
|
1576
|
+
eee = self.textbuffer.get_iter_at_offset(aa+1)
|
|
1577
|
+
ccc = self.textbuffer.get_text(iii, eee, False)
|
|
1578
|
+
#print("aa", ccc)
|
|
1579
|
+
|
|
1580
|
+
return txt
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
#all = self.edview.get_all()
|
|
1584
|
+
#print("serialize", self.edview.textbuffer.get_deserialize_formats())
|
|
1585
|
+
#print("str", self.edview.serial_str())
|
|
1586
|
+
#print("serialize", self.edview.textbuffer.get_deserialize_formats())
|
|
1587
|
+
|
|
1588
|
+
#vv = self.edview.textbuffer
|
|
1589
|
+
#startt = vv.get_start_iter(); endd = vv.get_end_iter()
|
|
1590
|
+
#while True:
|
|
1591
|
+
# prev = startt.copy()
|
|
1592
|
+
# nextok = startt.forward_line()
|
|
1593
|
+
# ttt = vv.get_text(prev, startt, False)
|
|
1594
|
+
# prevc = prev.copy()
|
|
1595
|
+
# while True:
|
|
1596
|
+
# sss = prevc.get_toggled_tags(True)
|
|
1597
|
+
# if sss:
|
|
1598
|
+
# print("tags on toggle", sss)
|
|
1599
|
+
# for cc in sss:
|
|
1600
|
+
# print("cc", cc.get_property("name"))
|
|
1601
|
+
# print("pos", prevc.get_line(), prevc.get_line_offset())
|
|
1602
|
+
# beg = prevc.copy()
|
|
1603
|
+
# nextokc = prevc.forward_char()
|
|
1604
|
+
# if not nextokc:
|
|
1605
|
+
# break
|
|
1606
|
+
# if startt == prevc:
|
|
1607
|
+
# break
|
|
1608
|
+
# chh = vv.get_text(beg, prevc, False)
|
|
1609
|
+
# print(chh, end="")
|
|
1610
|
+
#
|
|
1611
|
+
# #print("tags", prev.get_tags())
|
|
1612
|
+
# #print("line:", ttt, end="")
|
|
1613
|
+
# if not nextok:
|
|
1614
|
+
# break
|
|
1615
|
+
#
|
|
1616
|
+
##print("tags:", self.edview.textbuffer.get_tags())</code></pre>
|
|
1617
|
+
</details>
|
|
1618
|
+
<h3>Ancestors</h3>
|
|
1619
|
+
<ul class="hlist">
|
|
1620
|
+
<li>gi.repository.Gtk.VBox</li>
|
|
1621
|
+
<li>gi.overrides.Gtk.Box</li>
|
|
1622
|
+
<li>gi.repository.Gtk.Box</li>
|
|
1623
|
+
<li>gi.overrides.Gtk.Container</li>
|
|
1624
|
+
<li>gi.repository.Gtk.Container</li>
|
|
1625
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
1626
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
1627
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
1628
|
+
<li>gi.overrides.GObject.Object</li>
|
|
1629
|
+
<li>gi.repository.GObject.Object</li>
|
|
1630
|
+
<li>gi._gi.GObject</li>
|
|
1631
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
1632
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
1633
|
+
<li>gi.repository.Gtk.Orientable</li>
|
|
1634
|
+
<li>gobject.GInterface</li>
|
|
1635
|
+
</ul>
|
|
1636
|
+
<h3>Methods</h3>
|
|
1637
|
+
<dl>
|
|
1638
|
+
<dt id="pgtextview.pgTextView.area_button"><code class="name flex">
|
|
1639
|
+
<span>def <span class="ident">area_button</span></span>(<span>self, but, event)</span>
|
|
1640
|
+
</code></dt>
|
|
1641
|
+
<dd>
|
|
1642
|
+
<div class="desc"></div>
|
|
1643
|
+
<details class="source">
|
|
1644
|
+
<summary>
|
|
1645
|
+
<span>Expand source code</span>
|
|
1646
|
+
</summary>
|
|
1647
|
+
<pre><code class="python">def area_button(self, but, event):
|
|
1648
|
+
#print("click", event.x, event.y)
|
|
1649
|
+
# textview
|
|
1650
|
+
endd = self.textbuffer.get_end_iter()
|
|
1651
|
+
isx, iter = self.textview.get_iter_at_location(event.x, event.y)
|
|
1652
|
+
if isx:
|
|
1653
|
+
txt = self.textbuffer.get_text(iter, endd, False)
|
|
1654
|
+
#print("[", txt[:4], "]")
|
|
1655
|
+
|
|
1656
|
+
#defvals = self.textview.get_default_attributes()
|
|
1657
|
+
#print(defvals.appearance.rise)
|
|
1658
|
+
|
|
1659
|
+
#ixy, attr = iter.get_attributes()
|
|
1660
|
+
#if ixy:
|
|
1661
|
+
# #attr.ref()
|
|
1662
|
+
# #print(attr.refcount)
|
|
1663
|
+
# print(dir(attr))
|
|
1664
|
+
# #print(attr.refcount)
|
|
1665
|
+
# #print(attr.appearance.rise)
|
|
1666
|
+
# attr.unref()
|
|
1667
|
+
#else:
|
|
1668
|
+
# print("no artt")
|
|
1669
|
+
|
|
1670
|
+
#attr.unref()</code></pre>
|
|
1671
|
+
</details>
|
|
1672
|
+
</dd>
|
|
1673
|
+
<dt id="pgtextview.pgTextView.area_curs"><code class="name flex">
|
|
1674
|
+
<span>def <span class="ident">area_curs</span></span>(<span>self, ext_view, step, count, extend_selection)</span>
|
|
1675
|
+
</code></dt>
|
|
1676
|
+
<dd>
|
|
1677
|
+
<div class="desc"></div>
|
|
1678
|
+
<details class="source">
|
|
1679
|
+
<summary>
|
|
1680
|
+
<span>Expand source code</span>
|
|
1681
|
+
</summary>
|
|
1682
|
+
<pre><code class="python">def area_curs(self, ext_view, step, count, extend_selection):
|
|
1683
|
+
#print("step", step, "count", count)
|
|
1684
|
+
pass</code></pre>
|
|
1685
|
+
</details>
|
|
1686
|
+
</dd>
|
|
1687
|
+
<dt id="pgtextview.pgTextView.area_key"><code class="name flex">
|
|
1688
|
+
<span>def <span class="ident">area_key</span></span>(<span>self, widget, event)</span>
|
|
1689
|
+
</code></dt>
|
|
1690
|
+
<dd>
|
|
1691
|
+
<div class="desc"></div>
|
|
1692
|
+
<details class="source">
|
|
1693
|
+
<summary>
|
|
1694
|
+
<span>Expand source code</span>
|
|
1695
|
+
</summary>
|
|
1696
|
+
<pre><code class="python">def area_key(self, widget, event):
|
|
1697
|
+
#print("TextViewWin keypress", event.string, event.keyval)
|
|
1698
|
+
if event.state & Gdk.ModifierType.CONTROL_MASK:
|
|
1699
|
+
print("TextViewWin control keypress", event.string, event.keyval)
|
|
1700
|
+
|
|
1701
|
+
if event.keyval == 102:
|
|
1702
|
+
#print("control find")
|
|
1703
|
+
if self.findcall:
|
|
1704
|
+
# Call with object argument
|
|
1705
|
+
self.findcall[0](self.findcall[1])</code></pre>
|
|
1706
|
+
</details>
|
|
1707
|
+
</dd>
|
|
1708
|
+
<dt id="pgtextview.pgTextView.combo_sel"><code class="name flex">
|
|
1709
|
+
<span>def <span class="ident">combo_sel</span></span>(<span>self, sel)</span>
|
|
1710
|
+
</code></dt>
|
|
1711
|
+
<dd>
|
|
1712
|
+
<div class="desc"></div>
|
|
1713
|
+
<details class="source">
|
|
1714
|
+
<summary>
|
|
1715
|
+
<span>Expand source code</span>
|
|
1716
|
+
</summary>
|
|
1717
|
+
<pre><code class="python">def combo_sel(self, sel):
|
|
1718
|
+
#print("combo_sel", sel)
|
|
1719
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1720
|
+
if not len(bounds):
|
|
1721
|
+
if self.statstr:
|
|
1722
|
+
self.statstr.set_text("No selection")
|
|
1723
|
+
#print("No selection")
|
|
1724
|
+
return
|
|
1725
|
+
else:
|
|
1726
|
+
nnn = "size%d" % int(sel);
|
|
1727
|
+
start, end = bounds
|
|
1728
|
+
|
|
1729
|
+
# Femove size tags from here
|
|
1730
|
+
for aa in font_sizes:
|
|
1731
|
+
rrr = "size%d" % int(aa);
|
|
1732
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1733
|
+
try:
|
|
1734
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
1735
|
+
self.textbuffer.set_modified(1)
|
|
1736
|
+
except:
|
|
1737
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())</code></pre>
|
|
1738
|
+
</details>
|
|
1739
|
+
</dd>
|
|
1740
|
+
<dt id="pgtextview.pgTextView.combo_sel2"><code class="name flex">
|
|
1741
|
+
<span>def <span class="ident">combo_sel2</span></span>(<span>self, sel)</span>
|
|
1742
|
+
</code></dt>
|
|
1743
|
+
<dd>
|
|
1744
|
+
<div class="desc"></div>
|
|
1745
|
+
<details class="source">
|
|
1746
|
+
<summary>
|
|
1747
|
+
<span>Expand source code</span>
|
|
1748
|
+
</summary>
|
|
1749
|
+
<pre><code class="python">def combo_sel2(self, sel):
|
|
1750
|
+
#print("combo_sel2", sel)
|
|
1751
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1752
|
+
|
|
1753
|
+
if not len(bounds):
|
|
1754
|
+
if self.statstr:
|
|
1755
|
+
self.statstr.set_text("No selection")
|
|
1756
|
+
#print("No selection")
|
|
1757
|
+
return
|
|
1758
|
+
else:
|
|
1759
|
+
# Clear out old colors
|
|
1760
|
+
start, end = bounds
|
|
1761
|
+
for cc in range(len(font_colors)):
|
|
1762
|
+
rrr = "color%d" % cc
|
|
1763
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1764
|
+
|
|
1765
|
+
# Find out the offset:
|
|
1766
|
+
cnt = 0
|
|
1767
|
+
for aa, bb in font_colors:
|
|
1768
|
+
if aa == sel:
|
|
1769
|
+
break
|
|
1770
|
+
cnt += 1
|
|
1771
|
+
nnn = "color%d" % cnt
|
|
1772
|
+
#print("nnn", nnn)
|
|
1773
|
+
start, end = bounds
|
|
1774
|
+
try:
|
|
1775
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
1776
|
+
self.textbuffer.set_modified(1)
|
|
1777
|
+
except:
|
|
1778
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())</code></pre>
|
|
1779
|
+
</details>
|
|
1780
|
+
</dd>
|
|
1781
|
+
<dt id="pgtextview.pgTextView.combo_sel3"><code class="name flex">
|
|
1782
|
+
<span>def <span class="ident">combo_sel3</span></span>(<span>self, sel)</span>
|
|
1783
|
+
</code></dt>
|
|
1784
|
+
<dd>
|
|
1785
|
+
<div class="desc"></div>
|
|
1786
|
+
<details class="source">
|
|
1787
|
+
<summary>
|
|
1788
|
+
<span>Expand source code</span>
|
|
1789
|
+
</summary>
|
|
1790
|
+
<pre><code class="python">def combo_sel3(self, sel):
|
|
1791
|
+
#print("combo_sel3", sel)
|
|
1792
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1793
|
+
|
|
1794
|
+
if not len(bounds):
|
|
1795
|
+
if self.statstr:
|
|
1796
|
+
self.statstr.set_text("No selection")
|
|
1797
|
+
#print("No selection")
|
|
1798
|
+
return
|
|
1799
|
+
else:
|
|
1800
|
+
start, end = bounds
|
|
1801
|
+
|
|
1802
|
+
# Clear out old colors
|
|
1803
|
+
for cc in range(len(font_colors)):
|
|
1804
|
+
rrr = "backgr%d" % cc
|
|
1805
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
1806
|
+
|
|
1807
|
+
# Find out the offset:
|
|
1808
|
+
cnt = 0
|
|
1809
|
+
for aa, bb in font_colors:
|
|
1810
|
+
if aa == sel:
|
|
1811
|
+
break
|
|
1812
|
+
cnt += 1
|
|
1813
|
+
|
|
1814
|
+
nnn = "backgr%d" % cnt
|
|
1815
|
+
#print("nnn", nnn)
|
|
1816
|
+
|
|
1817
|
+
try:
|
|
1818
|
+
self.textbuffer.apply_tag(getattr(self, nnn), start, end)
|
|
1819
|
+
self.textbuffer.set_modified(1)
|
|
1820
|
+
except:
|
|
1821
|
+
print("Cannot apply size tag ", nnn, sys.exc_info())</code></pre>
|
|
1822
|
+
</details>
|
|
1823
|
+
</dd>
|
|
1824
|
+
<dt id="pgtextview.pgTextView.deser_buff"><code class="name flex">
|
|
1825
|
+
<span>def <span class="ident">deser_buff</span></span>(<span>self, buffx)</span>
|
|
1826
|
+
</code></dt>
|
|
1827
|
+
<dd>
|
|
1828
|
+
<div class="desc"></div>
|
|
1829
|
+
<details class="source">
|
|
1830
|
+
<summary>
|
|
1831
|
+
<span>Expand source code</span>
|
|
1832
|
+
</summary>
|
|
1833
|
+
<pre><code class="python">def deser_buff(self, buffx):
|
|
1834
|
+
|
|
1835
|
+
if not buffx:
|
|
1836
|
+
return
|
|
1837
|
+
|
|
1838
|
+
#print("UnSer buff")
|
|
1839
|
+
|
|
1840
|
+
fmt = self.textbuffer.register_deserialize_tagset()
|
|
1841
|
+
self.textbuffer.deserialize_set_can_create_tags(fmt, True)
|
|
1842
|
+
self.textbuffer.deserialize(self.textbuffer, fmt,
|
|
1843
|
+
self.textbuffer.get_start_iter(), buffx)
|
|
1844
|
+
self.textbuffer.set_modified(0)</code></pre>
|
|
1845
|
+
</details>
|
|
1846
|
+
</dd>
|
|
1847
|
+
<dt id="pgtextview.pgTextView.get_modified"><code class="name flex">
|
|
1848
|
+
<span>def <span class="ident">get_modified</span></span>(<span>self)</span>
|
|
1849
|
+
</code></dt>
|
|
1850
|
+
<dd>
|
|
1851
|
+
<div class="desc"></div>
|
|
1852
|
+
<details class="source">
|
|
1853
|
+
<summary>
|
|
1854
|
+
<span>Expand source code</span>
|
|
1855
|
+
</summary>
|
|
1856
|
+
<pre><code class="python">def get_modified(self):
|
|
1857
|
+
return self.textbuffer.get_modified()</code></pre>
|
|
1858
|
+
</details>
|
|
1859
|
+
</dd>
|
|
1860
|
+
<dt id="pgtextview.pgTextView.get_text"><code class="name flex">
|
|
1861
|
+
<span>def <span class="ident">get_text</span></span>(<span>self)</span>
|
|
1862
|
+
</code></dt>
|
|
1863
|
+
<dd>
|
|
1864
|
+
<div class="desc"></div>
|
|
1865
|
+
<details class="source">
|
|
1866
|
+
<summary>
|
|
1867
|
+
<span>Expand source code</span>
|
|
1868
|
+
</summary>
|
|
1869
|
+
<pre><code class="python">def get_text(self):
|
|
1870
|
+
startt = self.textbuffer.get_start_iter()
|
|
1871
|
+
endd = self.textbuffer.get_end_iter()
|
|
1872
|
+
txt = self.textbuffer.get_text(startt, endd, False)
|
|
1873
|
+
return txt</code></pre>
|
|
1874
|
+
</details>
|
|
1875
|
+
</dd>
|
|
1876
|
+
<dt id="pgtextview.pgTextView.on_button_clicked"><code class="name flex">
|
|
1877
|
+
<span>def <span class="ident">on_button_clicked</span></span>(<span>self, widget, tag)</span>
|
|
1878
|
+
</code></dt>
|
|
1879
|
+
<dd>
|
|
1880
|
+
<div class="desc"></div>
|
|
1881
|
+
<details class="source">
|
|
1882
|
+
<summary>
|
|
1883
|
+
<span>Expand source code</span>
|
|
1884
|
+
</summary>
|
|
1885
|
+
<pre><code class="python">def on_button_clicked(self, widget, tag):
|
|
1886
|
+
|
|
1887
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1888
|
+
if not len(bounds):
|
|
1889
|
+
if self.statstr:
|
|
1890
|
+
self.statstr.set_text("No style selection.")
|
|
1891
|
+
else:
|
|
1892
|
+
start, end = bounds
|
|
1893
|
+
#print("Apply Tag", tag, start, end)
|
|
1894
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
1895
|
+
self.textbuffer.set_modified(1)</code></pre>
|
|
1896
|
+
</details>
|
|
1897
|
+
</dd>
|
|
1898
|
+
<dt id="pgtextview.pgTextView.on_clear_clicked"><code class="name flex">
|
|
1899
|
+
<span>def <span class="ident">on_clear_clicked</span></span>(<span>self, widget)</span>
|
|
1900
|
+
</code></dt>
|
|
1901
|
+
<dd>
|
|
1902
|
+
<div class="desc"></div>
|
|
1903
|
+
<details class="source">
|
|
1904
|
+
<summary>
|
|
1905
|
+
<span>Expand source code</span>
|
|
1906
|
+
</summary>
|
|
1907
|
+
<pre><code class="python">def on_clear_clicked(self, widget):
|
|
1908
|
+
start = self.textbuffer.get_start_iter()
|
|
1909
|
+
end = self.textbuffer.get_end_iter()
|
|
1910
|
+
self.textbuffer.remove_all_tags(start, end)
|
|
1911
|
+
self.textbuffer.set_modified(1)</code></pre>
|
|
1912
|
+
</details>
|
|
1913
|
+
</dd>
|
|
1914
|
+
<dt id="pgtextview.pgTextView.on_combo_clicked"><code class="name flex">
|
|
1915
|
+
<span>def <span class="ident">on_combo_clicked</span></span>(<span>self, arg1, arg2)</span>
|
|
1916
|
+
</code></dt>
|
|
1917
|
+
<dd>
|
|
1918
|
+
<div class="desc"></div>
|
|
1919
|
+
<details class="source">
|
|
1920
|
+
<summary>
|
|
1921
|
+
<span>Expand source code</span>
|
|
1922
|
+
</summary>
|
|
1923
|
+
<pre><code class="python">def on_combo_clicked(self, arg1, arg2):
|
|
1924
|
+
#print("on_combo_clicked")
|
|
1925
|
+
#cont = ("12", "32", "64")
|
|
1926
|
+
#combo_box = pgbox.ComboBox(cont)
|
|
1927
|
+
#combo_box.show()
|
|
1928
|
+
pass</code></pre>
|
|
1929
|
+
</details>
|
|
1930
|
+
</dd>
|
|
1931
|
+
<dt id="pgtextview.pgTextView.on_cursor_toggled"><code class="name flex">
|
|
1932
|
+
<span>def <span class="ident">on_cursor_toggled</span></span>(<span>self, widget)</span>
|
|
1933
|
+
</code></dt>
|
|
1934
|
+
<dd>
|
|
1935
|
+
<div class="desc"></div>
|
|
1936
|
+
<details class="source">
|
|
1937
|
+
<summary>
|
|
1938
|
+
<span>Expand source code</span>
|
|
1939
|
+
</summary>
|
|
1940
|
+
<pre><code class="python">def on_cursor_toggled(self, widget):
|
|
1941
|
+
self.textview.set_cursor_visible(widget.get_active())</code></pre>
|
|
1942
|
+
</details>
|
|
1943
|
+
</dd>
|
|
1944
|
+
<dt id="pgtextview.pgTextView.on_editable_toggled"><code class="name flex">
|
|
1945
|
+
<span>def <span class="ident">on_editable_toggled</span></span>(<span>self, widget)</span>
|
|
1946
|
+
</code></dt>
|
|
1947
|
+
<dd>
|
|
1948
|
+
<div class="desc"></div>
|
|
1949
|
+
<details class="source">
|
|
1950
|
+
<summary>
|
|
1951
|
+
<span>Expand source code</span>
|
|
1952
|
+
</summary>
|
|
1953
|
+
<pre><code class="python">def on_editable_toggled(self, widget):
|
|
1954
|
+
self.textview.set_editable(widget.get_active())
|
|
1955
|
+
self.textbuffer.set_modified(1)</code></pre>
|
|
1956
|
+
</details>
|
|
1957
|
+
</dd>
|
|
1958
|
+
<dt id="pgtextview.pgTextView.on_justify_toggled"><code class="name flex">
|
|
1959
|
+
<span>def <span class="ident">on_justify_toggled</span></span>(<span>self, widget, justification)</span>
|
|
1960
|
+
</code></dt>
|
|
1961
|
+
<dd>
|
|
1962
|
+
<div class="desc"></div>
|
|
1963
|
+
<details class="source">
|
|
1964
|
+
<summary>
|
|
1965
|
+
<span>Expand source code</span>
|
|
1966
|
+
</summary>
|
|
1967
|
+
<pre><code class="python">def on_justify_toggled(self, widget, justification):
|
|
1968
|
+
#print("on_justify_toggled", justification)
|
|
1969
|
+
#self.textview.set_justification(justification)
|
|
1970
|
+
#start = self.textbuffer.get_start_iter()
|
|
1971
|
+
#end = self.textbuffer.get_end_iter()
|
|
1972
|
+
|
|
1973
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
1974
|
+
if not len(bounds):
|
|
1975
|
+
if self.statstr:
|
|
1976
|
+
self.statstr.set_text("No selection.")
|
|
1977
|
+
else:
|
|
1978
|
+
start, end = bounds
|
|
1979
|
+
#print("Apply Just Tag", justification, start, end)
|
|
1980
|
+
|
|
1981
|
+
# Remove old justification
|
|
1982
|
+
self.textbuffer.remove_tag(self.tag_left, start, end)
|
|
1983
|
+
self.textbuffer.remove_tag(self.tag_center, start, end)
|
|
1984
|
+
self.textbuffer.remove_tag(self.tag_right, start, end)
|
|
1985
|
+
self.textbuffer.remove_tag(self.tag_fill, start, end)
|
|
1986
|
+
|
|
1987
|
+
self.textbuffer.apply_tag(justification, start, end)
|
|
1988
|
+
self.textbuffer.set_modified(1)</code></pre>
|
|
1989
|
+
</details>
|
|
1990
|
+
</dd>
|
|
1991
|
+
<dt id="pgtextview.pgTextView.on_rm_clicked"><code class="name flex">
|
|
1992
|
+
<span>def <span class="ident">on_rm_clicked</span></span>(<span>self, widget, tag)</span>
|
|
1993
|
+
</code></dt>
|
|
1994
|
+
<dd>
|
|
1995
|
+
<div class="desc"></div>
|
|
1996
|
+
<details class="source">
|
|
1997
|
+
<summary>
|
|
1998
|
+
<span>Expand source code</span>
|
|
1999
|
+
</summary>
|
|
2000
|
+
<pre><code class="python">def on_rm_clicked(self, widget, tag):
|
|
2001
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
2002
|
+
if len(bounds) != 0:
|
|
2003
|
+
start, end = bounds
|
|
2004
|
+
self.textbuffer.remove_all_tags(start, end)
|
|
2005
|
+
self.textbuffer.set_modified(1)
|
|
2006
|
+
|
|
2007
|
+
# This was the old clear -- now clearing ALL
|
|
2008
|
+
#self.textbuffer.remove_tag(self.tag_bold, start, end)
|
|
2009
|
+
#self.textbuffer.remove_tag(self.tag_italic, start, end)
|
|
2010
|
+
#self.textbuffer.remove_tag(self.tag_underline, start, end)
|
|
2011
|
+
#self.textbuffer.remove_tag(self.tag_red, start, end)
|
|
2012
|
+
#self.textbuffer.remove_tag(self.tag_redbg, start, end)
|
|
2013
|
+
#self.textbuffer.remove_tag(self.tag_big, start, end)
|
|
2014
|
+
#self.textbuffer.remove_tag(self.tag_xbig, start, end)
|
|
2015
|
+
#self.textbuffer.remove_tag(self.tag_regular, start, end)</code></pre>
|
|
2016
|
+
</details>
|
|
2017
|
+
</dd>
|
|
2018
|
+
<dt id="pgtextview.pgTextView.on_rm_color"><code class="name flex">
|
|
2019
|
+
<span>def <span class="ident">on_rm_color</span></span>(<span>self, arg1)</span>
|
|
2020
|
+
</code></dt>
|
|
2021
|
+
<dd>
|
|
2022
|
+
<div class="desc"></div>
|
|
2023
|
+
<details class="source">
|
|
2024
|
+
<summary>
|
|
2025
|
+
<span>Expand source code</span>
|
|
2026
|
+
</summary>
|
|
2027
|
+
<pre><code class="python">def on_rm_color(self, arg1):
|
|
2028
|
+
print( "on_rm_color", arg1)
|
|
2029
|
+
|
|
2030
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
2031
|
+
|
|
2032
|
+
if not len(bounds):
|
|
2033
|
+
if self.statstr:
|
|
2034
|
+
self.statstr.set_text("No selection")
|
|
2035
|
+
#print("No selection")
|
|
2036
|
+
return
|
|
2037
|
+
else:
|
|
2038
|
+
start, end = bounds
|
|
2039
|
+
|
|
2040
|
+
# Clear out old colors
|
|
2041
|
+
for cc in range(len(font_colors)):
|
|
2042
|
+
rrr = "backgr%d" % cc
|
|
2043
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
2044
|
+
|
|
2045
|
+
for cc in range(len(font_colors)):
|
|
2046
|
+
rrr = "color%d" % cc
|
|
2047
|
+
self.textbuffer.remove_tag(getattr(self, rrr), start, end)
|
|
2048
|
+
|
|
2049
|
+
self.textbuffer.set_modified(1)</code></pre>
|
|
2050
|
+
</details>
|
|
2051
|
+
</dd>
|
|
2052
|
+
<dt id="pgtextview.pgTextView.on_search_clicked"><code class="name flex">
|
|
2053
|
+
<span>def <span class="ident">on_search_clicked</span></span>(<span>self, widget)</span>
|
|
2054
|
+
</code></dt>
|
|
2055
|
+
<dd>
|
|
2056
|
+
<div class="desc"></div>
|
|
2057
|
+
<details class="source">
|
|
2058
|
+
<summary>
|
|
2059
|
+
<span>Expand source code</span>
|
|
2060
|
+
</summary>
|
|
2061
|
+
<pre><code class="python">def on_search_clicked(self, widget):
|
|
2062
|
+
|
|
2063
|
+
if self.findcall:
|
|
2064
|
+
# Call with object argument
|
|
2065
|
+
self.findcall[0](self.findcall[1])
|
|
2066
|
+
|
|
2067
|
+
dialog.destroy()</code></pre>
|
|
2068
|
+
</details>
|
|
2069
|
+
</dd>
|
|
2070
|
+
<dt id="pgtextview.pgTextView.on_size_button"><code class="name flex">
|
|
2071
|
+
<span>def <span class="ident">on_size_button</span></span>(<span>self, widget, tag)</span>
|
|
2072
|
+
</code></dt>
|
|
2073
|
+
<dd>
|
|
2074
|
+
<div class="desc"></div>
|
|
2075
|
+
<details class="source">
|
|
2076
|
+
<summary>
|
|
2077
|
+
<span>Expand source code</span>
|
|
2078
|
+
</summary>
|
|
2079
|
+
<pre><code class="python">def on_size_button(self, widget, tag):
|
|
2080
|
+
|
|
2081
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
2082
|
+
if not len(bounds):
|
|
2083
|
+
if self.statstr:
|
|
2084
|
+
self.statstr.set_text("No style selection.")
|
|
2085
|
+
else:
|
|
2086
|
+
start, end = bounds
|
|
2087
|
+
|
|
2088
|
+
self.textbuffer.remove_tag(self.tag_super, start, end)
|
|
2089
|
+
self.textbuffer.remove_tag(self.tag_sub, start, end)
|
|
2090
|
+
|
|
2091
|
+
#print("Apply Tag", tag, start, end)
|
|
2092
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
2093
|
+
self.textbuffer.set_modified(1)</code></pre>
|
|
2094
|
+
</details>
|
|
2095
|
+
</dd>
|
|
2096
|
+
<dt id="pgtextview.pgTextView.on_super_button"><code class="name flex">
|
|
2097
|
+
<span>def <span class="ident">on_super_button</span></span>(<span>self, widget, tag)</span>
|
|
2098
|
+
</code></dt>
|
|
2099
|
+
<dd>
|
|
2100
|
+
<div class="desc"></div>
|
|
2101
|
+
<details class="source">
|
|
2102
|
+
<summary>
|
|
2103
|
+
<span>Expand source code</span>
|
|
2104
|
+
</summary>
|
|
2105
|
+
<pre><code class="python">def on_super_button(self, widget, tag):
|
|
2106
|
+
|
|
2107
|
+
bounds = self.textbuffer.get_selection_bounds()
|
|
2108
|
+
if not len(bounds):
|
|
2109
|
+
if self.statstr:
|
|
2110
|
+
self.statstr.set_text("No style selection.")
|
|
2111
|
+
else:
|
|
2112
|
+
start, end = bounds
|
|
2113
|
+
|
|
2114
|
+
self.textbuffer.remove_tag(self.tag_super, start, end)
|
|
2115
|
+
self.textbuffer.remove_tag(self.tag_sub, start, end)
|
|
2116
|
+
|
|
2117
|
+
#print("Apply Tag", tag, start, end)
|
|
2118
|
+
self.textbuffer.apply_tag(tag, start, end)
|
|
2119
|
+
self.textbuffer.set_modified(1)</code></pre>
|
|
2120
|
+
</details>
|
|
2121
|
+
</dd>
|
|
2122
|
+
<dt id="pgtextview.pgTextView.on_unzoom_clicked"><code class="name flex">
|
|
2123
|
+
<span>def <span class="ident">on_unzoom_clicked</span></span>(<span>self, arg1)</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_unzoom_clicked(self, arg1):
|
|
2132
|
+
|
|
2133
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
2134
|
+
myfd = pg.get_font_description()
|
|
2135
|
+
mysize = myfd.get_size() / Pango.SCALE
|
|
2136
|
+
|
|
2137
|
+
fd = Pango.FontDescription()
|
|
2138
|
+
fd.set_size((mysize - 1) * Pango.SCALE)
|
|
2139
|
+
self.textview.modify_font(fd)</code></pre>
|
|
2140
|
+
</details>
|
|
2141
|
+
</dd>
|
|
2142
|
+
<dt id="pgtextview.pgTextView.on_wrap_toggled"><code class="name flex">
|
|
2143
|
+
<span>def <span class="ident">on_wrap_toggled</span></span>(<span>self, widget, mode)</span>
|
|
2144
|
+
</code></dt>
|
|
2145
|
+
<dd>
|
|
2146
|
+
<div class="desc"></div>
|
|
2147
|
+
<details class="source">
|
|
2148
|
+
<summary>
|
|
2149
|
+
<span>Expand source code</span>
|
|
2150
|
+
</summary>
|
|
2151
|
+
<pre><code class="python">def on_wrap_toggled(self, widget, mode):
|
|
2152
|
+
self.textview.set_wrap_mode(mode)</code></pre>
|
|
2153
|
+
</details>
|
|
2154
|
+
</dd>
|
|
2155
|
+
<dt id="pgtextview.pgTextView.on_zoom_clicked"><code class="name flex">
|
|
2156
|
+
<span>def <span class="ident">on_zoom_clicked</span></span>(<span>self, arg1)</span>
|
|
2157
|
+
</code></dt>
|
|
2158
|
+
<dd>
|
|
2159
|
+
<div class="desc"></div>
|
|
2160
|
+
<details class="source">
|
|
2161
|
+
<summary>
|
|
2162
|
+
<span>Expand source code</span>
|
|
2163
|
+
</summary>
|
|
2164
|
+
<pre><code class="python">def on_zoom_clicked(self, arg1):
|
|
2165
|
+
|
|
2166
|
+
pg = Gtk.Widget.create_pango_context(self.textview)
|
|
2167
|
+
myfd = pg.get_font_description()
|
|
2168
|
+
mysize = myfd.get_size() / Pango.SCALE
|
|
2169
|
+
|
|
2170
|
+
fd = Pango.FontDescription()
|
|
2171
|
+
fd.set_size((mysize + 1) * Pango.SCALE)
|
|
2172
|
+
self.textview.modify_font(fd)</code></pre>
|
|
2173
|
+
</details>
|
|
2174
|
+
</dd>
|
|
2175
|
+
<dt id="pgtextview.pgTextView.print_tags"><code class="name flex">
|
|
2176
|
+
<span>def <span class="ident">print_tags</span></span>(<span>self)</span>
|
|
2177
|
+
</code></dt>
|
|
2178
|
+
<dd>
|
|
2179
|
+
<div class="desc"></div>
|
|
2180
|
+
<details class="source">
|
|
2181
|
+
<summary>
|
|
2182
|
+
<span>Expand source code</span>
|
|
2183
|
+
</summary>
|
|
2184
|
+
<pre><code class="python">def print_tags(self):
|
|
2185
|
+
|
|
2186
|
+
#startt = self.textbuffer.get_start_iter()
|
|
2187
|
+
#endd = self.textbuffer.get_end_iter()
|
|
2188
|
+
|
|
2189
|
+
# TagTable
|
|
2190
|
+
#tt = self.textbuffer.get_property("tag-table")
|
|
2191
|
+
#print("table", tt)
|
|
2192
|
+
|
|
2193
|
+
tt = self.textbuffer.get_tag_table()
|
|
2194
|
+
print("table", tt)
|
|
2195
|
+
tt.foreach(self.ptag, tt)
|
|
2196
|
+
print()
|
|
2197
|
+
|
|
2198
|
+
return
|
|
2199
|
+
|
|
2200
|
+
txt = self.textbuffer.get_text(startt, endd, False)
|
|
2201
|
+
lc = self.textbuffer.get_char_count()
|
|
2202
|
+
for aa in range(lc):
|
|
2203
|
+
iii = self.textbuffer.get_iter_at_offset(aa)
|
|
2204
|
+
eee = self.textbuffer.get_iter_at_offset(aa+1)
|
|
2205
|
+
ccc = self.textbuffer.get_text(iii, eee, False)
|
|
2206
|
+
#print("aa", ccc)
|
|
2207
|
+
|
|
2208
|
+
return txt
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
#all = self.edview.get_all()
|
|
2212
|
+
#print("serialize", self.edview.textbuffer.get_deserialize_formats())
|
|
2213
|
+
#print("str", self.edview.serial_str())
|
|
2214
|
+
#print("serialize", self.edview.textbuffer.get_deserialize_formats())
|
|
2215
|
+
|
|
2216
|
+
#vv = self.edview.textbuffer
|
|
2217
|
+
#startt = vv.get_start_iter(); endd = vv.get_end_iter()
|
|
2218
|
+
#while True:
|
|
2219
|
+
# prev = startt.copy()
|
|
2220
|
+
# nextok = startt.forward_line()
|
|
2221
|
+
# ttt = vv.get_text(prev, startt, False)
|
|
2222
|
+
# prevc = prev.copy()
|
|
2223
|
+
# while True:
|
|
2224
|
+
# sss = prevc.get_toggled_tags(True)
|
|
2225
|
+
# if sss:
|
|
2226
|
+
# print("tags on toggle", sss)
|
|
2227
|
+
# for cc in sss:
|
|
2228
|
+
# print("cc", cc.get_property("name"))
|
|
2229
|
+
# print("pos", prevc.get_line(), prevc.get_line_offset())
|
|
2230
|
+
# beg = prevc.copy()
|
|
2231
|
+
# nextokc = prevc.forward_char()
|
|
2232
|
+
# if not nextokc:
|
|
2233
|
+
# break
|
|
2234
|
+
# if startt == prevc:
|
|
2235
|
+
# break
|
|
2236
|
+
# chh = vv.get_text(beg, prevc, False)
|
|
2237
|
+
# print(chh, end="")
|
|
2238
|
+
#
|
|
2239
|
+
# #print("tags", prev.get_tags())
|
|
2240
|
+
# #print("line:", ttt, end="")
|
|
2241
|
+
# if not nextok:
|
|
2242
|
+
# break
|
|
2243
|
+
#
|
|
2244
|
+
##print("tags:", self.edview.textbuffer.get_tags())</code></pre>
|
|
2245
|
+
</details>
|
|
2246
|
+
</dd>
|
|
2247
|
+
<dt id="pgtextview.pgTextView.ptag"><code class="name flex">
|
|
2248
|
+
<span>def <span class="ident">ptag</span></span>(<span>self, ttt, tt)</span>
|
|
2249
|
+
</code></dt>
|
|
2250
|
+
<dd>
|
|
2251
|
+
<div class="desc"></div>
|
|
2252
|
+
<details class="source">
|
|
2253
|
+
<summary>
|
|
2254
|
+
<span>Expand source code</span>
|
|
2255
|
+
</summary>
|
|
2256
|
+
<pre><code class="python">def ptag(self, ttt, tt):
|
|
2257
|
+
|
|
2258
|
+
global cnt # Print only one
|
|
2259
|
+
if cnt: return
|
|
2260
|
+
cnt += 1
|
|
2261
|
+
|
|
2262
|
+
print(ttt)
|
|
2263
|
+
#print(dir(ttt))
|
|
2264
|
+
ll = ttt.list_properties()
|
|
2265
|
+
for aa in ll:
|
|
2266
|
+
#print(nnnn, end= " ")
|
|
2267
|
+
try:
|
|
2268
|
+
nn = tt.lookup(aa.name)
|
|
2269
|
+
if nn:
|
|
2270
|
+
#nnn = nn.get_property("size")
|
|
2271
|
+
#print("size", nnn)
|
|
2272
|
+
|
|
2273
|
+
lll = nn.list_properties()
|
|
2274
|
+
for bb in lll:
|
|
2275
|
+
nnn = bb.name #get_property("name")
|
|
2276
|
+
try:
|
|
2277
|
+
pp = nn.get_property(nnn)
|
|
2278
|
+
except:
|
|
2279
|
+
pass
|
|
2280
|
+
print(aa.name, "prop", "'" + nnn + "'" , "val =", pp)
|
|
2281
|
+
print()
|
|
2282
|
+
|
|
2283
|
+
except:
|
|
2284
|
+
print(sys.exc_info())
|
|
2285
|
+
pass
|
|
2286
|
+
#print()
|
|
2287
|
+
|
|
2288
|
+
return</code></pre>
|
|
2289
|
+
</details>
|
|
2290
|
+
</dd>
|
|
2291
|
+
<dt id="pgtextview.pgTextView.search_and_mark"><code class="name flex">
|
|
2292
|
+
<span>def <span class="ident">search_and_mark</span></span>(<span>self, text, start)</span>
|
|
2293
|
+
</code></dt>
|
|
2294
|
+
<dd>
|
|
2295
|
+
<div class="desc"></div>
|
|
2296
|
+
<details class="source">
|
|
2297
|
+
<summary>
|
|
2298
|
+
<span>Expand source code</span>
|
|
2299
|
+
</summary>
|
|
2300
|
+
<pre><code class="python">def search_and_mark(self, text, start):
|
|
2301
|
+
end = self.textbuffer.get_end_iter()
|
|
2302
|
+
match = start.forward_search(text, 0, end)
|
|
2303
|
+
|
|
2304
|
+
if match is not None:
|
|
2305
|
+
match_start, match_end = match
|
|
2306
|
+
self.textbuffer.apply_tag(self.tag_found, match_start, match_end)
|
|
2307
|
+
self.search_and_mark(text, match_end)</code></pre>
|
|
2308
|
+
</details>
|
|
2309
|
+
</dd>
|
|
2310
|
+
<dt id="pgtextview.pgTextView.ser_buff"><code class="name flex">
|
|
2311
|
+
<span>def <span class="ident">ser_buff</span></span>(<span>self)</span>
|
|
2312
|
+
</code></dt>
|
|
2313
|
+
<dd>
|
|
2314
|
+
<div class="desc"></div>
|
|
2315
|
+
<details class="source">
|
|
2316
|
+
<summary>
|
|
2317
|
+
<span>Expand source code</span>
|
|
2318
|
+
</summary>
|
|
2319
|
+
<pre><code class="python">def ser_buff(self):
|
|
2320
|
+
|
|
2321
|
+
#print("Ser buff")
|
|
2322
|
+
|
|
2323
|
+
startt = self.textbuffer.get_start_iter()
|
|
2324
|
+
endd = self.textbuffer.get_end_iter()
|
|
2325
|
+
|
|
2326
|
+
fmt = self.textbuffer.register_serialize_tagset()
|
|
2327
|
+
sss = self.textbuffer.serialize(self.textbuffer, fmt, startt, endd)
|
|
2328
|
+
if not sss: sss = b""
|
|
2329
|
+
return sss</code></pre>
|
|
2330
|
+
</details>
|
|
2331
|
+
</dd>
|
|
2332
|
+
<dt id="pgtextview.pgTextView.set_modified"><code class="name flex">
|
|
2333
|
+
<span>def <span class="ident">set_modified</span></span>(<span>self, valx)</span>
|
|
2334
|
+
</code></dt>
|
|
2335
|
+
<dd>
|
|
2336
|
+
<div class="desc"></div>
|
|
2337
|
+
<details class="source">
|
|
2338
|
+
<summary>
|
|
2339
|
+
<span>Expand source code</span>
|
|
2340
|
+
</summary>
|
|
2341
|
+
<pre><code class="python">def set_modified(self, valx):
|
|
2342
|
+
return self.textbuffer.set_modified(valx)</code></pre>
|
|
2343
|
+
</details>
|
|
2344
|
+
</dd>
|
|
2345
|
+
<dt id="pgtextview.pgTextView.set_text"><code class="name flex">
|
|
2346
|
+
<span>def <span class="ident">set_text</span></span>(<span>self, txt)</span>
|
|
2347
|
+
</code></dt>
|
|
2348
|
+
<dd>
|
|
2349
|
+
<div class="desc"></div>
|
|
2350
|
+
<details class="source">
|
|
2351
|
+
<summary>
|
|
2352
|
+
<span>Expand source code</span>
|
|
2353
|
+
</summary>
|
|
2354
|
+
<pre><code class="python">def set_text(self, txt):
|
|
2355
|
+
if self.textbuffer.get_modified():
|
|
2356
|
+
startt = self.textbuffer.get_start_iter()
|
|
2357
|
+
endd = self.textbuffer.get_end_iter()
|
|
2358
|
+
old = self.textbuffer.get_text(startt, endd, False)
|
|
2359
|
+
if self.callb:
|
|
2360
|
+
self.callb(old)
|
|
2361
|
+
#print("old_content", old)
|
|
2362
|
+
self.textbuffer.set_text(txt)</code></pre>
|
|
2363
|
+
</details>
|
|
2364
|
+
</dd>
|
|
2365
|
+
</dl>
|
|
2366
|
+
</dd>
|
|
2367
|
+
</dl>
|
|
2368
|
+
</section>
|
|
2369
|
+
</article>
|
|
2370
|
+
<nav id="sidebar">
|
|
2371
|
+
<h1>Index</h1>
|
|
2372
|
+
<div class="toc">
|
|
2373
|
+
<ul></ul>
|
|
2374
|
+
</div>
|
|
2375
|
+
<ul id="index">
|
|
2376
|
+
<li><h3><a href="#header-classes">Classes</a></h3>
|
|
2377
|
+
<ul>
|
|
2378
|
+
<li>
|
|
2379
|
+
<h4><code><a title="pgtextview.pgTextView" href="#pgtextview.pgTextView">pgTextView</a></code></h4>
|
|
2380
|
+
<ul class="two-column">
|
|
2381
|
+
<li><code><a title="pgtextview.pgTextView.area_button" href="#pgtextview.pgTextView.area_button">area_button</a></code></li>
|
|
2382
|
+
<li><code><a title="pgtextview.pgTextView.area_curs" href="#pgtextview.pgTextView.area_curs">area_curs</a></code></li>
|
|
2383
|
+
<li><code><a title="pgtextview.pgTextView.area_key" href="#pgtextview.pgTextView.area_key">area_key</a></code></li>
|
|
2384
|
+
<li><code><a title="pgtextview.pgTextView.combo_sel" href="#pgtextview.pgTextView.combo_sel">combo_sel</a></code></li>
|
|
2385
|
+
<li><code><a title="pgtextview.pgTextView.combo_sel2" href="#pgtextview.pgTextView.combo_sel2">combo_sel2</a></code></li>
|
|
2386
|
+
<li><code><a title="pgtextview.pgTextView.combo_sel3" href="#pgtextview.pgTextView.combo_sel3">combo_sel3</a></code></li>
|
|
2387
|
+
<li><code><a title="pgtextview.pgTextView.deser_buff" href="#pgtextview.pgTextView.deser_buff">deser_buff</a></code></li>
|
|
2388
|
+
<li><code><a title="pgtextview.pgTextView.get_modified" href="#pgtextview.pgTextView.get_modified">get_modified</a></code></li>
|
|
2389
|
+
<li><code><a title="pgtextview.pgTextView.get_text" href="#pgtextview.pgTextView.get_text">get_text</a></code></li>
|
|
2390
|
+
<li><code><a title="pgtextview.pgTextView.on_button_clicked" href="#pgtextview.pgTextView.on_button_clicked">on_button_clicked</a></code></li>
|
|
2391
|
+
<li><code><a title="pgtextview.pgTextView.on_clear_clicked" href="#pgtextview.pgTextView.on_clear_clicked">on_clear_clicked</a></code></li>
|
|
2392
|
+
<li><code><a title="pgtextview.pgTextView.on_combo_clicked" href="#pgtextview.pgTextView.on_combo_clicked">on_combo_clicked</a></code></li>
|
|
2393
|
+
<li><code><a title="pgtextview.pgTextView.on_cursor_toggled" href="#pgtextview.pgTextView.on_cursor_toggled">on_cursor_toggled</a></code></li>
|
|
2394
|
+
<li><code><a title="pgtextview.pgTextView.on_editable_toggled" href="#pgtextview.pgTextView.on_editable_toggled">on_editable_toggled</a></code></li>
|
|
2395
|
+
<li><code><a title="pgtextview.pgTextView.on_justify_toggled" href="#pgtextview.pgTextView.on_justify_toggled">on_justify_toggled</a></code></li>
|
|
2396
|
+
<li><code><a title="pgtextview.pgTextView.on_rm_clicked" href="#pgtextview.pgTextView.on_rm_clicked">on_rm_clicked</a></code></li>
|
|
2397
|
+
<li><code><a title="pgtextview.pgTextView.on_rm_color" href="#pgtextview.pgTextView.on_rm_color">on_rm_color</a></code></li>
|
|
2398
|
+
<li><code><a title="pgtextview.pgTextView.on_search_clicked" href="#pgtextview.pgTextView.on_search_clicked">on_search_clicked</a></code></li>
|
|
2399
|
+
<li><code><a title="pgtextview.pgTextView.on_size_button" href="#pgtextview.pgTextView.on_size_button">on_size_button</a></code></li>
|
|
2400
|
+
<li><code><a title="pgtextview.pgTextView.on_super_button" href="#pgtextview.pgTextView.on_super_button">on_super_button</a></code></li>
|
|
2401
|
+
<li><code><a title="pgtextview.pgTextView.on_unzoom_clicked" href="#pgtextview.pgTextView.on_unzoom_clicked">on_unzoom_clicked</a></code></li>
|
|
2402
|
+
<li><code><a title="pgtextview.pgTextView.on_wrap_toggled" href="#pgtextview.pgTextView.on_wrap_toggled">on_wrap_toggled</a></code></li>
|
|
2403
|
+
<li><code><a title="pgtextview.pgTextView.on_zoom_clicked" href="#pgtextview.pgTextView.on_zoom_clicked">on_zoom_clicked</a></code></li>
|
|
2404
|
+
<li><code><a title="pgtextview.pgTextView.print_tags" href="#pgtextview.pgTextView.print_tags">print_tags</a></code></li>
|
|
2405
|
+
<li><code><a title="pgtextview.pgTextView.ptag" href="#pgtextview.pgTextView.ptag">ptag</a></code></li>
|
|
2406
|
+
<li><code><a title="pgtextview.pgTextView.search_and_mark" href="#pgtextview.pgTextView.search_and_mark">search_and_mark</a></code></li>
|
|
2407
|
+
<li><code><a title="pgtextview.pgTextView.ser_buff" href="#pgtextview.pgTextView.ser_buff">ser_buff</a></code></li>
|
|
2408
|
+
<li><code><a title="pgtextview.pgTextView.set_modified" href="#pgtextview.pgTextView.set_modified">set_modified</a></code></li>
|
|
2409
|
+
<li><code><a title="pgtextview.pgTextView.set_text" href="#pgtextview.pgTextView.set_text">set_text</a></code></li>
|
|
2410
|
+
</ul>
|
|
2411
|
+
</li>
|
|
2412
|
+
</ul>
|
|
2413
|
+
</li>
|
|
2414
|
+
</ul>
|
|
2415
|
+
</nav>
|
|
2416
|
+
</main>
|
|
2417
|
+
<footer id="footer">
|
|
2418
|
+
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
|
2419
|
+
</footer>
|
|
2420
|
+
</body>
|
|
2421
|
+
</html>
|