def fl_stuff_clipboard(ptr_flobject, clipbdtype, datablock, size, \ pyfn_LoseSelectionCb): """fl_stuff_clipboard(ptr_flobject, clipbdtype, datablock, size, pyfn_LoseSelectionCb) -> size Stores data in clipboard, read-write buffer shared by all applications running on the X server. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT clipboard flobject clipbdtype : long type of clipboard (not used) datablock : pointer to void? data contents to be stored (in str?) *todo* size : long size (in bytes) of the contents pointed to by datablock. pyfn_LoseSelectionCb : python function callback, returned unused value name referring to function(ptr_flobject, [long]type) -> [int]num. Function to be invoked if selection is lost; type is unused. For textual content the application that loses the clipboard should typically undo the visual cues about the selection. Returns ------- size : int size of stuffed data?, or 0 (on failure) Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ #FL_LOSE_SELECTION_CB = cty.CFUNCTYPE(cty.c_int, cty.POINTER( \ # xfdata.FL_OBJECT), cty.c_long) _fl_stuff_clipboard = library.cfuncproto( library.load_so_libforms(), "fl_stuff_clipboard", cty.c_int, [cty.POINTER(xfdata.FL_OBJECT), cty.c_long, cty.c_void_p, cty.c_long, xfdata.FL_LOSE_SELECTION_CB], """int fl_stuff_clipboard(FL_OBJECT * ob, long int type, const char * data, long int size, FL_LOSE_SELECTION_CB lose_callback)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) l_clipbdtype = library.convert_to_longc(clipbdtype) ptr_vdata = cty.cast(datablock, cty.c_void_p) l_size = library.convert_to_longc(size) library.verify_function_type(pyfn_LoseSelectionCb) cfn_LoseSelectionCb = xfdata.FL_LOSE_SELECTION_CB(pyfn_LoseSelectionCb) library.keep_cfunc_refs(cfn_LoseSelectionCb, pyfn_LoseSelectionCb) library.keep_elem_refs(ptr_flobject, clipbdtype, datablock, size, \ l_clipbdtype, ptr_vdata, l_size) retval = _fl_stuff_clipboard(ptr_flobject, l_clipbdtype, ptr_vdata, \ l_size, cfn_LoseSelectionCb) return retval
def fl_request_clipboard(ptr_flobject, clipbdtype, pyfn_SelectionCb): """fl_request_clipboard(ptr_flobject, clipbdtype, pyfn_SelectionCb) -> result Retrieves data previously stuffed into the clipboard. Contents is available in invoked callback function. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT clipboard flobject clipbdtype : long type of clipboard (not used) pyfn_SelectionCb : python function callback, returned value name referring to function(ptr_flobject, [long]type, [pointer to void]datablock, [long]size) -> [int]num. Function to be invoked when the clipboard content is obtained; type is unused. The content data passed to the callback function should not be modified. Returns ------- result : int positive number (if the requesting flobject owns the selection, i.e. the callback could be invoked before the function returned), or 0 (if it does not own the selection), or -1 (if there is no selection) Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ #FL_SELECTION_CB = cty.CFUNCTYPE(cty.c_int, cty.POINTER(xfdata.FL_OBJECT), # cty.c_long, cty.c_void_p, cty.c_long) _fl_request_clipboard = library.cfuncproto( library.load_so_libforms(), "fl_request_clipboard", cty.c_int, [cty.POINTER(xfdata.FL_OBJECT), cty.c_long, xfdata.FL_SELECTION_CB], """int fl_request_clipboard(FL_OBJECT * ob, long int type, FL_SELECTION_CB got_it_callback)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) l_clipbdtype = library.convert_to_longc(clipbdtype) library.verify_function_type(pyfn_SelectionCb) cfn_SelectionCb = xfdata.FL_SELECTION_CB(pyfn_SelectionCb) library.keep_cfunc_refs(cfn_SelectionCb, pyfn_SelectionCb) library.keep_elem_refs(ptr_flobject, clipbdtype, l_clipbdtype) retval = _fl_request_clipboard(ptr_flobject, l_clipbdtype, \ cfn_SelectionCb) return retval
def fl_get_nmenu_item_by_value(ptr_flobject, itemval): """fl_get_nmenu_item_by_value(ptr_flobject, itemval) -> ptr_flpopupentry Searches through the list of all items (including items in sub-popups) and returns the first one with the val associated with the item. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT nmenu flobject itemval : long value corresponding to an item to be searched. Returns ------- ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY first item associated, or None (if is not found) Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_get_nmenu_item_by_value = library.cfuncproto( library.load_so_libforms(), "fl_get_nmenu_item_by_value", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), cty.c_long], """FL_POPUP_ENTRY * fl_get_nmenu_item_by_value(FL_OBJECT * p1, long int p2)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) l_itemval = library.convert_to_longc(itemval) library.keep_elem_refs(ptr_flobject, itemval, l_itemval) retval = _fl_get_nmenu_item_by_value(ptr_flobject, l_itemval) return retval
def fl_get_select_item_by_value(ptr_flobject, itemval): """fl_get_select_item_by_value(ptr_flobject, itemval) -> ptr_flpopupentry Finds the first item of select flobject with the value associated with the item. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT select flobject itemval : long value of the select item. Returns ------- ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY popup entry class instance, or None (on failure) Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_get_select_item_by_value = library.cfuncproto( library.load_so_libforms(), "fl_get_select_item_by_value", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), cty.c_long], """FL_POPUP_ENTRY * fl_get_select_item_by_value(FL_OBJECT * p1, long int p2)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) l_itemval = library.convert_to_longc(itemval) library.keep_elem_refs(ptr_flobject, itemval, l_itemval) retval = _fl_get_select_item_by_value(ptr_flobject, l_itemval) return retval
def fl_set_clock_adjustment(ptr_flobject, offset): """fl_set_clock_adjustment(ptr_flobject, offset) -> oldadjust Adjusts the clock to display a time other than local time. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT clock flobject offset : long adjustment value in seconds Returns ------- oldadjust : long old adjustment value Examples -------- >>> oldadj = fl_set_clock_adjustment(pclkobj, 3600) Notes ----- Status: NA-UTest + Doc + NoDemo = OK """ _fl_set_clock_adjustment = library.cfuncproto( library.load_so_libforms(), "fl_set_clock_adjustment", cty.c_long, [cty.POINTER(xfdata.FL_OBJECT), cty.c_long], """long int fl_set_clock_adjustment(FL_OBJECT * ob, long int offset)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) l_offset = library.convert_to_longc(offset) library.keep_elem_refs(ptr_flobject, offset, l_offset) retval = _fl_set_clock_adjustment(ptr_flobject, l_offset) return retval
def fl_replace_nmenu_item(ptr_flobject, ptr_flpopupentry, entryitemstxt, x=None, u=None, f=None, E=None, L=None, m=None, Rr=None, s=None): """fl_replace_nmenu_item(ptr_flobject, ptr_flpopupentry, entryitemstxt, x=None, u=None, f=None, E=None, L=None, m=None, Rr=None, s=None) -> ptr_flpopupentry Replaces an existing item of a nmenu flobject with another. If additional separated arguments are required by in-text special sequences, user must respect the same sequences' order. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT nmenu flobject ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY old popup entry to be replaced entryitemstxt : str text of the entry to be replaced and in-text special sequences with or without not separated additional arguments (if required). Text may contain "|" for more than one entry newline character which allows to create entries that span more than a single line. Special sequences who are allowed are: %x, %u, %f, %E, %L, %m or %T or %t, %R or %r or %l, %d, %h, %S, %s, %%. Special sequences of same type cannot be repeated in xforms-python. x : long numeric data to be passed to callbacks for entry (separated additional argument corresponding to %x in-text special sequence) u : pointer to any type user data to be passed to callbacks for entry; invoked callback has to take care of type check and re-cast ptr_void to chosen type using appropriate xfstruct.fls_convert_ptrvoid_to_* function (separated additional argument corresponding to %u in-text special sequence) f : python callback function, returned value name referring to function(ptr_flpopupreturn) -> int function to be invoked on set (separated additional argument corresponding to %f in-text special sequence) E : python callback function, returned unused value name referring to function(ptr_flpopupreturn) -> int function to be invoked on enter (separated additional argument corresponding to %E in-text special sequence) L : python callback function, returned unused value name referring to function(ptr_flpopupreturn) -> int function to be invoked on leave (separated additional argument corresponding to %L in-text special sequence) m : pointer to xfdata.FL_POPUP popup class to be used as sub-popup (separated additional argument corresponding to %m in-text special sequence) Rr : int group number of a radio entry type (separated additional argument corresponding to %R or %r in-text special sequence) s : str shortcut text for the entry (separated additional argument corresponding to %s in-text special sequence) Returns ------- ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY popup entry Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK See: Special sequences in entry text documentation in xfdata.py. """ # managing additional separate parameters l_x = ptr_u = cfn_f = cfn_E = cfn_L = i_Rr = s_s = None cparam_argstypelist = [] specseqargslist = [] if x: # long x additional arg l_x = library.convert_to_longc(x) cparam_argstypelist.append(cty.c_long) specseqargslist.append(l_x) if u: # pointer to void u additional arg ptr_u = library.convert_userdata_to_ptrvoid(u) cparam_argstypelist.append(cty.c_void_p) specseqargslist.append(ptr_u) if f: # xfdata.FL_POPUP_CB f additional arg library.verify_function_type(f) cfn_f = xfdata.FL_POPUP_CB(f) cparam_argstypelist.append(xfdata.FL_POPUP_CB) specseqargslist.append(cfn_f) if E: # xfdata.FL_POPUP_CB E additional arg library.verify_function_type(E) cfn_E = xfdata.FL_POPUP_CB(E) cparam_argstypelist.append(xfdata.FL_POPUP_CB) specseqargslist.append(cfn_E) if L: # xfdata.FL_POPUP_CB L additional arg library.verify_function_type(L) cfn_L = xfdata.FL_POPUP_CB(L) cparam_argstypelist.append(xfdata.FL_POPUP_CB) specseqargslist.append(cfn_L) if m: # pointer to xfdata.FL_POPUP m additional arg library.verify_flpopupptr_type(m) # passed as is cparam_argstypelist.append(cty.POINTER(xfdata.FL_POPUP)) specseqargslist.append(m) if Rr: # int R or r additional arg i_Rr = library.convert_to_intc(Rr) cparam_argstypelist.append(cty.c_int) specseqargslist.append(i_Rr) if s: # str s additional arg s_s = library.convert_to_bytestrc(s) cparam_argstypelist.append(cty.c_char_p) specseqargslist.append(s_s) if not cparam_argstypelist: # no additional separate params cparam_argstypelist = [cty.c_char_p, cty.c_char_p] specseqargslist = [b"", b""] elif len(cparam_argstypelist) < 2: # just 1 param, add another cparam_argstypelist.append(cty.c_char_p) specseqargslist.append(b"") _fl_replace_nmenu_item = library.cfuncproto( library.load_so_libforms(), "fl_replace_nmenu_item", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), cty.POINTER(xfdata.FL_POPUP_ENTRY), xfdata.STRING, \ cparam_argstypelist], """FL_POPUP_ENTRY * fl_replace_nmenu_item(FL_OBJECT * p1, FL_POPUP_ENTRY * p2, const char * p3, ...)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) library.verify_flpopupentryptr_type(ptr_flpopupentry) s_entryitemstxt = library.convert_to_bytestrc(entryitemstxt) library.keep_elem_refs(ptr_flobject, ptr_flpopupentry, entryitemstxt, \ s_entryitemstxt, specseqargslist, cparam_argstypelist, x, u, f, \ E, L, m, Rr, s, l_x, ptr_u, cfn_f, cfn_E, cfn_L, i_Rr, s_s) retval = _fl_replace_nmenu_item(ptr_flobject, ptr_flpopupentry, \ s_entryitemstxt, *specseqargslist) return retval
def fl_insert_select_items(ptr_flobject, ptr_flpopupentry, entryitemstxt, \ x=None, u=None, f=None, E=None, L=None, s=None): """fl_insert_select_items(ptr_flobject, ptr_flpopupentry, entryitemstxt, x=None, u=None, f=None, E=None, L=None, s=None) -> ptr_flpopupentry Inserts a new item somewhere in the middle of a list of already existing items (it can be used several times). If additional separated arguments are required by in-text special sequences, user must respect the same sequences' order. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT select flobject ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY popup entry. If it is None new items are inserted at the real start entryitemstxt : str text of the entry to be inserted and in-text special sequences with or without not separated additional arguments (if required). Text may contain "|" for more than one entry and newline character which allows to create entries that span more than a single line. Only some special sequences are allowed: %x, %u, %f, %E, %L, %d, %h, %S, %s, %% (other combinations do not make sense here). Special sequences of same type cannot be repeated in xforms-python. x : long numeric data to be passed to callbacks for entry (separated additional argument corresponding to %x in-text special sequence) u : pointer to any type user data to be passed to callbacks for entry; invoked callback has to take care of type check and re-cast ptr_void to chosen type using appropriate xfstruct.fls_convert_ptrvoid_to_* function (separated additional argument corresponding to %u in-text special sequence) f : python callback function, returned value name referring to function(ptr_flpopupreturn) -> int function to be invoked on set (separated additional argument corresponding to %f in-text special sequence) E : python callback function, returned unused value name referring to function(ptr_flpopupreturn) -> int function to be invoked on enter (separated additional argument corresponding to %E in-text special sequence) L : python callback function, returned unused value name referring to function(ptr_flpopupreturn) -> int function to be invoked on leave (separated additional argument corresponding to %L in-text special sequence) s : str shortcut text for the entry (separated additional argument corresponding to %s in-text special sequence) Returns ------- ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY popup entry, or None (on failure) Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK See: Special sequences in entry text documentation in xfdata.py. """ # managing additional separate parameters l_x = ptr_u = cfn_f = cfn_E = cfn_L = s_s = None cparam_argstypelist = [] specseqargslist = [] if x: # long x additional arg l_x = library.convert_to_longc(x) cparam_argstypelist.append(cty.c_long) specseqargslist.append(l_x) if u: # pointer to void u additional arg ptr_u = library.convert_userdata_to_ptrvoid(u) cparam_argstypelist.append(cty.c_void_p) specseqargslist.append(ptr_u) if f: # xfdata.FL_POPUP_CB f additional arg library.verify_function_type(f) cfn_f = xfdata.FL_POPUP_CB(f) cparam_argstypelist.append(xfdata.FL_POPUP_CB) specseqargslist.append(cfn_f) if E: # xfdata.FL_POPUP_CB E additional arg library.verify_function_type(E) cfn_E = xfdata.FL_POPUP_CB(E) cparam_argstypelist.append(xfdata.FL_POPUP_CB) specseqargslist.append(cfn_E) if L: # xfdata.FL_POPUP_CB L additional arg library.verify_function_type(L) cfn_L = xfdata.FL_POPUP_CB(L) cparam_argstypelist.append(xfdata.FL_POPUP_CB) specseqargslist.append(cfn_L) if s: # str s additional arg s_s = library.convert_to_bytestrc(s) cparam_argstypelist.append(cty.c_char_p) specseqargslist.append(s_s) if not cparam_argstypelist: # no additional separate params cparam_argstypelist = [cty.c_char_p, cty.c_char_p] specseqargslist = [b"", b""] elif len(cparam_argstypelist) < 2: # just 1 param, add another cparam_argstypelist.append(cty.c_char_p) specseqargslist.append(b"") _fl_insert_select_items = library.cfuncproto( library.load_so_libforms(), "fl_insert_select_items", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), cty.POINTER(xfdata.FL_POPUP_ENTRY), xfdata.STRING, cparam_argstypelist], """FL_POPUP_ENTRY * fl_insert_select_items(FL_OBJECT * p1, FL_POPUP_ENTRY * p2, const char * p3, ...)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) library.verify_flpopupentryptr_type(ptr_flpopupentry) s_entryitemstxt = library.convert_to_bytestrc(entryitemstxt) library.keep_elem_refs(ptr_flobject, ptr_flpopupentry, entryitemstxt, \ s_entryitemstxt, specseqargslist, cparam_argstypelist, x, u, \ f, E, L, s, l_x, ptr_u, cfn_f, cfn_E, cfn_L, s_s) retval = _fl_insert_select_items(ptr_flobject, ptr_flpopupentry, \ s_entryitemstxt, *specseqargslist) return retval