def onBrowse(self): """Present the File Open dialog. Parameters: self: This object. Return value: String containing the path to the selected file, or None if no file was selected. Description: Display the File/Open dialog box and return the path to the selected file. """ # Present the file/open dialog. path = Open().show() # If no file was selected, return. if path == '': return # Save the current path in the file entry field. self._fileEntryField.setvalue(path)
def _onBrowse(self): # Present the file/open dialog. path = Open().show() # If no file was selected, return. if path == '': return # Save the current path in the livetime cube file EntryField. self._expcubeEntryField.setvalue(path)
def _onFileOpen(self): if debug: print 'File/Open...' # If the current document has changed, prompt to save it. self._saveIfChanged() # Fetch the path to the new file. If found, load the document and # save the path. path = Open().show() if path == (): return self._open(path)
def loadImage(self): """Load an image into ds9 Parameters: - self - This DS9Connector object Return value: - ra - the ROI center RA coordinate - dec - the ROI center Dec coordinate Description: After checking for a connection to ds9, if connected the method launches and Open File dialog to allow the user to select an image file to display. Once selected it attempts to display the file in ds9. If the file type is unsupported, the user is warned of such. If the file is supported, the program attempts to load and extract the images ROI data and passes it back to the calling method. """ noROIData = (-1, 0, 0) self._checkConnection() if (self._isConnected()): # open file dialog to get name path = Open().show() if path == (): return noROIData # open the file in window try: self.ds9.set("fits " + path) file = FitsFile(path) if file.hasROIData(): return file.getROIData() else: return noROIData except: showwarning("File Type Error!", "The specified file is not a valid FITS image") return noROIData
def my_askopenfilename(self): # objects remember last result dir/file if not self.openDialog: self.openDialog = Open(initialdir=self.startfiledir, filetypes=self.ftypes) return self.openDialog.show()
def ask_file(title, message, filetypes, directory, mult): dlg = Open(title=title, filetypes=filetypes, initialdir=directory, multiple=mult) out = dlg.show() return out