예제 #1
0
    def LoadNotebook(self):
        """Add the notebook tabs. """
        self.tabs = []
        
        self.tab_startup = panel_startup.PanelStartup(parent=self.notebook)
        self.tab_sample = panel_sample.PanelSample(parent=self.notebook)
        self.tab_goniometer = panel_goniometer.PanelGoniometer(parent=self.notebook)
        self.tab_experiment = panel_experiment.PanelExperiment(parent=self.notebook)
        if not gui_utils.fourcircle_mode():
            self.tab_add = panel_add_positions.PanelAddPositions(parent=self.notebook)
            self.tab_try = panel_try_position.PanelTryPosition(parent=self.notebook)
            self.tab_detectors = panel_detectors.PanelDetectors(parent=self.notebook)


        def AddPage(tab, title, mac_title="", select=False):
            if (gui_utils.is_mac() or gui_utils.is_windows()) and not (mac_title==""):
                title = mac_title
            self.notebook.AddPage(tab, title, select)

        AddPage(self.tab_startup, 'Q-Space', 'Q-Space', select=True)
        if not gui_utils.fourcircle_mode():
            AddPage(self.tab_detectors, 'Detectors')
        AddPage(self.tab_goniometer, 'Goniometer')
        AddPage(self.tab_sample, 'Sample')
        if not gui_utils.fourcircle_mode():
            AddPage(self.tab_try, 'Try an\nOrientation', 'Try Orientation')
            AddPage(self.tab_add, 'Add\nOrientations', 'Add Orientations')
        AddPage(self.tab_experiment, 'Experiment\nPlan', 'Experiment Plan' )

        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.onNotebookPageChanging)
예제 #2
0
    def _init_menuTools(self, parent):

        if not gui_utils.fourcircle_mode():
            id = wx.NewId()
            parent.Append(id=id,
                          help='',
                          kind=wx.ITEM_NORMAL,
                          text=u'Automatic Coverage Optimizer...\tCtrl+O')
            self.Bind(wx.EVT_MENU, self.OnMenuOptimizePositions, id=id)

        id = wx.NewId()
        parent.Append(id=id,
                      help='',
                      kind=wx.ITEM_NORMAL,
                      text=u'Compare measured to predicted peak positions...')
        self.Bind(wx.EVT_MENU, self.OnMenuComparePeaks, id=id)

        id = wx.NewId()
        parent.Append(id=id,
                      help='',
                      kind=wx.ITEM_NORMAL,
                      text=u'Find angles for all HKL.')
        self.Bind(wx.EVT_MENU, self.OnMenuFourCircleAllHKL, id=id)

        id = wx.NewId()
        parent.Append(id=id,
                      help='',
                      kind=wx.ITEM_NORMAL,
                      text=u'Simple Laue Plots')
        self.Bind(wx.EVT_MENU, self.OnMenuLauePlot, id=id)
예제 #3
0
    def LoadNotebook(self):
        """Add the notebook tabs. """
        self.tabs = []

        self.tab_startup = panel_startup.PanelStartup(parent=self.notebook)
        self.tab_sample = panel_sample.PanelSample(parent=self.notebook)
        self.tab_goniometer = panel_goniometer.PanelGoniometer(
            parent=self.notebook)
        self.tab_experiment = panel_experiment.PanelExperiment(
            parent=self.notebook)
        if not gui_utils.fourcircle_mode():
            self.tab_add = panel_add_positions.PanelAddPositions(
                parent=self.notebook)
            self.tab_try = panel_try_position.PanelTryPosition(
                parent=self.notebook)
            self.tab_detectors = panel_detectors.PanelDetectors(
                parent=self.notebook)

        def AddPage(tab, title, mac_title="", select=False):
            if (gui_utils.is_mac()
                    or gui_utils.is_windows()) and not (mac_title == ""):
                title = mac_title
            self.notebook.AddPage(tab, title, select)

        AddPage(self.tab_startup, 'Q-Space', 'Q-Space', select=True)
        if not gui_utils.fourcircle_mode():
            AddPage(self.tab_detectors, 'Detectors')
        AddPage(self.tab_goniometer, 'Goniometer')
        AddPage(self.tab_sample, 'Sample')
        if not gui_utils.fourcircle_mode():
            AddPage(self.tab_try, 'Try an\nOrientation', 'Try Orientation')
            AddPage(self.tab_add, 'Add\nOrientations', 'Add Orientations')
        AddPage(self.tab_experiment, 'Experiment\nPlan', 'Experiment Plan')

        self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING,
                           self.onNotebookPageChanging)
