return if self.colorv is not None: (c1, c2, c3) = (self.colorv.getRed(), self.colorv.getGreen(), self.colorv.getBlue()) if not self.rgb_selector.get_active(): (c1, c2, c3) = color.hsv_from_rgb(c1, c2, c3) self.text1.set_text( ` c1 `) self.text2.set_text( ` c2 `) self.text3.set_text( ` c3 `) else: self.text1.set_text("") self.text2.set_text("") self.text3.set_text("") def image_changed(self, modifier, image): self.update(self.toolbox.currentPixel()) def nonsense(self): debug.mainthreadTest() self.colorv = "Nonsense" debug.mainthreadTest() self.imagetext.set_text('???') self.text1.set_text('???') self.text2.set_text('???') self.text3.set_text('???') pixelinfoplugin.registerPlugInClass(ImagePlugIn)
self.sbcb = switchboard.requestCallbackMain( 'materials changed in microstructure', self.matchanged) def close(self): switchboard.removeCallback(self.sbcb) pixelinfoplugin.PixelInfoPlugIn.close(self) def update(self, where): debug.mainthreadTest() microstructure = self.toolbox.findMicrostructure() if microstructure and where is not None: mat = material.getMaterialFromPoint(microstructure, where) if mat: self.materialtext.set_text(mat.name()) return self.materialtext.set_text('<No material>') def clear(self): debug.mainthreadTest() self.materialtext.set_text("") def nonsense(self): debug.mainthreadTest() self.materialtext.set_text('???') def matchanged(self, ms): if ms is self.toolbox.findMicrostructure(): self.update(self.toolbox.currentPixel()) pixelinfoplugin.registerPlugInClass(MaterialPlugIn)
]) newvalue = klass(*reg.from_base(None, base)) self.param.value = newvalue self.widget.set(newvalue, interactive=False) self.set_mode("widget") self.label.set_text('Orientation=\n(%s)' % source) else: # orientsource is None self.text.set_text("<No Orientation>") self.set_mode("text") self.label.set_text('Orientation=') else: # microstructure is None or where is None self.text.set_text("<No Microstructure>") self.set_mode("text") self.label.set_text('Orientation=') def widgetcb(self, *args, **kwargs): self.param.value = self.widget.get_value() def clear(self): debug.mainthreadTest() self.set_mode("text") self.text.set_text("---") def nonsense(self): debug.mainthreadTest() self.set_mode("text") self.text.set_text("???") pixelinfoplugin.registerPlugInClass(OrientMapPixelInfoPlugIn)
self.param.value = newvalue self.widget.set(newvalue, interactive=False) self.set_mode("widget") self.label.set_text('Orientation=\n(%s)' % source) else: # orientsource is None self.text.set_text("<No Orientation>") self.set_mode("text") self.label.set_text('Orientation=') else: # microstructure is None or where is None self.text.set_text("<No Microstructure>") self.set_mode("text") self.label.set_text('Orientation=') def widgetcb(self, *args, **kwargs): self.param.value = self.widget.get_value() def clear(self): debug.mainthreadTest() self.set_mode("text") self.text.set_text("---") def nonsense(self): debug.mainthreadTest() self.set_mode("text") self.text.set_text("???") pixelinfoplugin.registerPlugInClass(OrientMapPixelInfoPlugIn)
'materials changed in microstructure', self.matchanged) def close(self): switchboard.removeCallback(self.sbcb) pixelinfoplugin.PixelInfoPlugIn.close(self) def update(self, where): debug.mainthreadTest() microstructure = self.toolbox.findMicrostructure() if microstructure and where is not None: mat = material.getMaterialFromPoint(microstructure, where) if mat: self.materialtext.set_text(mat.name()) return self.materialtext.set_text('<No material>') def clear(self): debug.mainthreadTest() self.materialtext.set_text("") def nonsense(self): debug.mainthreadTest() self.materialtext.set_text('???') def matchanged(self, ms): if ms is self.toolbox.findMicrostructure(): self.update(self.toolbox.currentPixel()) pixelinfoplugin.registerPlugInClass(MaterialPlugIn)
if self.colorv == -1: return if self.colorv is not None: (c1, c2, c3) = (self.colorv.getRed(), self.colorv.getGreen(), self.colorv.getBlue()) if not self.rgb_selector.get_active(): (c1, c2, c3) = color.hsv_from_rgb(c1, c2, c3) self.text1.set_text(` c1 `) self.text2.set_text(` c2 `) self.text3.set_text(` c3 `) else: self.text1.set_text("") self.text2.set_text("") self.text3.set_text("") def image_changed(self, modifier, image): self.update(self.toolbox.currentPixel()) def nonsense(self): debug.mainthreadTest() self.colorv = -1 debug.mainthreadTest() self.imagetext.set_text("???") self.text1.set_text("???") self.text2.set_text("???") self.text3.set_text("???") pixelinfoplugin.registerPlugInClass(ImagePlugIn)