def create_forms(self):

        self.sample = xfl.fl_bgn_form(xfl.FL_NO_BOX, 320, 250)

        self.ptrflobj0 = xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 320, 250, '')
        xfl.fl_set_object_color(self.ptrflobj0, xfl.FL_COL1, xfl.FL_COL1)
        xfl.fl_set_object_lalign(self.ptrflobj0, xfl.FL_ALIGN_CENTER)
        xfl.fl_set_object_lstyle(self.ptrflobj0, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.ptrflobj0, xfl.FL_DEFAULT_SIZE)
        xfl.fl_set_object_lcol(self.ptrflobj0, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.ptrflobj0, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.ptrflobj0, xfl.FL_NoGravity, xfl.FL_NoGravity)
        self.bitmapname = xfl.fl_add_bitmap(xfl.FL_NORMAL_BITMAP, 40, 30, 250, 100, 'bitmap')
        xfl.fl_set_object_boxtype(self.bitmapname, xfl.FL_NO_BOX)
        bm2_width = 16
        bm2_height = 16
        bm2_bits = [0, 0, 0, 87, 124, 114, 252, 82, 252, 0, 124, 1, 124, 31, 252, 34, 64, 66, 64, 68, 64, 67, 192, 64, 112, 64, 140, 32, 0, 31, 0, 0]
        xfl.fl_set_bitmap_data(self.bitmapname, bm2_width, bm2_height, bm2_bits)
        xfl.fl_set_object_color(self.bitmapname, xfl.FL_COL1, xfl.FL_COL1)
        xfl.fl_set_object_lalign(self.bitmapname, xfl.FL_ALIGN_BOTTOM)
        xfl.fl_set_object_lstyle(self.bitmapname, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.bitmapname, xfl.FL_DEFAULT_SIZE)
        xfl.fl_set_object_lcol(self.bitmapname, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.bitmapname, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.bitmapname, xfl.FL_NoGravity, xfl.FL_NoGravity)
        xfl.fl_set_object_shortcut(self.bitmapname, 'b', 1)
        xfl.fl_set_object_callback(self.bitmapname, self.bitmapcb, 2)

        xfl.fl_end_form()
 def test_fl_set_bitmap_data__fail2(self):
     # failing: 2nd arg missing
     self.statusmsg = "%s: should fail." % sys._getframe().f_code.co_name
     w = 6
     h = 6
     xbmdata = [0xa0, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93,
                0x92, 0x91, 0x90, 0x89, 0x88, 0x87, 0x86, 0x85,
                0x84, 0x83, 0x82, 0x81, 0x80, 0x79, 0x78, 0x77,
                0x76, 0x75, 0x74, 0x73, 0x72, 0x71, 0x70, 0x69,
                0x68, 0x67, 0x66, 0x65]
     xfl.fl_set_bitmap_data(self.bitobj, h, xbmdata)
Exemplo n.º 3
0
def main(lsysargv, sysargv):
    xfl.fl_initialize(lsysargv, sysargv, "FormDemo", 0, 0 )
    pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 200, 200)
    pobj = xfl.fl_add_bitmap(xfl.FL_NORMAL_BITMAP, 50, 50, 100, 100, \
            "A bitmap")
    xfl.fl_set_object_lcol(pobj, xfl.FL_BLUE)
    xfl.fl_add_button(xfl.FL_HIDDEN_BUTTON, 50, 50, 100, 100, "")
    xfl.fl_end_form()
    xfl.fl_set_bitmap_data(pobj, xbmwidth, xbmheight, bitmapcontents)
    xfl.fl_show_form(pform, xfl.FL_PLACE_MOUSE, xfl.FL_NOBORDER, "X Bitmap")
    xfl.fl_do_forms()
    xfl.fl_hide_form(pform)
    xfl.fl_finish()
    return 0
Exemplo n.º 4
0
def init_gui(fd):
    x = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
    y = [5.5, 4.0, 4.5, 3.8, 4.0, 5.0]
    label = ["Mon", "Tue", "Wed", "Thur", "Fri", "Sat"]
    xfl.fl_add_nmenu_items(fd.menu, "One\tF1|Two\tF2|Three\tF3|Four\tF4")
    xfl.fl_add_select_items(fd.choice, "Option1|Option2|Option3")
    crab = xfl.fls_import_xpmdata_from_file("crab45.xpm")
    xfl.fl_set_pixmapbutton_data(fd.pixbutton, crab)
    xfl.fl_set_pixmap_data(fd.pix, crab)
    bm1_width, bm1_height, bm1_bits = xfl.fls_import_xbmdata_from_file( \
            "bm1.xbm")
    xfl.fl_set_bitmapbutton_data(fd.bitbutton, bm1_width, bm1_height, \
            bm1_bits)
    nomail_width, nomail_height, nomail_bits = \
            xfl.fls_import_xbmdata_from_file("nomail.xbm")
    xfl.fl_set_bitmap_data(fd.bit, nomail_width, nomail_height, nomail_bits)
    xfl.fl_set_browser_fontsize(fd.browser, xfl.FL_NORMAL_SIZE)
    xfl.fl_addto_browser(fd.browser, "browser line 1\nbrowser line 2")
    xfl.fl_addto_browser(fd.browser, "browser line 3\nbrowser line 4")
    xfl.fl_addto_browser(fd.browser, "browser line 5\nbrowser line 6")
    xfl.fl_addto_browser(fd.browser, "browser line 7\nbrowser line 8")
    xfl.fl_addto_browser(fd.browser, "browser line 9\nbrowser line 10")
    xfl.fl_addto_browser(fd.browser, "browser line 11\nbrowser line 12")
    xfl.fl_addto_browser(fd.browser, "browser line 13\nbrowser line 14")
    xfl.fl_addto_browser(fd.browser, "browser line 15\nbrowser line 16")
    xfl.fl_addto_browser(fd.browser, "browser line 17\nbrowser line 18")
    for i in range(0, len(y)):
        xfl.fl_add_chart_value(fd.chart, y[i], label[i], i + 1)
    xfl.fl_set_xyplot_data(fd.xyplot, x, y, 6, "", "","")
    xfl.fl_add_xyplot_overlay(fd.xyplot, 1, x, y, 6, xfl.FL_RED)
    xfl.fl_add_xyplot_text(fd.xyplot, 2.5, 5.2, "Weekly Summary", \
            xfl.FL_ALIGN_CENTER, xfl.FL_BLUE)
    xfl.fl_add_xyplot_text(fd.xyplot, 3, 3.85, "@-22->", xfl.FL_ALIGN_TOP, \
            xfl.FL_RED)
    xfl.fl_set_xyplot_overlay_type(fd.xyplot, 1, xfl.FL_NORMAL_XYPLOT)
    xfl.fl_set_xyplot_alphaxtics(fd.xyplot, "Mon|Tue|Wed|Thu|Fri|Sat", "")
    xfl.fl_set_xyplot_ytics(fd.xyplot, -1, -1)
    xfl.fl_set_xyplot_linewidth(fd.xyplot, 0, 3)
Exemplo n.º 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()
 def test_fl_set_bitmap_data__fail3(self):
     # failing: 4th arg of unfit type
     self.statusmsg = "%s: should fail." % sys._getframe().f_code.co_name
     w = 2
     h = 3
     xfl.fl_set_bitmap_data(self.bitobj, w, h, 10)