Changeset 8998:22040c748eea in orange


Ignore:
Timestamp:
09/21/11 11:09:03 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
9f17496df7c2450e6dff8e0cdfbc722ec09e3935
Message:

Some more mouse interaction for scroll views.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngDebugging.py

    r8042 r8998  
    99 
    1010import PyQt4.QtGui 
     11from PyQt4 import QtCore, QtGui 
    1112from PyQt4.QtTest import QTest 
    1213from PyQt4.QtCore import Qt 
    1314 
     15import random 
    1416class debug(object): 
    15     elements_list = defaultdict(list)  
     17    elements_list = defaultdict(list) 
     18    random = random 
     19     
    1620    @classmethod 
    1721    def registerQItemView(cls, widget, view): 
     
    2327         
    2428    @classmethod 
    25     def regiseterQwtPlot(cls, widget, graph): 
     29    def registerQwtPlot(cls, widget, graph): 
    2630        cls.elements_list[widget].append(graph) 
    2731         
     
    4347#        print "scrollAreaInteract", area 
    4448        from PyQt4.QtTest import QTest 
    45         QTest.mouseMove(area) 
    46         QTest.mouseClick(area, Qt.LeftButton) 
     49        geom = area.geometry() 
     50        randpos = lambda: geom.topLeft() + QtCore.QPoint(geom.width() * random.random(), geom.height() * random.random()) 
     51        QTest.mouseMove(area, randpos(), 2) 
     52        QTest.mouseClick(area, Qt.LeftButton, pos=randpos(), delay=2) 
     53        QTest.mouseDClick(area, Qt.LeftButton, pos=randpos(), delay=2) 
     54        QTest.mousePress(area, Qt.LeftButton, pos=randpos(), delay=2) 
     55        QTest.mouseRelease(area, Qt.LeftButton, pos=randpos(), delay=2) 
     56         
     57#        area.scrollContentsBy(random.randint(-10, 10), random.randint(-10, 10)) 
    4758         
    4859         
    4960    @classmethod 
    5061    def itemViewInteract(cls, view): 
    51         cls.scrollAreaInteract(view)         
    52           
     62        cls.scrollAreaInteract(view) 
     63     
    5364    @classmethod 
    5465    def graphicsViewInteract(cls, view): 
Note: See TracChangeset for help on using the changeset viewer.