Ejemplo n.º 1
0
 def but3_callback(self, a, b):
     if xfl.fl_get_button(self.pbut3):
         xfl.fl_set_slider_value(self.psl, 1.0)
         xfl.fl_set_button(self.pbut1, 0)
         xfl.fl_set_button(self.pbut2, 0)
     else:
         xfl.fl_set_button(self.pbut3, 1)
    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.pvalslider = xfl.fl_add_valslider(xfl.FL_HOR_SLIDER, 10, 40, 290, 30, 'Horizontal way')
        xfl.fl_set_object_boxtype(self.pvalslider, xfl.FL_UP_BOX)
        xfl.fl_set_slider_bounds(self.pvalslider, 1, 25)
        xfl.fl_set_slider_value(self.pvalslider, 1)
        xfl.fl_set_slider_increment(self.pvalslider, 0.4, 0.5)
        xfl.fl_set_slider_size(self.pvalslider, 0.20)
        xfl.fl_set_slider_step(self.pvalslider, 1)
        xfl.fl_set_slider_precision(self.pvalslider, 3)
        xfl.fl_set_object_color(self.pvalslider, xfl.FL_COL1, xfl.FL_COL1)
        xfl.fl_set_object_lalign(self.pvalslider, xfl.FL_ALIGN_BOTTOM)
        xfl.fl_set_object_lstyle(self.pvalslider, xfl.FL_NORMAL_STYLE)
        xfl.fl_set_object_lsize(self.pvalslider, xfl.FL_TINY_SIZE)
        xfl.fl_set_object_lcol(self.pvalslider, xfl.FL_BLACK)
        xfl.fl_set_object_resize(self.pvalslider, xfl.FL_RESIZE_ALL)
        xfl.fl_set_object_gravity(self.pvalslider, xfl.FL_NoGravity, xfl.FL_NoGravity)
        xfl.fl_set_object_shortcut(self.pvalslider, 'H', 1)
        xfl.fl_set_object_callback(self.pvalslider, self.slidercb, 4)
        xfl.fl_set_object_return(self.pvalslider, xfl.FL_RETURN_CHANGED|xfl.FL_RETURN_END)

        xfl.fl_end_form()
Ejemplo n.º 3
0
    def __init__(self, lsysargv, sysarg):

        xfl.fl_initialize(lsysargv, sysarg, "FormDemo", None, 0)
        self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 300)
        self.psl = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 40, 40, 60, 220, "X")
        xfl.fl_set_slider_value(self.psl, 0.5)
        xfl.fl_set_object_callback(self.psl, self.slider_callback, 0)
        self.pbut1 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 140, 220, \
                120, 40, "0.0")
        xfl.fl_set_object_callback(self.pbut1, self.but1_callback, 0)
        self.pbut2 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 140, 160, \
                120, 40, "0.5")
        xfl.fl_set_button(self.pbut2, 1)
        xfl.fl_set_object_callback(self.pbut2, self.but2_callback, 0)
        self.pbut3 = xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 140, 100, \
                120, 40, "1.0")
        xfl.fl_set_object_callback(self.pbut3, self.but3_callback, 0)
        self.pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 140, 40, \
                120, 40, "Exit")
        xfl.fl_set_object_callback(self.pbut, self.but_callback, 0)
        xfl.fl_end_form()

        xfl.fl_show_form(self.pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, \
                "slRadio")

        while xfl.fl_do_forms():
            pass

        xfl.fl_finish()
