Пример #1
0
	def initText(self):			#已经被替代
		sz=self.GetSize()
		#print _ct.Iround(sz.x*0.15)
		if hasattr(self, 'nameText'):
			del self.nameText
		else:
			nt=self.nameText=wx.StaticText(self, -1, _ct.getFileName(self.imPath), (_ct.Iround(sz.x*0.15), sz.y-45), (sz.x,30), wx.ALIGN_CENTER)
			nt.Wrap(_ct.Iround(sz.x*0.7))
Пример #2
0
	def initToolTip(self):
		if self.imPath == _ct.mainC.blankIm:
			if hasattr(self, 'toolTip'):
				del self.toolTip
			return
		name=_ct.getFileName(self.imPath)
		x,y=self.image.GetSize()
		tip=name+"\n"+str(x)+u'×'+str(y)+u'像素'
		if hasattr(self, 'toolTip'):
			self.toolTip.SetTip(tip)
		else:
			self.toolTip=wx.ToolTip(tip)
			self.SetToolTip(self.toolTip)
Пример #3
0
	def initBuffer(self, brush='sel'):
		#print 't'
		sz=self.GetSize()
		self.buffer = wx.EmptyBitmap(sz.x, sz.y)
		dc=wx.BufferedDC(None, self.buffer)
		dc=wx.GCDC(dc)
		dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
		dc.Clear()
		if self._ui_status == _UI_SELECTED or brush=='hover' and self.HitTest(wx.GetMousePosition()-self.GetScreenPosition())==wx.HT_WINDOW_INSIDE:
			dc.SetPen(self.pen)
			dc.SetBrush(getattr(self, brush+'Brush'))
			dc.DrawRoundedRectangleRect(wx.Rect(0,0,sz.x,sz.y), 5)
		if hasattr(self,'pic'):
			dc.DrawBitmap(self.pic, self.impos[0], self.impos[1], True)
		#dc.SetFont(wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
		if self.imPath != _ct.mainC.blankIm:
			name=_ct.getFileName(self.imPath)
			tn=_ct.Iround((sz.x-100)/6)+1
			name=name if len(name)<tn else name[:tn-1]+'...'
			#namepos=[_ct.Iround(sz.x*0.15)]
			dc.DrawText(name, _ct.Iround((sz.x-6*len(name))/2), sz.y-26)
		self.reInitBuffer = 0