def __init__(self, filename=logo, text=None, textcolor="blue", **kw): # look for file in both local directory and this script's directory if not os.path.exists(filename): tfilename = os.path.join(os.path.dirname(__file__),filename) if not os.path.exists(tfilename): raise ValueError("Splash image `%s' not found" % filename) filename = tfilename self.filename = filename self.nlines = 1 self.textcolor = textcolor if text: if isinstance(text, type("")): text = text.split("\n") self.nlines = len(text) self.initialText = text else: self.initialText = [None] # put focus on this app (Mac only) self.__termWin = None if wutil.hasGraphics and wutil.WUTIL_ON_MAC: self.__termWin = wutil.getFocalWindowID() # the terminal window wutil.forceFocusToNewWindow() # create it SplashScreen.__init__(self, **kw) self.defaultCursor = self['cursor'] self.bind("<Button>", self.killCursor) self.bind("<ButtonRelease>", self.Destroy)
def __init__(self, filename=logo, text=None, textcolor="blue", **kw): # look for file in both local directory and this script's directory if not os.path.exists(filename): tfilename = os.path.join(os.path.dirname(__file__), filename) if not os.path.exists(tfilename): raise ValueError("Splash image `%s' not found" % filename) filename = tfilename self.filename = filename self.nlines = 1 self.textcolor = textcolor if text: if isinstance(text, type("")): text = text.split("\n") self.nlines = len(text) self.initialText = text else: self.initialText = [None] # put focus on this app (Mac only) self.__termWin = None if wutil.hasGraphics and wutil.WUTIL_ON_MAC: self.__termWin = wutil.getFocalWindowID() # the terminal window wutil.forceFocusToNewWindow() # create it SplashScreen.__init__(self, **kw) self.defaultCursor = self['cursor'] self.bind("<Button>", self.killCursor) self.bind("<ButtonRelease>", self.Destroy)
def epar(theTask, parent=None, isChild=0): if wutil is None or not wutil.hasGraphics: raise IrafError("Cannot run epar without graphics windows") if not isChild: oldFoc = wutil.getFocalWindowID() wutil.forceFocusToNewWindow() PyrafEparDialog(theTask, parent, isChild) if not isChild: wutil.setFocusTo(oldFoc)
def hasFocus(self): """Returns true if this window currently has focus""" return wutil.getTopID(wutil.getFocalWindowID()) == \ wutil.getTopID(self.getWindowID())