Ejemplo n.º 4
0
def draw_initialize(ui):
    global cur_fig
    xfl.fl_set_form_minsize(ui.drawfree, 530, 490)
    xfl.fl_set_object_gravity(ui.colgrp, xfl.FL_West, xfl.FL_West)
    xfl.fl_set_object_gravity(ui.sizegrp, xfl.FL_SouthWest, xfl.FL_SouthWest)
    xfl.fl_set_object_gravity(ui.figgrp, xfl.FL_NorthWest, xfl.FL_NorthWest)
    xfl.fl_set_object_gravity(ui.miscgrp, xfl.FL_South, xfl.FL_South)
    xfl.fl_set_object_resize(ui.miscgrp, xfl.FL_RESIZE_NONE)
    cur_fig = saved_figure[0]
    cur_fig.c[0] = cur_fig.c[1] = cur_fig.c[2] = 127
    cur_fig.w = cur_fig.h = 30
    cur_fig.drawit = xfl.fl_oval
    cur_fig.fill = 1
    cur_fig.col = xfl.FL_FREE_COL1 + 1
    xfl.fl_mapcolor(xfl.FL_FREE_COL1, \
            cur_fig.c[0], cur_fig.c[1], cur_fig.c[2])
    xfl.fl_mapcolor(cur_fig.col, \
            cur_fig.c[0], cur_fig.c[1], cur_fig.c[2])
    xfl.fl_set_slider_bounds(ui.wsli, 1, max_w)
    xfl.fl_set_slider_bounds(ui.hsli, 1, max_h)
    xfl.fl_set_slider_precision(ui.wsli, 0)
    xfl.fl_set_slider_precision(ui.hsli, 0)
    xfl.fl_set_slider_value(ui.wsli, cur_fig.w)
    xfl.fl_set_slider_value(ui.hsli, cur_fig.h)
    # color sliders
    xfl.fl_set_slider_bounds(ui.rsli, 1.0, 0)
    xfl.fl_set_slider_bounds(ui.gsli, 1.0, 0)
    xfl.fl_set_slider_bounds(ui.bsli, 1.0, 0)
    # initial drawing function
    xfl.fl_set_button(ui.drobj[0], 1)
Ejemplo n.º 5
0
 def __init__(self, lsysargv, sysargv):
     xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0)
     pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 240, 400)
     self.pboxvalue = xfl.fl_add_box(xfl.FL_DOWN_BOX, 120, 180, 100, 30, "")
     xfl.fl_set_object_lalign(self.pboxvalue, xfl.FL_ALIGN_CENTER)
     pslider = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 40, 40, 60, 320, "")
     xfl.fl_set_slider_bounds(pslider, -1, 1)
     xfl.fl_set_slider_value(pslider, 0)
     xfl.fl_set_object_color(pslider, xfl.FL_SLIDER_COL1, xfl.FL_GREEN)
     xfl.fl_set_object_callback(pslider, self.slider_cb, 0)
     xfl.fl_add_button(xfl.FL_RETURN_BUTTON, 120, 290, 100, 30, "Exit")
     xfl.fl_end_form()
     xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, "Slider")
     xfl.fl_do_forms()
     xfl.fl_finish()
     sys.exit(0)
def main(lsysarg, sysargv):

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

    pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 300, 300)
    psl = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 40, 40, 60, 220, "X")
    psl.contents.radio = 1
    pbut1 = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 140, 220, \
            120, 40, "0.0")
    pbut2 = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 140, 160, \
            120, 40, "0.5")
    pbut3 = xfl.fl_add_lightbutton(xfl.FL_RADIO_BUTTON, 140, 100, \
            120, 40, "1.0")
    pexitbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 140, 40, \
            120, 40, "Exit")
    xfl.fl_end_form()

    xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, "slRadio")

    while True:
        pobj = xfl.fl_do_forms()
        if xfl.fl_is_same_object(pobj, pbut1):
            xfl.fl_set_slider_value(psl, 0.0)
        elif xfl.fl_is_same_object(pobj, pbut2):
            xfl.fl_set_slider_value(psl, 0.5)
        elif xfl.fl_is_same_object(pobj, pbut3):
            xfl.fl_set_slider_value(psl, 1.0)
        elif xfl.fl_is_same_object(pobj, pexitbut):
            break

    xfl.fl_finish()
    return 0
