def load_file(self, pobj, arg):
     myfilename = xfl.fl_show_input("Filename to load", "")
     if not myfilename or not os.path.exists(myfilename):
         xfl.fl_load_browser(self.pbr, "")
         xfl.fl_add_browser_line(self.pbr, "NO SUCH FILE!")
     else:
         xfl.fl_load_browser(self.pbr, myfilename)
 def __init__(self, lsysargv, sysargv):
     xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0)
     pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 130, 100)
     self.pbr = xfl.fl_add_browser(xfl.FL_NORMAL_BROWSER, 5, 5, 95, 90, \
             "")
     pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 105, 5, 20, 8, \
             "Exit")
     pobj = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 105, 75, 20, 8, \
             "Load")
     xfl.fl_set_object_callback(pobj, self.load_file, 0)
     pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 60, 20, 8, \
             "Small")
     xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_SMALL_SIZE)
     xfl.fl_call_object_callback(pobj)
     xfl.fl_set_button(pobj, 1)
     pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 50, 20, 8, \
             "Normal")
     xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_NORMAL_SIZE)
     pobj = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 105, 40, 20, 8, \
             "Large")
     xfl.fl_set_object_callback(pobj, self.set_size, xfl.FL_LARGE_SIZE)
     xfl.fl_end_form()
     xfl.fl_scale_form(pform, 4.0, 4.0)
     xfl.fl_adjust_form_size(pform)
     xfl.fl_clear_browser(self.pbr)
     xfl.fl_add_browser_line(self.pbr, "LOAD A FILE.")
     xfl.fl_show_form(pform, xfl.FL_PLACE_FREE, xfl.FL_FULLBORDER, \
             "Browser")
     while True:
         pobj = xfl.fl_do_forms()
         if xfl.fl_is_same_object(pobj, pbut):
             break
     xfl.fl_hide_form(pform)
     xfl.fl_finish()
예제 #3
0
 def __init__(self, lsysarg, sysargv):
     xfl.fl_initialize(lsysarg, sysargv, "FormDemo", None, 0)
     fdnew = self.create_form()
     xfl.fl_clear_browser(self.pbr)
     xfl.fl_add_browser_line(self.pbr, "LOAD A FILE.")
     xfl.fl_set_browser_fontstyle(self.pbr, xfl.FL_FIXED_STYLE)
     xfl.fl_show_form(fdnew, xfl.FL_PLACE_FREE, xfl.FL_FULLBORDER, \
             "Browser")
     poret = xfl.fl_do_forms()
     if poret.contents.label:
         prndata = poret.contents.label
     else:
         prndata = ""
     message = "%p %d %s\n" % (poret.contents, poret.contents.objclass, prndata)
     print(message)
     xfl.fl_hide_form(fdnew)
     xfl.fl_free_form(fdnew)
     xfl.fl_finish()
예제 #4
0
 def test_fl_add_browser_line(self):
     """fl_add_browser_line(ptr_flobject, newtext)"""
     xfl.fl_add_browser_line(Hello, 15899, None, Label, E.U., 149, )
예제 #5
0
    def __init__(self, lsysargv, sysargv):
        self.pform = self.pexitob = self.pbtypeob = self.pmodeob = None

        c = xfl.FL_BLACK
        # 	char **p;
        # 	VN_struct *vn;
        # 	VN_struct *g = gmode,
        # 		      *gs = g + sizeof gmode / sizeof *gmode;

        xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0)

        self.create_form()

        sorceress_width, sorceress_height, sorceress_bits = xfl.fls_import_xbmdata_from_file("srs.xbm")
        xfl.fl_set_bitmap_data(tobj[2], sorceress_width, sorceress_height, sorceress_bits)

        xfl.fl_add_chart_value(tobj[3], 15, "Item 1", c)
        c += 1
        xfl.fl_add_chart_value(tobj[3], 5, "Item 2", c)
        c += 1
        xfl.fl_add_chart_value(tobj[3], -10, "Item 3", c)
        c += 1
        xfl.fl_add_chart_value(tobj[3], 25, "Item 4", c)
        c += 1

        xfl.fl_add_nmenu_items(tobj[14], "Item 1|Item 2|Item 3|Item 4|item 5")

        xfl.fl_add_select_items(tobj[15], "Item 1")
        xfl.fl_add_select_items(tobj[15], "Item 2")
        xfl.fl_add_select_items(tobj[15], "Item 3")
        xfl.fl_add_select_items(tobj[15], "Item 4")
        xfl.fl_add_select_items(tobj[15], "Item 5")

        xfl.fl_set_timer(tobj[16], 1000.0)

        # for ( p = browserlines; *p; p++ )
        for p in browserlines:
            xfl.fl_add_browser_line(tobj[17], p)

        # 	for ( vn = btypes; vn->val >= 0; vn++ )
        for vn in btypes:
            xfl.fl_add_select_items(self.pbtypeob, vn["name"])

        # 	for ( i = 1; g < gs; g++, i++ )
        for g in range(0, len(gmode)):
            pitem = xfl.fl_add_select_items(self.pmodeob, gmode[g]["name"])

            if not xfl.fl_mode_capable(gmode[g]["val"], 0):
                xfl.fl_popup_entry_set_state(pitem, xfl.FL_POPUP_DISABLED)

        # xfl.fl_vmode not working??
        xfl.fl_set_select_item(
            self.pmodeob, xfl.fl_get_select_item_by_value(self.pmodeob, xfl.fl_get_vclass())
        )  # 5 xfl.fl_get_vclass()))  #xfl.fl_vmode.value))

        xfl.fl_set_select_item(self.pbtypeob, xfl.fl_get_select_item_by_value(self.pbtypeob, 1))
        self.boxtype_cb(self.pbtypeob, 0)

        xfl.fl_show_form(self.pform, xfl.FL_PLACE_MOUSE, border, "Box types")

        while True:
            if xfl.fl_is_same_object(xfl.fl_do_forms(), self.pexitob):
                break

        xfl.fl_finish()
예제 #6
0
 def load_file(self, pobj, arg):
     fname = xfl.fl_show_file_selector("File To Load", "", "*", "")
     if fname:
         if not xfl.fl_load_browser(self.pbr, fname):
             xfl.fl_add_browser_line(self.pbr,"NO SUCH FILE!")
예제 #7
0
 def addit(self, txtstr):
     print("31")
     print("txtstr", txtstr)
     xfl.fl_add_browser_line(self.ui.pfontobj, txtstr)
     print("32")