E5Gui/E5SqueezeLabels.py

branch
Py2 comp.
changeset 3065
070b35dde35e
parent 3060
5883ce99ee12
child 3145
a9de05d4a22f
equal deleted inserted replaced
3061:1c0ea3a87390 3065:070b35dde35e
77 77
78 @param surrounding the a string containg placeholders for the path 78 @param surrounding the a string containg placeholders for the path
79 (string) 79 (string)
80 """ 80 """
81 self.__surrounding = surrounding 81 self.__surrounding = surrounding
82 super(E5SqueezeLabelPath, self).setText(self.__surrounding.format(self.__path)) 82 super(E5SqueezeLabelPath, self).setText(
83 self.__surrounding.format(self.__path))
83 84
84 def setPath(self, path): 85 def setPath(self, path):
85 """ 86 """
86 Public method to set the path of the label. 87 Public method to set the path of the label.
87 88
88 @param path path to be shown (string) 89 @param path path to be shown (string)
89 """ 90 """
90 self.__path = path 91 self.__path = path
91 super(E5SqueezeLabelPath, self).setText(self.__surrounding.format(self.__path)) 92 super(E5SqueezeLabelPath, self).setText(
93 self.__surrounding.format(self.__path))
92 94
93 def setTextPath(self, surrounding, path): 95 def setTextPath(self, surrounding, path):
94 """ 96 """
95 Public method to set the surrounding and the path of the label. 97 Public method to set the surrounding and the path of the label.
96 98
98 (string) 100 (string)
99 @param path path to be shown (string) 101 @param path path to be shown (string)
100 """ 102 """
101 self.__surrounding = surrounding 103 self.__surrounding = surrounding
102 self.__path = path 104 self.__path = path
103 super(E5SqueezeLabelPath, self).setText(self.__surrounding.format(self.__path)) 105 super(E5SqueezeLabelPath, self).setText(
106 self.__surrounding.format(self.__path))
104 107
105 def paintEvent(self, event): 108 def paintEvent(self, event):
106 """ 109 """
107 Protected method called when some painting is required. 110 Protected method called when some painting is required.
108 111
115 self.__surrounding.format(compactPath(self.__path, 118 self.__surrounding.format(compactPath(self.__path,
116 self.contentsRect().width(), 119 self.contentsRect().width(),
117 self.length)) 120 self.length))
118 ) 121 )
119 else: 122 else:
120 super(E5SqueezeLabelPath, self).setText(self.__surrounding.format(self.__path)) 123 super(E5SqueezeLabelPath, self).setText(
124 self.__surrounding.format(self.__path))
121 super(E5SqueezeLabelPath, self).paintEvent(event) 125 super(E5SqueezeLabelPath, self).paintEvent(event)
122 126
123 def length(self, txt): 127 def length(self, txt):
124 """ 128 """
125 Public method to return the length of a text in pixels. 129 Public method to return the length of a text in pixels.

eric ide

mercurial