wolfhece.PyPalette._gui

Author: HECE - University of Liege, Pierre Archambeau Date: 2024

Copyright (c) 2024 University of Liege. All rights reserved.

This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.

Module Contents

class wolfhece.PyPalette._gui.wolfpalette(parent=None, title=_('Colormap'), w=100, h=500, nseg=1024)[source]

Bases: wolfhece.PyPalette._model.wolfpaletteModel, wx.Frame

Inheritance diagram of wolfhece.PyPalette._gui.wolfpalette

Color palette with wxPython GUI support.

Inherits all data/computation logic from wolfpaletteModel and adds wx.Frame initialization, dialog-based file I/O, and CpGrid integration.

wx_exists[source]
distribute_values(minval: float = -99999, maxval: float = -99999, step=0, wx_permitted=True)[source]

Distribution of the palette values

Parameters:
  • minval – minimum value

  • maxval – maximum value

  • step – distribution step

  • wx_permitted – if True and wx app exists, show dialogs for missing values

If the step is provided, it takes precedence over the maximum value.

export_image(fn='', h_or_v=None, figax=None)[source]

Export image from colormap — with wx.FileDialog fallback when fn is empty.

readfile(*args)[source]

Read the palette from a WOLF .pal file — with wx.FileDialog when no path given.

savefile(*args)[source]

Save the palette to a WOLF .pal file — with wx.FileDialog when no path given.

lookupcolor(x)[source]
lookupcolorflt(x)[source]

Lookup interpolated color for value x.

Returns:

[r, g, b, a] list with float values 0.0-1.0

lookupcolorrgb(x)[source]

Lookup interpolated color for value x.

Returns:

(r, g, b, a) tuple with int values 0-255

fillgrid(gridto: wolfhece.CpGrid.CpGrid)[source]

Fill a grid with the palette values

updatefromgrid(gridfrom: wolfhece.CpGrid.CpGrid)[source]

Update the palette based on a grid