~ubuntu-branches/ubuntu/trusty/guiqwt/trusty

« back to all changes in this revision

Viewing changes to guiqwt/tests/cursors.py

  • Committer: Bazaar Package Importer
  • Author(s): Picca Frédéric-Emmanuel
  • Date: 2011-04-07 22:41:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110407224150-kkhppnq7rp2c8b3c
Tags: 2.1.0-1
* Imported Upstream version 2.1.0
* debian/patches/
  - 0001-features-01_bts614083.patch (delete)
  - 0001-feature-fix-the-documentation-build.patch (new)
* add and install the sift desktop file
* recommends python-dicom (Closes: #621421)
  thanks Junqian Gordon Xu for the report

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
#
 
3
# Copyright © 2009-2011 CEA
 
4
# Pierre Raybaut
 
5
# Licensed under the terms of the CECILL License
 
6
# (see guiqwt/__init__.py for details)
 
7
 
 
8
"""Horizontal/vertical cursors test"""
 
9
 
 
10
SHOW = True # Show test in GUI-based test launcher
 
11
 
 
12
from guiqwt.plot import CurveDialog
 
13
from guiqwt.builder import make
 
14
 
 
15
def plot( *items ):
 
16
    win = CurveDialog(edit=False, toolbar=True)
 
17
    plot = win.get_plot()
 
18
    for item in items:
 
19
        plot.add_item(item)
 
20
    win.show()
 
21
    win.exec_()
 
22
 
 
23
def test():
 
24
    """Test"""
 
25
    # -- Create QApplication
 
26
    import guidata
 
27
    _app = guidata.qapplication()
 
28
    # --
 
29
    from numpy import linspace, sin
 
30
    x = linspace(-10, 10, 1000)
 
31
    y = sin(sin(sin(x)))
 
32
 
 
33
    curve = make.curve(x, y, "ab", "b")
 
34
    hcursor = make.hcursor(.2)
 
35
    vcursor = make.vcursor(2)
 
36
    hcursor_info = make.info_cursor(hcursor, "TL")
 
37
    vcursor_info = make.info_cursor(vcursor, "BR")
 
38
    legend = make.legend("TR")
 
39
    plot(curve, hcursor, vcursor, hcursor_info, vcursor_info, legend)
 
40
 
 
41
if __name__ == "__main__":
 
42
    test()