#NEWLINE# def createControlPanel( self ) : #NEWLINE# #INDENT# ctrlpanel = wx . Panel ( self , name = 'Ctrl Panel' ) #NEWLINE# ptable = PeriodicTablePanel ( ctrlpanel , onselect = self . onShowLines , tooltip_msg = 'Select Element for KLM Lines' ) #NEWLINE# self . wids [ 'ptable' ] = ptable #NEWLINE# labstyle = ( ( wx . ALIGN_LEFT | wx . ALIGN_BOTTOM ) | wx . EXPAND ) #NEWLINE# ctrlstyle = ( wx . ALIGN_LEFT | wx . ALIGN_BOTTOM ) #NEWLINE# txtstyle = ( ( wx . ALIGN_LEFT | wx . ST_NO_AUTORESIZE ) | wx . TE_PROCESS_ENTER ) #NEWLINE# Font9 = Font ( 9 ) #NEWLINE# Font10 = Font ( 10 ) #NEWLINE# Font11 = Font ( 11 ) #NEWLINE# arrowpanel = wx . Panel ( ctrlpanel ) #NEWLINE# ssizer = wx . BoxSizer ( wx . HORIZONTAL ) #NEWLINE# for ( wname , dname ) in ( ( 'uparrow' , 'up' ) , ( 'leftarrow' , 'left' ) , ( 'rightarrow' , 'right' ) , ( 'downarrow' , 'down' ) ) : #NEWLINE# #INDENT# self . wids [ wname ] = wx . BitmapButton ( arrowpanel , ( - 1 ) , get_icon ( wname ) , size = ( 25 , 25 ) , style = wx . NO_BORDER ) #NEWLINE# self . wids [ wname ] . Bind ( wx . EVT_BUTTON , partial ( ptable . onKey , name = dname ) ) #NEWLINE# ssizer . Add ( self . wids [ wname ] , 0 , ( wx . EXPAND | wx . ALL ) ) #NEWLINE# #UNINDENT# self . wids [ 'kseries' ] = Check ( arrowpanel , ' K ' , action = self . onKLM ) #NEWLINE# self . wids [ 'lseries' ] = Check ( arrowpanel , ' L ' , action = self . onKLM ) #NEWLINE# self . wids [ 'mseries' ] = Check ( arrowpanel , ' M ' , action = self . onKLM ) #NEWLINE# self . wids [ 'holdbtn' ] = wx . ToggleButton ( arrowpanel , ( - 1 ) , 'Hold   ' , size = ( 65 , 25 ) ) #NEWLINE# self . wids [ 'holdbtn' ] . Bind ( wx . EVT_TOGGLEBUTTON , self . onToggleHold ) #NEWLINE# ssizer . Add ( txt ( arrowpanel , '  ' ) , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# ssizer . Add ( self . wids [ 'holdbtn' ] , 0 , ( wx . EXPAND | wx . ALL ) , 2 ) #NEWLINE# ssizer . Add ( self . wids [ 'kseries' ] , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# ssizer . Add ( self . wids [ 'lseries' ] , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# ssizer . Add ( self . wids [ 'mseries' ] , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# pack ( arrowpanel , ssizer ) #NEWLINE# rsizer = wx . GridBagSizer ( 4 , 6 ) #NEWLINE# roipanel = wx . Panel ( ctrlpanel , name = 'ROI Panel' ) #NEWLINE# self . wids [ 'roilist' ] = wx . ListBox ( roipanel , size = ( 135 , 120 ) ) #NEWLINE# self . wids [ 'roilist' ] . Bind ( wx . EVT_LISTBOX , self . onROI ) #NEWLINE# self . wids [ 'roilist' ] . SetMinSize ( ( 135 , 120 ) ) #NEWLINE# self . wids [ 'roiname' ] = wx . TextCtrl ( roipanel , ( - 1 ) , '' , size = ( 150 , ( - 1 ) ) ) #NEWLINE# roibtns = wx . Panel ( roipanel , name = 'ROIButtons' ) #NEWLINE# zsizer = wx . BoxSizer ( wx . HORIZONTAL ) #NEWLINE# z1 = Button ( roibtns , 'Add' , size = ( 70 , 30 ) , action = self . onNewROI ) #NEWLINE# z2 = Button ( roibtns , 'Delete' , size = ( 70 , 30 ) , action = self . onConfirmDelROI ) #NEWLINE# z3 = Button ( roibtns , 'Rename' , size = ( 70 , 30 ) , action = self . onRenameROI ) #NEWLINE# zsizer . Add ( z1 , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# zsizer . Add ( z2 , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# zsizer . Add ( z3 , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# pack ( roibtns , zsizer ) #NEWLINE# rt1 = txt ( roipanel , ' Channels:' , size = 75 , font = Font9 ) #NEWLINE# rt2 = txt ( roipanel , ' Energy:' , size = 75 , font = Font9 ) #NEWLINE# rt3 = txt ( roipanel , ' Cen/Wid:' , size = 75 , font = Font9 ) #NEWLINE# m = '' #NEWLINE# self . wids [ 'roi_msg1' ] = txt ( roipanel , m , size = 135 , font = Font9 ) #NEWLINE# self . wids [ 'roi_msg2' ] = txt ( roipanel , m , size = 135 , font = Font9 ) #NEWLINE# self . wids [ 'roi_msg3' ] = txt ( roipanel , m , size = 135 , font = Font9 ) #NEWLINE# rsizer . Add ( txt ( roipanel , ' Regions of Interest:' , size = 125 , font = Font11 ) , ( 0 , 0 ) , ( 1 , 3 ) , labstyle ) #NEWLINE# rsizer . Add ( self . wids [ 'roiname' ] , ( 1 , 0 ) , ( 1 , 3 ) , labstyle ) #NEWLINE# rsizer . Add ( roibtns , ( 2 , 0 ) , ( 1 , 3 ) , labstyle ) #NEWLINE# rsizer . Add ( rt1 , ( 3 , 0 ) , ( 1 , 1 ) , LEFT ) #NEWLINE# rsizer . Add ( rt2 , ( 4 , 0 ) , ( 1 , 1 ) , LEFT ) #NEWLINE# rsizer . Add ( rt3 , ( 5 , 0 ) , ( 1 , 1 ) , LEFT ) #NEWLINE# rsizer . Add ( self . wids [ 'roi_msg1' ] , ( 3 , 1 ) , ( 1 , 2 ) , labstyle ) #NEWLINE# rsizer . Add ( self . wids [ 'roi_msg2' ] , ( 4 , 1 ) , ( 1 , 2 ) , labstyle ) #NEWLINE# rsizer . Add ( self . wids [ 'roi_msg3' ] , ( 5 , 1 ) , ( 1 , 2 ) , labstyle ) #NEWLINE# rsizer . Add ( self . wids [ 'roilist' ] , ( 0 , 3 ) , ( 6 , 1 ) , ( ( wx . EXPAND | wx . ALL ) | wx . ALIGN_RIGHT ) ) #NEWLINE# rsizer . SetHGap ( 1 ) #NEWLINE# pack ( roipanel , rsizer ) #NEWLINE# yscalepanel = wx . Panel ( ctrlpanel , name = 'YScalePanel' ) #NEWLINE# ysizer = wx . BoxSizer ( wx . HORIZONTAL ) #NEWLINE# ytitle = txt ( yscalepanel , ' Y Axis:' , font = Font10 , size = 80 ) #NEWLINE# yspace = txt ( yscalepanel , ' ' , font = Font10 , size = 20 ) #NEWLINE# ylog = Choice ( yscalepanel , size = ( 80 , 30 ) , choices = [ 'log' , 'linear' ] , action = self . onLogLinear ) #NEWLINE# yaxis = Check ( yscalepanel , ' Show Y Scale ' , action = self . onYAxis , default = False ) #NEWLINE# self . wids [ 'show_yaxis' ] = yaxis #NEWLINE# ysizer . Add ( ytitle , 0 , ( wx . ALIGN_CENTER_VERTICAL | wx . ALL ) , 0 ) #NEWLINE# ysizer . Add ( ylog , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# ysizer . Add ( yspace , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# ysizer . Add ( yaxis , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# pack ( yscalepanel , ysizer ) #NEWLINE# zoompanel = wx . Panel ( ctrlpanel , name = 'ZoomPanel' ) #NEWLINE# zsizer = wx . BoxSizer ( wx . HORIZONTAL ) #NEWLINE# z1 = Button ( zoompanel , 'Zoom In' , size = ( 80 , 30 ) , action = self . onZoomIn ) #NEWLINE# z2 = Button ( zoompanel , 'Zoom Out' , size = ( 80 , 30 ) , action = self . onZoomOut ) #NEWLINE# p1 = Button ( zoompanel , 'Pan Lo' , size = ( 75 , 30 ) , action = self . onPanLo ) #NEWLINE# p2 = Button ( zoompanel , 'Pan Hi' , size = ( 75 , 30 ) , action = self . onPanHi ) #NEWLINE# zsizer . Add ( p1 , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# zsizer . Add ( p2 , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# zsizer . Add ( z1 , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# zsizer . Add ( z2 , 0 , ( wx . EXPAND | wx . ALL ) , 0 ) #NEWLINE# pack ( zoompanel , zsizer ) #NEWLINE# self . wids [ 'xray_lines' ] = None #NEWLINE# if HAS_DV : #NEWLINE# #INDENT# dvstyle = ( ( dv . DV_SINGLE | dv . DV_VERT_RULES ) | dv . DV_ROW_LINES ) #NEWLINE# xlines = dv . DataViewListCtrl ( ctrlpanel , style = dvstyle ) #NEWLINE# self . wids [ 'xray_lines' ] = xlines #NEWLINE# xlines . AppendTextColumn ( 'Line  ' , width = 55 ) #NEWLINE# xlines . AppendTextColumn ( 'Energy(keV)  ' , width = 110 ) #NEWLINE# xlines . AppendTextColumn ( 'Strength  ' , width = 85 ) #NEWLINE# xlines . AppendTextColumn ( 'Levels  ' , width = 75 ) #NEWLINE# for col in ( 0 , 1 , 2 , 3 ) : #NEWLINE# #INDENT# this = xlines . Columns [ col ] #NEWLINE# this . Sortable = True #NEWLINE# align = RIGHT #NEWLINE# if ( col in ( 0 , 3 ) ) : #NEWLINE# #INDENT# align = wx . ALIGN_LEFT #NEWLINE# #UNINDENT# this . Alignment = this . Renderer . Alignment = align #NEWLINE# #UNINDENT# xlines . SetMinSize ( ( 300 , 240 ) ) #NEWLINE# xlines . Bind ( dv . EVT_DATAVIEW_SELECTION_CHANGED , self . onSelectXrayLine ) #NEWLINE# #UNINDENT# store = xlines . GetStore ( ) #NEWLINE# sizer = wx . BoxSizer ( wx . VERTICAL ) #NEWLINE# sizer . Add ( roipanel , 0 , labstyle ) #NEWLINE# sizer . Add ( lin ( ctrlpanel , 195 ) , 0 , labstyle ) #NEWLINE# sizer . Add ( yscalepanel , 0 , ( ( wx . ALIGN_RIGHT | wx . EXPAND ) | wx . ALL ) ) #NEWLINE# sizer . Add ( zoompanel , 0 , ( ( wx . ALIGN_RIGHT | wx . EXPAND ) | wx . ALL ) ) #NEWLINE# sizer . Add ( lin ( ctrlpanel , 195 ) , 0 , labstyle ) #NEWLINE# sizer . Add ( ptable , 0 , ( ( wx . ALIGN_RIGHT | wx . EXPAND ) | wx . ALL ) , 4 ) #NEWLINE# sizer . Add ( arrowpanel , 0 , labstyle ) #NEWLINE# sizer . Add ( lin ( ctrlpanel , 195 ) , 0 , labstyle ) #NEWLINE# if ( self . wids [ 'xray_lines' ] is not None ) : #NEWLINE# #INDENT# sizer . Add ( xlines , 0 , ( ( ( wx . ALIGN_CENTER | wx . GROW ) | wx . ALL ) | wx . EXPAND ) ) #NEWLINE# #UNINDENT# pack ( ctrlpanel , sizer ) #NEWLINE# return ctrlpanel