def save(self,item): ''' Runs a file saving dialog and prompts the user to make sure nothing goes awry @param item an EMData object @exception RuntimeError raised if item is not of type EMData ''' fine = EMSingleImageSaveDialog.validate_save_argument(item) if not fine: raise RuntimeError("item is not an EMData instance") self.validator = EMSaveImageValidator([item]) self.__item = item from emselector import EMSelectorDialog selector = EMSelectorDialog(True,True) selector.set_validator(self.validator) file = selector.exec_() if file != "": self.__save_file(file)
def save(self,item_list): ''' The main function @param item_list a list of items - will change to become more generic @raise RuntimeError if the the function argument is not acceptable ''' fine = EMStackSaveDialog.validate_save_argument(item_list) if not fine: raise RuntimeError("item_list must be a list of EMData instances, a list of ListWidgetItems, or an EMDataListCache") self.__item_list = item_list from emselector import EMSelectorDialog selector = EMSelectorDialog(True,True) self.validator = EMSaveImageValidator(item_list) selector.set_validator(self.validator) file = selector.exec_() if file != "": self.__save_file(str(file))
def browse_iso(self): em_selector = EMSelectorDialog() file_path = em_selector.exec_() get_application().detach_child(em_selector) self.volume_line_edit.setText(file_path)