def __init__(self, parent, current_colormap):
# call widget init
QDialog.__init__(self, parent)
# define available colormaps
colormaps = ['bwr', 'gnuplot', 'gnuplot2', 'inferno', 'nipy_spectral', 'seismic', 'viridis']
# load and set up UI
self.ui = UiColormapDialog(self)
# fill combobox with colormaps
current_id = 0
for i_colormap in range(len(colormaps)):
if colormaps[i_colormap] == current_colormap:
current_id = i_colormap
self.ui.colormap_combobox.addItem(QIcon('./img/cm_'+colormaps[i_colormap]+'.png'), colormaps[i_colormap])
self.ui.colormap_combobox.setCurrentIndex(current_id)
评论列表
文章目录