def run_gui(self): userConfig = fractconfig.userConfig() window = main_window.MainWindow(userConfig) window.f.set_size(self.w, self.h) window.f.thaw() times = [] self.last_time = now() def status_changed(f, status): if status == 0: # done new_time = now() times.append(new_time - self.last_time) self.last_time = new_time self.pos += 1 if self.pos < len(files): window.load(files[self.pos]) else: Gtk.main_quit() window.f.connect('status-changed', status_changed) window.load(files[0]) Gtk.main() return times
def main(args): fc = Compiler(fractconfig.userConfig()) fc.leave_dirty = True for arg in args: ff = fc.load_formula_file(arg) for name in ff.get_formula_names(): print(name) form = fc.get_formula(arg, name) fc.compile(form)
def main(args): opts = Arguments() try: opts.parse_args(args) except SystemExit as err: print("Error parsing arguments: %s" % ', '.join(args)) return 1 userConfig = fractconfig.userConfig() t = fractmain.T(userConfig)
def run_nogui(self): userConfig = fractconfig.userConfig() main = fractmain.T(userConfig) times = [] last_time = now() for file in files: main.load(file) opts = Arguments().parse_args(sys.argv[1:]) main.run(opts) new_time = now() times.append(new_time - last_time) return times
def main(outfile): out = open(outfile, "w") printer = CommandPrinter(out) userConfig = fractconfig.userConfig() mw = main_window.MainWindow(userConfig) menu_items = mw.get_all_actions() for item in menu_items: if len(item) < 4: continue key = item[3] if not key: continue func = item[5] printer.add_command(key, func.__doc__) # hard-code ones which are too hard to extract from main code printer.add_command("(arrow)", "Pan image in indicated direction.") printer.add_command("<control>(arrow)", "Pan more quickly in indicated direction.") printer.add_command("<shift>(arrow)", "Mutate image in Z or W directions.") printer.add_command("<shift><control>(arrow)", "Mutate more quickly.") printer.add_command("Escape", "Quit full-screen mode.") printer.add_mouse("Left-click", "Zoom in") printer.add_mouse("Left-click and drag", "Draw rectangle to zoom into.") printer.add_mouse("Shift-Left-click", "Recenter image on point clicked.") printer.add_mouse("Middle-click", "Flip to Julia set (or back to Mandelbrot).") printer.add_mouse("Right-click", "Zoom out.") printer.add_mouse("Control-Right-click", "Zoom out more quickly.") printer.output_all() out.close()
def onResponse(self, widget, id): if id == Gtk.ResponseType.CLOSE or \ id == Gtk.ResponseType.NONE or \ id == Gtk.ResponseType.DELETE_EVENT: self.hide() elif id == DirectorDialog.RESPONSE_RENDER: self.animation.set_avi_file(self.txt_temp_avi.get_text()) try: self.generate(self.converterpath is not None) except (SanityCheckError, UserCancelledError): # prevent dialog closing if being run GObject.signal_stop_emission_by_name(self, "response") else: self.hide() def main(self): Gtk.main() if __name__ == "__main__": GObject.threads_init() Gtk.threads_init() main_window = Gtk.Window() userConfig = fractconfig.userConfig() compiler = fc.Compiler(userConfig) f = fractal.T(compiler) fracwin = DirectorDialog(main_window, f, userConfig) fracwin.main()
col = [ int(x_y[0] * nratio + x_y[1] * ratio) for x_y in pairs ] colors.append(col) colors.append(rgb) i += 3 runlength = 0 return colors if __name__ == "__main__": import sys from fract4d import fractal from fract4d_compiler import fc g_comp = fc.Compiler(fractconfig.userConfig()) g_comp.add_func_path("../formulas") g_comp.add_func_path("../testdata/formulas") g_comp.load_formula_file("gf4d.frm") g_comp.load_formula_file("test.frm") g_comp.load_formula_file("gf4d.cfrm") f = fractal.T(g_comp) file = open(sys.argv[1]) parse(file, f) f.save(open("parfile.fct", "w"))
for k in range(0,runlength): ratio = (k+1.0) / runlength nratio = 1.0 - ratio col = [int(x_y[0] * nratio + x_y[1] * ratio) for x_y in pairs] colors.append(col) colors.append(rgb) i += 3 runlength = 0 return colors if __name__ == "__main__": import sys import fc import fractal g_comp = fc.Compiler(fractconfig.userConfig()) g_comp.add_func_path("../formulas") g_comp.load_formula_file("gf4d.frm") g_comp.load_formula_file("test.frm") g_comp.load_formula_file("gf4d.cfrm") f = fractal.T(g_comp) file = open(sys.argv[1]) parse(file,f) f.save(open("parfile.fct","w"))