This section describes a set of miscellaneous widgets in the Abaqus GUI Toolkit that you can use in your applications. The following topics are covered:
The FXHorizontalSeparator widget and the FXVerticalSeparator widget provide a visual separator to allow separating elements in a GUI. The Abaqus GUI Toolkit also includes a FXMenuSeparator widget that you can use to separate items in a menu pane. For example,
FXLabel(parent, 'This is a label above an FXHorizontalSeparator') FXHorizontalSeparator(parent) FXLabel(parent, 'This is a label below an FXHorizontalSeparator')
The AFXNote widget provides a convenient way to display notes or warnings in a dialog box. AFXNote displays either the word “Note” or the word “Warning” in a bold font. AFXNote also aligns messages that contain more than one line. For example,
AFXNote(parent, 'This is an AFXNote information note\n' 'that wraps on two lines.') AFXNote(parent, 'This is an AFXNote warning note!', NOTE_WARNING)
The AFXProgressBar widget provides feedback during a process that takes a long time to complete. For example,
pb = AFXProgressBar(parent, keyword, tgt, LAYOUT_FIX_HEIGHT|LAYOUT_FIX_WIDTH| FRAME_SUNKEN|FRAME_THICK|AFXPROGRESSBAR_SCANNER, 0, 0, 200, 25)If you want to control the display of the progress bar you can use the percentage or iterator mode and call setProgress with the appropriate value.
from abaqusGui import * class MyDB(AFXDataDialog): ID_START = AFXDataDialog.ID_LAST def __init__(self, form): AFXDataDialog.__init__(self, form, 'My Dialog', self.OK|self.CANCEL, DECOR_RESIZE|DIALOG_ACTIONS_SEPARATOR) FXButton(self, 'Start Something', None, self, self.ID_START) FXMAPFUNC(self, SEL_COMMAND, self.ID_START, MyDB.onDoSomething) self.scannerDB = ScannerDB(self) def onDoSomething(self, sender, sel, ptr): self.scannerDB.create() self.scannerDB.showModal(self) getAFXApp().repaint() files = [ 'file_1.txt', 'file_2.txt', 'file_3.txt', 'file_4.txt', ] self.scannerDB.setTotal( len(files) ) for i in range( 1, len(files)+1 ): self.scannerDB.setProgress(i) # Do something with files[i] self.scannerDB.hide() class ScannerDB(AFXDialog): def __init__(self, owner): AFXDialog.__init__(self, owner, 'Work in Progress', 0, 0, DIALOG_ACTIONS_NONE) self.scanner = AFXProgressBar(self, None, 0, LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT| FRAME_SUNKEN|FRAME_THICK|AFXPROGRESSBAR_ITERATOR, 0, 0, 200, 22) def setTotal(self, total): self.scanner.setTotal(total) def setProgress(self, progress): self.scanner.setProgress(progress)
Note: The setProgress method has no effect on a progress bar that uses the scanner mode.