Ignore:
Timestamp:
Jan 10, 2011 10:42:27 AM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
3658abed
Parents:
d65a00a
Message:

make pr plugin inheriting from pluginbase in guiframe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/explore_dialog.py

    r7116b6e0 r3e41f43  
    6868  
    6969        # Plot area 
    70         self.plot = Model1D(self.x,y=y,dy=dy) 
     70        self.plot = Model1D(self.x, y=y, dy=dy) 
    7171        self.plot.name = DEFAULT_OUTPUT 
    7272 
     
    8989        id = wx.NewId() 
    9090        slicerpop = wx.Menu() 
    91         slicerpop.Append(id,'&Save image', 'Save image as PNG') 
     91        slicerpop.Append(id, '&Save image', 'Save image as PNG') 
    9292        wx.EVT_MENU(self, id, self.onSaveImage) 
    9393         
     
    126126        self.outputs['Oscillation parameter'] = ["Osc", "a.u.", self.osc]     
    127127        self.outputs['Positive fraction'] = ["P^+", "a.u.", self.pos]     
    128         self.outputs['1-sigma positive fraction'] = ["P^+_{1\ \sigma}", "a.u.", self.pos_err]     
     128        self.outputs['1-sigma positive fraction'] = ["P^+_{1\ \sigma}",  
     129                                                     "a.u.", self.pos_err]     
    129130        self.outputs['Rg'] = ["R_g", "A", self.rg]     
    130131        self.outputs['I(q=0)'] = ["I(q=0)", "1/A", self.iq0]     
     
    157158         
    158159        # Control for number of points 
    159         self.npts_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20)) 
     160        self.npts_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 
     161                                   size=(60,20)) 
    160162        # Control for the minimum value of D_max 
    161         self.dmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20)) 
     163        self.dmin_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 
     164                                   size=(60,20)) 
    162165        # Control for the maximum value of D_max 
    163         self.dmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, size=(60,20)) 
     166        self.dmax_ctl = PrTextCtrl(self, -1, style=wx.TE_PROCESS_ENTER, 
     167                                   size=(60,20)) 
    164168 
    165169        # Output selection box for the y axis 
     
    167171 
    168172        # Create the plot object 
    169         self.plotpanel = OutputPlot(self._default_min, self._default_max, self, -1, style=wx.RAISED_BORDER) 
     173        self.plotpanel = OutputPlot(self._default_min, self._default_max, 
     174                                    self, -1, style=wx.RAISED_BORDER) 
    170175         
    171176        # Create the layout of the dialog 
     
    258263            self.plotpanel.plot.y = self.results.outputs[output_type][2] 
    259264            self.plotpanel.plot.name = '_nolegend_' 
    260             self.plotpanel.graph.yaxis("\\rm{%s}" % self.results.outputs[output_type][0], self.results.outputs[output_type][1]) 
     265            y_label = "\\rm{%s}" % self.results.outputs[output_type][0] 
     266            self.plotpanel.graph.yaxis(y_label, 
     267                                       self.results.outputs[output_type][1]) 
    261268             
    262269            # Redraw 
     
    264271            self.plotpanel.subplot.figure.canvas.draw_idle() 
    265272        else: 
    266             msg =  "ExploreDialog: the Results object's dictionary does not contain " 
    267             msg += "the [%s] output type. This must be indicative of a change in the " % str(output_type) 
     273            msg =  "ExploreDialog: the Results object's dictionary " 
     274            msg += "does not contain " 
     275            msg += "the [%s] output type. This must be indicative of " 
     276            msg += "a change in the " % str(output_type) 
    268277            msg += "ExploreDialog code." 
    269278            logging.error(msg) 
     
    279288        sizer_main = wx.BoxSizer(wx.VERTICAL) 
    280289        sizer_button = wx.BoxSizer(wx.HORIZONTAL) 
    281         sizer_params = wx.GridBagSizer(5,5) 
     290        sizer_params = wx.GridBagSizer(5, 5) 
    282291 
    283292        iy = 0 
    284293        ix = 0 
    285294        label_npts  = wx.StaticText(self, -1, "Npts") 
    286         sizer_params.Add(label_npts, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     295        sizer_params.Add(label_npts, (iy, ix), (1, 1),  
     296                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    287297        ix += 1 
    288         sizer_params.Add(self.npts_ctl,   (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     298        sizer_params.Add(self.npts_ctl,   (iy, ix), (1, 1),  
     299                         wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    289300        self.npts_ctl.SetValue("%g" % DEFAULT_NPTS) 
    290301        self.npts_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc) 
     
    292303        ix += 1 
    293304        label_dmin   = wx.StaticText(self, -1, "Min Distance [A]") 
    294         sizer_params.Add(label_dmin, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     305        sizer_params.Add(label_dmin, (iy, ix), (1, 1), 
     306                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    295307        ix += 1 
    296         sizer_params.Add(self.dmin_ctl,   (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     308        sizer_params.Add(self.dmin_ctl, (iy, ix), (1, 1), 
     309                         wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    297310        self.dmin_ctl.SetValue(str(self._default_min)) 
    298311        self.dmin_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc) 
     
    300313        ix += 1 
    301314        label_dmax = wx.StaticText(self, -1, "Max Distance [A]") 
    302         sizer_params.Add(label_dmax, (iy,ix), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     315        sizer_params.Add(label_dmax, (iy, ix), (1, 1), 
     316                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    303317        ix += 1 
    304         sizer_params.Add(self.dmax_ctl,   (iy,ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     318        sizer_params.Add(self.dmax_ctl,   (iy, ix), (1, 1), 
     319                         wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    305320        self.dmax_ctl.SetValue(str(self._default_max)) 
    306321        self.dmax_ctl.Bind(wx.EVT_KILL_FOCUS, self._recalc) 
     
    314329        self.output_box.SetStringSelection(DEFAULT_OUTPUT) 
    315330         
    316         output_sizer = wx.GridBagSizer(5,5) 
    317         output_sizer.Add(selection_msg, (0,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
    318         output_sizer.Add(self.output_box, (0,1), (1,2), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
    319          
    320         wx.EVT_COMBOBOX(self.output_box,-1, self._plot_output)  
     331        output_sizer = wx.GridBagSizer(5, 5) 
     332        output_sizer.Add(selection_msg, (0, 0), (1, 1), 
     333                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
     334        output_sizer.Add(self.output_box, (0, 1), (1, 2), 
     335                         wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
     336         
     337        wx.EVT_COMBOBOX(self.output_box, -1, self._plot_output)  
    321338        sizer_main.Add(output_sizer, 0, wx.EXPAND | wx.ALL, 10) 
    322339         
    323340        sizer_main.Add(self.plotpanel, 0, wx.EXPAND | wx.ALL, 10) 
    324         sizer_main.SetItemMinSize(self.plotpanel, 400,400) 
     341        sizer_main.SetItemMinSize(self.plotpanel, 400, 400) 
    325342         
    326343        sizer_main.Add(sizer_params, 0, wx.EXPAND|wx.ALL, 10) 
     
    357374         
    358375        # Loop over d_max values 
    359         for i in range(content.npts):     
    360             d = content.dmin + i * (content.dmax - content.dmin)/(content.npts-1.0) 
     376        for i in range(content.npts):  
     377            temp = (content.dmax - content.dmin)/(content.npts - 1.0)    
     378            d = content.dmin + i * temp 
     379                 
    361380            self.pr_state.d_max = d 
    362381            try: 
     
    380399            except: 
    381400                # This inversion failed, skip this D_max value 
    382                 logging.error("ExploreDialog: inversion failed for D_max=%s\n%s" % (str(d), sys.exc_value)) 
     401                msg = "ExploreDialog: inversion failed " 
     402                msg += "for D_max=%s\n%s" % (str(d), sys.exc_value) 
     403                logging.error(msg) 
    383404             
    384405        self.results = results             
Note: See TracChangeset for help on using the changeset viewer.