def load_file(self, fname, pvdata):
     #ldata = xfl.fls_convert_ptrvoid_to_ptrlongc(pvdata).contents.value
     #print("ldata", ldata)
     if not fname or not os.path.exists(fname):
         print("Missing file name\n")
         return 0
     fnameonly = os.path.basename(fname)
     if os.path.isdir(fname):
         xfl.fl_set_directory(fname)
     else:   # a file
         p, ext = os.path.splitext(fnameonly)
         if not ext:
             print("Missing file extension\n")
             return 0
         else:
             if fname.endswith(b".xpm"):
                 xfl.fl_hide_object(self.fd_ttt.bm)
                 xfl.fl_free_pixmap_pixmap(self.fd_ttt.pm)
                 xfl.fl_set_pixmap_file(self.fd_ttt.pm, fname)
                 xfl.fl_show_object(self.fd_ttt.pm)
             elif fname.endswith(b".xbm"):
                 xfl.fl_hide_object(self.fd_ttt.pm)
                 xfl.fl_set_bitmap_file(self.fd_ttt.bm, fname)
                 xfl.fl_show_object(self.fd_ttt.bm)
             else:
                 message = "Invalid file extension, neither" \
                         ".xpm nor .xbm file: %s\n" % ext
                 print(message)
                 return 0
     return 1
 def hide_it(self, pobj, alln):
     if xfl.fl_object_is_visible(self.fd_canvasform.canvas):
         xfl.fl_hide_object(self.fd_canvasform.canvas)
         xfl.fl_set_object_label(pobj, "ShowCanvas")
     else:
         xfl.fl_show_object(self.fd_canvasform.canvas)
         xfl.fl_set_object_label(pobj, "HideCanvas")
 def hide_cb(self, pobj, data):
     if xfl.fl_object_is_visible(self.fd_scb.hor_thin):
         xfl.fl_set_object_label(self.fd_scb.hide, "Show")
         xfl.fl_hide_object(self.fd_scb.hor_thin)
     else:
         xfl.fl_set_object_label(self.fd_scb.hide, "Hide")
         xfl.fl_show_object(self.fd_scb.hor_thin)
 def makeform(self):
     self.pform = xfl.fl_bgn_form(xfl.FL_UP_BOX, 400, 400)
     for i in range(0, 8):
         pobj = xfl.fl_add_button(xfl.FL_PUSH_BUTTON, 40, 310 - 40 * i, \
                 80, 30, "")
         xfl.fl_set_object_color(pobj, xfl.FL_BLACK + i + 1, \
                 xfl.FL_BLACK + i + 1)
         xfl.fl_set_object_callback(pobj, self.push_cb, i)
         self.pabox[i] = xfl.fl_add_box(xfl.FL_DOWN_BOX, 150 + 30 * i, \
                 40, 25, 320, "")
         xfl.fl_set_object_color(self.pabox[i], xfl.FL_BLACK + i + 1, \
                 xfl.FL_BLACK + i + 1)
         xfl.fl_hide_object(self.pabox[i])
     xfl.fl_add_button(xfl.FL_NORMAL_BUTTON, 40, 350, 80, 30, "Exit")
     xfl.fl_end_form()
 def hide_show_cb(self, pobj, data):
     if data:
         xfl.fl_show_object(self.fd_mainform.folder)
     else:
         xfl.fl_hide_object(self.fd_mainform.folder)
def show_group(pobj, data):
    for i in range(0, NGROUP+1):
        if i == data:
            xfl.fl_show_object(fd_objsform.group[i])
        else:
            xfl.fl_hide_object(fd_objsform.group[i])
 def push_cb(self, pobj, n):
     if xfl.fl_get_button(pobj):
         xfl.fl_show_object(self.pabox[n])
     else:
         xfl.fl_hide_object(self.pabox[n])
 def hide_show(self, pobj, data):
     if xfl.fl_object_is_visible(self.pbr):
         xfl.fl_hide_object(self.pbr)
     else:
         xfl.fl_show_object(self.pbr)