예제 #4
0
    def _init_menuTools(self, parent):

        if not gui_utils.fourcircle_mode():
            id = wx.NewId()
            parent.Append(id=id, help='', kind=wx.ITEM_NORMAL, text=u'Automatic Coverage Optimizer...\tCtrl+O')
            self.Bind(wx.EVT_MENU, self.OnMenuOptimizePositions, id=id)

        id = wx.NewId()
        parent.Append(id=id, help='', kind=wx.ITEM_NORMAL, text=u'Compare measured to predicted peak positions...')
        self.Bind(wx.EVT_MENU, self.OnMenuComparePeaks, id=id)

        id = wx.NewId()
        parent.Append(id=id, help='', kind=wx.ITEM_NORMAL, text=u'Find angles for all HKL.')
        self.Bind(wx.EVT_MENU, self.OnMenuFourCircleAllHKL, id=id)

        id = wx.NewId()
        parent.Append(id=id, help='', kind=wx.ITEM_NORMAL, text=u'Simple Laue Plots')
        self.Bind(wx.EVT_MENU, self.OnMenuLauePlot, id=id)
예제 #5
0
    def _init_menuFile(self, parent):
        id = wx.NewId()
        parent.Append(id=id, text=u'Save experiment to file...\tCtrl+S', kind=wx.ITEM_NORMAL,
                    help='Save the experiment to a .exp file so that it can be re-loaded later.')
        self.Bind(wx.EVT_MENU, self.OnMenuSave, id=id)

        id = wx.NewId()
        parent.Append(id=id, text=u'Load experiment from file...\tCtrl+L', kind=wx.ITEM_NORMAL,
                    help='Load a .exp file.')
        self.Bind(wx.EVT_MENU, self.OnMenuLoad, id=id)

        parent.AppendSeparator()

        if gui_utils.fourcircle_mode():
            # ---------- HFIR-specific loading menus --------------------

            id = wx.NewId()
            parent.Append(id=id, text=u'Load a HFIR .int file...\tCtrl+I', kind=wx.ITEM_NORMAL,
                        help='Load a peaks file from HFIR software to compare predicted and real peaks.')
            self.Bind(wx.EVT_MENU, self.OnMenuLoadIntegrateHFIR, id=id)

            id = wx.NewId()
            parent.Append(id=id, text=u'Load a HFIR UB matrix and lattice parameters file...\tCtrl+U', kind=wx.ITEM_NORMAL,
                        help='Load a UB matrix file made by HFIR software, and a corresponding lattice parameters file.')
            self.Bind(wx.EVT_MENU, self.OnMenuLoadHFIRUB, id=id)

        else:
            # ---------- ISAW loading menus --------------------
            id = wx.NewId()
            parent.Append(id=id, text=u'Load an older ISAW .integrate or .peaks file with sequential det. numbers', kind=wx.ITEM_NORMAL,
                        help='Load a peaks file from ISAW to compare predicted and real peaks. Use this menu for older files (made with ISAW before ~April 2011).')
            self.Bind(wx.EVT_MENU, self.OnMenuLoadIntegrateOld, id=id)

            id = wx.NewId()
            parent.Append(id=id, text=u'Load an ISAW .integrate or .peaks file...\tCtrl+I', kind=wx.ITEM_NORMAL,
                        help='Load a peaks file from ISAW to compare predicted and real peaks.')
            self.Bind(wx.EVT_MENU, self.OnMenuLoadIntegrateNew, id=id)

            id = wx.NewId()
            parent.Append(id=id, text=u'Load an ISAW UB matrix (.mat) file...\tCtrl+U', kind=wx.ITEM_NORMAL,
                        help='Load a UB matrix file made by ISAW (goniometer-corrected; not by ISAWev).')
            self.Bind(wx.EVT_MENU, self.OnMenuLoadUB, id=id)


            id = wx.NewId()
            parent.Append(id=id, text=u'Load a Lauegen .ldm UB matrix file...\tCtrl+M', kind=wx.ITEM_NORMAL,
                        help='Load a Lauegen .ldm file containing the crystal orientation for the IMAGINE instrument.')
            self.Bind(wx.EVT_MENU, self.OnMenuLoadLDM, id=id)


        parent.AppendSeparator()

        id = wx.NewId()
        parent.Append(id=id, text=u'Save sample orientations to CSV file...\tCtrl+D', kind=wx.ITEM_NORMAL,
                    help='Make a CSV file containing the list of motor positions.')
        self.Bind(wx.EVT_MENU, self.OnMenuSaveToCSV, id=id)

        id = wx.NewId()
        parent.Append(id=id, text=u'Preferences...', kind=wx.ITEM_NORMAL, help='Change preferences for calculations, display, and others.')
        self.Bind(wx.EVT_MENU, self.OnMenuPreferences, id=id)

        parent.AppendSeparator()

        parent.Append(id=wx.ID_EXIT, text=u'Quit\tCtrl+Q', kind=wx.ITEM_NORMAL, help='Exit the program.')
        self.Bind(wx.EVT_MENU, self.OnMenuQuit, id=wx.ID_EXIT)
