pyvguicom 1.1.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/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/pggui.py +1 -1
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.1.2.dist-info}/METADATA +8 -11
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.1.2.dist-info}/RECORD +18 -5
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.1.2.dist-info}/WHEEL +0 -0
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.1.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,1048 @@
|
|
|
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>pgsimp 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>pgsimp</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/python
|
|
30
|
+
|
|
31
|
+
import sys
|
|
32
|
+
|
|
33
|
+
import gi
|
|
34
|
+
gi.require_version("Gtk", "3.0")
|
|
35
|
+
from gi.repository import Gtk
|
|
36
|
+
from gi.repository import Gdk
|
|
37
|
+
from gi.repository import GObject
|
|
38
|
+
from gi.repository import Pango
|
|
39
|
+
|
|
40
|
+
''' Simplified controls '''
|
|
41
|
+
|
|
42
|
+
gui_testmode = False
|
|
43
|
+
|
|
44
|
+
import pgutils
|
|
45
|
+
|
|
46
|
+
# ------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
class SimpleTree(Gtk.TreeView):
|
|
49
|
+
|
|
50
|
+
''' Simplified Tree control '''
|
|
51
|
+
|
|
52
|
+
def __init__(self, head = [], editx = [], skipedit = 0, xalign = 0.5):
|
|
53
|
+
|
|
54
|
+
Gtk.TreeView.__init__(self)
|
|
55
|
+
|
|
56
|
+
self.callb = None
|
|
57
|
+
self.chcallb = None
|
|
58
|
+
self.actcallb = None
|
|
59
|
+
|
|
60
|
+
# repair missing column
|
|
61
|
+
if len(head) == 0:
|
|
62
|
+
head.append("")
|
|
63
|
+
|
|
64
|
+
if len(editx) == 0:
|
|
65
|
+
editx.append("")
|
|
66
|
+
|
|
67
|
+
self.types = []
|
|
68
|
+
for aa in head:
|
|
69
|
+
self.types.append(str)
|
|
70
|
+
|
|
71
|
+
self.treestore = Gtk.TreeStore()
|
|
72
|
+
self.treestore.set_column_types(self.types)
|
|
73
|
+
|
|
74
|
+
cnt = 0
|
|
75
|
+
for aa in head:
|
|
76
|
+
# Create a CellRendererText to render the data
|
|
77
|
+
cell = Gtk.CellRendererText()
|
|
78
|
+
cell.set_property("alignment", Pango.Alignment.LEFT)
|
|
79
|
+
cell.set_property("align-set", True)
|
|
80
|
+
cell.set_property("xalign", xalign)
|
|
81
|
+
|
|
82
|
+
if cnt > skipedit:
|
|
83
|
+
cell.set_property("editable", True)
|
|
84
|
+
cell.connect("edited", self.text_edited, cnt)
|
|
85
|
+
|
|
86
|
+
tvcolumn = Gtk.TreeViewColumn(aa)
|
|
87
|
+
tvcolumn.pack_start(cell, True)
|
|
88
|
+
tvcolumn.add_attribute(cell, 'text', cnt)
|
|
89
|
+
self.append_column(tvcolumn)
|
|
90
|
+
cnt += 1
|
|
91
|
+
|
|
92
|
+
self.set_model(self.treestore)
|
|
93
|
+
self.connect("cursor-changed", self.selection)
|
|
94
|
+
self.connect("row-activated", self.activate)
|
|
95
|
+
|
|
96
|
+
def activate(self, xtree, arg2, arg3):
|
|
97
|
+
#print("Activated", row, arg2, arg3)
|
|
98
|
+
sel = xtree.get_selection()
|
|
99
|
+
xmodel, xiter = sel.get_selected()
|
|
100
|
+
if xiter:
|
|
101
|
+
xstr = xmodel.get_value(xiter, 0)
|
|
102
|
+
#print("Activated str", xstr)
|
|
103
|
+
if self.actcallb:
|
|
104
|
+
self.actcallb(xstr)
|
|
105
|
+
|
|
106
|
+
def text_edited(self, widget, path, text, idx):
|
|
107
|
+
#print ("edited", widget, path, text, idx)
|
|
108
|
+
self.treestore[path][idx] = text
|
|
109
|
+
args = []
|
|
110
|
+
for aa in self.treestore[path]:
|
|
111
|
+
args.append(aa)
|
|
112
|
+
if self.chcallb:
|
|
113
|
+
self.chcallb(args)
|
|
114
|
+
|
|
115
|
+
def selection(self, xtree):
|
|
116
|
+
#print("simple tree sel", xtree)
|
|
117
|
+
sel = xtree.get_selection()
|
|
118
|
+
xmodel, xiter = sel.get_selected()
|
|
119
|
+
if xiter:
|
|
120
|
+
self.args = []
|
|
121
|
+
for aa in range(len(self.types)):
|
|
122
|
+
xstr = xmodel.get_value(xiter, aa)
|
|
123
|
+
self.args.append(xstr)
|
|
124
|
+
#print("selection", self.args)
|
|
125
|
+
if self.callb:
|
|
126
|
+
self.callb(self.args)
|
|
127
|
+
|
|
128
|
+
def setcallb(self, callb):
|
|
129
|
+
self.callb = callb
|
|
130
|
+
|
|
131
|
+
def setCHcallb(self, callb):
|
|
132
|
+
self.chcallb = callb
|
|
133
|
+
|
|
134
|
+
def setActcallb(self, callb):
|
|
135
|
+
self.actcallb = callb
|
|
136
|
+
|
|
137
|
+
def append(self, args):
|
|
138
|
+
#print("append", args)
|
|
139
|
+
piter = self.treestore.append(None, args)
|
|
140
|
+
|
|
141
|
+
# TreeStore
|
|
142
|
+
def insert(self, parent, pos, args):
|
|
143
|
+
print("insert", parent, pos, args)
|
|
144
|
+
piter = self.treestore.insert(parent, pos, args)
|
|
145
|
+
|
|
146
|
+
def sel_first(self):
|
|
147
|
+
#print("sel first ...")
|
|
148
|
+
sel = self.get_selection()
|
|
149
|
+
xmodel, xiter = sel.get_selected()
|
|
150
|
+
iterx = self.treestore.get_iter_first()
|
|
151
|
+
sel.select_iter(iterx)
|
|
152
|
+
ppp = self.treestore.get_path(iterx)
|
|
153
|
+
self.set_cursor(ppp, self.get_column(0), False)
|
|
154
|
+
pgutils.usleep(5)
|
|
155
|
+
self.scroll_to_cell(ppp, None, 0, 0, 0 )
|
|
156
|
+
|
|
157
|
+
def sel_last(self):
|
|
158
|
+
#print("sel last ...")
|
|
159
|
+
sel = self.get_selection()
|
|
160
|
+
xmodel, xiter = sel.get_selected()
|
|
161
|
+
iterx = self.treestore.get_iter_first()
|
|
162
|
+
if not iterx:
|
|
163
|
+
return
|
|
164
|
+
while True:
|
|
165
|
+
iter2 = self.treestore.iter_next(iterx)
|
|
166
|
+
if not iter2:
|
|
167
|
+
break
|
|
168
|
+
iterx = iter2.copy()
|
|
169
|
+
sel.select_iter(iterx)
|
|
170
|
+
ppp = self.treestore.get_path(iterx)
|
|
171
|
+
self.set_cursor(ppp, self.get_column(0), False)
|
|
172
|
+
pgutils.usleep(5)
|
|
173
|
+
self.scroll_to_cell(ppp, None, True, 0., 0. )
|
|
174
|
+
#sel.select_path(self.treestore.get_path(iterx))
|
|
175
|
+
|
|
176
|
+
def find_item(self, item):
|
|
177
|
+
|
|
178
|
+
''' find if we already have an item like that '''
|
|
179
|
+
|
|
180
|
+
#print("find", item)
|
|
181
|
+
found = 0
|
|
182
|
+
iterx = self.treestore.get_iter_first()
|
|
183
|
+
if not iterx:
|
|
184
|
+
return found
|
|
185
|
+
while True:
|
|
186
|
+
value = self.treestore.get_value(iterx, 0)
|
|
187
|
+
#print("item:", value)
|
|
188
|
+
if item == value:
|
|
189
|
+
found = True
|
|
190
|
+
break
|
|
191
|
+
iter2 = self.treestore.iter_next(iterx)
|
|
192
|
+
if not iter2:
|
|
193
|
+
break
|
|
194
|
+
iterx = iter2.copy()
|
|
195
|
+
return found
|
|
196
|
+
|
|
197
|
+
def clear(self):
|
|
198
|
+
self.treestore.clear()
|
|
199
|
+
|
|
200
|
+
# ------------------------------------------------------------------------
|
|
201
|
+
|
|
202
|
+
class SimpleEdit(Gtk.TextView):
|
|
203
|
+
|
|
204
|
+
''' Simplified Edit controol '''
|
|
205
|
+
|
|
206
|
+
def __init__(self, head = []):
|
|
207
|
+
|
|
208
|
+
Gtk.TextView.__init__(self)
|
|
209
|
+
self.buffer = Gtk.TextBuffer()
|
|
210
|
+
self.set_buffer(self.buffer)
|
|
211
|
+
self.set_editable(True)
|
|
212
|
+
self.connect("unmap", self.unmapx)
|
|
213
|
+
#self.connect("focus-out-event", self.focus_out)
|
|
214
|
+
self.connect("key-press-event", self.area_key)
|
|
215
|
+
self.modified = False
|
|
216
|
+
self.text = ""
|
|
217
|
+
self.savecb = None
|
|
218
|
+
self.single_line = False
|
|
219
|
+
|
|
220
|
+
def focus_out(self, win, arg):
|
|
221
|
+
#print("SimpleEdit focus_out")
|
|
222
|
+
self.check_saved()
|
|
223
|
+
#self.mefocus = False
|
|
224
|
+
|
|
225
|
+
def check_saved(self):
|
|
226
|
+
if not self.buffer.get_modified():
|
|
227
|
+
return
|
|
228
|
+
#print("Saving")
|
|
229
|
+
startt = self.buffer.get_start_iter()
|
|
230
|
+
endd = self.buffer.get_end_iter()
|
|
231
|
+
self.text = self.buffer.get_text(startt, endd, False)
|
|
232
|
+
if self.savecb:
|
|
233
|
+
self.savecb(self.text)
|
|
234
|
+
|
|
235
|
+
def focus_in(self, win, arg):
|
|
236
|
+
pass
|
|
237
|
+
#self.buffer.set_modified(False)
|
|
238
|
+
#self.mefocus = True
|
|
239
|
+
#print("SimpleEdit focus_in")
|
|
240
|
+
|
|
241
|
+
def unmapx(self, widget):
|
|
242
|
+
#print("SimpleEdit unmap", widget)
|
|
243
|
+
pass
|
|
244
|
+
|
|
245
|
+
def area_key(self, widget, event):
|
|
246
|
+
#print("SimpleEdit keypress", event.string)
|
|
247
|
+
#self.buffer.set_modified(True)
|
|
248
|
+
|
|
249
|
+
if self.single_line:
|
|
250
|
+
if event.string == "\r":
|
|
251
|
+
#print("newline")
|
|
252
|
+
if self.savecb:
|
|
253
|
+
try:
|
|
254
|
+
self.savecb(self.get_text())
|
|
255
|
+
except:
|
|
256
|
+
print("Error simpledit callback")
|
|
257
|
+
return True
|
|
258
|
+
|
|
259
|
+
def append(self, strx):
|
|
260
|
+
self.check_saved()
|
|
261
|
+
iterx = self.buffer.get_end_iter()
|
|
262
|
+
self.buffer.insert(iterx, strx)
|
|
263
|
+
self.buffer.set_modified(False)
|
|
264
|
+
|
|
265
|
+
def clear(self):
|
|
266
|
+
self.check_saved()
|
|
267
|
+
startt = self.buffer.get_start_iter()
|
|
268
|
+
endd = self.buffer.get_end_iter()
|
|
269
|
+
self.buffer.delete(startt, endd)
|
|
270
|
+
self.buffer.set_modified(False)
|
|
271
|
+
|
|
272
|
+
def setsavecb(self, callb):
|
|
273
|
+
self.savecb = callb
|
|
274
|
+
|
|
275
|
+
def get_text(self):
|
|
276
|
+
startt = self.buffer.get_start_iter()
|
|
277
|
+
endd = self.buffer.get_end_iter()
|
|
278
|
+
return self.buffer.get_text(startt, endd, False)
|
|
279
|
+
|
|
280
|
+
def set_text(self, txt, eventx = False):
|
|
281
|
+
if eventx:
|
|
282
|
+
self.check_saved()
|
|
283
|
+
startt = self.buffer.get_start_iter()
|
|
284
|
+
endd = self.buffer.get_end_iter()
|
|
285
|
+
self.buffer.delete(startt, endd)
|
|
286
|
+
self.buffer.insert(startt, txt)
|
|
287
|
+
self.buffer.set_modified(True)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
# EOF</code></pre>
|
|
291
|
+
</details>
|
|
292
|
+
</section>
|
|
293
|
+
<section>
|
|
294
|
+
</section>
|
|
295
|
+
<section>
|
|
296
|
+
</section>
|
|
297
|
+
<section>
|
|
298
|
+
</section>
|
|
299
|
+
<section>
|
|
300
|
+
<h2 class="section-title" id="header-classes">Classes</h2>
|
|
301
|
+
<dl>
|
|
302
|
+
<dt id="pgsimp.SimpleEdit"><code class="flex name class">
|
|
303
|
+
<span>class <span class="ident">SimpleEdit</span></span>
|
|
304
|
+
<span>(</span><span>head=[])</span>
|
|
305
|
+
</code></dt>
|
|
306
|
+
<dd>
|
|
307
|
+
<div class="desc"><p>Simplified Edit controol</p></div>
|
|
308
|
+
<details class="source">
|
|
309
|
+
<summary>
|
|
310
|
+
<span>Expand source code</span>
|
|
311
|
+
</summary>
|
|
312
|
+
<pre><code class="python">class SimpleEdit(Gtk.TextView):
|
|
313
|
+
|
|
314
|
+
''' Simplified Edit controol '''
|
|
315
|
+
|
|
316
|
+
def __init__(self, head = []):
|
|
317
|
+
|
|
318
|
+
Gtk.TextView.__init__(self)
|
|
319
|
+
self.buffer = Gtk.TextBuffer()
|
|
320
|
+
self.set_buffer(self.buffer)
|
|
321
|
+
self.set_editable(True)
|
|
322
|
+
self.connect("unmap", self.unmapx)
|
|
323
|
+
#self.connect("focus-out-event", self.focus_out)
|
|
324
|
+
self.connect("key-press-event", self.area_key)
|
|
325
|
+
self.modified = False
|
|
326
|
+
self.text = ""
|
|
327
|
+
self.savecb = None
|
|
328
|
+
self.single_line = False
|
|
329
|
+
|
|
330
|
+
def focus_out(self, win, arg):
|
|
331
|
+
#print("SimpleEdit focus_out")
|
|
332
|
+
self.check_saved()
|
|
333
|
+
#self.mefocus = False
|
|
334
|
+
|
|
335
|
+
def check_saved(self):
|
|
336
|
+
if not self.buffer.get_modified():
|
|
337
|
+
return
|
|
338
|
+
#print("Saving")
|
|
339
|
+
startt = self.buffer.get_start_iter()
|
|
340
|
+
endd = self.buffer.get_end_iter()
|
|
341
|
+
self.text = self.buffer.get_text(startt, endd, False)
|
|
342
|
+
if self.savecb:
|
|
343
|
+
self.savecb(self.text)
|
|
344
|
+
|
|
345
|
+
def focus_in(self, win, arg):
|
|
346
|
+
pass
|
|
347
|
+
#self.buffer.set_modified(False)
|
|
348
|
+
#self.mefocus = True
|
|
349
|
+
#print("SimpleEdit focus_in")
|
|
350
|
+
|
|
351
|
+
def unmapx(self, widget):
|
|
352
|
+
#print("SimpleEdit unmap", widget)
|
|
353
|
+
pass
|
|
354
|
+
|
|
355
|
+
def area_key(self, widget, event):
|
|
356
|
+
#print("SimpleEdit keypress", event.string)
|
|
357
|
+
#self.buffer.set_modified(True)
|
|
358
|
+
|
|
359
|
+
if self.single_line:
|
|
360
|
+
if event.string == "\r":
|
|
361
|
+
#print("newline")
|
|
362
|
+
if self.savecb:
|
|
363
|
+
try:
|
|
364
|
+
self.savecb(self.get_text())
|
|
365
|
+
except:
|
|
366
|
+
print("Error simpledit callback")
|
|
367
|
+
return True
|
|
368
|
+
|
|
369
|
+
def append(self, strx):
|
|
370
|
+
self.check_saved()
|
|
371
|
+
iterx = self.buffer.get_end_iter()
|
|
372
|
+
self.buffer.insert(iterx, strx)
|
|
373
|
+
self.buffer.set_modified(False)
|
|
374
|
+
|
|
375
|
+
def clear(self):
|
|
376
|
+
self.check_saved()
|
|
377
|
+
startt = self.buffer.get_start_iter()
|
|
378
|
+
endd = self.buffer.get_end_iter()
|
|
379
|
+
self.buffer.delete(startt, endd)
|
|
380
|
+
self.buffer.set_modified(False)
|
|
381
|
+
|
|
382
|
+
def setsavecb(self, callb):
|
|
383
|
+
self.savecb = callb
|
|
384
|
+
|
|
385
|
+
def get_text(self):
|
|
386
|
+
startt = self.buffer.get_start_iter()
|
|
387
|
+
endd = self.buffer.get_end_iter()
|
|
388
|
+
return self.buffer.get_text(startt, endd, False)
|
|
389
|
+
|
|
390
|
+
def set_text(self, txt, eventx = False):
|
|
391
|
+
if eventx:
|
|
392
|
+
self.check_saved()
|
|
393
|
+
startt = self.buffer.get_start_iter()
|
|
394
|
+
endd = self.buffer.get_end_iter()
|
|
395
|
+
self.buffer.delete(startt, endd)
|
|
396
|
+
self.buffer.insert(startt, txt)
|
|
397
|
+
self.buffer.set_modified(True)</code></pre>
|
|
398
|
+
</details>
|
|
399
|
+
<h3>Ancestors</h3>
|
|
400
|
+
<ul class="hlist">
|
|
401
|
+
<li>gi.repository.Gtk.TextView</li>
|
|
402
|
+
<li>gi.overrides.Gtk.Container</li>
|
|
403
|
+
<li>gi.repository.Gtk.Container</li>
|
|
404
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
405
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
406
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
407
|
+
<li>gi.overrides.GObject.Object</li>
|
|
408
|
+
<li>gi.repository.GObject.Object</li>
|
|
409
|
+
<li>gi._gi.GObject</li>
|
|
410
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
411
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
412
|
+
<li>gi.repository.Gtk.Scrollable</li>
|
|
413
|
+
<li>gobject.GInterface</li>
|
|
414
|
+
</ul>
|
|
415
|
+
<h3>Methods</h3>
|
|
416
|
+
<dl>
|
|
417
|
+
<dt id="pgsimp.SimpleEdit.append"><code class="name flex">
|
|
418
|
+
<span>def <span class="ident">append</span></span>(<span>self, strx)</span>
|
|
419
|
+
</code></dt>
|
|
420
|
+
<dd>
|
|
421
|
+
<div class="desc"></div>
|
|
422
|
+
<details class="source">
|
|
423
|
+
<summary>
|
|
424
|
+
<span>Expand source code</span>
|
|
425
|
+
</summary>
|
|
426
|
+
<pre><code class="python">def append(self, strx):
|
|
427
|
+
self.check_saved()
|
|
428
|
+
iterx = self.buffer.get_end_iter()
|
|
429
|
+
self.buffer.insert(iterx, strx)
|
|
430
|
+
self.buffer.set_modified(False)</code></pre>
|
|
431
|
+
</details>
|
|
432
|
+
</dd>
|
|
433
|
+
<dt id="pgsimp.SimpleEdit.area_key"><code class="name flex">
|
|
434
|
+
<span>def <span class="ident">area_key</span></span>(<span>self, widget, event)</span>
|
|
435
|
+
</code></dt>
|
|
436
|
+
<dd>
|
|
437
|
+
<div class="desc"></div>
|
|
438
|
+
<details class="source">
|
|
439
|
+
<summary>
|
|
440
|
+
<span>Expand source code</span>
|
|
441
|
+
</summary>
|
|
442
|
+
<pre><code class="python">def area_key(self, widget, event):
|
|
443
|
+
#print("SimpleEdit keypress", event.string)
|
|
444
|
+
#self.buffer.set_modified(True)
|
|
445
|
+
|
|
446
|
+
if self.single_line:
|
|
447
|
+
if event.string == "\r":
|
|
448
|
+
#print("newline")
|
|
449
|
+
if self.savecb:
|
|
450
|
+
try:
|
|
451
|
+
self.savecb(self.get_text())
|
|
452
|
+
except:
|
|
453
|
+
print("Error simpledit callback")
|
|
454
|
+
return True</code></pre>
|
|
455
|
+
</details>
|
|
456
|
+
</dd>
|
|
457
|
+
<dt id="pgsimp.SimpleEdit.check_saved"><code class="name flex">
|
|
458
|
+
<span>def <span class="ident">check_saved</span></span>(<span>self)</span>
|
|
459
|
+
</code></dt>
|
|
460
|
+
<dd>
|
|
461
|
+
<div class="desc"></div>
|
|
462
|
+
<details class="source">
|
|
463
|
+
<summary>
|
|
464
|
+
<span>Expand source code</span>
|
|
465
|
+
</summary>
|
|
466
|
+
<pre><code class="python">def check_saved(self):
|
|
467
|
+
if not self.buffer.get_modified():
|
|
468
|
+
return
|
|
469
|
+
#print("Saving")
|
|
470
|
+
startt = self.buffer.get_start_iter()
|
|
471
|
+
endd = self.buffer.get_end_iter()
|
|
472
|
+
self.text = self.buffer.get_text(startt, endd, False)
|
|
473
|
+
if self.savecb:
|
|
474
|
+
self.savecb(self.text)</code></pre>
|
|
475
|
+
</details>
|
|
476
|
+
</dd>
|
|
477
|
+
<dt id="pgsimp.SimpleEdit.clear"><code class="name flex">
|
|
478
|
+
<span>def <span class="ident">clear</span></span>(<span>self)</span>
|
|
479
|
+
</code></dt>
|
|
480
|
+
<dd>
|
|
481
|
+
<div class="desc"></div>
|
|
482
|
+
<details class="source">
|
|
483
|
+
<summary>
|
|
484
|
+
<span>Expand source code</span>
|
|
485
|
+
</summary>
|
|
486
|
+
<pre><code class="python">def clear(self):
|
|
487
|
+
self.check_saved()
|
|
488
|
+
startt = self.buffer.get_start_iter()
|
|
489
|
+
endd = self.buffer.get_end_iter()
|
|
490
|
+
self.buffer.delete(startt, endd)
|
|
491
|
+
self.buffer.set_modified(False)</code></pre>
|
|
492
|
+
</details>
|
|
493
|
+
</dd>
|
|
494
|
+
<dt id="pgsimp.SimpleEdit.focus_in"><code class="name flex">
|
|
495
|
+
<span>def <span class="ident">focus_in</span></span>(<span>self, win, arg)</span>
|
|
496
|
+
</code></dt>
|
|
497
|
+
<dd>
|
|
498
|
+
<div class="desc"></div>
|
|
499
|
+
<details class="source">
|
|
500
|
+
<summary>
|
|
501
|
+
<span>Expand source code</span>
|
|
502
|
+
</summary>
|
|
503
|
+
<pre><code class="python">def focus_in(self, win, arg):
|
|
504
|
+
pass
|
|
505
|
+
#self.buffer.set_modified(False)
|
|
506
|
+
#self.mefocus = True
|
|
507
|
+
#print("SimpleEdit focus_in")</code></pre>
|
|
508
|
+
</details>
|
|
509
|
+
</dd>
|
|
510
|
+
<dt id="pgsimp.SimpleEdit.focus_out"><code class="name flex">
|
|
511
|
+
<span>def <span class="ident">focus_out</span></span>(<span>self, win, arg)</span>
|
|
512
|
+
</code></dt>
|
|
513
|
+
<dd>
|
|
514
|
+
<div class="desc"></div>
|
|
515
|
+
<details class="source">
|
|
516
|
+
<summary>
|
|
517
|
+
<span>Expand source code</span>
|
|
518
|
+
</summary>
|
|
519
|
+
<pre><code class="python">def focus_out(self, win, arg):
|
|
520
|
+
#print("SimpleEdit focus_out")
|
|
521
|
+
self.check_saved()
|
|
522
|
+
#self.mefocus = False</code></pre>
|
|
523
|
+
</details>
|
|
524
|
+
</dd>
|
|
525
|
+
<dt id="pgsimp.SimpleEdit.get_text"><code class="name flex">
|
|
526
|
+
<span>def <span class="ident">get_text</span></span>(<span>self)</span>
|
|
527
|
+
</code></dt>
|
|
528
|
+
<dd>
|
|
529
|
+
<div class="desc"></div>
|
|
530
|
+
<details class="source">
|
|
531
|
+
<summary>
|
|
532
|
+
<span>Expand source code</span>
|
|
533
|
+
</summary>
|
|
534
|
+
<pre><code class="python">def get_text(self):
|
|
535
|
+
startt = self.buffer.get_start_iter()
|
|
536
|
+
endd = self.buffer.get_end_iter()
|
|
537
|
+
return self.buffer.get_text(startt, endd, False)</code></pre>
|
|
538
|
+
</details>
|
|
539
|
+
</dd>
|
|
540
|
+
<dt id="pgsimp.SimpleEdit.set_text"><code class="name flex">
|
|
541
|
+
<span>def <span class="ident">set_text</span></span>(<span>self, txt, eventx=False)</span>
|
|
542
|
+
</code></dt>
|
|
543
|
+
<dd>
|
|
544
|
+
<div class="desc"></div>
|
|
545
|
+
<details class="source">
|
|
546
|
+
<summary>
|
|
547
|
+
<span>Expand source code</span>
|
|
548
|
+
</summary>
|
|
549
|
+
<pre><code class="python">def set_text(self, txt, eventx = False):
|
|
550
|
+
if eventx:
|
|
551
|
+
self.check_saved()
|
|
552
|
+
startt = self.buffer.get_start_iter()
|
|
553
|
+
endd = self.buffer.get_end_iter()
|
|
554
|
+
self.buffer.delete(startt, endd)
|
|
555
|
+
self.buffer.insert(startt, txt)
|
|
556
|
+
self.buffer.set_modified(True)</code></pre>
|
|
557
|
+
</details>
|
|
558
|
+
</dd>
|
|
559
|
+
<dt id="pgsimp.SimpleEdit.setsavecb"><code class="name flex">
|
|
560
|
+
<span>def <span class="ident">setsavecb</span></span>(<span>self, callb)</span>
|
|
561
|
+
</code></dt>
|
|
562
|
+
<dd>
|
|
563
|
+
<div class="desc"></div>
|
|
564
|
+
<details class="source">
|
|
565
|
+
<summary>
|
|
566
|
+
<span>Expand source code</span>
|
|
567
|
+
</summary>
|
|
568
|
+
<pre><code class="python">def setsavecb(self, callb):
|
|
569
|
+
self.savecb = callb</code></pre>
|
|
570
|
+
</details>
|
|
571
|
+
</dd>
|
|
572
|
+
<dt id="pgsimp.SimpleEdit.unmapx"><code class="name flex">
|
|
573
|
+
<span>def <span class="ident">unmapx</span></span>(<span>self, widget)</span>
|
|
574
|
+
</code></dt>
|
|
575
|
+
<dd>
|
|
576
|
+
<div class="desc"></div>
|
|
577
|
+
<details class="source">
|
|
578
|
+
<summary>
|
|
579
|
+
<span>Expand source code</span>
|
|
580
|
+
</summary>
|
|
581
|
+
<pre><code class="python">def unmapx(self, widget):
|
|
582
|
+
#print("SimpleEdit unmap", widget)
|
|
583
|
+
pass</code></pre>
|
|
584
|
+
</details>
|
|
585
|
+
</dd>
|
|
586
|
+
</dl>
|
|
587
|
+
</dd>
|
|
588
|
+
<dt id="pgsimp.SimpleTree"><code class="flex name class">
|
|
589
|
+
<span>class <span class="ident">SimpleTree</span></span>
|
|
590
|
+
<span>(</span><span>head=[], editx=[], skipedit=0, xalign=0.5)</span>
|
|
591
|
+
</code></dt>
|
|
592
|
+
<dd>
|
|
593
|
+
<div class="desc"><p>Simplified Tree control </p>
|
|
594
|
+
<p>Initializer for a GObject based classes with support for property
|
|
595
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
596
|
+
<details class="source">
|
|
597
|
+
<summary>
|
|
598
|
+
<span>Expand source code</span>
|
|
599
|
+
</summary>
|
|
600
|
+
<pre><code class="python">class SimpleTree(Gtk.TreeView):
|
|
601
|
+
|
|
602
|
+
''' Simplified Tree control '''
|
|
603
|
+
|
|
604
|
+
def __init__(self, head = [], editx = [], skipedit = 0, xalign = 0.5):
|
|
605
|
+
|
|
606
|
+
Gtk.TreeView.__init__(self)
|
|
607
|
+
|
|
608
|
+
self.callb = None
|
|
609
|
+
self.chcallb = None
|
|
610
|
+
self.actcallb = None
|
|
611
|
+
|
|
612
|
+
# repair missing column
|
|
613
|
+
if len(head) == 0:
|
|
614
|
+
head.append("")
|
|
615
|
+
|
|
616
|
+
if len(editx) == 0:
|
|
617
|
+
editx.append("")
|
|
618
|
+
|
|
619
|
+
self.types = []
|
|
620
|
+
for aa in head:
|
|
621
|
+
self.types.append(str)
|
|
622
|
+
|
|
623
|
+
self.treestore = Gtk.TreeStore()
|
|
624
|
+
self.treestore.set_column_types(self.types)
|
|
625
|
+
|
|
626
|
+
cnt = 0
|
|
627
|
+
for aa in head:
|
|
628
|
+
# Create a CellRendererText to render the data
|
|
629
|
+
cell = Gtk.CellRendererText()
|
|
630
|
+
cell.set_property("alignment", Pango.Alignment.LEFT)
|
|
631
|
+
cell.set_property("align-set", True)
|
|
632
|
+
cell.set_property("xalign", xalign)
|
|
633
|
+
|
|
634
|
+
if cnt > skipedit:
|
|
635
|
+
cell.set_property("editable", True)
|
|
636
|
+
cell.connect("edited", self.text_edited, cnt)
|
|
637
|
+
|
|
638
|
+
tvcolumn = Gtk.TreeViewColumn(aa)
|
|
639
|
+
tvcolumn.pack_start(cell, True)
|
|
640
|
+
tvcolumn.add_attribute(cell, 'text', cnt)
|
|
641
|
+
self.append_column(tvcolumn)
|
|
642
|
+
cnt += 1
|
|
643
|
+
|
|
644
|
+
self.set_model(self.treestore)
|
|
645
|
+
self.connect("cursor-changed", self.selection)
|
|
646
|
+
self.connect("row-activated", self.activate)
|
|
647
|
+
|
|
648
|
+
def activate(self, xtree, arg2, arg3):
|
|
649
|
+
#print("Activated", row, arg2, arg3)
|
|
650
|
+
sel = xtree.get_selection()
|
|
651
|
+
xmodel, xiter = sel.get_selected()
|
|
652
|
+
if xiter:
|
|
653
|
+
xstr = xmodel.get_value(xiter, 0)
|
|
654
|
+
#print("Activated str", xstr)
|
|
655
|
+
if self.actcallb:
|
|
656
|
+
self.actcallb(xstr)
|
|
657
|
+
|
|
658
|
+
def text_edited(self, widget, path, text, idx):
|
|
659
|
+
#print ("edited", widget, path, text, idx)
|
|
660
|
+
self.treestore[path][idx] = text
|
|
661
|
+
args = []
|
|
662
|
+
for aa in self.treestore[path]:
|
|
663
|
+
args.append(aa)
|
|
664
|
+
if self.chcallb:
|
|
665
|
+
self.chcallb(args)
|
|
666
|
+
|
|
667
|
+
def selection(self, xtree):
|
|
668
|
+
#print("simple tree sel", xtree)
|
|
669
|
+
sel = xtree.get_selection()
|
|
670
|
+
xmodel, xiter = sel.get_selected()
|
|
671
|
+
if xiter:
|
|
672
|
+
self.args = []
|
|
673
|
+
for aa in range(len(self.types)):
|
|
674
|
+
xstr = xmodel.get_value(xiter, aa)
|
|
675
|
+
self.args.append(xstr)
|
|
676
|
+
#print("selection", self.args)
|
|
677
|
+
if self.callb:
|
|
678
|
+
self.callb(self.args)
|
|
679
|
+
|
|
680
|
+
def setcallb(self, callb):
|
|
681
|
+
self.callb = callb
|
|
682
|
+
|
|
683
|
+
def setCHcallb(self, callb):
|
|
684
|
+
self.chcallb = callb
|
|
685
|
+
|
|
686
|
+
def setActcallb(self, callb):
|
|
687
|
+
self.actcallb = callb
|
|
688
|
+
|
|
689
|
+
def append(self, args):
|
|
690
|
+
#print("append", args)
|
|
691
|
+
piter = self.treestore.append(None, args)
|
|
692
|
+
|
|
693
|
+
# TreeStore
|
|
694
|
+
def insert(self, parent, pos, args):
|
|
695
|
+
print("insert", parent, pos, args)
|
|
696
|
+
piter = self.treestore.insert(parent, pos, args)
|
|
697
|
+
|
|
698
|
+
def sel_first(self):
|
|
699
|
+
#print("sel first ...")
|
|
700
|
+
sel = self.get_selection()
|
|
701
|
+
xmodel, xiter = sel.get_selected()
|
|
702
|
+
iterx = self.treestore.get_iter_first()
|
|
703
|
+
sel.select_iter(iterx)
|
|
704
|
+
ppp = self.treestore.get_path(iterx)
|
|
705
|
+
self.set_cursor(ppp, self.get_column(0), False)
|
|
706
|
+
pgutils.usleep(5)
|
|
707
|
+
self.scroll_to_cell(ppp, None, 0, 0, 0 )
|
|
708
|
+
|
|
709
|
+
def sel_last(self):
|
|
710
|
+
#print("sel last ...")
|
|
711
|
+
sel = self.get_selection()
|
|
712
|
+
xmodel, xiter = sel.get_selected()
|
|
713
|
+
iterx = self.treestore.get_iter_first()
|
|
714
|
+
if not iterx:
|
|
715
|
+
return
|
|
716
|
+
while True:
|
|
717
|
+
iter2 = self.treestore.iter_next(iterx)
|
|
718
|
+
if not iter2:
|
|
719
|
+
break
|
|
720
|
+
iterx = iter2.copy()
|
|
721
|
+
sel.select_iter(iterx)
|
|
722
|
+
ppp = self.treestore.get_path(iterx)
|
|
723
|
+
self.set_cursor(ppp, self.get_column(0), False)
|
|
724
|
+
pgutils.usleep(5)
|
|
725
|
+
self.scroll_to_cell(ppp, None, True, 0., 0. )
|
|
726
|
+
#sel.select_path(self.treestore.get_path(iterx))
|
|
727
|
+
|
|
728
|
+
def find_item(self, item):
|
|
729
|
+
|
|
730
|
+
''' find if we already have an item like that '''
|
|
731
|
+
|
|
732
|
+
#print("find", item)
|
|
733
|
+
found = 0
|
|
734
|
+
iterx = self.treestore.get_iter_first()
|
|
735
|
+
if not iterx:
|
|
736
|
+
return found
|
|
737
|
+
while True:
|
|
738
|
+
value = self.treestore.get_value(iterx, 0)
|
|
739
|
+
#print("item:", value)
|
|
740
|
+
if item == value:
|
|
741
|
+
found = True
|
|
742
|
+
break
|
|
743
|
+
iter2 = self.treestore.iter_next(iterx)
|
|
744
|
+
if not iter2:
|
|
745
|
+
break
|
|
746
|
+
iterx = iter2.copy()
|
|
747
|
+
return found
|
|
748
|
+
|
|
749
|
+
def clear(self):
|
|
750
|
+
self.treestore.clear()</code></pre>
|
|
751
|
+
</details>
|
|
752
|
+
<h3>Ancestors</h3>
|
|
753
|
+
<ul class="hlist">
|
|
754
|
+
<li>gi.overrides.Gtk.TreeView</li>
|
|
755
|
+
<li>gi.repository.Gtk.TreeView</li>
|
|
756
|
+
<li>gi.overrides.Gtk.Container</li>
|
|
757
|
+
<li>gi.repository.Gtk.Container</li>
|
|
758
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
759
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
760
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
761
|
+
<li>gi.overrides.GObject.Object</li>
|
|
762
|
+
<li>gi.repository.GObject.Object</li>
|
|
763
|
+
<li>gi._gi.GObject</li>
|
|
764
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
765
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
766
|
+
<li>gi.repository.Gtk.Scrollable</li>
|
|
767
|
+
<li>gobject.GInterface</li>
|
|
768
|
+
</ul>
|
|
769
|
+
<h3>Methods</h3>
|
|
770
|
+
<dl>
|
|
771
|
+
<dt id="pgsimp.SimpleTree.activate"><code class="name flex">
|
|
772
|
+
<span>def <span class="ident">activate</span></span>(<span>self, xtree, arg2, arg3)</span>
|
|
773
|
+
</code></dt>
|
|
774
|
+
<dd>
|
|
775
|
+
<div class="desc"><p>activate(self) -> bool</p></div>
|
|
776
|
+
<details class="source">
|
|
777
|
+
<summary>
|
|
778
|
+
<span>Expand source code</span>
|
|
779
|
+
</summary>
|
|
780
|
+
<pre><code class="python">def activate(self, xtree, arg2, arg3):
|
|
781
|
+
#print("Activated", row, arg2, arg3)
|
|
782
|
+
sel = xtree.get_selection()
|
|
783
|
+
xmodel, xiter = sel.get_selected()
|
|
784
|
+
if xiter:
|
|
785
|
+
xstr = xmodel.get_value(xiter, 0)
|
|
786
|
+
#print("Activated str", xstr)
|
|
787
|
+
if self.actcallb:
|
|
788
|
+
self.actcallb(xstr)</code></pre>
|
|
789
|
+
</details>
|
|
790
|
+
</dd>
|
|
791
|
+
<dt id="pgsimp.SimpleTree.append"><code class="name flex">
|
|
792
|
+
<span>def <span class="ident">append</span></span>(<span>self, args)</span>
|
|
793
|
+
</code></dt>
|
|
794
|
+
<dd>
|
|
795
|
+
<div class="desc"></div>
|
|
796
|
+
<details class="source">
|
|
797
|
+
<summary>
|
|
798
|
+
<span>Expand source code</span>
|
|
799
|
+
</summary>
|
|
800
|
+
<pre><code class="python">def append(self, args):
|
|
801
|
+
#print("append", args)
|
|
802
|
+
piter = self.treestore.append(None, args)</code></pre>
|
|
803
|
+
</details>
|
|
804
|
+
</dd>
|
|
805
|
+
<dt id="pgsimp.SimpleTree.clear"><code class="name flex">
|
|
806
|
+
<span>def <span class="ident">clear</span></span>(<span>self)</span>
|
|
807
|
+
</code></dt>
|
|
808
|
+
<dd>
|
|
809
|
+
<div class="desc"></div>
|
|
810
|
+
<details class="source">
|
|
811
|
+
<summary>
|
|
812
|
+
<span>Expand source code</span>
|
|
813
|
+
</summary>
|
|
814
|
+
<pre><code class="python">def clear(self):
|
|
815
|
+
self.treestore.clear()</code></pre>
|
|
816
|
+
</details>
|
|
817
|
+
</dd>
|
|
818
|
+
<dt id="pgsimp.SimpleTree.find_item"><code class="name flex">
|
|
819
|
+
<span>def <span class="ident">find_item</span></span>(<span>self, item)</span>
|
|
820
|
+
</code></dt>
|
|
821
|
+
<dd>
|
|
822
|
+
<div class="desc"><p>find if we already have an item like that</p></div>
|
|
823
|
+
<details class="source">
|
|
824
|
+
<summary>
|
|
825
|
+
<span>Expand source code</span>
|
|
826
|
+
</summary>
|
|
827
|
+
<pre><code class="python">def find_item(self, item):
|
|
828
|
+
|
|
829
|
+
''' find if we already have an item like that '''
|
|
830
|
+
|
|
831
|
+
#print("find", item)
|
|
832
|
+
found = 0
|
|
833
|
+
iterx = self.treestore.get_iter_first()
|
|
834
|
+
if not iterx:
|
|
835
|
+
return found
|
|
836
|
+
while True:
|
|
837
|
+
value = self.treestore.get_value(iterx, 0)
|
|
838
|
+
#print("item:", value)
|
|
839
|
+
if item == value:
|
|
840
|
+
found = True
|
|
841
|
+
break
|
|
842
|
+
iter2 = self.treestore.iter_next(iterx)
|
|
843
|
+
if not iter2:
|
|
844
|
+
break
|
|
845
|
+
iterx = iter2.copy()
|
|
846
|
+
return found</code></pre>
|
|
847
|
+
</details>
|
|
848
|
+
</dd>
|
|
849
|
+
<dt id="pgsimp.SimpleTree.insert"><code class="name flex">
|
|
850
|
+
<span>def <span class="ident">insert</span></span>(<span>self, parent, pos, args)</span>
|
|
851
|
+
</code></dt>
|
|
852
|
+
<dd>
|
|
853
|
+
<div class="desc"></div>
|
|
854
|
+
<details class="source">
|
|
855
|
+
<summary>
|
|
856
|
+
<span>Expand source code</span>
|
|
857
|
+
</summary>
|
|
858
|
+
<pre><code class="python">def insert(self, parent, pos, args):
|
|
859
|
+
print("insert", parent, pos, args)
|
|
860
|
+
piter = self.treestore.insert(parent, pos, args)</code></pre>
|
|
861
|
+
</details>
|
|
862
|
+
</dd>
|
|
863
|
+
<dt id="pgsimp.SimpleTree.sel_first"><code class="name flex">
|
|
864
|
+
<span>def <span class="ident">sel_first</span></span>(<span>self)</span>
|
|
865
|
+
</code></dt>
|
|
866
|
+
<dd>
|
|
867
|
+
<div class="desc"></div>
|
|
868
|
+
<details class="source">
|
|
869
|
+
<summary>
|
|
870
|
+
<span>Expand source code</span>
|
|
871
|
+
</summary>
|
|
872
|
+
<pre><code class="python">def sel_first(self):
|
|
873
|
+
#print("sel first ...")
|
|
874
|
+
sel = self.get_selection()
|
|
875
|
+
xmodel, xiter = sel.get_selected()
|
|
876
|
+
iterx = self.treestore.get_iter_first()
|
|
877
|
+
sel.select_iter(iterx)
|
|
878
|
+
ppp = self.treestore.get_path(iterx)
|
|
879
|
+
self.set_cursor(ppp, self.get_column(0), False)
|
|
880
|
+
pgutils.usleep(5)
|
|
881
|
+
self.scroll_to_cell(ppp, None, 0, 0, 0 )</code></pre>
|
|
882
|
+
</details>
|
|
883
|
+
</dd>
|
|
884
|
+
<dt id="pgsimp.SimpleTree.sel_last"><code class="name flex">
|
|
885
|
+
<span>def <span class="ident">sel_last</span></span>(<span>self)</span>
|
|
886
|
+
</code></dt>
|
|
887
|
+
<dd>
|
|
888
|
+
<div class="desc"></div>
|
|
889
|
+
<details class="source">
|
|
890
|
+
<summary>
|
|
891
|
+
<span>Expand source code</span>
|
|
892
|
+
</summary>
|
|
893
|
+
<pre><code class="python">def sel_last(self):
|
|
894
|
+
#print("sel last ...")
|
|
895
|
+
sel = self.get_selection()
|
|
896
|
+
xmodel, xiter = sel.get_selected()
|
|
897
|
+
iterx = self.treestore.get_iter_first()
|
|
898
|
+
if not iterx:
|
|
899
|
+
return
|
|
900
|
+
while True:
|
|
901
|
+
iter2 = self.treestore.iter_next(iterx)
|
|
902
|
+
if not iter2:
|
|
903
|
+
break
|
|
904
|
+
iterx = iter2.copy()
|
|
905
|
+
sel.select_iter(iterx)
|
|
906
|
+
ppp = self.treestore.get_path(iterx)
|
|
907
|
+
self.set_cursor(ppp, self.get_column(0), False)
|
|
908
|
+
pgutils.usleep(5)
|
|
909
|
+
self.scroll_to_cell(ppp, None, True, 0., 0. )
|
|
910
|
+
#sel.select_path(self.treestore.get_path(iterx))</code></pre>
|
|
911
|
+
</details>
|
|
912
|
+
</dd>
|
|
913
|
+
<dt id="pgsimp.SimpleTree.selection"><code class="name flex">
|
|
914
|
+
<span>def <span class="ident">selection</span></span>(<span>self, xtree)</span>
|
|
915
|
+
</code></dt>
|
|
916
|
+
<dd>
|
|
917
|
+
<div class="desc"></div>
|
|
918
|
+
<details class="source">
|
|
919
|
+
<summary>
|
|
920
|
+
<span>Expand source code</span>
|
|
921
|
+
</summary>
|
|
922
|
+
<pre><code class="python">def selection(self, xtree):
|
|
923
|
+
#print("simple tree sel", xtree)
|
|
924
|
+
sel = xtree.get_selection()
|
|
925
|
+
xmodel, xiter = sel.get_selected()
|
|
926
|
+
if xiter:
|
|
927
|
+
self.args = []
|
|
928
|
+
for aa in range(len(self.types)):
|
|
929
|
+
xstr = xmodel.get_value(xiter, aa)
|
|
930
|
+
self.args.append(xstr)
|
|
931
|
+
#print("selection", self.args)
|
|
932
|
+
if self.callb:
|
|
933
|
+
self.callb(self.args)</code></pre>
|
|
934
|
+
</details>
|
|
935
|
+
</dd>
|
|
936
|
+
<dt id="pgsimp.SimpleTree.setActcallb"><code class="name flex">
|
|
937
|
+
<span>def <span class="ident">setActcallb</span></span>(<span>self, callb)</span>
|
|
938
|
+
</code></dt>
|
|
939
|
+
<dd>
|
|
940
|
+
<div class="desc"></div>
|
|
941
|
+
<details class="source">
|
|
942
|
+
<summary>
|
|
943
|
+
<span>Expand source code</span>
|
|
944
|
+
</summary>
|
|
945
|
+
<pre><code class="python">def setActcallb(self, callb):
|
|
946
|
+
self.actcallb = callb</code></pre>
|
|
947
|
+
</details>
|
|
948
|
+
</dd>
|
|
949
|
+
<dt id="pgsimp.SimpleTree.setCHcallb"><code class="name flex">
|
|
950
|
+
<span>def <span class="ident">setCHcallb</span></span>(<span>self, callb)</span>
|
|
951
|
+
</code></dt>
|
|
952
|
+
<dd>
|
|
953
|
+
<div class="desc"></div>
|
|
954
|
+
<details class="source">
|
|
955
|
+
<summary>
|
|
956
|
+
<span>Expand source code</span>
|
|
957
|
+
</summary>
|
|
958
|
+
<pre><code class="python">def setCHcallb(self, callb):
|
|
959
|
+
self.chcallb = callb</code></pre>
|
|
960
|
+
</details>
|
|
961
|
+
</dd>
|
|
962
|
+
<dt id="pgsimp.SimpleTree.setcallb"><code class="name flex">
|
|
963
|
+
<span>def <span class="ident">setcallb</span></span>(<span>self, callb)</span>
|
|
964
|
+
</code></dt>
|
|
965
|
+
<dd>
|
|
966
|
+
<div class="desc"></div>
|
|
967
|
+
<details class="source">
|
|
968
|
+
<summary>
|
|
969
|
+
<span>Expand source code</span>
|
|
970
|
+
</summary>
|
|
971
|
+
<pre><code class="python">def setcallb(self, callb):
|
|
972
|
+
self.callb = callb</code></pre>
|
|
973
|
+
</details>
|
|
974
|
+
</dd>
|
|
975
|
+
<dt id="pgsimp.SimpleTree.text_edited"><code class="name flex">
|
|
976
|
+
<span>def <span class="ident">text_edited</span></span>(<span>self, widget, path, text, idx)</span>
|
|
977
|
+
</code></dt>
|
|
978
|
+
<dd>
|
|
979
|
+
<div class="desc"></div>
|
|
980
|
+
<details class="source">
|
|
981
|
+
<summary>
|
|
982
|
+
<span>Expand source code</span>
|
|
983
|
+
</summary>
|
|
984
|
+
<pre><code class="python">def text_edited(self, widget, path, text, idx):
|
|
985
|
+
#print ("edited", widget, path, text, idx)
|
|
986
|
+
self.treestore[path][idx] = text
|
|
987
|
+
args = []
|
|
988
|
+
for aa in self.treestore[path]:
|
|
989
|
+
args.append(aa)
|
|
990
|
+
if self.chcallb:
|
|
991
|
+
self.chcallb(args)</code></pre>
|
|
992
|
+
</details>
|
|
993
|
+
</dd>
|
|
994
|
+
</dl>
|
|
995
|
+
</dd>
|
|
996
|
+
</dl>
|
|
997
|
+
</section>
|
|
998
|
+
</article>
|
|
999
|
+
<nav id="sidebar">
|
|
1000
|
+
<h1>Index</h1>
|
|
1001
|
+
<div class="toc">
|
|
1002
|
+
<ul></ul>
|
|
1003
|
+
</div>
|
|
1004
|
+
<ul id="index">
|
|
1005
|
+
<li><h3><a href="#header-classes">Classes</a></h3>
|
|
1006
|
+
<ul>
|
|
1007
|
+
<li>
|
|
1008
|
+
<h4><code><a title="pgsimp.SimpleEdit" href="#pgsimp.SimpleEdit">SimpleEdit</a></code></h4>
|
|
1009
|
+
<ul class="two-column">
|
|
1010
|
+
<li><code><a title="pgsimp.SimpleEdit.append" href="#pgsimp.SimpleEdit.append">append</a></code></li>
|
|
1011
|
+
<li><code><a title="pgsimp.SimpleEdit.area_key" href="#pgsimp.SimpleEdit.area_key">area_key</a></code></li>
|
|
1012
|
+
<li><code><a title="pgsimp.SimpleEdit.check_saved" href="#pgsimp.SimpleEdit.check_saved">check_saved</a></code></li>
|
|
1013
|
+
<li><code><a title="pgsimp.SimpleEdit.clear" href="#pgsimp.SimpleEdit.clear">clear</a></code></li>
|
|
1014
|
+
<li><code><a title="pgsimp.SimpleEdit.focus_in" href="#pgsimp.SimpleEdit.focus_in">focus_in</a></code></li>
|
|
1015
|
+
<li><code><a title="pgsimp.SimpleEdit.focus_out" href="#pgsimp.SimpleEdit.focus_out">focus_out</a></code></li>
|
|
1016
|
+
<li><code><a title="pgsimp.SimpleEdit.get_text" href="#pgsimp.SimpleEdit.get_text">get_text</a></code></li>
|
|
1017
|
+
<li><code><a title="pgsimp.SimpleEdit.set_text" href="#pgsimp.SimpleEdit.set_text">set_text</a></code></li>
|
|
1018
|
+
<li><code><a title="pgsimp.SimpleEdit.setsavecb" href="#pgsimp.SimpleEdit.setsavecb">setsavecb</a></code></li>
|
|
1019
|
+
<li><code><a title="pgsimp.SimpleEdit.unmapx" href="#pgsimp.SimpleEdit.unmapx">unmapx</a></code></li>
|
|
1020
|
+
</ul>
|
|
1021
|
+
</li>
|
|
1022
|
+
<li>
|
|
1023
|
+
<h4><code><a title="pgsimp.SimpleTree" href="#pgsimp.SimpleTree">SimpleTree</a></code></h4>
|
|
1024
|
+
<ul class="two-column">
|
|
1025
|
+
<li><code><a title="pgsimp.SimpleTree.activate" href="#pgsimp.SimpleTree.activate">activate</a></code></li>
|
|
1026
|
+
<li><code><a title="pgsimp.SimpleTree.append" href="#pgsimp.SimpleTree.append">append</a></code></li>
|
|
1027
|
+
<li><code><a title="pgsimp.SimpleTree.clear" href="#pgsimp.SimpleTree.clear">clear</a></code></li>
|
|
1028
|
+
<li><code><a title="pgsimp.SimpleTree.find_item" href="#pgsimp.SimpleTree.find_item">find_item</a></code></li>
|
|
1029
|
+
<li><code><a title="pgsimp.SimpleTree.insert" href="#pgsimp.SimpleTree.insert">insert</a></code></li>
|
|
1030
|
+
<li><code><a title="pgsimp.SimpleTree.sel_first" href="#pgsimp.SimpleTree.sel_first">sel_first</a></code></li>
|
|
1031
|
+
<li><code><a title="pgsimp.SimpleTree.sel_last" href="#pgsimp.SimpleTree.sel_last">sel_last</a></code></li>
|
|
1032
|
+
<li><code><a title="pgsimp.SimpleTree.selection" href="#pgsimp.SimpleTree.selection">selection</a></code></li>
|
|
1033
|
+
<li><code><a title="pgsimp.SimpleTree.setActcallb" href="#pgsimp.SimpleTree.setActcallb">setActcallb</a></code></li>
|
|
1034
|
+
<li><code><a title="pgsimp.SimpleTree.setCHcallb" href="#pgsimp.SimpleTree.setCHcallb">setCHcallb</a></code></li>
|
|
1035
|
+
<li><code><a title="pgsimp.SimpleTree.setcallb" href="#pgsimp.SimpleTree.setcallb">setcallb</a></code></li>
|
|
1036
|
+
<li><code><a title="pgsimp.SimpleTree.text_edited" href="#pgsimp.SimpleTree.text_edited">text_edited</a></code></li>
|
|
1037
|
+
</ul>
|
|
1038
|
+
</li>
|
|
1039
|
+
</ul>
|
|
1040
|
+
</li>
|
|
1041
|
+
</ul>
|
|
1042
|
+
</nav>
|
|
1043
|
+
</main>
|
|
1044
|
+
<footer id="footer">
|
|
1045
|
+
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
|
1046
|
+
</footer>
|
|
1047
|
+
</body>
|
|
1048
|
+
</html>
|