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.ppixmap = xfl.fl_add_pixmap(xfl.FL_NORMAL_PIXMAP, 40, 40, 240, 90, 'one\ndemo\npixmap') xfl.fl_set_object_boxtype(self.ppixmap, xfl.FL_FRAME_BOX) xfl.fl_set_pixmap_align(self.ppixmap, xfl.FL_ALIGN_RIGHT|xfl.FL_ALIGN_INSIDE, 3, 3) xfl.fl_set_pixmap_file(self.ppixmap, 'crab45.xpm') xfl.fl_set_object_color(self.ppixmap, xfl.FL_COL1, xfl.FL_COL1) xfl.fl_set_object_lalign(self.ppixmap, xfl.FL_ALIGN_BOTTOM) xfl.fl_set_object_lstyle(self.ppixmap, xfl.FL_NORMAL_STYLE) xfl.fl_set_object_lsize(self.ppixmap, xfl.FL_DEFAULT_SIZE) xfl.fl_set_object_lcol(self.ppixmap, xfl.FL_BLACK) xfl.fl_set_object_resize(self.ppixmap, xfl.FL_RESIZE_ALL) xfl.fl_set_object_gravity(self.ppixmap, xfl.FL_NoGravity, xfl.FL_NoGravity) xfl.fl_set_object_shortcut(self.ppixmap, 'm', 1) xfl.fl_set_object_callback(self.ppixmap, self.pmapcb, 0) xfl.fl_end_form()
def align_cb(self, pobj, n): if xfl.fl_get_button(self.fd_form0.inside): n |= xfl.FL_ALIGN_INSIDE if not TEST_PIXMAP_ALIGN: xfl.fl_set_object_lalign(self.fd_form0.box, n) else: xfl.fl_set_pixmap_align(self.fd_form0.box, n, 3, 3)
def align_cb(self, pobj, n): if xfl.fl_get_button(self.fd_form0.inside): n = xfl.fl_to_inside_lalign(n) if n == xfl.FL_ALIGN_CENTER: xfl.fl_set_button(self.fd_form0.inside, 1) if not TEST_PIXMAP_ALIGN: xfl.fl_set_object_lalign(self.fd_form0.box, n) else: xfl.fl_set_pixmap_align(self.fd_form0.box, n, 3, 3)
def inside_cb(self, pobj, data): if xfl.fl_get_button(pobj): newalign = xfl.fl_get_object_lalign(self.fd_form0.box) newalign |= xfl.FL_ALIGN_INSIDE xfl.fl_set_object_lalign(self.fd_form0.box, newalign) else: newalign = xfl.fl_get_object_lalign(self.fd_form0.box) newalign &= ~xfl.FL_ALIGN_INSIDE xfl.fl_set_object_lalign(self.fd_form0.box, newalign) if TEST_PIXMAP_ALIGN: xfl.fl_set_pixmap_align(self.fd_form0.box, xfl.fl_get_object_lalign(self.fd_form0.box), 3, 3) else: xfl.fl_redraw_form(self.fd_form0.form0)
def inside_cb(self, pobj, data): align = xfl.fl_get_object_lalign(self.fd_form0.box) if xfl.fl_get_button(pobj): xfl.fl_set_object_lalign(self.fd_form0.box, \ xfl.fl_to_inside_lalign(align)) else: xfl.fl_set_object_lalign(self.fd_form0.box, \ xfl.fl_to_outside_lalign(align)) if TEST_PIXMAP_ALIGN: xfl.fl_set_pixmap_align(self.fd_form0.box, \ xfl.fl_get_object_lalign(self.fd_form0.box), 3, 3) else: xfl.fl_redraw_form(self.fd_form0.form0)
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.ppixmap = xfl.fl_add_pixmap(xfl.FL_NORMAL_PIXMAP, 40, 40, 240, 90, "one\ndemo\npixmap") xfl.fl_set_object_boxtype(self.ppixmap, xfl.FL_FRAME_BOX) xfl.fl_set_pixmap_align(self.ppixmap, xfl.FL_ALIGN_RIGHT | xfl.FL_ALIGN_INSIDE, 3, 3) crab = [ "28 28 6 2 ", ". c None m white s s_SkyBlue ", "x c orange m black s s_orange ", "* c #ff72c2 m black s s_#ff72c2 ", "+ c SteelBlue m white s s_SteelBlue ", "G c black m black s s_black ", "a c LightGrey m white s s_LightGrey ", ". . . . . . * * * * . . . . . . . . . * * * * . . . . . ", ". . . . + * x x * . . . . . . . . . . + * x x * . . . . ", ". . . + * x x * . . . . . . . . . . . . + * x x * . . . ", ". . + * x * . . . * . . . . . . . . . * . . + * x * . . ", ". . + * x * . . + * . . . . . . . . + * . . + * x * . . ", ". . + * x * . + * * . . . . . . . . + * * . + * x * . . ", ". . + * x * + * * . . . . . . . . . . + * * + * x * . . ", ". . + * x * * * . . . . . . . . . . . . + * * x x * . . ", ". . . + * x * . . + * . . . . . . + * . . + * x * . . . ", ". . . + * x . . + * . + * * . * * . + * . . + x * . . . ", ". . . . + x . . + * . + * * . * * . + * . . + x . . . . ", ". . . . + x . . . + * + * * * * * + * . . . + x . . . . ", ". . . . + * x . . + * * * * * * * * * . . + x * . . . . ", ". . . . . + * x * * * * x x x x x * * * * x * . . . . . ", ". . . . + + + * * x x x x x x x x x x x x * . . . . . . ", ". . + + * x x x x x x x x x x x x x x x x x x * x . . . ", ". + * x x a + * * x x x x x x x x x x x * * a G * x * . ", "+ * x . . . + * * x x x x x x x x x x x * * G . . . x * ", ". . . . . . + * * x x x x x x x x x x x * * . . . . . . ", ". . . . . + * * x x x x x x x x x x x x x * * . . . . . ", ". . . + * x x x * x x x x x x x x x x x * x x x * . . . ", ". . + * x a a + * * x x x x x x x x x * * a a a x * . . ", ". + * x G G G + * * x x x x x x x x x * * a G G G x * . ", ". + * G . . . + * x * x x x x x x x * x * a G . . . * . ", ". . . . . . + * x a * * * x x x * * * a x * G . . . . . ", ". . . . . + * x a G a a * * * * * a a G a x * G . . . . ", ". . . . . + x a G . G G a a a a a G G . G G x a G . . . ", ". . . . . + x a G . . . G G G G G . . . . . x a G . . . ", ] xfl.fl_set_pixmap_data(self.ppixmap, crab) xfl.fl_set_object_color(self.ppixmap, xfl.FL_COL1, xfl.FL_COL1) xfl.fl_set_object_lalign(self.ppixmap, xfl.FL_ALIGN_BOTTOM) xfl.fl_set_object_lstyle(self.ppixmap, xfl.FL_NORMAL_STYLE) xfl.fl_set_object_lsize(self.ppixmap, xfl.FL_DEFAULT_SIZE) xfl.fl_set_object_lcol(self.ppixmap, xfl.FL_BLACK) xfl.fl_set_object_resize(self.ppixmap, xfl.FL_RESIZE_ALL) xfl.fl_set_object_gravity(self.ppixmap, xfl.FL_NoGravity, xfl.FL_NoGravity) xfl.fl_set_object_shortcut(self.ppixmap, "m", 1) xfl.fl_set_object_callback(self.ppixmap, self.pmapcb, 0) xfl.fl_end_form()
def test_fl_set_pixmap_align__fail3(self): # failing: 4th arg missing self.statusmsg = "%s: should fail." % sys._getframe().f_code.co_name xfl.fl_set_pixmap_align(self.pxmobj0, xfl.FL_ALIGN_TOP, 2)
def test_fl_set_pixmap_align__fail2(self): # failing: 1st and 2nd args of unfit type self.statusmsg = "%s: should fail." % sys._getframe().f_code.co_name xfl.fl_set_pixmap_align(102, self.pxmobj0, 2, 2)
def test_fl_set_pixmap_align__fail1(self): # failing: 2nd arg of unfit type self.statusmsg = "%s: should fail." % sys._getframe().f_code.co_name xfl.fl_set_pixmap_align(self.pxmobj0, 199, 2, 2)
def test_fl_set_pixmap_align__ok(self): # test should NOT fail self.statusmsg = "%s: should NOT fail." % \ sys._getframe().f_code.co_name xfl.fl_set_pixmap_align(self.pxmobj0, xfl.FL_ALIGN_BOTTOM, 2, 2)