예제 #6
0
    def _init_menuFile(self, parent):
        id = wx.NewId()
        parent.Append(
            id=id,
            text=u'Save experiment to file...\tCtrl+S',
            kind=wx.ITEM_NORMAL,
            help=
            'Save the experiment to a .exp file so that it can be re-loaded later.'
        )
        self.Bind(wx.EVT_MENU, self.OnMenuSave, id=id)

        id = wx.NewId()
        parent.Append(id=id,
                      text=u'Load experiment from file...\tCtrl+L',
                      kind=wx.ITEM_NORMAL,
                      help='Load a .exp file.')
        self.Bind(wx.EVT_MENU, self.OnMenuLoad, id=id)

        parent.AppendSeparator()

        if gui_utils.fourcircle_mode():
            # ---------- HFIR-specific loading menus --------------------

            id = wx.NewId()
            parent.Append(
                id=id,
                text=u'Load a HFIR .int file...\tCtrl+I',
                kind=wx.ITEM_NORMAL,
                help=
                'Load a peaks file from HFIR software to compare predicted and real peaks.'
            )
            self.Bind(wx.EVT_MENU, self.OnMenuLoadIntegrateHFIR, id=id)

            id = wx.NewId()
            parent.Append(
                id=id,
                text=
                u'Load a HFIR UB matrix and lattice parameters file...\tCtrl+U',
                kind=wx.ITEM_NORMAL,
                help=
                'Load a UB matrix file made by HFIR software, and a corresponding lattice parameters file.'
            )
            self.Bind(wx.EVT_MENU, self.OnMenuLoadHFIRUB, id=id)

        else:
            # ---------- ISAW loading menus --------------------
            id = wx.NewId()
            parent.Append(
                id=id,
                text=
                u'Load an older ISAW .integrate or .peaks file with sequential det. numbers',
                kind=wx.ITEM_NORMAL,
                help=
                'Load a peaks file from ISAW to compare predicted and real peaks. Use this menu for older files (made with ISAW before ~April 2011).'
            )
            self.Bind(wx.EVT_MENU, self.OnMenuLoadIntegrateOld, id=id)

            id = wx.NewId()
            parent.Append(
                id=id,
                text=u'Load an ISAW .integrate or .peaks file...\tCtrl+I',
                kind=wx.ITEM_NORMAL,
                help=
                'Load a peaks file from ISAW to compare predicted and real peaks.'
            )
            self.Bind(wx.EVT_MENU, self.OnMenuLoadIntegrateNew, id=id)

            id = wx.NewId()
            parent.Append(
                id=id,
                text=u'Load an ISAW UB matrix (.mat) file...\tCtrl+U',
                kind=wx.ITEM_NORMAL,
                help=
                'Load a UB matrix file made by ISAW (goniometer-corrected; not by ISAWev).'
            )
            self.Bind(wx.EVT_MENU, self.OnMenuLoadUB, id=id)

            id = wx.NewId()
            parent.Append(
                id=id,
                text=u'Load a Lauegen .ldm UB matrix file...\tCtrl+M',
                kind=wx.ITEM_NORMAL,
                help=
                'Load a Lauegen .ldm file containing the crystal orientation for the IMAGINE instrument.'
            )
            self.Bind(wx.EVT_MENU, self.OnMenuLoadLDM, id=id)

        parent.AppendSeparator()

        id = wx.NewId()
        parent.Append(
            id=id,
            text=u'Save sample orientations to CSV file...\tCtrl+D',
            kind=wx.ITEM_NORMAL,
            help='Make a CSV file containing the list of motor positions.')
        self.Bind(wx.EVT_MENU, self.OnMenuSaveToCSV, id=id)

        id = wx.NewId()
        parent.Append(
            id=id,
            text=u'Preferences...',
            kind=wx.ITEM_NORMAL,
            help='Change preferences for calculations, display, and others.')
        self.Bind(wx.EVT_MENU, self.OnMenuPreferences, id=id)

        parent.AppendSeparator()

        parent.Append(id=wx.ID_EXIT,
                      text=u'Quit\tCtrl+Q',
                      kind=wx.ITEM_NORMAL,
                      help='Exit the program.')
        self.Bind(wx.EVT_MENU, self.OnMenuQuit, id=wx.ID_EXIT)
