--- a/E5Gui/E5SqueezeLabels.py Fri Mar 11 08:55:14 2011 +0100 +++ b/E5Gui/E5SqueezeLabels.py Fri Mar 11 16:51:57 2011 +0100 @@ -12,11 +12,12 @@ from Utilities import compactPath + class E5SqueezeLabel(QLabel): """ Class implementing a label that squeezes its contents to fit it's size. """ - def __init__(self, parent = None): + def __init__(self, parent=None): """ Constructor @@ -50,11 +51,12 @@ self.__text = txt QLabel.setText(self, self.__text) + class E5SqueezeLabelPath(QLabel): """ Class implementing a label showing a file path compacted to fit it's size. """ - def __init__(self, parent = None): + def __init__(self, parent=None): """ Constructor @@ -102,9 +104,9 @@ """ fm = self.fontMetrics() if fm.width(self.__surrounding.format(self.__path)) > self.contentsRect().width(): - QLabel.setText(self, - self.__surrounding.format(compactPath(self.__path, - self.contentsRect().width(), + QLabel.setText(self, + self.__surrounding.format(compactPath(self.__path, + self.contentsRect().width(), self.length)) ) else: @@ -118,4 +120,4 @@ @param txt text to calculate the length for after wrapped (string) @return length of the wrapped text in pixels (integer) """ - return self.fontMetrics().width(self.__surrounding.format(txt)) \ No newline at end of file + return self.fontMetrics().width(self.__surrounding.format(txt))