Ignore:
Location:
Orange/OrangeCanvas
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/canvas/items/__init__.py

    r11102 r11332  
    44""" 
    55 
    6 from xml.sax.saxutils import escape 
    7 import logging 
    8  
    9 import numpy 
    10  
    11 from PyQt4.QtGui import ( 
    12     QGraphicsItem, QGraphicsObject, QGraphicsWidget, 
    13     QGraphicsEllipseItem, QGraphicsPathItem, QGraphicsRectItem, 
    14     QGraphicsTextItem, QGraphicsPixmapItem, QPainterPath, 
    15     QPainterPathStroker, QGraphicsDropShadowEffect, 
    16     QBrush, QColor, QPen, QRadialGradient, QPainter, 
    17     QIcon, QFont, QStyle, QPalette, QPolygonF 
    18 ) 
    19  
    20 from PyQt4.QtCore import Qt, QRectF, QPointF, QSizeF, QLineF, QTimer, \ 
    21                          QMargins, QVariant, QEvent 
    22  
    23 from PyQt4.QtCore import pyqtSignal as Signal, pyqtProperty as Property 
    24  
    25  
    266from .nodeitem import NodeItem, NodeAnchorItem, NodeBodyItem, SHADOW_COLOR 
    277from .nodeitem import SourceAnchorItem, SinkAnchorItem, AnchorPoint 
  • Orange/OrangeCanvas/canvas/items/nodeitem.py

    r11293 r11331  
    281281        self.__fullStroke = None 
    282282        self.__dottedStroke = None 
     283        self.__shape = None 
    283284 
    284285    def parentNodeItem(self): 
     
    296297        stroke_path = QPainterPathStroker() 
    297298        stroke_path.setCapStyle(Qt.RoundCap) 
     299 
     300        # Shape is wider (bigger mouse hit area - should be settable) 
     301        stroke_path.setWidth(9) 
     302        self.__shape = stroke_path.createStroke(path) 
     303 
     304        # The full stroke 
    298305        stroke_path.setWidth(3) 
    299         # The full stroke 
    300306        self.__fullStroke = stroke_path.createStroke(path) 
    301307 
     
    430436 
    431437    def shape(self): 
    432         # Use stroke without the doted line (poor mouse cursor collision) 
    433         if self.__fullStroke is not None: 
    434             return self.__fullStroke 
     438        if self.__shape is not None: 
     439            return self.__shape 
    435440        else: 
    436441            return GraphicsPathObject.shape(self) 
     442 
     443    def boundingRect(self): 
     444        if self.__shape is not None: 
     445            return self.__shape.controlPointRect() 
     446        else: 
     447            return GraphicsPathObject.boundingRect(self) 
    437448 
    438449    def hoverEnterEvent(self, event): 
  • Orange/OrangeCanvas/document/tests/test_quickmenu.py

    r11163 r11333  
     1from PyQt4.QtGui import QStringListModel 
    12from PyQt4.QtCore import QPoint 
     3 
    24from ..quickmenu import QuickMenu, SuggestMenuPage, FlattenedTreeItemModel, \ 
    35                        ToolTree, QAction 
    46 
    57from ...gui.test import QAppTestCase 
     8from ...registry import global_registry 
     9from ...registry.qt import QtWidgetRegistry 
    610 
    711 
    812class TestMenu(QAppTestCase): 
    913    def test_menu(self): 
    10         from PyQt4.QtGui import QStringListModel 
    1114        menu = QuickMenu() 
    1215 
     
    3437 
    3538    def test_menu_with_registry(self): 
    36         from ...registry.qt import run_discovery 
     39        registry = QtWidgetRegistry(global_registry()) 
    3740 
    38         registry = run_discovery() 
    3941        menu = QuickMenu() 
    4042        menu.setModel(registry.model()) 
     
    6163 
    6264    def test_search(self): 
    63         from ...registry.qt import run_discovery 
    64  
    65         registry = run_discovery() 
     65        registry = QtWidgetRegistry(global_registry()) 
    6666 
    6767        menu = SuggestMenuPage() 
     
    7474 
    7575    def test_flattened_model(self): 
    76         from PyQt4.QtGui import QStringListModel 
    7776        model = QStringListModel(["0", "1", "2", "3"]) 
    7877        flat = FlattenedTreeItemModel() 
Note: See TracChangeset for help on using the changeset viewer.