コード例 #1
0
    def view_action(self, q):
        opt_model = self.app_manager.model

        if q.text() == "Spec Sheet":
            cmds.create_new_ideal_imager(opt_model=opt_model, gui_parent=self)

        if q.text() == "Optical Layout":
            cmds.create_live_layout_view(opt_model, gui_parent=self)

        if q.text() == "Lens View":
            cmds.create_lens_layout_view(opt_model, gui_parent=self)


#            self.create_2D_lens_view()

        if q.text() == "Lens Table":
            self.create_lens_table()

        if q.text() == "Element Table":
            model = cmds.create_element_table_model(opt_model)
            self.create_table_view(model, "Element Table")

        if q.text() == "Ray Fans":
            cmds.create_ray_fan_view(opt_model, "Ray", gui_parent=self)

        if q.text() == "OPD Fans":
            cmds.create_ray_fan_view(opt_model, "OPD", gui_parent=self)

        if q.text() == "Spot Diagram":
            cmds.create_ray_grid_view(opt_model, gui_parent=self)

        if q.text() == "Wavefront Map":
            cmds.create_wavefront_view(opt_model, gui_parent=self)

        if q.text() == "Astigmatism Curves":
            cmds.create_field_curves(opt_model, gui_parent=self)

        if q.text() == "3rd Order Aberrations":
            cmds.create_3rd_order_bar_chart(opt_model, gui_parent=self)

        if q.text() == "y-ybar View":
            cmds.create_paraxial_design_view_v2(opt_model,
                                                'ht',
                                                gui_parent=self)

        if q.text() == "nu-nubar View":
            cmds.create_paraxial_design_view_v2(opt_model,
                                                'slp',
                                                gui_parent=self)

        if q.text() == "yui Ray Table":
            model = cmds.create_parax_table_model(opt_model)
            self.create_table_view(model, "Paraxial Ray Table")

        if q.text() == "Paraxial Model":
            model = cmds.create_parax_model_table(opt_model)
            self.create_table_view(model, "Paraxial Model")

        if q.text() == "Ray Table":
            self.create_ray_table(opt_model)
コード例 #2
0
    def new_model(self, **kwargs):
        opt_model = cmds.create_new_optical_system(**kwargs)
        self.app_manager.set_model(opt_model)
        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()
        self.add_ipython_subwindow(opt_model)
        self.refresh_app_ui()
コード例 #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()