def __init__(self, path, parent=None):
self.path = path
self.new_version = ""
def createWidget(self, parent):
widget = QdVersionTree(self.path, parent)
widget.setMinimumSize(450, 100)
self.connect(widget, SIGNAL("versionSelected(QString)"), self.versionAccepted)
self.
activate(QtGui.
QAction.
Trigger) return widget
def versionAccepted(self, path):
self.new_version = path
# this works, the triggered signal is emitted and all
self.
activate(QtGui.
QAction.
Trigger)
# What else can I do here????
self.emit(SIGNAL("changed()"))
self.toggle()
print 'version accepted', path
def __init__(self, path, parent=None):
self.setAllColumnsShowFocus(True)
attributes = ["version", "name", "creator", "description"]
self.setHeaderLabels(atributes)
self.
setFrameStyle(QtGui.
QFrame.
NoFrame)
versions = [1, 2, 3, 4, 5, 6]
for version in versions:
columns = []
for attribute in attributes:
columns.append(attribute)
item = QdVersionTreeItem(self, columns)
self.addTopLevelItem(item)
self.connect(self, SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
self.itemActivated)
def itemActivated(self, item, column):
self.emit(SIGNAL("versionSelected(QString)"), "foo")
class QdVersionListAction(QtGui.QWidgetAction):
def __init__(self, path, parent=None):
QtGui.QWidgetAction.__init__(self, parent)
self.path = path
self.new_version = ""
def createWidget(self, parent):
widget = QdVersionTree(self.path, parent)
widget.setMinimumSize(450, 100)
self.connect(widget, SIGNAL("versionSelected(QString)"), self.versionAccepted)
self.activate(QtGui.QAction.Trigger)
return widget
def versionAccepted(self, path):
self.new_version = path
# this works, the triggered signal is emitted and all
self.activate(QtGui.QAction.Trigger)
# What else can I do here????
self.emit(SIGNAL("changed()"))
self.toggle()
print 'version accepted', path
class QdVersionTree(QtGui.QTreeWidget):
def __init__(self, path, parent=None):
QtGui.QTreeWidget.__init__(self, parent)
self.setAllColumnsShowFocus(True)
attributes = ["version", "name", "creator", "description"]
self.setHeaderLabels(atributes)
self.setFrameStyle(QtGui.QFrame.NoFrame)
versions = [1, 2, 3, 4, 5, 6]
for version in versions:
columns = []
for attribute in attributes:
columns.append(attribute)
item = QdVersionTreeItem(self, columns)
self.addTopLevelItem(item)
self.connect(self, SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
self.itemActivated)
def itemActivated(self, item, column):
self.emit(SIGNAL("versionSelected(QString)"), "foo")
To copy to clipboard, switch view to plain text mode
Bookmarks