<s> """<STR_LIT>""" <EOL> from spyderlib . qt . QtGui import QVBoxLayout , QGroupBox , QLabel <EOL> from spyderlib . qt . QtCore import SIGNAL , Qt <EOL> from spyderlib . baseconfig import get_translation <EOL> _ = get_translation ( "<STR_LIT>" , dirname = "<STR_LIT>" ) <EOL> from spyderlib . utils . qthelpers import get_icon , create_action <EOL> from spyderlib . plugins import SpyderPluginMixin , PluginConfigPage , runconfig <EOL> from spyderplugins . widgets . memoryprofilergui import ( <EOL> MemoryProfilerWidget , is_memoryprofiler_installed ) <EOL> class MemoryProfilerConfigPage ( PluginConfigPage ) : <EOL> """<STR_LIT>""" <EOL> def setup_page ( self ) : <EOL> settings_group = QGroupBox ( _ ( "<STR_LIT>" ) ) <EOL> use_color_box = self . create_checkbox ( <EOL> _ ( "<STR_LIT>" ) , <EOL> '<STR_LIT>' , default = True ) <EOL> results_group = QGroupBox ( _ ( "<STR_LIT>" ) ) <EOL> results_label1 = QLabel ( _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> results_label1 . setWordWrap ( True ) <EOL> results_label2 = QLabel ( MemoryProfilerWidget . DATAPATH ) <EOL> results_label2 . setTextInteractionFlags ( Qt . TextSelectableByMouse ) <EOL> results_label2 . setWordWrap ( True ) <EOL> settings_layout = QVBoxLayout ( ) <EOL> settings_layout . addWidget ( use_color_box ) <EOL> settings_group . setLayout ( settings_layout ) <EOL> results_layout = QVBoxLayout ( ) <EOL> results_layout . addWidget ( results_label1 ) <EOL> results_layout . addWidget ( results_label2 ) <EOL> results_group . setLayout ( results_layout ) <EOL> vlayout = QVBoxLayout ( ) <EOL> vlayout . addWidget ( settings_group ) <EOL> vlayout . addWidget ( results_group ) <EOL> vlayout . addStretch ( <NUM_LIT:1> ) <EOL> self . setLayout ( vlayout ) <EOL> class MemoryProfiler ( MemoryProfilerWidget , SpyderPluginMixin ) : <EOL> """<STR_LIT>""" <EOL> CONF_SECTION = '<STR_LIT>' <EOL> CONFIGWIDGET_CLASS = MemoryProfilerConfigPage <EOL> def __init__ ( self , parent = None ) : <EOL> MemoryProfilerWidget . __init__ ( self , parent = parent ) <EOL> SpyderPluginMixin . __init__ ( self , parent ) <EOL> self . initialize_plugin ( ) <EOL> def get_plugin_title ( self ) : <EOL> """<STR_LIT>""" <EOL> return _ ( "<STR_LIT>" ) <EOL> def get_plugin_icon ( self ) : <EOL> """<STR_LIT>""" <EOL> return get_icon ( '<STR_LIT>' ) <EOL> def get_focus_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . datatree <EOL> def get_plugin_actions ( self ) : <EOL> """<STR_LIT>""" <EOL> return [ ] <EOL> def on_first_registration ( self ) : <EOL> """<STR_LIT>""" <EOL> self . main . tabify_plugins ( self . main . inspector , self ) <EOL> self . dockwidget . hide ( ) <EOL> def register_plugin ( self ) : <EOL> """<STR_LIT>""" <EOL> self . connect ( self , SIGNAL ( "<STR_LIT>" ) , <EOL> self . main . editor . load ) <EOL> self . connect ( self , SIGNAL ( '<STR_LIT>' ) , <EOL> self . main . redirect_internalshell_stdio ) <EOL> self . main . add_dockwidget ( self ) <EOL> memoryprofiler_act = create_action ( self , _ ( "<STR_LIT>" ) , <EOL> icon = self . get_plugin_icon ( ) , <EOL> triggered = self . run_memoryprofiler ) <EOL> memoryprofiler_act . setEnabled ( is_memoryprofiler_installed ( ) ) <EOL> self . register_shortcut ( memoryprofiler_act , context = "<STR_LIT>" , <EOL> name = "<STR_LIT>" , default = "<STR_LIT>" ) <EOL> self . main . run_menu_actions += [ memoryprofiler_act ] <EOL> self . main . editor . pythonfile_dependent_actions += [ memoryprofiler_act ] <EOL> def refresh_plugin ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def closing_plugin ( self , cancelable = False ) : <EOL> """<STR_LIT>""" <EOL> return True <EOL> def apply_plugin_settings ( self , options ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def run_memoryprofiler ( self ) : <EOL> """<STR_LIT>""" <EOL> self . analyze ( self . main . editor . get_current_filename ( ) ) <EOL> def analyze ( self , filename ) : <EOL> """<STR_LIT>""" <EOL> if self . dockwidget and not self . ismaximized : <EOL> self . dockwidget . setVisible ( True ) <EOL> self . dockwidget . setFocus ( ) <EOL> self . dockwidget . raise_ ( ) <EOL> pythonpath = self . main . get_spyder_pythonpath ( ) <EOL> runconf = runconfig . get_run_configuration ( filename ) <EOL> wdir , args = None , None <EOL> if runconf is not None : <EOL> if runconf . wdir_enabled : <EOL> wdir = runconf . wdir <EOL> if runconf . args_enabled : <EOL> args = runconf . args <EOL> MemoryProfilerWidget . analyze ( <EOL> self , filename , wdir = wdir , args = args , pythonpath = pythonpath , <EOL> use_colors = self . get_option ( '<STR_LIT>' , True ) ) <EOL> PLUGIN_CLASS = MemoryProfiler </s>
