'This is implemented for handling negative values in index for
3d arrays, to give the same behavior as slicing'

def change_active_widget(self, index):

    string_index = ([':'] * 3)
    string_index[self.last_dim] = '<font    color=red>%i</font>'
    self.slicing_label.setText(((('Slicing:    [' + ',    '.join(string_index)) + ']') % index))
    if (index < 0):
        data_index = (self.data.shape[self.last_dim] + index)
    else:
        data_index = index
    slice_index = ([slice(None)] * 3)
    slice_index[self.last_dim] = data_index
    stack_index = self.dim_indexes[self.last_dim].get(data_index)
    if (stack_index == None):
        stack_index = self.stack.count()
        self.stack.addWidget(ArrayEditorWidget(self, self.data[slice_index]))
        self.dim_indexes[self.last_dim][data_index] = stack_index
        self.stack.update()
    self.stack.setCurrentIndex(stack_index)
