pyvguicom 1.3.7__tar.gz

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.
Files changed (37) hide show
  1. pyvguicom-1.3.7/PKG-INFO +106 -0
  2. pyvguicom-1.3.7/README.md +79 -0
  3. pyvguicom-1.3.7/pyvguicom/__init__.py +1 -0
  4. pyvguicom-1.3.7/pyvguicom/browsewin.py +262 -0
  5. pyvguicom-1.3.7/pyvguicom/comline.py +414 -0
  6. pyvguicom-1.3.7/pyvguicom/custwidg.py +110 -0
  7. pyvguicom-1.3.7/pyvguicom/docs/__index__.py +0 -0
  8. pyvguicom-1.3.7/pyvguicom/docs/browsewin.html +956 -0
  9. pyvguicom-1.3.7/pyvguicom/docs/htmledit.html +903 -0
  10. pyvguicom-1.3.7/pyvguicom/docs/pgbox.html +2470 -0
  11. pyvguicom-1.3.7/pyvguicom/docs/pgbutt.html +727 -0
  12. pyvguicom-1.3.7/pyvguicom/docs/pgentry.html +1101 -0
  13. pyvguicom-1.3.7/pyvguicom/docs/pggui.html +5476 -0
  14. pyvguicom-1.3.7/pyvguicom/docs/pgsel.html +1539 -0
  15. pyvguicom-1.3.7/pyvguicom/docs/pgsimp.html +1054 -0
  16. pyvguicom-1.3.7/pyvguicom/docs/pgtextview.html +2421 -0
  17. pyvguicom-1.3.7/pyvguicom/docs/pgutils.html +2507 -0
  18. pyvguicom-1.3.7/pyvguicom/docs/pgwkit.html +2277 -0
  19. pyvguicom-1.3.7/pyvguicom/docs/sutil.html +907 -0
  20. pyvguicom-1.3.7/pyvguicom/htmledit.py +252 -0
  21. pyvguicom-1.3.7/pyvguicom/pgbox.py +693 -0
  22. pyvguicom-1.3.7/pyvguicom/pgbutt.py +222 -0
  23. pyvguicom-1.3.7/pyvguicom/pgentry.py +361 -0
  24. pyvguicom-1.3.7/pyvguicom/pggui.py +1952 -0
  25. pyvguicom-1.3.7/pyvguicom/pgsel.py +441 -0
  26. pyvguicom-1.3.7/pyvguicom/pgsimp.py +264 -0
  27. pyvguicom-1.3.7/pyvguicom/pgtests.py +203 -0
  28. pyvguicom-1.3.7/pyvguicom/pgtextview.py +805 -0
  29. pyvguicom-1.3.7/pyvguicom/pgutils.py +676 -0
  30. pyvguicom-1.3.7/pyvguicom/pgwkit.py +727 -0
  31. pyvguicom-1.3.7/pyvguicom/plug.py +33 -0
  32. pyvguicom-1.3.7/pyvguicom.egg-info/PKG-INFO +106 -0
  33. pyvguicom-1.3.7/pyvguicom.egg-info/SOURCES.txt +35 -0
  34. pyvguicom-1.3.7/pyvguicom.egg-info/dependency_links.txt +1 -0
  35. pyvguicom-1.3.7/pyvguicom.egg-info/top_level.txt +1 -0
  36. pyvguicom-1.3.7/setup.cfg +4 -0
  37. pyvguicom-1.3.7/setup.py +69 -0
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyvguicom
3
+ Version: 1.3.7
4
+ Summary: High power secure server GUI utility helpers.
5
+ Home-page: https://github.com/pglen/pyguicom.git
6
+ Author: Peter Glen
7
+ Author-email: peterglen99@gmail.com
8
+ Classifier: Development Status :: 6 - Mature
9
+ Classifier: Intended Audience :: End Users/Desktop
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: License :: OSI Approved :: Python Software Foundation License
13
+ Classifier: Operating System :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Topic :: Software Development :: Libraries
17
+ Requires-Python: >=3
18
+ Description-Content-Type: text/markdown
19
+ Dynamic: author
20
+ Dynamic: author-email
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: requires-python
26
+ Dynamic: summary
27
+
28
+ # pyvguicom PyV GUI Common utilities
29
+
30
+ ## Common GUI routines and classes
31
+
32
+ These classes are for python PyGobject (Gtk) development. They are used in
33
+ several projects. They act as a simplification front end for the PyGtk / PyGobject
34
+ classes.
35
+
36
+ A sampler of what is in there (pasted from code, in no particular order):
37
+
38
+ class CairoHelper():
39
+ class TextTable(Gtk.Table):
40
+ class TextRow(Gtk.HBox):
41
+ class RadioGroup(Gtk.Frame):
42
+ class Led(Gtk.DrawingArea):
43
+ class SeparatorMenuItem(Gtk.SeparatorMenuItem):
44
+ class Menu():
45
+ class MenuButt(Gtk.DrawingArea):
46
+ class Lights(Gtk.Frame):
47
+ class WideButt(Gtk.Button):
48
+ class ScrollListBox(Gtk.Frame):
49
+ class FrameTextView(Gtk.TextView):
50
+ class Label(Gtk.Label):
51
+ class Logo(Gtk.VBox):
52
+ class xSpacer(Gtk.HBox):
53
+ class ListBox(Gtk.TreeView):
54
+
55
+ ... and a lot more ...
56
+
57
+ ## Also includes Some Python / Gtk primitives:
58
+
59
+ def get_screen_wh():
60
+ def get_screen_xy():
61
+ def print_exception(xstr):
62
+ def message(strx, parent = None, title = None, icon = Gtk.MessageType.INFO):
63
+ def usleep(msec):
64
+ def tmpname(indir, template):
65
+ def mainloop():
66
+ def time_n2s(ttt):
67
+ def time_s2n(sss):
68
+ def yes_no_cancel(title, message, cancel = True, parent = None):
69
+ def yn_key(win, event, cancel):
70
+ def opendialog(parent=None):
71
+ def savedialog(resp):
72
+ def leadspace(strx):
73
+
74
+ ... and a lot more ...
75
+
76
+ ## Example:
77
+
78
+ The Label Button (SmallButt) takes a constructor, and feeds
79
+ the arguments with defaults as one would expect.
80
+
81
+ def __init__(self, textm="", widget=None, tooltip=None, font=None):
82
+
83
+ The simplification effect allows one to create a Label Button with no arguments,
84
+ and still have a somewhat reasonable outcome. The label example is trivial,
85
+ the simplification takes a new dimension with classes like SimpleTree.
86
+
87
+ The defaults are set to a reasonable value, and the named argument(s) can be
88
+ set on one line. This makes the code look more compact and maintainable.
89
+
90
+ ## Tests:
91
+
92
+ The test utilities can confirm correct operation; however being a visual
93
+ set of classes, the real test is seeing the generated UI.
94
+ The test utilities can also be found in the project install directory,
95
+ starting with the text* prefix.
96
+
97
+ See descendent projects for more examples. (pyedpro; pycal; pyvserv; ...)
98
+
99
+ ## History:
100
+
101
+ Sat 08.Nov.2025 -- Simplified pyutils
102
+ Tue 11.Nov.2025 -- No default frame for radio buttons
103
+
104
+ Peter Glen
105
+
106
+ // EOF
@@ -0,0 +1,79 @@
1
+ # pyvguicom PyV GUI Common utilities
2
+
3
+ ## Common GUI routines and classes
4
+
5
+ These classes are for python PyGobject (Gtk) development. They are used in
6
+ several projects. They act as a simplification front end for the PyGtk / PyGobject
7
+ classes.
8
+
9
+ A sampler of what is in there (pasted from code, in no particular order):
10
+
11
+ class CairoHelper():
12
+ class TextTable(Gtk.Table):
13
+ class TextRow(Gtk.HBox):
14
+ class RadioGroup(Gtk.Frame):
15
+ class Led(Gtk.DrawingArea):
16
+ class SeparatorMenuItem(Gtk.SeparatorMenuItem):
17
+ class Menu():
18
+ class MenuButt(Gtk.DrawingArea):
19
+ class Lights(Gtk.Frame):
20
+ class WideButt(Gtk.Button):
21
+ class ScrollListBox(Gtk.Frame):
22
+ class FrameTextView(Gtk.TextView):
23
+ class Label(Gtk.Label):
24
+ class Logo(Gtk.VBox):
25
+ class xSpacer(Gtk.HBox):
26
+ class ListBox(Gtk.TreeView):
27
+
28
+ ... and a lot more ...
29
+
30
+ ## Also includes Some Python / Gtk primitives:
31
+
32
+ def get_screen_wh():
33
+ def get_screen_xy():
34
+ def print_exception(xstr):
35
+ def message(strx, parent = None, title = None, icon = Gtk.MessageType.INFO):
36
+ def usleep(msec):
37
+ def tmpname(indir, template):
38
+ def mainloop():
39
+ def time_n2s(ttt):
40
+ def time_s2n(sss):
41
+ def yes_no_cancel(title, message, cancel = True, parent = None):
42
+ def yn_key(win, event, cancel):
43
+ def opendialog(parent=None):
44
+ def savedialog(resp):
45
+ def leadspace(strx):
46
+
47
+ ... and a lot more ...
48
+
49
+ ## Example:
50
+
51
+ The Label Button (SmallButt) takes a constructor, and feeds
52
+ the arguments with defaults as one would expect.
53
+
54
+ def __init__(self, textm="", widget=None, tooltip=None, font=None):
55
+
56
+ The simplification effect allows one to create a Label Button with no arguments,
57
+ and still have a somewhat reasonable outcome. The label example is trivial,
58
+ the simplification takes a new dimension with classes like SimpleTree.
59
+
60
+ The defaults are set to a reasonable value, and the named argument(s) can be
61
+ set on one line. This makes the code look more compact and maintainable.
62
+
63
+ ## Tests:
64
+
65
+ The test utilities can confirm correct operation; however being a visual
66
+ set of classes, the real test is seeing the generated UI.
67
+ The test utilities can also be found in the project install directory,
68
+ starting with the text* prefix.
69
+
70
+ See descendent projects for more examples. (pyedpro; pycal; pyvserv; ...)
71
+
72
+ ## History:
73
+
74
+ Sat 08.Nov.2025 -- Simplified pyutils
75
+ Tue 11.Nov.2025 -- No default frame for radio buttons
76
+
77
+ Peter Glen
78
+
79
+ // EOF
@@ -0,0 +1 @@
1
+ # __init__.py
@@ -0,0 +1,262 @@
1
+ #!/usr/bin/env python
2
+
3
+ ''' This encapsulates the browser window wit the webkia an toolbars '''
4
+
5
+ import os, sys, getopt, signal, random, time, warnings
6
+
7
+ realinc = os.path.realpath(os.path.dirname(__file__) + os.sep + "../pycommon")
8
+ if realinc not in sys.path:
9
+ sys.path.append(realinc)
10
+
11
+ from pgutils import *
12
+ from pggui import *
13
+ from pgsimp import *
14
+
15
+ import gi
16
+ gi.require_version("Gtk", "3.0")
17
+
18
+ from gi.repository import Gtk
19
+ from gi.repository import Gdk
20
+ from gi.repository import GLib
21
+ from gi.repository import GObject
22
+ from gi.repository import Pango
23
+
24
+ from pedlib import pedconfig
25
+
26
+ import pgwkit
27
+ #print("pgwkit:", pgwkit)
28
+
29
+ class browserWin(Gtk.VBox):
30
+
31
+ ''' Collection of URL bar, toolbar, status bar '''
32
+
33
+ def __init__(self):
34
+
35
+ try:
36
+ Gtk.VBox.__init__(self)
37
+ except:
38
+ pass
39
+
40
+ # TEST Mnemonic Label
41
+ #bbb = Gtk.Button.new_with_mnemonic("_Hello")
42
+ #self.pack_start(bbb, 0, 0, 0)
43
+
44
+ hbox3 = self.urlbar()
45
+ self.pack_start(hbox3, 0, 0, 0)
46
+
47
+ #if not conf.kiosk:
48
+ # vbox.pack_start(hbox3, False, False, 2)
49
+
50
+ self.scroll_win = Gtk.ScrolledWindow()
51
+
52
+ try:
53
+ self.webview = pgwkit.pgwebw(self)
54
+ except:
55
+ print("Please install WebKit2", sys.exc_info())
56
+ #if pedconfig.conf.verbose:
57
+ put_exception("start webview")
58
+ #sys.exit(1)
59
+ #raise
60
+
61
+ #self.old_html = ""
62
+ self.scroll_win.add(self.webview)
63
+ self.webview.editor = self.webview
64
+
65
+ self.toolbar2 = self.webview.ui.get_widget("/toolbar_format")
66
+ self.pack_start(self.toolbar2, False, False, 0)
67
+
68
+ self.pack_start(self.scroll_win, 1, 1, 2)
69
+
70
+ hbox5 = Gtk.HBox()
71
+ hbox5.pack_start(Gtk.Label(" "), 0, 0, 0)
72
+ self.status = Gtk.Label(" Idle ");
73
+ self.status.set_xalign(0)
74
+
75
+ hbox5.pack_start(self.status, 1, 1, 0)
76
+ hbox5.pack_start(Gtk.Label(" "), 0, 0, 0)
77
+ self.set_status(" Idle State ")
78
+
79
+ self.pack_start(hbox5, 0, 0, 2)
80
+
81
+ #self.add_events(Gdk.EventMask.ALL_EVENTS_MASK)
82
+ #self.set_sensitive(True)
83
+
84
+ # Receive key presses
85
+ self.set_can_focus(True)
86
+ #self.grab_focus()
87
+
88
+ def load_html(self, strx):
89
+ self.webview.load_html(strx)
90
+
91
+ def cut(self):
92
+ #print("cut")
93
+ self.webview.on_action("cut")
94
+
95
+ def copy(self):
96
+ #print("copy")
97
+ self.webview.on_action("copy")
98
+
99
+ def paste(self):
100
+ #print("paste")
101
+ self.webview.on_paste()
102
+ #self.webview.on_action("paste")
103
+
104
+ def open(self):
105
+ dialog = Gtk.FileChooserDialog("Open an HTML file", None,
106
+ Gtk.FileChooserAction.OPEN,
107
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
108
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
109
+
110
+ ret = dialog.run()
111
+ fn = dialog.get_filename()
112
+ dialog.destroy()
113
+
114
+ if ret == Gtk.ResponseType.OK:
115
+ if not fn:
116
+ return
117
+ if os.path.exists(fn):
118
+ self.fname = fn
119
+ with open(fn) as fd:
120
+ self.webview.load_html(fd.read(), "file:///")
121
+
122
+ def save(self):
123
+
124
+ #print("brow_win", "save", self.fname)
125
+ def completion(html, user_data):
126
+ #print("len html", len(html), len(self.webview.old_html) )
127
+ #print("html", html, "old", self.webview.old_html )
128
+ #if self.webview.old_html == html:
129
+
130
+ if not self.webview.modified:
131
+ self.set_status("File NOT modified.") # '%s'" % self.fname)
132
+ else:
133
+ #self.webview.old_html = html
134
+ open_mode = user_data
135
+ with open(self.fname, open_mode) as fd:
136
+ fd.write(html)
137
+ self.set_status("Saved file '%s'" % self.fname)
138
+ self.webview.modified = False
139
+ self.webview.get_html(completion, 'w')
140
+
141
+ def is_modified(self):
142
+ return self.webview.modified
143
+
144
+ def _completion(self, html, user_data):
145
+ self.ret = html
146
+ self.done = True
147
+ self.webview.modified = False
148
+ #print("retx", ret)
149
+
150
+ def get_content(self):
151
+ self.done = 0; self.ret = ""
152
+ self.webview.get_html(self._completion, "w")
153
+ # Wait until done is set
154
+ for aa in range(1000):
155
+ if self.done:
156
+ break
157
+ Gtk.main_iteration_do(False)
158
+ return self.ret
159
+
160
+ def saveas(self):
161
+ def completion(html, user_data):
162
+ open_mode = user_data
163
+ with open(self.fname, open_mode) as fd:
164
+ fd.write(html)
165
+ self.set_status("Saved as '%s'" % self.fname)
166
+
167
+ dialog = Gtk.FileChooserDialog("Select an HTML file", None,
168
+ Gtk.FileChooserAction.SAVE,
169
+ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
170
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
171
+
172
+ if dialog.run() == Gtk.ResponseType.OK:
173
+ self.fname = dialog.get_filename()
174
+ #print("Saving", self.fname)
175
+ self.webview.get_html(completion, "w+")
176
+ dialog.destroy()
177
+
178
+ def url_callb(self, xtxt):
179
+ self.webview.go(xtxt)
180
+
181
+ def url_callb(self, xtxt):
182
+ self.go(xtxt)
183
+
184
+ def backurl(self, url, parm, buff):
185
+ self.webview.go_back()
186
+
187
+ def baseurl(self, url, parm, buff):
188
+ self.webview.load_uri("file://" + self.fname)
189
+
190
+ def forwurl(self, url, parm, buff):
191
+ self.webview.go_forward()
192
+
193
+ #def gourl(self, url, parm, buff):
194
+ def gourl(self, *url):
195
+ print("gourl", *url)
196
+ self.go(self.edit.get_text())
197
+
198
+ def go(self, xstr):
199
+ print("go", xstr)
200
+
201
+ # Leave known URL scemes alone
202
+ if xstr[:7] == "file://":
203
+ sss = os.path.realpath(xstr[7:])
204
+ xstr = "file://" + sss
205
+ pass
206
+ elif xstr[:7] == "http://":
207
+ pass
208
+ elif xstr[:8] == "https://":
209
+ pass
210
+ elif xstr[:6] == "ftp://":
211
+ pass
212
+ elif str.isdecimal(xstr[0]):
213
+ #print("Possible IP")
214
+ pass
215
+ else:
216
+ # Yeah, padd it
217
+ xstr = "https://" + xstr
218
+
219
+ self.webview.load_uri(xstr)
220
+
221
+ def stattime(self, *arg):
222
+ self.status.set_text("Idle.")
223
+
224
+ def set_status(self, xtxt):
225
+ self.status.set_text(xtxt)
226
+ GLib.timeout_add(3000, self.stattime, self, 0)
227
+
228
+ def urlbar(self):
229
+
230
+ self.edit = SimpleEdit();
231
+ self.edit.setsavecb(self.url_callb)
232
+ self.edit.single_line = True
233
+
234
+ hbox3 = Gtk.HBox()
235
+ uuu = Gtk.Label(" URL: ")
236
+ uuu.set_tooltip_text("Current / New URL; press Enter to go")
237
+ hbox3.pack_start(uuu, 0, 0, 0)
238
+
239
+ hbox3.pack_start(self.edit, True, True, 2)
240
+
241
+ bbb = LabelButt(" _Go ", self.gourl, "Go to speified URL")
242
+ #bbb = Gtk.Button.new_with_mnemonic(" _Go ") #, self.gourl, "Go to speified URL")
243
+ #bbb.connect("clicked", self.gourl)
244
+
245
+ #bbb = LabelButt(" _Go ", self.gourl, "Go to speified URL")
246
+ ccc = LabelButt(" <-_Back ", self.backurl, "Go Back")
247
+ ddd = LabelButt(" For_w-> ", self.forwurl, "Go Forw")
248
+ eee = LabelButt(" B_ase ", self.baseurl, "Go to base URL")
249
+
250
+ hbox3.pack_start(Gtk.Label(" "), 0, 0, 0)
251
+
252
+ hbox3.pack_start(bbb, 0, 0, 0)
253
+ hbox3.pack_start(ccc, 0, 0, 0)
254
+ hbox3.pack_start(ddd, 0, 0, 0)
255
+ hbox3.pack_start(eee, 0, 0, 0)
256
+
257
+ #hbox3.pack_start(Gtk.Label(" ^ "), 0, 0, 0)
258
+ hbox3.pack_start(Gtk.Label(" "), 0, 0, 0)
259
+
260
+ return hbox3
261
+
262
+ # EOF