Example #1
0
 def load_case(self, info):
     avl = info.object.avl
     filename = get_file_from_user(cwd=avl.case_filename, filter=['AVL case files (*.avl)|*.avl'])
     if filename:
         avl.load_case_from_file(filename)
         logger.info('loading case from file : %s' %str(filename))
     avl.reload_case = True
Example #2
0
 def load_case(self, info):
     avl = info.object.avl
     filename = get_file_from_user(cwd=avl.case_filename,
                                   filter=['AVL case files (*.avl)|*.avl'])
     if filename:
         avl.load_case_from_file(filename)
         logger.info('loading case from file : %s' % str(filename))
     avl.reload_case = True
Example #3
0
 def save_case(self, info):
     case = info.object.avl.case
     filename = get_file_from_user(cwd=case.case_filename, filter=['AVL case files (*.avl)|*.avl'])
     if filename:
         f = open(filename, 'w')
         case.write_input_file(f)
         f.flush()
         f.close()
     logger.info('saving case to file : %s' %str(filename))
     info.object.avl.load_case_from_file(filename)
     logger.info('reloading case into avl : %s' %str(filename))
Example #4
0
class AVLHandler(Handler):
    '''
    Handler for all gui events
    '''
    toolbar_actions = List(Action, [
        Action(name="Load Case",
               action="load_case",
               toolip="Load an AVL case from file"),
        Action(name="Save Case",
               action="save_case",
               toolip="Save AVL case to file"),
        Action(name="Run...",
               action="run_config",
               toolip="Recalculate the results"),
    ])

    #def object_runcases_changed(self, uiinfo):
    #    print uiinfo.object, 'runcase name changed'
    def run_config(self, info):
        print 'running...'
        runcase = info.object.avl.run_cases[0]
        runcaseconfig = RunConfig(runcase=runcase)
        out = runcaseconfig.configure_traits(kind='livemodal')
        if not out:
            return
        output = runcaseconfig.run()
        runcase.runoutput.variable_names = output.variable_names
        runcase.runoutput.variable_values = output.variable_values
        runcase.runoutput.eigenmodes = output.eigenmodes
        runcase.runoutput.eigenmatrix = output.eigenmatrix

    def load_case(self, info):
        avl = info.object.avl
        filename = get_file_from_user(cwd=avl.case_filename,
                                      filter=['AVL case files (*.avl)|*.avl'])
        if filename:
            avl.load_case_from_file(filename)
            logger.info('loading case from file : %s' % str(filename))
        avl.reload_case = True

    # NOTE: it also reloads the case into avl
    def save_case(self, info):
        case = info.object.avl.case
        filename = get_file_from_user(cwd=case.case_filename,
                                      filter=['AVL case files (*.avl)|*.avl'])
        if filename:
            f = open(filename, 'w')
            case.write_input_file(f)
            f.flush()
            f.close()
        logger.info('saving case to file : %s' % str(filename))
        info.object.avl.load_case_from_file(filename)
        logger.info('reloading case into avl : %s' % str(filename))
Example #5
0
 def _save_data_fired(self):
     filename = get_file_from_user()
     if filename:
         f = open(filename, 'w')
         self.runoutput.save_variables(f)
         f.close()
Example #6
0
 def _save_data_fired(self):
     filename = get_file_from_user()
     if filename:
         f = open(filename, 'w')
         self.runoutput.save_variables(f)
         f.close()