Exemple #1
0
 def handle_ideal_imager_command(self, iid, command, specsheet):
     if command == 'Apply':
         opt_model = self.app_manager.model
         opt_model.set_from_specsheet(specsheet)
         self.refresh_gui()
     elif command == 'Close':
         for view, info in self.app_manager.view_dict.items():
             if iid == info[0]:
                 view.close()
     elif command == 'Update':
         opt_model = self.app_manager.model
         specsheet = opt_model.specsheet
         firstorder.specsheet_from_parax_data(opt_model, specsheet)
         iid.specsheet_dict[specsheet.conjugate_type] = specsheet
         iid.update_values()
     elif command == 'New':
         opt_model = cmds.create_new_optical_model_from_specsheet(specsheet)
         self.app_manager.set_model(opt_model)
         for view, info in self.app_manager.view_dict.items():
             if iid == info[0]:
                 w = iid
                 mi = info[1]
                 args = (iid, opt_model)
                 new_mi = ModelInfo(model=opt_model,
                                    fct=mi.fct,
                                    args=args,
                                    kwargs=mi.kwargs)
                 self.app_manager.view_dict[view] = w, new_mi
         self.refresh_gui()
         self.create_lens_table()
         cmds.create_live_layout_view(opt_model, gui_parent=self)
         cmds.create_paraxial_design_view(opt_model, 'ht', gui_parent=self)
         self.refresh_gui()
Exemple #2
0
def create_specsheet_from_model(opt_model, specsheets=None):
    if specsheets is None:
        specsheets = create_specsheets()

    specsheet = opt_model.specsheet
    if specsheet is None:
        conj_type = 'finite'
        if opt_model.seq_model.gaps[0].thi > 10e8:
            conj_type = 'infinite'
        specsheet = specsheets[conj_type]
    firstorder.specsheet_from_parax_data(opt_model, specsheet)
    opt_model.specsheet = specsheet
    return specsheet
Exemple #3
0
 def handle_ideal_imager_command(self, iid, command, specsheet):
     ''' link Ideal Imager Dialog buttons to model actions
     iid: ideal imager dialog
     command: text field with the action - same as button label
     specsheet: the input specsheet used to drive the actions
     '''
     if command == 'Apply':
         opt_model = self.app_manager.model
         opt_model.set_from_specsheet(specsheet)
         self.refresh_gui()
     elif command == 'Close':
         for view, info in self.app_manager.view_dict.items():
             if iid == info[0]:
                 self.delete_subwindow(view)
                 view.close()
                 break
     elif command == 'Update':
         opt_model = self.app_manager.model
         specsheet = opt_model.specsheet
         firstorder.specsheet_from_parax_data(opt_model, specsheet)
         iid.specsheet_dict[specsheet.conjugate_type] = specsheet
         iid.update_values()
     elif command == 'New':
         opt_model = cmds.create_new_optical_model_from_specsheet(specsheet)
         self.app_manager.set_model(opt_model)
         for view, info in self.app_manager.view_dict.items():
             if iid == info[0]:
                 w = iid
                 mi = info[1]
                 args = (iid, opt_model)
                 new_mi = ModelInfo(model=opt_model,
                                    fct=mi.fct,
                                    args=args,
                                    kwargs=mi.kwargs)
                 self.app_manager.view_dict[view] = w, new_mi
         self.refresh_gui()
         self.create_lens_table()
         cmds.create_live_layout_view(opt_model, gui_parent=self)
         cmds.create_paraxial_design_view_v2(opt_model,
                                             'ht',
                                             gui_parent=self)
         self.refresh_gui()
Exemple #4
0
def update_specsheet(iid, opt_model):
    specsheet = opt_model.specsheet
    specsheet_from_parax_data(opt_model, specsheet)
    iid.specsheet_dict[specsheet.conjugate_type] = specsheet
    iid.update_values()