rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
for (ii, ltr0, ltr1) in [(0, "L", "R"), (1, "T", "B")]: if ltr0 in regionName: | for (ii, charLT, charRB) in [(0, "L", "R"), (1, "T", "B")]: if charLT in regionName: | def doResize(self, regionName, evt): """Handle <Motion> event to resize the box""" newMousePos = [evt.x, evt.y] dPos = [newMousePos[ii] - self.mousePos[ii] for ii in range(2)] newRectCoords = list(self.rectCoords) cnvSize = [self.cnv.winfo_width(), self.cnv.winfo_height()] # compute the resize for (ii, ltr0, ltr1) in... |
elif newRectCoords[ii] > newRectCoords[ii+2] - self.minSize: adj = (newRectCoords[ii+2] - self.minSize) - newRectCoords[ii] | elif newRectCoords[ii] > newRectCoords[ii+2] - self.minSizeLess1: adj = (newRectCoords[ii+2] - self.minSizeLess1) - newRectCoords[ii] | def doResize(self, regionName, evt): """Handle <Motion> event to resize the box""" newMousePos = [evt.x, evt.y] dPos = [newMousePos[ii] - self.mousePos[ii] for ii in range(2)] newRectCoords = list(self.rectCoords) cnvSize = [self.cnv.winfo_width(), self.cnv.winfo_height()] # compute the resize for (ii, ltr0, ltr1) in... |
if ltr1 in regionName: | if charRB in regionName: | def doResize(self, regionName, evt): """Handle <Motion> event to resize the box""" newMousePos = [evt.x, evt.y] dPos = [newMousePos[ii] - self.mousePos[ii] for ii in range(2)] newRectCoords = list(self.rectCoords) cnvSize = [self.cnv.winfo_width(), self.cnv.winfo_height()] # compute the resize for (ii, ltr0, ltr1) in... |
if newRectCoords[ii+2] > cnvSize[ii]: adj = cnvSize[ii] - newRectCoords[ii+2] elif newRectCoords[ii+2] < newRectCoords[ii] + self.minSize: adj = (newRectCoords[ii] + self.minSize) - newRectCoords[ii+2] | if newRectCoords[ii+2] > maxCoord[ii]: adj = maxCoord[ii] - newRectCoords[ii+2] elif newRectCoords[ii+2] < newRectCoords[ii] + self.minSizeLess1: adj = (newRectCoords[ii] + self.minSizeLess1) - newRectCoords[ii+2] | def doResize(self, regionName, evt): """Handle <Motion> event to resize the box""" newMousePos = [evt.x, evt.y] dPos = [newMousePos[ii] - self.mousePos[ii] for ii in range(2)] newRectCoords = list(self.rectCoords) cnvSize = [self.cnv.winfo_width(), self.cnv.winfo_height()] # compute the resize for (ii, ltr0, ltr1) in... |
root = Tkinter.Tk() cnv = Tkinter.Canvas(root, selectborderwidth=0, highlightthickness=0, borderwidth=0) | import PythonTk root = PythonTk.PythonTk() cnv = Tkinter.Canvas(root, selectborderwidth=0, highlightthickness=0, borderwidth=1) | def doResize(self, regionName, evt): """Handle <Motion> event to resize the box""" newMousePos = [evt.x, evt.y] dPos = [newMousePos[ii] - self.mousePos[ii] for ii in range(2)] newRectCoords = list(self.rectCoords) cnvSize = [self.cnv.winfo_width(), self.cnv.winfo_height()] # compute the resize for (ii, ltr0, ltr1) in... |
pb = ResizableRect(cnv, 50, 50, 100, 100, grabSize=(5,0), fill="white") | root.update_idletasks() rr = ResizableRect(cnv, 50, 50, 100, 100, grabSize=(5,0), fill="white") | def doResize(self, regionName, evt): """Handle <Motion> event to resize the box""" newMousePos = [evt.x, evt.y] dPos = [newMousePos[ii] - self.mousePos[ii] for ii in range(2)] newRectCoords = list(self.rectCoords) cnvSize = [self.cnv.winfo_width(), self.cnv.winfo_height()] # compute the resize for (ii, ltr0, ltr1) in... |
print "padx=%s, pady=%s" % (self["padx"], self["pady"]) | def __init__(self, master, var = None, defValue = False, helpText = None, helpURL = None, callFunc = None, defIfDisabled = False, showValue = False, autoIsCurrent = False, isCurrent = True, severity = RO.Constants.sevNormal, | |
return False return guideState.lower() in ("on", "starting") | isAutoGuiding = False else: isAutoGuiding = guideState.lower() in ("on", "starting") return isManGuiding and isAutoGuiding | def isGuiding(self): """Return True if guiding""" guideState, guideStateCurr = self.guideModel.guideState.getInd(0) if guideState == None: return False return guideState.lower() in ("on", "starting") |
dataStr = msgDict.get("data", {}).get("text", None) if not dataStr: | try: dataStr = msgDict["data"]["text"][0] except LookupError: | def _cmdCallback(self, msgType, msgDict, cmdVar=None): # print "StatusBar _cmdCallback(%r, %r, %r)" % (msgType, msgDict, cmdVar) msgDescr, newSeverity = RO.KeyVariable.TypeDict[msgType] msgSeverity = max(newSeverity, self.permSeverity) if msgType == ":": # command finished; omit associated text # but append "with warni... |
self. | def doShowHideImage(self, wdg=None): """Handle show/hide image button """ doShow = self.showHideImageWdg.getBool() if doShow: self.gim.grid() self. else: self.gim.grid_remove() | |
if not hasattr(arr, "type") or not hasattr(arr, "astype"): | try: if arr.isbyteswapped(): arr.byteswap() except AttributeError: | def showArray(self, arr, **kargs): """Display a 2-d or 3-d grayscale integer numarray arrays. 3-d images are displayed as data cubes, meaning one can view a single z at a time or play through them as a movie, that sort of thing. Inputs: - arr: a numarray array; must be 2-d or 3-d: 2-d arrays have index order (y, x) 3-... |
self.guideKeyVars.append(guideModel.guiding) guideModel.guiding.addIndexedCallback(self._updGuiding) | self.guideKeyVars.append(guideModel.guideState) guideModel.guideState.addIndexedCallback(self._updGuiding) | def __init__ (self, master=None, **kargs): """Displays miscellaneous information, such as current time and az/alt |
im = pyfits.open(fileName) | dirName = os.path.dirname(__file__) filePath = os.path.join(dirName, fileName) im = pyfits.open(filePath) | def limitZoomFac(desZoomFac): """Return zoom factor restricted to be in bounds""" return max(_MinZoomFac, min(_MaxZoomFac, desZoomFac)) |
self.dataMin = None self.dataMax = None | def __init__(self, master, | |
self.scrollWdg._cnv["background"] = cnvBackground | def __init__(self, master, | |
valueStr = self.rangeMenuWdg.getString() numVal = float(valueStr[:-1]) / 100.0 | strVal = self.rangeMenuWdg.getString() numVal = float(strVal[:-1]) / 100.0 | def doRangeMenu(self, wdg=None, redisplay=True): """Handle new selection from range menu.""" valueStr = self.rangeMenuWdg.getString() numVal = float(valueStr[:-1]) / 100.0 # ignore % from end lowFrac = (1.0 - numVal) / 2.0 highFrac = 1.0 - lowFrac dataLen = len(self.sortedData) self.dataDispMin = self.sortedData[int(lo... |
self.dataDispMin = self.sortedData[int(lowFrac*(dataLen-1))] self.dataDispMax = self.sortedData[int(highFrac*(dataLen)-1)] print "doRangeMenu; valueStr=%r; numVal=%r; lowFrac=%r; highFrac=%r, dataDispMin=%r, dataDispMax=%r" % (valueStr, numVal, lowFrac, highFrac, self.dataDispMin, self.dataDispMax) | lowInd = int(lowFrac * dataLen) highInd = int(highFrac * dataLen) - 1 self.dataDispMin = self.sortedData[lowInd] self.dataDispMax = self.sortedData[highInd] | def doRangeMenu(self, wdg=None, redisplay=True): """Handle new selection from range menu.""" valueStr = self.rangeMenuWdg.getString() numVal = float(valueStr[:-1]) / 100.0 # ignore % from end lowFrac = (1.0 - numVal) / 2.0 highFrac = 1.0 - lowFrac dataLen = len(self.sortedData) self.dataDispMin = self.sortedData[int(lo... |
valueStr = self.scaleMenuWdg.getString() funcName = "scale" + valueStr.replace(" ", "") | strVal = self.scaleMenuWdg.getString() funcName = "scale" + strVal.replace(" ", "") | def doScaleMenu(self, *args): """Handle new selection from scale menu.""" valueStr = self.scaleMenuWdg.getString() funcName = "scale" + valueStr.replace(" ", "") try: func = getattr(self, funcName) except AttributeError: raise RuntimeError("Bug! No function named %r" % (funcName,)) func() |
valueStr = self.zoomMenuWdg.getString() valueList = valueStr.split("/") | strVal = self.zoomMenuWdg.getString() valueList = strVal.split("/") | def doZoomMenu(self, *args): """Handle new selection from zoom menu.""" valueStr = self.zoomMenuWdg.getString() valueList = valueStr.split("/") if len(valueList) > 1: zoomFac = float(valueList[0]) / float(valueList[1]) else: zoomFac = int(valueList[0]) self.setZoom(zoomFac) # enable or disable zoom in/out widgets as a... |
if valueStr == self.zoomMenuWdg._items[0]: | if strVal == self.zoomMenuWdg._items[0]: | def doZoomMenu(self, *args): """Handle new selection from zoom menu.""" valueStr = self.zoomMenuWdg.getString() valueList = valueStr.split("/") if len(valueList) > 1: zoomFac = float(valueList[0]) / float(valueList[1]) else: zoomFac = int(valueList[0]) self.setZoom(zoomFac) # enable or disable zoom in/out widgets as a... |
elif valueStr == self.zoomMenuWdg._items[-1]: | elif strVal == self.zoomMenuWdg._items[-1]: | def doZoomMenu(self, *args): """Handle new selection from zoom menu.""" valueStr = self.zoomMenuWdg.getString() valueList = valueStr.split("/") if len(valueList) > 1: zoomFac = float(valueList[0]) / float(valueList[1]) else: zoomFac = int(valueList[0]) self.setZoom(zoomFac) # enable or disable zoom in/out widgets as a... |
self.scaledArr = self.dataArr.astype(num.Float32) | def redisplay(self): """Starting from the data array, redisplay the data. """ dataShapeXY = self.dataArr.shape[::-1] # create scaled array self.scaledArr = self.dataArr.astype(num.Float32) # offset so minimum display value = scaling function minimum input # note: this form of equation reuses the input array for outpu... | |
num.add(self.scaledArr, offset, self.scaledArr) num.maximum(self.scaledArr, self.scaleFuncMinInput, self.scaledArr) | num.add(self.dataArr, float(offset), self.scaledArr) num.maximum(self.scaledArr, float(self.scaleFuncMinInput), self.scaledArr) | def redisplay(self): """Starting from the data array, redisplay the data. """ dataShapeXY = self.dataArr.shape[::-1] # create scaled array self.scaledArr = self.dataArr.astype(num.Float32) # offset so minimum display value = scaling function minimum input # note: this form of equation reuses the input array for outpu... |
self.scaleFuncMinInput = minInput | self.scaleFuncMinInput = float(minInput) | def setScaleFunc(self, func, minInput=0.0): """Set a new scale function and redisplay. scaled value = func(max(minInput, data - offset)) where offset is determined by range The default offset is the minimum data value. """ self.scaleFuncMinInput = minInput self.scaleFunc = func print "scaleFunc = %r; scaleFuncMinInp... |
self.dataMin = arr.min() self.dataMax = max(arr.max(), self.dataMin + 1) self.sortedData = num.ravel(self.dataArr) | self.sortedData = num.ravel(self.dataArr.astype(num.Float32)) | def showArr(self, arr): """Specify an array to display. The data is initially scaled from minimum to maximum To do: - preserve existing zoom """ # delete current image, if any if self.imID: self.cnv.delete(self.imID) |
pathList.append(end) | if end: pathList.append(end) | def splitPath(path): """Splits a path into its component pieces. Similar to os.path.split but breaks the path completely apart instead of into just two pieces. My code with a correction from a Python Cookbook recipe by Trent Mick Note: pathList is built backwards and then reversed because inserting is much more expen... |
self.isInSequence = not self.isLocal | self.isInSequence = not isLocal print "isLocal=%r" % self.isLocal | def __init__(self, baseDir, imageName, guideModel, fetchCallFunc = None, isLocal = False, |
self.doingCmd = None self.manGuideScriptRunner = None | self.doingCmd = None | def __init__(self, master, actor, |
onOffVals = ("Current", "Not Current") | onOffVals = ("Current", "Not Curr") | def __init__(self, master, actor, |
self.bind("<Map>", self.doMap) | self.gim.bind("<Map>", self.doMap) | def __init__(self, master, actor, |
sr = self.manGuideScriptRunner if sr and sr.isExecuting(): sr.cancel() self.enableCmdButtons() else: cmdStr = "guide off" self.doCmd(cmdStr, cmdBtn=self.guideOffBtn) | self.doCmd("guide off", cmdBtn=self.guideOffBtn) | def doGuideOff(self, wdg=None): """Turn off guiding. """ sr = self.manGuideScriptRunner if sr and sr.isExecuting(): sr.cancel() self.enableCmdButtons() else: cmdStr = "guide off" self.doCmd(cmdStr, cmdBtn=self.guideOffBtn) |
cmdStr = "findstars " + self.getExpArgStr(inclRadMult=True) def guideScript(sr, cmdStr=cmdStr): while True: yield sr.waitCmd( actor = self.actor, cmdStr = cmdStr, ) self.manGuideScriptRunner = RO.ScriptRunner.ScriptRunner( master = self, name = "Manual guide script", dispatcher = self.tuiModel.dispatcher, runFunc =... | self.doCmd( "guide on manual %s" % self.getExpArgStr(), cmdBtn = self.manGuideBtn, isGuideOn = True, ) | def doManGuide(self, wdg=None): """Repeatedly expose. Let the user control-click to center up. """ cmdStr = "findstars " + self.getExpArgStr(inclRadMult=True) def guideScript(sr, cmdStr=cmdStr): # disable Expose, Guide, etc. # take exposures forever while True: yield sr.waitCmd( actor = self.actor, cmdStr = cmdStr, ) |
sr = self.manGuideScriptRunner isManGuiding = sr and sr.isExecuting() | def isGuiding(self): """Return True if guiding""" sr = self.manGuideScriptRunner isManGuiding = sr and sr.isExecuting() | |
isAutoGuiding = False else: isAutoGuiding = guideState.lower() != "off" return isManGuiding or isAutoGuiding | return False return guideState.lower() != "off" | def isGuiding(self): """Return True if guiding""" sr = self.manGuideScriptRunner isManGuiding = sr and sr.isExecuting() |
print "showImage(imObj=%s)" % (imObj,) | def showImage(self, imObj): """Display an image. """ # expire current image if not in history (this should never happen) if (self.dispImObj != None) and (self.dispImObj.imageName not in self.imObjDict): sys.stderr.write("GuideWdg warning: expiring display image that was not in history") self.dispImObj.expire() #print ... | |
self.statusBar.setMsg("", RO.Constants.sevNormal) | def showImage(self, imObj): """Display an image. """ # expire current image if not in history (this should never happen) if (self.dispImObj != None) and (self.dispImObj.imageName not in self.imObjDict): sys.stderr.write("GuideWdg warning: expiring display image that was not in history") self.dispImObj.expire() #print ... | |
if (imObj.state == imObj.StReady) and self.winfo_ismapped(): | if (imObj.state == imObj.StReady) and self.gim.winfo_ismapped(): | def showImage(self, imObj): """Display an image. """ # expire current image if not in history (this should never happen) if (self.dispImObj != None) and (self.dispImObj.imageName not in self.imObjDict): sys.stderr.write("GuideWdg warning: expiring display image that was not in history") self.dispImObj.expire() #print ... |
if self.winfo_ismapped(): | if self.gim.winfo_ismapped(): | def updFiles(self, fileData, isCurrent, keyVar): """Handle files keyword """ #print "%s updFiles(fileData=%r; isCurrent=%r)" % (self.actor, fileData, isCurrent) if not isCurrent: return cmdChar, isNew, baseDir, imageName, maskName = fileData[0:5] msgDict = keyVar.getMsgDict() cmdr = msgDict["cmdr"] cmdID = msgDict["cm... |
isLocal = False | isLocal = True _LocalMode = isLocal | def _exitHandler(self): """Delete all image files and mask files. """ for maskObj in self.maskDict.itervalues(): maskObj.expire() for imObj in self.imObjDict.itervalues(): imObj.expire() |
outPath = "" | def procFiles ( func, inPathList = sys.argv[1:], outDir = None, outFile = "", patterns = None, recursionDepth = None, | |
width and height are ignored unless window is fully resizable | width and/or height are ignored if the window is not resizable in that direction | def __init__(self, master=None, geometry="", title=None, visible=True, resizable=True, closeMode=tl_CloseWithdraws, wdgFunc=None, |
try: if arr.isbyteswapped(): arr.byteswap() except AttributeError: | if not hasattr(arr, "type") or not hasattr(arr, "astype"): | def showArray(self, arr, **kargs): """Display a 2-d or 3-d grayscale integer numarray arrays. 3-d images are displayed as data cubes, meaning one can view a single z at a time or play through them as a movie, that sort of thing. Inputs: - arr: a numarray array; must be 2-d or 3-d: 2-d arrays have index order (y, x) 3-... |
if arr.isbyteswapped(): arr = arr.copy() | def showArray(self, arr, **kargs): """Display a 2-d or 3-d grayscale integer numarray arrays. 3-d images are displayed as data cubes, meaning one can view a single z at a time or play through them as a movie, that sort of thing. Inputs: - arr: a numarray array; must be 2-d or 3-d: 2-d arrays have index order (y, x) 3-... | |
msgStr = "No star found; please fix and then Resume" | msgStr = "No star found! Fix and then press Resume" | def run(self, sr): """Take the series of focus exposures. """ print "sr.debug=", sr.debug self.initAll() # open DIS Slitviewer window self.tuiModel.tlSet.makeVisible(self.guideTLName) # fake data for debug mode # iteration #, FWHM self.debugIterFWHM = (1, 2.0) self.getInstInfo() |
msgStr = "Press Resume to start the focus sweep" | msgStr = "Check params; then press Resume to start the focus sweep" | def run(self, sr): """Take the series of focus exposures. """ print "sr.debug=", sr.debug self.initAll() # open DIS Slitviewer window self.tuiModel.tlSet.makeVisible(self.guideTLName) # fake data for debug mode # iteration #, FWHM self.debugIterFWHM = (1, 2.0) self.getInstInfo() |
sr.master.after(1, sr.showMsg, "Put a star on the boresight, then Resume", RO.Constants.sevWarning) | sr.master.after(1, sr.showMsg, msgStr, RO.Constants.sevWarning) | def run(self, sr): """Take the series of focus exposures. """ print "sr.debug=", sr.debug self.initAll() # open DIS Slitviewer window self.tuiModel.tlSet.makeVisible(self.guideTLName) # fake data for debug mode # iteration #, FWHM self.debugIterFWHM = (1, 2.0) self.getInstInfo() |
cmdCol = 0 | def showRight(evt=None): self.imNameWdg.xview("end") | |
self.holdWarnWdg = RO.Wdg.StrLabel( cmdButtonFrame, text = "Holding Image", severity = RO.Constants.sevWarning, anchor = "center", helpText = "Press Hold above to enable these controls", ) | def showRight(evt=None): self.imNameWdg.xview("end") | |
self.exposeBtn.pack(side="left") self.guideOnBtn.pack(side="left") self.applyBtn.pack(side="left") self.guideOffBtn.pack(side="left") self.cancelBtn.pack(side="left") | col = 0 self.exposeBtn.grid(row=0, column=col) self.holdWarnWdg.grid(row=0, column=col, columnspan=3, sticky="ew") self.holdWarnWdg.grid_remove() col += 1 self.guideOnBtn.grid(row=0, column=col) col += 1 self.applyBtn.grid(row=0, column=col) col += 1 self.guideOffBtn.grid(row=0, column=col) col += 1 self.cancelBtn.grid... | def showRight(evt=None): self.imNameWdg.xview("end") |
Tkinter.Label(cmdButtonFrame, text=" ").pack(side="right") self.ds9Btn.pack(side="right") | Tkinter.Label(cmdButtonFrame, text=" ").grid(row=0, column=col) col += 1 | def showRight(evt=None): self.imNameWdg.xview("end") |
self.exposeBtn.setEnable(not isExecOrGuiding) self.centerBtn.setEnable(isCurrIm and isSel and not isExecOrGuiding) | self.exposeBtn.setEnable(showCurrIm and not isExecOrGuiding) self.centerBtn.setEnable(showCurrIm and isCurrIm and isSel and not isExecOrGuiding) | def enableCmdButtons(self, wdg=None): """Set enable of command buttons. """ isImage = (self.dispImObj != None) isCurrIm = isImage and not self.nextImWdg.getEnable() isSel = (self.dispImObj != None) and (self.dispImObj.selDataColor != None) isGuiding = self.isGuiding() isExec = (self.doingCmd != None) isExecOrGuiding = ... |
self.guideOnBtn.setEnable(guideCmdOK and not isExecOrGuiding) self.applyBtn.setEnable(isGuiding and isCurrIm and guideCmdOK and areParamsModified) | self.guideOnBtn.setEnable(showCurrIm and guideCmdOK and not isExecOrGuiding) self.applyBtn.setEnable(showCurrIm and isGuiding and isCurrIm and guideCmdOK and areParamsModified) | def enableCmdButtons(self, wdg=None): """Set enable of command buttons. """ isImage = (self.dispImObj != None) isCurrIm = isImage and not self.nextImWdg.getEnable() isSel = (self.dispImObj != None) and (self.dispImObj.selDataColor != None) isGuiding = self.isGuiding() isExec = (self.doingCmd != None) isExecOrGuiding = ... |
imObj = self.imObjFromKeyVar(keyVar) if imObj == None: return | def updGuideMode(self, guideMode, isCurrent, keyVar): """New guideMode data found. """ #print "%s updGuideMode(guideMode=%r, isCurrent=%r)" % (self.actor, guideMode, isCurrent) self.setGuideState() if not isCurrent: return | |
if imObj.currGuideMode == None: imObj.defGuideMode = guideMode imObj.currGuideMode = guideMode if self.isDispObj(imObj): | imObj = self.dispImObj if imObj: if imObj.currGuideMode == None: imObj.defGuideMode = guideMode imObj.currGuideMode = guideMode if self.showCurrWdg.getBool(): | def updGuideMode(self, guideMode, isCurrent, keyVar): """New guideMode data found. """ #print "%s updGuideMode(guideMode=%r, isCurrent=%r)" % (self.actor, guideMode, isCurrent) self.setGuideState() if not isCurrent: return |
postcommand = self.checkMenu, | def _setMenu(self): self.menu = Tkinter.Menu( self.parentNode.menu, tearoff = False, postcommand = self.checkMenu, ) self.parentNode.menu.add_cascade( label = self.label, menu = self.menu, ) | |
def checkMenu(self): | def checkMenu(self, recurse=True): | def checkMenu(self): """Check contents of menu and rebuild if anything has changed. """ print "%s checkMenu" % (self,) newItemDict = {} newSubDict = RO.Alg.ListDict() for path in self.pathList: for baseName in os.listdir(path): # reject files that would be invisible on unix if baseName.startswith("."): continue baseB... |
""" print "%s checkMenu" % (self,) | Return True if anything rebuilt. """ | def checkMenu(self): """Check contents of menu and rebuild if anything has changed. """ print "%s checkMenu" % (self,) newItemDict = {} newSubDict = RO.Alg.ListDict() for path in self.pathList: for baseName in os.listdir(path): # reject files that would be invisible on unix if baseName.startswith("."): continue baseB... |
self.menu.update_idletasks() | def _fillMenu(self): """Fill the menu. """ | |
self.isAqua = (RO.TkUtil.getWindowingSystem() == RO.TkUtil.WSysAqua) | def __init__(self, master, label, pathList): self.master = master _MenuNode.__init__(self, None, label, pathList) | |
def getLabels(self): """Return a list of labels all the way up to, but not including, the root node. """ return [] | def getLabels(self): """Return a list of labels all the way up to, but not including, the root node. """ return [] | |
root = RO.Wdg.PythonTk() parentTL = root parentMenu = Tkinter.Menu(parentTL) parentTL["menu"] = parentMenu scriptMenu = getScriptMenu(parentMenu) parentMenu.add_cascade(label="Scripts", menu=scriptMenu) | root = Tkinter.Tk() newTl = RO.Wdg.Toplevel(root, title="Other") menuBar = Tkinter.Menu(root) root["menu"] = menuBar scriptMenu = getScriptMenu(menuBar) menuBar.add_cascade(label="Scripts", menu=scriptMenu) | def makeWdg(self, master): |
doResize = True, | def __init__(self, gim, annType, imPos, rad, tags = None, doResize = True, | |
if doResize: rad = rad / float(gim.zoomFac) | def __init__(self, gim, annType, imPos, rad, tags = None, doResize = True, | |
self.unzRad = float(rad) | self.isImSize = isImSize self.holeRad = kargs.get("holeRad") if self.isImSize: self.rad = float(rad) if self.holeRad != None: self.holeRad = float(self.holeRad) else: self.rad = int(round(rad)) if self.holeRad != None: self.holeRad = int(round(self.holeRad)) | def __init__(self, gim, annType, imPos, rad, tags = None, doResize = True, |
self.doResize = doResize | def __init__(self, gim, annType, imPos, rad, tags = None, doResize = True, | |
if self.doResize: rad = self.unzRad * self.gim.zoomFac | if self.isImSize: rad = int(round(self.rad * self.gim.zoomFac)) if self.holeRad != None: kargs["holeRad"] = int(round(self.holeRad * self.gim.zoomFac)) | def draw(self): """Draw the annotation. Warning: calling multiple times draws multiple copies. (Not an issue with GrayImageWdg because it tends to delete the canvas and start over when redrawing). """ cnvPos = self.gim.cnvPosFromImPos(self.imPos) if self.doResize: rad = self.unzRad * self.gim.zoomFac else: rad = self.... |
rad = self.unzRad rad = int(round(rad)) | rad = self.rad | def draw(self): """Draw the annotation. Warning: calling multiple times draws multiple copies. (Not an issue with GrayImageWdg because it tends to delete the canvas and start over when redrawing). """ cnvPos = self.gim.cnvPosFromImPos(self.imPos) if self.doResize: rad = self.unzRad * self.gim.zoomFac else: rad = self.... |
Warning: under construction! | Inputs: - master parent widget - height height of image portal (visible area) - width applies of image portal (visible area) | def delete(self): """Delete the annotation from the canvas. """ self.gim.cnv.delete(self.idTag) |
self.scrollFrame = Tkinter.Frame(self) | self.scrollFrame = Tkinter.Frame(self, height=height, width=width) self.scrollFrame.grid_propagate(False) | def __init__(self, master, |
def addAnnotation(self, annType, imPos, rad, tags=None, doResize=True, **kargs): | def addAnnotation(self, annType, imPos, rad, tags=None, isImSize=True, **kargs): | def addAnnotation(self, annType, imPos, rad, tags=None, doResize=True, **kargs): """Add an annotation. |
- doResize resize object when zoom factor changes? | - isImSize is radius in image pixels? else cnv pixels. If true, annotation is resized as zoom changes. | def addAnnotation(self, annType, imPos, rad, tags=None, doResize=True, **kargs): """Add an annotation. |
doResize = doResize, | isImSize = isImSize, | def addAnnotation(self, annType, imPos, rad, tags=None, doResize=True, **kargs): """Add an annotation. |
fmtFieldList = ["(%s=%%(%s)s)" % (fieldName, fieldName) for fieldName in fieldsToCheck] fmtFieldStr = " and ".join(fmtFieldList) sqlCmd = "select * from %s where %s" % (table, fmtFieldStr) | sqlCmd = "select * from %s where %s" % (table, formatFieldEqVal(fieldsToCheck)) | def rowExists(dbCursor, table, dataDict, fieldsToCheck=None): """Check to see if row exists with matching values in the specified fields. Returns True or False. Inputs: - dbCursor: database cursor - table: name of table - dataDict: dict of field name: value entries - fieldsToCheck: list of fields to check; if None (de... |
return 1 | return [1] | def fetchone(self): return 1 |
floatShape = [float(elt) for elt in self.dataArr.shape] self.hsb.set(self.begIJ[1] / floatShape[1], self.endIJ[1] / floatShape[1]) self.vsb.set(1.0 - (self.endIJ[0] / floatShape[0]), 1.0 - (self.begIJ[0] / floatShape[0])) | def _updImBounds(self, desCtrIJ=None, updZoom=True): """Update self.begIJ, self.endIJ and (if desired) self.zoomFac based on self.zoomFac and self.frameShape. Inputs: - updZoom: if True, zoom is increased if necessary so that the image fills x or y """ #print "self._updImBounds(desCtrIJ=%s, updZoom=%s)" % (desCtrIJ, u... | |
expCmdStr = "%sExpose time=%s" % (self.instActor, expTime) | expCmdStr = "%sExpose object time=%s" % (self.instActor, expTime) | def waitExpose(self, expTime, window=None): """Take an exposure using 1x1 binning. Returns the file path of the exposure. Inputs: - expTime: exposure time (sec) - window: (xmin, ymin, xmax, ymax) of subframe corners (inclusive, pix). warning: ignored by default because the commands to take a sub-framed exposure are in... |
nVal=(1,None), | nval=(1,None), | def __init__(self, gcamName): self.gcamName = gcamName self.actor = gcamName.lower() |
print "FTPCallback(%s) clear" % (self.ftpGet,) | if _DebugMem: print "FTPCallback(%s) clear" % (self.ftpGet,) | def clear(self): """Clear the callback""" print "FTPCallback(%s) clear" % (self.ftpGet,) self.ftpGet = None self.callFunc = None |
yield sr.waitCmd(cmdStr) | yield sr.waitCmd( actor = self.actor, cmdStr = cmdStr, ) | def guideScript(sr, cmdStr=cmdStr): # disable Expose, Guide, etc. # take exposures forever while True: yield sr.waitCmd(cmdStr) |
return self._isCurrent and self.getString() == self.getDefault() | try: return self._isCurrent and self.getString() == self.getDefault() except (ValueError, TypeError): return False | def getIsCurrent(self): """Return True if value is current, False otherwise. |
self.enableCmdBtns() self.enableHistBtns() | self.enableCmdButtons() self.enableHistButtons() | def __init__(self, master, actor, |
self.enableHistBtns() | self.enableHistButtons() | def doShowCurr(self, wdg=None): if not self.showCurrWdg.getBool(): return |
def enableCmdBtns(self, isGuiding=None): | def enableCmdButtons(self, isGuiding=None): | def enableCmdBtns(self, isGuiding=None): """Set enable of command buttons. If you specify isGuiding then the value you specify will be used (used to disable guide on buttons just after pressing one). """ isImage = (self.dispImObj != None) isSel = (self.dispImObj != None) and (self.dispImObj.selDataColor != None) if is... |
def enableHistBtns(self): | def enableHistButtons(self): | def enableHistBtns(self): """Set enable of prev and next buttons""" revHist, currInd = self.getHistInfo() |
self.enableHistBtns() | self.enableHistButtons() | def _showShim(self, imObj): # delete image from disk, if no longer in history if (self.dispImObj != None) and (self.dispImObj.imageName not in self.imObjDict): # purge file self.dispImObj.expire() #print "showImage(imObj=%s)" % (imObj,) if imObj == None: self.statusBar.setMsg("", RO.Constants.sevNormal) imArr = None e... |
self.enableCmdBtns() | self.enableCmdButtons() | def showSelection(self): """Display the current selection. """ # clear current selection self.gim.removeAnnotation(_SelTag) |
self.enableHistBtns() | self.enableHistButtons() | def updFiles(self, fileData, isCurrent, keyVar): """Handle files keyword """ #print "%s updFiles(fileData=%r; isCurrent=%r)" % (self.actor, fileData, isCurrent) if not isCurrent: return cmdChar, isNew, baseDir, imageName, maskName = fileData[0:5] msgDict = keyVar.getMsgDict() cmdr = msgDict["cmdr"] cmdID = msgDict["cm... |
self.enableCmdBtns() | self.enableCmdButtons() | def updGuideState(self, guideState, isCurrent, keyVar): if not isCurrent: return msgDict = keyVar.getMsgDict() msgType = msgDict["type"].lower() if msgType == "w": sev = RO.Constants.sevWarning elif msgType in "f!": sev = RO.Constants.sevError else: sev = RO.Constants.sevNormal self.guideStateWdg.set( " ".join(guideSta... |
def reportEvent(event): rpt = '\n\n%s' % (80*'=') rpt = '%s\nEvent: type=%s (%s)' % (rpt, event.type, eventList.get(event.type, 'Unknown')) rpt = '%s\nserial=%s' % (rpt, event.serial) rpt = '%s time=%s' % (rpt, event.time) rpt = '%s widget=%s' % (rpt, event.widget) rpt = '%s heigh... | def reportEvent(evt): eventName = eventDict.get(evt.type, 'Unknown') rptList = [ '\n\n%s\nEvent:' % (80*'=',), ' type=%r (%r' % (evt.type, eventName,), '\nserial=%r' % (evt.serial,), 'time=%r' % (evt.time,), 'widget=%r' % (evt.widget,), '\nx=%r y=%r' % (evt.x, evt.y), 'x_root=%r' % (evt.x_root,), 'y_root=%r' % (evt.y_... | def reportEvent(event): rpt = '\n\n%s' % (80*'=') rpt = '%s\nEvent: type=%s (%s)' % (rpt, event.type, eventList.get(event.type, 'Unknown')) rpt = '%s\nserial=%s' % (rpt, event.serial) rpt = '%s time=%s' % (rpt, event.time) rpt = '%s widget=%s' % (rpt, event.widget) rpt = '%s heigh... |
try: rpt = '%s focus=%s' % (rpt, event.focus) except: pass try: rpt = '%s send=%s' % (rpt, event.send_event) except: pass logWdg.yview("end") logWdg.insert("end", rpt) | try: rptList.append( 'focus=%s' % (evt.focus) ) except: pass try: rptList.append( 'send_event=%s' % (evt.send_event) ) except: pass logWdg.yview("end") logWdg.insert("end", '; '.join(rptList)) | def reportEvent(event): rpt = '\n\n%s' % (80*'=') rpt = '%s\nEvent: type=%s (%s)' % (rpt, event.type, eventList.get(event.type, 'Unknown')) rpt = '%s\nserial=%s' % (rpt, event.serial) rpt = '%s time=%s' % (rpt, event.time) rpt = '%s widget=%s' % (rpt, event.widget) rpt = '%s heigh... |
for event in eventList.values(): userLabel.bind('<%s>' % event, reportEvent) userEntry.bind('<%s>' % event, reportEvent) | for eventName in eventDict.values(): userLabel.bind('<%s>' % eventName, reportEvent) userEntry.bind('<%s>' % eventName, reportEvent) | def reportEvent(event): rpt = '\n\n%s' % (80*'=') rpt = '%s\nEvent: type=%s (%s)' % (rpt, event.type, eventList.get(event.type, 'Unknown')) rpt = '%s\nserial=%s' % (rpt, event.serial) rpt = '%s time=%s' % (rpt, event.time) rpt = '%s widget=%s' % (rpt, event.widget) rpt = '%s heigh... |
cmdVar = RO.KeyVariable.CmdVar( cmdStr = cmdStr, actor = self.echelleModel.actor, ) self.statusBar.doCmd(cmdVar) | self.doCmd(cmdStr, actor=self.echelleModel.actor) | def doApply(self, wdg=None): """Apply changes to configuration""" cmdStr = self.inputCont.getString() if not cmdStr: return |
self.forceFirst = \ lines[lines.index("[first]") + 1:lines.index("[last]")] self.forceLast = \ lines[lines.index("[last]") + 1:lines.index("[exclude]")] | self.forceFirst = lines[lines.index("[first]") + 1:lines.index("[last]")] self.forceLast = lines[lines.index("[last]") + 1:lines.index("[exclude]")] | def __init__(self, filename): """ Parses the content of the named file and stores the values. """ lines = [line[:-1] # Assumes end-of-line character is present for line in open(filename) if line != "\n"] # Skip blank lines |
HEADER = "/* " + "=" * 70 + "\n"\ " %s\n" +\ " " + "=" * 70 + " */\n\n" | HEADER = "/* " + "=" * 70 + " %s\n" + " " + "=" * 70 + " */\n\n" | def __init__(self, filename): """ Parses the content of the named file and stores the values. """ lines = [line[:-1] # Assumes end-of-line character is present for line in open(filename) if line != "\n"] # Skip blank lines |
order = cfg.forceFirst + \ [item | order = cfg.forceFirst + [item | def __init__(self, filename): """ Parses the content of the named file and stores the values. """ lines = [line[:-1] # Assumes end-of-line character is present for line in open(filename) if line != "\n"] # Skip blank lines |
(item not in cfg.forceLast))] + \ cfg.forceLast | (item not in cfg.forceLast))] + cfg.forceLast | def __init__(self, filename): """ Parses the content of the named file and stores the values. """ lines = [line[:-1] # Assumes end-of-line character is present for line in open(filename) if line != "\n"] # Skip blank lines |
cert = botan.X509_Certificate("cert.pem") stor = botan.X509_Store() stor.add_cert(botan.X509_Certificate("cert.pem"), True) stor.add_cert(botan.X509_Certificate("cert2.pem")) stor.add_cert(botan.X509_Certificate("cert.crt")) matcher = FindDOD() certs = stor.get_certs(matcher) for cert in certs: print cert.subject_inf... | print do_hash("foo") | def main(): cert = botan.X509_Certificate("cert.pem") stor = botan.X509_Store() stor.add_cert(botan.X509_Certificate("cert.pem"), True) stor.add_cert(botan.X509_Certificate("cert2.pem")) stor.add_cert(botan.X509_Certificate("cert.crt")) matcher = FindDOD() certs = stor.get_certs(matcher) for cert in certs: print cert... |
elif quadratureOrder == "Reduced": | elif lm3dscan.quadratureOrder == "Reduced": | def initialize(self, scanner): |
elif quadratureOrder == "Selective": | elif lm3dscan.quadratureOrder == "Selective": | def initialize(self, scanner): |
if u.has_key("filename"): | if u.has_key("got_first"): | def request(self, args): """Request a file from a server. args are (.sumi filename) or (transport, nick, filename). |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.