diff options
author | aneejit1 <aneejit1@gmail.com> | 2022-07-28 15:46:19 +0000 |
---|---|---|
committer | aneejit1 <aneejit1@gmail.com> | 2022-07-30 17:54:15 +0000 |
commit | e602246539fd7435aaeb440fcb7f852c92c8426b (patch) | |
tree | 35e09f5d93c67158e6c1160d6d9b27ae8a0bf966 /examples3/progressbar.py | |
parent | b34531364d5c0d3be7056d87011afd8bd538a0e7 (diff) | |
download | pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.tar.gz pytqt-e602246539fd7435aaeb440fcb7f852c92c8426b.zip |
Remove Qt V2 support and example files
Build files for pyuic2 have been removed along with the examples for
version 2 of Qt and the build/configure scripts have been amended
accordingly. The "examples3" directory has been renamed to just
"examples".
Signed-off-by: aneejit1 <aneejit1@gmail.com>
Diffstat (limited to 'examples3/progressbar.py')
-rwxr-xr-x | examples3/progressbar.py | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/examples3/progressbar.py b/examples3/progressbar.py deleted file mode 100755 index e33362e..0000000 --- a/examples3/progressbar.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env python - -"""*********************************************************************** -** $Id: progressbar.py,v 1.1 2003/06/10 14:51:24 phil Exp $ -** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. -** -** This file is part of an example program for TQt. This example -** program may be used, distributed and modified without limitation. -** -**************************************************************************""" - -#import pdb -import sys -from python_tqt.qt import * - -FALSE = 0 -TRUE = 1 - -class ProgressBar( TQButtonGroup ): - # Constructor - # Creates child widgets of the ProgressBar widget - def __init__( self, parent=None, name=None ): - TQButtonGroup.__init__( self, 0, TQt.Horizontal, "Progress Bar", parent, name ) - - self.timer = TQTimer() - - self.setMargin( 10 ) - toplayout = TQGridLayout( self.layout(), 2, 2, 5) - - self.setRadioButtonExclusive( TRUE ) - - # insert three radiobuttons which the user can use - # to set the speed of the progress and two pushbuttons - # to start/pause/continue and reset the progress - self.slow = TQRadioButton( "&Slow", self ) - self.normal = TQRadioButton( "&Normal", self ) - self.fast = TQRadioButton( "&Fast", self ) - vb1 = TQVBoxLayout( ) - toplayout.addLayout( vb1, 0, 0 ) - vb1.addWidget( self.slow ) - vb1.addWidget( self.normal ) - vb1.addWidget( self.fast ) - - # two push buttons, one for start, for for reset. - self.start = TQPushButton( "&Start", self ) - self.reset = TQPushButton( "&Reset", self ) - - vb2 = TQVBoxLayout() - toplayout.addLayout( vb2, 0, 1 ) - vb2.addWidget( self.start ) - vb2.addWidget( self.reset ) - - # Create the progressbar - self.progress = TQProgressBar( 100, self ) - #self.progress.setStyle( TQMotifStyle() ) - toplayout.addMultiCellWidget( self.progress, 1, 1, 0, 1 ) - - # connect the clicked() SIGNALs of the pushbuttons to SLOTs - self.connect( self.start, SIGNAL("clicked()"), self.slotStart ) - self.connect( self.reset, SIGNAL("clicked()"), self.slotReset ) - - # connect the timeout() SIGNAL of the progress-timer to a SLOT - self.connect( self.timer, SIGNAL("timeout()"), self.slotTimeout ) - # Let's start with normal speed... - self.normal.setChecked( TRUE ) - - # some contraints - self.start.setFixedWidth( 80 ) - self.setMinimumWidth( 300 ) - - # SLOT slotStart - # This SLOT is called if the user clicks start/pause/continue button - def slotStart( self ): - # If the progress bar is at the beginning... - if self.progress.progress() == -1 : - # ...set according to the checked speed-radiobutton the - # the number of steps which are needed to complete the process - if self.slow.isChecked(): - self.progress.setTotalSteps( 10000 ) - elif self.normal.isChecked() : - self.progress.setTotalSteps( 1000 ) - else : - self.progress.setTotalSteps( 50 ) - - # disable the speed-radiobuttons - self.slow.setEnabled( FALSE ) - self.normal.setEnabled( FALSE ) - self.fast.setEnabled( FALSE ) - - # If the progress is not running... - if not self.timer.isActive() : - # ...start the timer (and so the progress) with a interval of 1 ms... - self.timer.start( 1 ) - # ...and rename the start/pause/continue button to Pause - self.start.setText( "&Pause" ) - else : # if the prgress is running... - # ...stop the timer (and so the prgress)... - self.timer.stop() - # ...and rename the start/pause/continue button to Continue - self.start.setText( "&Continue" ) - - # SLOT slotReset - # This SLOT is called when the user clicks the reset button - def slotReset( self ): - # stop the timer and progress - self.timer.stop() - - # rename the start/pause/continue button to Start... - self.start.setText( "&Start" ) - # ...and enable this button - self.start.setEnabled( TRUE ) - - # enable the speed-radiobuttons - self.slow.setEnabled( TRUE ) - self.normal.setEnabled( TRUE ) - self.fast.setEnabled( TRUE ) - - # reset the progressbar - self.progress.reset() - - # SLOT slotTimeout - # This SLOT is called each ms when the timer is - # active (== progress is running) - def slotTimeout( self ): - p = self.progress.progress() - - # If the progress is complete... - if p == self.progress.totalSteps() : - # ...rename the start/pause/continue button to Start... - self.start.setText( "&Start" ) - # ...and disable it... - self.start.setEnabled( FALSE ) - # ...and return - return - - # If the process is not complete increase it - p += 1 - self.progress.setProgress( p ) - - - #TQPushButton *start, *pause, *reset; - -def main( args ): - a = TQApplication( args ) - - progressbar = ProgressBar() - progressbar.setCaption("TQt Example - ProgressBar") - a.setMainWidget(progressbar) - progressbar.show() - - a.exec_loop() - -if __name__=="__main__": - main(sys.argv) |