def main(lsysargv, sysargv):
    xfl.fl_initialize(lsysargv, sysargv, "FormDemo", None, 0)
    pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 150, 300)

    psl1 = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 20, 20, 40, 180, "X")
    psl2 = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 90, 20, 40, 180, "1-X")
    xfl.fl_deactivate_object(psl2)
    pbut = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 40, 250, 70, 30, "Exit")
    xfl.fl_set_object_callback(pbut, exitcb, 0)

    xfl.fl_end_form()

    xfl.fl_show_form(pform, xfl.FL_PLACE_CENTER, xfl.FL_NOBORDER, "Inactive Slider")

    while True:
        pobj = xfl.fl_do_forms()
        xfl.fl_set_slider_value(psl2, 1.0 - xfl.fl_get_slider_value(psl1))

    xfl.fl_hide_form(pform)
    xfl.fl_finish()

    return 0
 def set_entry(self, i):
     #RGBdb *db = rgbdb + i;
     #print("i", i, "rgbdb[i].r", self.rgbdb[i]['r'], "rgbdb[i].g",
     #        self.rgbdb[i]['g'], "rgbdb[i].b",  self.rgbdb[i]['b'])
     xfl.fl_freeze_form(self.pcl)
     xfl.fl_mapcolor(xfl.FL_FREE_COL4 + i, self.rgbdb[i]['r'], \
             self.rgbdb[i]['g'], self.rgbdb[i]['b'])
     xfl.fl_mapcolor(xfl.FL_FREE_COL4, self.rgbdb[i]['r'], \
             self.rgbdb[i]['g'], self.rgbdb[i]['b'])
     xfl.fl_set_slider_value(self.prs, self.rgbdb[i]['r'])
     xfl.fl_set_slider_value(self.pgs, self.rgbdb[i]['g'])
     xfl.fl_set_slider_value(self.pbs, self.rgbdb[i]['b'])
     #xfl.fl_redraw_object(self.prescol)
     xfl.fl_unfreeze_form(self.pcl)
 def create_form_valuatorform(self):
     fdui = FD_valuatorform()
     fdui.valuatorform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 431, 211)
     pobj = xfl.fl_add_box(xfl.FL_FLAT_BOX, 0, 0, 431, 211, "")
     pobj1 = xfl.fl_add_positioner(xfl.FL_NORMAL_POSITIONER, 280, 50, 82, 72, "")
     xfl.fl_set_positioner_xvalue(pobj1, 0.679012)
     xfl.fl_set_positioner_yvalue(pobj1, 0.71831)
     pobj2 = xfl.fl_add_valslider(xfl.FL_HOR_NICE_SLIDER, 55, 10, 240, 20, "")
     xfl.fl_set_object_boxtype(pobj2, xfl.FL_FLAT_BOX)
     xfl.fl_set_object_color(pobj2, xfl.FL_COL1, xfl.FL_RIGHT_BCOL)
     xfl.fl_set_object_return(pobj2, xfl.FL_RETURN_CHANGED)
     xfl.fl_set_slider_value(pobj2, 0.87)
     pobj3 = xfl.fl_add_counter(xfl.FL_NORMAL_COUNTER, 130, 110, 110, 20, "")
     xfl.fl_set_counter_value(pobj3, -1.0)
     pobj4 = xfl.fl_add_slider(xfl.FL_VERT_NICE_SLIDER, 10, 30, 20, 160, "")
     xfl.fl_set_object_boxtype(pobj4, xfl.FL_FLAT_BOX)
     xfl.fl_set_object_color(pobj4, xfl.FL_COL1, xfl.FL_RED)
     xfl.fl_set_object_return(pobj4, xfl.FL_RETURN_CHANGED)
     xfl.fl_set_slider_value(pobj4, 0.49)
     pobj5 = xfl.fl_add_valslider(xfl.FL_HOR_BROWSER_SLIDER, 70, 170, 150, 21, "")
     xfl.fl_set_object_return(pobj5, xfl.FL_RETURN_CHANGED)
     pobj6 = xfl.fl_add_slider(xfl.FL_HOR_FILL_SLIDER, 69, 57, 159, 22, "")
     xfl.fl_set_object_color(pobj6, xfl.FL_COL1, xfl.FL_SLATEBLUE)
     xfl.fl_set_object_return(pobj6, xfl.FL_RETURN_CHANGED)
     xfl.fl_set_slider_value(pobj6, 0.25)
     pobj7 = xfl.fl_add_dial(xfl.FL_NORMAL_DIAL, 60, 90, 60, 58, "")
     xfl.fl_set_object_boxtype(pobj7, xfl.FL_UP_BOX)
     xfl.fl_set_object_return(pobj7, xfl.FL_RETURN_END_CHANGED)
     pobj8 = xfl.fl_add_scrollbar(xfl.FL_VERT_THIN_SCROLLBAR, 394, 14, 18, 180, "")
     xfl.fl_set_object_boxtype(pobj8, xfl.FL_DOWN_BOX)
     xfl.fl_set_object_resize(pobj8, xfl.FL_RESIZE_ALL)
     xfl.fl_set_scrollbar_size(pobj8, 0.20)
     pobj9 = xfl.fl_add_scrollbar(xfl.FL_HOR_SCROLLBAR, 238, 158, 140, 16, "")
     xfl.fl_set_object_resize(pobj9, xfl.FL_RESIZE_ALL)
     xfl.fl_set_scrollbar_size(pobj9, 0.25)
     xfl.fl_end_form()
     return fdui
