<s> """<STR_LIT>""" <EOL> import cellprofiler . gui <EOL> import cellprofiler . gui . cpfigure <EOL> import cellprofiler . gui . datatoolframe <EOL> import cellprofiler . gui . dialog <EOL> import cellprofiler . gui . errordialog <EOL> import cellprofiler . gui . help <EOL> import cellprofiler . gui . html <EOL> import cellprofiler . gui . html . htmlwindow <EOL> import cellprofiler . gui . imagesetctrl <EOL> import cellprofiler . gui . moduleview <EOL> import cellprofiler . gui . pathlist <EOL> import cellprofiler . gui . pipelinecontroller <EOL> import cellprofiler . gui . pipelinelistview <EOL> import cellprofiler . gui . preferencesdlg <EOL> import cellprofiler . gui . preferencesview <EOL> import cellprofiler . gui . sashwindow_tools <EOL> import cellprofiler . icons <EOL> import cellprofiler . modules <EOL> import cellprofiler . pipeline <EOL> import cellprofiler . preferences <EOL> import cellprofiler . utilities . version <EOL> import cellprofiler . workspace <EOL> import inspect <EOL> import logging <EOL> import os <EOL> import pdb <EOL> import sys <EOL> import traceback <EOL> import wx <EOL> import wx . html <EOL> import wx . lib . scrolledpanel <EOL> logger = logging . getLogger ( __name__ ) <EOL> ID_FILE_NEW_WORKSPACE = wx . ID_NEW <EOL> ID_FILE_LOAD = wx . ID_OPEN <EOL> ID_FILE_LOAD_PIPELINE = wx . NewId ( ) <EOL> ID_FILE_URL_LOAD_PIPELINE = wx . NewId ( ) <EOL> ID_FILE_OPEN_IMAGE = wx . NewId ( ) <EOL> ID_FILE_EXIT = wx . NewId ( ) <EOL> ID_FILE_WIDGET_INSPECTOR = wx . NewId ( ) <EOL> ID_FILE_SAVE_PIPELINE = wx . NewId ( ) <EOL> ID_FILE_SAVE = wx . ID_SAVE <EOL> ID_FILE_SAVE_AS = wx . ID_SAVEAS <EOL> ID_FILE_REVERT_TO_SAVED = wx . NewId ( ) <EOL> ID_FILE_CLEAR_PIPELINE = wx . NewId ( ) <EOL> ID_FILE_EXPORT_IMAGE_SETS = wx . NewId ( ) <EOL> ID_FILE_EXPORT_PIPELINE_NOTES = wx . NewId ( ) <EOL> ID_FILE_IMPORT_FILE_LIST = wx . NewId ( ) <EOL> ID_FILE_ANALYZE_IMAGES = wx . NewId ( ) <EOL> ID_FILE_STOP_ANALYSIS = wx . NewId ( ) <EOL> ID_FILE_RESTART = wx . NewId ( ) <EOL> ID_FILE_PRINT = wx . NewId ( ) <EOL> ID_FILE_PLATEVIEWER = wx . NewId ( ) <EOL> ID_FILE_RUN_MULTIPLE_PIPELINES = wx . NewId ( ) <EOL> ID_FILE_NEW_CP = wx . NewId ( ) <EOL> ID_EDIT_SELECT_ALL = wx . NewId ( ) <EOL> ID_EDIT_COPY = wx . NewId ( ) <EOL> ID_EDIT_DUPLICATE = wx . NewId ( ) <EOL> ID_EDIT_UNDO = wx . ID_UNDO <EOL> ID_EDIT_MOVE_UP = wx . NewId ( ) <EOL> ID_EDIT_MOVE_DOWN = wx . NewId ( ) <EOL> ID_EDIT_DELETE = wx . NewId ( ) <EOL> ID_EDIT_EXPAND_ALL = wx . NewId ( ) <EOL> ID_EDIT_COLLAPSE_ALL = wx . NewId ( ) <EOL> ID_EDIT_BROWSE_FOR_FILES = wx . NewId ( ) <EOL> ID_EDIT_CLEAR_FILE_LIST = wx . NewId ( ) <EOL> ID_EDIT_REMOVE_FROM_FILE_LIST = wx . NewId ( ) <EOL> ID_EDIT_SHOW_FILE_LIST_IMAGE = wx . NewId ( ) <EOL> ID_EDIT_ENABLE_MODULE = wx . NewId ( ) <EOL> ID_EDIT_GO_TO_MODULE = wx . NewId ( ) <EOL> ID_OPTIONS_PREFERENCES = wx . ID_PREFERENCES <EOL> ID_CHECK_NEW_VERSION = wx . NewId ( ) <EOL> ID_DEBUG_TOGGLE = wx . NewId ( ) <EOL> ID_DEBUG_STEP = wx . NewId ( ) <EOL> ID_DEBUG_NEXT_IMAGE_SET = wx . NewId ( ) <EOL> ID_DEBUG_NEXT_GROUP = wx . NewId ( ) <EOL> ID_DEBUG_CHOOSE_GROUP = wx . NewId ( ) <EOL> ID_DEBUG_CHOOSE_IMAGE_SET = wx . NewId ( ) <EOL> ID_DEBUG_CHOOSE_RANDOM_IMAGE_SET = wx . NewId ( ) <EOL> ID_DEBUG_RELOAD = wx . NewId ( ) <EOL> ID_DEBUG_PDB = wx . NewId ( ) <EOL> ID_DEBUG_VIEW_WORKSPACE = wx . NewId ( ) <EOL> ID_SAMPLE_INIT = wx . NewId ( ) <EOL> ID_WINDOW = wx . NewId ( ) <EOL> ID_WINDOW_CLOSE_ALL = wx . NewId ( ) <EOL> ID_WINDOW_SHOW_ALL_WINDOWS = wx . NewId ( ) <EOL> ID_WINDOW_HIDE_ALL_WINDOWS = wx . NewId ( ) <EOL> ID_WINDOW_ALL = ( ID_WINDOW_CLOSE_ALL , ID_WINDOW_SHOW_ALL_WINDOWS , <EOL> ID_WINDOW_HIDE_ALL_WINDOWS ) <EOL> window_ids = [ ] <EOL> ID_HELP_WELCOME = wx . NewId ( ) <EOL> ID_HELP_MODULE = wx . NewId ( ) <EOL> ID_HELP_SEARCH = wx . NewId ( ) <EOL> ID_HELP_DATATOOLS = wx . NewId ( ) <EOL> ID_HELP_ONLINE_MANUAL = wx . NewId ( ) <EOL> ID_HELP_RELEASE_NOTES = wx . NewId ( ) <EOL> ID_HELP_DEVELOPERS_GUIDE = wx . NewId ( ) <EOL> ID_HELP_SOURCE_CODE = wx . NewId ( ) <EOL> ID_HELP_ABOUT = wx . ID_ABOUT <EOL> class CPFrame ( wx . Frame ) : <EOL> def __init__ ( self , * args , ** kwds ) : <EOL> """<STR_LIT>""" <EOL> kwds [ "<STR_LIT>" ] = wx . DEFAULT_FRAME_STYLE <EOL> wx . Frame . __init__ ( self , * args , ** kwds ) <EOL> self . __pipeline = cellprofiler . pipeline . Pipeline ( ) <EOL> self . __workspace = cellprofiler . workspace . Workspace ( <EOL> self . __pipeline , None , None , None , None , None ) <EOL> self . __splitter = wx . SplitterWindow ( self , - <NUM_LIT:1> , style = wx . SP_BORDER ) <EOL> cellprofiler . gui . sashwindow_tools . sp_bind_to_evt_paint ( self . __splitter ) <EOL> screen_width = wx . SystemSettings . GetMetric ( wx . SYS_SCREEN_X ) <EOL> screen_height = wx . SystemSettings . GetMetric ( wx . SYS_SCREEN_Y ) <EOL> self . __splitter . BackgroundStyle = <NUM_LIT:0> <EOL> self . __right_win = wx . Panel ( self . __splitter , style = wx . BORDER_NONE ) <EOL> self . __right_win . AutoLayout = True <EOL> self . __left_win = wx . Panel ( self . __splitter , style = wx . BORDER_NONE ) <EOL> self . __module_list_panel = wx . Panel ( self . __left_win ) <EOL> self . __module_list_panel . SetToolTipString ( <EOL> "<STR_LIT>" ) <EOL> self . __pipeline_test_panel = wx . Panel ( self . __left_win , - <NUM_LIT:1> ) <EOL> self . __pipeline_test_panel . SetToolTipString ( <EOL> "<STR_LIT>" ) <EOL> self . __module_controls_panel = wx . Panel ( self . __left_win , - <NUM_LIT:1> , style = wx . BORDER_NONE ) <EOL> self . __module_controls_panel . SetToolTipString ( <EOL> "<STR_LIT>" ) <EOL> self . __right_win . Sizer = wx . BoxSizer ( wx . VERTICAL ) <EOL> self . __notes_panel = wx . Panel ( self . __right_win ) <EOL> self . __right_win . Sizer . Add ( self . __notes_panel , <NUM_LIT:0> , wx . EXPAND | wx . ALL ) <EOL> self . __right_win . Sizer . AddSpacer ( <NUM_LIT:4> ) <EOL> self . __path_module_imageset_panel = wx . Panel ( self . __right_win ) <EOL> self . __right_win . Sizer . Add ( self . __path_module_imageset_panel , <NUM_LIT:1> , <EOL> wx . EXPAND | wx . ALL ) <EOL> self . __pmi_layout_in_progress = False <EOL> self . __path_module_imageset_panel . Bind ( <EOL> wx . EVT_SIZE , self . __on_path_module_imageset_panel_size ) <EOL> self . __path_list_sash = wx . SashLayoutWindow ( <EOL> self . __path_module_imageset_panel , style = wx . NO_BORDER ) <EOL> cellprofiler . gui . sashwindow_tools . sw_bind_to_evt_paint ( self . __path_list_sash ) <EOL> self . __path_list_sash . Bind ( wx . EVT_SASH_DRAGGED , <EOL> self . __on_sash_drag ) <EOL> self . __path_list_sash . SetOrientation ( wx . LAYOUT_HORIZONTAL ) <EOL> self . __path_list_sash . SetAlignment ( wx . LAYOUT_TOP ) <EOL> self . __path_list_sash . SetDefaultSize ( ( screen_width , screen_height / <NUM_LIT:4> ) ) <EOL> self . __path_list_sash . SetDefaultBorderSize ( <NUM_LIT:4> ) <EOL> self . __path_list_sash . SetSashVisible ( wx . SASH_BOTTOM , True ) <EOL> self . __path_list_sash . AutoLayout = True <EOL> self . __path_list_sash . Hide ( ) <EOL> path_list_group_box = wx . StaticBox ( <EOL> self . __path_list_sash , <EOL> label = "<STR_LIT>" ) <EOL> sizer = wx . StaticBoxSizer ( path_list_group_box , wx . VERTICAL ) <EOL> self . __path_list_sash . Sizer = wx . BoxSizer ( wx . VERTICAL ) <EOL> self . __path_list_sash . Sizer . Add ( sizer , <NUM_LIT:1> , wx . EXPAND ) <EOL> self . __path_list_sash . Sizer . AddSpacer ( <NUM_LIT:6> ) <EOL> self . __path_list_ctrl = cellprofiler . gui . pathlist . PathListCtrl ( self . __path_list_sash ) <EOL> sizer . Add ( self . __path_list_ctrl , <NUM_LIT:1> , wx . EXPAND | wx . ALL ) <EOL> sizer . AddSpacer ( <NUM_LIT:2> ) <EOL> hsizer = wx . BoxSizer ( wx . HORIZONTAL ) <EOL> sizer . Add ( hsizer , <NUM_LIT:0> , wx . EXPAND ) <EOL> hsizer . AddSpacer ( <NUM_LIT:5> ) <EOL> self . __path_list_filter_checkbox = wx . CheckBox ( <EOL> self . __path_list_sash , <EOL> label = "<STR_LIT>" ) <EOL> hsizer . Add ( self . __path_list_filter_checkbox , <NUM_LIT:0> , wx . EXPAND ) <EOL> def show_disabled ( event ) : <EOL> self . __path_list_ctrl . set_show_disabled ( <EOL> self . __path_list_filter_checkbox . Value ) <EOL> self . __path_list_filter_checkbox . Bind ( wx . EVT_CHECKBOX , show_disabled ) <EOL> hsizer . AddStretchSpacer ( ) <EOL> hsizer . AddSpacer ( <NUM_LIT:5> ) <EOL> self . __path_list_help_button = wx . Button ( <EOL> self . __path_list_sash , label = "<STR_LIT:?>" , style = wx . BU_EXACTFIT ) <EOL> self . __path_list_help_button . Bind ( wx . EVT_BUTTON , self . __on_help_path_list ) <EOL> hsizer . Add ( self . __path_list_help_button , <NUM_LIT:0> , wx . EXPAND ) <EOL> self . __module_panel = wx . Panel ( self . __path_module_imageset_panel ) <EOL> self . __imageset_sash = wx . SashLayoutWindow ( <EOL> self . __path_module_imageset_panel , style = wx . NO_BORDER ) <EOL> self . __imageset_sash . SetOrientation ( wx . LAYOUT_HORIZONTAL ) <EOL> self . __imageset_sash . SetAlignment ( wx . LAYOUT_BOTTOM ) <EOL> self . __imageset_sash . SetDefaultSize ( ( screen_width , screen_height / <NUM_LIT:4> ) ) <EOL> self . __imageset_sash . SetDefaultBorderSize ( <NUM_LIT:4> ) <EOL> self . __imageset_sash . SetExtraBorderSize ( <NUM_LIT:2> ) <EOL> self . __imageset_sash . SetSashVisible ( wx . SASH_TOP , True ) <EOL> self . __imageset_sash . Bind ( wx . EVT_SASH_DRAGGED , <EOL> self . __on_sash_drag ) <EOL> cellprofiler . gui . sashwindow_tools . sw_bind_to_evt_paint ( self . __imageset_sash ) <EOL> self . __imageset_sash . Hide ( ) <EOL> self . __imageset_panel = wx . Panel ( self . __imageset_sash ) <EOL> self . __imageset_panel . Sizer = wx . BoxSizer ( ) <EOL> self . __imageset_panel . SetAutoLayout ( True ) <EOL> self . __imageset_ctrl = cellprofiler . gui . imagesetctrl . ImageSetCtrl ( <EOL> self . __workspace , self . __imageset_panel , read_only = True ) <EOL> self . __imageset_panel . Sizer . Add ( self . __imageset_ctrl , <NUM_LIT:1> , wx . EXPAND ) <EOL> self . __grid_ctrl = cellprofiler . gui . moduleview . ModuleView . CornerButtonGrid ( <EOL> self . __imageset_panel ) <EOL> self . __imageset_panel . Sizer . Add ( self . __grid_ctrl , <NUM_LIT:1> , wx . EXPAND ) <EOL> self . __right_win . Sizer . AddSpacer ( <NUM_LIT:4> ) <EOL> self . __preferences_panel = wx . Panel ( self . __right_win , - <NUM_LIT:1> ) <EOL> self . __right_win . Sizer . Add ( self . __preferences_panel , <NUM_LIT:1> , wx . EXPAND ) <EOL> self . __preferences_panel . SetToolTipString ( <EOL> "<STR_LIT>" ) <EOL> self . __progress_panel = wx . Panel ( self . __right_win ) <EOL> self . __progress_panel . AutoLayout = True <EOL> self . __right_win . Sizer . Add ( self . __progress_panel , <NUM_LIT:0> , wx . EXPAND ) <EOL> self . __status_panel = wx . Panel ( self . __right_win ) <EOL> self . __status_panel . AutoLayout = True <EOL> self . __right_win . Sizer . Add ( self . __status_panel , <NUM_LIT:0> , wx . EXPAND ) <EOL> self . __add_menu ( ) <EOL> self . __attach_views ( ) <EOL> self . __set_properties ( ) <EOL> self . __set_icon ( ) <EOL> self . __do_layout ( ) <EOL> self . __make_search_frame ( ) <EOL> self . __make_startup_blurb_frame ( ) <EOL> self . __error_listeners = [ ] <EOL> self . Bind ( wx . EVT_CLOSE , self . OnClose ) <EOL> self . SetAutoLayout ( True ) <EOL> if cellprofiler . preferences . get_startup_blurb ( ) : <EOL> self . show_welcome_screen ( True ) <EOL> self . show_module_ui ( True ) <EOL> def start ( self , workspace_path , pipeline_path ) : <EOL> """<STR_LIT>""" <EOL> self . __pipeline_controller . start ( workspace_path , pipeline_path ) <EOL> self . __module_view . start ( ) <EOL> r = self . __right_win . GetScreenRect ( ) <EOL> self . startup_blurb_frame . SetRect ( r ) <EOL> def show_path_list_ctrl ( self , show ) : <EOL> """<STR_LIT>""" <EOL> if bool ( show ) == bool ( self . __path_list_sash . IsShown ( ) ) : <EOL> return <EOL> self . __path_list_sash . Show ( show ) <EOL> self . layout_pmi_panel ( ) <EOL> self . __path_list_sash . Layout ( ) <EOL> def show_imageset_sash ( self , show ) : <EOL> """<STR_LIT>""" <EOL> if bool ( show ) == bool ( self . __imageset_sash . IsShown ( ) ) : <EOL> return <EOL> self . __imageset_sash . Show ( show ) <EOL> self . layout_pmi_panel ( ) <EOL> self . __imageset_sash . Layout ( ) <EOL> def show_imageset_ctrl ( self ) : <EOL> sizer = self . __imageset_panel . Sizer <EOL> assert isinstance ( sizer , wx . Sizer ) <EOL> if ( sizer . IsShown ( self . __imageset_ctrl ) == False or <EOL> self . __imageset_sash . IsShown ( ) == False ) : <EOL> sizer . Show ( self . __imageset_ctrl , True ) <EOL> sizer . Show ( self . __grid_ctrl , False ) <EOL> self . show_imageset_sash ( True ) <EOL> self . __imageset_panel . Layout ( ) <EOL> def show_grid_ctrl ( self , table = None ) : <EOL> if table is not None : <EOL> self . __grid_ctrl . SetTable ( table ) <EOL> sizer = self . __imageset_panel . Sizer <EOL> if ( sizer . IsShown ( self . __imageset_ctrl ) == True or <EOL> self . __imageset_sash . IsShown ( ) == False ) : <EOL> sizer . Show ( self . __imageset_ctrl , False ) <EOL> sizer . Show ( self . __grid_ctrl , True ) <EOL> self . show_imageset_sash ( True ) <EOL> self . __imageset_sash . Layout ( ) <EOL> self . __imageset_panel . Layout ( ) <EOL> self . __grid_ctrl . Layout ( ) <EOL> def get_grid_ctrl ( self ) : <EOL> return self . __grid_ctrl <EOL> def reset_imageset_ctrl ( self , refresh_image_set = True ) : <EOL> if refresh_image_set : <EOL> self . __workspace . refresh_image_set ( ) <EOL> self . __imageset_ctrl . recompute ( ) <EOL> def show_module_ui ( self , show ) : <EOL> """<STR_LIT>""" <EOL> if ( show == self . __path_module_imageset_panel . IsShownOnScreen ( ) and <EOL> show == self . __notes_panel . IsShownOnScreen ( ) ) : <EOL> return <EOL> right_sizer = self . __right_win . Sizer <EOL> assert isinstance ( right_sizer , wx . Sizer ) <EOL> right_sizer . Show ( self . __notes_panel , show ) <EOL> right_sizer . Show ( self . __path_module_imageset_panel , show ) <EOL> self . __right_win . Layout ( ) <EOL> if show : <EOL> self . show_preferences ( False ) <EOL> self . layout_pmi_panel ( ) <EOL> self . __path_list_sash . Layout ( ) <EOL> self . __module_panel . Layout ( ) <EOL> self . __module_view . module_panel . SetupScrolling ( <EOL> scroll_x = True , <EOL> scroll_y = True , <EOL> scrollToTop = False ) <EOL> self . __imageset_sash . Layout ( ) <EOL> def show_welcome_screen ( self , show ) : <EOL> """<STR_LIT>""" <EOL> self . startup_blurb_frame . Show ( show ) <EOL> if show : <EOL> self . startup_blurb_frame . Raise ( ) <EOL> def show_preferences ( self , show ) : <EOL> """<STR_LIT>""" <EOL> self . __preferences_panel . Show ( show ) <EOL> if show : <EOL> self . show_module_ui ( False ) <EOL> self . show_welcome_screen ( False ) <EOL> self . __preferences_panel . Layout ( ) <EOL> self . __preferences_panel . Parent . Layout ( ) <EOL> def __on_sash_drag ( self , event ) : <EOL> sash = event . GetEventObject ( ) <EOL> width , _ = sash . GetSize ( ) <EOL> sash . SetDefaultSize ( ( width , event . GetDragRect ( ) . height ) ) <EOL> self . layout_pmi_panel ( ) <EOL> sash . Layout ( ) <EOL> def __on_path_module_imageset_panel_size ( self , event ) : <EOL> if not self . __pmi_layout_in_progress : <EOL> self . layout_pmi_panel ( ) <EOL> if self . __path_list_sash . IsShown ( ) : <EOL> self . __path_list_sash . Layout ( ) <EOL> if self . __imageset_sash . IsShown ( ) : <EOL> self . __imageset_sash . Layout ( ) <EOL> def layout_pmi_panel ( self ) : <EOL> """<STR_LIT>""" <EOL> self . __pmi_layout_in_progress = True <EOL> try : <EOL> wx . LayoutAlgorithm ( ) . LayoutWindow ( self . __path_module_imageset_panel , <EOL> self . __module_panel ) <EOL> self . __right_win . Layout ( ) <EOL> finally : <EOL> self . __pmi_layout_in_progress = False <EOL> def OnClose ( self , event ) : <EOL> if event . CanVeto ( ) and not self . pipeline_controller . check_close ( ) : <EOL> event . Veto ( ) <EOL> return <EOL> try : <EOL> self . __workspace . measurements . flush ( ) <EOL> except : <EOL> logger . warn ( "<STR_LIT>" , exc_info = True ) <EOL> try : <EOL> self . __preferences_view . close ( ) <EOL> except : <EOL> logger . warn ( "<STR_LIT>" , exc_info = True ) <EOL> try : <EOL> self . pipeline_controller . on_close ( ) <EOL> except : <EOL> logger . warn ( "<STR_LIT>" , exc_info = True ) <EOL> try : <EOL> cellprofiler . gui . moduleview . stop_validation_queue_thread ( ) <EOL> except : <EOL> logger . warn ( "<STR_LIT>" , exc_info = True ) <EOL> wx . GetApp ( ) . ExitMainLoop ( ) <EOL> def __set_properties ( self ) : <EOL> self . SetTitle ( "<STR_LIT>" % cellprofiler . utilities . version . title_string ) <EOL> self . SetSize ( ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def enable_edit_commands ( self , ids ) : <EOL> """<STR_LIT>""" <EOL> d = dict ( [ ( x , False ) for x in <EOL> ( wx . ID_COPY , wx . ID_CUT , wx . ID_PASTE , wx . ID_SELECTALL ) ] ) <EOL> for eyedee in ids : <EOL> d [ eyedee ] = True <EOL> for k , v in d . iteritems ( ) : <EOL> self . menu_edit . Enable ( k , v ) <EOL> def __add_menu ( self ) : <EOL> """<STR_LIT>""" <EOL> self . __menu_file = wx . Menu ( ) <EOL> self . __menu_file . Append ( <EOL> wx . ID_NEW , <EOL> "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> self . __menu_file . Append ( <EOL> wx . ID_OPEN , <EOL> "<STR_LIT>" , <EOL> help = '<STR_LIT>' % cellprofiler . preferences . EXT_PROJECT ) <EOL> self . recent_workspace_files = wx . Menu ( ) <EOL> self . __menu_file . AppendSubMenu ( <EOL> self . recent_workspace_files , <EOL> "<STR_LIT>" ) <EOL> self . __menu_file . Append ( <EOL> wx . ID_SAVE , <EOL> "<STR_LIT>" , <EOL> help = '<STR_LIT>' ) <EOL> self . __menu_file . Append ( <EOL> wx . ID_SAVEAS , <EOL> "<STR_LIT>" , <EOL> help = '<STR_LIT>' ) <EOL> self . __menu_file . Append ( <EOL> ID_FILE_REVERT_TO_SAVED , <EOL> "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> submenu = wx . Menu ( ) <EOL> submenu . Append ( <EOL> ID_FILE_LOAD_PIPELINE , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' % <EOL> cellprofiler . preferences . EXT_PIPELINE ) <EOL> submenu . Append ( <EOL> ID_FILE_URL_LOAD_PIPELINE , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> submenu . Append ( <EOL> ID_FILE_IMPORT_FILE_LIST , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_file . AppendSubMenu ( submenu , "<STR_LIT>" ) <EOL> submenu = wx . Menu ( ) <EOL> submenu . Append ( <EOL> ID_FILE_SAVE_PIPELINE , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" % cellprofiler . preferences . EXT_PIPELINE ) <EOL> submenu . Append ( <EOL> ID_FILE_EXPORT_IMAGE_SETS , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> submenu . Append ( <EOL> ID_FILE_EXPORT_PIPELINE_NOTES , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_file . AppendSubMenu ( submenu , "<STR_LIT>" ) <EOL> self . __menu_file . Append ( <EOL> ID_FILE_CLEAR_PIPELINE , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __menu_file . AppendSeparator ( ) <EOL> self . __menu_file . Append ( <EOL> ID_FILE_OPEN_IMAGE , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __menu_file . AppendSeparator ( ) <EOL> self . __menu_file . Append ( ID_FILE_ANALYZE_IMAGES , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __menu_file . Append ( ID_FILE_STOP_ANALYSIS , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_file . Append ( ID_FILE_RUN_MULTIPLE_PIPELINES , '<STR_LIT>' ) <EOL> if os . name == '<STR_LIT>' : <EOL> self . __menu_file . Append ( ID_FILE_NEW_CP , '<STR_LIT>' ) <EOL> self . __menu_file . Append ( ID_FILE_RESTART , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_file . AppendSeparator ( ) <EOL> self . __menu_file . Append ( ID_OPTIONS_PREFERENCES , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . recent_files = wx . Menu ( ) <EOL> self . recent_pipeline_files = wx . Menu ( ) <EOL> self . __menu_file . Append ( ID_FILE_EXIT , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . menu_edit = wx . Menu ( ) <EOL> self . menu_edit . Append ( wx . ID_UNDO , help = "<STR_LIT>" ) <EOL> self . menu_edit . AppendSeparator ( ) <EOL> self . menu_edit . Append ( wx . ID_CUT ) <EOL> self . menu_edit . Append ( wx . ID_COPY ) <EOL> self . menu_edit . Append ( wx . ID_PASTE ) <EOL> self . menu_edit . Append ( wx . ID_SELECTALL ) <EOL> self . menu_edit . AppendSeparator ( ) <EOL> self . menu_edit . Append ( ID_EDIT_MOVE_UP , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_MOVE_DOWN , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_DELETE , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_DUPLICATE , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . menu_edit . Append ( <EOL> ID_EDIT_ENABLE_MODULE , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . menu_edit_add_module = wx . Menu ( ) <EOL> self . menu_edit . AppendSubMenu ( self . menu_edit_add_module , "<STR_LIT>" ) <EOL> self . menu_edit_goto_module = wx . Menu ( ) <EOL> self . menu_edit . AppendSubMenu ( <EOL> self . menu_edit_goto_module , "<STR_LIT>" ) <EOL> self . menu_edit . AppendSeparator ( ) <EOL> self . menu_edit . Append ( ID_EDIT_SHOW_FILE_LIST_IMAGE , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_REMOVE_FROM_FILE_LIST , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_BROWSE_FOR_FILES , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_CLEAR_FILE_LIST , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_EXPAND_ALL , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . menu_edit . Append ( ID_EDIT_COLLAPSE_ALL , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_debug = wx . Menu ( ) <EOL> self . __menu_debug . Append ( ID_DEBUG_TOGGLE , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_debug . Append ( ID_DEBUG_STEP , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_debug . Append ( ID_DEBUG_NEXT_IMAGE_SET , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_debug . Append ( ID_DEBUG_NEXT_GROUP , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __menu_debug . Append ( ID_DEBUG_CHOOSE_RANDOM_IMAGE_SET , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_debug . Append ( ID_DEBUG_CHOOSE_GROUP , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __menu_debug . Append ( ID_DEBUG_CHOOSE_IMAGE_SET , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __menu_debug . Append ( ID_DEBUG_VIEW_WORKSPACE , "<STR_LIT>" , "<STR_LIT>" ) <EOL> if not hasattr ( sys , '<STR_LIT>' ) or os . getenv ( '<STR_LIT>' ) : <EOL> self . __menu_debug . Append ( ID_DEBUG_RELOAD , "<STR_LIT>" ) <EOL> self . __menu_debug . Append ( ID_DEBUG_PDB , "<STR_LIT>" ) <EOL> if os . environ . get ( "<STR_LIT>" , "<STR_LIT>" ) . lower ( ) == "<STR_LIT>" : <EOL> self . __menu_debug . Append ( ID_FILE_WIDGET_INSPECTOR , "<STR_LIT>" ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_STEP , False ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_NEXT_IMAGE_SET , False ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_NEXT_GROUP , False ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_CHOOSE_GROUP , False ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_CHOOSE_IMAGE_SET , False ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_CHOOSE_RANDOM_IMAGE_SET , False ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_VIEW_WORKSPACE , False ) <EOL> self . __menu_window = wx . Menu ( ) <EOL> self . __menu_window . Append ( ID_WINDOW_CLOSE_ALL , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_window . Append ( ID_WINDOW_SHOW_ALL_WINDOWS , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_window . Append ( ID_WINDOW_HIDE_ALL_WINDOWS , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_window . AppendSeparator ( ) <EOL> self . __menu_help = wx . Menu ( ) <EOL> self . __menu_help . Append ( ID_HELP_WELCOME , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . __menu_help . Append ( ID_HELP_RELEASE_NOTES , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . __menu_help . Append ( ID_HELP_ONLINE_MANUAL , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . __menu_help . AppendSeparator ( ) <EOL> cellprofiler . gui . help . make_help_menu ( cellprofiler . gui . help . MAIN_HELP , self , self . __menu_help ) <EOL> self . __menu_help . AppendSeparator ( ) <EOL> self . __menu_help . AppendSubMenu ( self . data_tools_help ( ) , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __menu_help . Append ( ID_HELP_MODULE , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_help . Append ( ID_HELP_SEARCH , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_help . AppendSeparator ( ) <EOL> self . __menu_help . Append ( ID_HELP_DEVELOPERS_GUIDE , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_help . Append ( ID_HELP_SOURCE_CODE , "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . __menu_help . Append ( wx . ID_ABOUT , "<STR_LIT>" , "<STR_LIT>" ) <EOL> self . __menu_bar = wx . MenuBar ( ) <EOL> self . __menu_bar . Append ( self . __menu_file , '<STR_LIT>' ) <EOL> self . __menu_bar . Append ( self . menu_edit , '<STR_LIT>' ) <EOL> self . __menu_bar . Append ( self . __menu_debug , '<STR_LIT>' ) <EOL> if cellprofiler . preferences . get_show_sampling ( ) : <EOL> self . __menu_sample = wx . Menu ( ) <EOL> self . __menu_sample . Append ( ID_SAMPLE_INIT , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . __menu_bar . Append ( self . __menu_sample , '<STR_LIT>' ) <EOL> self . __menu_bar . Append ( self . data_tools_menu ( ) , '<STR_LIT>' ) <EOL> self . __menu_bar . Append ( self . __menu_window , "<STR_LIT>" ) <EOL> if wx . VERSION <= ( <NUM_LIT:2> , <NUM_LIT:8> , <NUM_LIT:10> , <NUM_LIT:1> , '<STR_LIT>' ) and wx . Platform == '<STR_LIT>' : <EOL> self . __menu_bar . Append ( self . __menu_help , '<STR_LIT>' ) <EOL> else : <EOL> self . __menu_bar . Append ( self . __menu_help , '<STR_LIT>' ) <EOL> self . SetMenuBar ( self . __menu_bar ) <EOL> self . enable_edit_commands ( [ ] ) <EOL> wx . EVT_MENU ( self , ID_FILE_OPEN_IMAGE , self . on_open_image ) <EOL> wx . EVT_MENU ( self , ID_FILE_EXIT , lambda event : self . Close ( ) ) <EOL> wx . EVT_MENU ( self , ID_FILE_WIDGET_INSPECTOR , self . __on_widget_inspector ) <EOL> wx . EVT_MENU ( self , ID_FILE_NEW_CP , self . __on_new_cp ) <EOL> wx . EVT_MENU ( self , wx . ID_CUT , self . on_cut ) <EOL> self . Bind ( wx . EVT_UPDATE_UI , self . on_update_cut_ui , id = wx . ID_CUT ) <EOL> wx . EVT_MENU ( self , wx . ID_COPY , self . on_copy ) <EOL> self . Bind ( wx . EVT_UPDATE_UI , self . on_update_copy_ui , id = wx . ID_COPY ) <EOL> wx . EVT_MENU ( self , wx . ID_PASTE , self . on_paste ) <EOL> self . Bind ( wx . EVT_UPDATE_UI , self . on_update_paste_ui , id = wx . ID_PASTE ) <EOL> wx . EVT_MENU ( self , wx . ID_SELECTALL , self . on_select_all ) <EOL> self . Bind ( wx . EVT_UPDATE_UI , self . on_update_select_all_ui , <EOL> id = wx . ID_SELECTALL ) <EOL> wx . EVT_MENU ( self , ID_HELP_WELCOME , self . __on_help_welcome ) <EOL> wx . EVT_MENU ( self , ID_HELP_MODULE , self . __on_help_module ) <EOL> wx . EVT_BUTTON ( self , ID_HELP_MODULE , self . __on_help_module ) <EOL> wx . EVT_MENU ( self , ID_HELP_RELEASE_NOTES , self . __on_help_release_notes ) <EOL> wx . EVT_MENU ( self , ID_HELP_ONLINE_MANUAL , self . __on_help_online_manual ) <EOL> wx . EVT_MENU ( self , ID_HELP_DEVELOPERS_GUIDE , self . __on_help_developers_guide ) <EOL> wx . EVT_MENU ( self , ID_HELP_SOURCE_CODE , self . __on_help_source_code ) <EOL> wx . EVT_MENU ( self , ID_HELP_SEARCH , self . __on_search_help ) <EOL> wx . EVT_MENU ( self , ID_HELP_ABOUT , self . about ) <EOL> wx . EVT_MENU ( self , ID_OPTIONS_PREFERENCES , self . __on_preferences ) <EOL> wx . EVT_MENU ( self , ID_WINDOW_CLOSE_ALL , self . __on_close_all ) <EOL> wx . EVT_MENU ( self , ID_DEBUG_PDB , self . __debug_pdb ) <EOL> accelerator_table = wx . AcceleratorTable ( <EOL> [ ( wx . ACCEL_CMD , ord ( '<STR_LIT:N>' ) , ID_FILE_ANALYZE_IMAGES ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT:O>' ) , ID_FILE_LOAD ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT:P>' ) , ID_FILE_SAVE_PIPELINE ) , <EOL> ( wx . ACCEL_CMD | wx . ACCEL_SHIFT , ord ( '<STR_LIT:S>' ) , ID_FILE_SAVE ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT:L>' ) , ID_WINDOW_CLOSE_ALL ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT>' ) , ID_FILE_EXIT ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT>' ) , ID_FILE_EXIT ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT:A>' ) , wx . ID_SELECTALL ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT:C>' ) , wx . ID_COPY ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT>' ) , wx . ID_PASTE ) , <EOL> ( wx . ACCEL_NORMAL , wx . WXK_F5 , ID_DEBUG_TOGGLE ) , <EOL> ( wx . ACCEL_NORMAL , wx . WXK_F6 , ID_DEBUG_STEP ) , <EOL> ( wx . ACCEL_NORMAL , wx . WXK_F7 , ID_DEBUG_NEXT_IMAGE_SET ) , <EOL> ( wx . ACCEL_NORMAL , wx . WXK_F8 , ID_DEBUG_NEXT_GROUP ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT>' ) , ID_EDIT_UNDO ) ] ) <EOL> self . SetAcceleratorTable ( accelerator_table ) <EOL> self . enable_launch_commands ( ) <EOL> def data_tools_help ( self ) : <EOL> """<STR_LIT>""" <EOL> if not hasattr ( self , "<STR_LIT>" ) : <EOL> self . __menu_data_tools_help_menu = wx . Menu ( ) <EOL> def on_plate_viewer_help ( event ) : <EOL> import htmldialog <EOL> dlg = htmldialog . HTMLDialog ( <EOL> self , "<STR_LIT>" , cellprofiler . gui . help . PLATEVIEWER_HELP ) <EOL> dlg . Show ( ) <EOL> new_id = wx . NewId ( ) <EOL> self . __menu_data_tools_help_menu . Append ( new_id , "<STR_LIT>" ) <EOL> wx . EVT_MENU ( self , new_id , on_plate_viewer_help ) <EOL> for data_tool_name in cellprofiler . modules . get_data_tool_names ( ) : <EOL> new_id = wx . NewId ( ) <EOL> self . __menu_data_tools_help_menu . Append ( new_id , data_tool_name ) <EOL> def on_data_tool_help ( event , data_tool_name = data_tool_name ) : <EOL> self . __on_data_tool_help ( event , data_tool_name ) <EOL> wx . EVT_MENU ( self , new_id , on_data_tool_help ) <EOL> return self . __menu_data_tools_help_menu <EOL> def data_tools_menu ( self ) : <EOL> """<STR_LIT>""" <EOL> if not hasattr ( self , "<STR_LIT>" ) : <EOL> self . __data_tools_menu = wx . Menu ( ) <EOL> def on_data_tool_overview ( event ) : <EOL> import htmldialog <EOL> from cellprofiler . gui . help import MENU_BAR_DATATOOLS_HELP <EOL> dlg = htmldialog . HTMLDialog ( self , '<STR_LIT>' , MENU_BAR_DATATOOLS_HELP ) <EOL> dlg . Show ( ) <EOL> new_id = wx . NewId ( ) <EOL> self . __data_tools_menu . Append ( <EOL> new_id , '<STR_LIT>' , '<STR_LIT>' ) <EOL> wx . EVT_MENU ( self , new_id , on_data_tool_overview ) <EOL> self . __data_tools_menu . AppendSeparator ( ) <EOL> self . __data_tools_menu . Append ( <EOL> ID_FILE_PLATEVIEWER , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> self . __data_tools_menu . AppendSeparator ( ) <EOL> for data_tool_name in cellprofiler . modules . get_data_tool_names ( ) : <EOL> new_id = wx . NewId ( ) <EOL> self . __data_tools_menu . Append ( new_id , data_tool_name ) <EOL> def on_data_tool ( event , data_tool_name = data_tool_name ) : <EOL> self . __on_data_tool ( event , data_tool_name ) <EOL> wx . EVT_MENU ( self , new_id , on_data_tool ) <EOL> self . __data_tools_menu . AppendSeparator ( ) <EOL> self . __data_tools_menu . AppendSubMenu ( self . data_tools_help ( ) , '<STR_LIT>' ) <EOL> return self . __data_tools_menu <EOL> @ staticmethod <EOL> def on_cut ( event ) : <EOL> """<STR_LIT>""" <EOL> focus = wx . Window . FindFocus ( ) <EOL> if ( focus is not None and hasattr ( focus , "<STR_LIT>" ) <EOL> and hasattr ( focus , '<STR_LIT>' ) and focus . CanCut ( ) ) : <EOL> focus . Cut ( ) <EOL> @ staticmethod <EOL> def on_update_cut_ui ( event ) : <EOL> focus = wx . Window . FindFocus ( ) <EOL> event . Enable ( bool ( <EOL> focus and hasattr ( focus , '<STR_LIT>' ) and focus . CanCut ( ) ) ) <EOL> @ staticmethod <EOL> def on_copy ( event ) : <EOL> """<STR_LIT>""" <EOL> focus = wx . Window . FindFocus ( ) <EOL> if focus is not None and hasattr ( focus , "<STR_LIT>" ) and hasattr ( focus , '<STR_LIT>' ) and focus . CanCopy ( ) : <EOL> focus . Copy ( ) <EOL> @ staticmethod <EOL> def on_update_copy_ui ( event ) : <EOL> focus = wx . Window . FindFocus ( ) <EOL> event . Enable ( bool ( <EOL> focus and hasattr ( focus , '<STR_LIT>' ) and focus . CanCopy ( ) ) ) <EOL> @ staticmethod <EOL> def on_paste ( event ) : <EOL> """<STR_LIT>""" <EOL> focus = wx . Window . FindFocus ( ) <EOL> if focus is not None and hasattr ( focus , "<STR_LIT>" ) and hasattr ( focus , "<STR_LIT>" ) and focus . CanPaste ( ) : <EOL> focus . Paste ( ) <EOL> @ staticmethod <EOL> def on_update_paste_ui ( event ) : <EOL> focus = wx . Window . FindFocus ( ) <EOL> event . Enable ( bool ( <EOL> focus and hasattr ( focus , '<STR_LIT>' ) and focus . CanPaste ( ) ) ) <EOL> @ staticmethod <EOL> def on_select_all ( event ) : <EOL> focus = wx . Window . FindFocus ( ) <EOL> if focus and hasattr ( focus , "<STR_LIT>" ) : <EOL> focus . SelectAll ( ) <EOL> @ staticmethod <EOL> def on_update_select_all_ui ( event ) : <EOL> focus = wx . Window . FindFocus ( ) <EOL> if hasattr ( focus , "<STR_LIT>" ) and not focus . CanSelect ( ) : <EOL> event . Enable ( False ) <EOL> return <EOL> event . Enable ( bool ( focus and hasattr ( focus , "<STR_LIT>" ) ) ) <EOL> debug_commands = ( ID_DEBUG_STEP , ID_DEBUG_NEXT_IMAGE_SET , <EOL> ID_DEBUG_NEXT_GROUP , ID_DEBUG_CHOOSE_GROUP , <EOL> ID_DEBUG_CHOOSE_IMAGE_SET , <EOL> ID_DEBUG_CHOOSE_RANDOM_IMAGE_SET , <EOL> ID_DEBUG_VIEW_WORKSPACE ) <EOL> def enable_debug_commands ( self ) : <EOL> """<STR_LIT>""" <EOL> startstop = self . __menu_debug . FindItemById ( ID_DEBUG_TOGGLE ) <EOL> self . __menu_file . Enable ( ID_FILE_ANALYZE_IMAGES , False ) <EOL> self . __menu_file . Enable ( ID_FILE_RESTART , False ) <EOL> self . __menu_file . Enable ( ID_FILE_RUN_MULTIPLE_PIPELINES , False ) <EOL> assert isinstance ( startstop , wx . MenuItem ) <EOL> startstop . Text = '<STR_LIT>' <EOL> startstop . Help = '<STR_LIT>' <EOL> for cmd in self . debug_commands : <EOL> self . __menu_debug . Enable ( cmd , True ) <EOL> def enable_launch_commands ( self ) : <EOL> """<STR_LIT>""" <EOL> startstop = self . __menu_debug . FindItemById ( ID_DEBUG_TOGGLE ) <EOL> startstop . Text = '<STR_LIT>' <EOL> startstop . Help = '<STR_LIT>' <EOL> for cmd in self . debug_commands : <EOL> self . __menu_debug . Enable ( cmd , False ) <EOL> self . __menu_file . Enable ( ID_FILE_ANALYZE_IMAGES , True ) <EOL> self . __menu_file . Enable ( ID_FILE_RESTART , True ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_TOGGLE , True ) <EOL> self . __menu_file . Enable ( ID_FILE_RUN_MULTIPLE_PIPELINES , True ) <EOL> self . __menu_file . Enable ( ID_FILE_STOP_ANALYSIS , False ) <EOL> def enable_analysis_commands ( self ) : <EOL> """<STR_LIT>""" <EOL> self . __menu_file . Enable ( ID_FILE_ANALYZE_IMAGES , False ) <EOL> self . __menu_file . Enable ( ID_FILE_RESTART , False ) <EOL> self . __menu_debug . Enable ( ID_DEBUG_TOGGLE , False ) <EOL> self . __menu_file . Enable ( ID_FILE_RUN_MULTIPLE_PIPELINES , False ) <EOL> self . __menu_file . Enable ( ID_FILE_STOP_ANALYSIS , True ) <EOL> @ staticmethod <EOL> def __on_widget_inspector ( evt ) : <EOL> try : <EOL> import wx . lib . inspection <EOL> wx . lib . inspection . InspectionTool ( ) . Show ( ) <EOL> except : <EOL> wx . MessageBox ( "<STR_LIT>" ) <EOL> @ staticmethod <EOL> def __on_preferences ( event ) : <EOL> dlg = cellprofiler . gui . preferencesdlg . PreferencesDlg ( ) <EOL> dlg . Show ( ) <EOL> def __on_close_all ( self , event ) : <EOL> cellprofiler . gui . cpfigure . close_all ( self ) <EOL> @ staticmethod <EOL> def __on_new_cp ( event ) : <EOL> import os <EOL> if not hasattr ( sys , '<STR_LIT>' ) : <EOL> os . system ( '<STR_LIT>' ) <EOL> else : <EOL> os . system ( '<STR_LIT>' ) <EOL> @ staticmethod <EOL> def __on_help_release_notes ( event ) : <EOL> import webbrowser <EOL> webbrowser . open ( "<STR_LIT>" ) <EOL> @ staticmethod <EOL> def __on_help_online_manual ( event ) : <EOL> import webbrowser <EOL> webbrowser . open ( "<STR_LIT>" ) <EOL> @ staticmethod <EOL> def __on_help_developers_guide ( event ) : <EOL> import webbrowser <EOL> webbrowser . open ( "<STR_LIT>" ) <EOL> @ staticmethod <EOL> def __on_help_source_code ( event ) : <EOL> import webbrowser <EOL> webbrowser . open ( "<STR_LIT>" ) <EOL> def __on_help_path_list ( self , event ) : <EOL> import htmldialog <EOL> dlg = htmldialog . HTMLDialog ( self , "<STR_LIT>" , cellprofiler . gui . help . HELP_ON_FILE_LIST ) <EOL> dlg . Show ( ) <EOL> @ staticmethod <EOL> def about ( event ) : <EOL> info = cellprofiler . gui . dialog . AboutDialogInfo ( ) <EOL> wx . AboutBox ( info ) <EOL> def __on_help_welcome ( self , event ) : <EOL> self . show_welcome_screen ( True ) <EOL> def __on_help_module ( self , event ) : <EOL> modules = self . __pipeline_list_view . get_selected_modules ( ) <EOL> active_module = self . __pipeline_list_view . get_active_module ( ) <EOL> if len ( modules ) > <NUM_LIT:0> : <EOL> self . do_help_modules ( modules ) <EOL> elif active_module is not None : <EOL> self . do_help_module ( active_module . module_name , <EOL> active_module . get_help ( ) ) <EOL> else : <EOL> wx . MessageBox ( cellprofiler . gui . help . HELP_ON_MODULE_BUT_NONE_SELECTED , <EOL> "<STR_LIT>" , <EOL> style = wx . OK | wx . ICON_INFORMATION ) <EOL> @ staticmethod <EOL> def __debug_pdb ( event ) : <EOL> pdb . set_trace ( ) <EOL> def do_help_modules ( self , modules ) : <EOL> for module in modules : <EOL> self . do_help_module ( module . module_name , module . get_help ( ) ) <EOL> def do_help_module ( self , module_name , help_text ) : <EOL> helpframe = wx . Frame ( self , - <NUM_LIT:1> , '<STR_LIT>' % <EOL> module_name , size = ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> helpframe . MenuBar = wx . MenuBar ( ) <EOL> sizer = wx . BoxSizer ( ) <EOL> helpframe . SetSizer ( sizer ) <EOL> window = cellprofiler . gui . html . htmlwindow . HtmlClickableWindow ( helpframe ) <EOL> sizer . Add ( window , <NUM_LIT:1> , wx . EXPAND ) <EOL> window . AppendToPage ( help_text ) <EOL> menu = wx . Menu ( ) <EOL> menu . Append ( ID_FILE_SAVE_PIPELINE , "<STR_LIT>" ) <EOL> menu . Append ( ID_FILE_PRINT , "<STR_LIT>" ) <EOL> menu . Append ( ID_FILE_EXIT , "<STR_LIT>" ) <EOL> def on_save ( event ) : <EOL> self . save_help ( event , module_name , help_text ) <EOL> def on_print ( event ) : <EOL> self . print_help ( event , module_name , help_text ) <EOL> def on_exit ( event ) : <EOL> helpframe . Close ( ) <EOL> helpframe . MenuBar . Append ( menu , '<STR_LIT>' ) <EOL> helpframe . Bind ( wx . EVT_MENU , on_save , id = ID_FILE_SAVE_PIPELINE ) <EOL> helpframe . Bind ( wx . EVT_MENU , on_print , id = ID_FILE_PRINT ) <EOL> helpframe . Bind ( wx . EVT_MENU , on_exit , id = ID_FILE_EXIT ) <EOL> menu = wx . Menu ( ) <EOL> copy_menu_item = menu . Append ( ID_EDIT_COPY , "<STR_LIT>" ) <EOL> copy_menu_item . Enable ( False ) <EOL> menu . Append ( ID_EDIT_SELECT_ALL , "<STR_LIT>" ) <EOL> def on_idle ( event ) : <EOL> copy_menu_item . Enable ( len ( window . SelectionToText ( ) ) > <NUM_LIT:0> ) <EOL> def on_edit_select_all ( event ) : <EOL> window . SelectAll ( ) <EOL> def on_copy ( event ) : <EOL> data_object = wx . TextDataObject ( window . SelectionToText ( ) ) <EOL> if wx . TheClipboard . Open ( ) : <EOL> try : <EOL> wx . TheClipboard . SetData ( data_object ) <EOL> wx . TheClipboard . Flush ( ) <EOL> finally : <EOL> wx . TheClipboard . Close ( ) <EOL> else : <EOL> wx . MessageBox ( "<STR_LIT>" , "<STR_LIT>" , <EOL> wx . OK | wx . ICON_ERROR ) <EOL> helpframe . MenuBar . Append ( menu , '<STR_LIT>' ) <EOL> helpframe . Bind ( wx . EVT_MENU , on_copy , id = ID_EDIT_COPY ) <EOL> helpframe . Bind ( wx . EVT_MENU , on_edit_select_all , id = ID_EDIT_SELECT_ALL ) <EOL> helpframe . Bind ( wx . EVT_IDLE , on_idle ) <EOL> accelerator_table = wx . AcceleratorTable ( <EOL> [ ( wx . ACCEL_CMD , ord ( '<STR_LIT>' ) , ID_FILE_EXIT ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT:P>' ) , ID_FILE_PRINT ) , <EOL> ( wx . ACCEL_CMD , ord ( '<STR_LIT:C>' ) , ID_EDIT_COPY ) ] ) <EOL> helpframe . SetAcceleratorTable ( accelerator_table ) <EOL> helpframe . SetIcon ( cellprofiler . gui . get_cp_icon ( ) ) <EOL> helpframe . Layout ( ) <EOL> helpframe . Show ( ) <EOL> @ staticmethod <EOL> def print_help ( event , module_name , help_text ) : <EOL> """<STR_LIT>""" <EOL> printer = wx . html . HtmlEasyPrinting ( "<STR_LIT>" % module_name , <EOL> event . GetEventObject ( ) ) <EOL> printer . GetPrintData ( ) . SetPaperId ( wx . PAPER_LETTER ) <EOL> printer . PrintText ( help_text ) <EOL> @ staticmethod <EOL> def save_help ( event , module_name , help_text ) : <EOL> """<STR_LIT>""" <EOL> save_dlg = wx . FileDialog ( event . GetEventObject ( ) , <EOL> message = "<STR_LIT>" % module_name , <EOL> defaultFile = "<STR_LIT>" % module_name , <EOL> wildcard = "<STR_LIT>" , <EOL> style = wx . FD_SAVE | wx . FD_OVERWRITE_PROMPT ) <EOL> result = save_dlg . ShowModal ( ) <EOL> if result == wx . ID_OK : <EOL> pathname = save_dlg . GetPath ( ) <EOL> fd = open ( pathname , "<STR_LIT>" ) <EOL> fd . write ( help_text ) <EOL> fd . close ( ) <EOL> def on_open_image ( self , event ) : <EOL> dlg = wx . FileDialog ( self , <EOL> message = "<STR_LIT>" , <EOL> wildcard = "<STR_LIT>" , <EOL> style = wx . FD_OPEN ) <EOL> if dlg . ShowModal ( ) == wx . ID_OK : <EOL> from cellprofiler . modules . loadimages import LoadImagesImageProvider <EOL> from cellprofiler . gui . cpfigure import CPFigureFrame <EOL> lip = LoadImagesImageProvider ( "<STR_LIT>" , "<STR_LIT>" , dlg . Path ) <EOL> image = lip . provide_image ( None ) . pixel_data <EOL> frame = CPFigureFrame ( self , title = dlg . Path , subplots = ( <NUM_LIT:1> , <NUM_LIT:1> ) ) <EOL> if image . ndim == <NUM_LIT:3> : <EOL> frame . subplot_imshow_color ( <NUM_LIT:0> , <NUM_LIT:0> , image , title = dlg . Path ) <EOL> else : <EOL> frame . subplot_imshow_grayscale ( <NUM_LIT:0> , <NUM_LIT:0> , image , title = dlg . Path ) <EOL> frame . panel . draw ( ) <EOL> def __attach_views ( self ) : <EOL> self . __pipeline_list_view = cellprofiler . gui . pipelinelistview . PipelineListView ( self . __module_list_panel , self ) <EOL> self . __pipeline_controller = cellprofiler . gui . pipelinecontroller . PipelineController ( self . __workspace , self ) <EOL> self . __pipeline_list_view . attach_to_pipeline ( self . __pipeline , self . __pipeline_controller ) <EOL> self . __pipeline_controller . attach_to_test_controls_panel ( self . __pipeline_test_panel ) <EOL> self . __pipeline_controller . attach_to_module_controls_panel ( self . __module_controls_panel ) <EOL> self . __pipeline_controller . attach_to_path_list_ctrl ( <EOL> self . __path_list_ctrl , <EOL> self . __path_list_filter_checkbox ) <EOL> self . __module_view = cellprofiler . gui . moduleview . ModuleView ( <EOL> self . __module_panel , <EOL> self . __workspace , <EOL> frame = self , <EOL> notes_panel = self . __notes_panel ) <EOL> self . __pipeline_controller . attach_to_module_view ( self . __module_view ) <EOL> self . __pipeline_list_view . attach_to_module_view ( self . __module_view ) <EOL> self . __preferences_view = cellprofiler . gui . preferencesview . PreferencesView ( <EOL> self . __right_win . Sizer , <EOL> self . __preferences_panel , <EOL> self . __progress_panel , <EOL> self . __status_panel ) <EOL> self . __preferences_view . attach_to_pipeline_list_view ( self . __pipeline_list_view ) <EOL> def __do_layout ( self ) : <EOL> width = wx . SystemSettings . GetMetric ( wx . SYS_SCREEN_X ) <EOL> height = wx . SystemSettings . GetMetric ( wx . SYS_SCREEN_Y ) <EOL> self . SetSize ( ( int ( width * <NUM_LIT:2> / <NUM_LIT:3> ) , int ( height * <NUM_LIT:2> / <NUM_LIT:3> ) ) ) <EOL> splitter = self . __splitter <EOL> right_win = self . __right_win <EOL> top_left_win = self . __left_win <EOL> self . __splitter . SetMinimumPaneSize ( <NUM_LIT> ) <EOL> self . __splitter . SplitVertically ( self . __left_win , self . __right_win , <NUM_LIT> ) <EOL> self . __splitter . BorderSize = <NUM_LIT:0> <EOL> self . __splitter . SashSize = <NUM_LIT:5> <EOL> top_left_sizer = wx . BoxSizer ( wx . VERTICAL ) <EOL> top_left_sizer . Add ( self . __module_list_panel , <NUM_LIT:1> , wx . EXPAND | wx . ALL , <NUM_LIT:1> ) <EOL> top_left_sizer . Add ( self . __module_controls_panel , <NUM_LIT:0> , wx . EXPAND | wx . ALL , <NUM_LIT:2> ) <EOL> top_left_sizer . Add ( self . __pipeline_test_panel , <NUM_LIT:0> , wx . EXPAND | wx . ALL , <NUM_LIT:2> ) <EOL> top_left_win . SetSizer ( top_left_sizer ) <EOL> border = wx . BoxSizer ( ) <EOL> border . Add ( splitter , <NUM_LIT:1> , wx . EXPAND | wx . ALL , <NUM_LIT:1> ) <EOL> self . SetSizer ( border ) <EOL> self . Layout ( ) <EOL> right_win . Layout ( ) <EOL> top_left_win . Layout ( ) <EOL> def __set_icon ( self ) : <EOL> self . SetIcon ( cellprofiler . gui . get_cp_icon ( ) ) <EOL> def __make_search_frame ( self ) : <EOL> """<STR_LIT>""" <EOL> background_color = cellprofiler . preferences . get_background_color ( ) <EOL> size = ( wx . SystemSettings . GetMetric ( wx . SYS_SCREEN_X ) / <NUM_LIT:2> , <EOL> wx . SystemSettings . GetMetric ( wx . SYS_SCREEN_Y ) / <NUM_LIT:2> ) <EOL> self . search_frame = wx . Frame ( <EOL> self , title = "<STR_LIT>" , <EOL> size = size , <EOL> style = wx . DEFAULT_FRAME_STYLE | wx . TAB_TRAVERSAL ) <EOL> self . search_frame . AutoLayout = True <EOL> self . search_frame . SetIcon ( cellprofiler . gui . get_cp_icon ( ) ) <EOL> self . search_frame . Sizer = wx . BoxSizer ( wx . VERTICAL ) <EOL> sizer = wx . BoxSizer ( wx . HORIZONTAL ) <EOL> self . search_frame . Sizer . Add ( sizer , <NUM_LIT:0> , wx . EXPAND | wx . ALL , <NUM_LIT:4> ) <EOL> sizer . Add ( wx . StaticText ( self . search_frame , label = "<STR_LIT>" ) , <NUM_LIT:0> , <EOL> wx . ALIGN_LEFT | wx . ALIGN_CENTER_VERTICAL ) <EOL> sizer . AddSpacer ( <NUM_LIT:2> ) <EOL> search_text_ctrl = wx . TextCtrl ( self . search_frame ) <EOL> sizer . Add ( search_text_ctrl , <NUM_LIT:1> , wx . EXPAND ) <EOL> search_button = wx . Button ( self . search_frame , label = "<STR_LIT>" ) <EOL> search_button . SetDefault ( ) <EOL> sizer . AddSpacer ( <NUM_LIT:2> ) <EOL> sizer . Add ( search_button , <NUM_LIT:0> , wx . EXPAND ) <EOL> html_window = cellprofiler . gui . html . htmlwindow . HtmlClickableWindow ( self . search_frame ) <EOL> self . search_frame . Sizer . Add ( html_window , <NUM_LIT:1> , wx . EXPAND | wx . ALL , <NUM_LIT:4> ) <EOL> def on_search ( event ) : <EOL> from cellprofiler . gui . html . manual import search_module_help <EOL> search_text = search_text_ctrl . Value <EOL> html = search_module_help ( search_text ) <EOL> if html is None : <EOL> so_sorry = """<STR_LIT>""" % ( search_text , search_text ) <EOL> html_window . SetPage ( so_sorry ) <EOL> else : <EOL> html_window . SetPage ( html ) <EOL> search_button . Bind ( wx . EVT_BUTTON , on_search ) <EOL> def on_link_clicked ( event ) : <EOL> """<STR_LIT>""" <EOL> linkinfo = event . GetLinkInfo ( ) <EOL> if linkinfo . GetHref ( ) [ <NUM_LIT:0> ] != "<STR_LIT:#>" : <EOL> event . Skip ( ) <EOL> return <EOL> html_window . ScrollToAnchor ( linkinfo . GetHref ( ) [ <NUM_LIT:1> : ] ) <EOL> html_window . ScrollLines ( - <NUM_LIT:1> ) <EOL> html_window . Bind ( wx . html . EVT_HTML_LINK_CLICKED , on_link_clicked ) <EOL> def on_close ( event ) : <EOL> assert isinstance ( event , wx . CloseEvent ) <EOL> self . search_frame . Hide ( ) <EOL> event . Veto ( ) <EOL> self . search_frame . Bind ( wx . EVT_CLOSE , on_close ) <EOL> self . search_frame . Layout ( ) <EOL> self . search_frame . SetIcon ( cellprofiler . gui . get_cp_icon ( ) ) <EOL> def __on_search_help ( self , event ) : <EOL> if self . search_frame is not None : <EOL> self . search_frame . Show ( ) <EOL> self . search_frame . Raise ( ) <EOL> def __make_startup_blurb_frame ( self ) : <EOL> """<STR_LIT>""" <EOL> background_color = cellprofiler . preferences . get_background_color ( ) <EOL> frame = self . startup_blurb_frame = wx . Frame ( <EOL> self , title = "<STR_LIT>" , <EOL> size = ( <NUM_LIT> , <NUM_LIT> ) , <EOL> name = cellprofiler . gui . html . htmlwindow . WELCOME_SCREEN_FRAME ) <EOL> frame . Sizer = wx . BoxSizer ( ) <EOL> content = cellprofiler . gui . html . htmlwindow . HtmlClickableWindow ( frame ) <EOL> content . load_startup_blurb ( ) <EOL> frame . Sizer . Add ( content , <NUM_LIT:1> , wx . EXPAND ) <EOL> frame . SetIcon ( cellprofiler . gui . get_cp_icon ( ) ) <EOL> def on_close ( event ) : <EOL> assert isinstance ( event , wx . CloseEvent ) <EOL> event . EventObject . Hide ( ) <EOL> event . Veto ( ) <EOL> frame . Bind ( wx . EVT_CLOSE , on_close ) <EOL> frame . Layout ( ) <EOL> def __on_data_tool ( self , event , tool_name ) : <EOL> module = cellprofiler . modules . instantiate_module ( tool_name ) <EOL> args , varargs , varkw , vardef = inspect . getargspec ( module . run_as_data_tool ) <EOL> if len ( args ) + ( <NUM_LIT:0> if varargs is None else len ( varargs ) ) == <NUM_LIT:1> : <EOL> module . run_as_data_tool ( ) <EOL> return <EOL> dlg = wx . FileDialog ( <EOL> self , "<STR_LIT>" % <EOL> tool_name , wildcard = "<STR_LIT>" , <EOL> style = ( wx . FD_OPEN | wx . FILE_MUST_EXIST ) ) <EOL> if dlg . ShowModal ( ) == wx . ID_OK : <EOL> cellprofiler . gui . datatoolframe . DataToolFrame ( self , <EOL> module_name = tool_name , <EOL> measurements_file_name = dlg . Path ) <EOL> def __on_data_tool_help ( self , event , tool_name ) : <EOL> module = cellprofiler . modules . instantiate_module ( tool_name ) <EOL> self . do_help_module ( tool_name , module . get_help ( ) ) <EOL> def display_error ( self , message , error ) : <EOL> """<STR_LIT>""" <EOL> for listener in self . __error_listeners : <EOL> listener ( message , error ) <EOL> tb = sys . exc_info ( ) [ <NUM_LIT:2> ] <EOL> traceback . print_tb ( tb ) <EOL> text = '<STR_LIT:\n>' . join ( traceback . format_list ( traceback . extract_tb ( tb ) ) ) <EOL> text = error . message + '<STR_LIT:\n>' + text <EOL> cellprofiler . gui . errordialog . display_error_message ( self , text , "<STR_LIT>" ) <EOL> def add_error_listener ( self , listener ) : <EOL> """<STR_LIT>""" <EOL> self . __error_listeners . append ( listener ) <EOL> def remove_error_listener ( self , listener ) : <EOL> """<STR_LIT>""" <EOL> self . __error_listeners . remove ( listener ) <EOL> def get_preferences_view ( self ) : <EOL> return self . __preferences_view <EOL> preferences_view = property ( get_preferences_view ) <EOL> def get_pipeline_controller ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . __pipeline_controller <EOL> pipeline_controller = property ( get_pipeline_controller ) <EOL> def get_pipeline ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . __pipeline <EOL> pipeline = property ( get_pipeline ) <EOL> def get_module_view ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . __module_view <EOL> module_view = property ( get_module_view ) <EOL> def get_pipeline_list_view ( self ) : <EOL> return self . __pipeline_list_view <EOL> pipeline_list_view = property ( get_pipeline_list_view ) <EOL> class CPSizer ( wx . PySizer ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , rows , cols , hungry_row , hungry_col ) : <EOL> wx . PySizer . __init__ ( self ) <EOL> self . __rows = rows <EOL> self . __cols = cols <EOL> self . __hungry_row = hungry_row <EOL> self . __hungry_col = hungry_col <EOL> self . __ignore_width = [ [ False for j in range ( <NUM_LIT:0> , rows ) ] for i in range ( <NUM_LIT:0> , cols ) ] <EOL> self . __ignore_height = [ [ False for j in range ( <NUM_LIT:0> , rows ) ] for i in range ( <NUM_LIT:0> , cols ) ] <EOL> def set_ignore_width ( self , col , row , ignore = True ) : <EOL> """<STR_LIT>""" <EOL> self . __ignore_width [ col ] [ row ] = ignore <EOL> def get_ignore_width ( self , col , row ) : <EOL> """<STR_LIT>""" <EOL> return self . __ignore_width [ col ] [ row ] <EOL> def set_ignore_height ( self , col , row , ignore = True ) : <EOL> """<STR_LIT>""" <EOL> self . __ignore_height [ col ] [ row ] = ignore <EOL> def get_ignore_height ( self , col , row ) : <EOL> """<STR_LIT>""" <EOL> return self . __ignore_height [ col ] [ row ] <EOL> def CalcMin ( self ) : <EOL> """<STR_LIT>""" <EOL> ( row_heights , col_widths ) = self . __get_min_sizes ( ) <EOL> return wx . Size ( sum ( col_widths ) , sum ( row_heights ) ) <EOL> def __get_min_sizes ( self ) : <EOL> row_heights = [ <NUM_LIT:0> for i in range ( <NUM_LIT:0> , self . __rows ) ] <EOL> col_widths = [ <NUM_LIT:0> for i in range ( <NUM_LIT:0> , self . __cols ) ] <EOL> idx = <NUM_LIT:0> <EOL> for item in self . GetChildren ( ) : <EOL> row , col = divmod ( idx , self . __rows ) <EOL> size = item . CalcMin ( ) <EOL> if not self . get_ignore_width ( col , row ) : <EOL> col_widths [ col ] = max ( col_widths [ col ] , size [ <NUM_LIT:0> ] ) <EOL> if not self . get_ignore_height ( col , row ) : <EOL> row_heights [ row ] = max ( row_heights [ row ] , size [ <NUM_LIT:1> ] ) <EOL> idx += <NUM_LIT:1> <EOL> return row_heights , col_widths <EOL> def RecalcSizes ( self ) : <EOL> """<STR_LIT>""" <EOL> ( row_heights , col_widths ) = self . __get_min_sizes ( ) <EOL> size = self . GetSize ( ) <EOL> leftover_width = size [ <NUM_LIT:0> ] - sum ( col_widths ) <EOL> leftover_height = size [ <NUM_LIT:1> ] - sum ( row_heights ) <EOL> col_widths [ self . __hungry_col ] += leftover_width <EOL> row_heights [ self . __hungry_row ] += leftover_height <EOL> idx = <NUM_LIT:0> <EOL> for item in self . GetChildren ( ) : <EOL> row , col = divmod ( idx , self . __rows ) <EOL> item_size = wx . Size ( col_widths [ col ] , row_heights [ row ] ) <EOL> item_pos = wx . Point ( sum ( col_widths [ : col ] ) , sum ( row_heights [ : row ] ) ) <EOL> item . SetDimension ( item_pos , item_size ) <EOL> idx += <NUM_LIT:1> </s>
