def fl_create_bitmap_cursor(source, maskstr, width, height, hotx, hoty): """fl_create_bitmap_cursor(source, maskstr, width, height, hotx, hoty) -> cursornum Creates a bitmap cursor, using cursors other than those defined by the standard cursor font. Parameters ---------- source : str of ubytes bitmap to be used as cursor. maskstr : str of ubytes bitmap defining the shape of the cursor. The pixels set to 1 define which source pixels are displayed. If it is empty ("") all bits in source are displayed. width : int width of cursor height : int height of cursor hotx : int horizontal hotspot of the cursor (relative to the source origin) hoty : int vertical hotspot of the cursor (relative to the source origin) Returns ------- cursornum : int cursor id Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_create_bitmap_cursor = library.cfuncproto( library.load_so_libforms(), "fl_create_bitmap_cursor", cty.c_int, [xfdata.STRING, xfdata.STRING, cty.c_int, cty.c_int, cty.c_int, cty.c_int], """int fl_create_bitmap_cursor(const char * source, const char * mask, int w, int h, int hotx, int hoty)""") library.check_if_flinitialized() s_source = library.convert_to_bytestrc(source) if not maskstr: # if it is empty s_maskstr = cty.cast(maskstr, cty.c_void_p) else: s_maskstr = library.convert_to_bytestrc(maskstr) i_width = library.convert_to_intc(width) i_height = library.convert_to_FL_Coord(height) i_hotx = library.convert_to_intc(hotx) i_hoty = library.convert_to_intc(hoty) library.keep_elem_refs(source, maskstr, width, height, hotx, hoty, \ s_source, s_maskstr, i_width, i_height, i_hotx, i_hoty) retval = _fl_create_bitmap_cursor(s_source, s_maskstr, i_width, \ i_height, i_hotx, i_hoty) return retval
def fl_get_dirlist(dirname, pattern, rescan): """fl_get_dirlist(dirname, pattern, rescan) -> ptr_dirlist, numfiles Finds out a listing of specified directory. Parameters ---------- dirname : str name of directory pattern : str regular expression that is used to filter the directory entries rescan : int flag to request a re-read or not. Values 0 (no re-read) or non-zero (to do a re-read) Returns ------- ptr_dirlist : pointer to xfdata.FL_DIRLIST array of DirList class instances numfiles : int number of files (total number of entries in directory dirname that match the pattern specified by pattern) Examples -------- >>> pdirlist, nfiles = fl_get_dirlist("/home/userdir", "*.*", 1) >>> print(pdirlist[1].name) API_diversion ---------- API changed from XForms, upstream is fl_get_dirlist(directory, pattern, n, rescan) Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_get_dirlist = library.cfuncproto( library.load_so_libforms(), "fl_get_dirlist", cty.POINTER(xfdata.FL_Dirlist), [xfdata.STRING, xfdata.STRING, cty.POINTER(cty.c_int), cty.c_int], """const FL_Dirlist * fl_get_dirlist(const char * dir, const char * pattern, int * n, int rescan)""") library.check_if_flinitialized() s_dirname = library.convert_to_bytestrc(dirname) s_pattern = library.convert_to_bytestrc(pattern) i_numfiles, ptr_numfiles = library.make_intc_and_pointer() i_rescan = library.convert_to_intc(rescan) library.keep_elem_refs(dirname, pattern, i_numfiles, rescan, s_dirname, \ s_pattern, ptr_numfiles, i_rescan) retval = _fl_get_dirlist(s_dirname, s_pattern, ptr_numfiles, i_rescan) return retval, i_numfiles.value
def fl_add_formbrowser(frmbrwstype, xpos, ypos, width, height, label): """fl_add_formbrowser(frmbrwstype, xpos, ypos, width, height, label) -> ptr_flform Adds a formbrowser flobject. It is a container class that is capable of holding multiple forms, the height of which in aggregate may exceed the screen height. The formbrowser also works obviously for a single form that has a height that is larger than the screen height. Parameters ---------- frmbrwstype : int type of formbrowser to be added. Values (from xfdata.py) FL_NORMAL_FORMBROWSER (normal formbrowser type) xpos : int horizontal position (upper-left corner) ypos : int vertical position (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of formbrowser Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT formbrowser flobject added Examples -------- >>> pfrmbrobj = fl_add_formbrowser(xfdata.FL_NORMAL_FORMBROWSER, 110, 60, 550, 750, "My Formbrowser) Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_add_formbrowser = library.cfuncproto( library.load_so_libforms(), "fl_add_formbrowser", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_formbrowser(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * label)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(frmbrwstype, \ xfdata.FORMBRWSTYPE_list) i_frmbrwstype = library.convert_to_intc(frmbrwstype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(frmbrwstype, xpos, ypos, width, height, label, \ i_frmbrwstype, i_xpos, i_ypos, i_width, i_height, s_label) retval = _fl_add_formbrowser(i_frmbrwstype, i_xpos, i_ypos, i_width, \ i_height, s_label) return retval
def fl_set_pixmapbutton_focus_file(ptr_flobject, fname): """fl_set_pixmapbutton_focus_file(ptr_flobject, fname) Defines a different pixmap to show, using a file, when the mouse enters a pixmap button flobject, instead of an outline of the button. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT button flobject fname : str name of file containing pixmap resource Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_set_pixmapbutton_focus_file = library.cfuncproto( library.load_so_libforms(), "fl_set_pixmapbutton_focus_file", None, [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """void fl_set_pixmapbutton_focus_file(FL_OBJECT * ob, const char * fname)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_fname = library.convert_to_bytestrc(fname) library.keep_elem_refs(ptr_flobject, fname, s_fname) _fl_set_pixmapbutton_focus_file(ptr_flobject, s_fname)
def fl_fmtime(fname): """fl_fmtime(fname) -> mtime Finds out the modification time of a specified file. You can then use python time.ctime() to have a textual representation of time. Parameters ---------- fname : str name of the file Returns ------- mtime : long_pos file modification time Examples -------- >>> fmtime = fl_fmtime("/home/user/somefile") Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_fmtime = library.cfuncproto( library.load_so_libforms(), "fl_fmtime", cty.c_ulong, [xfdata.STRING], """long unsigned int fl_fmtime(const char * s)""") library.check_if_flinitialized() s_fname = library.convert_to_bytestrc(fname) library.keep_elem_refs(fname, s_fname) retval = _fl_fmtime(s_fname) return retval
def fl_set_input(ptr_flobject, text): """fl_set_input(ptr_flobject, text) Defines the particular input string, with no checks for validity. An empty string can be used to clear an input field. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT input flobject text : str input text Examples -------- >>> fl_set_input(pinpobj, "some text") Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_set_input = library.cfuncproto( library.load_so_libforms(), "fl_set_input", None, [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """void fl_set_input(FL_OBJECT * ob, const char * str)""", ) library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_text = library.convert_to_bytestrc(text) library.keep_elem_refs(ptr_flobject, text, s_text) _fl_set_input(ptr_flobject, s_text)
def fl_set_folder_byname(ptr_flobject, name): """fl_set_folder_byname(ptr_flobject, name) Defines which folder to show by its name. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT tabfolder flobject name : str name of folder to show Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_set_folder_byname = library.cfuncproto( library.load_so_libforms(), "fl_set_folder_byname", None, [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """void fl_set_folder_byname(FL_OBJECT * ob, const char * name)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) sname = library.convert_to_bytestrc(name) library.keep_elem_refs(ptr_flobject, name, sname) _fl_set_folder_byname(ptr_flobject, name)
def fl_delete_folder_byname(ptr_flobject, name): """fl_delete_folder_byname(ptr_flobject, name) Removes a folder from a tabfolder flobject by its name. After deletion, the number of folders in the tabfolder as well as the sequence numbers are updated. This means if you want to delete all folders after the second folder, you can do that by deleting the third folder repeatedly. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT tabfolder flobject name : str name of folder to be deleted Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_delete_folder_byname = library.cfuncproto( library.load_so_libforms(), "fl_delete_folder_byname", None, [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """void fl_delete_folder_byname(FL_OBJECT * ob, const char * name)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_name = library.convert_to_bytestrc(name) library.keep_elem_refs(ptr_flobject, name, s_name) _fl_delete_folder_byname(ptr_flobject, s_name)
def fl_add_pixmap(pixmaptype, xpos, ypos, width, height, label): """fl_add_pixmap(pixmaptype, xpos, ypos, width, height, label) -> ptr_flobject Adds a pixmap flobject (plain text multi-color image format). The label is by default placed below the pixmap. The pixmap is empty on creation. Parameters ---------- pixmaptype : int type of pixmap to be added. Values (from xfdata.py) FL_NORMAL_PIXMAP (normal pixmap flobject type) xpos : int horizontal position (upper-left corner) ypos : int vertical position of bitmap (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of pixmap Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT flobject created Examples -------- >>> fl_add_pixmap(xfdata.FL_NORMAL_PIXMAP, 320, 200, 100, 100, "MyPixmap") Notes ----- Status: UnitTest + Doc + Demo = OK """ _fl_add_pixmap = library.cfuncproto( library.load_so_libforms(), "fl_add_pixmap", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_pixmap(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * label)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(pixmaptype, \ xfdata.PIXMAPTYPE_list) i_pixmaptype = library.convert_to_intc(pixmaptype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(pixmaptype, xpos, ypos, width, height, \ label, i_pixmaptype, i_xpos, i_ypos, i_width, i_height, \ s_label) retval = _fl_add_pixmap(i_pixmaptype, i_xpos, i_ypos, i_width, \ i_height, s_label) return retval
def fl_set_pixmap_file(ptr_flobject, fname): """fl_set_pixmap_file(ptr_flobject, fname) Defines the actual bitmap being displayed from a specified .xpm file. A number of pixmaps can be found in '/usr/include/X11/pixmaps' or similar places. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT pixmap flobject fname : str name (path included if necessary) of pixmap (.xpm format) file Examples -------- >>> fl_set_pixmap_file(pxpmobj, "mypixmapfile.xpm") Notes ----- Status: UnitTest + Doc + Demo = OK """ _fl_set_pixmap_file = library.cfuncproto( library.load_so_libforms(), "fl_set_pixmap_file", None, [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """void fl_set_pixmap_file(FL_OBJECT * ob, const char * fname)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_fname = library.convert_to_bytestrc(fname) library.keep_elem_refs(ptr_flobject, fname, s_fname) _fl_set_pixmap_file(ptr_flobject, s_fname)
def fl_add_clock(clocktype, xpos, ypos, width, height, label): """fl_add_clock(clocktype, xpos, ypos, width, height, label) -> ptr_flobject Adds a clock flobject. Parameters ---------- clocktype : int type of clock to be added. Values (from xfdata.py) - FL_ANALOG_CLOCK (An analog clock complete with the second hand), - FL_DIGITAL_CLOCK (A digital clock) xpos : int horizontal position (upper-left corner) ypos : int vertical position (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of clock Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT clock flobject added Examples -------- >>> pclkobj = fl_add_clock(xfdata.FL_ANALOG_CLOCK, 150, 210, 220, 200, "My great clock") Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_add_clock = library.cfuncproto( library.load_so_libforms(), "fl_add_clock", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_clock(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * s)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(clocktype, \ xfdata.CLOCKTYPE_list) i_clocktype = library.convert_to_intc(clocktype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(clocktype, xpos, ypos, width, height, label, \ i_clocktype, i_xpos, i_ypos, i_width, i_height, s_label) retval = _fl_add_clock(i_clocktype, i_xpos, i_ypos, i_width, i_height, \ s_label) return retval
def fl_read_bitmapfile(win, fname): """fl_read_bitmapfile(win, fname) -> pixmapid, width, height, hotx, hoty Makes a bitmap from a bitmap (.xpm format) file. Parameters ---------- win : long_pos window id fname : str name of bitmap (.xbm format) file Returns ------- pixmapid : long_pos pixmap resource id width : int_pos width height : int_pos height hotx : int hotspot horizontal position hoty : int hotspot vertical position Examples -------- >>> pmap, w, h, hotx, hoty = fl_read_bitmapfile(win0, "xbmfile.xbm") API_diversion ---------- API changed from XForms, upstream is fl_read_bitmapfile(win, filename, width, height, hotx, hoty) Notes ----- Status: UnitTest + Doc + NoDemo = OK """ _fl_read_bitmapfile = library.cfuncproto( library.load_so_libforms(), "fl_read_bitmapfile", xfdata.Pixmap, [xfdata.Window, xfdata.STRING, cty.POINTER(cty.c_uint), cty.POINTER(cty.c_uint), cty.POINTER(cty.c_int), cty.POINTER(cty.c_int)], """Pixmap fl_read_bitmapfile(Window win, const char * file, unsigned int * w, unsigned int * h, int * hotx, int * hoty)""") library.check_if_flinitialized() ul_win = library.convert_to_Window(win) s_fname = library.convert_to_bytestrc(fname) i_width, ptr_width = library.make_uintc_and_pointer() i_height, ptr_height = library.make_uintc_and_pointer() i_hotx, ptr_hotx = library.make_intc_and_pointer() i_hoty, ptr_hoty = library.make_intc_and_pointer() library.keep_elem_refs(win, fname, i_width, i_height, i_hotx, i_hoty, \ ul_win, s_fname, ptr_width, ptr_height, ptr_hotx, ptr_hoty) retval = _fl_read_bitmapfile(ul_win, s_fname, ptr_width, ptr_height, \ ptr_hotx, ptr_hoty) return retval, i_width.value, i_height.value, i_hotx.value, i_hoty.value
def fl_add_glcanvas(canvastype, xpos, ypos, width, height, label): """fl_add_glcanvas(canvastype, xpos, ypos, width, height, label) -> ptr_flobject Adds a glcanvas flobject to the form. Parameters ---------- canvastype : int type of glcanvas to be added. Values (from xfdata.py) - FL_NORMAL_CANVAS (normal canvas type), - FL_SCROLLED_CANVAS (not enabled) xpos : int horizontal position (upper-left corner) ypos : int vertical position (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of glcanvas Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT glcanvas flobject added Examples -------- >>> pglcnvobj = fl_add_glcanvas(xfdata.FL_NORMAL_CANVAS, 14, 21, 654, 457, "My Gl Canvas") Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_add_glcanvas = library.cfuncproto( library.load_so_libformsgl(), "fl_add_glcanvas", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_glcanvas(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * label)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(canvastype, \ xfdata.CANVASTYPE_list) i_canvastype = library.convert_to_intc(canvastype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(canvastype, xpos, ypos, width, height, label, \ i_canvastype, i_xpos, i_ypos, i_width, i_height, s_label) retval = _fl_add_glcanvas(i_canvastype, i_xpos, i_ypos, i_width, \ i_height, s_label) return retval
def fl_add_counter(countertype, xpos, ypos, width, height, label): """fl_add_counter(countertype, xpos, ypos, width, height, label) -> ptr_flobject Adds a counter flobject. Parameters ---------- countertype : int type of counter to be added. Values (from xfdata.py) FL_NORMAL_COUNTER (A counter with two buttons on each side), FL_SIMPLE_COUNTER (A counter with one button on each side). xpos : int horizontal position (upper-left corner) ypos : int vertical position (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of counter Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT counter flobject added Examples -------- >>> pcntrobj = fl_add_counter(FL_NORMAL_COUNTER, 142, 230, 142, 100, "My Counter") Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_add_counter = library.cfuncproto( library.load_so_libforms(), "fl_add_counter", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_counter(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * label)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(countertype, \ xfdata.COUNTERTYPE_list) i_countertype = library.convert_to_intc(countertype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(countertype, xpos, ypos, width, height, label, \ i_countertype, i_xpos, i_ypos, i_width, i_height, s_label) retval = _fl_add_counter(i_countertype, i_xpos, i_ypos, i_width, \ i_height, s_label) return retval
def fl_add_text(texttype, xpos, ypos, width, height, label): """fl_add_text(texttype, xpos, ypos, width, height, label) -> ptr_flobject Adds a text flobject. It simply consists of a label maybe placed in a box. Parameters ---------- texttype : int type of text to be added. Values (from xfdata.py) FL_NORMAL_TEXT (Normal text type) xpos : int horizontal position (upper-left corner) ypos : int vertical position (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of text Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT text flobject added Examples -------- >>> ptxtobj = fl_add_text(xfdata.FL_NORMAL_TEXT, 140, 120, 400, 500, "My text flobject") Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_add_text = library.cfuncproto( library.load_so_libforms(), "fl_add_text", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_text(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * label)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(texttype, xfdata.TEXTTYPE_list) i_texttype = library.convert_to_intc(texttype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(texttype, xpos, ypos, width, height, label, \ i_texttype, i_xpos, i_ypos, i_width, i_height, s_label) retval = _fl_add_text(i_texttype, i_xpos, i_ypos, i_width, i_height, \ s_label) return retval
def fl_addto_tabfolder(ptr_flobject, tabtitle, ptr_flform): """fl_addto_tabfolder(ptr_flobject, tabtitle, ptr_flform) -> ptr_flobject Populates a tabbed folder, adding a regular form to it. Note: application program should not destroy a form that has been added to a tabbed folder. You can change the attributes of the returned flobject just like any other objects, but not all possibilities result in a pleasing appearance. Although there is no specific requirement of what the backface of the folder/form should be, a boxtype other than xfdata.FL_FLAT_BOX or xfdata.FL_NO_BOX may not look nice. If the backface of the form is of xfdata.FL_FLAT_BOX the associated tab will take on the color of the backface when activated. Each tab must have its own form, i.e. you should not associate the same form with two different tabs; however, you can create copies of a form and use these copies. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT tabfolder flobject tabtitle : str text of the tab rider (with possible embedded newlines in it) ptr_flform : pointer to xfdata.FL_FORM form to be added Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT tabfolder flobject Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_addto_tabfolder = library.cfuncproto( library.load_so_libforms(), "fl_addto_tabfolder", cty.POINTER(xfdata.FL_OBJECT), [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING, cty.POINTER(xfdata.FL_FORM)], """FL_OBJECT * fl_addto_tabfolder(FL_OBJECT * ob, const char * title, FL_FORM * form)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) library.verify_flformptr_type(ptr_flform) s_tabtitle = library.convert_to_bytestrc(tabtitle) library.keep_elem_refs(ptr_flobject, tabtitle, ptr_flform, s_tabtitle) retval = _fl_addto_tabfolder(ptr_flobject, s_tabtitle, ptr_flform) return retval
def fl_object_ps_dump(ptr_flobject, fname): """fl_object_ps_dump(ptr_flobject, fname) -> result Finds out hardcopies of some flobjects in a what-you-see-is-what-you-get (WYSIWYG) way, especially those that are dynamic and of vector-graphics in nature. It outputs the specified flobject in PostScript. The flobject must be visible at the time of the function call. The hardcopy should mostly be WYSIWYG and centered on the printed page. The orientation is determined such that a balanced margin results, i.e., if the width of the flobject is larger than the height, landscape mode will be used. Further, if the flobject is too big to fit on the printed page, a scale factor will be applied so the flobject fits. The box underneath the flobject is by default not drawn and in the default black&white mode, all curves are drawn in black. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT object. Only the xfdata.FL_XYPLOT flobject is supported. fname : str name of output file. If it is empty (""), a fselector will be shown to ask the user for a file name. Returns ------- result : int 0 (on success), or -1 (on errors) Examples -------- >>> if fl_object_ps_dump(pxyplobj, "myhardcopy.ps") < 0: >>> ... <something> Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_object_ps_dump = library.cfuncproto( library.load_so_libflimage(), "fl_object_ps_dump", cty.c_int, [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """int fl_object_ps_dump(FL_OBJECT * ob, const char * fname)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_fname = library.convert_to_bytestrc(fname) library.keep_elem_refs(ptr_flobject, fname, s_fname) retval = _fl_object_ps_dump(ptr_flobject, s_fname) return retval
def fl_create_from_bitmapdata(win, xbmdata, width, height): """fl_create_from_bitmapdata(win, xbmdata, width, height) -> pixmapid Makes a bitmap from bitmap contents data. Parameters ---------- win : long_pos window id xbmdata : str bitmap data used for contents width : int_pos width of bitmap in coord units height : int_pos height of bitmap in coord units Returns ------- pixmapid : long_pos created pixmap resource id Examples -------- >>> xbmdata = "\x10\x18\x1f\x20\x28x\x2f\x30\x38\x3f\x40\x48\x4f\x50" >>> pmap = fl_create_from_bitmapdata(win0, xbmdata, 20, 20) Notes ----- Status: UnitTest + Doc + NoDemo = OK """ _fl_create_from_bitmapdata = library.cfuncproto( library.load_so_libforms(), "fl_create_from_bitmapdata", xfdata.Pixmap, [xfdata.Window, xfdata.STRING, cty.c_int, cty.c_int], """Pixmap fl_create_from_bitmapdata(Window win, const char * data, int width, int height)""") library.check_if_flinitialized() ul_win = library.convert_to_Window(win) s_xbmdata = library.convert_to_bytestrc(xbmdata) i_width = library.convert_to_intc(width) i_height = library.convert_to_intc(height) library.keep_elem_refs(win, xbmdata, width, height, ul_win, \ s_xbmdata, i_width, i_height) retval = _fl_create_from_bitmapdata(ul_win, s_xbmdata, i_width, \ i_height) return retval
def fl_replace_chart_value(ptr_flobject, indx, itemval, label, colr): """fl_replace_chart_value(ptr_flobject, indx, itemval, label, colr) Replaces value of an item in the chart flobject. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT chart flobject indx : int index position of item to be replaced. The first item is number 1 itemval : float value of chart item label : str text label of chart colr : long_pos XForms colormap index as color Examples -------- >>> fl_replace_chart_value(pchrtobj, 3, 142.0, "replaced item", xfdata.FL_FIREBRICK) Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_replace_chart_value = library.cfuncproto( library.load_so_libforms(), "fl_replace_chart_value", None, [cty.POINTER(xfdata.FL_OBJECT), cty.c_int, cty.c_double, xfdata.STRING, xfdata.FL_COLOR], """void fl_replace_chart_value(FL_OBJECT * ob, int indx, double val, const char * str, FL_COLOR col)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) i_indx = library.convert_to_intc(indx) f_itemval = library.convert_to_doublec(itemval) s_label = library.convert_to_bytestrc(label) ul_colr = library.convert_to_FL_COLOR(colr) library.keep_elem_refs(ptr_flobject, indx, itemval, label, colr, \ i_indx, f_itemval, s_label, ul_colr) _fl_replace_chart_value(ptr_flobject, i_indx, f_itemval, s_label, \ ul_colr)
def fl_insert_chart_value(ptr_flobject, indx, itemval, label, colr): """fl_insert_chart_value(ptr_flobject, indx, itemval, label, colr) Inserts a new value at a particular place in a chart flobject. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT chart flobject indx : int index before which the new item should be inserted. The first item is number 1. itemval : float value of new chart item label : str text label of chart colr : long_pos XForms colormap index as color Examples -------- >>> fl_insert_chart_value(pchrtobj, 2, 123.0, "new value", xfdata.FL_DEEPSKYBLUE) Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_insert_chart_value = library.cfuncproto( library.load_so_libforms(), "fl_insert_chart_value", None, [cty.POINTER(xfdata.FL_OBJECT), cty.c_int, cty.c_double, xfdata.STRING, xfdata.FL_COLOR], """void fl_insert_chart_value(FL_OBJECT * ob, int indx, double val, const char * str, FL_COLOR col)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) i_indx = library.convert_to_intc(indx) f_itemval = library.convert_to_doublec(itemval) s_label = library.convert_to_bytestrc(label) ul_colr = library.convert_to_FL_COLOR(colr) library.keep_elem_refs(ptr_flobject, indx, itemval, label, colr, \ i_indx, f_itemval, s_label, ul_colr) _fl_insert_chart_value(ptr_flobject, i_indx, f_itemval, s_label, ul_colr)
def fl_get_nmenu_item_by_text(ptr_flobject, text): """fl_get_nmenu_item_by_text(ptr_flobject, text) -> ptr_flpopupentry Searches for the text the item in nmenu flobject was created by (that might be the same as the label text in simple cases). Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT nmenu flobject text : str text associated with an item. 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 + NoDemo = Maybe """ _fl_get_nmenu_item_by_text = library.cfuncproto( library.load_so_libforms(), "fl_get_nmenu_item_by_text", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """FL_POPUP_ENTRY * fl_get_nmenu_item_by_text(FL_OBJECT * p1, const char * p2)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_text = library.convert_to_bytestrc(text) library.keep_elem_refs(ptr_flobject, text, s_text) retval = _fl_get_nmenu_item_by_text(ptr_flobject, s_text) return retval
def fl_get_select_item_by_label(ptr_flobject, label): """fl_get_select_item_by_label(ptr_flobject, label) -> ptr_flpopupentry Finds out an item of select flobject who has a certain label as displayed for the item in the popup. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT select flobject label : str label of the item. Returns ------- ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY popup entry class instance Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_get_select_item_by_label = library.cfuncproto( library.load_so_libforms(), "fl_get_select_item_by_label", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """FL_POPUP_ENTRY * fl_get_select_item_by_label(FL_OBJECT * p1, const char * p2)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(ptr_flobject, label, s_label) retval = _fl_get_select_item_by_label(ptr_flobject, s_label) return retval
def fl_get_nmenu_item_by_label(ptr_flobject, label): """fl_get_nmenu_item_by_label(ptr_flobject, label) -> ptr_flpopupentry Searches for a certain label as displayed for the item in the nmenu's popup. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT nmenu flobject label : str text associated with an item. 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 + NoDemo = Maybe """ _fl_get_nmenu_item_by_label = library.cfuncproto( library.load_so_libforms(), "fl_get_nmenu_item_by_label", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """FL_POPUP_ENTRY * fl_get_nmenu_item_by_label(FL_OBJECT * p1, const char * p2)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(ptr_flobject, label, s_label) retval = _fl_get_nmenu_item_by_label(ptr_flobject, s_label) return retval
def fl_get_select_item_by_text(ptr_flobject, txtstr): """fl_get_select_item_by_text(ptr_flobject, txtstr) -> ptr_flpopupentry Finds out an item of select flobject who has supplied text (that might be the same as the label text in simple cases). Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT select flobject txtstr : str text of the item. Returns ------- ptr_flpopupentry : pointer to xfdata.FL_POPUP_ENTRY popup entry class instance Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_get_select_item_by_text = library.cfuncproto( library.load_so_libforms(), "fl_get_select_item_by_text", cty.POINTER(xfdata.FL_POPUP_ENTRY), [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """FL_POPUP_ENTRY * fl_get_select_item_by_text(FL_OBJECT * p1, const char * p2)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_txtstr = library.convert_to_bytestrc(txtstr) library.keep_elem_refs(ptr_flobject, txtstr, s_txtstr) retval = _fl_get_select_item_by_text(ptr_flobject, s_txtstr) return retval
def fl_add_chart_value(ptr_flobject, itemval, label, colr): """fl_add_chart_value(ptr_flobject, itemval, label, colr) Adds an item to the chart flobject. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT chart flobject itemval : float value of chart item label : str text label of chart colr : long_pos XForms colormap index as color Examples -------- >>> fl_add_chart_value(pchrtobj, 120, "Some point", xfdata.FL_BLUE) Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_add_chart_value = library.cfuncproto( library.load_so_libforms(), "fl_add_chart_value", None, [cty.POINTER(xfdata.FL_OBJECT), cty.c_double, xfdata.STRING, xfdata.FL_COLOR], """void fl_add_chart_value(FL_OBJECT * ob, double val, const char * str, FL_COLOR col)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) f_itemval = library.convert_to_doublec(itemval) s_label = library.convert_to_bytestrc(label) ul_colr = library.convert_to_FL_COLOR(colr) library.keep_elem_refs(ptr_flobject, itemval, label, colr, f_itemval, \ s_label, ul_colr) _fl_add_chart_value(ptr_flobject, f_itemval, s_label, ul_colr)
def fl_get_tabfolder_folder_byname(ptr_flobject, name): """fl_get_tabfolder_folder_byname(ptr_flobject, name) -> ptr_flform Accesses an individual form on the tabfolder by its name. Parameters ---------- ptr_flobject : pointer to xfdata.FL_OBJECT tabfolder flobject name : str name of folder Returns ------- ptr_flform : pointer to xfdata.FL_FORM form associated with the name, or None (on failure) Examples -------- >>> *todo* Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_get_tabfolder_folder_byname = library.cfuncproto( library.load_so_libforms(), "fl_get_tabfolder_folder_byname", cty.POINTER(xfdata.FL_FORM), [cty.POINTER(xfdata.FL_OBJECT), xfdata.STRING], """FL_FORM * fl_get_tabfolder_folder_byname(FL_OBJECT * ob, const char * name)""") library.check_if_flinitialized() library.verify_flobjectptr_type(ptr_flobject) s_name = library.convert_to_bytestrc(name) library.keep_elem_refs(ptr_flobject, name, s_name) retval = _fl_get_tabfolder_folder_byname(ptr_flobject, s_name) return retval
def fl_fix_dirname(dirname): """fl_fix_dirname(dirname) -> fixdirname Fixes the name of a directory that has a relative path ("..") in it. You can use os.path.normnpath(), instead. Parameters ---------- dirname : str name of the directory to evaluate Returns ------- fixdirname : str fixed directory name Examples -------- >>> newdirnam = fl_fix_dirname("../../home/user/../user/mydir/") Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_fix_dirname = library.cfuncproto( library.load_so_libforms(), "fl_fix_dirname", xfdata.STRING, [xfdata.STRING], """char * fl_fix_dirname(char * dir)""") library.check_if_flinitialized() s_dirname = library.convert_to_bytestrc(dirname) library.keep_elem_refs(dirname, s_dirname) retval = _fl_fix_dirname(s_dirname) if isinstance(retval, bytes): return retval.decode('utf-8') else: # str return retval
def fl_is_valid_dir(dirname): """fl_is_valid_dir(dirname) -> yesno Checks if dirname is a valid name of a directory. You can use python's os.path.isdir(), instead. Parameters ---------- dirname : str name of the directory to evaluate Returns ------- yesno : int 1 (if valid) or 0 (if invalid) Examples -------- >>> isvalid = fl_is_valid_dir("/etc/mydirname") >>> if not isvalid: >>> ... <something> Notes ----- Status: NA-UTest + Doc + NoDemo = Maybe """ _fl_is_valid_dir = library.cfuncproto( library.load_so_libforms(), "fl_is_valid_dir", cty.c_int, [xfdata.STRING], """int fl_is_valid_dir(const char * name)""") library.check_if_flinitialized() s_dirname = library.convert_to_bytestrc(dirname) library.keep_elem_refs(dirname, s_dirname) retval = _fl_is_valid_dir(s_dirname) return retval
def fl_add_spinner(spinnertype, xpos, ypos, width, height, label): """fl_add_spinner(spinnertype, xpos, ypos, width, height, label) -> ptr_flobject Adds a spinner flobject. It is a combination of a (numerical) input field with two (touch) buttons that allow to increment or decrement the value in the (editable) input field. I.e. the user can change the spinners value by either editing the value of the input field or by using the up/down buttons shown beside the input field. Parameters ---------- spinnertype : int type of spinner to be added. Values (from xfdata.py) - FL_INT_SPINNER (spinner with integer values), - FL_FLOAT_SPINNER (spinner with float values) xpos : int horizontal position (upper-left corner) ypos : int vertical position (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of spinner Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT spinner flobject added Examples -------- >>> pspnobj = fl_add_spinner(xfdata.FL_INT_SPINNER, 175, 75, 140, 150, "My spinner") Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_add_spinner = library.cfuncproto( library.load_so_libforms(), "fl_add_spinner", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_spinner(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * label)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(spinnertype, \ xfdata.SPINNERTYPE_list) i_spinnertype = library.convert_to_intc(spinnertype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(spinnertype, xpos, ypos, width, height, label, \ i_spinnertype, i_xpos, i_ypos, i_width, i_height, s_label) retval = _fl_add_spinner(i_spinnertype, i_xpos, i_ypos, i_width, \ i_height, s_label) return retval
def fl_add_positioner(posittype, xpos, ypos, width, height, label): """fl_add_positioner(posittype, xpos, ypos, width, height, label) -> ptr_flobject Adds a positioner flobject. By default the label is placed below the box. Parameters ---------- posittype : int type of positioner to be added. Values (from xfdata.py) - FL_NORMAL_POSITIONER (Cross-hair inside a box), - FL_OVERLAY_POSITIONER (Cross-hair inside a transparent box, i.e. drawn in in XOR mode), - FL_INVISIBLE_POSITIONER (Completely invisible positioner to be used just for the side effect of obtaining a position, typically a flobject is below it that otherwise would receive user events) xpos : int horizontal position (upper-left corner) ypos : int vertical position (upper-left corner) width : int width in coord units height : int height in coord units label : str text label of positioner. Returns ------- ptr_flobject : pointer to xfdata.FL_OBJECT positioner flobject added Examples -------- >>> pstobj = fl_add_positioner(xfdata.FL_NORMAL_POSITIONER, 140, 120, 180, 180, "MyPositioner") Notes ----- Status: NA-UTest + Doc + Demo = OK """ _fl_add_positioner = library.cfuncproto( library.load_so_libforms(), "fl_add_positioner", cty.POINTER(xfdata.FL_OBJECT), [cty.c_int, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.FL_Coord, xfdata.STRING], """FL_OBJECT * fl_add_positioner(int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char * label)""") library.check_if_flinitialized() library.checkfatal_allowed_value_in_list(posittype, \ xfdata.POSITIONERTYPE_list) i_posittype = library.convert_to_intc(posittype) i_xpos = library.convert_to_FL_Coord(xpos) i_ypos = library.convert_to_FL_Coord(ypos) i_width = library.convert_to_FL_Coord(width) i_height = library.convert_to_FL_Coord(height) s_label = library.convert_to_bytestrc(label) library.keep_elem_refs(posittype, xpos, ypos, width, height, label, \ i_posittype, i_xpos, i_ypos, i_width, i_height, s_label) retval = _fl_add_positioner(i_posittype, i_xpos, i_ypos, i_width, \ i_height, s_label) return retval