pyvguicom 1.1.1__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pyvguicom might be problematic. Click here for more details.
- 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/pgtests.py +11 -0
- pyvguicom/testtests.py +18 -0
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.2.0.dist-info}/METADATA +8 -11
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.2.0.dist-info}/RECORD +20 -7
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.2.0.dist-info}/WHEEL +0 -0
- {pyvguicom-1.1.1.dist-info → pyvguicom-1.2.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,1539 @@
|
|
|
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>pgsel 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>pgsel</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, pggui
|
|
45
|
+
|
|
46
|
+
# ------------------------------------------------------------------------
|
|
47
|
+
# Letter selection control
|
|
48
|
+
|
|
49
|
+
class LetterNumberSel(Gtk.VBox):
|
|
50
|
+
|
|
51
|
+
''' Letter Number selector '''
|
|
52
|
+
|
|
53
|
+
def __init__(self, callb = None, font="Mono 13", pad = ""):
|
|
54
|
+
|
|
55
|
+
Gtk.VBox.__init__(self)
|
|
56
|
+
|
|
57
|
+
self.set_can_focus(True)
|
|
58
|
+
self.set_focus_on_click(True)
|
|
59
|
+
self.set_can_default(True)
|
|
60
|
+
|
|
61
|
+
self.callb = callb
|
|
62
|
+
|
|
63
|
+
self.frame = Gtk.Frame()
|
|
64
|
+
|
|
65
|
+
hbox3a = Gtk.HBox()
|
|
66
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
67
|
+
|
|
68
|
+
strx = "abcdefghijklmnopqrstuvwxyz"
|
|
69
|
+
self.simsel = internal_SimpleSel(strx, self.lettercb, font, pad)
|
|
70
|
+
#self.override_background_color(Gtk.StateFlags.FOCUSED, Gdk.RGBA(.9,.9,.9))
|
|
71
|
+
|
|
72
|
+
self.connect("key-press-event", self.simsel_key)
|
|
73
|
+
self.connect("key-release-event", self.simsel_key_rel)
|
|
74
|
+
|
|
75
|
+
hbox3a.pack_start(self.simsel, 0, 0, 0)
|
|
76
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
77
|
+
|
|
78
|
+
strn2 = ""
|
|
79
|
+
hbox3b = Gtk.HBox()
|
|
80
|
+
hbox3b.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
81
|
+
strn = "1234567890!@#$^*_-+"
|
|
82
|
+
self.simsel2 = internal_SimpleSel(strn, self.lettercb, font, pad)
|
|
83
|
+
hbox3b.pack_start(self.simsel2, 0, 0, 0)
|
|
84
|
+
|
|
85
|
+
self.simall = internal_AllSel("All", self.lettercb, font, pad)
|
|
86
|
+
hbox3b.pack_start(self.simall, 0, 0, 0)
|
|
87
|
+
hbox3b.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
88
|
+
|
|
89
|
+
self.simsel2.other = self.simsel
|
|
90
|
+
self.simsel.other = self.simsel2
|
|
91
|
+
|
|
92
|
+
self.simsel2.other2 = self.simall
|
|
93
|
+
self.simsel.other2 = self.simall
|
|
94
|
+
|
|
95
|
+
self.simall.other = self.simsel
|
|
96
|
+
self.simall.other2 = self.simsel2
|
|
97
|
+
|
|
98
|
+
self.curr = self.simsel
|
|
99
|
+
# Commit changes
|
|
100
|
+
self.simsel.exec_index(True)
|
|
101
|
+
|
|
102
|
+
self.hand_cursor = Gdk.Cursor(Gdk.CursorType.HAND2)
|
|
103
|
+
self.simsel.connect("enter_notify_event", self.enter_label)
|
|
104
|
+
self.simsel.connect("leave_notify_event", self.leave_label)
|
|
105
|
+
self.simsel2.connect("enter_notify_event", self.enter_label)
|
|
106
|
+
self.simsel2.connect("leave_notify_event", self.leave_label)
|
|
107
|
+
|
|
108
|
+
self.connect("focus_in_event", self.focus_label)
|
|
109
|
+
self.connect("focus_out_event", self.focus_out_label)
|
|
110
|
+
|
|
111
|
+
vbox = Gtk.VBox()
|
|
112
|
+
vbox.pack_start(hbox3a, 0, 0, False)
|
|
113
|
+
#vbox.pack_start(pggui.ySpacer(), 0, 0, False)
|
|
114
|
+
vbox.pack_start(hbox3b, 0, 0, False)
|
|
115
|
+
|
|
116
|
+
self.frame = Gtk.Frame()
|
|
117
|
+
self.frame.set_shadow_type(Gtk.ShadowType.NONE)
|
|
118
|
+
|
|
119
|
+
self.frame.add(vbox)
|
|
120
|
+
self.pack_start(self.frame, 0, 0, False)
|
|
121
|
+
|
|
122
|
+
def focus_label(self, arg, arg2):
|
|
123
|
+
#print("focus in")
|
|
124
|
+
self.frame.set_shadow_type(Gtk.ShadowType.OUT)
|
|
125
|
+
|
|
126
|
+
def focus_out_label(self, arg, arg2):
|
|
127
|
+
#print("focus out")
|
|
128
|
+
self.frame.set_shadow_type(Gtk.ShadowType.NONE)
|
|
129
|
+
|
|
130
|
+
def simsel_key_rel(self, arg, event):
|
|
131
|
+
if event.keyval == Gdk.KEY_Return or event.keyval == Gdk.KEY_space:
|
|
132
|
+
return True
|
|
133
|
+
|
|
134
|
+
def simsel_key(self, arg, event):
|
|
135
|
+
|
|
136
|
+
# print(event.keyval)
|
|
137
|
+
|
|
138
|
+
if event.keyval == Gdk.KEY_Left:
|
|
139
|
+
self.curr.idx -= 1
|
|
140
|
+
if self.curr.idx < 0:
|
|
141
|
+
#print("Skip left")
|
|
142
|
+
if self.curr == self.simsel:
|
|
143
|
+
self.curr = self.simall
|
|
144
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
145
|
+
elif self.curr == self.simall:
|
|
146
|
+
self.curr = self.simsel2
|
|
147
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
148
|
+
else:
|
|
149
|
+
self.curr = self.simsel
|
|
150
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
151
|
+
self.curr.exec_index(True)
|
|
152
|
+
return True
|
|
153
|
+
|
|
154
|
+
if event.keyval == Gdk.KEY_Right:
|
|
155
|
+
self.curr.idx += 1
|
|
156
|
+
if self.curr.idx >= len(self.curr.textarr):
|
|
157
|
+
#print("Skip right")
|
|
158
|
+
if self.curr == self.simsel:
|
|
159
|
+
self.curr = self.simsel2
|
|
160
|
+
self.curr.idx = 0
|
|
161
|
+
elif self.curr == self.simsel2:
|
|
162
|
+
self.curr = self.simall
|
|
163
|
+
self.curr.idx = 0
|
|
164
|
+
else:
|
|
165
|
+
self.curr = self.simsel
|
|
166
|
+
self.curr.idx = 0
|
|
167
|
+
self.curr.exec_index(True)
|
|
168
|
+
return True
|
|
169
|
+
|
|
170
|
+
if event.keyval == Gdk.KEY_Down:
|
|
171
|
+
if self.curr == self.simsel:
|
|
172
|
+
self.curr = self.simsel2
|
|
173
|
+
self.curr.exec_index(True)
|
|
174
|
+
else:
|
|
175
|
+
# Thu 02.May.2024 tab instead
|
|
176
|
+
self.emit("move-focus", Gtk.DirectionType.TAB_FORWARD)
|
|
177
|
+
return True
|
|
178
|
+
|
|
179
|
+
if event.keyval == Gdk.KEY_Up:
|
|
180
|
+
if self.curr == self.simsel2:
|
|
181
|
+
self.curr = self.simsel
|
|
182
|
+
self.curr.exec_index(True)
|
|
183
|
+
else:
|
|
184
|
+
# Thu 02.May.2024 tab instead
|
|
185
|
+
self.emit("move-focus", Gtk.DirectionType.TAB_BACKWARD)
|
|
186
|
+
return True
|
|
187
|
+
|
|
188
|
+
if event.keyval == Gdk.KEY_Home:
|
|
189
|
+
self.curr.idx = 0
|
|
190
|
+
self.curr.exec_index(True)
|
|
191
|
+
return True
|
|
192
|
+
|
|
193
|
+
if event.keyval == Gdk.KEY_End:
|
|
194
|
+
self.curr.idx = len(self.curr.textarr) - 1
|
|
195
|
+
self.curr.exec_index(True)
|
|
196
|
+
return True
|
|
197
|
+
|
|
198
|
+
if event.keyval == Gdk.KEY_Return or event.keyval == Gdk.KEY_space:
|
|
199
|
+
self.curr.exec_index(False)
|
|
200
|
+
return True
|
|
201
|
+
|
|
202
|
+
if event.keyval >= Gdk.KEY_a and event.keyval <= Gdk.KEY_z:
|
|
203
|
+
self.curr.idx = event.keyval - Gdk.KEY_a
|
|
204
|
+
self.curr.exec_index(True)
|
|
205
|
+
return True
|
|
206
|
+
|
|
207
|
+
def enter_label(self, arg, arg2):
|
|
208
|
+
#print("Enter")
|
|
209
|
+
self.get_window().set_cursor(self.hand_cursor)
|
|
210
|
+
|
|
211
|
+
def leave_label(self, arg, arg2):
|
|
212
|
+
#print("Leave")
|
|
213
|
+
self.get_window().set_cursor()
|
|
214
|
+
|
|
215
|
+
def lettercb(self, letter):
|
|
216
|
+
#print("LetterSel::letterx:", letter)
|
|
217
|
+
if self.callb:
|
|
218
|
+
self.callb(letter)
|
|
219
|
+
|
|
220
|
+
# Select character by index (do not call directly)
|
|
221
|
+
|
|
222
|
+
class internal_AllSel(Gtk.Label):
|
|
223
|
+
|
|
224
|
+
''' Internal class for selectors '''
|
|
225
|
+
|
|
226
|
+
def __init__(self, textx = " ", callb = None, font="Mono 13", pad = ""):
|
|
227
|
+
|
|
228
|
+
Gtk.Label.__init__(self, "")
|
|
229
|
+
|
|
230
|
+
self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
231
|
+
self.connect("button-press-event", self.area_button)
|
|
232
|
+
self.modify_font(Pango.FontDescription(font))
|
|
233
|
+
self.set_has_window(True)
|
|
234
|
+
self.text = textx
|
|
235
|
+
#self.textarr = [" " + textx + " ", "[" + textx + "]"]
|
|
236
|
+
self.textarr = [textx]
|
|
237
|
+
self.org = " " + textx + " "
|
|
238
|
+
self.callb = callb
|
|
239
|
+
self.lastsel = ""
|
|
240
|
+
self.lastidx = 0
|
|
241
|
+
self.other = None
|
|
242
|
+
self.other2 = None
|
|
243
|
+
self.pad = pad
|
|
244
|
+
self.newtext = pad
|
|
245
|
+
self.idx = -1
|
|
246
|
+
self.set_can_focus(True)
|
|
247
|
+
self.set_focus_on_click(True)
|
|
248
|
+
self.fill() #self.set_text(self.org)
|
|
249
|
+
|
|
250
|
+
def fill(self):
|
|
251
|
+
if self.idx == 0:
|
|
252
|
+
self.text = "[" + self.org[1:-1] + "]"
|
|
253
|
+
else:
|
|
254
|
+
self.text = " " + self.org[1:-1] + " "
|
|
255
|
+
self.set_text(self.text)
|
|
256
|
+
|
|
257
|
+
def area_button(self, but, event):
|
|
258
|
+
|
|
259
|
+
self.get_parent().get_parent().grab_focus()
|
|
260
|
+
#print("allbutt")
|
|
261
|
+
self.idx = 0
|
|
262
|
+
self.fill()
|
|
263
|
+
if 1: #not fromkey:
|
|
264
|
+
if self.callb:
|
|
265
|
+
self.callb(self.textarr[self.idx])
|
|
266
|
+
|
|
267
|
+
def exec_index(self, fromkey):
|
|
268
|
+
|
|
269
|
+
self.fill()
|
|
270
|
+
|
|
271
|
+
# Fill others, if allocated
|
|
272
|
+
if self.other:
|
|
273
|
+
self.other.idx = -1
|
|
274
|
+
self.other.fill()
|
|
275
|
+
if self.other2:
|
|
276
|
+
self.other2.idx = -1
|
|
277
|
+
self.other2.fill()
|
|
278
|
+
|
|
279
|
+
if not fromkey:
|
|
280
|
+
if self.callb:
|
|
281
|
+
self.callb(self.textarr[self.idx])
|
|
282
|
+
|
|
283
|
+
class internal_SimpleSel(Gtk.Label):
|
|
284
|
+
|
|
285
|
+
''' Internal class for selectors '''
|
|
286
|
+
|
|
287
|
+
def __init__(self, textx = " ", callb = None, font="Mono 13", pad = ""):
|
|
288
|
+
|
|
289
|
+
Gtk.Label.__init__(self, "")
|
|
290
|
+
|
|
291
|
+
self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
292
|
+
self.connect("button-press-event", self.area_button)
|
|
293
|
+
self.modify_font(Pango.FontDescription(font))
|
|
294
|
+
self.set_has_window(True)
|
|
295
|
+
|
|
296
|
+
self.callb = callb
|
|
297
|
+
|
|
298
|
+
self.lastsel = ""
|
|
299
|
+
self.lastidx = 0
|
|
300
|
+
self.other = None
|
|
301
|
+
self.other2 = None
|
|
302
|
+
self.pad = pad
|
|
303
|
+
self.newtext = pad
|
|
304
|
+
self.idx = 0
|
|
305
|
+
self.set_can_focus(True)
|
|
306
|
+
self.set_focus_on_click(True)
|
|
307
|
+
|
|
308
|
+
self.textarr = []
|
|
309
|
+
for aa in textx:
|
|
310
|
+
self.textarr.append(aa)
|
|
311
|
+
|
|
312
|
+
self.fill()
|
|
313
|
+
|
|
314
|
+
def area_button(self, but, event):
|
|
315
|
+
|
|
316
|
+
self.get_parent().get_parent().grab_focus()
|
|
317
|
+
www = self.get_allocation().width
|
|
318
|
+
pitch = float(www) / len(self.textarr)
|
|
319
|
+
#print("pitch", pitch, "www", www, "len",
|
|
320
|
+
# len(self.textarr), "event.x", event.x)
|
|
321
|
+
|
|
322
|
+
# Map point to position
|
|
323
|
+
self.idx = int(event.x / pitch)
|
|
324
|
+
#print("idxx:", idxx, self.idx)
|
|
325
|
+
self.exec_index(False)
|
|
326
|
+
|
|
327
|
+
def _fill2(self, xarr, xidx, padx):
|
|
328
|
+
''' Internal '''
|
|
329
|
+
cnt = 0
|
|
330
|
+
newtext = ""
|
|
331
|
+
for aa in xarr:
|
|
332
|
+
if cnt == xidx:
|
|
333
|
+
newtext += self.pad + "<span weight='bold' " \
|
|
334
|
+
"underline='double'>" + aa.upper() + "</span>"
|
|
335
|
+
else:
|
|
336
|
+
newtext += self.pad + aa
|
|
337
|
+
cnt += 1
|
|
338
|
+
newtext += self.pad
|
|
339
|
+
return newtext
|
|
340
|
+
|
|
341
|
+
def fill(self):
|
|
342
|
+
self.newtext = self._fill2(self.textarr, self.idx, self.pad)
|
|
343
|
+
self.set_markup(self.newtext)
|
|
344
|
+
|
|
345
|
+
def exec_index(self, fromkey):
|
|
346
|
+
|
|
347
|
+
if self.idx < 0:
|
|
348
|
+
self.idx = 0
|
|
349
|
+
if self.idx > len(self.textarr) - 1:
|
|
350
|
+
self.idx = len(self.textarr) - 1
|
|
351
|
+
#print("index:", self.idx)
|
|
352
|
+
self.fill()
|
|
353
|
+
|
|
354
|
+
# Fill others, if allocated
|
|
355
|
+
if self.other:
|
|
356
|
+
self.other.idx = -1
|
|
357
|
+
self.other.fill()
|
|
358
|
+
if self.other2:
|
|
359
|
+
self.other2.idx = -1
|
|
360
|
+
self.other2.fill()
|
|
361
|
+
|
|
362
|
+
if not fromkey:
|
|
363
|
+
if self.callb:
|
|
364
|
+
self.callb(self.textarr[self.idx])
|
|
365
|
+
|
|
366
|
+
class NumberSel(Gtk.Label):
|
|
367
|
+
|
|
368
|
+
''' Number selector. Give a proportional answer from mouse position '''
|
|
369
|
+
|
|
370
|
+
def __init__(self, text = " ", callb = None, font="Mono 13"):
|
|
371
|
+
self.text = text
|
|
372
|
+
self.callb = callb
|
|
373
|
+
self.axx = self.text.find("[All]")
|
|
374
|
+
Gtk.Label.__init__(self, text)
|
|
375
|
+
self.set_has_window(True)
|
|
376
|
+
self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
377
|
+
self.connect("button-press-event", self.area_button)
|
|
378
|
+
self.override_font(Pango.FontDescription(font))
|
|
379
|
+
self.lastsel = 0
|
|
380
|
+
|
|
381
|
+
def area_button(self, but, event):
|
|
382
|
+
|
|
383
|
+
#print("sss =", self.get_allocation().width)
|
|
384
|
+
#print("click", event.x, event.y)
|
|
385
|
+
|
|
386
|
+
prop = event.x / float(self.get_allocation().width)
|
|
387
|
+
idx = int(prop * len(self.text))
|
|
388
|
+
|
|
389
|
+
# Navigate to IDX
|
|
390
|
+
if self.text[idx] == " ":
|
|
391
|
+
idx += 1
|
|
392
|
+
else:
|
|
393
|
+
if self.text[idx-1] != " ":
|
|
394
|
+
idx -= 1
|
|
395
|
+
if idx >= len(self.text):
|
|
396
|
+
return
|
|
397
|
+
if idx < 0:
|
|
398
|
+
idx = 0
|
|
399
|
+
try:
|
|
400
|
+
# See of it is all
|
|
401
|
+
if self.axx >= 0:
|
|
402
|
+
if idx > self.axx:
|
|
403
|
+
#print("all", idx, self.text[idx-5:idx+7])
|
|
404
|
+
self.lastsel = "All"
|
|
405
|
+
self.newtext = self.text[:self.axx] + self.text[self.axx:].upper()
|
|
406
|
+
self.set_text(self.newtext)
|
|
407
|
+
else:
|
|
408
|
+
self.newtext = self.text[:self.axx] + self.text[self.axx:].lower()
|
|
409
|
+
self.set_text(self.newtext)
|
|
410
|
+
|
|
411
|
+
else:
|
|
412
|
+
self.lastsel = self.text[idx:idx+2]
|
|
413
|
+
#print("lastsel", self.lastsel)
|
|
414
|
+
self.newtext = self.text[:idx] + self.text[idx].upper() + self.text[idx+1:]
|
|
415
|
+
self.set_text(self.newtext)
|
|
416
|
+
|
|
417
|
+
if self.callb:
|
|
418
|
+
self.callb(self.lastsel)
|
|
419
|
+
|
|
420
|
+
except:
|
|
421
|
+
print(sys.exc_info())
|
|
422
|
+
|
|
423
|
+
class HourSel(Gtk.VBox):
|
|
424
|
+
|
|
425
|
+
''' Hour selector '''
|
|
426
|
+
|
|
427
|
+
def __init__(self, callb = None):
|
|
428
|
+
|
|
429
|
+
Gtk.VBox.__init__(self)
|
|
430
|
+
self.callb = callb
|
|
431
|
+
|
|
432
|
+
strx = " 8 10 12 14 16 "
|
|
433
|
+
hbox3a = Gtk.HBox()
|
|
434
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
435
|
+
self.simsel = NumberSel(strx, self.lettercb)
|
|
436
|
+
hbox3a.pack_start(self.simsel, 0, 0, 0)
|
|
437
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
438
|
+
|
|
439
|
+
self.pack_start(hbox3a, 0, 0, False)
|
|
440
|
+
|
|
441
|
+
def lettercb(self, letter):
|
|
442
|
+
#print("LetterSel::letterx:", letter)
|
|
443
|
+
if self.callb:
|
|
444
|
+
self.callb(letter)
|
|
445
|
+
|
|
446
|
+
class MinSel(Gtk.VBox):
|
|
447
|
+
|
|
448
|
+
''' Minute selector '''
|
|
449
|
+
|
|
450
|
+
def __init__(self, callb = None):
|
|
451
|
+
|
|
452
|
+
Gtk.VBox.__init__(self)
|
|
453
|
+
self.callb = callb
|
|
454
|
+
|
|
455
|
+
strx = " 0 10 20 30 40 50 "
|
|
456
|
+
hbox3a = Gtk.HBox()
|
|
457
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
458
|
+
self.simsel = NumberSel(strx, self.lettercb)
|
|
459
|
+
hbox3a.pack_start(self.simsel, 0, 0, 0)
|
|
460
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
461
|
+
|
|
462
|
+
self.pack_start(hbox3a, 0, 0, False)
|
|
463
|
+
|
|
464
|
+
def lettercb(self, letter):
|
|
465
|
+
#print("LetterSel::letterx:", letter)
|
|
466
|
+
if self.callb:
|
|
467
|
+
self.callb(letter)</code></pre>
|
|
468
|
+
</details>
|
|
469
|
+
</section>
|
|
470
|
+
<section>
|
|
471
|
+
</section>
|
|
472
|
+
<section>
|
|
473
|
+
</section>
|
|
474
|
+
<section>
|
|
475
|
+
</section>
|
|
476
|
+
<section>
|
|
477
|
+
<h2 class="section-title" id="header-classes">Classes</h2>
|
|
478
|
+
<dl>
|
|
479
|
+
<dt id="pgsel.HourSel"><code class="flex name class">
|
|
480
|
+
<span>class <span class="ident">HourSel</span></span>
|
|
481
|
+
<span>(</span><span>callb=None)</span>
|
|
482
|
+
</code></dt>
|
|
483
|
+
<dd>
|
|
484
|
+
<div class="desc"><p>Hour selector </p>
|
|
485
|
+
<p>Initializer for a GObject based classes with support for property
|
|
486
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
487
|
+
<details class="source">
|
|
488
|
+
<summary>
|
|
489
|
+
<span>Expand source code</span>
|
|
490
|
+
</summary>
|
|
491
|
+
<pre><code class="python">class HourSel(Gtk.VBox):
|
|
492
|
+
|
|
493
|
+
''' Hour selector '''
|
|
494
|
+
|
|
495
|
+
def __init__(self, callb = None):
|
|
496
|
+
|
|
497
|
+
Gtk.VBox.__init__(self)
|
|
498
|
+
self.callb = callb
|
|
499
|
+
|
|
500
|
+
strx = " 8 10 12 14 16 "
|
|
501
|
+
hbox3a = Gtk.HBox()
|
|
502
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
503
|
+
self.simsel = NumberSel(strx, self.lettercb)
|
|
504
|
+
hbox3a.pack_start(self.simsel, 0, 0, 0)
|
|
505
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
506
|
+
|
|
507
|
+
self.pack_start(hbox3a, 0, 0, False)
|
|
508
|
+
|
|
509
|
+
def lettercb(self, letter):
|
|
510
|
+
#print("LetterSel::letterx:", letter)
|
|
511
|
+
if self.callb:
|
|
512
|
+
self.callb(letter)</code></pre>
|
|
513
|
+
</details>
|
|
514
|
+
<h3>Ancestors</h3>
|
|
515
|
+
<ul class="hlist">
|
|
516
|
+
<li>gi.repository.Gtk.VBox</li>
|
|
517
|
+
<li>gi.overrides.Gtk.Box</li>
|
|
518
|
+
<li>gi.repository.Gtk.Box</li>
|
|
519
|
+
<li>gi.overrides.Gtk.Container</li>
|
|
520
|
+
<li>gi.repository.Gtk.Container</li>
|
|
521
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
522
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
523
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
524
|
+
<li>gi.overrides.GObject.Object</li>
|
|
525
|
+
<li>gi.repository.GObject.Object</li>
|
|
526
|
+
<li>gi._gi.GObject</li>
|
|
527
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
528
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
529
|
+
<li>gi.repository.Gtk.Orientable</li>
|
|
530
|
+
<li>gobject.GInterface</li>
|
|
531
|
+
</ul>
|
|
532
|
+
<h3>Methods</h3>
|
|
533
|
+
<dl>
|
|
534
|
+
<dt id="pgsel.HourSel.lettercb"><code class="name flex">
|
|
535
|
+
<span>def <span class="ident">lettercb</span></span>(<span>self, letter)</span>
|
|
536
|
+
</code></dt>
|
|
537
|
+
<dd>
|
|
538
|
+
<div class="desc"></div>
|
|
539
|
+
<details class="source">
|
|
540
|
+
<summary>
|
|
541
|
+
<span>Expand source code</span>
|
|
542
|
+
</summary>
|
|
543
|
+
<pre><code class="python">def lettercb(self, letter):
|
|
544
|
+
#print("LetterSel::letterx:", letter)
|
|
545
|
+
if self.callb:
|
|
546
|
+
self.callb(letter)</code></pre>
|
|
547
|
+
</details>
|
|
548
|
+
</dd>
|
|
549
|
+
</dl>
|
|
550
|
+
</dd>
|
|
551
|
+
<dt id="pgsel.LetterNumberSel"><code class="flex name class">
|
|
552
|
+
<span>class <span class="ident">LetterNumberSel</span></span>
|
|
553
|
+
<span>(</span><span>callb=None, font='Mono 13', pad='')</span>
|
|
554
|
+
</code></dt>
|
|
555
|
+
<dd>
|
|
556
|
+
<div class="desc"><p>Letter Number selector </p>
|
|
557
|
+
<p>Initializer for a GObject based classes with support for property
|
|
558
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
559
|
+
<details class="source">
|
|
560
|
+
<summary>
|
|
561
|
+
<span>Expand source code</span>
|
|
562
|
+
</summary>
|
|
563
|
+
<pre><code class="python">class LetterNumberSel(Gtk.VBox):
|
|
564
|
+
|
|
565
|
+
''' Letter Number selector '''
|
|
566
|
+
|
|
567
|
+
def __init__(self, callb = None, font="Mono 13", pad = ""):
|
|
568
|
+
|
|
569
|
+
Gtk.VBox.__init__(self)
|
|
570
|
+
|
|
571
|
+
self.set_can_focus(True)
|
|
572
|
+
self.set_focus_on_click(True)
|
|
573
|
+
self.set_can_default(True)
|
|
574
|
+
|
|
575
|
+
self.callb = callb
|
|
576
|
+
|
|
577
|
+
self.frame = Gtk.Frame()
|
|
578
|
+
|
|
579
|
+
hbox3a = Gtk.HBox()
|
|
580
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
581
|
+
|
|
582
|
+
strx = "abcdefghijklmnopqrstuvwxyz"
|
|
583
|
+
self.simsel = internal_SimpleSel(strx, self.lettercb, font, pad)
|
|
584
|
+
#self.override_background_color(Gtk.StateFlags.FOCUSED, Gdk.RGBA(.9,.9,.9))
|
|
585
|
+
|
|
586
|
+
self.connect("key-press-event", self.simsel_key)
|
|
587
|
+
self.connect("key-release-event", self.simsel_key_rel)
|
|
588
|
+
|
|
589
|
+
hbox3a.pack_start(self.simsel, 0, 0, 0)
|
|
590
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
591
|
+
|
|
592
|
+
strn2 = ""
|
|
593
|
+
hbox3b = Gtk.HBox()
|
|
594
|
+
hbox3b.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
595
|
+
strn = "1234567890!@#$^*_-+"
|
|
596
|
+
self.simsel2 = internal_SimpleSel(strn, self.lettercb, font, pad)
|
|
597
|
+
hbox3b.pack_start(self.simsel2, 0, 0, 0)
|
|
598
|
+
|
|
599
|
+
self.simall = internal_AllSel("All", self.lettercb, font, pad)
|
|
600
|
+
hbox3b.pack_start(self.simall, 0, 0, 0)
|
|
601
|
+
hbox3b.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
602
|
+
|
|
603
|
+
self.simsel2.other = self.simsel
|
|
604
|
+
self.simsel.other = self.simsel2
|
|
605
|
+
|
|
606
|
+
self.simsel2.other2 = self.simall
|
|
607
|
+
self.simsel.other2 = self.simall
|
|
608
|
+
|
|
609
|
+
self.simall.other = self.simsel
|
|
610
|
+
self.simall.other2 = self.simsel2
|
|
611
|
+
|
|
612
|
+
self.curr = self.simsel
|
|
613
|
+
# Commit changes
|
|
614
|
+
self.simsel.exec_index(True)
|
|
615
|
+
|
|
616
|
+
self.hand_cursor = Gdk.Cursor(Gdk.CursorType.HAND2)
|
|
617
|
+
self.simsel.connect("enter_notify_event", self.enter_label)
|
|
618
|
+
self.simsel.connect("leave_notify_event", self.leave_label)
|
|
619
|
+
self.simsel2.connect("enter_notify_event", self.enter_label)
|
|
620
|
+
self.simsel2.connect("leave_notify_event", self.leave_label)
|
|
621
|
+
|
|
622
|
+
self.connect("focus_in_event", self.focus_label)
|
|
623
|
+
self.connect("focus_out_event", self.focus_out_label)
|
|
624
|
+
|
|
625
|
+
vbox = Gtk.VBox()
|
|
626
|
+
vbox.pack_start(hbox3a, 0, 0, False)
|
|
627
|
+
#vbox.pack_start(pggui.ySpacer(), 0, 0, False)
|
|
628
|
+
vbox.pack_start(hbox3b, 0, 0, False)
|
|
629
|
+
|
|
630
|
+
self.frame = Gtk.Frame()
|
|
631
|
+
self.frame.set_shadow_type(Gtk.ShadowType.NONE)
|
|
632
|
+
|
|
633
|
+
self.frame.add(vbox)
|
|
634
|
+
self.pack_start(self.frame, 0, 0, False)
|
|
635
|
+
|
|
636
|
+
def focus_label(self, arg, arg2):
|
|
637
|
+
#print("focus in")
|
|
638
|
+
self.frame.set_shadow_type(Gtk.ShadowType.OUT)
|
|
639
|
+
|
|
640
|
+
def focus_out_label(self, arg, arg2):
|
|
641
|
+
#print("focus out")
|
|
642
|
+
self.frame.set_shadow_type(Gtk.ShadowType.NONE)
|
|
643
|
+
|
|
644
|
+
def simsel_key_rel(self, arg, event):
|
|
645
|
+
if event.keyval == Gdk.KEY_Return or event.keyval == Gdk.KEY_space:
|
|
646
|
+
return True
|
|
647
|
+
|
|
648
|
+
def simsel_key(self, arg, event):
|
|
649
|
+
|
|
650
|
+
# print(event.keyval)
|
|
651
|
+
|
|
652
|
+
if event.keyval == Gdk.KEY_Left:
|
|
653
|
+
self.curr.idx -= 1
|
|
654
|
+
if self.curr.idx < 0:
|
|
655
|
+
#print("Skip left")
|
|
656
|
+
if self.curr == self.simsel:
|
|
657
|
+
self.curr = self.simall
|
|
658
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
659
|
+
elif self.curr == self.simall:
|
|
660
|
+
self.curr = self.simsel2
|
|
661
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
662
|
+
else:
|
|
663
|
+
self.curr = self.simsel
|
|
664
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
665
|
+
self.curr.exec_index(True)
|
|
666
|
+
return True
|
|
667
|
+
|
|
668
|
+
if event.keyval == Gdk.KEY_Right:
|
|
669
|
+
self.curr.idx += 1
|
|
670
|
+
if self.curr.idx >= len(self.curr.textarr):
|
|
671
|
+
#print("Skip right")
|
|
672
|
+
if self.curr == self.simsel:
|
|
673
|
+
self.curr = self.simsel2
|
|
674
|
+
self.curr.idx = 0
|
|
675
|
+
elif self.curr == self.simsel2:
|
|
676
|
+
self.curr = self.simall
|
|
677
|
+
self.curr.idx = 0
|
|
678
|
+
else:
|
|
679
|
+
self.curr = self.simsel
|
|
680
|
+
self.curr.idx = 0
|
|
681
|
+
self.curr.exec_index(True)
|
|
682
|
+
return True
|
|
683
|
+
|
|
684
|
+
if event.keyval == Gdk.KEY_Down:
|
|
685
|
+
if self.curr == self.simsel:
|
|
686
|
+
self.curr = self.simsel2
|
|
687
|
+
self.curr.exec_index(True)
|
|
688
|
+
else:
|
|
689
|
+
# Thu 02.May.2024 tab instead
|
|
690
|
+
self.emit("move-focus", Gtk.DirectionType.TAB_FORWARD)
|
|
691
|
+
return True
|
|
692
|
+
|
|
693
|
+
if event.keyval == Gdk.KEY_Up:
|
|
694
|
+
if self.curr == self.simsel2:
|
|
695
|
+
self.curr = self.simsel
|
|
696
|
+
self.curr.exec_index(True)
|
|
697
|
+
else:
|
|
698
|
+
# Thu 02.May.2024 tab instead
|
|
699
|
+
self.emit("move-focus", Gtk.DirectionType.TAB_BACKWARD)
|
|
700
|
+
return True
|
|
701
|
+
|
|
702
|
+
if event.keyval == Gdk.KEY_Home:
|
|
703
|
+
self.curr.idx = 0
|
|
704
|
+
self.curr.exec_index(True)
|
|
705
|
+
return True
|
|
706
|
+
|
|
707
|
+
if event.keyval == Gdk.KEY_End:
|
|
708
|
+
self.curr.idx = len(self.curr.textarr) - 1
|
|
709
|
+
self.curr.exec_index(True)
|
|
710
|
+
return True
|
|
711
|
+
|
|
712
|
+
if event.keyval == Gdk.KEY_Return or event.keyval == Gdk.KEY_space:
|
|
713
|
+
self.curr.exec_index(False)
|
|
714
|
+
return True
|
|
715
|
+
|
|
716
|
+
if event.keyval >= Gdk.KEY_a and event.keyval <= Gdk.KEY_z:
|
|
717
|
+
self.curr.idx = event.keyval - Gdk.KEY_a
|
|
718
|
+
self.curr.exec_index(True)
|
|
719
|
+
return True
|
|
720
|
+
|
|
721
|
+
def enter_label(self, arg, arg2):
|
|
722
|
+
#print("Enter")
|
|
723
|
+
self.get_window().set_cursor(self.hand_cursor)
|
|
724
|
+
|
|
725
|
+
def leave_label(self, arg, arg2):
|
|
726
|
+
#print("Leave")
|
|
727
|
+
self.get_window().set_cursor()
|
|
728
|
+
|
|
729
|
+
def lettercb(self, letter):
|
|
730
|
+
#print("LetterSel::letterx:", letter)
|
|
731
|
+
if self.callb:
|
|
732
|
+
self.callb(letter)</code></pre>
|
|
733
|
+
</details>
|
|
734
|
+
<h3>Ancestors</h3>
|
|
735
|
+
<ul class="hlist">
|
|
736
|
+
<li>gi.repository.Gtk.VBox</li>
|
|
737
|
+
<li>gi.overrides.Gtk.Box</li>
|
|
738
|
+
<li>gi.repository.Gtk.Box</li>
|
|
739
|
+
<li>gi.overrides.Gtk.Container</li>
|
|
740
|
+
<li>gi.repository.Gtk.Container</li>
|
|
741
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
742
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
743
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
744
|
+
<li>gi.overrides.GObject.Object</li>
|
|
745
|
+
<li>gi.repository.GObject.Object</li>
|
|
746
|
+
<li>gi._gi.GObject</li>
|
|
747
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
748
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
749
|
+
<li>gi.repository.Gtk.Orientable</li>
|
|
750
|
+
<li>gobject.GInterface</li>
|
|
751
|
+
</ul>
|
|
752
|
+
<h3>Methods</h3>
|
|
753
|
+
<dl>
|
|
754
|
+
<dt id="pgsel.LetterNumberSel.enter_label"><code class="name flex">
|
|
755
|
+
<span>def <span class="ident">enter_label</span></span>(<span>self, arg, arg2)</span>
|
|
756
|
+
</code></dt>
|
|
757
|
+
<dd>
|
|
758
|
+
<div class="desc"></div>
|
|
759
|
+
<details class="source">
|
|
760
|
+
<summary>
|
|
761
|
+
<span>Expand source code</span>
|
|
762
|
+
</summary>
|
|
763
|
+
<pre><code class="python">def enter_label(self, arg, arg2):
|
|
764
|
+
#print("Enter")
|
|
765
|
+
self.get_window().set_cursor(self.hand_cursor)</code></pre>
|
|
766
|
+
</details>
|
|
767
|
+
</dd>
|
|
768
|
+
<dt id="pgsel.LetterNumberSel.focus_label"><code class="name flex">
|
|
769
|
+
<span>def <span class="ident">focus_label</span></span>(<span>self, arg, arg2)</span>
|
|
770
|
+
</code></dt>
|
|
771
|
+
<dd>
|
|
772
|
+
<div class="desc"></div>
|
|
773
|
+
<details class="source">
|
|
774
|
+
<summary>
|
|
775
|
+
<span>Expand source code</span>
|
|
776
|
+
</summary>
|
|
777
|
+
<pre><code class="python">def focus_label(self, arg, arg2):
|
|
778
|
+
#print("focus in")
|
|
779
|
+
self.frame.set_shadow_type(Gtk.ShadowType.OUT)</code></pre>
|
|
780
|
+
</details>
|
|
781
|
+
</dd>
|
|
782
|
+
<dt id="pgsel.LetterNumberSel.focus_out_label"><code class="name flex">
|
|
783
|
+
<span>def <span class="ident">focus_out_label</span></span>(<span>self, arg, arg2)</span>
|
|
784
|
+
</code></dt>
|
|
785
|
+
<dd>
|
|
786
|
+
<div class="desc"></div>
|
|
787
|
+
<details class="source">
|
|
788
|
+
<summary>
|
|
789
|
+
<span>Expand source code</span>
|
|
790
|
+
</summary>
|
|
791
|
+
<pre><code class="python">def focus_out_label(self, arg, arg2):
|
|
792
|
+
#print("focus out")
|
|
793
|
+
self.frame.set_shadow_type(Gtk.ShadowType.NONE)</code></pre>
|
|
794
|
+
</details>
|
|
795
|
+
</dd>
|
|
796
|
+
<dt id="pgsel.LetterNumberSel.leave_label"><code class="name flex">
|
|
797
|
+
<span>def <span class="ident">leave_label</span></span>(<span>self, arg, arg2)</span>
|
|
798
|
+
</code></dt>
|
|
799
|
+
<dd>
|
|
800
|
+
<div class="desc"></div>
|
|
801
|
+
<details class="source">
|
|
802
|
+
<summary>
|
|
803
|
+
<span>Expand source code</span>
|
|
804
|
+
</summary>
|
|
805
|
+
<pre><code class="python">def leave_label(self, arg, arg2):
|
|
806
|
+
#print("Leave")
|
|
807
|
+
self.get_window().set_cursor()</code></pre>
|
|
808
|
+
</details>
|
|
809
|
+
</dd>
|
|
810
|
+
<dt id="pgsel.LetterNumberSel.lettercb"><code class="name flex">
|
|
811
|
+
<span>def <span class="ident">lettercb</span></span>(<span>self, letter)</span>
|
|
812
|
+
</code></dt>
|
|
813
|
+
<dd>
|
|
814
|
+
<div class="desc"></div>
|
|
815
|
+
<details class="source">
|
|
816
|
+
<summary>
|
|
817
|
+
<span>Expand source code</span>
|
|
818
|
+
</summary>
|
|
819
|
+
<pre><code class="python">def lettercb(self, letter):
|
|
820
|
+
#print("LetterSel::letterx:", letter)
|
|
821
|
+
if self.callb:
|
|
822
|
+
self.callb(letter)</code></pre>
|
|
823
|
+
</details>
|
|
824
|
+
</dd>
|
|
825
|
+
<dt id="pgsel.LetterNumberSel.simsel_key"><code class="name flex">
|
|
826
|
+
<span>def <span class="ident">simsel_key</span></span>(<span>self, arg, event)</span>
|
|
827
|
+
</code></dt>
|
|
828
|
+
<dd>
|
|
829
|
+
<div class="desc"></div>
|
|
830
|
+
<details class="source">
|
|
831
|
+
<summary>
|
|
832
|
+
<span>Expand source code</span>
|
|
833
|
+
</summary>
|
|
834
|
+
<pre><code class="python">def simsel_key(self, arg, event):
|
|
835
|
+
|
|
836
|
+
# print(event.keyval)
|
|
837
|
+
|
|
838
|
+
if event.keyval == Gdk.KEY_Left:
|
|
839
|
+
self.curr.idx -= 1
|
|
840
|
+
if self.curr.idx < 0:
|
|
841
|
+
#print("Skip left")
|
|
842
|
+
if self.curr == self.simsel:
|
|
843
|
+
self.curr = self.simall
|
|
844
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
845
|
+
elif self.curr == self.simall:
|
|
846
|
+
self.curr = self.simsel2
|
|
847
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
848
|
+
else:
|
|
849
|
+
self.curr = self.simsel
|
|
850
|
+
self.curr.idx = len(self.curr.textarr)-1
|
|
851
|
+
self.curr.exec_index(True)
|
|
852
|
+
return True
|
|
853
|
+
|
|
854
|
+
if event.keyval == Gdk.KEY_Right:
|
|
855
|
+
self.curr.idx += 1
|
|
856
|
+
if self.curr.idx >= len(self.curr.textarr):
|
|
857
|
+
#print("Skip right")
|
|
858
|
+
if self.curr == self.simsel:
|
|
859
|
+
self.curr = self.simsel2
|
|
860
|
+
self.curr.idx = 0
|
|
861
|
+
elif self.curr == self.simsel2:
|
|
862
|
+
self.curr = self.simall
|
|
863
|
+
self.curr.idx = 0
|
|
864
|
+
else:
|
|
865
|
+
self.curr = self.simsel
|
|
866
|
+
self.curr.idx = 0
|
|
867
|
+
self.curr.exec_index(True)
|
|
868
|
+
return True
|
|
869
|
+
|
|
870
|
+
if event.keyval == Gdk.KEY_Down:
|
|
871
|
+
if self.curr == self.simsel:
|
|
872
|
+
self.curr = self.simsel2
|
|
873
|
+
self.curr.exec_index(True)
|
|
874
|
+
else:
|
|
875
|
+
# Thu 02.May.2024 tab instead
|
|
876
|
+
self.emit("move-focus", Gtk.DirectionType.TAB_FORWARD)
|
|
877
|
+
return True
|
|
878
|
+
|
|
879
|
+
if event.keyval == Gdk.KEY_Up:
|
|
880
|
+
if self.curr == self.simsel2:
|
|
881
|
+
self.curr = self.simsel
|
|
882
|
+
self.curr.exec_index(True)
|
|
883
|
+
else:
|
|
884
|
+
# Thu 02.May.2024 tab instead
|
|
885
|
+
self.emit("move-focus", Gtk.DirectionType.TAB_BACKWARD)
|
|
886
|
+
return True
|
|
887
|
+
|
|
888
|
+
if event.keyval == Gdk.KEY_Home:
|
|
889
|
+
self.curr.idx = 0
|
|
890
|
+
self.curr.exec_index(True)
|
|
891
|
+
return True
|
|
892
|
+
|
|
893
|
+
if event.keyval == Gdk.KEY_End:
|
|
894
|
+
self.curr.idx = len(self.curr.textarr) - 1
|
|
895
|
+
self.curr.exec_index(True)
|
|
896
|
+
return True
|
|
897
|
+
|
|
898
|
+
if event.keyval == Gdk.KEY_Return or event.keyval == Gdk.KEY_space:
|
|
899
|
+
self.curr.exec_index(False)
|
|
900
|
+
return True
|
|
901
|
+
|
|
902
|
+
if event.keyval >= Gdk.KEY_a and event.keyval <= Gdk.KEY_z:
|
|
903
|
+
self.curr.idx = event.keyval - Gdk.KEY_a
|
|
904
|
+
self.curr.exec_index(True)
|
|
905
|
+
return True</code></pre>
|
|
906
|
+
</details>
|
|
907
|
+
</dd>
|
|
908
|
+
<dt id="pgsel.LetterNumberSel.simsel_key_rel"><code class="name flex">
|
|
909
|
+
<span>def <span class="ident">simsel_key_rel</span></span>(<span>self, arg, event)</span>
|
|
910
|
+
</code></dt>
|
|
911
|
+
<dd>
|
|
912
|
+
<div class="desc"></div>
|
|
913
|
+
<details class="source">
|
|
914
|
+
<summary>
|
|
915
|
+
<span>Expand source code</span>
|
|
916
|
+
</summary>
|
|
917
|
+
<pre><code class="python">def simsel_key_rel(self, arg, event):
|
|
918
|
+
if event.keyval == Gdk.KEY_Return or event.keyval == Gdk.KEY_space:
|
|
919
|
+
return True</code></pre>
|
|
920
|
+
</details>
|
|
921
|
+
</dd>
|
|
922
|
+
</dl>
|
|
923
|
+
</dd>
|
|
924
|
+
<dt id="pgsel.MinSel"><code class="flex name class">
|
|
925
|
+
<span>class <span class="ident">MinSel</span></span>
|
|
926
|
+
<span>(</span><span>callb=None)</span>
|
|
927
|
+
</code></dt>
|
|
928
|
+
<dd>
|
|
929
|
+
<div class="desc"><p>Minute selector </p>
|
|
930
|
+
<p>Initializer for a GObject based classes with support for property
|
|
931
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
932
|
+
<details class="source">
|
|
933
|
+
<summary>
|
|
934
|
+
<span>Expand source code</span>
|
|
935
|
+
</summary>
|
|
936
|
+
<pre><code class="python">class MinSel(Gtk.VBox):
|
|
937
|
+
|
|
938
|
+
''' Minute selector '''
|
|
939
|
+
|
|
940
|
+
def __init__(self, callb = None):
|
|
941
|
+
|
|
942
|
+
Gtk.VBox.__init__(self)
|
|
943
|
+
self.callb = callb
|
|
944
|
+
|
|
945
|
+
strx = " 0 10 20 30 40 50 "
|
|
946
|
+
hbox3a = Gtk.HBox()
|
|
947
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
948
|
+
self.simsel = NumberSel(strx, self.lettercb)
|
|
949
|
+
hbox3a.pack_start(self.simsel, 0, 0, 0)
|
|
950
|
+
hbox3a.pack_start(Gtk.Label(label=" "), 1, 1, 0)
|
|
951
|
+
|
|
952
|
+
self.pack_start(hbox3a, 0, 0, False)
|
|
953
|
+
|
|
954
|
+
def lettercb(self, letter):
|
|
955
|
+
#print("LetterSel::letterx:", letter)
|
|
956
|
+
if self.callb:
|
|
957
|
+
self.callb(letter)</code></pre>
|
|
958
|
+
</details>
|
|
959
|
+
<h3>Ancestors</h3>
|
|
960
|
+
<ul class="hlist">
|
|
961
|
+
<li>gi.repository.Gtk.VBox</li>
|
|
962
|
+
<li>gi.overrides.Gtk.Box</li>
|
|
963
|
+
<li>gi.repository.Gtk.Box</li>
|
|
964
|
+
<li>gi.overrides.Gtk.Container</li>
|
|
965
|
+
<li>gi.repository.Gtk.Container</li>
|
|
966
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
967
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
968
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
969
|
+
<li>gi.overrides.GObject.Object</li>
|
|
970
|
+
<li>gi.repository.GObject.Object</li>
|
|
971
|
+
<li>gi._gi.GObject</li>
|
|
972
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
973
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
974
|
+
<li>gi.repository.Gtk.Orientable</li>
|
|
975
|
+
<li>gobject.GInterface</li>
|
|
976
|
+
</ul>
|
|
977
|
+
<h3>Methods</h3>
|
|
978
|
+
<dl>
|
|
979
|
+
<dt id="pgsel.MinSel.lettercb"><code class="name flex">
|
|
980
|
+
<span>def <span class="ident">lettercb</span></span>(<span>self, letter)</span>
|
|
981
|
+
</code></dt>
|
|
982
|
+
<dd>
|
|
983
|
+
<div class="desc"></div>
|
|
984
|
+
<details class="source">
|
|
985
|
+
<summary>
|
|
986
|
+
<span>Expand source code</span>
|
|
987
|
+
</summary>
|
|
988
|
+
<pre><code class="python">def lettercb(self, letter):
|
|
989
|
+
#print("LetterSel::letterx:", letter)
|
|
990
|
+
if self.callb:
|
|
991
|
+
self.callb(letter)</code></pre>
|
|
992
|
+
</details>
|
|
993
|
+
</dd>
|
|
994
|
+
</dl>
|
|
995
|
+
</dd>
|
|
996
|
+
<dt id="pgsel.NumberSel"><code class="flex name class">
|
|
997
|
+
<span>class <span class="ident">NumberSel</span></span>
|
|
998
|
+
<span>(</span><span>text=' ', callb=None, font='Mono 13')</span>
|
|
999
|
+
</code></dt>
|
|
1000
|
+
<dd>
|
|
1001
|
+
<div class="desc"><p>Number selector. Give a proportional answer from mouse position </p>
|
|
1002
|
+
<p>Initializer for a GObject based classes with support for property
|
|
1003
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
1004
|
+
<details class="source">
|
|
1005
|
+
<summary>
|
|
1006
|
+
<span>Expand source code</span>
|
|
1007
|
+
</summary>
|
|
1008
|
+
<pre><code class="python">class NumberSel(Gtk.Label):
|
|
1009
|
+
|
|
1010
|
+
''' Number selector. Give a proportional answer from mouse position '''
|
|
1011
|
+
|
|
1012
|
+
def __init__(self, text = " ", callb = None, font="Mono 13"):
|
|
1013
|
+
self.text = text
|
|
1014
|
+
self.callb = callb
|
|
1015
|
+
self.axx = self.text.find("[All]")
|
|
1016
|
+
Gtk.Label.__init__(self, text)
|
|
1017
|
+
self.set_has_window(True)
|
|
1018
|
+
self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
1019
|
+
self.connect("button-press-event", self.area_button)
|
|
1020
|
+
self.override_font(Pango.FontDescription(font))
|
|
1021
|
+
self.lastsel = 0
|
|
1022
|
+
|
|
1023
|
+
def area_button(self, but, event):
|
|
1024
|
+
|
|
1025
|
+
#print("sss =", self.get_allocation().width)
|
|
1026
|
+
#print("click", event.x, event.y)
|
|
1027
|
+
|
|
1028
|
+
prop = event.x / float(self.get_allocation().width)
|
|
1029
|
+
idx = int(prop * len(self.text))
|
|
1030
|
+
|
|
1031
|
+
# Navigate to IDX
|
|
1032
|
+
if self.text[idx] == " ":
|
|
1033
|
+
idx += 1
|
|
1034
|
+
else:
|
|
1035
|
+
if self.text[idx-1] != " ":
|
|
1036
|
+
idx -= 1
|
|
1037
|
+
if idx >= len(self.text):
|
|
1038
|
+
return
|
|
1039
|
+
if idx < 0:
|
|
1040
|
+
idx = 0
|
|
1041
|
+
try:
|
|
1042
|
+
# See of it is all
|
|
1043
|
+
if self.axx >= 0:
|
|
1044
|
+
if idx > self.axx:
|
|
1045
|
+
#print("all", idx, self.text[idx-5:idx+7])
|
|
1046
|
+
self.lastsel = "All"
|
|
1047
|
+
self.newtext = self.text[:self.axx] + self.text[self.axx:].upper()
|
|
1048
|
+
self.set_text(self.newtext)
|
|
1049
|
+
else:
|
|
1050
|
+
self.newtext = self.text[:self.axx] + self.text[self.axx:].lower()
|
|
1051
|
+
self.set_text(self.newtext)
|
|
1052
|
+
|
|
1053
|
+
else:
|
|
1054
|
+
self.lastsel = self.text[idx:idx+2]
|
|
1055
|
+
#print("lastsel", self.lastsel)
|
|
1056
|
+
self.newtext = self.text[:idx] + self.text[idx].upper() + self.text[idx+1:]
|
|
1057
|
+
self.set_text(self.newtext)
|
|
1058
|
+
|
|
1059
|
+
if self.callb:
|
|
1060
|
+
self.callb(self.lastsel)
|
|
1061
|
+
|
|
1062
|
+
except:
|
|
1063
|
+
print(sys.exc_info())</code></pre>
|
|
1064
|
+
</details>
|
|
1065
|
+
<h3>Ancestors</h3>
|
|
1066
|
+
<ul class="hlist">
|
|
1067
|
+
<li>gi.overrides.Gtk.Label</li>
|
|
1068
|
+
<li>gi.repository.Gtk.Label</li>
|
|
1069
|
+
<li>gi.repository.Gtk.Misc</li>
|
|
1070
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
1071
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
1072
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
1073
|
+
<li>gi.overrides.GObject.Object</li>
|
|
1074
|
+
<li>gi.repository.GObject.Object</li>
|
|
1075
|
+
<li>gi._gi.GObject</li>
|
|
1076
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
1077
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
1078
|
+
<li>gobject.GInterface</li>
|
|
1079
|
+
</ul>
|
|
1080
|
+
<h3>Methods</h3>
|
|
1081
|
+
<dl>
|
|
1082
|
+
<dt id="pgsel.NumberSel.area_button"><code class="name flex">
|
|
1083
|
+
<span>def <span class="ident">area_button</span></span>(<span>self, but, event)</span>
|
|
1084
|
+
</code></dt>
|
|
1085
|
+
<dd>
|
|
1086
|
+
<div class="desc"></div>
|
|
1087
|
+
<details class="source">
|
|
1088
|
+
<summary>
|
|
1089
|
+
<span>Expand source code</span>
|
|
1090
|
+
</summary>
|
|
1091
|
+
<pre><code class="python">def area_button(self, but, event):
|
|
1092
|
+
|
|
1093
|
+
#print("sss =", self.get_allocation().width)
|
|
1094
|
+
#print("click", event.x, event.y)
|
|
1095
|
+
|
|
1096
|
+
prop = event.x / float(self.get_allocation().width)
|
|
1097
|
+
idx = int(prop * len(self.text))
|
|
1098
|
+
|
|
1099
|
+
# Navigate to IDX
|
|
1100
|
+
if self.text[idx] == " ":
|
|
1101
|
+
idx += 1
|
|
1102
|
+
else:
|
|
1103
|
+
if self.text[idx-1] != " ":
|
|
1104
|
+
idx -= 1
|
|
1105
|
+
if idx >= len(self.text):
|
|
1106
|
+
return
|
|
1107
|
+
if idx < 0:
|
|
1108
|
+
idx = 0
|
|
1109
|
+
try:
|
|
1110
|
+
# See of it is all
|
|
1111
|
+
if self.axx >= 0:
|
|
1112
|
+
if idx > self.axx:
|
|
1113
|
+
#print("all", idx, self.text[idx-5:idx+7])
|
|
1114
|
+
self.lastsel = "All"
|
|
1115
|
+
self.newtext = self.text[:self.axx] + self.text[self.axx:].upper()
|
|
1116
|
+
self.set_text(self.newtext)
|
|
1117
|
+
else:
|
|
1118
|
+
self.newtext = self.text[:self.axx] + self.text[self.axx:].lower()
|
|
1119
|
+
self.set_text(self.newtext)
|
|
1120
|
+
|
|
1121
|
+
else:
|
|
1122
|
+
self.lastsel = self.text[idx:idx+2]
|
|
1123
|
+
#print("lastsel", self.lastsel)
|
|
1124
|
+
self.newtext = self.text[:idx] + self.text[idx].upper() + self.text[idx+1:]
|
|
1125
|
+
self.set_text(self.newtext)
|
|
1126
|
+
|
|
1127
|
+
if self.callb:
|
|
1128
|
+
self.callb(self.lastsel)
|
|
1129
|
+
|
|
1130
|
+
except:
|
|
1131
|
+
print(sys.exc_info())</code></pre>
|
|
1132
|
+
</details>
|
|
1133
|
+
</dd>
|
|
1134
|
+
</dl>
|
|
1135
|
+
</dd>
|
|
1136
|
+
<dt id="pgsel.internal_AllSel"><code class="flex name class">
|
|
1137
|
+
<span>class <span class="ident">internal_AllSel</span></span>
|
|
1138
|
+
<span>(</span><span>textx=' ', callb=None, font='Mono 13', pad='')</span>
|
|
1139
|
+
</code></dt>
|
|
1140
|
+
<dd>
|
|
1141
|
+
<div class="desc"><p>Internal class for selectors </p>
|
|
1142
|
+
<p>Initializer for a GObject based classes with support for property
|
|
1143
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
1144
|
+
<details class="source">
|
|
1145
|
+
<summary>
|
|
1146
|
+
<span>Expand source code</span>
|
|
1147
|
+
</summary>
|
|
1148
|
+
<pre><code class="python">class internal_AllSel(Gtk.Label):
|
|
1149
|
+
|
|
1150
|
+
''' Internal class for selectors '''
|
|
1151
|
+
|
|
1152
|
+
def __init__(self, textx = " ", callb = None, font="Mono 13", pad = ""):
|
|
1153
|
+
|
|
1154
|
+
Gtk.Label.__init__(self, "")
|
|
1155
|
+
|
|
1156
|
+
self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
1157
|
+
self.connect("button-press-event", self.area_button)
|
|
1158
|
+
self.modify_font(Pango.FontDescription(font))
|
|
1159
|
+
self.set_has_window(True)
|
|
1160
|
+
self.text = textx
|
|
1161
|
+
#self.textarr = [" " + textx + " ", "[" + textx + "]"]
|
|
1162
|
+
self.textarr = [textx]
|
|
1163
|
+
self.org = " " + textx + " "
|
|
1164
|
+
self.callb = callb
|
|
1165
|
+
self.lastsel = ""
|
|
1166
|
+
self.lastidx = 0
|
|
1167
|
+
self.other = None
|
|
1168
|
+
self.other2 = None
|
|
1169
|
+
self.pad = pad
|
|
1170
|
+
self.newtext = pad
|
|
1171
|
+
self.idx = -1
|
|
1172
|
+
self.set_can_focus(True)
|
|
1173
|
+
self.set_focus_on_click(True)
|
|
1174
|
+
self.fill() #self.set_text(self.org)
|
|
1175
|
+
|
|
1176
|
+
def fill(self):
|
|
1177
|
+
if self.idx == 0:
|
|
1178
|
+
self.text = "[" + self.org[1:-1] + "]"
|
|
1179
|
+
else:
|
|
1180
|
+
self.text = " " + self.org[1:-1] + " "
|
|
1181
|
+
self.set_text(self.text)
|
|
1182
|
+
|
|
1183
|
+
def area_button(self, but, event):
|
|
1184
|
+
|
|
1185
|
+
self.get_parent().get_parent().grab_focus()
|
|
1186
|
+
#print("allbutt")
|
|
1187
|
+
self.idx = 0
|
|
1188
|
+
self.fill()
|
|
1189
|
+
if 1: #not fromkey:
|
|
1190
|
+
if self.callb:
|
|
1191
|
+
self.callb(self.textarr[self.idx])
|
|
1192
|
+
|
|
1193
|
+
def exec_index(self, fromkey):
|
|
1194
|
+
|
|
1195
|
+
self.fill()
|
|
1196
|
+
|
|
1197
|
+
# Fill others, if allocated
|
|
1198
|
+
if self.other:
|
|
1199
|
+
self.other.idx = -1
|
|
1200
|
+
self.other.fill()
|
|
1201
|
+
if self.other2:
|
|
1202
|
+
self.other2.idx = -1
|
|
1203
|
+
self.other2.fill()
|
|
1204
|
+
|
|
1205
|
+
if not fromkey:
|
|
1206
|
+
if self.callb:
|
|
1207
|
+
self.callb(self.textarr[self.idx])</code></pre>
|
|
1208
|
+
</details>
|
|
1209
|
+
<h3>Ancestors</h3>
|
|
1210
|
+
<ul class="hlist">
|
|
1211
|
+
<li>gi.overrides.Gtk.Label</li>
|
|
1212
|
+
<li>gi.repository.Gtk.Label</li>
|
|
1213
|
+
<li>gi.repository.Gtk.Misc</li>
|
|
1214
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
1215
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
1216
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
1217
|
+
<li>gi.overrides.GObject.Object</li>
|
|
1218
|
+
<li>gi.repository.GObject.Object</li>
|
|
1219
|
+
<li>gi._gi.GObject</li>
|
|
1220
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
1221
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
1222
|
+
<li>gobject.GInterface</li>
|
|
1223
|
+
</ul>
|
|
1224
|
+
<h3>Methods</h3>
|
|
1225
|
+
<dl>
|
|
1226
|
+
<dt id="pgsel.internal_AllSel.area_button"><code class="name flex">
|
|
1227
|
+
<span>def <span class="ident">area_button</span></span>(<span>self, but, event)</span>
|
|
1228
|
+
</code></dt>
|
|
1229
|
+
<dd>
|
|
1230
|
+
<div class="desc"></div>
|
|
1231
|
+
<details class="source">
|
|
1232
|
+
<summary>
|
|
1233
|
+
<span>Expand source code</span>
|
|
1234
|
+
</summary>
|
|
1235
|
+
<pre><code class="python">def area_button(self, but, event):
|
|
1236
|
+
|
|
1237
|
+
self.get_parent().get_parent().grab_focus()
|
|
1238
|
+
#print("allbutt")
|
|
1239
|
+
self.idx = 0
|
|
1240
|
+
self.fill()
|
|
1241
|
+
if 1: #not fromkey:
|
|
1242
|
+
if self.callb:
|
|
1243
|
+
self.callb(self.textarr[self.idx])</code></pre>
|
|
1244
|
+
</details>
|
|
1245
|
+
</dd>
|
|
1246
|
+
<dt id="pgsel.internal_AllSel.exec_index"><code class="name flex">
|
|
1247
|
+
<span>def <span class="ident">exec_index</span></span>(<span>self, fromkey)</span>
|
|
1248
|
+
</code></dt>
|
|
1249
|
+
<dd>
|
|
1250
|
+
<div class="desc"></div>
|
|
1251
|
+
<details class="source">
|
|
1252
|
+
<summary>
|
|
1253
|
+
<span>Expand source code</span>
|
|
1254
|
+
</summary>
|
|
1255
|
+
<pre><code class="python">def exec_index(self, fromkey):
|
|
1256
|
+
|
|
1257
|
+
self.fill()
|
|
1258
|
+
|
|
1259
|
+
# Fill others, if allocated
|
|
1260
|
+
if self.other:
|
|
1261
|
+
self.other.idx = -1
|
|
1262
|
+
self.other.fill()
|
|
1263
|
+
if self.other2:
|
|
1264
|
+
self.other2.idx = -1
|
|
1265
|
+
self.other2.fill()
|
|
1266
|
+
|
|
1267
|
+
if not fromkey:
|
|
1268
|
+
if self.callb:
|
|
1269
|
+
self.callb(self.textarr[self.idx])</code></pre>
|
|
1270
|
+
</details>
|
|
1271
|
+
</dd>
|
|
1272
|
+
<dt id="pgsel.internal_AllSel.fill"><code class="name flex">
|
|
1273
|
+
<span>def <span class="ident">fill</span></span>(<span>self)</span>
|
|
1274
|
+
</code></dt>
|
|
1275
|
+
<dd>
|
|
1276
|
+
<div class="desc"></div>
|
|
1277
|
+
<details class="source">
|
|
1278
|
+
<summary>
|
|
1279
|
+
<span>Expand source code</span>
|
|
1280
|
+
</summary>
|
|
1281
|
+
<pre><code class="python">def fill(self):
|
|
1282
|
+
if self.idx == 0:
|
|
1283
|
+
self.text = "[" + self.org[1:-1] + "]"
|
|
1284
|
+
else:
|
|
1285
|
+
self.text = " " + self.org[1:-1] + " "
|
|
1286
|
+
self.set_text(self.text)</code></pre>
|
|
1287
|
+
</details>
|
|
1288
|
+
</dd>
|
|
1289
|
+
</dl>
|
|
1290
|
+
</dd>
|
|
1291
|
+
<dt id="pgsel.internal_SimpleSel"><code class="flex name class">
|
|
1292
|
+
<span>class <span class="ident">internal_SimpleSel</span></span>
|
|
1293
|
+
<span>(</span><span>textx=' ', callb=None, font='Mono 13', pad='')</span>
|
|
1294
|
+
</code></dt>
|
|
1295
|
+
<dd>
|
|
1296
|
+
<div class="desc"><p>Internal class for selectors </p>
|
|
1297
|
+
<p>Initializer for a GObject based classes with support for property
|
|
1298
|
+
sets through the use of explicit keyword arguments.</p></div>
|
|
1299
|
+
<details class="source">
|
|
1300
|
+
<summary>
|
|
1301
|
+
<span>Expand source code</span>
|
|
1302
|
+
</summary>
|
|
1303
|
+
<pre><code class="python">class internal_SimpleSel(Gtk.Label):
|
|
1304
|
+
|
|
1305
|
+
''' Internal class for selectors '''
|
|
1306
|
+
|
|
1307
|
+
def __init__(self, textx = " ", callb = None, font="Mono 13", pad = ""):
|
|
1308
|
+
|
|
1309
|
+
Gtk.Label.__init__(self, "")
|
|
1310
|
+
|
|
1311
|
+
self.set_events(Gdk.EventMask.ALL_EVENTS_MASK )
|
|
1312
|
+
self.connect("button-press-event", self.area_button)
|
|
1313
|
+
self.modify_font(Pango.FontDescription(font))
|
|
1314
|
+
self.set_has_window(True)
|
|
1315
|
+
|
|
1316
|
+
self.callb = callb
|
|
1317
|
+
|
|
1318
|
+
self.lastsel = ""
|
|
1319
|
+
self.lastidx = 0
|
|
1320
|
+
self.other = None
|
|
1321
|
+
self.other2 = None
|
|
1322
|
+
self.pad = pad
|
|
1323
|
+
self.newtext = pad
|
|
1324
|
+
self.idx = 0
|
|
1325
|
+
self.set_can_focus(True)
|
|
1326
|
+
self.set_focus_on_click(True)
|
|
1327
|
+
|
|
1328
|
+
self.textarr = []
|
|
1329
|
+
for aa in textx:
|
|
1330
|
+
self.textarr.append(aa)
|
|
1331
|
+
|
|
1332
|
+
self.fill()
|
|
1333
|
+
|
|
1334
|
+
def area_button(self, but, event):
|
|
1335
|
+
|
|
1336
|
+
self.get_parent().get_parent().grab_focus()
|
|
1337
|
+
www = self.get_allocation().width
|
|
1338
|
+
pitch = float(www) / len(self.textarr)
|
|
1339
|
+
#print("pitch", pitch, "www", www, "len",
|
|
1340
|
+
# len(self.textarr), "event.x", event.x)
|
|
1341
|
+
|
|
1342
|
+
# Map point to position
|
|
1343
|
+
self.idx = int(event.x / pitch)
|
|
1344
|
+
#print("idxx:", idxx, self.idx)
|
|
1345
|
+
self.exec_index(False)
|
|
1346
|
+
|
|
1347
|
+
def _fill2(self, xarr, xidx, padx):
|
|
1348
|
+
''' Internal '''
|
|
1349
|
+
cnt = 0
|
|
1350
|
+
newtext = ""
|
|
1351
|
+
for aa in xarr:
|
|
1352
|
+
if cnt == xidx:
|
|
1353
|
+
newtext += self.pad + "<span weight='bold' " \
|
|
1354
|
+
"underline='double'>" + aa.upper() + "</span>"
|
|
1355
|
+
else:
|
|
1356
|
+
newtext += self.pad + aa
|
|
1357
|
+
cnt += 1
|
|
1358
|
+
newtext += self.pad
|
|
1359
|
+
return newtext
|
|
1360
|
+
|
|
1361
|
+
def fill(self):
|
|
1362
|
+
self.newtext = self._fill2(self.textarr, self.idx, self.pad)
|
|
1363
|
+
self.set_markup(self.newtext)
|
|
1364
|
+
|
|
1365
|
+
def exec_index(self, fromkey):
|
|
1366
|
+
|
|
1367
|
+
if self.idx < 0:
|
|
1368
|
+
self.idx = 0
|
|
1369
|
+
if self.idx > len(self.textarr) - 1:
|
|
1370
|
+
self.idx = len(self.textarr) - 1
|
|
1371
|
+
#print("index:", self.idx)
|
|
1372
|
+
self.fill()
|
|
1373
|
+
|
|
1374
|
+
# Fill others, if allocated
|
|
1375
|
+
if self.other:
|
|
1376
|
+
self.other.idx = -1
|
|
1377
|
+
self.other.fill()
|
|
1378
|
+
if self.other2:
|
|
1379
|
+
self.other2.idx = -1
|
|
1380
|
+
self.other2.fill()
|
|
1381
|
+
|
|
1382
|
+
if not fromkey:
|
|
1383
|
+
if self.callb:
|
|
1384
|
+
self.callb(self.textarr[self.idx])</code></pre>
|
|
1385
|
+
</details>
|
|
1386
|
+
<h3>Ancestors</h3>
|
|
1387
|
+
<ul class="hlist">
|
|
1388
|
+
<li>gi.overrides.Gtk.Label</li>
|
|
1389
|
+
<li>gi.repository.Gtk.Label</li>
|
|
1390
|
+
<li>gi.repository.Gtk.Misc</li>
|
|
1391
|
+
<li>gi.overrides.Gtk.Widget</li>
|
|
1392
|
+
<li>gi.repository.Gtk.Widget</li>
|
|
1393
|
+
<li>gi.repository.GObject.InitiallyUnowned</li>
|
|
1394
|
+
<li>gi.overrides.GObject.Object</li>
|
|
1395
|
+
<li>gi.repository.GObject.Object</li>
|
|
1396
|
+
<li>gi._gi.GObject</li>
|
|
1397
|
+
<li>gi.repository.Atk.ImplementorIface</li>
|
|
1398
|
+
<li>gi.repository.Gtk.Buildable</li>
|
|
1399
|
+
<li>gobject.GInterface</li>
|
|
1400
|
+
</ul>
|
|
1401
|
+
<h3>Methods</h3>
|
|
1402
|
+
<dl>
|
|
1403
|
+
<dt id="pgsel.internal_SimpleSel.area_button"><code class="name flex">
|
|
1404
|
+
<span>def <span class="ident">area_button</span></span>(<span>self, but, event)</span>
|
|
1405
|
+
</code></dt>
|
|
1406
|
+
<dd>
|
|
1407
|
+
<div class="desc"></div>
|
|
1408
|
+
<details class="source">
|
|
1409
|
+
<summary>
|
|
1410
|
+
<span>Expand source code</span>
|
|
1411
|
+
</summary>
|
|
1412
|
+
<pre><code class="python">def area_button(self, but, event):
|
|
1413
|
+
|
|
1414
|
+
self.get_parent().get_parent().grab_focus()
|
|
1415
|
+
www = self.get_allocation().width
|
|
1416
|
+
pitch = float(www) / len(self.textarr)
|
|
1417
|
+
#print("pitch", pitch, "www", www, "len",
|
|
1418
|
+
# len(self.textarr), "event.x", event.x)
|
|
1419
|
+
|
|
1420
|
+
# Map point to position
|
|
1421
|
+
self.idx = int(event.x / pitch)
|
|
1422
|
+
#print("idxx:", idxx, self.idx)
|
|
1423
|
+
self.exec_index(False)</code></pre>
|
|
1424
|
+
</details>
|
|
1425
|
+
</dd>
|
|
1426
|
+
<dt id="pgsel.internal_SimpleSel.exec_index"><code class="name flex">
|
|
1427
|
+
<span>def <span class="ident">exec_index</span></span>(<span>self, fromkey)</span>
|
|
1428
|
+
</code></dt>
|
|
1429
|
+
<dd>
|
|
1430
|
+
<div class="desc"></div>
|
|
1431
|
+
<details class="source">
|
|
1432
|
+
<summary>
|
|
1433
|
+
<span>Expand source code</span>
|
|
1434
|
+
</summary>
|
|
1435
|
+
<pre><code class="python">def exec_index(self, fromkey):
|
|
1436
|
+
|
|
1437
|
+
if self.idx < 0:
|
|
1438
|
+
self.idx = 0
|
|
1439
|
+
if self.idx > len(self.textarr) - 1:
|
|
1440
|
+
self.idx = len(self.textarr) - 1
|
|
1441
|
+
#print("index:", self.idx)
|
|
1442
|
+
self.fill()
|
|
1443
|
+
|
|
1444
|
+
# Fill others, if allocated
|
|
1445
|
+
if self.other:
|
|
1446
|
+
self.other.idx = -1
|
|
1447
|
+
self.other.fill()
|
|
1448
|
+
if self.other2:
|
|
1449
|
+
self.other2.idx = -1
|
|
1450
|
+
self.other2.fill()
|
|
1451
|
+
|
|
1452
|
+
if not fromkey:
|
|
1453
|
+
if self.callb:
|
|
1454
|
+
self.callb(self.textarr[self.idx])</code></pre>
|
|
1455
|
+
</details>
|
|
1456
|
+
</dd>
|
|
1457
|
+
<dt id="pgsel.internal_SimpleSel.fill"><code class="name flex">
|
|
1458
|
+
<span>def <span class="ident">fill</span></span>(<span>self)</span>
|
|
1459
|
+
</code></dt>
|
|
1460
|
+
<dd>
|
|
1461
|
+
<div class="desc"></div>
|
|
1462
|
+
<details class="source">
|
|
1463
|
+
<summary>
|
|
1464
|
+
<span>Expand source code</span>
|
|
1465
|
+
</summary>
|
|
1466
|
+
<pre><code class="python">def fill(self):
|
|
1467
|
+
self.newtext = self._fill2(self.textarr, self.idx, self.pad)
|
|
1468
|
+
self.set_markup(self.newtext)</code></pre>
|
|
1469
|
+
</details>
|
|
1470
|
+
</dd>
|
|
1471
|
+
</dl>
|
|
1472
|
+
</dd>
|
|
1473
|
+
</dl>
|
|
1474
|
+
</section>
|
|
1475
|
+
</article>
|
|
1476
|
+
<nav id="sidebar">
|
|
1477
|
+
<h1>Index</h1>
|
|
1478
|
+
<div class="toc">
|
|
1479
|
+
<ul></ul>
|
|
1480
|
+
</div>
|
|
1481
|
+
<ul id="index">
|
|
1482
|
+
<li><h3><a href="#header-classes">Classes</a></h3>
|
|
1483
|
+
<ul>
|
|
1484
|
+
<li>
|
|
1485
|
+
<h4><code><a title="pgsel.HourSel" href="#pgsel.HourSel">HourSel</a></code></h4>
|
|
1486
|
+
<ul class="">
|
|
1487
|
+
<li><code><a title="pgsel.HourSel.lettercb" href="#pgsel.HourSel.lettercb">lettercb</a></code></li>
|
|
1488
|
+
</ul>
|
|
1489
|
+
</li>
|
|
1490
|
+
<li>
|
|
1491
|
+
<h4><code><a title="pgsel.LetterNumberSel" href="#pgsel.LetterNumberSel">LetterNumberSel</a></code></h4>
|
|
1492
|
+
<ul class="two-column">
|
|
1493
|
+
<li><code><a title="pgsel.LetterNumberSel.enter_label" href="#pgsel.LetterNumberSel.enter_label">enter_label</a></code></li>
|
|
1494
|
+
<li><code><a title="pgsel.LetterNumberSel.focus_label" href="#pgsel.LetterNumberSel.focus_label">focus_label</a></code></li>
|
|
1495
|
+
<li><code><a title="pgsel.LetterNumberSel.focus_out_label" href="#pgsel.LetterNumberSel.focus_out_label">focus_out_label</a></code></li>
|
|
1496
|
+
<li><code><a title="pgsel.LetterNumberSel.leave_label" href="#pgsel.LetterNumberSel.leave_label">leave_label</a></code></li>
|
|
1497
|
+
<li><code><a title="pgsel.LetterNumberSel.lettercb" href="#pgsel.LetterNumberSel.lettercb">lettercb</a></code></li>
|
|
1498
|
+
<li><code><a title="pgsel.LetterNumberSel.simsel_key" href="#pgsel.LetterNumberSel.simsel_key">simsel_key</a></code></li>
|
|
1499
|
+
<li><code><a title="pgsel.LetterNumberSel.simsel_key_rel" href="#pgsel.LetterNumberSel.simsel_key_rel">simsel_key_rel</a></code></li>
|
|
1500
|
+
</ul>
|
|
1501
|
+
</li>
|
|
1502
|
+
<li>
|
|
1503
|
+
<h4><code><a title="pgsel.MinSel" href="#pgsel.MinSel">MinSel</a></code></h4>
|
|
1504
|
+
<ul class="">
|
|
1505
|
+
<li><code><a title="pgsel.MinSel.lettercb" href="#pgsel.MinSel.lettercb">lettercb</a></code></li>
|
|
1506
|
+
</ul>
|
|
1507
|
+
</li>
|
|
1508
|
+
<li>
|
|
1509
|
+
<h4><code><a title="pgsel.NumberSel" href="#pgsel.NumberSel">NumberSel</a></code></h4>
|
|
1510
|
+
<ul class="">
|
|
1511
|
+
<li><code><a title="pgsel.NumberSel.area_button" href="#pgsel.NumberSel.area_button">area_button</a></code></li>
|
|
1512
|
+
</ul>
|
|
1513
|
+
</li>
|
|
1514
|
+
<li>
|
|
1515
|
+
<h4><code><a title="pgsel.internal_AllSel" href="#pgsel.internal_AllSel">internal_AllSel</a></code></h4>
|
|
1516
|
+
<ul class="">
|
|
1517
|
+
<li><code><a title="pgsel.internal_AllSel.area_button" href="#pgsel.internal_AllSel.area_button">area_button</a></code></li>
|
|
1518
|
+
<li><code><a title="pgsel.internal_AllSel.exec_index" href="#pgsel.internal_AllSel.exec_index">exec_index</a></code></li>
|
|
1519
|
+
<li><code><a title="pgsel.internal_AllSel.fill" href="#pgsel.internal_AllSel.fill">fill</a></code></li>
|
|
1520
|
+
</ul>
|
|
1521
|
+
</li>
|
|
1522
|
+
<li>
|
|
1523
|
+
<h4><code><a title="pgsel.internal_SimpleSel" href="#pgsel.internal_SimpleSel">internal_SimpleSel</a></code></h4>
|
|
1524
|
+
<ul class="">
|
|
1525
|
+
<li><code><a title="pgsel.internal_SimpleSel.area_button" href="#pgsel.internal_SimpleSel.area_button">area_button</a></code></li>
|
|
1526
|
+
<li><code><a title="pgsel.internal_SimpleSel.exec_index" href="#pgsel.internal_SimpleSel.exec_index">exec_index</a></code></li>
|
|
1527
|
+
<li><code><a title="pgsel.internal_SimpleSel.fill" href="#pgsel.internal_SimpleSel.fill">fill</a></code></li>
|
|
1528
|
+
</ul>
|
|
1529
|
+
</li>
|
|
1530
|
+
</ul>
|
|
1531
|
+
</li>
|
|
1532
|
+
</ul>
|
|
1533
|
+
</nav>
|
|
1534
|
+
</main>
|
|
1535
|
+
<footer id="footer">
|
|
1536
|
+
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
|
1537
|
+
</footer>
|
|
1538
|
+
</body>
|
|
1539
|
+
</html>
|