本文整理汇总了Python中PyQt4.QtGui.QListView.setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:Python QListView.setSizePolicy方法的具体用法?Python QListView.setSizePolicy怎么用?Python QListView.setSizePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QListView
的用法示例。
在下文中一共展示了QListView.setSizePolicy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OWPythonScript
# 需要导入模块: from PyQt4.QtGui import QListView [as 别名]
# 或者: from PyQt4.QtGui.QListView import setSizePolicy [as 别名]
class OWPythonScript(OWWidget):
settingsList = ["codeFile", "libraryListSource", "currentScriptIndex",
"splitterState", "auto_execute"]
def __init__(self, parent=None, signalManager=None):
OWWidget.__init__(self, parent, signalManager, 'Python Script')
self.inputs = [("in_data", Orange.data.Table, self.setExampleTable,
Default),
("in_distance", Orange.misc.SymMatrix,
self.setDistanceMatrix, Default),
("in_learner", Orange.core.Learner, self.setLearner,
Default),
("in_classifier", Orange.core.Classifier,
self.setClassifier, Default),
("in_object", object, self.setObject)]
self.outputs = [("out_data", Orange.data.Table),
("out_distance", Orange.misc.SymMatrix),
("out_learner", Orange.core.Learner),
("out_classifier", Orange.core.Classifier, Dynamic),
("out_object", object, Dynamic)]
self.in_data = None
self.in_distance = None
self.in_learner = None
self.in_classifier = None
self.in_object = None
self.auto_execute = False
self.codeFile = ''
self.libraryListSource = [Script("Hello world",
"print 'Hello world'\n")]
self.currentScriptIndex = 0
self.splitterState = None
self.loadSettings()
for s in self.libraryListSource:
s.flags = 0
self._cachedDocuments = {}
self.infoBox = OWGUI.widgetBox(self.controlArea, 'Info')
OWGUI.label(
self.infoBox, self,
"<p>Execute python script.</p><p>Input variables:<ul><li> " + \
"<li>".join(t[0] for t in self.inputs) + \
"</ul></p><p>Output variables:<ul><li>" + \
"<li>".join(t[0] for t in self.outputs) + \
"</ul></p>"
)
self.libraryList = PyListModel([], self, flags=Qt.ItemIsSelectable | \
Qt.ItemIsEnabled | Qt.ItemIsEditable)
self.libraryList.wrap(self.libraryListSource)
self.controlBox = OWGUI.widgetBox(self.controlArea, 'Library')
self.controlBox.layout().setSpacing(1)
self.libraryView = QListView()
self.libraryView.setEditTriggers(QListView.DoubleClicked | \
QListView.EditKeyPressed)
self.libraryView.setSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Preferred)
self.libraryView.setItemDelegate(ScriptItemDelegate(self))
self.libraryView.setModel(self.libraryList)
self.connect(self.libraryView.selectionModel(),
SIGNAL("selectionChanged(QItemSelection, QItemSelection)"),
self.onSelectedScriptChanged)
self.controlBox.layout().addWidget(self.libraryView)
w = ModelActionsWidget()
self.addNewScriptAction = action = QAction("+", self)
action.setToolTip("Add a new script to the library")
self.connect(action, SIGNAL("triggered()"), self.onAddScript)
w.addAction(action)
self.removeAction = action = QAction("-", self)
action.setToolTip("Remove script from library")
self.connect(action, SIGNAL("triggered()"), self.onRemoveScript)
w.addAction(action)
action = QAction("Update", self)
action.setToolTip("Save changes in the editor to library")
action.setShortcut(QKeySequence(QKeySequence.Save))
self.connect(action, SIGNAL("triggered()"),
self.commitChangesToLibrary)
w.addAction(action)
action = QAction("More", self)
action.pyqtConfigure(toolTip="More actions")
new_from_file = QAction("Import a script from a file", self)
save_to_file = QAction("Save selected script to a file", self)
save_to_file.setShortcut(QKeySequence(QKeySequence.SaveAs))
#.........这里部分代码省略.........