@@ -144,7 +144,6 @@ def _events(self, window: ctypes.c_size_t,
144144 lib .webui_interface_set_response (window , event_number , cb_result_encode )
145145
146146
147- # Bind a specific html element click event with a function. Empty element means all events.
148147 def bind (self , element , func ):
149148 """Bind a specific HTML element click event with a function.
150149
@@ -171,7 +170,6 @@ def bind(self, element, func):
171170 self .cb_fun_list [bindId ] = func
172171
173172
174- # Show a window using a embedded HTML, or a file. If the window is already opened then it will be refreshed.
175173 def show (self , content = "<html></html>" , browser :int = browser .ChromiumBased ):
176174 """Show a window using embedded HTML, or a file.
177175
@@ -196,7 +194,6 @@ def show(self, content="<html></html>", browser:int=browser.ChromiumBased):
196194 lib .webui_show_browser (self .window , content .encode ('utf-8' ), ctypes .c_uint (browser ))
197195
198196
199- # Chose between Deno and Nodejs runtime for .js and .ts files.
200197 def set_runtime (self , rt = runtime .deno ):
201198 """Choose between Deno and Nodejs runtime for .js and .ts files.
202199
@@ -214,7 +211,6 @@ def set_runtime(self, rt=runtime.deno):
214211 ctypes .c_uint (rt ))
215212
216213
217- # Close the window.
218214 def close (self ):
219215 """Close the window.
220216
@@ -325,7 +321,6 @@ def get_bool(self, e: event, index: c_size_t = 0) -> bool:
325321 return data
326322
327323
328- # Run a JavaScript, and get the response back (Make sure your local buffer can hold the response).
329324 def script (self , script , timeout = 0 , response_size = (1024 * 8 )) -> javascript :
330325 """Run JavaScript and get the response back.
331326
@@ -364,7 +359,6 @@ def script(self, script, timeout=0, response_size=(1024 * 8)) -> javascript:
364359 return res
365360
366361
367- # Run JavaScript quickly with no waiting for the response
368362 def run (self , script ):
369363 """Run JavaScript quickly with no waiting for the response.
370364
@@ -383,7 +377,6 @@ def run(self, script):
383377 ctypes .c_char_p (script .encode ('utf-8' )))
384378
385379
386- # Set the web-server root folder path for a specific window
387380 def set_root_folder (self , path ):
388381 """Set the web-server root folder path for a specific window.
389382
@@ -402,7 +395,6 @@ def set_root_folder(self, path):
402395 ctypes .c_char_p (path .encode ('utf-8' )))
403396
404397
405- # Allow a specific window address to be accessible from a public network
406398 def set_public (self , status = True ):
407399 """Allow a specific window address to be accessible from a public network.
408400
@@ -421,7 +413,6 @@ def set_public(self, status = True):
421413 ctypes .c_bool (status ))
422414
423415
424- #
425416 def set_kiosk (self , status : bool ):
426417 """Set the window in Kiosk mode (Full screen).
427418
@@ -434,7 +425,6 @@ def set_kiosk(self, status: bool):
434425 lib .webui_set_kiosk (self .window , ctypes .c_bool (status ))
435426
436427
437- #
438428 def destroy (self ):
439429 """Close the window and free all memory resources."""
440430 if self .window == 0 :
@@ -443,7 +433,6 @@ def destroy(self):
443433 lib .webui_destroy (self .window )
444434
445435
446- #
447436 def set_icon (self , icon_path , icon_type ):
448437 """Set the default embedded HTML favicon.
449438
@@ -457,7 +446,6 @@ def set_icon(self, icon_path, icon_type):
457446 lib .webui_set_icon (self .window , ctypes .c_char_p (icon_path .encode ('utf-8' )), ctypes .c_char_p (icon_type .encode ('utf-8' )))
458447
459448
460- #
461449 def set_hide (self , status : bool ):
462450 """Set a window in hidden mode.
463451
@@ -473,7 +461,6 @@ def set_hide(self, status: bool):
473461 lib .webui_set_hide (self .window , ctypes .c_bool (status ))
474462
475463
476- #
477464 def set_size (self , width : int , height : int ):
478465 """Set the window size.
479466
@@ -487,7 +474,6 @@ def set_size(self, width: int, height: int):
487474 lib .webui_set_size (self .window , ctypes .c_uint (width ), ctypes .c_uint (height ))
488475
489476
490- #
491477 def set_position (self , x : int , y : int ):
492478 """Set the window position.
493479
@@ -501,7 +487,6 @@ def set_position(self, x: int, y: int):
501487 lib .webui_set_position (self .window , ctypes .c_uint (x ), ctypes .c_uint (y ))
502488
503489
504- #
505490 def set_profile (self , name , path ):
506491 """Set the web browser profile to use.
507492
@@ -518,7 +503,6 @@ def set_profile(self, name, path):
518503 lib .webui_set_profile (self .window , ctypes .c_char_p (name .encode ('utf-8' )), ctypes .c_char_p (path .encode ('utf-8' )))
519504
520505
521- #
522506 def set_port (self , port : int ):
523507 """Set a custom web-server/websocket network port to be used by WebUI.
524508
@@ -531,7 +515,6 @@ def set_port(self, port: int):
531515 lib .webui_set_port (self .window , ctypes .c_size_t (port ))
532516
533517
534- #
535518 def get_parent_process_id (self ) -> int :
536519 """Get the ID of the parent process.
537520
@@ -544,7 +527,6 @@ def get_parent_process_id(self) -> int:
544527 return int (lib .webui_get_parent_process_id (self .window ))
545528
546529
547- #
548530 def get_child_process_id (self ) -> int :
549531 """Get the ID of the last child process.
550532
@@ -716,7 +698,6 @@ def _download_library():
716698 ' && ' + script + ' minimal' )
717699
718700
719- # Load WebUI Dynamic Library
720701def _load_library ():
721702 global lib
722703 if lib is not None :
@@ -749,62 +730,55 @@ def _load_library():
749730 else :
750731 print ("Unsupported OS" )
751732
752- # Close all opened windows. webui_wait() will break.
733+
753734def exit ():
754735 global lib
755736 if lib is not None :
756737 lib .webui_exit ()
757738
758- #
739+
759740def free (ptr ):
760741 global lib
761742 if lib is not None :
762743 lib .webui_free (ctypes .c_void_p (ptr ))
763744
764745
765- #
766746def malloc (size : int ) -> int :
767747 global lib
768748 if lib is not None :
769749 return int (lib .webui_malloc (ctypes .c_size_t (size )))
770750
771751
772- #
773752def send_raw (window , function , raw , size ):
774753 global lib
775754 if lib is not None :
776755 lib .webui_send_raw (window , ctypes .c_char_p (function .encode ('utf-8' )), ctypes .c_void_p (raw ), ctypes .c_size_t (size ))
777756
778757
779- #
780758def clean ():
781759 global lib
782760 if lib is not None :
783761 lib .webui_clean ()
784762
785763
786- #
787764def delete_all_profiles ():
788765 global lib
789766 if lib is not None :
790767 lib .webui_delete_all_profiles ()
791768
792769
793- #
794770def delete_profile (window ):
795771 global lib
796772 if lib is not None :
797773 lib .webui_delete_profile (ctypes .c_size_t (window ))
798774
799775
800- #
801776def set_tls_certificate (certificate_pem , private_key_pem ):
802777 global lib
803778 if lib is not None :
804779 lib .webui_set_tls_certificate (ctypes .c_char_p (certificate_pem .encode ('utf-8' )), ctypes .c_char_p (private_key_pem .encode ('utf-8' )))
805780
806781
807- # Set startup timeout
808782def set_timeout (second ):
809783 global lib
810784 if lib is None :
@@ -826,7 +800,6 @@ def is_app_running():
826800 return r
827801
828802
829- # Wait until all opened windows get closed.
830803def wait ():
831804 global lib
832805 if lib is None :
@@ -841,12 +814,10 @@ def wait():
841814 pass
842815
843816
844- #
845817def _err_library_not_found (f ):
846818 print ('WebUI ' + f + '(): Library Not Found.' )
847819
848820
849- #
850821def _err_window_is_none (f ):
851822 print ('WebUI ' + f + '(): window is None.' )
852823
0 commit comments