Skip to content

Commit

Permalink
Add scrollbar to port tables in configure widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Mar 21, 2017
1 parent 4573a0c commit e93f8af
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions vistrails/gui/modules/source_configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ def __init__(self, module, controller, editor_class=None,
self.codeEditor = editor_class(parent)
self.setWindowTitle('%s Configuration' % module.name)
self.setLayout(QtGui.QVBoxLayout())
self.layout().setMargin(0)
self.layout().setSpacing(0)
self.has_inputs = has_inputs
self.has_outputs = has_outputs
self.sourcePortName = portName
Expand All @@ -84,12 +82,24 @@ def __init__(self, module, controller, editor_class=None,
self.adjustSize()

def createPortTable(self, has_inputs=True, has_outputs=True):
table_layout = QtGui.QVBoxLayout()
table_layout.setMargin(0)
table_layout.setSpacing(0)
inner_widget = QtGui.QWidget()
inner_widget.setLayout(table_layout)
scrollarea = QtGui.QScrollArea()
scrollarea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
scrollarea.setWidget(inner_widget)
scrollarea.setWidgetResizable(True)
scrollarea.setSizePolicy(QtGui.QSizePolicy.Preferred,
QtGui.QSizePolicy.Maximum)
self.layout().addWidget(scrollarea, 1)
if has_inputs:
self.inputPortTable = PortTable(self)
labels = ["Input Port Name", "Type", "List Depth"]
self.inputPortTable.setHorizontalHeaderLabels(labels)
self.inputPortTable.initializePorts(self.module.input_port_specs)
self.layout().addWidget(self.inputPortTable)
table_layout.addWidget(self.inputPortTable)
horiz = self.inputPortTable.horizontalHeader()
horiz.setResizeMode(1, QtGui.QHeaderView.Stretch)
if has_outputs:
Expand All @@ -98,7 +108,7 @@ def createPortTable(self, has_inputs=True, has_outputs=True):
self.outputPortTable.setHorizontalHeaderLabels(labels)
self.outputPortTable.initializePorts(self.module.output_port_specs,
True)
self.layout().addWidget(self.outputPortTable)
table_layout.addWidget(self.outputPortTable)
horiz = self.outputPortTable.horizontalHeader()
horiz.setResizeMode(1, QtGui.QHeaderView.Stretch)
if has_inputs:
Expand Down Expand Up @@ -145,7 +155,7 @@ def findSourceFunction(self):

def setupEditor(self):
self.initializeCode()
self.layout().addWidget(self.codeEditor, 1)
self.layout().addWidget(self.codeEditor, 2)

self.cursorLabel = QtGui.QLabel()
self.layout().addWidget(self.cursorLabel)
Expand Down

0 comments on commit e93f8af

Please sign in to comment.