def filecb(widget, data): native = Fl.Native_File_Chooser() native.set_title("Pick a file") native.set_filter('''Text\t*.txt C Files\t*.{cxx,h,c} Apps\t*.{app}\n''') ret = native.show() if ret == -1: print 'Error ', native.errmsg() elif ret == 1: print 'Cancel' else: print native.filename()
def openFile(self, widget=None, filename=None): if filename is None: native = Fl.Native_File_Chooser() native.title("Select SVG file") native.filter('SVG\t*.svg') ret = native.show() if ret == -1 or ret == 1: return filename = native.filename() xmltree = readFile(filename) self.renderer = Renderer(xmltree, imageprovider=image_cb) if isinstance(filename, basestring): name = os.path.split(filename)[-1] else: name = 'unamed.svg' self.updateScale() self.redraw()