def __init__(self): app.soar = self self.top = app.top app.top.wm_title('soar' + soar.version.format_version()) app.top.protocol('WM_DELETE_WINDOW', self.exit) self.initializeNamespace() self.userfn = UserFunctionIF() io.configure_io(self.namespace) self.soar_toolbar_commands = formulae.FormulaPool() self.flowtriplets = [(self.startstepper, self.step, self.stopstepper)] soar_dir = soar.__path__[0] self.readConfigFile() if self.main_geom: app.top.geometry(self.main_geom[self.main_geom.find('+'):]) media_dir = soar_dir + '/media' self.toolbar = widgets.ToolbarFrame(app.top, self.soar_toolbar_commands) self.toolbar.pack(side=TOP) start_images = {'normal': media_dir + "/start.gif"} step_images = {'normal': media_dir + "/step.gif"} stop_images = {'normal': media_dir + "/stop.gif"} simulator_images = {'normal': media_dir + "/simulator.gif"} robot_images = {'normal': media_dir + "/robot.gif"} brain_images = {'normal': media_dir + "/brain.gif"} joystick_images = {'normal': media_dir + "/joystick.gif"} oscillo_images = {'normal': media_dir + "/oscillo.gif"} wireless_images = {'normal': media_dir + "/wireless.gif"} # if we're on the mac, the buttons won't stay pushed, so # we have a different image to indicate active buttons self.use_active_button_images = (platform.system() == 'Darwin') if (self.use_active_button_images): start_images['active'] = media_dir + "/start_active.gif" stop_images['active'] = media_dir + "/stop_active.gif" simulator_images['active'] = media_dir + "/simulator_active.gif" robot_images['active'] = media_dir + "/robot_active.gif" brain_images['active'] = media_dir + "/brain_active.gif" joystick_images['active'] = media_dir + "/joystick_active.gif" oscillo_images['active'] = media_dir + "/oscillo_active.gif" wireless_images['active'] = media_dir + "/wireless_active.gif" self.soar_toolbar_commands.addFormula( ('start', self.startall, 'Start', start_images, lambda: [])) self.soar_toolbar_commands.addFormula( ('step', self.stepall, 'Step', step_images, lambda: [])) self.soar_toolbar_commands.addFormula( ('stop', self.stopall, 'Stop', stop_images, lambda: [])) self.pushToolbarButton('stop') self.disableToolbarButton('start') self.disableToolbarButton('step') Label(self.toolbar, text="Outputs:").pack(side=LEFT) #self.simulator_dir_default = soar_dir + "/6.01/worlds" self.soar_toolbar_commands.addFormula( ('simulator', self.openSimulator, 'Simulator', simulator_images, self.openSimulatorDialog)) self.soar_toolbar_commands.addFormula( ('pioneer', self.openPioneer, 'Pioneer', robot_images, lambda: [])) #self.soar_toolbar_commands.addFormula(('wireless', self.openWireless, # 'Wireless', wireless_images, # lambda: [])) Label(self.toolbar, text="Controls:").pack(side=LEFT) #self.brain_dir_default = '~' self.soar_toolbar_commands.addFormula( ('brain', self.openBrain, 'Brain', brain_images, self.openBrainDialog)) self.disableToolbarButton('brain') self.soar_toolbar_commands.addFormula( ('joystick', self.openJoystick, 'Joystick', joystick_images, lambda: [])) self.disableToolbarButton('joystick') # self.soar_toolbar_commands.addFormula(('oscillo', self.openOscillo, # ' Oscilloscope ', oscillo_images, # lambda: [])) self.minibuffer = widgets.MiniBuffer(app.mainframe, self.namespace, width=78) self.minibuffer.pack(side=TOP, fill=X, expand=1) self.stderrbuffer = None # self.stderrframe = app.tabframe.addFrameWithHideCB("errors", # self.clearErrors) # self.stderrframe = app.tabframe.addFrame("errors") self.stderrbuffer = widgets.OutputBufferFrame( app.mainframe) #self.stderrframe) self.stderrbuffer.box_.config(foreground='red') self.stderrbuffer.pack(fill=BOTH, expand=1) sys.stderr = parallel.PipeSyndicator([sys.stderr, self.stderrbuffer]) self.clearErrors() self.stdoutbuffer = None # self.stdoutframe = app.tabframe.addFrameWithHideCB("standard output", # self.clearOutput) # self.stdoutframe = app.tabframe.addFrame("standard output") self.stdoutbuffer = widgets.OutputBufferFrame( app.mainframe) #self.stdoutframe) self.stdoutbuffer.pack(fill=BOTH, expand=1) sys.stdout = parallel.PipeSyndicator([sys.stdout, self.stdoutbuffer]) self.clearOutput() self.reloadAllButton = Button(app.mainframe, text="Reload Brain and World", command=self.reloadAll) self.reloadAllButton.pack() self.disableButton(self.reloadAllButton) self.reloadBrainButton = Button(app.mainframe, text="Reload Brain", command=self.reloadBrain) self.reloadBrainButton.pack() self.brainfile = "" self.disableButton(self.reloadBrainButton) #self.reloadWorldButton = Button(app.mainframe, text="Reload World", # command = self.reloadWorld) #self.reloadWorldButton.pack() #self.disableButton(self.reloadWorldButton) self.sonarMonitor = None self.oscope = None self.control = None self.output = None self.readfile = False self.writefile = False
def __init__(self): app.soar = self self.top = app.top app.top.wm_title('soar'+soar.version.format_version()) app.top.protocol('WM_DELETE_WINDOW', self.exit) self.initializeNamespace() self.userfn = UserFunctionIF() io.configure_io(self.namespace) self.soar_toolbar_commands = formulae.FormulaPool() self.flowtriplets = [(self.startstepper, self.step, self.stopstepper)] soar_dir = soar.__path__[0] self.readConfigFile() if self.main_geom: app.top.geometry(self.main_geom[self.main_geom.find('+'):]) media_dir = soar_dir + '/media' self.toolbar = widgets.ToolbarFrame(app.top, self.soar_toolbar_commands) self.toolbar.pack(side = TOP) start_images = {'normal' : media_dir + "/start.gif"} step_images = {'normal' : media_dir + "/step.gif"} stop_images = {'normal' : media_dir + "/stop.gif"} simulator_images = {'normal' : media_dir + "/simulator.gif"} eBot_images = {'normal' : media_dir + "/eBot.gif"} robot_images = {'normal' : media_dir + "/robot.gif"} brain_images = {'normal' : media_dir + "/brain.gif"} joystick_images = {'normal' : media_dir + "/joystick.gif"} oscillo_images = {'normal' : media_dir + "/oscillo.gif"} Amigo_simulator_images = {'normal' : media_dir + "/simulator.gif"} # if we're on the mac, the buttons won't stay pushed, so # we have a different image to indicate active buttons self.use_active_button_images = (platform.system() == 'Darwin') if (self.use_active_button_images): start_images['active'] = media_dir + "/start_active.gif" stop_images['active'] = media_dir + "/stop_active.gif" simulator_images['active'] = media_dir + "/simulator_active.gif" eBot_images['active'] = media_dir + "/eBot_active.gif" robot_images['active'] = media_dir + "/robot_active.gif" brain_images['active'] = media_dir + "/brain_active.gif" joystick_images['active'] = media_dir + "/joystick_active.gif" oscillo_images['active'] = media_dir + "/oscillo_active.gif" Amigo_simulator_images['active'] = media_dir + "/simulator_active.gif" self.soar_toolbar_commands.addFormula(('start', self.startall, 'Start', start_images, lambda: [])) self.soar_toolbar_commands.addFormula(('step', self.stepall, 'Step', step_images, lambda: [])) self.soar_toolbar_commands.addFormula(('stop', self.stopall, 'Stop', stop_images, lambda: [])) self.pushToolbarButton('stop') self.disableToolbarButton('start') self.disableToolbarButton('step') Label(self.toolbar, text = "Outputs:").pack(side = LEFT) #self.simulator_dir_default = soar_dir + "/6.01/worlds" self.soar_toolbar_commands.addFormula(('simulator', self.openSimulator, 'Simulator', simulator_images, self.openSimulatorDialog)) self.soar_toolbar_commands.addFormula(('Amigosimulator', self.openAmigoSimulator, 'AmigoSimulator', Amigo_simulator_images, self.openAmigoSimulatorDialog)) #self.soar_toolbar_commands.addFormula(('pioneer', self.openPioneer, # 'Pioneer', robot_images, # lambda: [])) self.soar_toolbar_commands.addFormula(('eBot', self.openEBot, 'eBot', eBot_images, lambda: [])) #CHANGED: robot name self.soar_toolbar_commands.addFormula(('pioneer', self.openPioneer, 'Amigobot', robot_images, lambda: [])) Label(self.toolbar, text = "Controls:").pack(side = LEFT) #self.brain_dir_default = '~' self.soar_toolbar_commands.addFormula(('brain', self.openBrain, 'Brain', brain_images, self.openBrainDialog)) self.disableToolbarButton('brain') #CHANGED: commented out #self.soar_toolbar_commands.addFormula(('joystick', self.openJoystick, # 'Joystick', joystick_images, # lambda: [])) #self.disableToolbarButton('joystick') # self.soar_toolbar_commands.addFormula(('oscillo', self.openOscillo, # ' Oscilloscope ', oscillo_images, # lambda: [])) self.minibuffer = widgets.MiniBuffer(app.mainframe, self.namespace, width=78) self.minibuffer.pack(side = TOP, fill=X, expand=1) self.stderrbuffer = None # self.stderrframe = app.tabframe.addFrameWithHideCB("errors", # self.clearErrors) # self.stderrframe = app.tabframe.addFrame("errors") self.stderrbuffer = widgets.OutputBufferFrame(app.mainframe)#self.stderrframe) self.stderrbuffer.box_.config(foreground='red') self.stderrbuffer.pack(fill=BOTH, expand=1) sys.stderr = parallel.PipeSyndicator([sys.stderr, self.stderrbuffer]) self.clearErrors() self.stdoutbuffer = None # self.stdoutframe = app.tabframe.addFrameWithHideCB("standard output", # self.clearOutput) # self.stdoutframe = app.tabframe.addFrame("standard output") self.stdoutbuffer = widgets.OutputBufferFrame(app.mainframe)#self.stdoutframe) self.stdoutbuffer.pack(fill=BOTH, expand=1) sys.stdout = parallel.PipeSyndicator([sys.stdout, self.stdoutbuffer]) self.clearOutput() self.reloadAllButton = Button(app.mainframe, text="Reload Brain and World", command = self.reloadAll) self.reloadAllButton.pack() self.disableButton(self.reloadAllButton) self.reloadBrainButton = Button(app.mainframe, text="Reload Brain", command = self.reloadBrain) self.reloadBrainButton.pack() self.brainfile = "" self.disableButton(self.reloadBrainButton) #self.reloadWorldButton = Button(app.mainframe, text="Reload World", # command = self.reloadWorld) #self.reloadWorldButton.pack() #self.disableButton(self.reloadWorldButton) self.sonarMonitor = None self.oscope = None self.control = None self.output = None self.readfile = False self.writefile = False