예제 #7
0
    def __init__(self, parent):
        self._init_ctrls(parent)
        #Set the icon
        import os
        icon_file = os.path.join(os.path.dirname(__file__),
                                 CrystalPlan_version.icon_file_3d)
        self.SetIcon(wx.Icon(icon_file, wx.BITMAP_TYPE_PNG))

        #Create the qspace options panel
        self.tabVolume = panel_qspace_options.PanelQspaceOptions(
            parent=self.notebookView)
        if not gui_utils.fourcircle_mode():
            #Add it to the notebook
            self.notebookView.AddPage(self.tabVolume,
                                      'Volume Coverage View',
                                      select=True)

        #Create the reflections view options panel
        self.tabReflections = panel_reflections_view_options.PanelReflectionsViewOptions(
            parent=self.notebookView)
        #Add it to the notebook
        self.notebookView.AddPage(self.tabReflections,
                                  'Reflections View',
                                  select=False)

        #Make the stats panel
        self.stats_panel = panel_coverage_stats.PanelCoverageStats(
            parent=self.panelStats,
            id=wx.NewId(),
            name=u'stats_panel',
            pos=wx.Point(0, 0),
            size=wx.Size(624, 120),
            style=wx.TAB_TRAVERSAL)
        #Put it in the sizer
        self.boxSizerStats.Insert(0,
                                  self.stats_panel,
                                  1,
                                  border=0,
                                  flag=wx.EXPAND)

        # Create the view controller
        self.controller = QspaceViewController(self)

        #This sets the parent control
        self.control = self.controller.edit_traits(parent=self.panel3D,
                                                   kind='panel').control

        #Add a sizer that holds the mayaview, and expand it
        sizer = wx.BoxSizer(orient=wx.VERTICAL)
        sizer.Add(self.control, 1, wx.EXPAND)
        #Also put the mouse info line after
        sizer.Add(self.staticTextMouseInfo,
                  0,
                  border=8,
                  flag=wx.EXPAND | wx.LEFT)
        self.panel3D.SetSizer(sizer)

        self.init_plot()

        #Once the window is shown, we can initialize the pickers.
        #  The scene.interactor does not exist until the window is shown!
        self.controller.init_pickers()