Source code for enaml.qt.qt_progress_bar

#------------------------------------------------------------------------------
#  Copyright (c) 2012, Enthought, Inc.
#  All rights reserved.
#------------------------------------------------------------------------------
from .qt.QtGui import QProgressBar
from .qt_control import QtControl


[docs]class QtProgressBar(QtControl): """ A Qt implementation of an Enaml ProgressBar. """ #-------------------------------------------------------------------------- # Setup Methods #--------------------------------------------------------------------------
[docs] def create_widget(self, parent, tree): """ Create the underlying progress bar widget. """ widget = QProgressBar(parent) widget.setTextVisible(False) return widget
[docs] def create(self, tree): """ Create and initialize the underlying widget. """ super(QtProgressBar, self).create(tree) self.set_minimum(tree['minimum']) self.set_maximum(tree['maximum']) self.set_value(tree['value']) #-------------------------------------------------------------------------- # Message Handlers #--------------------------------------------------------------------------
[docs] def on_action_set_minimum(self, content): """ Handle the 'set_minimum' action from the Enaml widget. """ self.set_minimum(content['minimum'])
[docs] def on_action_set_maximum(self, content): """ Handle the 'set_maximum' action from the Enaml widget. """ self.set_maximum(content['maximum'])
[docs] def on_action_set_value(self, content): """ Handle the 'set_value' action from the Enaml widget. """ self.set_value(content['value']) #-------------------------------------------------------------------------- # Widget Update Methods #--------------------------------------------------------------------------
[docs] def set_minimum(self, value): """ Set the minimum value of the progress bar """ self.widget().setMinimum(value)
[docs] def set_maximum(self, value): """ Set the maximum value of the progress bar """ self.widget().setMaximum(value)
[docs] def set_value(self, value): """ Set the value of the progress bar """ self.widget().setValue(value)