git://git.onelab.eu
/
sface.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleanup for using the config dir properly, and not an hard-wired ~/.sfi/
[sface.git]
/
sface
/
screens
/
mainscreen.py
diff --git
a/sface/screens/mainscreen.py
b/sface/screens/mainscreen.py
index
b20ae51
..
e6e4fb4
100644
(file)
--- a/
sface/screens/mainscreen.py
+++ b/
sface/screens/mainscreen.py
@@
-31,6
+31,9
@@
NODE_STATUS_COLUMN = 1
MEMBERSHIP_STATUS_COLUMN = 2
KIND_COLUMN = 3
MEMBERSHIP_STATUS_COLUMN = 2
KIND_COLUMN = 3
+# maximum length of a name to display before clipping
+NAME_MAX_LEN = 48
+
def itemType(index):
if index.parent().parent().isValid():
return "tag"
def itemType(index):
if index.parent().parent().isValid():
return "tag"
@@
-144,15
+147,21
@@
class NodeNameDelegate(QStyledItemDelegate):
def __init__(self, parent):
QStyledItemDelegate.__init__(self, parent)
def __init__(self, parent):
QStyledItemDelegate.__init__(self, parent)
+ def displayText(self, value, locale):
+ data = str(QStyledItemDelegate.displayText(self, value, locale))
+ if (len(data)>NAME_MAX_LEN):
+ data = data[:(NAME_MAX_LEN-3)] + "..."
+ return QString(data)
+
def paint(self, painter, option, index):
model = index.model()
def paint(self, painter, option, index):
model = index.model()
+ data = str(self.displayText(index.data(), QLocale()))
status_index = model.index(index.row(), MEMBERSHIP_STATUS_COLUMN, index.parent())
status_data = status_index.data().toString()
fm = QFontMetrics(option.font)
rect = QRect(option.rect)
status_index = model.index(index.row(), MEMBERSHIP_STATUS_COLUMN, index.parent())
status_data = status_index.data().toString()
fm = QFontMetrics(option.font)
rect = QRect(option.rect)
- data = index.data().toString()
rect.setHeight(rect.height() - 2)
rect.setWidth(fm.width(QString(data)) + 6)
rect.setX(rect.x() + 5)
rect.setHeight(rect.height() - 2)
rect.setWidth(fm.width(QString(data)) + 6)
rect.setX(rect.x() + 5)