garyinspringhil 0 Newbie Poster

I need a qtimer to trigger reading of a file line by line, I have the code working running with the timer trigger but qtimer will just read the first line over and over as it is now.

Here is the code so far:
self.lcdtimer = QTimer()
self.connect(self.pushButton85,SIGNAL("clicked()"),self.update)
self.connect(self.lcdtimer, SIGNAL("timeout()"), self.lcdxyz)

def lcdxyz(self):
	import time
	import os
	plotfile = os.system("(cat hpgl.plt | sed 's/;/;\\n/g' | sed '/^$/d') > .temp.plt")
	plotfile = open(".temp.plt")
	lines = plotfile.readlines()
	if not lines:
	  self.LCDNumber18.display(0)
	  self.LCDNumber19.display(0)
	  return
	for line in lines:
          if  re.match(r'PD', line):
	     line = line.replace("!PZ","")
	     line = line.replace("PD","")
	     line = line.replace("PU","")
	     line = line.replace(";","")
	     x, y = line.split(",")
	     print x
	     print y
	     self.LCDNumber18.display(x)
	     self.LCDNumber19.display(y)
	self.LCDNumber18.display(0)
	self.LCDNumber19.display(0)
	self.lcdtimer.stop()
	

    def update(self): 
        """ Update the lcd with xy values. """
        import time
	scale = str(self.comboBox7.currentText())
	if scale == "3.53":
	  self.lcdtimer.start(200)
	else:
	  self.lcdtimer.start(1000)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.