def test_get_enabled_4d_filled_contour_qplt(self): cube = tcl.setup_4d_cube() dim_1_name = 'time' dim_2_name = 'grid_longitude' status = {'cube loaded': True, 'plot method': 'using quickplot', 'plot type': 'Filled Contour', 'cube': cube, 'dim 1 name': dim_1_name, 'dim 2 name': dim_2_name, 'projection': 'Automatic'} state = gl.get_enabled(status) expected_state = {'previous': True, 'next': True, 'source code': True, 'cartographic': False, 'labels': False, 'colorbar': True, 'plot type': True, 'colormap': True, 'contour slider': True, 'third dim': True, 'central longitude': False, 'update': True} difference = compare_dict(state, expected_state) self.assertIsNone(difference)
def test_get_enabled_2d_pcolormesh_data(self): cube = tcl.setup_2d_cube() dim_1_name = 'latitude' dim_2_name = 'longitude' status = {'cube loaded': True, 'plot method': 'from data array', 'plot type': 'pcolormesh', 'cube': cube, 'dim 1 name': dim_1_name, 'dim 2 name': dim_2_name, 'projection': 'Automatic'} state = gl.get_enabled(status) expected_state = {'previous': False, 'next': False, 'source code': True, 'cartographic': False, 'labels': False, 'colorbar': True, 'plot type': True, 'colormap': True, 'contour slider': False, 'third dim': False, 'central longitude': False, 'update': True} difference = compare_dict(state, expected_state) self.assertIsNone(difference)
def set_enabled(self): """ This function controls which objects in the main window are enabled at any point. It is called whenever the user makes a change to the window. """ status = self.get_status() state = gl.get_enabled(status) self.can_draw_map = state['cartographic'] if self.can_draw_map is False: self.select_projection.setCurrentIndex(0) self.colorbar_dialog.disable_fixed_colorbar(self.ndim) self.action_previous_slice.setEnabled(state['previous']) self.action_next_slice.setEnabled(state['next']) self.action_source_code.setEnabled(state['source code']) self.action_coastlines.setEnabled(state['cartographic']) self.action_contour_labels.setEnabled(state['labels']) self.action_country_boundaries.setEnabled(state['cartographic']) self.action_rivers_and_lakes.setEnabled(state['cartographic']) self.action_colorbar.setEnabled(state['colorbar']) self.select_projection.setEnabled(state['cartographic']) self.select_central_longitude.setEnabled(state['central longitude']) self.select_plot_type.setEnabled(state['plot type']) self.select_colormap.setEnabled(state['colormap']) self.contour_slider.setEnabled(state['contour slider']) self.select_sliced_dim.setEnabled(state['third dim']) self.select_slice_combo.setEnabled(state['third dim']) self.select_slice_scroll.setEnabled(state['third dim']) self.update_button.setEnabled(state['update'])
def test_get_enabled_4d_filled_contour_qplt(self): cube = tcl.setup_4d_cube() dim_1_name = 'time' dim_2_name = 'grid_longitude' status = { 'cube loaded': True, 'plot method': 'using quickplot', 'plot type': 'Filled Contour', 'cube': cube, 'dim 1 name': dim_1_name, 'dim 2 name': dim_2_name, 'projection': 'Automatic' } state = gl.get_enabled(status) expected_state = { 'previous': True, 'next': True, 'source code': True, 'cartographic': False, 'labels': False, 'colorbar': True, 'plot type': True, 'colormap': True, 'contour slider': True, 'third dim': True, 'central longitude': False, 'update': True } difference = compare_dict(state, expected_state) self.assertIsNone(difference)
def test_get_enabled_2d_pcolormesh_data(self): cube = tcl.setup_2d_cube() dim_1_name = 'latitude' dim_2_name = 'longitude' status = { 'cube loaded': True, 'plot method': 'from data array', 'plot type': 'pcolormesh', 'cube': cube, 'dim 1 name': dim_1_name, 'dim 2 name': dim_2_name, 'projection': 'Automatic' } state = gl.get_enabled(status) expected_state = { 'previous': False, 'next': False, 'source code': True, 'cartographic': False, 'labels': False, 'colorbar': True, 'plot type': True, 'colormap': True, 'contour slider': False, 'third dim': False, 'central longitude': False, 'update': True } difference = compare_dict(state, expected_state) self.assertIsNone(difference)
def set_enabled(self): """ This function controls which objects in the main window are enabled at any point. It is called whenever the user makes a change to the window. """ status = self.get_status() state = gl.get_enabled(status) self.can_draw_map = state['cartographic'] if self.can_draw_map is False: self.select_projection.setCurrentIndex(0) self.colorbar_dialog.disable_fixed_colorbar(self.ndim) self.action_previous_slice.setEnabled(state['previous']) self.action_next_slice.setEnabled(state['next']) self.action_source_code.setEnabled(state['source code']) self.action_coastlines.setEnabled(state['cartographic']) self.action_contour_labels.setEnabled(state['labels']) self.action_country_boundaries.setEnabled(state['cartographic']) self.action_rivers_and_lakes.setEnabled(state['cartographic']) self.action_colorbar.setEnabled(state['colorbar']) self.select_projection.setEnabled(state['cartographic']) self.select_central_longitude.setEnabled(state['central longitude']) self.select_plot_type.setEnabled(state['plot type']) self.select_colormap.setEnabled(state['colormap']) self.contour_slider.setEnabled(state['contour slider']) self.contour_label_frame.setEnabled(state['contour slider']) self.select_sliced_dim.setEnabled(state['third dim']) self.select_slice_combo.setEnabled(state['third dim']) self.select_slice_scroll.setEnabled(state['third dim']) self.update_button.setEnabled(state['update'])