Ejemplo n.º 10
0
def create_form_objsform():
    fdui = FD_objsform()
    fdui.objsform = xfl.fl_bgn_form(xfl.FL_NO_BOX, 456, 361)
    xfl.fl_add_box(xfl.FL_FLAT_BOX, 0, 0, 456, 361, "")
    xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 455, 360, "")
    xfl.fl_add_box(xfl.FL_UP_BOX, 0, 0, 456, 70, "")
    fdui.button[0] = xfl.fl_add_button(xfl.FL_RADIO_BUTTON, 15, 20, 75, \
            30, "Static")
    xfl.fl_set_object_lsize(fdui.button[0], xfl.FL_NORMAL_SIZE)
    xfl.fl_set_object_lstyle(fdui.button[0], xfl.FL_TIMESBOLD_STYLE)
    xfl.fl_set_object_callback(fdui.button[0], show_group, 0)
    fdui.button[1] = xfl.fl_add_button( xfl.FL_RADIO_BUTTON, 90, 20, 75, \
            30, "Button")
    xfl.fl_set_object_lsize(fdui.button[1], xfl.FL_NORMAL_SIZE)
    xfl.fl_set_object_lstyle(fdui.button[1], xfl.FL_TIMESBOLD_STYLE)
    xfl.fl_set_object_callback(fdui.button[1], show_group, 1)
    fdui.button[2] = xfl.fl_add_button( xfl.FL_RADIO_BUTTON, 165, 20, 70, \
            30, "Valuator")
    xfl.fl_set_object_lsize(fdui.button[2], xfl.FL_NORMAL_SIZE)
    xfl.fl_set_object_lstyle(fdui.button[2], xfl.FL_TIMESBOLD_STYLE)
    xfl.fl_set_object_callback(fdui.button[2], show_group, 2)
    fdui.button[3] = xfl.fl_add_button( xfl.FL_RADIO_BUTTON, 235, 20, 70, \
            30, "Input")
    xfl.fl_set_object_lsize(fdui.button[3], xfl.FL_NORMAL_SIZE)
    xfl.fl_set_object_lstyle(fdui.button[3], xfl.FL_TIMESBOLD_STYLE)
    xfl.fl_set_object_callback(fdui.button[3], show_group, 3)
    fdui.button[4] = xfl.fl_add_button( xfl.FL_RADIO_BUTTON, 305, 20, 70, \
            30, "Other")
    xfl.fl_set_object_lsize(fdui.button[4], xfl.FL_NORMAL_SIZE)
    xfl.fl_set_object_lstyle(fdui.button[4], xfl.FL_TIMESBOLD_STYLE)
    xfl.fl_set_object_callback(fdui.button[4], show_group, 4)
    xfl.fl_add_box(xfl.FL_UP_BOX, 0, 70, 456, 291, "")
    xfl.fl_add_box(xfl.FL_DOWN_BOX, 9, 90, 435, 260, "")
    fdui.group[2] = xfl.fl_bgn_group()
    pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 260, 140, 80, 30, "Text")
    xfl.fl_set_object_lalign(pobj, xfl.fl_to_inside_lalign(xfl.FL_ALIGN_LEFT))
    xfl.fl_add_slider(xfl.FL_HOR_BROWSER_SLIDER, 60, 120, 170, 25, "")
    pobj = xfl.fl_add_slider(xfl.FL_HOR_FILL_SLIDER, 60, 160, 170, 30, "")
    xfl.fl_set_slider_value(pobj, 0.54)
    pobj = xfl.fl_add_slider(xfl.FL_VERT_SLIDER, 390, 110, 30, 170, "")
    xfl.fl_set_slider_value(pobj, 0.48)
    xfl.fl_add_valslider(xfl.FL_VERT_SLIDER, 350, 110, 30, 170, "")
    pobj = xfl.fl_add_dial(xfl.FL_FILL_DIAL, 50, 220, 90, 70, "")
    xfl.fl_set_object_color(pobj, xfl.FL_COL1, xfl.FL_BLUE)
    xfl.fl_add_positioner(xfl.FL_NORMAL_POSITIONER, 150, 210, 120, 100, "")
    xfl.fl_add_counter(xfl.FL_NORMAL_COUNTER, 300, 300, 130, 30, "")
    xfl.fl_end_group()
    fdui.group[1] = xfl.fl_bgn_group()
    fdui.bitbutton = xfl.fl_add_bitmapbutton(xfl.FL_NORMAL_BUTTON, 60, 250, \
            50, 40, "")
    fdui.pixbutton = xfl.fl_add_pixmapbutton(xfl.FL_NORMAL_BUTTON, 85, 120, \
            80, 80, "")
    xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 290, 270, 90, 35, "Button")
    pobj = xfl.fl_add_round3dbutton(xfl.FL_PUSH_BUTTON, 260, 95, 60, 40, \
            "Round3DButton")
    xfl.fl_set_object_color(pobj, xfl.FL_COL1, xfl.FL_MAGENTA)
    xfl.fl_add_roundbutton(xfl.FL_PUSH_BUTTON, 220, 140, 60, 40, \
            "RoundButton")
    pobj = xfl.fl_add_checkbutton(xfl.FL_PUSH_BUTTON, 190, 230, 50, 40, \
            "CheckButton")
    xfl.fl_set_object_color(pobj, xfl.FL_COL1, xfl.FL_BLUE)
    xfl.fl_add_lightbutton(xfl.FL_PUSH_BUTTON, 290, 200, 100, 30, \
            "LightButton")
    pobj = xfl.fl_add_button(xfl.FL_PUSH_BUTTON, 120, 290, 100, 35, \
            "Button")
    xfl.fl_set_object_boxtype(pobj, xfl.FL_ROUNDED3D_UPBOX)
    xfl.fl_end_group()
    fdui.group[0] = xfl.fl_bgn_group()
    pobj = xfl.fl_add_box(xfl.FL_UP_BOX, 40, 120, 70, 70, "A Box")
    xfl.fl_set_object_lsize(pobj, xfl.FL_NORMAL_SIZE)
    xfl.fl_set_object_lstyle(pobj, xfl.FL_TIMESBOLD_STYLE)
    fdui.bit = xfl.fl_add_bitmap(xfl.FL_NORMAL_BITMAP, 30, 220, 80, 70, \
            "bitmap")
    xfl.fl_add_clock(xfl.FL_ANALOG_CLOCK, 330, 240, 90, 80, "")
    pobj = xfl.fl_add_frame(xfl.FL_ENGRAVED_FRAME, 130, 120, 80, 70, \
            "A Frame")
    xfl.fl_set_object_lsize(pobj, xfl.FL_NORMAL_SIZE)
    xfl.fl_set_object_lstyle(pobj, xfl.FL_TIMESBOLD_STYLE)
    fdui.pix = xfl.fl_add_pixmap(xfl.FL_NORMAL_PIXMAP, 340, 110, 90, 70, \
            "pixmap")
    fdui.chart = xfl.fl_add_chart(xfl.FL_PIE_CHART, 160, 210, 130, 110, \
            "chart")
    pobj = xfl.fl_add_text(xfl.FL_NORMAL_TEXT, 240, 130, 100, 30, \
            "Text stuff\nand more stuff")
    xfl.fl_set_object_lalign(pobj, \
            xfl.fl_to_inside_lalign(xfl.FL_ALIGN_CENTER))
    xfl.fl_end_group()
    fdui.group[3] = xfl.fl_bgn_group()
    xfl.fl_add_input(xfl.FL_NORMAL_INPUT, 140, 120, 150, 30, "Input")
    xfl.fl_add_input(xfl.FL_MULTILINE_INPUT, 60, 170, 320, 130, "")
    xfl.fl_end_group()
    fdui.quit = xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 385, 20, 60, 30, \
            "Quit")
    fdui.group[4] = xfl.fl_bgn_group()
    fdui.menu = xfl.fl_add_nmenu(xfl.FL_NORMAL_NMENU, 190, 110, 40, 19, \
            "Menu")
    xfl.fl_set_object_boxtype(fdui.menu, xfl.FL_FLAT_BOX)
    fdui.choice = xfl.fl_add_select(xfl.FL_NORMAL_SELECT, 290, 110, 120, \
            30, "")
    fdui.browser = xfl.fl_add_browser(xfl.FL_NORMAL_BROWSER, 30, 140, \
            140, 150, "")
    fdui.xyplot = xfl.fl_add_xyplot( xfl.FL_IMPULSE_XYPLOT, 190, 150, \
            240, 180, "")
    xfl.fl_set_object_lsize(fdui.xyplot, xfl.FL_DEFAULT_SIZE)
    xfl.fl_end_group()
    xfl.fl_end_form()
    return fdui