# HG changeset patch # User windel # Date 1329581361 -3600 # Node ID 8a52263d67c450ee2fe186fb78a7d704cdee8217 # Parent cbf199e007c28d9c8fd99ed79362599c816afde7 Fixed width of library diff -r cbf199e007c2 -r 8a52263d67c4 applications/lab/diagrameditor.py --- a/applications/lab/diagrameditor.py Sat Feb 18 16:42:23 2012 +0100 +++ b/applications/lab/diagrameditor.py Sat Feb 18 17:09:21 2012 +0100 @@ -96,7 +96,7 @@ self.setFlag(self.ItemSendsScenePositionChanges, True) def itemChange(self, change, value): if change == self.ItemScenePositionHasChanged: - value = value.toPointF() # Required! + #value = value.toPointF() # Required in python2??! for cb in self.posCallbacks: cb(value) return value @@ -117,7 +117,7 @@ def itemChange(self, change, value): if change == self.ItemPositionChange: - value = value.toPointF() + #value = value.toPointF() x, y = value.x(), value.y() # TODO: make this a signal? # This cannot be a signal because this is not a QObject @@ -244,7 +244,8 @@ mimedata = QMimeData() for idx in idxs: if idx.isValid(): - txt = self.data(idx, Qt.DisplayRole).toByteArray() + #txt = self.data(idx, Qt.DisplayRole).toByteArray() # python2 + txt = self.data(idx, Qt.DisplayRole) # python 3 mimedata.setData('component/name', txt) return mimedata @@ -266,6 +267,7 @@ # Widget layout and child widgets: self.horizontalLayout = QtGui.QHBoxLayout(self) self.libraryBrowserView = QtGui.QListView(self) + self.libraryBrowserView.setMaximumWidth(160) self.libraryModel = LibraryModel(self) self.libraryModel.setColumnCount(1) # Create an icon with an icon: @@ -326,6 +328,10 @@ self.startedConnection = None if __name__ == '__main__': + if sys.version_info.major != 3: + print('Please use python 3.x') + sys.exit(1) + app = QtGui.QApplication(sys.argv) global editor editor = DiagramEditor()