Esempio n. 1
0
    def eventFilter(self, ob, ev):

        if (hasattr(plplot, "semaphore")):
            if (plplot.owner is not self):
                plplot.semaphore.acquire()
                plplot.owner = self
        plplot.plsstrm(self.ipls)

        print " intercettato event ", ev.type()

        if (self.count == 1):
            self.Init()
            self.is_created = 1
            self.count = 2

        if (self.is_created):
            print " EVENTO = ", ev.type(), " ", qt.QEvent.Resize
            if (ev.type() == qt.QEvent.Paint):
                plplot_widget.plexpose()
                timer = qt.QTimer(self)
                self.connect(timer, qt.SIGNAL("timeout()"), self.exposeQUIET)
                timer.start(0, 1)
                return 1
            elif (ev.type() == qt.QEvent.Resize):
                print " RESIZE "
                self.resizeQUIET()
                return 1
            else:
                if (ev.type() == 12):
                    plplot_widget.plexpose()
        if (hasattr(plplot, "semaphore")):
            plplot.semaphore.release()

        return 0
Esempio n. 2
0
   def eventFilter(self,ob,ev):

      if(hasattr(plplot,"semaphore")):
        if(plplot.owner is not self): 
           plplot.semaphore.acquire()
           plplot.owner=self
      plplot.plsstrm(self.ipls)

      print " intercettato event ",  ev.type() 
      
      if(self.count==1):
        self.Init()
        self.is_created=1
        self.count=2
  
      if(self.is_created):
        print " EVENTO = ",ev.type() , " ", qt.QEvent.Resize
        if(ev.type()==qt.QEvent.Paint):
	  plplot_widget.plexpose()
          timer =  qt.QTimer( self )
	  self.connect( timer, qt.SIGNAL("timeout()"), self.exposeQUIET)
	  timer.start( 0, 1)
          return 1
        elif(ev.type()==qt.QEvent.Resize):
          print " RESIZE "
          self.resizeQUIET()  
          return 1
        else:
          if(ev.type()==12) :
	   plplot_widget.plexpose();
      if(hasattr(plplot,"semaphore")):
        plplot.semaphore.release()
  
      return 0
Esempio n. 3
0
 def resizeQUIET(self):
     if (hasattr(plplot, "semaphore")):
         if (plplot.owner is not self):
             plplot.semaphore.acquire()
             plplot.owner = self
     plplot.plsstrm(self.ipls)
     plplot_widget.plresize(self.width(), self.height())
     if (hasattr(plplot, "semaphore")):
         plplot.semaphore.release()
Esempio n. 4
0
 def exposeQUIET(self):
     if (hasattr(plplot, "semaphore")):
         if (plplot.owner is not self):
             plplot.semaphore.acquire()
             plplot.owner = self
     plplot.plsstrm(self.ipls)
     plplot_widget.plexpose()
     if (hasattr(plplot, "semaphore")):
         plplot.semaphore.release()
Esempio n. 5
0
 def resizeQUIET(self):
    if(hasattr(plplot,"semaphore")):
      if(plplot.owner is not self): 
         plplot.semaphore.acquire()
         plplot.owner=self
    plplot.plsstrm(self.ipls)
    plplot_widget.plresize(self.width(), self.height())
    if(hasattr(plplot,"semaphore")):
      plplot.semaphore.release()
Esempio n. 6
0
 def exposeQUIET(self):
    if(hasattr(plplot,"semaphore")):
      if(plplot.owner is not self): 
         plplot.semaphore.acquire()
         plplot.owner=self
    plplot.plsstrm(self.ipls)
    plplot_widget.plexpose()
    if(hasattr(plplot,"semaphore")):
      plplot.semaphore.release()
Esempio n. 7
0
    def __getattr__(self, name):

        if name in dir(plplot):

            # Select the stream
            Nstream = self.get_stream_number()
            plplot.plsstrm(Nstream)

            # Return the plplot function to call
            return eval('plplot.' + name)

        else:
            msg = "'Canvas' object has no attribute '%s'" % (name)
            raise exceptions.AttributeError, msg
Esempio n. 8
0
    def __getattr__(self, name):

        # Select the stream
        Nstream = self.get_stream_number()
        plplot.plsstrm(Nstream)

        # Try to get the function using all of the available prefixes
        if 'pl' + name in dir(plplot):
            return eval('plplot.' + 'pl' + name)
        elif '' + name in dir(plplot):
            return eval('plplot.' + '' + name)
        elif 'pl_' + name in dir(plplot):
            return eval('plplot.' + 'pl_' + name)
        else:
            msg = "'Canvas' object has no attribute '%s'" % (name)
            raise exceptions.AttributeError, msg
Esempio n. 9
0
 def set_stream(self):
     plplot.plsstrm(self.ipls)
Esempio n. 10
0
def main(w):

    geometry_master = "500x410+100+200"
    geometry_slave = "500x410+650+200"
    driver = w.plgdev()
    (fam, num, bmax) = w.plgfam()

    print "Demo of multiple output streams via the %s driver." % driver
    print "Running with the second stream as slave to the first."
    print ""

    # Set up the first stream.
    w.plsetopt("geometry", geometry_master)
    w.plsdev(driver)
    w.plssub(2, 2)
    w.plinit()

    # Start next stream.
    w.plsstrm(1)

    # Turn off pause to make this a slave (must follow master)

    w.plsetopt("geometry", geometry_slave)
    w.plspause(0)
    w.plsdev(driver)
    w.plsfam(fam, num, bmax)
    w.plsetopt("fflen", "2")
    w.plinit()

    # Set up the data & plot
    # Original case

    w.plsstrm(0)

    xscale = 6.
    yscale = 1.
    xoff = 0.
    yoff = 0.
    plot1(w, xscale, yscale, xoff, yoff)

    # Set up the data & plot

    xscale = 1.
    yscale = 1.e+6
    plot1(w, xscale, yscale, xoff, yoff)

    # Set up the data & plot

    xscale = 1.
    yscale = 1.e-6
    digmax = 2
    w.plsyax(digmax, 0)
    plot1(w, xscale, yscale, xoff, yoff)

    # Set up the data & plot

    xscale = 1.
    yscale = 0.0014
    yoff = 0.0185
    digmax = 5
    w.plsyax(digmax, 0)
    plot1(w, xscale, yscale, xoff, yoff)

    # To slave
    # The w.pleop() ensures the eop indicator gets lit.

    w.plsstrm(1)
    plot4(w)
    w.pleop()

    # Back to master

    w.plsstrm(0)
    plot2(w)
    plot3(w)

    # To slave

    w.plsstrm(1)
    plot5(w)
    w.pleop()

    # Back to master to wait for user to advance

    w.plsstrm(0)
    w.pleop()
Esempio n. 11
0
 def set_stream(self):
    plplot.plsstrm(self.ipls)