4 def __init__(self, context):
11 self.window_manager = context.window_manager
12 self.window_manager.progress_begin(0.0, 1.0)
14 self.window_manager = None
16 def push_task(self, task, low, high):
17 self.stack.append((self.task, self.start, self.delta))
18 self.set_task(task, low, high)
20 def push_task_slice(self, task, index, count):
21 self.push_task(task, index/count, (index+1)/count)
27 self.set_progress(1.0)
28 self.task, self.start, self.delta = self.stack.pop()
30 def set_task(self, task, low, high):
32 outer = self.stack[-1]
34 task = "{}: {}".format(outer[0], task)
35 low = outer[1]+low*outer[2]
36 high = outer[1]+high*outer[2]
42 self.set_progress(0.0)
44 def set_task_slice(self, task, index, count):
45 self.set_task(task, index/count, (index+1)/count)
47 def set_progress(self, value):
48 value = self.start+self.delta*value
49 if value>self.last+0.01:
50 if self.window_manager:
51 self.window_manager.progress_update(value)
55 def linear_to_srgb(l):
59 return 1.055*(l**(1/2.4))-0.055
61 def get_colormap(srgb):
70 return os.path.split(fp)[1]