Changeset 8509:8649aa20d611 in orange


Ignore:
Timestamp:
07/28/11 12:21:49 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
6ff9e726169c9ddbd2af5e5d39701261e75178c3
Message:

Make selection rectangles and polygons blue and transparent

Location:
orange/OrangeWidgets/plot
Files:
2 edited

Legend:

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

    r8436 r8509  
    1818CartesianAxes = XAxes + YAxes 
    1919 
     20SelectionZValue = -100 
    2021AxisZValue = -2 
    2122PlotZValue = 0 
  • orange/OrangeWidgets/plot/owplot.py

    r8508 r8509  
    5858from owtools import * 
    5959 
     60## Color values copied from orngView.SchemaView for consistency 
     61SelectionPen = QPen(QBrush(QColor(51, 153, 255, 192)), 1, Qt.SolidLine, Qt.RoundCap) 
     62SelectionBrush = QBrush(QColor(168, 202, 236, 192)) 
    6063 
    6164from PyQt4.QtGui import QGraphicsView,  QGraphicsScene, QPainter, QTransform, QPolygonF, QGraphicsItem, QGraphicsPolygonItem, QGraphicsRectItem, QRegion 
     
    650653            self._selection_start_point = self.mapToScene(event.pos()) 
    651654            self._current_rs_item = QGraphicsRectItem(parent=self.graph_item, scene=self.scene()) 
     655            self._current_rs_item.setPen(SelectionPen) 
     656            self._current_rs_item.setBrush(SelectionBrush) 
     657            self._current_rs_item.setZValue(SelectionZValue) 
    652658             
    653659    def mouseMoveEvent(self, event): 
     
    682688                self._current_ps_item.setPen(highlight_pen) 
    683689            else: 
    684                 self._current_ps_item.setPen(QPen(Qt.black)) 
     690                self._current_ps_item.setPen(SelectionPen) 
    685691        else: 
    686692            x, y = self.map_from_graph(point) 
     
    706712         
    707713        if event.button() == Qt.LeftButton and self.state == SELECT_RECTANGLE and self._current_rs_item: 
    708             self.add_selection_item(self._current_rs_item, self._current_rs_item.rect()) 
     714            self.add_selection(self._current_rs_item.rect()) 
     715            self.scene().removeItem(self._current_rs_item) 
    709716            self._current_rs_item = None 
    710717     
     
    732739                self._current_ps_polygon.append(point) 
    733740                self._current_ps_item = QGraphicsPolygonItem(self.graph_item, self.scene()) 
     741                self._current_ps_item.setPen(SelectionPen) 
     742                self._current_ps_item.setBrush(SelectionBrush) 
     743                self._current_ps_item.setZValue(SelectionZValue) 
     744             
    734745            self._current_ps_polygon.append(point) 
    735746            self._current_ps_item.setPolygon(self._current_ps_polygon) 
    736747            if self._current_ps_polygon.size() > 2 and self.points_equal(self._current_ps_polygon.first(), self._current_ps_polygon.last()): 
    737                 self._current_ps_item.setPen(QPen(Qt.black)) 
    738748                self._current_ps_polygon.append(self._current_ps_polygon.first()) 
    739                 self.add_selection_item(self._current_ps_item, self._current_ps_polygon) 
     749                self.add_selection(self._current_ps_polygon) 
     750                self.scene().removeItem(self._current_ps_item) 
    740751                self._current_ps_item = None 
    741752                 
     
    827838        return selected, unselected 
    828839         
    829     def add_selection_item(self, item, reg): 
     840    def add_selection(self, reg): 
    830841        self.select_points(reg, self.selection_behavior) 
    831842        if self.auto_send_selection_callback: 
Note: See TracChangeset for help on using the changeset viewer.