def onView2(self, ev): from Priithon.all import Y if isinstance(self.fn_or_fns, (list, tuple)) and len(self.fn_or_fns) > 1: f = tuple( self.fn_or_fns ) # 'tuple' for "view as mock-adarray" self.txt = '( ' for fff in self.fn_or_fns: self.txt += 'r\"%s\" , ' % fff self.txt += ')' else: f = self.fn_or_fns Y.view2(f, colorAxis='smart') self.pyshell.addHistory("Y.view2( %s, colorAxis='smart')"%(self.txt,))
def view(self, idx=0, color=None): """ idx: if viewer if already open, simply go to this idx """ global _ZSLIDER if self.vid is None or Y.viewers[self.vid] is None: if color: old_ignor_color_axis = self.ignor_color_axis self.ignor_color_axis = True # don't know how to disable this arr = self[idx] if color and self.nw >= 2 and self.hdr.ImgSequence in [1, 2]: #colorAxis = mrcIO.findAxis(self.hdr, self.shape, tzw='w') if self.hdr.ImgSequence in (0, 2): colorAxis = 0 elif self.hdr.ImgSequence == 1: colorAxis = -3 Y.view2(arr, colorAxis, self.file, originLeftBottom=1) else: Y.view(arr, self.file, originLeftBottom=1) viewer = Y.viewers[-1] self.vid = viewer.id if (self.nt * self.nz) > 1 or (self.nw > 1 and not color): nz = self.__getattribute__('n%s' % self.sld_axs) self._zslider = vzslider(self, self.vid, nz=nz, title='slide: axis %s of [%i]' % (self.sld_axs, self.vid)) viewer.setSlider2 = _setSlider self._zslider.zslider.SetValue(idx) _ZSLIDER = self._zslider viewer._zslider = self._zslider else: if (self.nt * self.nz) > 1: import wx try: self._setSlider(idx) self._zslider.zslider.SetValue(idx) except wx.PyDeadObjectError: self.vid = None self.view(idx)