Changeset 8311:2db255b99621 in orange


Ignore:
Timestamp:
06/12/11 13:52:55 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
5f26d46ac9ac37266a8fec5f7726b742e41aff67
Message:

Some changes to transformations and zoom

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWGraphQt.py

    r8308 r8311  
    7070from Orange.misc import deprecated_members 
    7171 
     72@deprecated_members({ 
     73                                "saveToFileDirect": "save_to_file_direct",   
     74                                "saveToFile" : "save_to_file",  
     75                                "addCurve" : "add_curve",  
     76                                "activateZooming" : "activate_zooming",  
     77                                "activateRectangleSelection" : "activate_rectangle_selection",  
     78                                "activatePolygonSelection" : "activate_polygon_selection" 
     79                                }) 
    7280class OWGraph(QGraphicsView): 
    7381    def __init__(self, parent=None,  name="None",  show_legend=1 ): 
     
    104112        self.tips = TooltipManager(self) 
    105113         
     114        self.selection_items = [] 
    106115        self.selectionCurveList = [] 
    107116        self.curves = [] 
     
    153162        sizeDlg.saveImage(fileName, size) 
    154163         
    155     def activateZooming(self): 
     164    def activate_zooming(self): 
    156165        self.state = ZOOMING 
     166         
     167    def activate_rectangle_selection(self): 
     168        self.state = SELECT_RECTANGLE 
     169         
     170    def activate_polygon_selection(self): 
     171        self.state = SELECT_POLYGON 
    157172         
    158173    def setShowMainTitle(self, b): 
     
    244259        self.setAxisLabels(yRight, labels) 
    245260         
    246     def addCurve(self, name, brushColor = Qt.black, penColor = Qt.black, size = 5, style = Qt.NoPen,  
     261    def add_curve(self, name, brushColor = Qt.black, penColor = Qt.black, size = 5, style = Qt.NoPen,  
    247262                 symbol = Ellipse, enableLegend = 0, xData = [], yData = [], showFilledSymbols = None, 
    248263                 lineWidth = 1, pen = None, autoScale = 0, antiAlias = None, penAlpha = 255, brushAlpha = 255): 
     
    339354        self.zoom_rect = self.zoom_transform.mapRect(self.graph_area) 
    340355         
    341         axes = self.axes.keys() 
    342         if not axes: 
    343             axes = [xBottom, yLeft] 
    344         min_x, max_x, t = self.axes[axes[0]].scale 
    345         min_y, max_y, t = self.axes[axes[1]].scale 
     356        ## TODO: We shouldn't rely on there always being these two axes 
     357        ## However, visualizations will probably reimplement this method anyway 
     358        min_x, max_x, t = self.axes[xBottom].scale 
     359        min_y, max_y, t = self.axes[yLeft].scale 
     360         
    346361        data_rect = QRectF(min_x, max_y, max_x-min_x, min_y-max_y) 
    347362        self.map_transform = self.transform_from_rects(data_rect,  self.graph_area) 
     
    427442            self.zoom_factor_animation.start(QAbstractAnimation.DeleteWhenStopped) 
    428443            return True 
     444        elif self.state == SELECT_POLYGON: 
     445            self._current_ps_polygon.addPoint(QPointF(event.pos())) 
     446            self._current_ps_item.setPolygon(self._current_ps_polygon) 
    429447        else: 
    430448            return False 
     
    475493        self._zoom_point = value 
    476494        self.update_zoom() 
    477          
    478 QWGraph = deprecated_members({"saveToFileDirect": "save_to_file_direct",   
    479                               "saveToFile" : "save_to_file"})(OWGraph) 
Note: See TracChangeset for help on using the changeset viewer.