Skip to content

Commit

Permalink
change status line from a <div> to a <p> so that long lines can wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
schiebel committed Jan 26, 2024
1 parent 0b30c64 commit 7abf9cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
24 changes: 12 additions & 12 deletions casagui/apps/_interactiveclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,12 @@ def __init__( self, vis, imagename, usemask='user', mask='', initial_mask_pixel=
'Stopping criteria encountered',
'Unrecognized stop code' ]
if ( typeof status === 'number' ) {
stopstatus.text = '<div>' +
stopstatus.text = '<p>' +
stopstr[ status < 0 || status >= stopstr.length ?
stopstr.length - 1 : status ] +
'</div>'
'</p>'
} else {
stopstatus.text = `<div>${status}</div>`
stopstatus.text = `<p>${status}</p>`
}
}''',

Expand Down Expand Up @@ -685,7 +685,7 @@ def _launch_gui( self ):
self._init_pipes( )

self._status['log'] = self._clean.cmds( )
self._status['stopcode']= self._cube.status_text( "<div>initial residual image</div>" if image_channels > 1 else "<div>initial <b>single-channel</b> residual image</div>" )
self._status['stopcode']= self._cube.status_text( "<p>initial residual image</p>" if image_channels > 1 else "<p>initial <b>single-channel</b> residual image</p>", width=230 )

###
### Python-side handler for events from the interactive clean control buttons
Expand Down Expand Up @@ -928,33 +928,33 @@ def convergence_handler( msg, self=self ):
code='''let values = cb_obj.value.split(/[ ,]+/).map((v,) => parseInt(v))
if ( values.length > 2 ) {
status._error_set = true
status.text = '<div>enter at most two indexes</div>'
status.text = '<p>enter at most two indexes</p>'
} else if ( values.filter((x) => x < 0 || isNaN(x)).length > 0 ) {
status._error_set = true
status.text = '<div>invalid channel entered</div>'
status.text = '<p>invalid channel entered</p>'
} else {
if ( status._error_set ) {
status._error_set = false
status.text = '<div/>'
status.text = '<p/>'
}
if ( values.length == 1 ) {
if ( values[0] >= 0 && values[0] < img.num_chans[1] ) {
status.text= `<div>moving to channel ${values[0]}</div>`
status.text= `<p>moving to channel ${values[0]}</p>`
slider.value = values[0]
} else {
status._error_set = true
status.text = `<div>channel ${values[0]} out of range</div>`
status.text = `<p>channel ${values[0]} out of range</p>`
}
} else if ( values.length == 2 ) {
if ( values[0] < 0 || values[0] >= img.num_chans[1] ) {
status._error_set = true
status.text = `<div>channel ${values[0]} out of range</div>`
status.text = `<p>channel ${values[0]} out of range</p>`
} else {
if ( values[1] < 0 || values[1] >= img.num_chans[0] ) {
status._error_set = true
status.text = `<div>stokes ${values[1]} out of range</div>`
status.text = `<p>stokes ${values[1]} out of range</p>`
} else {
status.text= `<div>moving to channel ${values[0]}/${values[1]}</div>`
status.text= `<p>moving to channel ${values[0]}/${values[1]}</p>`
slider.value = values[0]
img.channel( values[0], values[1] )
}
Expand Down
16 changes: 8 additions & 8 deletions casagui/toolbox/_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from bokeh.events import SelectionGeometry, MouseEnter, MouseLeave, Pan, PanStart, PanEnd
from bokeh.models import CustomJS, CustomAction, Slider, PolyAnnotation, Div, Span, HoverTool, TableColumn, \
DataTable, Select, ColorPicker, Spinner, Select, Button, PreText, Dropdown, \
LinearColorMapper, TextInput, Spacer, InlineStyleSheet
LinearColorMapper, TextInput, Spacer, InlineStyleSheet, Paragraph
from bokeh.models import WheelZoomTool, LassoSelectTool
from bokeh.models import BasicTickFormatter
from bokeh.plotting import ColumnDataSource, figure
Expand Down Expand Up @@ -201,7 +201,7 @@ def __init__( self, image, mask=None, abort=None ):
value: { chan: source.cur_chan,
src: mask_region_ds._src_chan } },
mask_mod_result )
} else if ( status ) status.text = '<div>no region found</div>'
} else if ( status ) status.text = '<p>no region found</p>'
}
function mask_sub_chan( ) {
if ( annotations[0].xs.length > 0 && annotations[0].ys.length > 0 ) {
Expand All @@ -219,7 +219,7 @@ def __init__( self, image, mask=None, abort=None ):
value: { chan: source.cur_chan,
src: mask_region_ds._src_chan } },
mask_mod_result )
} else if ( status ) status.text = '<div>no region found</div>'
} else if ( status ) status.text = '<p>no region found</p>'
}
function mask_add_cube( ) {
if ( annotations[0].xs.length > 0 && annotations[0].ys.length > 0 ) {
Expand All @@ -237,7 +237,7 @@ def __init__( self, image, mask=None, abort=None ):
value: { chan: source.cur_chan,
src: mask_region_ds._src_chan } },
mask_mod_result )
} else if ( status ) status.text = '<div>no region found</div>'
} else if ( status ) status.text = '<p>no region found</p>'
}
function mask_sub_cube( ) {
if ( annotations[0].xs.length > 0 && annotations[0].ys.length > 0 ) {
Expand All @@ -255,7 +255,7 @@ def __init__( self, image, mask=None, abort=None ):
value: { chan: source.cur_chan,
src: mask_region_ds._src_chan } },
mask_mod_result )
} else if ( status ) status.text = '<div>no region found</div>'
} else if ( status ) status.text = '<p>no region found</p>'
}''',
'bitmask-hotkey-setup': '''
function state_translate_selection( dx, dy ) {
Expand Down Expand Up @@ -556,7 +556,7 @@ def __init__( self, image, mask=None, abort=None ):
mask_region_ds._src_chan = source.cur_chan
mask_region_button.icon = mask_region_icons['on']
} else {
if ( status ) status.text = '<div>no region found</div>'
if ( status ) status.text = '<p>no region found</p>'
return
}
region.fill_color = 'rgba(0, 0, 0, 0)'
Expand Down Expand Up @@ -1855,8 +1855,8 @@ def coord_ctrl( self ):

return self._coord_ctrl_group

def status_text( self, text='' ):
self._status_div = Div( text=text )
def status_text( self, text='', **kw ):
self._status_div = set_attributes( Paragraph( text=text ), **kw )
return self._status_div

def pixel_tracking_text( self ):
Expand Down

0 comments on commit 7abf9cc

Please sign in to comment.