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,907 @@
|
|
|
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>sutil 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>sutil</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/python3
|
|
30
|
+
|
|
31
|
+
from __future__ import absolute_import
|
|
32
|
+
from __future__ import print_function
|
|
33
|
+
|
|
34
|
+
import sys, traceback, os, time, warnings
|
|
35
|
+
|
|
36
|
+
import gi
|
|
37
|
+
gi.require_version("Gtk", "3.0")
|
|
38
|
+
from gi.repository import Gtk
|
|
39
|
+
from gi.repository import Gdk
|
|
40
|
+
from gi.repository import GObject
|
|
41
|
+
from gi.repository import GLib
|
|
42
|
+
|
|
43
|
+
disp = Gdk.Display.get_default()
|
|
44
|
+
scr = disp.get_default_screen()
|
|
45
|
+
|
|
46
|
+
#print( "num_mon", scr.get_n_monitors() )
|
|
47
|
+
#for aa in range(scr.get_n_monitors()):
|
|
48
|
+
# print( "mon", aa, scr.get_monitor_geometry(aa);)
|
|
49
|
+
|
|
50
|
+
# ------------------------------------------------------------------------
|
|
51
|
+
# Get current screen (monitor) width and height
|
|
52
|
+
|
|
53
|
+
def get_screen_wh():
|
|
54
|
+
|
|
55
|
+
ptr = disp.get_pointer()
|
|
56
|
+
mon = scr.get_monitor_at_point(ptr[1], ptr[2])
|
|
57
|
+
geo = scr.get_monitor_geometry(mon)
|
|
58
|
+
www = geo.width; hhh = geo.height
|
|
59
|
+
if www == 0 or hhh == 0:
|
|
60
|
+
www = Gdk.get_screen_width();
|
|
61
|
+
hhh = Gdk.get_screen_height();
|
|
62
|
+
return www, hhh
|
|
63
|
+
|
|
64
|
+
# ------------------------------------------------------------------------
|
|
65
|
+
# Get current screen (monitor) upper left corner xx / yy
|
|
66
|
+
|
|
67
|
+
def get_screen_xy():
|
|
68
|
+
|
|
69
|
+
ptr = disp.get_pointer()
|
|
70
|
+
mon = scr.get_monitor_at_point(ptr[1], ptr[2])
|
|
71
|
+
geo = scr.get_monitor_geometry(mon)
|
|
72
|
+
return geo.x, geo.y
|
|
73
|
+
|
|
74
|
+
# ------------------------------------------------------------------------
|
|
75
|
+
# Print( an exception as the system would print it)
|
|
76
|
+
|
|
77
|
+
def print_exception(xstr):
|
|
78
|
+
cumm = xstr + " "
|
|
79
|
+
a,b,c = sys.exc_info()
|
|
80
|
+
if a != None:
|
|
81
|
+
cumm += str(a) + " " + str(b) + "\n"
|
|
82
|
+
try:
|
|
83
|
+
#cumm += str(traceback.format_tb(c, 10))
|
|
84
|
+
ttt = traceback.extract_tb(c)
|
|
85
|
+
for aa in ttt:
|
|
86
|
+
cumm += "File: " + os.path.basename(aa[0]) + \
|
|
87
|
+
" Line: " + str(aa[1]) + "\n" + \
|
|
88
|
+
" Context: " + aa[2] + " -> " + aa[3] + "\n"
|
|
89
|
+
except:
|
|
90
|
+
print("Could not print trace stack. ", sys.exc_info())
|
|
91
|
+
print( cumm)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# ------------------------------------------------------------------------
|
|
95
|
+
# Show a regular message:
|
|
96
|
+
|
|
97
|
+
def message(strx, parent = None, title = None, icon = Gtk.MessageType.INFO):
|
|
98
|
+
|
|
99
|
+
dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
|
100
|
+
icon, Gtk.ButtonsType.CLOSE, strx)
|
|
101
|
+
|
|
102
|
+
dialog.set_modal(True)
|
|
103
|
+
|
|
104
|
+
if title:
|
|
105
|
+
dialog.set_title(title)
|
|
106
|
+
else:
|
|
107
|
+
dialog.set_title("DBGui Message")
|
|
108
|
+
|
|
109
|
+
# Close dialog on user response
|
|
110
|
+
dialog.connect("response", lambda d, r: d.destroy())
|
|
111
|
+
dialog.show()
|
|
112
|
+
|
|
113
|
+
# -----------------------------------------------------------------------
|
|
114
|
+
# Sleep just a little, but allow the system to breed
|
|
115
|
+
|
|
116
|
+
def usleep(msec):
|
|
117
|
+
|
|
118
|
+
if sys.version_info[0] < 3 or \
|
|
119
|
+
(sys.version_info[0] == 3 and sys.version_info[1] < 3):
|
|
120
|
+
timefunc = time.clock
|
|
121
|
+
else:
|
|
122
|
+
timefunc = time.process_time
|
|
123
|
+
|
|
124
|
+
got_clock = timefunc() + float(msec) / 1000
|
|
125
|
+
#print( got_clock)
|
|
126
|
+
while True:
|
|
127
|
+
if timefunc() > got_clock:
|
|
128
|
+
break
|
|
129
|
+
#print ("Sleeping")
|
|
130
|
+
Gtk.main_iteration_do(False)
|
|
131
|
+
|
|
132
|
+
# ------------------------------------------------------------------------
|
|
133
|
+
# Create temporary file, return name. Empty string ("") if error.
|
|
134
|
+
|
|
135
|
+
def tmpname(indir, template):
|
|
136
|
+
|
|
137
|
+
fname = ""
|
|
138
|
+
if not os.access(indir, os.W_OK):
|
|
139
|
+
print( "Cannot access ", indir)
|
|
140
|
+
return fname
|
|
141
|
+
|
|
142
|
+
cnt = 1;
|
|
143
|
+
while True:
|
|
144
|
+
tmp = indir + "/" + template + "_" + str(cnt)
|
|
145
|
+
if not os.access(tmp, os.R_OK):
|
|
146
|
+
fname = tmp
|
|
147
|
+
break
|
|
148
|
+
# Safety valve
|
|
149
|
+
if cnt > 10000:
|
|
150
|
+
break
|
|
151
|
+
return fname
|
|
152
|
+
|
|
153
|
+
# ------------------------------------------------------------------------
|
|
154
|
+
# Execute man loop
|
|
155
|
+
|
|
156
|
+
def mainloop():
|
|
157
|
+
while True:
|
|
158
|
+
ev = Gdk.event_peek()
|
|
159
|
+
#print( ev)
|
|
160
|
+
if ev:
|
|
161
|
+
if ev.type == Gdk.EventType.DELETE:
|
|
162
|
+
break
|
|
163
|
+
if ev.type == Gdk.EventType.UNMAP:
|
|
164
|
+
break
|
|
165
|
+
if Gtk.main_iteration_do(True):
|
|
166
|
+
break
|
|
167
|
+
|
|
168
|
+
class Unbuffered(object):
|
|
169
|
+
def __init__(self, stream):
|
|
170
|
+
self.stream = stream
|
|
171
|
+
|
|
172
|
+
def write(self, data):
|
|
173
|
+
self.stream.write(data)
|
|
174
|
+
self.stream.flush()
|
|
175
|
+
|
|
176
|
+
def writelines(self, datas):
|
|
177
|
+
self.stream.writelines(datas)
|
|
178
|
+
self.stream.flush()
|
|
179
|
+
|
|
180
|
+
def __getattr__(self, attr):
|
|
181
|
+
return getattr(self.stream, attr)
|
|
182
|
+
|
|
183
|
+
# Time to str and str to time
|
|
184
|
+
|
|
185
|
+
def time_n2s(ttt):
|
|
186
|
+
sss = time.ctime(ttt)
|
|
187
|
+
return sss
|
|
188
|
+
|
|
189
|
+
def time_s2n(sss):
|
|
190
|
+
rrr = time.strptime(sss)
|
|
191
|
+
ttt = time.mktime(rrr)
|
|
192
|
+
return ttt
|
|
193
|
+
|
|
194
|
+
def yes_no_cancel(title, message, cancel = True, parent = None):
|
|
195
|
+
|
|
196
|
+
#warnings.simplefilter("ignore")
|
|
197
|
+
dialog = Gtk.Dialog(title,
|
|
198
|
+
None,
|
|
199
|
+
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
dialog.set_default_response(Gtk.ResponseType.YES)
|
|
203
|
+
dialog.set_position(Gtk.WindowPosition.CENTER)
|
|
204
|
+
dialog.set_transient_for(parent)
|
|
205
|
+
|
|
206
|
+
sp = " "
|
|
207
|
+
label = Gtk.Label(message);
|
|
208
|
+
label2 = Gtk.Label(sp); label3 = Gtk.Label(sp)
|
|
209
|
+
label2a = Gtk.Label(sp); label3a = Gtk.Label(sp)
|
|
210
|
+
|
|
211
|
+
hbox = Gtk.HBox() ;
|
|
212
|
+
|
|
213
|
+
hbox.pack_start(label2, 0, 0, 0);
|
|
214
|
+
hbox.pack_start(label, 1, 1, 0);
|
|
215
|
+
hbox.pack_start(label3, 0, 0, 0)
|
|
216
|
+
|
|
217
|
+
dialog.vbox.pack_start(label2a, 0, 0, 0);
|
|
218
|
+
dialog.vbox.pack_start(hbox, 0, 0, 0)
|
|
219
|
+
dialog.vbox.pack_start(label3a, 0, 0, 0);
|
|
220
|
+
|
|
221
|
+
dialog.add_button("_Yes", Gtk.ResponseType.YES)
|
|
222
|
+
dialog.add_button("_No", Gtk.ResponseType.NO)
|
|
223
|
+
|
|
224
|
+
if cancel:
|
|
225
|
+
dialog.add_button("_Cancel", Gtk.ResponseType.CANCEL)
|
|
226
|
+
|
|
227
|
+
dialog.connect("key-press-event", yn_key, cancel)
|
|
228
|
+
#dialog.connect("key-release-event", yn_key, cancel)
|
|
229
|
+
#warnings.simplefilter("default")
|
|
230
|
+
|
|
231
|
+
dialog.show_all()
|
|
232
|
+
response = dialog.run()
|
|
233
|
+
# Convert all responses to cancel
|
|
234
|
+
if response == Gtk.ResponseType.CANCEL or \
|
|
235
|
+
response == Gtk.ResponseType.REJECT or \
|
|
236
|
+
response == Gtk.ResponseType.CLOSE or \
|
|
237
|
+
response == Gtk.ResponseType.DELETE_EVENT:
|
|
238
|
+
response = Gtk.ResponseType.CANCEL
|
|
239
|
+
dialog.destroy()
|
|
240
|
+
|
|
241
|
+
return response
|
|
242
|
+
|
|
243
|
+
def yn_key(win, event, cancel):
|
|
244
|
+
#print( event)
|
|
245
|
+
if event.keyval == Gdk.KEY_y or \
|
|
246
|
+
event.keyval == Gdk.KEY_Y:
|
|
247
|
+
win.response(Gtk.ResponseType.YES)
|
|
248
|
+
|
|
249
|
+
if event.keyval == Gdk.KEY_n or \
|
|
250
|
+
event.keyval == Gdk.KEY_N:
|
|
251
|
+
win.response(Gtk.ResponseType.NO)
|
|
252
|
+
|
|
253
|
+
if cancel:
|
|
254
|
+
if event.keyval == Gdk.KEY_c or \
|
|
255
|
+
event.keyval == Gdk.KEY_C:
|
|
256
|
+
win.response(Gtk.ResponseType.CANCEL)
|
|
257
|
+
|
|
258
|
+
def opendialog(parent=None):
|
|
259
|
+
|
|
260
|
+
# We create an array, so it is passed around by reference
|
|
261
|
+
fname = [""]
|
|
262
|
+
|
|
263
|
+
def makefilter(mask, name):
|
|
264
|
+
filter = Gtk.FileFilter.new()
|
|
265
|
+
filter.add_pattern(mask)
|
|
266
|
+
filter.set_name(name)
|
|
267
|
+
return filter
|
|
268
|
+
|
|
269
|
+
def done_open_fc(win, resp, fname):
|
|
270
|
+
#print "done_open_fc", win, resp
|
|
271
|
+
if resp == Gtk.ButtonsType.OK:
|
|
272
|
+
fname[0] = win.get_filename()
|
|
273
|
+
if not fname[0]:
|
|
274
|
+
#print "Must have filename"
|
|
275
|
+
pass
|
|
276
|
+
elif os.path.isdir(fname[0]):
|
|
277
|
+
os.chdir(fname[0])
|
|
278
|
+
win.set_current_folder(fname[0])
|
|
279
|
+
return
|
|
280
|
+
else:
|
|
281
|
+
#print("OFD", fname[0])
|
|
282
|
+
pass
|
|
283
|
+
win.destroy()
|
|
284
|
+
|
|
285
|
+
but = "Cancel", Gtk.ButtonsType.CANCEL,\
|
|
286
|
+
"Open File", Gtk.ButtonsType.OK
|
|
287
|
+
|
|
288
|
+
fc = Gtk.FileChooserDialog("Open file", parent, \
|
|
289
|
+
Gtk.FileChooserAction.OPEN \
|
|
290
|
+
, but)
|
|
291
|
+
|
|
292
|
+
filters = []
|
|
293
|
+
filters.append(makefilter("*.mup", "MarkUp files (*.py)"))
|
|
294
|
+
filters.append(makefilter("*.*", "All files (*.*)"))
|
|
295
|
+
|
|
296
|
+
if filters:
|
|
297
|
+
for aa in filters:
|
|
298
|
+
fc.add_filter(aa)
|
|
299
|
+
|
|
300
|
+
fc.set_default_response(Gtk.ButtonsType.OK)
|
|
301
|
+
fc.set_current_folder(os.getcwd())
|
|
302
|
+
fc.connect("response", done_open_fc, fname)
|
|
303
|
+
#fc.connect("current-folder-changed", self.folder_ch )
|
|
304
|
+
#fc.set_current_name(self.fname)
|
|
305
|
+
fc.run()
|
|
306
|
+
#print("OFD2", fname[0])
|
|
307
|
+
return fname[0]
|
|
308
|
+
|
|
309
|
+
def savedialog(resp):
|
|
310
|
+
|
|
311
|
+
#print "File dialog"
|
|
312
|
+
fname = [""] # So it is passed around as a reference
|
|
313
|
+
|
|
314
|
+
def makefilter(mask, name):
|
|
315
|
+
filter = Gtk.FileFilter.new()
|
|
316
|
+
filter.add_pattern(mask)
|
|
317
|
+
filter.set_name(name)
|
|
318
|
+
return filter
|
|
319
|
+
|
|
320
|
+
def done_fc(win, resp, fname):
|
|
321
|
+
#print( "done_fc", win, resp)
|
|
322
|
+
if resp == Gtk.ResponseType.OK:
|
|
323
|
+
fname[0] = win.get_filename()
|
|
324
|
+
if not fname[0]:
|
|
325
|
+
print("Must have filename")
|
|
326
|
+
else:
|
|
327
|
+
pass
|
|
328
|
+
win.destroy()
|
|
329
|
+
|
|
330
|
+
but = "Cancel", Gtk.ResponseType.CANCEL, \
|
|
331
|
+
"Save File", Gtk.ResponseType.OK
|
|
332
|
+
fc = Gtk.FileChooserDialog("Save file as ... ", None,
|
|
333
|
+
Gtk.FileChooserAction.SAVE, but)
|
|
334
|
+
|
|
335
|
+
#fc.set_do_overwrite_confirmation(True)
|
|
336
|
+
|
|
337
|
+
filters = []
|
|
338
|
+
filters.append(makefilter("*.mup", "MarkUp files (*.py)"))
|
|
339
|
+
filters.append(makefilter("*.*", "All files (*.*)"))
|
|
340
|
+
|
|
341
|
+
if filters:
|
|
342
|
+
for aa in filters:
|
|
343
|
+
fc.add_filter(aa)
|
|
344
|
+
|
|
345
|
+
fc.set_current_name(os.path.basename(fname[0]))
|
|
346
|
+
fc.set_current_folder(os.path.dirname(fname[0]))
|
|
347
|
+
fc.set_default_response(Gtk.ResponseType.OK)
|
|
348
|
+
fc.connect("response", done_fc, fname)
|
|
349
|
+
fc.run()
|
|
350
|
+
return fname[0]
|
|
351
|
+
|
|
352
|
+
# ------------------------------------------------------------------------
|
|
353
|
+
# Count lead spaces
|
|
354
|
+
|
|
355
|
+
def leadspace(strx):
|
|
356
|
+
cnt = 0;
|
|
357
|
+
for aa in range(len(strx)):
|
|
358
|
+
bb = strx[aa]
|
|
359
|
+
if bb == " ":
|
|
360
|
+
cnt += 1
|
|
361
|
+
elif bb == "\t":
|
|
362
|
+
cnt += 1
|
|
363
|
+
elif bb == "\r":
|
|
364
|
+
cnt += 1
|
|
365
|
+
elif bb == "\n":
|
|
366
|
+
cnt += 1
|
|
367
|
+
else:
|
|
368
|
+
break
|
|
369
|
+
return cnt
|
|
370
|
+
|
|
371
|
+
# EOF</code></pre>
|
|
372
|
+
</details>
|
|
373
|
+
</section>
|
|
374
|
+
<section>
|
|
375
|
+
</section>
|
|
376
|
+
<section>
|
|
377
|
+
</section>
|
|
378
|
+
<section>
|
|
379
|
+
<h2 class="section-title" id="header-functions">Functions</h2>
|
|
380
|
+
<dl>
|
|
381
|
+
<dt id="sutil.get_screen_wh"><code class="name flex">
|
|
382
|
+
<span>def <span class="ident">get_screen_wh</span></span>(<span>)</span>
|
|
383
|
+
</code></dt>
|
|
384
|
+
<dd>
|
|
385
|
+
<div class="desc"></div>
|
|
386
|
+
<details class="source">
|
|
387
|
+
<summary>
|
|
388
|
+
<span>Expand source code</span>
|
|
389
|
+
</summary>
|
|
390
|
+
<pre><code class="python">def get_screen_wh():
|
|
391
|
+
|
|
392
|
+
ptr = disp.get_pointer()
|
|
393
|
+
mon = scr.get_monitor_at_point(ptr[1], ptr[2])
|
|
394
|
+
geo = scr.get_monitor_geometry(mon)
|
|
395
|
+
www = geo.width; hhh = geo.height
|
|
396
|
+
if www == 0 or hhh == 0:
|
|
397
|
+
www = Gdk.get_screen_width();
|
|
398
|
+
hhh = Gdk.get_screen_height();
|
|
399
|
+
return www, hhh</code></pre>
|
|
400
|
+
</details>
|
|
401
|
+
</dd>
|
|
402
|
+
<dt id="sutil.get_screen_xy"><code class="name flex">
|
|
403
|
+
<span>def <span class="ident">get_screen_xy</span></span>(<span>)</span>
|
|
404
|
+
</code></dt>
|
|
405
|
+
<dd>
|
|
406
|
+
<div class="desc"></div>
|
|
407
|
+
<details class="source">
|
|
408
|
+
<summary>
|
|
409
|
+
<span>Expand source code</span>
|
|
410
|
+
</summary>
|
|
411
|
+
<pre><code class="python">def get_screen_xy():
|
|
412
|
+
|
|
413
|
+
ptr = disp.get_pointer()
|
|
414
|
+
mon = scr.get_monitor_at_point(ptr[1], ptr[2])
|
|
415
|
+
geo = scr.get_monitor_geometry(mon)
|
|
416
|
+
return geo.x, geo.y</code></pre>
|
|
417
|
+
</details>
|
|
418
|
+
</dd>
|
|
419
|
+
<dt id="sutil.leadspace"><code class="name flex">
|
|
420
|
+
<span>def <span class="ident">leadspace</span></span>(<span>strx)</span>
|
|
421
|
+
</code></dt>
|
|
422
|
+
<dd>
|
|
423
|
+
<div class="desc"></div>
|
|
424
|
+
<details class="source">
|
|
425
|
+
<summary>
|
|
426
|
+
<span>Expand source code</span>
|
|
427
|
+
</summary>
|
|
428
|
+
<pre><code class="python">def leadspace(strx):
|
|
429
|
+
cnt = 0;
|
|
430
|
+
for aa in range(len(strx)):
|
|
431
|
+
bb = strx[aa]
|
|
432
|
+
if bb == " ":
|
|
433
|
+
cnt += 1
|
|
434
|
+
elif bb == "\t":
|
|
435
|
+
cnt += 1
|
|
436
|
+
elif bb == "\r":
|
|
437
|
+
cnt += 1
|
|
438
|
+
elif bb == "\n":
|
|
439
|
+
cnt += 1
|
|
440
|
+
else:
|
|
441
|
+
break
|
|
442
|
+
return cnt</code></pre>
|
|
443
|
+
</details>
|
|
444
|
+
</dd>
|
|
445
|
+
<dt id="sutil.mainloop"><code class="name flex">
|
|
446
|
+
<span>def <span class="ident">mainloop</span></span>(<span>)</span>
|
|
447
|
+
</code></dt>
|
|
448
|
+
<dd>
|
|
449
|
+
<div class="desc"></div>
|
|
450
|
+
<details class="source">
|
|
451
|
+
<summary>
|
|
452
|
+
<span>Expand source code</span>
|
|
453
|
+
</summary>
|
|
454
|
+
<pre><code class="python">def mainloop():
|
|
455
|
+
while True:
|
|
456
|
+
ev = Gdk.event_peek()
|
|
457
|
+
#print( ev)
|
|
458
|
+
if ev:
|
|
459
|
+
if ev.type == Gdk.EventType.DELETE:
|
|
460
|
+
break
|
|
461
|
+
if ev.type == Gdk.EventType.UNMAP:
|
|
462
|
+
break
|
|
463
|
+
if Gtk.main_iteration_do(True):
|
|
464
|
+
break</code></pre>
|
|
465
|
+
</details>
|
|
466
|
+
</dd>
|
|
467
|
+
<dt id="sutil.message"><code class="name flex">
|
|
468
|
+
<span>def <span class="ident">message</span></span>(<span>strx, parent=None, title=None, icon=<enum GTK_MESSAGE_INFO of type Gtk.MessageType>)</span>
|
|
469
|
+
</code></dt>
|
|
470
|
+
<dd>
|
|
471
|
+
<div class="desc"></div>
|
|
472
|
+
<details class="source">
|
|
473
|
+
<summary>
|
|
474
|
+
<span>Expand source code</span>
|
|
475
|
+
</summary>
|
|
476
|
+
<pre><code class="python">def message(strx, parent = None, title = None, icon = Gtk.MessageType.INFO):
|
|
477
|
+
|
|
478
|
+
dialog = Gtk.MessageDialog(parent, Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
|
479
|
+
icon, Gtk.ButtonsType.CLOSE, strx)
|
|
480
|
+
|
|
481
|
+
dialog.set_modal(True)
|
|
482
|
+
|
|
483
|
+
if title:
|
|
484
|
+
dialog.set_title(title)
|
|
485
|
+
else:
|
|
486
|
+
dialog.set_title("DBGui Message")
|
|
487
|
+
|
|
488
|
+
# Close dialog on user response
|
|
489
|
+
dialog.connect("response", lambda d, r: d.destroy())
|
|
490
|
+
dialog.show()</code></pre>
|
|
491
|
+
</details>
|
|
492
|
+
</dd>
|
|
493
|
+
<dt id="sutil.opendialog"><code class="name flex">
|
|
494
|
+
<span>def <span class="ident">opendialog</span></span>(<span>parent=None)</span>
|
|
495
|
+
</code></dt>
|
|
496
|
+
<dd>
|
|
497
|
+
<div class="desc"></div>
|
|
498
|
+
<details class="source">
|
|
499
|
+
<summary>
|
|
500
|
+
<span>Expand source code</span>
|
|
501
|
+
</summary>
|
|
502
|
+
<pre><code class="python">def opendialog(parent=None):
|
|
503
|
+
|
|
504
|
+
# We create an array, so it is passed around by reference
|
|
505
|
+
fname = [""]
|
|
506
|
+
|
|
507
|
+
def makefilter(mask, name):
|
|
508
|
+
filter = Gtk.FileFilter.new()
|
|
509
|
+
filter.add_pattern(mask)
|
|
510
|
+
filter.set_name(name)
|
|
511
|
+
return filter
|
|
512
|
+
|
|
513
|
+
def done_open_fc(win, resp, fname):
|
|
514
|
+
#print "done_open_fc", win, resp
|
|
515
|
+
if resp == Gtk.ButtonsType.OK:
|
|
516
|
+
fname[0] = win.get_filename()
|
|
517
|
+
if not fname[0]:
|
|
518
|
+
#print "Must have filename"
|
|
519
|
+
pass
|
|
520
|
+
elif os.path.isdir(fname[0]):
|
|
521
|
+
os.chdir(fname[0])
|
|
522
|
+
win.set_current_folder(fname[0])
|
|
523
|
+
return
|
|
524
|
+
else:
|
|
525
|
+
#print("OFD", fname[0])
|
|
526
|
+
pass
|
|
527
|
+
win.destroy()
|
|
528
|
+
|
|
529
|
+
but = "Cancel", Gtk.ButtonsType.CANCEL,\
|
|
530
|
+
"Open File", Gtk.ButtonsType.OK
|
|
531
|
+
|
|
532
|
+
fc = Gtk.FileChooserDialog("Open file", parent, \
|
|
533
|
+
Gtk.FileChooserAction.OPEN \
|
|
534
|
+
, but)
|
|
535
|
+
|
|
536
|
+
filters = []
|
|
537
|
+
filters.append(makefilter("*.mup", "MarkUp files (*.py)"))
|
|
538
|
+
filters.append(makefilter("*.*", "All files (*.*)"))
|
|
539
|
+
|
|
540
|
+
if filters:
|
|
541
|
+
for aa in filters:
|
|
542
|
+
fc.add_filter(aa)
|
|
543
|
+
|
|
544
|
+
fc.set_default_response(Gtk.ButtonsType.OK)
|
|
545
|
+
fc.set_current_folder(os.getcwd())
|
|
546
|
+
fc.connect("response", done_open_fc, fname)
|
|
547
|
+
#fc.connect("current-folder-changed", self.folder_ch )
|
|
548
|
+
#fc.set_current_name(self.fname)
|
|
549
|
+
fc.run()
|
|
550
|
+
#print("OFD2", fname[0])
|
|
551
|
+
return fname[0]</code></pre>
|
|
552
|
+
</details>
|
|
553
|
+
</dd>
|
|
554
|
+
<dt id="sutil.print_exception"><code class="name flex">
|
|
555
|
+
<span>def <span class="ident">print_exception</span></span>(<span>xstr)</span>
|
|
556
|
+
</code></dt>
|
|
557
|
+
<dd>
|
|
558
|
+
<div class="desc"></div>
|
|
559
|
+
<details class="source">
|
|
560
|
+
<summary>
|
|
561
|
+
<span>Expand source code</span>
|
|
562
|
+
</summary>
|
|
563
|
+
<pre><code class="python">def print_exception(xstr):
|
|
564
|
+
cumm = xstr + " "
|
|
565
|
+
a,b,c = sys.exc_info()
|
|
566
|
+
if a != None:
|
|
567
|
+
cumm += str(a) + " " + str(b) + "\n"
|
|
568
|
+
try:
|
|
569
|
+
#cumm += str(traceback.format_tb(c, 10))
|
|
570
|
+
ttt = traceback.extract_tb(c)
|
|
571
|
+
for aa in ttt:
|
|
572
|
+
cumm += "File: " + os.path.basename(aa[0]) + \
|
|
573
|
+
" Line: " + str(aa[1]) + "\n" + \
|
|
574
|
+
" Context: " + aa[2] + " -> " + aa[3] + "\n"
|
|
575
|
+
except:
|
|
576
|
+
print("Could not print trace stack. ", sys.exc_info())
|
|
577
|
+
print( cumm)</code></pre>
|
|
578
|
+
</details>
|
|
579
|
+
</dd>
|
|
580
|
+
<dt id="sutil.savedialog"><code class="name flex">
|
|
581
|
+
<span>def <span class="ident">savedialog</span></span>(<span>resp)</span>
|
|
582
|
+
</code></dt>
|
|
583
|
+
<dd>
|
|
584
|
+
<div class="desc"></div>
|
|
585
|
+
<details class="source">
|
|
586
|
+
<summary>
|
|
587
|
+
<span>Expand source code</span>
|
|
588
|
+
</summary>
|
|
589
|
+
<pre><code class="python">def savedialog(resp):
|
|
590
|
+
|
|
591
|
+
#print "File dialog"
|
|
592
|
+
fname = [""] # So it is passed around as a reference
|
|
593
|
+
|
|
594
|
+
def makefilter(mask, name):
|
|
595
|
+
filter = Gtk.FileFilter.new()
|
|
596
|
+
filter.add_pattern(mask)
|
|
597
|
+
filter.set_name(name)
|
|
598
|
+
return filter
|
|
599
|
+
|
|
600
|
+
def done_fc(win, resp, fname):
|
|
601
|
+
#print( "done_fc", win, resp)
|
|
602
|
+
if resp == Gtk.ResponseType.OK:
|
|
603
|
+
fname[0] = win.get_filename()
|
|
604
|
+
if not fname[0]:
|
|
605
|
+
print("Must have filename")
|
|
606
|
+
else:
|
|
607
|
+
pass
|
|
608
|
+
win.destroy()
|
|
609
|
+
|
|
610
|
+
but = "Cancel", Gtk.ResponseType.CANCEL, \
|
|
611
|
+
"Save File", Gtk.ResponseType.OK
|
|
612
|
+
fc = Gtk.FileChooserDialog("Save file as ... ", None,
|
|
613
|
+
Gtk.FileChooserAction.SAVE, but)
|
|
614
|
+
|
|
615
|
+
#fc.set_do_overwrite_confirmation(True)
|
|
616
|
+
|
|
617
|
+
filters = []
|
|
618
|
+
filters.append(makefilter("*.mup", "MarkUp files (*.py)"))
|
|
619
|
+
filters.append(makefilter("*.*", "All files (*.*)"))
|
|
620
|
+
|
|
621
|
+
if filters:
|
|
622
|
+
for aa in filters:
|
|
623
|
+
fc.add_filter(aa)
|
|
624
|
+
|
|
625
|
+
fc.set_current_name(os.path.basename(fname[0]))
|
|
626
|
+
fc.set_current_folder(os.path.dirname(fname[0]))
|
|
627
|
+
fc.set_default_response(Gtk.ResponseType.OK)
|
|
628
|
+
fc.connect("response", done_fc, fname)
|
|
629
|
+
fc.run()
|
|
630
|
+
return fname[0]</code></pre>
|
|
631
|
+
</details>
|
|
632
|
+
</dd>
|
|
633
|
+
<dt id="sutil.time_n2s"><code class="name flex">
|
|
634
|
+
<span>def <span class="ident">time_n2s</span></span>(<span>ttt)</span>
|
|
635
|
+
</code></dt>
|
|
636
|
+
<dd>
|
|
637
|
+
<div class="desc"></div>
|
|
638
|
+
<details class="source">
|
|
639
|
+
<summary>
|
|
640
|
+
<span>Expand source code</span>
|
|
641
|
+
</summary>
|
|
642
|
+
<pre><code class="python">def time_n2s(ttt):
|
|
643
|
+
sss = time.ctime(ttt)
|
|
644
|
+
return sss</code></pre>
|
|
645
|
+
</details>
|
|
646
|
+
</dd>
|
|
647
|
+
<dt id="sutil.time_s2n"><code class="name flex">
|
|
648
|
+
<span>def <span class="ident">time_s2n</span></span>(<span>sss)</span>
|
|
649
|
+
</code></dt>
|
|
650
|
+
<dd>
|
|
651
|
+
<div class="desc"></div>
|
|
652
|
+
<details class="source">
|
|
653
|
+
<summary>
|
|
654
|
+
<span>Expand source code</span>
|
|
655
|
+
</summary>
|
|
656
|
+
<pre><code class="python">def time_s2n(sss):
|
|
657
|
+
rrr = time.strptime(sss)
|
|
658
|
+
ttt = time.mktime(rrr)
|
|
659
|
+
return ttt</code></pre>
|
|
660
|
+
</details>
|
|
661
|
+
</dd>
|
|
662
|
+
<dt id="sutil.tmpname"><code class="name flex">
|
|
663
|
+
<span>def <span class="ident">tmpname</span></span>(<span>indir, template)</span>
|
|
664
|
+
</code></dt>
|
|
665
|
+
<dd>
|
|
666
|
+
<div class="desc"></div>
|
|
667
|
+
<details class="source">
|
|
668
|
+
<summary>
|
|
669
|
+
<span>Expand source code</span>
|
|
670
|
+
</summary>
|
|
671
|
+
<pre><code class="python">def tmpname(indir, template):
|
|
672
|
+
|
|
673
|
+
fname = ""
|
|
674
|
+
if not os.access(indir, os.W_OK):
|
|
675
|
+
print( "Cannot access ", indir)
|
|
676
|
+
return fname
|
|
677
|
+
|
|
678
|
+
cnt = 1;
|
|
679
|
+
while True:
|
|
680
|
+
tmp = indir + "/" + template + "_" + str(cnt)
|
|
681
|
+
if not os.access(tmp, os.R_OK):
|
|
682
|
+
fname = tmp
|
|
683
|
+
break
|
|
684
|
+
# Safety valve
|
|
685
|
+
if cnt > 10000:
|
|
686
|
+
break
|
|
687
|
+
return fname</code></pre>
|
|
688
|
+
</details>
|
|
689
|
+
</dd>
|
|
690
|
+
<dt id="sutil.usleep"><code class="name flex">
|
|
691
|
+
<span>def <span class="ident">usleep</span></span>(<span>msec)</span>
|
|
692
|
+
</code></dt>
|
|
693
|
+
<dd>
|
|
694
|
+
<div class="desc"></div>
|
|
695
|
+
<details class="source">
|
|
696
|
+
<summary>
|
|
697
|
+
<span>Expand source code</span>
|
|
698
|
+
</summary>
|
|
699
|
+
<pre><code class="python">def usleep(msec):
|
|
700
|
+
|
|
701
|
+
if sys.version_info[0] < 3 or \
|
|
702
|
+
(sys.version_info[0] == 3 and sys.version_info[1] < 3):
|
|
703
|
+
timefunc = time.clock
|
|
704
|
+
else:
|
|
705
|
+
timefunc = time.process_time
|
|
706
|
+
|
|
707
|
+
got_clock = timefunc() + float(msec) / 1000
|
|
708
|
+
#print( got_clock)
|
|
709
|
+
while True:
|
|
710
|
+
if timefunc() > got_clock:
|
|
711
|
+
break
|
|
712
|
+
#print ("Sleeping")
|
|
713
|
+
Gtk.main_iteration_do(False)</code></pre>
|
|
714
|
+
</details>
|
|
715
|
+
</dd>
|
|
716
|
+
<dt id="sutil.yes_no_cancel"><code class="name flex">
|
|
717
|
+
<span>def <span class="ident">yes_no_cancel</span></span>(<span>title, message, cancel=True, parent=None)</span>
|
|
718
|
+
</code></dt>
|
|
719
|
+
<dd>
|
|
720
|
+
<div class="desc"></div>
|
|
721
|
+
<details class="source">
|
|
722
|
+
<summary>
|
|
723
|
+
<span>Expand source code</span>
|
|
724
|
+
</summary>
|
|
725
|
+
<pre><code class="python">def yes_no_cancel(title, message, cancel = True, parent = None):
|
|
726
|
+
|
|
727
|
+
#warnings.simplefilter("ignore")
|
|
728
|
+
dialog = Gtk.Dialog(title,
|
|
729
|
+
None,
|
|
730
|
+
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT)
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
dialog.set_default_response(Gtk.ResponseType.YES)
|
|
734
|
+
dialog.set_position(Gtk.WindowPosition.CENTER)
|
|
735
|
+
dialog.set_transient_for(parent)
|
|
736
|
+
|
|
737
|
+
sp = " "
|
|
738
|
+
label = Gtk.Label(message);
|
|
739
|
+
label2 = Gtk.Label(sp); label3 = Gtk.Label(sp)
|
|
740
|
+
label2a = Gtk.Label(sp); label3a = Gtk.Label(sp)
|
|
741
|
+
|
|
742
|
+
hbox = Gtk.HBox() ;
|
|
743
|
+
|
|
744
|
+
hbox.pack_start(label2, 0, 0, 0);
|
|
745
|
+
hbox.pack_start(label, 1, 1, 0);
|
|
746
|
+
hbox.pack_start(label3, 0, 0, 0)
|
|
747
|
+
|
|
748
|
+
dialog.vbox.pack_start(label2a, 0, 0, 0);
|
|
749
|
+
dialog.vbox.pack_start(hbox, 0, 0, 0)
|
|
750
|
+
dialog.vbox.pack_start(label3a, 0, 0, 0);
|
|
751
|
+
|
|
752
|
+
dialog.add_button("_Yes", Gtk.ResponseType.YES)
|
|
753
|
+
dialog.add_button("_No", Gtk.ResponseType.NO)
|
|
754
|
+
|
|
755
|
+
if cancel:
|
|
756
|
+
dialog.add_button("_Cancel", Gtk.ResponseType.CANCEL)
|
|
757
|
+
|
|
758
|
+
dialog.connect("key-press-event", yn_key, cancel)
|
|
759
|
+
#dialog.connect("key-release-event", yn_key, cancel)
|
|
760
|
+
#warnings.simplefilter("default")
|
|
761
|
+
|
|
762
|
+
dialog.show_all()
|
|
763
|
+
response = dialog.run()
|
|
764
|
+
# Convert all responses to cancel
|
|
765
|
+
if response == Gtk.ResponseType.CANCEL or \
|
|
766
|
+
response == Gtk.ResponseType.REJECT or \
|
|
767
|
+
response == Gtk.ResponseType.CLOSE or \
|
|
768
|
+
response == Gtk.ResponseType.DELETE_EVENT:
|
|
769
|
+
response = Gtk.ResponseType.CANCEL
|
|
770
|
+
dialog.destroy()
|
|
771
|
+
|
|
772
|
+
return response</code></pre>
|
|
773
|
+
</details>
|
|
774
|
+
</dd>
|
|
775
|
+
<dt id="sutil.yn_key"><code class="name flex">
|
|
776
|
+
<span>def <span class="ident">yn_key</span></span>(<span>win, event, cancel)</span>
|
|
777
|
+
</code></dt>
|
|
778
|
+
<dd>
|
|
779
|
+
<div class="desc"></div>
|
|
780
|
+
<details class="source">
|
|
781
|
+
<summary>
|
|
782
|
+
<span>Expand source code</span>
|
|
783
|
+
</summary>
|
|
784
|
+
<pre><code class="python">def yn_key(win, event, cancel):
|
|
785
|
+
#print( event)
|
|
786
|
+
if event.keyval == Gdk.KEY_y or \
|
|
787
|
+
event.keyval == Gdk.KEY_Y:
|
|
788
|
+
win.response(Gtk.ResponseType.YES)
|
|
789
|
+
|
|
790
|
+
if event.keyval == Gdk.KEY_n or \
|
|
791
|
+
event.keyval == Gdk.KEY_N:
|
|
792
|
+
win.response(Gtk.ResponseType.NO)
|
|
793
|
+
|
|
794
|
+
if cancel:
|
|
795
|
+
if event.keyval == Gdk.KEY_c or \
|
|
796
|
+
event.keyval == Gdk.KEY_C:
|
|
797
|
+
win.response(Gtk.ResponseType.CANCEL)</code></pre>
|
|
798
|
+
</details>
|
|
799
|
+
</dd>
|
|
800
|
+
</dl>
|
|
801
|
+
</section>
|
|
802
|
+
<section>
|
|
803
|
+
<h2 class="section-title" id="header-classes">Classes</h2>
|
|
804
|
+
<dl>
|
|
805
|
+
<dt id="sutil.Unbuffered"><code class="flex name class">
|
|
806
|
+
<span>class <span class="ident">Unbuffered</span></span>
|
|
807
|
+
<span>(</span><span>stream)</span>
|
|
808
|
+
</code></dt>
|
|
809
|
+
<dd>
|
|
810
|
+
<div class="desc"></div>
|
|
811
|
+
<details class="source">
|
|
812
|
+
<summary>
|
|
813
|
+
<span>Expand source code</span>
|
|
814
|
+
</summary>
|
|
815
|
+
<pre><code class="python">class Unbuffered(object):
|
|
816
|
+
def __init__(self, stream):
|
|
817
|
+
self.stream = stream
|
|
818
|
+
|
|
819
|
+
def write(self, data):
|
|
820
|
+
self.stream.write(data)
|
|
821
|
+
self.stream.flush()
|
|
822
|
+
|
|
823
|
+
def writelines(self, datas):
|
|
824
|
+
self.stream.writelines(datas)
|
|
825
|
+
self.stream.flush()
|
|
826
|
+
|
|
827
|
+
def __getattr__(self, attr):
|
|
828
|
+
return getattr(self.stream, attr)</code></pre>
|
|
829
|
+
</details>
|
|
830
|
+
<h3>Methods</h3>
|
|
831
|
+
<dl>
|
|
832
|
+
<dt id="sutil.Unbuffered.write"><code class="name flex">
|
|
833
|
+
<span>def <span class="ident">write</span></span>(<span>self, data)</span>
|
|
834
|
+
</code></dt>
|
|
835
|
+
<dd>
|
|
836
|
+
<div class="desc"></div>
|
|
837
|
+
<details class="source">
|
|
838
|
+
<summary>
|
|
839
|
+
<span>Expand source code</span>
|
|
840
|
+
</summary>
|
|
841
|
+
<pre><code class="python">def write(self, data):
|
|
842
|
+
self.stream.write(data)
|
|
843
|
+
self.stream.flush()</code></pre>
|
|
844
|
+
</details>
|
|
845
|
+
</dd>
|
|
846
|
+
<dt id="sutil.Unbuffered.writelines"><code class="name flex">
|
|
847
|
+
<span>def <span class="ident">writelines</span></span>(<span>self, datas)</span>
|
|
848
|
+
</code></dt>
|
|
849
|
+
<dd>
|
|
850
|
+
<div class="desc"></div>
|
|
851
|
+
<details class="source">
|
|
852
|
+
<summary>
|
|
853
|
+
<span>Expand source code</span>
|
|
854
|
+
</summary>
|
|
855
|
+
<pre><code class="python">def writelines(self, datas):
|
|
856
|
+
self.stream.writelines(datas)
|
|
857
|
+
self.stream.flush()</code></pre>
|
|
858
|
+
</details>
|
|
859
|
+
</dd>
|
|
860
|
+
</dl>
|
|
861
|
+
</dd>
|
|
862
|
+
</dl>
|
|
863
|
+
</section>
|
|
864
|
+
</article>
|
|
865
|
+
<nav id="sidebar">
|
|
866
|
+
<h1>Index</h1>
|
|
867
|
+
<div class="toc">
|
|
868
|
+
<ul></ul>
|
|
869
|
+
</div>
|
|
870
|
+
<ul id="index">
|
|
871
|
+
<li><h3><a href="#header-functions">Functions</a></h3>
|
|
872
|
+
<ul class="two-column">
|
|
873
|
+
<li><code><a title="sutil.get_screen_wh" href="#sutil.get_screen_wh">get_screen_wh</a></code></li>
|
|
874
|
+
<li><code><a title="sutil.get_screen_xy" href="#sutil.get_screen_xy">get_screen_xy</a></code></li>
|
|
875
|
+
<li><code><a title="sutil.leadspace" href="#sutil.leadspace">leadspace</a></code></li>
|
|
876
|
+
<li><code><a title="sutil.mainloop" href="#sutil.mainloop">mainloop</a></code></li>
|
|
877
|
+
<li><code><a title="sutil.message" href="#sutil.message">message</a></code></li>
|
|
878
|
+
<li><code><a title="sutil.opendialog" href="#sutil.opendialog">opendialog</a></code></li>
|
|
879
|
+
<li><code><a title="sutil.print_exception" href="#sutil.print_exception">print_exception</a></code></li>
|
|
880
|
+
<li><code><a title="sutil.savedialog" href="#sutil.savedialog">savedialog</a></code></li>
|
|
881
|
+
<li><code><a title="sutil.time_n2s" href="#sutil.time_n2s">time_n2s</a></code></li>
|
|
882
|
+
<li><code><a title="sutil.time_s2n" href="#sutil.time_s2n">time_s2n</a></code></li>
|
|
883
|
+
<li><code><a title="sutil.tmpname" href="#sutil.tmpname">tmpname</a></code></li>
|
|
884
|
+
<li><code><a title="sutil.usleep" href="#sutil.usleep">usleep</a></code></li>
|
|
885
|
+
<li><code><a title="sutil.yes_no_cancel" href="#sutil.yes_no_cancel">yes_no_cancel</a></code></li>
|
|
886
|
+
<li><code><a title="sutil.yn_key" href="#sutil.yn_key">yn_key</a></code></li>
|
|
887
|
+
</ul>
|
|
888
|
+
</li>
|
|
889
|
+
<li><h3><a href="#header-classes">Classes</a></h3>
|
|
890
|
+
<ul>
|
|
891
|
+
<li>
|
|
892
|
+
<h4><code><a title="sutil.Unbuffered" href="#sutil.Unbuffered">Unbuffered</a></code></h4>
|
|
893
|
+
<ul class="">
|
|
894
|
+
<li><code><a title="sutil.Unbuffered.write" href="#sutil.Unbuffered.write">write</a></code></li>
|
|
895
|
+
<li><code><a title="sutil.Unbuffered.writelines" href="#sutil.Unbuffered.writelines">writelines</a></code></li>
|
|
896
|
+
</ul>
|
|
897
|
+
</li>
|
|
898
|
+
</ul>
|
|
899
|
+
</li>
|
|
900
|
+
</ul>
|
|
901
|
+
</nav>
|
|
902
|
+
</main>
|
|
903
|
+
<footer id="footer">
|
|
904
|
+
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
|
905
|
+
</footer>
|
|
906
|
+
</body>
|
|
907
|
+
</html>
|