Changeset 26b0a7c in sasview


Ignore:
Timestamp:
Jan 11, 2012 7:12:24 PM (12 years ago)
Author:
Jae Cho <jhjcho@…>
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:
2a09236
Parents:
d6202e30
Message:

tick label font change can be turned off

Location:
plottools/src/danse/common/plottools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plottools/src/danse/common/plottools/PlotPanel.py

    r7053d08 r26b0a7c  
    258258        self.xaxis_unit = None 
    259259        self.xaxis_color = 'black' 
     260        self.xaxis_tick = False 
    260261        self.yaxis_font = None 
    261262        self.yaxis_label = None 
    262263        self.yaxis_unit = None 
    263264        self.yaxis_color = 'black' 
     265        self.yaxis_tick = False 
    264266         
    265267        # check if zoomed. 
     
    10591061        """ 
    10601062        xaxis_label, xaxis_unit, xaxis_font, xaxis_color,\ 
    1061                      is_ok = self._on_axis_label(axis='x') 
     1063                     is_ok, xaxis_tick = self._on_axis_label(axis='x') 
    10621064        if not is_ok: 
    10631065            return 
     
    10671069        self.xaxis_font = xaxis_font 
    10681070        self.xaxis_color = xaxis_color 
     1071        self.xaxis_tick = xaxis_tick 
    10691072         
    10701073        if self.data != None: 
    10711074            # 2D 
    10721075            self.xaxis(self.xaxis_label, self.xaxis_unit,\ 
    1073                         self.xaxis_font, self.xaxis_color) 
     1076                        self.xaxis_font, self.xaxis_color, self.xaxis_tick) 
    10741077            self.subplot.figure.canvas.draw_idle() 
    10751078        else: 
     
    10971100        """ 
    10981101        yaxis_label, yaxis_unit, yaxis_font, yaxis_color,\ 
    1099                         is_ok = self._on_axis_label(axis='y') 
     1102                        is_ok, yaxis_tick = self._on_axis_label(axis='y') 
    11001103        if not is_ok: 
    11011104            return 
     
    11051108        self.yaxis_font = yaxis_font 
    11061109        self.yaxis_color = yaxis_color 
     1110        self.yaxis_tick = yaxis_tick 
    11071111 
    11081112        if self.data != None: 
    11091113            # 2D 
    11101114            self.yaxis(self.yaxis_label, self.yaxis_unit,\ 
    1111                         self.yaxis_font, self.yaxis_color) 
     1115                        self.yaxis_font, self.yaxis_color, self.yaxis_tick) 
    11121116            self.subplot.figure.canvas.draw_idle() 
    11131117        else: 
     
    11431147                unit = textdial.getUnit() 
    11441148                colour = textdial.getColor() 
     1149                is_tick = textdial.getTickLabel() 
    11451150                label_temp = textdial.getText() 
    11461151                if label_temp.count("\%s"% "\\") > 0: 
     
    11611166        else: 
    11621167            is_ok = False 
     1168            is_tick = True 
    11631169        textdial.Destroy() 
    1164         return label, unit, font, colour, is_ok 
     1170        return label, unit, font, colour, is_ok, is_tick 
    11651171         
    11661172    def _on_removetext(self, event): 
     
    12491255                                handletextsep=.05, loc=self.legendLoc) 
    12501256                  
    1251     def xaxis(self, label, units, font=None, color='black'): 
     1257    def xaxis(self, label, units, font=None, color='black', t_font=False): 
    12521258        """xaxis label and units. 
    12531259         
     
    12651271        if font: 
    12661272            self.subplot.set_xlabel(label, fontproperties=font, color=color) 
    1267             for tick in self.subplot.xaxis.get_major_ticks(): 
    1268                 tick.label.set_fontproperties(font)  
     1273            if t_font: 
     1274                for tick in self.subplot.xaxis.get_major_ticks(): 
     1275                    tick.label.set_fontproperties(font)  
    12691276        else: 
    12701277            self.subplot.set_xlabel(label, color=color) 
    12711278        pass 
    12721279     
    1273     def yaxis(self, label, units, font=None, color='black'): 
     1280    def yaxis(self, label, units, font=None, color='black', t_font=False): 
    12741281        """yaxis label and units.""" 
    12751282        if units != "":  
     
    12791286        if font: 
    12801287            self.subplot.set_ylabel(label, fontproperties=font, color=color) 
    1281             for tick_label in self.subplot.get_yticklabels(): 
    1282                 tick_label.set_fontproperties(font) 
     1288            if t_font: 
     1289                for tick_label in self.subplot.get_yticklabels(): 
     1290                    tick_label.set_fontproperties(font) 
    12831291        else: 
    12841292            self.subplot.set_ylabel(label, color=color) 
     
    18171825        self.set_yscale(_yscale) 
    18181826         
    1819         self.xaxis(xname, xunits, self.xaxis_font, self.xaxis_color) 
    1820         self.yaxis(yname, yunits, self.yaxis_font, self.yaxis_color) 
     1827        self.xaxis(xname, xunits, self.xaxis_font,  
     1828                   self.xaxis_color, self.xaxis_tick) 
     1829        self.yaxis(yname, yunits, self.yaxis_font,  
     1830                   self.yaxis_color, self.yaxis_tick) 
    18211831        self.subplot.texts = self.textList 
    18221832        self.subplot.figure.canvas.draw_idle() 
  • plottools/src/danse/common/plottools/TextDialog.py

    r82a54b8 r26b0a7c  
    2929        self.weight = WEIGHT[1] 
    3030        self.color = COLOR[0] 
     31        self.tick_label = True 
    3132        #Dialog interface 
    3233        vbox  = wx.BoxSizer(wx.VERTICAL) 
     
    4950            self.unit_ctrl.SetValue(str(unit)) 
    5051            unit_box = wx.BoxSizer(wx.HORIZONTAL) 
     52            tick_label_text = wx.StaticText(self, -1, 'Tick label') 
     53            tick_label_text.SetToolTipString("Apply to tick label too.") 
     54            self.tick_label_check = wx.CheckBox(self, -1,  
     55                                                '', (10, 10)) 
     56            self.tick_label_check.SetValue(True) 
     57            self.tick_label_check.SetToolTipString("Apply to tick label too.") 
     58            wx.EVT_CHECKBOX(self, self.tick_label_check.GetId(),  
     59                            self.on_tick_label) 
    5160            enter_text = 'Enter text:' 
    5261        else: 
     
    5766            self.unit_ctrl = None 
    5867            unit_box = None 
     68            tick_label_text = None 
     69            self.tick_label_check = None 
    5970            enter_text = 'Enter text' 
    6071            if len(label) > 0: 
     
    119130        family_box.Add(wx.StaticText(self, -1, 'Size :'), -1, 0) 
    120131        family_box.Add(self.fontSize, -1, 0) 
     132        if unit_box != None: 
     133            family_box.Add((_BOX_WIDTH/2,-1)) 
     134            family_box.Add(tick_label_text, -1, 0) 
     135            family_box.Add(self.tick_label_check, -1, 0) 
    121136        style_box.Add(wx.StaticText(self, -1, 'Style :'), -1, 0) 
    122137        style_box.Add(self.fontStyle, -1, 0) 
     
    202217        for idx in range(len(list)): 
    203218            self.fontColor.Append(list[idx],idx)  
     219             
     220    def on_tick_label(self, event): 
     221        """ 
     222        Set the font for tick label 
     223        """ 
     224        event.Skip() 
     225        self.tick_label = self.tick_label_check.GetValue() 
    204226                    
    205227    def on_family(self, event): 
     
    292314        return str(self.color) 
    293315     
     316    def getTickLabel(self): 
     317        """ 
     318        Bool for use on tick label 
     319        """ 
     320        return self.tick_label 
Note: See TracChangeset for help on using the changeset viewer.