コード例 #1
0
	def SLOT_actionFileSave(self):
		"""
		Slot used when saving the current file.
		"""		
		if self.filepath==None:
			filepath = FMFileManagement.save_gui_filepath(
					self.get_default_opening_saving_site(),
					self,filter="AthW files (*.athw);; All files (*.*)")
		else:
			filepath = self.filepath
		if filepath :
			filepath=unicode(filepath)
			
			
			progressBar = QtGui.QProgressBar(parent=self)
			progressBar.setMaximum(0)
			progressBar.setValue(0)
			# center the widget
			point = self.geometry().center()
			point1 = progressBar.geometry().center()
			progressBar.move(point-point1)
			# set the window to the correct flag
			progressBar.setWindowFlags(QtCore.Qt.SplashScreen)
			progressBar.setWindowModality(QtCore.Qt.WindowModal)
			
			progressBar.show()
			
			# this class is a very classic thread just to save the file while
			# displaying the progressBar:
			class TaskThread(QtCore.QThread):
				taskFinished = QtCore.pyqtSignal()
				def run(self1):
					self.CMD_FileSave(filepath=filepath)
					self1.taskFinished.emit()
					
			# What we have to do at the end of the saving
			def finishing():
				progressBar.close()
				self.actionFileSave.setEnabled(False)
				self.setWindowTitle("AthenaWriter : "+self.filepath)
				tmp,filename = os.path.split(self.filepath)
				self.changeMessageStatusBar("Has saved "+filename)
				self.lastFiles.addFile(self.filepath)
			
			self.myLongTask = TaskThread()
			self.connect(self.myLongTask,QtCore.SIGNAL("taskFinished()"),
																	finishing)
					
			# self.myLongTask.taskFinished.connect(finishing)
			self.myLongTask.start()
コード例 #2
0
	def SLOT_actionFileSaveAs(self):
		"""
		Slot used when saving as the current file.
		"""
		filepath = FMFileManagement.save_gui_filepath(
				self.get_default_opening_saving_site(),
				self,filter="AthW files (*.athw);; All files (*.*)")
		if filepath :
			self.clean_tmp_files() # we remove the previous tmp files
			self.CMD_FileSave(filepath=unicode(filepath))
			self.actionFileSave.setEnabled(False)
			self.setWindowTitle("AthenaWriter : "+self.filepath)
			tmp,filename = os.path.split(self.filepath)
			self.changeMessageStatusBar("Has saved "+filename)
			self.lastFiles.addFile(self.filepath)