Exemplo n.º 1
0
	def OnPaint(self):
		# size of current file
		if self.currentBytesDone is not None and self.currentBytesAll is not None:
			self.currentBytesHeader.SetLabel('Current File {0:s}/{1:s}'.format( \
				sizeToString(self.currentBytesDone), sizeToString(self.currentBytesAll)))
			if self.currentBytesAll == 0:
				self.currentBytesGauge.SetRange(1)
				self.currentBytesGauge.SetValue(1)
				self.currentBytesGaugeText.SetLabel('100 %')
			else:
				self.currentBytesGauge.SetValue(self.currentBytesDone / self.currentBytesFactor)
				self.currentBytesGaugeText.SetLabel('{0:d} %'.format( \
				(100 * self.currentBytesDone) / self.currentBytesAll))
		else:
			self.currentBytesHeader.SetLabel('Current File -/-')
			self.currentBytesGauge.SetValue(0)
			self.currentBytesGaugeText.SetLabel('--- %')
		# total number of files
		if self.totalFilesDone is not None and self.totalFilesAll is not None:
			self.totalFilesHeader.SetLabel('Total Number of Files {0:d}/{1:d}'.format( \
				self.totalFilesDone, self.totalFilesAll))
			if self.totalFilesAll == 0:
				self.totalFilesGauge.SetRange(1)
				self.totalFilesGauge.SetValue(1)
				self.totalFilesGaugeText.SetLabel('100 %')
			else:
				self.totalFilesGauge.SetValue(self.totalFilesDone / self.totalFilesFactor)
				self.totalFilesGaugeText.SetLabel('{0:d} %'.format( \
				(100 * self.totalFilesDone) / self.totalFilesAll))
		else:
			self.totalFilesHeader.SetLabel('Total Number of Files -/-')
			self.totalFilesGauge.SetValue(0)
			self.totalFilesGaugeText.SetLabel('--- %')
		# total size of all files
		if self.totalBytesDone is not None and self.totalBytesAll is not None:
			self.totalBytesHeader.SetLabel('Total Size {0:s}/{1:s}'.format( \
				sizeToString(self.totalBytesDone), sizeToString(self.totalBytesAll)))
			if self.totalBytesAll == 0:
				self.totalBytesGauge.SetRange(1)
				self.totalBytesGauge.SetValue(1)
				self.totalBytesGaugeText.SetLabel('100 %')
			else:
				self.totalBytesGauge.SetValue(self.totalBytesDone / self.totalBytesFactor)
				self.totalBytesGaugeText.SetLabel('{0:d} %'.format( \
				(100 * self.totalBytesDone) / self.totalBytesAll))
		else:
			self.totalBytesHeader.SetLabel('Total Size -/-')
			self.totalBytesGauge.SetValue(0)
			self.totalBytesGaugeText.SetLabel('--- %')
		# force a repaint of the dialog
		self.Update()
		# allow wx to process events like for the cancel button
		wx.YieldIfNeeded()
Exemplo n.º 2
0
	def getSizeString(self, abbreviate=True):
		if self.size is None:
			return self.NoneString
		else:
			if abbreviate:
				return sizeToString(self.size)
			else:
				return '{0:,}'.format(self.size)
Exemplo n.º 3
0
	def __str__(self):
		return '{0:d} directories and {1:s} in {2:d} files'.format( \
			self.__dircount, sizeToString(self.__filesize), self.__filecount)