@@ -539,43 +539,43 @@ def get_child_process_id(self) -> int:
539539 return int (lib .webui_get_child_process_id (self .window ))
540540
541541
542- """Create a new webui window object using a specified window number.
543- @param window_number The window number (should be > 0, and < WEBUI_MAX_IDS)
544- @return Returns the same window number if success."""
545542 def new_window_id (self , window_number : int ) -> int :
543+ """Create a new webui window object using a specified window number.
544+ @param window_number The window number (should be > 0, and < WEBUI_MAX_IDS)
545+ @return Returns the same window number if success."""
546546 global lib
547547 if lib is None :
548548 _err_library_not_found ('new_window_id' )
549549 return 0
550550 return int (lib .webui_new_window_id (ctypes .c_size_t (window_number )))
551551
552552
553- """Get a free window number that can be used with `webui_new_window_id()`.
554- @return Returns the first available free window number. Starting from 1."""
555553 def get_new_window_id (self ) -> int :
554+ """Get a free window number that can be used with `webui_new_window_id()`.
555+ @return Returns the first available free window number. Starting from 1."""
556556 global lib
557557 if lib is None :
558558 _err_library_not_found ('get_new_window_id' )
559559 return 0
560560 return int (lib .webui_get_new_window_id ())
561561
562562
563- """Get the recommended web browser ID to use. If you are already using one,
564- this function will return the same ID.
565- @return Returns a web browser ID."""
566563 def get_best_browser (self ) -> int :
564+ """Get the recommended web browser ID to use. If you are already using one,
565+ this function will return the same ID.
566+ @return Returns a web browser ID."""
567567 global lib
568568 if lib is None :
569569 _err_library_not_found ('get_best_browser' )
570570 return 0
571571 return int (lib .webui_get_best_browser (self .window ))
572572
573573
574- """Same as `webui_show()`. But start only the web server and return the URL.
575- No window will be shown.
576- @param content The HTML, Or a local file
577- @return Returns the url of this window server."""
578574 def start_server (self , content : str ) -> str :
575+ """Same as `webui_show()`. But start only the web server and return the URL.
576+ No window will be shown.
577+ @param content The HTML, Or a local file
578+ @return Returns the url of this window server."""
579579 global lib
580580 if lib is None :
581581 _err_library_not_found ('start_server' )
@@ -586,63 +586,63 @@ def start_server(self, content: str) -> str:
586586 return url .decode ('utf-8' ) if url else ""
587587
588588
589- """Show a WebView window using embedded HTML, or a file. If the window is already
590- open, it will be refreshed. Note: Win32 need `WebView2Loader.dll`.
591- @param content The HTML, URL, Or a local file
592- @return Returns True if showing the WebView window is successed."""
593589 def show_wv (self , content : str ) -> bool :
590+ """Show a WebView window using embedded HTML, or a file. If the window is already
591+ open, it will be refreshed. Note: Win32 need `WebView2Loader.dll`.
592+ @param content The HTML, URL, Or a local file
593+ @return Returns True if showing the WebView window is successed."""
594594 global lib
595595 if lib is None :
596596 _err_library_not_found ('show_wv' )
597597 return False
598598 return bool (lib .webui_show_wv (self .window , content .encode ('utf-8' )))
599599
600600
601- """Add a user-defined web browser's CLI parameters.
602- @param params Command line parameters"""
603601 def set_custom_parameters (self , params : str ):
602+ """Add a user-defined web browser's CLI parameters.
603+ @param params Command line parameters"""
604604 global lib
605605 if lib is None :
606606 _err_library_not_found ('set_custom_parameters' )
607607 return
608608 lib .webui_set_custom_parameters (self .window , params .encode ('utf-8' ))
609609
610610
611- """Set the window with high-contrast support. Useful when you want to
612- build a better high-contrast theme with CSS.
613- @param status True or False"""
614611 def set_high_contrast (self , status : bool ):
612+ """Set the window with high-contrast support. Useful when you want to
613+ build a better high-contrast theme with CSS.
614+ @param status True or False"""
615615 global lib
616616 if lib is None :
617617 _err_library_not_found ('set_high_contrast' )
618618 return
619619 lib .webui_set_high_contrast (self .window , ctypes .c_bool (status ))
620620
621621
622- """Set the window minimum size.
623- @param width The window width
624- @param height The window height"""
625622 def set_minimum_size (self , width : int , height : int ):
623+ """Set the window minimum size.
624+ @param width The window width
625+ @param height The window height"""
626626 global lib
627627 if lib is None :
628628 _err_library_not_found ('set_minimum_size' )
629629 return
630630 lib .webui_set_minimum_size (self .window , ctypes .c_uint (width ), ctypes .c_uint (height ))
631631
632632
633- """Set the web browser proxy server to use. Need to be called before `webui_show()`.
634- @param proxy_server The web browser proxy_server"""
635633 def set_proxy (self , proxy_server : str ):
634+ """Set the web browser proxy server to use. Need to be called before `webui_show()`.
635+ @param proxy_server The web browser proxy_server"""
636636 global lib
637637 if lib is None :
638638 _err_library_not_found ('set_proxy' )
639639 return
640640 lib .webui_set_proxy (self .window , proxy_server .encode ('utf-8' ))
641641
642642
643- """Navigate to a specific URL. All clients.
644- @param url Full HTTP URL"""
645643 def navigate (self , url : str ):
644+ """Navigate to a specific URL. All clients.
645+ @param url Full HTTP URL"""
646646 global lib
647647 if lib is None :
648648 _err_library_not_found ('navigate' )
@@ -822,49 +822,49 @@ def _err_window_is_none(f):
822822 print ('WebUI ' + f + '(): window is None.' )
823823
824824
825- """Get OS high contrast preference.
826- @return Returns True if OS is using high contrast theme"""
827825def is_high_contrast () -> bool :
826+ """Get OS high contrast preference.
827+ @return Returns True if OS is using high contrast theme"""
828828 global lib
829829 if lib is None :
830830 _err_library_not_found ('is_high_contrast' )
831831 return False
832832 return bool (lib .webui_is_high_contrast ())
833833
834834
835- """Check if a web browser is installed.
836- @return Returns True if the specified browser is available"""
837835def browser_exist (browser : int ) -> bool :
836+ """Check if a web browser is installed.
837+ @return Returns True if the specified browser is available"""
838838 global lib
839839 if lib is None :
840840 _err_library_not_found ('browser_exist' )
841841 return False
842842 return bool (lib .webui_browser_exist (ctypes .c_size_t (browser )))
843843
844844
845- """Open an URL in the native default web browser.
846- @param url The URL to open"""
847845def open_url (url : str ):
846+ """Open an URL in the native default web browser.
847+ @param url The URL to open"""
848848 global lib
849849 if lib is None :
850850 _err_library_not_found ('open_url' )
851851 return
852852 lib .webui_open_url (url .encode ('utf-8' ))
853853
854854
855- """Get an available usable free network port.
856- @return Returns a free port"""
857855def get_free_port () -> int :
856+ """Get an available usable free network port.
857+ @return Returns a free port"""
858858 global lib
859859 if lib is None :
860860 _err_library_not_found ('get_free_port' )
861861 return 0
862862 return int (lib .webui_get_free_port ())
863863
864864
865- """Get the HTTP mime type of a file.
866- @return Returns the HTTP mime string"""
867865def get_mime_type (file : str ) -> str :
866+ """Get the HTTP mime type of a file.
867+ @return Returns the HTTP mime string"""
868868 global lib
869869 if lib is None :
870870 _err_library_not_found ('get_mime_type' )
@@ -875,10 +875,10 @@ def get_mime_type(file: str) -> str:
875875 return mime .decode ('utf-8' ) if mime else ""
876876
877877
878- """Encode text to Base64. The returned buffer need to be freed.
879- @param str The string to encode (Should be null terminated)
880- @return Returns the base64 encoded string"""
881878def encode (text : str ) -> str :
879+ """Encode text to Base64. The returned buffer need to be freed.
880+ @param str The string to encode (Should be null terminated)
881+ @return Returns the base64 encoded string"""
882882 global lib
883883 if lib is None :
884884 _err_library_not_found ('encode' )
@@ -891,10 +891,10 @@ def encode(text: str) -> str:
891891 return result
892892
893893
894- """Decode a Base64 encoded text. The returned buffer need to be freed.
895- @param str The string to decode (Should be null terminated)
896- @return Returns the base64 decoded string"""
897894def decode (text : str ) -> str :
895+ """Decode a Base64 encoded text. The returned buffer need to be freed.
896+ @param str The string to decode (Should be null terminated)
897+ @return Returns the base64 decoded string"""
898898 global lib
899899 if lib is None :
900900 _err_library_not_found ('decode' )
0 commit comments