<s> import time <EOL> from pyface . qt import QtGui , QtCore <EOL> from traits . api import Instance , Int , Str <EOL> from traitsui . qt4 . editor import Editor <EOL> from pyface . ui . qt4 . progress_dialog import ProgressDialog <EOL> class _ProgressDialog ( ProgressDialog ) : <EOL> def close ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class SimpleEditor ( Editor ) : <EOL> """<STR_LIT>""" <EOL> progress = Instance ( _ProgressDialog ) <EOL> message = Str <EOL> min = Int <EOL> max = Int <EOL> def init ( self , parent ) : <EOL> """<STR_LIT>""" <EOL> self . control = self . create_control ( parent ) <EOL> factory = self . factory <EOL> self . min = factory . min <EOL> self . max = factory . max <EOL> self . message = factory . message <EOL> self . sync_value ( factory . min_name , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . sync_value ( factory . max_name , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . sync_value ( factory . message_name , '<STR_LIT:message>' , '<STR_LIT>' ) <EOL> self . set_tooltip ( ) <EOL> def create_control ( self , parent ) : <EOL> """<STR_LIT>""" <EOL> self . progress = _ProgressDialog ( title = self . factory . title , <EOL> message = self . factory . message , <EOL> min = self . factory . min , <EOL> max = self . factory . max , <EOL> can_cancel = self . factory . can_cancel , <EOL> show_time = self . factory . show_time , <EOL> show_percent = self . factory . show_percent ) <EOL> control = QtGui . QWidget ( ) <EOL> self . control = control <EOL> layout = QtGui . QVBoxLayout ( self . control ) <EOL> layout . setContentsMargins ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> self . progress . _create_message ( control , layout ) <EOL> self . progress . _create_gauge ( control , layout ) <EOL> self . progress . _create_percent ( control , layout ) <EOL> self . progress . _create_timer ( control , layout ) <EOL> self . progress . _create_buttons ( control , layout ) <EOL> return self . control <EOL> def update_editor ( self ) : <EOL> """<STR_LIT>""" <EOL> self . progress . min = self . min <EOL> self . progress . max = self . max <EOL> self . progress . message = self . message <EOL> if self . value : <EOL> self . progress . update ( self . value ) <EOL> return <EOL> def _min_changed ( self ) : <EOL> self . update_editor ( ) <EOL> def _max_changed ( self ) : <EOL> self . update_editor ( ) <EOL> def _message_changed ( self ) : <EOL> self . update_editor ( ) </s>
