File: prova.py

package info (click to toggle)
plplot 5.3.1-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 26,248 kB
  • ctags: 11,687
  • sloc: ansic: 86,045; xml: 17,249; sh: 12,400; tcl: 8,113; cpp: 6,824; perl: 4,383; python: 3,915; makefile: 2,899; java: 2,788; fortran: 290; sed: 5; awk: 1
file content (104 lines) | stat: -rwxr-xr-x 2,012 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env python

# Qt tutorial 1.

# Append to effective python path so that can find plplot modules.
from plplot_python_start import *

import sys
from qt import *
from Numeric import *
import math
import qplplot
from  qt import *
import threading

class  MenuExample(QWidget):

    def __init__( self, parent=None , name=None ):
       QWidget.__init__(self,parent,name)
       self.file = QPopupMenu();
       self.file.insertItem( "&Open",  self.open )
       self.file.insertItem( "&Run",  self.Run )

       menu =  QMenuBar( self );
       menu.insertItem( "&File", self.file )
     
       self.mle=QMultiLineEdit(self)
       
       self.mle.show()

       self.qpl=  qplplot.qplplot(self)
       self.resize(500,700)
       
      #  self.resizeQUIET()

       self.show()

       self.qpl.attiva()
  
       

    def  Run(self):
       self.qpl.set_stream()
       exec(str(self.mle.text()), globals(),globals())

  
       
#       p.rotate( -ang )
       
       
#       p.drawRect( QRect(33, -4, 15, 8) )

    def mouseMoveEvent ( qmev ) :
        print "MOVE IN PYTHON"

    def resizeQUIET(self):
          self.mle.resize(self.width(), self.height()/3   )
          self.qpl.move(0,self.mle.y()+self.mle.height() +10)
          self.qpl.resize(self.width(), (2*self.height())/3-20   )
          print "FINE "
          
    def resizeEvent(self,qrev):
         print "resize in python"
         timer =  QTimer( self )
 	 self.connect( timer, SIGNAL("timeout()"), self.resizeQUIET )
 	 timer.start( 0, 1)





    def  open(self):
         self.command=str((QFileDialog.getOpenFileName(".","*.py",)))
         print self.command
         f=open(self.command,"r")
         self.command=f.read()
         print self.command
         self.mle.setText(self.command)


#plplot.semaphore=threading.Semaphore()
#plplot.owner=None

a = QApplication(sys.argv)

w=MenuExample()

# graph=qplplot.qplplot()

a.setMainWidget(w)
# graph.ciao()
# disegna(graph)
# graph.show()


a.exec_loop()