]>
Commit | Line | Data |
---|---|---|
8fa876ca RD |
1 | # 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net) |
2 | # | |
3 | # o Updated for wx namespace | |
4 | # | |
5 | # 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net) | |
6 | # | |
7 | # o wx.ProgressDialog appears to be broken. No abort button | |
8 | # and it's not possible to dismiss it otherwise. | |
9 | # | |
10 | ||
11 | import wx | |
bb0054cd RD |
12 | |
13 | #--------------------------------------------------------------------------- | |
14 | ||
15 | def runTest(frame, nb, log): | |
16 | max = 20 | |
8fa876ca RD |
17 | |
18 | dlg = wx.ProgressDialog("Progress dialog example", | |
bb0054cd | 19 | "An informative message", |
8fa876ca RD |
20 | maximum = max, |
21 | parent=frame, | |
22 | style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL) | |
bb0054cd | 23 | |
1e4a197e | 24 | keepGoing = True |
bb0054cd | 25 | count = 0 |
8fa876ca | 26 | |
eb0f373c | 27 | while keepGoing and count < max: |
bb0054cd | 28 | count = count + 1 |
8fa876ca RD |
29 | #print count |
30 | wx.Sleep(1) | |
bb0054cd RD |
31 | |
32 | if count == max / 2: | |
33 | keepGoing = dlg.Update(count, "Half-time!") | |
34 | else: | |
35 | keepGoing = dlg.Update(count) | |
36 | ||
37 | dlg.Destroy() | |
38 | ||
39 | ||
40 | #--------------------------------------------------------------------------- | |
41 | ||
42 | ||
1fded56b | 43 | overview = """\ |
8fa876ca RD |
44 | This class represents a dialog that shows a short message and a progress bar. |
45 | Optionally, it can display an ABORT button | |
46 | ||
47 | This dialog indicates the progress of some event that takes a while to accomplish, | |
48 | usually, such as file copy progress, download progress, and so on. The display | |
49 | is <b>completely</b> under control of the program; you must update the dialog from | |
50 | within the program creating it. | |
bb0054cd | 51 | |
8fa876ca RD |
52 | When the dialog closes, you must check to see if the user aborted the process or |
53 | not, and act accordingly -- that is, if the PD_CAN_ABORT style flag is set. | |
54 | If not then you may progress blissfully onward. | |
bb0054cd | 55 | |
8fa876ca | 56 | """ |
bb0054cd | 57 | |
1fded56b RD |
58 | if __name__ == '__main__': |
59 | import sys,os | |
60 | import run | |
61 | run.main(['', os.path.basename(sys.argv[0])]) |