@@ -94,18 +94,18 @@ def __init__(self):
9494 webui_wrapper = None
9595 # size_t webui_new_window(void)
9696 webui_wrapper = lib .webui_new_window
97- webui_wrapper .restype = c_size_t
98- self .window = c_size_t (webui_wrapper ())
97+ webui_wrapper .restype = c_uint
98+ self .window = c_uint (webui_wrapper ())
9999 # Get the window unique ID
100100 self .window_id = str (self .window )
101101 # Initializing events() to be used by
102102 # WebUI library as a callback
103103 py_fun = ctypes .CFUNCTYPE (
104104 ctypes .c_void_p , # RESERVED
105- ctypes .c_size_t , # window
105+ ctypes .c_uint , # window
106106 ctypes .c_uint , # event type
107107 ctypes .c_char_p , # element
108- ctypes .c_size_t , # event number
108+ ctypes .c_uint , # event number
109109 ctypes .c_uint ) # Bind ID
110110 self .c_events = py_fun (self ._events )
111111 except OSError as e :
@@ -120,7 +120,7 @@ def __init__(self):
120120 # lib.webui_close(self.window)
121121
122122
123- def _events (self , window : ctypes .c_size_t ,
123+ def _events (self , window : ctypes .c_uint ,
124124 event_type : ctypes .c_uint ,
125125 _element : ctypes .c_char_p ,
126126 event_number : ctypes .c_longlong ,
@@ -192,7 +192,10 @@ def show(self, content="<html></html>", browser:int=browser.ChromiumBased):
192192 _err_library_not_found ('show' )
193193 return
194194 # bool webui_show_browser(size_t window, const char* content, size_t browser)
195- lib .webui_show_browser (self .window , content .encode ('utf-8' ), ctypes .c_uint (browser ))
195+ lib .webui_show_browser (
196+ self .window ,
197+ content .encode ('utf-8' ),
198+ ctypes .c_uint (browser ))
196199
197200
198201 def set_runtime (self , rt = runtime .deno ):
@@ -209,8 +212,9 @@ def set_runtime(self, rt=runtime.deno):
209212 _err_library_not_found ('set_runtime' )
210213 return
211214 # void webui_set_runtime(size_t window, size_t runtime)
212- lib .webui_set_runtime (self .window ,
213- ctypes .c_uint (rt ))
215+ lib .webui_set_runtime (
216+ self .window ,
217+ ctypes .c_uint (rt ))
214218
215219
216220 def close (self ):
@@ -237,6 +241,7 @@ def is_shown(self):
237241 _err_library_not_found ('is_shown' )
238242 return
239243 # bool webui_is_shown(size_t window)
244+ lib .webui_is_shown .restype = ctypes .c_bool
240245 r = bool (lib .webui_is_shown (self .window ))
241246 return r
242247
@@ -259,7 +264,7 @@ def get_url(self) -> str:
259264 return decode
260265
261266
262- def get_str (self , e : event , index : c_size_t = 0 ) -> str :
267+ def get_str (self , e : event , index : c_uint = 0 ) -> str :
263268 """Get an argument as string at a specific index.
264269
265270 Args:
@@ -274,6 +279,7 @@ def get_str(self, e: event, index: c_size_t = 0) -> str:
274279 _err_library_not_found ('get_str' )
275280 return
276281 # const char* webui_interface_get_string_at(size_t window, size_t event_number, size_t index)
282+ # const char* webui_interface_get_string_at(size_t window, size_t event_number, size_t index)
277283 c_res = lib .webui_interface_get_string_at
278284 c_res .restype = ctypes .c_char_p
279285 data = c_res (self .window ,
@@ -283,7 +289,7 @@ def get_str(self, e: event, index: c_size_t = 0) -> str:
283289 return decode
284290
285291
286- def get_int (self , e : event , index : c_size_t = 0 ) -> int :
292+ def get_int (self , e : event , index : c_uint = 0 ) -> int :
287293 """Get an argument as integer at a specific index.
288294
289295 Args:
@@ -306,7 +312,7 @@ def get_int(self, e: event, index: c_size_t = 0) -> int:
306312 return data
307313
308314
309- def get_bool (self , e : event , index : c_size_t = 0 ) -> bool :
315+ def get_bool (self , e : event , index : c_uint = 0 ) -> bool :
310316 """Get an argument as boolean at a specific index.
311317
312318 Args:
@@ -356,7 +362,8 @@ def script(self, script, timeout=0, response_size=(1024 * 8)) -> javascript:
356362 buffer_ptr = ctypes .pointer (buffer )
357363 status = bool (lib .webui_script (self .window ,
358364 ctypes .c_char_p (script .encode ('utf-8' )),
359- ctypes .c_uint (timeout ), buffer_ptr ,
365+ ctypes .c_uint (timeout ),
366+ buffer_ptr ,
360367 ctypes .c_uint (response_size )))
361368 res = javascript ()
362369 res .data = buffer .value .decode ('utf-8' )
@@ -525,7 +532,7 @@ def set_port(self, port: int):
525532 _err_window_is_none ('set_port' )
526533 return
527534 # bool webui_set_port(size_t window, size_t port)
528- lib .webui_set_port (self .window , ctypes .c_size_t (port ))
535+ lib .webui_set_port (self .window , ctypes .c_uint (port ))
529536
530537
531538 def get_parent_process_id (self ) -> int :
@@ -563,7 +570,7 @@ def new_window_id(self, window_number: int) -> int:
563570 _err_library_not_found ('new_window_id' )
564571 return 0
565572 # size_t webui_new_window_id(size_t window_number)
566- return int (lib .webui_new_window_id (ctypes .c_size_t (window_number )))
573+ return int (lib .webui_new_window_id (ctypes .c_uint (window_number )))
567574
568575
569576 def get_new_window_id (self ) -> int :
@@ -774,14 +781,14 @@ def malloc(size: int) -> int:
774781 global lib
775782 if lib is not None :
776783 # void* webui_malloc(size_t size)
777- return int (lib .webui_malloc (ctypes .c_size_t (size )))
784+ return int (lib .webui_malloc (ctypes .c_uint (size )))
778785
779786
780787def send_raw (window , function , raw , size ):
781788 global lib
782789 if lib is not None :
783790 # void webui_send_raw(size_t window, const char* function, const void* raw, size_t size)
784- lib .webui_send_raw (window , ctypes .c_char_p (function .encode ('utf-8' )), ctypes .c_void_p (raw ), ctypes .c_size_t (size ))
791+ lib .webui_send_raw (window , ctypes .c_char_p (function .encode ('utf-8' )), ctypes .c_void_p (raw ), ctypes .c_uint (size ))
785792
786793
787794def clean ():
@@ -802,7 +809,7 @@ def delete_profile(window):
802809 global lib
803810 if lib is not None :
804811 # void webui_delete_profile(size_t window)
805- lib .webui_delete_profile (ctypes .c_size_t (window ))
812+ lib .webui_delete_profile (ctypes .c_uint (window ))
806813
807814
808815def set_tls_certificate (certificate_pem , private_key_pem ):
@@ -877,7 +884,7 @@ def browser_exist(browser: int) -> bool:
877884 _err_library_not_found ('browser_exist' )
878885 return False
879886 # bool webui_browser_exist(size_t browser)
880- return bool (lib .webui_browser_exist (ctypes .c_size_t (browser )))
887+ return bool (lib .webui_browser_exist (ctypes .c_uint (browser )))
881888
882889
883890def open_url (url : str ):
0 commit comments