def save_as(self):
     filename= file_manager.getSaveFileName(caption='Save script', filter='All files (*.*);;Python files (*.py);;Text files (*.txt)')
     if filename == None:
         return False
     self.scriptfile = filename
     self.save()
     return True
 def exportROIs(self):
     fname = fm.getSaveFileName(filter='Text Files (*.txt)')
     if fname == '':
         return
     s = [repr(roi) for roi in self.rois]
     s = '\n'.join(s)
     open(fname, 'w').write(s)
 def exportInternalPoints(self, writer=None):
     if writer == None or type(writer) == bool:
         writer = str(fm.getSaveFileName(filter='Excel Files (*.xls)'))
     if writer == '': 
         return
     ids = np.where([self.contains(p) for p in zip(self.dock.data.Xc.values, self.dock.data.Yc.values)])[0]
     data = self.dock.data.iloc[ids.astype(int)]
     data.to_excel(writer, 'ROI #%d' % self.id)
	def teach_gui(self):

		if not hasattr(self, 'ui'):
			self.ui = uic.loadUi('LetterClassifier.ui')
			self.ui.consoleWidget.localNamespace.update({'classifier': self, 'plot': self.ui.plotWidget, 'player': self.player, 'ui': self.ui, "recorderWidget": self.ui.recorderWidget})
			self.ui.actionOpen.triggered.connect(lambda : self.plotWavFile(file_manager.getOpenFileName()))
			self.ui.actionSave_Memory.triggered.connect(lambda : self.save(file_manager.getSaveFileName()))
			self.ui.menuRecent_Files.aboutToShow.connect(self.build_recent_actions)
			self.ui.browseButton.pressed.connect(lambda : self.plotWavFile(file_manager.getOpenFileName()))
			self.ui.learnButton.pressed.connect(self.ui_learn_pressed)
			self.ui.unlearnButton.pressed.connect(self.ui_unlearn_pressed)
			self.ui.loadButton.pressed.connect(lambda : self.load_mem(file_manager.getOpenFileName()))
			self.ui.clearMemButton.pressed.connect(lambda : self.clear_memory(erase=False))
			self.ui.predictButton.pressed.connect(self.ui_predict_pressed)
			self.ui.outputTree.itemClicked.connect(self.ui_tree_clicked)
			self.ui.setAcceptDrops(True)
			self.ui.playButton.pressed.connect(self.play_selection)
			self.ui.eventFilter = self.eventFilter
			self.ui.installEventFilter(self.ui)
			self.build_recent_actions()
			self.ui.closeEvent = lambda ev: self.save()
		self.ui.show()
		self.updateTreeView()
 def save(self, data):
     fileName = fm.getSaveFileName(filter="Text File (*.txt)")
     if fileName == '':
         return
     data = '\t'.join(["Ch1 N", 'Ch2 N', 'Distance', 'Ch1 XY', 'Ch2 XY']) + '\n' + data
     open(fileName, 'w').write(data)
 def exportPoints(self):
     fname = fm.getSaveFileName(filter='Text Files (*.txt)')
     if fname == '':
         return
     open(fname, 'w').write(str(self.data))
Exemple #7
0
def save_file_gui(func, filetypes, prompt = 'Save File', args = []):
    filename= file_manager.getSaveFileName(caption=prompt, filter=filetypes)
    if filename != '':
        func(filename, *args)