
| Current Path : /home/ift/52_procpy/dataninja/test/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //home/ift/52_procpy/dataninja/test/tss1.py |
# coding: utf8
import os,re,sys
from PyQt5.QtWidgets import QApplication, QWidget, QProgressBar, QPushButton
from PyQt5.QtCore import QBasicTimer
class Example (QWidget):
def __init__(self,*pars,**args):
super().__init__(self,*pars,**args)
self.initUI()
def initUI(self):
self.pbar = QProgressBar(self)
self.pbar.setGeometry(30, 40, 200, 25)
self.btn_start = QPushButton('Start', self)
self.btn_start.move(40, 100)
self.btn_start.clicked.connect(self.doStartAction)
self.btn_stop = QPushButton('Stop', self)
self.btn_stop.move(40, 120)
self.btn_stop.clicked.connect(self.doStopAction)
self.btn_new = QPushButton('New', self)
self.btn_new.move(40, 140)
self.btn_new.clicked.connect(self.doNewAction)
self.timer = QBasicTimer()
self.step = 0
self.setGeometry(300, 300, 800, 600)
self.setWindowTitle('Demo for Button and Progress bar')
self.show()
def timerEvent(self, e):
if self.step >= 100:
self.timer.stop()
self.btn_start.setText('Completion')
return
self.step = self.step + 1
self.pbar.setValue(self.step)
def doStartAction(self, value):
if self.timer.isActive():
self.timer.stop()
self.btn_start.setText('Start')
else:
self.timer.start(100, self)
self.btn_start.setText('Stop')
def doStopAction(self, value):
if self.timer.isActive():
self.timer.stop()
self.btn_stop.setText('Stop')
else:
self.timer.start(100, self)
self.btn_start.setText('Start')
def doStopAction(self, value):
if self.timer.isActive():
self.timer.stop()
self.btn_stop.setText('Stop')
else:
self.timer.start(100, self)
self.btn_start.setText('Start')
def doNewAction(self, value):
if self.timer.isActive():
self.timer.stop()
self.btn_new.setText('Stop')
else:
self.timer.start(100, self)
self.btn_new.setText('Start')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
class Procapp (object):
def __init__ (self,*pars):
self.__class__.__dict__[pars[0]](self,*pars[1:])
#**************************************************************************
def test (self,*pars):
try:
filename = pars[0]
except:
filename = None
try:
os.unlink("test.db")
except:
pass
dbh = sqlite3.connect("test.db")
# dbh.row_factory = sqlite3.Row
dbh.execute("create table entries " +
"(OBJID text unique," +
"____LOCKED____ text default 0," +
"____REPEAT____ text default 0," +
"____CHILDS____ text default ''," +
"____PARENT____ text default ''," +
"____LEVEL____ text default 0," +
"____WAIT____ text default 0," +
"SLEEP text default 0," +
"PRODUCTION text default ''," +
"STARTTIME text default 0," +
"DUMPTIME text default 0," +
"DURATION text default 0," +
"JUMP text default '')" )
dbh.execute("create index OBJID_IDX on entries (OBJID)")
dbh.execute("create index ____LOCKED_____IDX on entries (____LOCKED____)")
dbh.execute("create index ____PARENT_____IDX on entries (____PARENT____)")
dbh.execute("create index ____LEVEL_____IDX on entries (____LEVEL____)")
dbh.execute("create index PRODUCTION_IDX on entries (PRODUCTION)")
dbh.commit()
pa = procpy.procapp.Procapp(tkinter.Tk(),dbh=dbh,filename=filename,dbtable="entries")
pa.app.mainloop()
#**************************************************************************
def test0 (self,*pars):
try:
filename = pars[0]
except:
filename = None
pa = procpy.procapp.Procapp(tkinter.Tk(),dbh={},filename=filename)
pa.app.mainloop()
#**************************************************************************
if __name__ == "__main__":
Procapp(*tuple(sys.argv[1:]))