Changeset 8432:2cdd12350af2 in orange


Ignore:
Timestamp:
07/23/11 19:30:52 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
2f5fbdacdb516c264855e303f68518268eada4cd
Message:

HTML-escape axis labels and title.

For example, the Discretize widget can create a label '<=1', which causes the HTML parsing to fail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/owaxis.py

    r8431 r8432  
    191191        test_rect.adjust(-1, -1, 1, 1) 
    192192        v = self.graph_line.normalVector().unitVector() 
    193         for i in range(len(self._ticks)): 
     193        for i in range(n): 
    194194            pos, text, size = self._ticks[i] 
    195195            label_pos = self.map_to_graph( pos ) 
     
    203203            item.setVisible(True) 
    204204            if not zoom_only: 
    205                 item.setHtml( '<center>' + text.strip() + '</center>') 
     205                item.setHtml( '<center>' + Qt.escape(text.strip()) + '</center>') 
    206206            item.setTextWidth( QLineF(self.map_to_graph(pos - hs), self.map_to_graph(pos + hs) ).length() ) 
    207207            if self.title_above: 
     
    262262            min, max = self.auto_range 
    263263        else: 
    264             return 0 
     264            return QPointF() 
     265        if min == max: 
     266            return QPointF() 
    265267        line_point = self.graph_line.pointAt( (x-min)/(max-min) ) 
    266268        end_point = line_point * self.zoom_transform 
Note: See TracChangeset for help on using the changeset viewer.