本文整理汇总了Python中AnyQt.QtWidgets.QGridLayout.setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:Python QGridLayout.setContentsMargins方法的具体用法?Python QGridLayout.setContentsMargins怎么用?Python QGridLayout.setContentsMargins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QGridLayout
的用法示例。
在下文中一共展示了QGridLayout.setContentsMargins方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self, var, lc, widget_parent=None, widget=None):
QWidget.__init__(self)
self.list_view = QListView()
text = []
model = QStandardItemModel(self.list_view)
for (i, val) in enumerate(var.values):
item = QStandardItem(val)
item.setCheckable(True)
if i + 1 in lc:
item.setCheckState(Qt.Checked)
text.append(val)
model.appendRow(item)
model.itemChanged.connect(widget_parent.conditions_changed)
self.list_view.setModel(model)
layout = QGridLayout(self)
layout.addWidget(self.list_view)
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
self.adjustSize()
self.setWindowFlags(Qt.Popup)
self.widget = widget
self.widget.desc_text = ', '.join(text)
self.widget.set_text()
示例2: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __setupUi(self):
layout = QGridLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
layout.setSizeConstraint(QGridLayout.SetFixedSize)
self.setLayout(layout)
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
示例3: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self):
super().__init__()
# data
self.dataA = None
self.dataB = None
# GUI
w = QWidget(self)
self.controlArea.layout().addWidget(w)
grid = QGridLayout()
grid.setContentsMargins(0, 0, 0, 0)
w.setLayout(grid)
# attribute A selection
boxAttrA = gui.vBox(self, self.tr("Attribute A"), addToLayout=False)
grid.addWidget(boxAttrA, 0, 0)
self.attrViewA = gui.comboBox(boxAttrA, self, 'attr_a',
orientation=Qt.Horizontal,
sendSelectedValue=True,
callback=self._invalidate)
self.attrModelA = itemmodels.VariableListModel()
self.attrViewA.setModel(self.attrModelA)
# attribute B selection
boxAttrB = gui.vBox(self, self.tr("Attribute B"), addToLayout=False)
grid.addWidget(boxAttrB, 0, 1)
self.attrViewB = gui.comboBox(boxAttrB, self, 'attr_b',
orientation=Qt.Horizontal,
sendSelectedValue=True,
callback=self._invalidate)
self.attrModelB = itemmodels.VariableListModel()
self.attrViewB.setModel(self.attrModelB)
# info A
boxDataA = gui.vBox(self, self.tr("Data A Input"), addToLayout=False)
grid.addWidget(boxDataA, 1, 0)
self.infoBoxDataA = gui.widgetLabel(boxDataA, self.dataInfoText(None))
# info B
boxDataB = gui.vBox(self, self.tr("Data B Input"), addToLayout=False)
grid.addWidget(boxDataB, 1, 1)
self.infoBoxDataB = gui.widgetLabel(boxDataB, self.dataInfoText(None))
gui.rubber(self)
示例4: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self):
super().__init__()
self.measure_scores = None
self.update_scores = True
self.usefulAttributes = []
self.learners = {}
self.labels = []
self.out_domain_desc = None
self.all_measures = SCORES
self.selectedMeasures = dict([(m.name, True) for m
in self.all_measures])
# Discrete (0) or continuous (1) class mode
self.rankMode = 0
self.data = None
self.discMeasures = [m for m in self.all_measures if
issubclass(DiscreteVariable, m.score.class_type)]
self.contMeasures = [m for m in self.all_measures if
issubclass(ContinuousVariable, m.score.class_type)]
self.score_checks = []
self.cls_scoring_box = gui.vBox(None, "Scoring for Classification")
self.reg_scoring_box = gui.vBox(None, "Scoring for Regression")
boxes = [self.cls_scoring_box] * 7 + [self.reg_scoring_box] * 2
for _score, var, box in zip(SCORES, self._score_vars, boxes):
check = gui.checkBox(
box, self, var, label=_score.name,
callback=lambda val=_score: self.measuresSelectionChanged(val))
self.score_checks.append(check)
self.score_stack = QStackedWidget(self)
self.score_stack.addWidget(self.cls_scoring_box)
self.score_stack.addWidget(self.reg_scoring_box)
self.score_stack.addWidget(QWidget())
self.controlArea.layout().addWidget(self.score_stack)
gui.rubber(self.controlArea)
selMethBox = gui.vBox(
self.controlArea, "Select Attributes", addSpace=True)
grid = QGridLayout()
grid.setContentsMargins(6, 0, 6, 0)
self.selectButtons = QButtonGroup()
self.selectButtons.buttonClicked[int].connect(self.setSelectMethod)
def button(text, buttonid, toolTip=None):
b = QRadioButton(text)
self.selectButtons.addButton(b, buttonid)
if toolTip is not None:
b.setToolTip(toolTip)
return b
b1 = button(self.tr("None"), OWRank.SelectNone)
b2 = button(self.tr("All"), OWRank.SelectAll)
b3 = button(self.tr("Manual"), OWRank.SelectManual)
b4 = button(self.tr("Best ranked:"), OWRank.SelectNBest)
s = gui.spin(selMethBox, self, "nSelected", 1, 100,
callback=self.nSelectedChanged)
grid.addWidget(b1, 0, 0)
grid.addWidget(b2, 1, 0)
grid.addWidget(b3, 2, 0)
grid.addWidget(b4, 3, 0)
grid.addWidget(s, 3, 1)
self.selectButtons.button(self.selectMethod).setChecked(True)
selMethBox.layout().addLayout(grid)
gui.auto_commit(selMethBox, self, "auto_apply", "Send", box=False)
# Discrete, continuous and no_class table views are stacked
self.ranksViewStack = QStackedLayout()
self.mainArea.layout().addLayout(self.ranksViewStack)
self.discRanksView = QTableView()
self.ranksViewStack.addWidget(self.discRanksView)
self.discRanksView.setSelectionBehavior(QTableView.SelectRows)
self.discRanksView.setSelectionMode(QTableView.MultiSelection)
self.discRanksView.setSortingEnabled(True)
self.discRanksLabels = ["#"] + [m.shortname for m in self.discMeasures]
self.discRanksModel = QStandardItemModel(self)
self.discRanksModel.setHorizontalHeaderLabels(self.discRanksLabels)
self.discRanksProxyModel = MySortProxyModel(self)
self.discRanksProxyModel.setSourceModel(self.discRanksModel)
self.discRanksView.setModel(self.discRanksProxyModel)
self.discRanksView.setColumnWidth(0, 20)
self.discRanksView.selectionModel().selectionChanged.connect(
self.commit
)
self.discRanksView.pressed.connect(self.onSelectItem)
self.discRanksView.horizontalHeader().sectionClicked.connect(
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self):
super().__init__()
self.controlArea = QWidget(self.controlArea)
self.layout().addWidget(self.controlArea)
layout = QGridLayout()
self.controlArea.setLayout(layout)
layout.setContentsMargins(4, 4, 4, 4)
box = gui.vBox(self.controlArea, "Available Variables",
addToLayout=False)
self.filter_edit = QLineEdit()
self.filter_edit.setToolTip("Filter the list of available variables.")
box.layout().addWidget(self.filter_edit)
if hasattr(self.filter_edit, "setPlaceholderText"):
self.filter_edit.setPlaceholderText("Filter")
self.completer = QCompleter()
self.completer.setCompletionMode(QCompleter.InlineCompletion)
self.completer_model = QStringListModel()
self.completer.setModel(self.completer_model)
self.completer.setModelSorting(
QCompleter.CaseSensitivelySortedModel)
self.filter_edit.setCompleter(self.completer)
self.completer_navigator = CompleterNavigator(self)
self.filter_edit.installEventFilter(self.completer_navigator)
def dropcompleted(action):
if action == Qt.MoveAction:
self.commit()
self.available_attrs = VariableListModel(enable_dnd=True)
self.available_attrs_proxy = VariableFilterProxyModel()
self.available_attrs_proxy.setSourceModel(self.available_attrs)
self.available_attrs_view = VariablesListItemView(
acceptedType=Orange.data.Variable)
self.available_attrs_view.setModel(self.available_attrs_proxy)
aa = self.available_attrs
aa.dataChanged.connect(self.update_completer_model)
aa.rowsInserted.connect(self.update_completer_model)
aa.rowsRemoved.connect(self.update_completer_model)
self.available_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.available_attrs_view))
self.available_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
self.filter_edit.textChanged.connect(self.update_completer_prefix)
self.filter_edit.textChanged.connect(
self.available_attrs_proxy.set_filter_string)
box.layout().addWidget(self.available_attrs_view)
layout.addWidget(box, 0, 0, 3, 1)
box = gui.vBox(self.controlArea, "Features", addToLayout=False)
self.used_attrs = VariableListModel(enable_dnd=True)
self.used_attrs_view = VariablesListItemView(
acceptedType=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.used_attrs_view.setModel(self.used_attrs)
self.used_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.used_attrs_view))
self.used_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.used_attrs_view)
layout.addWidget(box, 0, 2, 1, 1)
box = gui.vBox(self.controlArea, "Target Variable", addToLayout=False)
self.class_attrs = ClassVarListItemModel(enable_dnd=True)
self.class_attrs_view = ClassVariableItemView(
acceptedType=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.class_attrs_view.setModel(self.class_attrs)
self.class_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.class_attrs_view))
self.class_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
self.class_attrs_view.setMaximumHeight(24)
box.layout().addWidget(self.class_attrs_view)
layout.addWidget(box, 1, 2, 1, 1)
box = gui.vBox(self.controlArea, "Meta Attributes", addToLayout=False)
self.meta_attrs = VariableListModel(enable_dnd=True)
self.meta_attrs_view = VariablesListItemView(
acceptedType=Orange.data.Variable)
self.meta_attrs_view.setModel(self.meta_attrs)
self.meta_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.meta_attrs_view))
self.meta_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.meta_attrs_view)
layout.addWidget(box, 2, 2, 1, 1)
bbox = gui.vBox(self.controlArea, addToLayout=False, margin=0)
layout.addWidget(bbox, 0, 1, 1, 1)
self.up_attr_button = gui.button(bbox, self, "Up",
callback=partial(self.move_up, self.used_attrs_view))
self.move_attr_button = gui.button(bbox, self, ">",
callback=partial(self.move_selected, self.used_attrs_view))
self.down_attr_button = gui.button(bbox, self, "Down",
callback=partial(self.move_down, self.used_attrs_view))
bbox = gui.vBox(self.controlArea, addToLayout=False, margin=0)
#.........这里部分代码省略.........
示例6: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self, *args):
QWidget.__init__(self, *args)
self.setContentsMargins(0, 0, 0, 0)
gridLayout = QGridLayout()
gridLayout.setContentsMargins(0, 0, 0, 0)
gridLayout.setSpacing(1)
model = QStandardItemModel(self)
model.rowsInserted.connect(self.__changed)
model.rowsRemoved.connect(self.__changed)
model.dataChanged.connect(self.__changed)
self._listView = QListView(self)
self._listView.setModel(model)
# self._listView.setDragEnabled(True)
self._listView.setDropIndicatorShown(True)
self._listView.setDragDropMode(QListView.InternalMove)
self._listView.viewport().setAcceptDrops(True)
self._listView.setMinimumHeight(100)
gridLayout.addWidget(self._listView, 0, 0, 2, 2)
vButtonLayout = QVBoxLayout()
self._upAction = QAction(
"\u2191", self, toolTip="Move up")
self._upButton = QToolButton(self)
self._upButton.setDefaultAction(self._upAction)
self._upButton.setSizePolicy(
QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
self._downAction = QAction(
"\u2193", self, toolTip="Move down")
self._downButton = QToolButton(self)
self._downButton.setDefaultAction(self._downAction)
self._downButton.setSizePolicy(
QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
vButtonLayout.addWidget(self._upButton)
vButtonLayout.addWidget(self._downButton)
gridLayout.addLayout(vButtonLayout, 0, 2, 2, 1)
hButtonLayout = QHBoxLayout()
self._addAction = QAction("+", self)
self._addButton = QToolButton(self)
self._addButton.setDefaultAction(self._addAction)
self._removeAction = QAction("-", self)
self._removeButton = QToolButton(self)
self._removeButton.setDefaultAction(self._removeAction)
hButtonLayout.addWidget(self._addButton)
hButtonLayout.addWidget(self._removeButton)
hButtonLayout.addStretch(10)
gridLayout.addLayout(hButtonLayout, 2, 0, 1, 2)
self.setLayout(gridLayout)
self._addAction.triggered.connect(self._onAddAction)
self._removeAction.triggered.connect(self._onRemoveAction)
self._upAction.triggered.connect(self._onUpAction)
self._downAction.triggered.connect(self._onDownAction)
示例7: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self):
super().__init__()
self.data = None
self.features = None
# Schedule interface updates (enabled buttons) using a coalescing
# single shot timer (complex interactions on selection and filtering
# updates in the 'available_attrs_view')
self.__interface_update_timer = QTimer(self, interval=0, singleShot=True)
self.__interface_update_timer.timeout.connect(
self.__update_interface_state)
# The last view that has the selection for move operation's source
self.__last_active_view = None # type: Optional[QListView]
def update_on_change(view):
# Schedule interface state update on selection change in `view`
self.__last_active_view = view
self.__interface_update_timer.start()
self.controlArea = QWidget(self.controlArea)
self.layout().addWidget(self.controlArea)
layout = QGridLayout()
self.controlArea.setLayout(layout)
layout.setContentsMargins(4, 4, 4, 4)
box = gui.vBox(self.controlArea, "Available Variables",
addToLayout=False)
self.available_attrs = VariablesListItemModel()
filter_edit, self.available_attrs_view = variables_filter(
parent=self, model=self.available_attrs)
box.layout().addWidget(filter_edit)
def dropcompleted(action):
if action == Qt.MoveAction:
self.commit()
self.available_attrs_view.selectionModel().selectionChanged.connect(
partial(update_on_change, self.available_attrs_view))
self.available_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.available_attrs_view)
layout.addWidget(box, 0, 0, 3, 1)
box = gui.vBox(self.controlArea, "Features", addToLayout=False)
self.used_attrs = VariablesListItemModel()
filter_edit, self.used_attrs_view = variables_filter(
parent=self, model=self.used_attrs,
accepted_type=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.used_attrs.rowsInserted.connect(self.__used_attrs_changed)
self.used_attrs.rowsRemoved.connect(self.__used_attrs_changed)
self.used_attrs_view.selectionModel().selectionChanged.connect(
partial(update_on_change, self.used_attrs_view))
self.used_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
self.use_features_box = gui.auto_commit(
self.controlArea, self, "use_input_features",
"Use input features", "Always use input features",
box=False, commit=self.__use_features_clicked,
callback=self.__use_features_changed, addToLayout=False
)
self.enable_use_features_box()
box.layout().addWidget(self.use_features_box)
box.layout().addWidget(filter_edit)
box.layout().addWidget(self.used_attrs_view)
layout.addWidget(box, 0, 2, 1, 1)
box = gui.vBox(self.controlArea, "Target Variable", addToLayout=False)
self.class_attrs = VariablesListItemModel()
self.class_attrs_view = VariablesListItemView(
acceptedType=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.class_attrs_view.setModel(self.class_attrs)
self.class_attrs_view.selectionModel().selectionChanged.connect(
partial(update_on_change, self.class_attrs_view))
self.class_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
self.class_attrs_view.setMaximumHeight(72)
box.layout().addWidget(self.class_attrs_view)
layout.addWidget(box, 1, 2, 1, 1)
box = gui.vBox(self.controlArea, "Meta Attributes", addToLayout=False)
self.meta_attrs = VariablesListItemModel()
self.meta_attrs_view = VariablesListItemView(
acceptedType=Orange.data.Variable)
self.meta_attrs_view.setModel(self.meta_attrs)
self.meta_attrs_view.selectionModel().selectionChanged.connect(
partial(update_on_change, self.meta_attrs_view))
self.meta_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.meta_attrs_view)
layout.addWidget(box, 2, 2, 1, 1)
bbox = gui.vBox(self.controlArea, addToLayout=False, margin=0)
layout.addWidget(bbox, 0, 1, 1, 1)
self.up_attr_button = gui.button(bbox, self, "Up",
callback=partial(self.move_up, self.used_attrs_view))
self.move_attr_button = gui.button(bbox, self, ">",
callback=partial(self.move_selected,
self.used_attrs_view)
)
self.down_attr_button = gui.button(bbox, self, "Down",
#.........这里部分代码省略.........
示例8: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self):
super().__init__()
self.scorers = OrderedDict()
self.out_domain_desc = None
self.data = None
self.problem_type_mode = ProblemType.CLASSIFICATION
if not self.selected_methods:
self.selected_methods = {method.name for method in SCORES
if method.is_default}
# GUI
self.ranksModel = model = TableModel(parent=self) # type: TableModel
self.ranksView = view = TableView(self) # type: TableView
self.mainArea.layout().addWidget(view)
view.setModel(model)
view.setColumnWidth(0, 30)
view.selectionModel().selectionChanged.connect(self.on_select)
def _set_select_manual():
self.setSelectionMethod(OWRank.SelectManual)
view.pressed.connect(_set_select_manual)
view.verticalHeader().sectionClicked.connect(_set_select_manual)
view.horizontalHeader().sectionClicked.connect(self.headerClick)
self.measuresStack = stacked = QStackedWidget(self)
self.controlArea.layout().addWidget(stacked)
for scoring_methods in (CLS_SCORES,
REG_SCORES,
[]):
box = gui.vBox(None, "Scoring Methods" if scoring_methods else None)
stacked.addWidget(box)
for method in scoring_methods:
box.layout().addWidget(QCheckBox(
method.name, self,
objectName=method.shortname, # To be easily found in tests
checked=method.name in self.selected_methods,
stateChanged=partial(self.methodSelectionChanged, method_name=method.name)))
gui.rubber(box)
gui.rubber(self.controlArea)
self.switchProblemType(ProblemType.CLASSIFICATION)
selMethBox = gui.vBox(self.controlArea, "Select Attributes", addSpace=True)
grid = QGridLayout()
grid.setContentsMargins(6, 0, 6, 0)
self.selectButtons = QButtonGroup()
self.selectButtons.buttonClicked[int].connect(self.setSelectionMethod)
def button(text, buttonid, toolTip=None):
b = QRadioButton(text)
self.selectButtons.addButton(b, buttonid)
if toolTip is not None:
b.setToolTip(toolTip)
return b
b1 = button(self.tr("None"), OWRank.SelectNone)
b2 = button(self.tr("All"), OWRank.SelectAll)
b3 = button(self.tr("Manual"), OWRank.SelectManual)
b4 = button(self.tr("Best ranked:"), OWRank.SelectNBest)
s = gui.spin(selMethBox, self, "nSelected", 1, 100,
callback=lambda: self.setSelectionMethod(OWRank.SelectNBest))
grid.addWidget(b1, 0, 0)
grid.addWidget(b2, 1, 0)
grid.addWidget(b3, 2, 0)
grid.addWidget(b4, 3, 0)
grid.addWidget(s, 3, 1)
self.selectButtons.button(self.selectionMethod).setChecked(True)
selMethBox.layout().addLayout(grid)
gui.auto_commit(selMethBox, self, "auto_apply", "Send", box=False)
self.resize(690, 500)
示例9: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self):
super().__init__()
self.controlArea = QWidget(self.controlArea)
self.layout().addWidget(self.controlArea)
layout = QGridLayout()
self.controlArea.setLayout(layout)
layout.setContentsMargins(4, 4, 4, 4)
box = gui.vBox(self.controlArea, "Available Variables",
addToLayout=False)
self.available_attrs = VariableListModel(enable_dnd=True)
filter_edit, self.available_attrs_view = variables_filter(
parent=self, model=self.available_attrs)
box.layout().addWidget(filter_edit)
def dropcompleted(action):
if action == Qt.MoveAction:
self.commit()
self.available_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.available_attrs_view))
self.available_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.available_attrs_view))
self.available_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.available_attrs_view)
layout.addWidget(box, 0, 0, 3, 1)
box = gui.vBox(self.controlArea, "Features", addToLayout=False)
self.used_attrs = VariableListModel(enable_dnd=True)
self.used_attrs_view = VariablesListItemView(
acceptedType=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.used_attrs_view.setModel(self.used_attrs)
self.used_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.used_attrs_view))
self.used_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.used_attrs_view)
layout.addWidget(box, 0, 2, 1, 1)
box = gui.vBox(self.controlArea, "Target Variable", addToLayout=False)
self.class_attrs = ClassVarListItemModel(enable_dnd=True)
self.class_attrs_view = ClassVariableItemView(
acceptedType=(Orange.data.DiscreteVariable,
Orange.data.ContinuousVariable))
self.class_attrs_view.setModel(self.class_attrs)
self.class_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.class_attrs_view))
self.class_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
self.class_attrs_view.setMaximumHeight(72)
box.layout().addWidget(self.class_attrs_view)
layout.addWidget(box, 1, 2, 1, 1)
box = gui.vBox(self.controlArea, "Meta Attributes", addToLayout=False)
self.meta_attrs = VariableListModel(enable_dnd=True)
self.meta_attrs_view = VariablesListItemView(
acceptedType=Orange.data.Variable)
self.meta_attrs_view.setModel(self.meta_attrs)
self.meta_attrs_view.selectionModel().selectionChanged.connect(
partial(self.update_interface_state, self.meta_attrs_view))
self.meta_attrs_view.dragDropActionDidComplete.connect(dropcompleted)
box.layout().addWidget(self.meta_attrs_view)
layout.addWidget(box, 2, 2, 1, 1)
bbox = gui.vBox(self.controlArea, addToLayout=False, margin=0)
layout.addWidget(bbox, 0, 1, 1, 1)
self.up_attr_button = gui.button(bbox, self, "Up",
callback=partial(self.move_up, self.used_attrs_view))
self.move_attr_button = gui.button(bbox, self, ">",
callback=partial(self.move_selected,
self.used_attrs_view)
)
self.down_attr_button = gui.button(bbox, self, "Down",
callback=partial(self.move_down, self.used_attrs_view))
bbox = gui.vBox(self.controlArea, addToLayout=False, margin=0)
layout.addWidget(bbox, 1, 1, 1, 1)
self.up_class_button = gui.button(bbox, self, "Up",
callback=partial(self.move_up, self.class_attrs_view))
self.move_class_button = gui.button(bbox, self, ">",
callback=partial(self.move_selected,
self.class_attrs_view,
exclusive=False)
)
self.down_class_button = gui.button(bbox, self, "Down",
callback=partial(self.move_down, self.class_attrs_view))
bbox = gui.vBox(self.controlArea, addToLayout=False, margin=0)
layout.addWidget(bbox, 2, 1, 1, 1)
self.up_meta_button = gui.button(bbox, self, "Up",
callback=partial(self.move_up, self.meta_attrs_view))
self.move_meta_button = gui.button(bbox, self, ">",
callback=partial(self.move_selected,
self.meta_attrs_view)
)
self.down_meta_button = gui.button(bbox, self, "Down",
callback=partial(self.move_down, self.meta_attrs_view))
#.........这里部分代码省略.........
示例10: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGridLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QGridLayout import setContentsMargins [as 别名]
def __init__(self):
super().__init__()
self.data = None
self.stored_phase = None
self.spectra_table = None
if self.dx_HeNe is True:
self.dx = 1.0 / self.laser_wavenumber / 2.0
# GUI
# An info box
infoBox = gui.widgetBox(self.controlArea, "Info")
self.infoa = gui.widgetLabel(infoBox, "No data on input.")
self.infob = gui.widgetLabel(infoBox, "")
self.infoc = gui.widgetLabel(infoBox, "")
# Input Data control area
self.dataBox = gui.widgetBox(self.controlArea, "Input Data")
gui.widgetLabel(self.dataBox, "Datapoint spacing (Δx):")
grid = QGridLayout()
grid.setContentsMargins(0, 0, 0, 0)
self.dx_edit = gui.lineEdit(
self.dataBox, self, "dx",
callback=self.setting_changed,
valueType=float,
controlWidth=100, disabled=self.dx_HeNe
)
self.dx_HeNe_cb = gui.checkBox(
self.dataBox, self, "dx_HeNe",
label="HeNe laser",
callback=self.dx_changed,
)
lb = gui.widgetLabel(self.dataBox, "cm")
grid.addWidget(self.dx_HeNe_cb, 0, 0)
grid.addWidget(self.dx_edit, 0, 1)
grid.addWidget(lb, 0, 2)
wl = gui.widgetLabel(self.dataBox, "Sweep Direction:")
box = gui.comboBox(
self.dataBox, self, "sweeps",
label=None,
items=self.sweep_opts,
callback=self.sweeps_changed,
disabled=self.auto_sweeps
)
cb2 = gui.checkBox(
self.dataBox, self, "auto_sweeps",
label="Auto",
callback=self.sweeps_changed,
)
grid.addWidget(wl, 1, 0, 1, 3)
grid.addWidget(cb2, 2, 0)
grid.addWidget(box, 2, 1)
self.dataBox.layout().addLayout(grid)
box = gui.comboBox(
self.dataBox, self, "peak_search",
label="ZPD Peak Search:",
items=[name.title() for name, _ in irfft.PeakSearch.__members__.items()],
callback=self.setting_changed
)
# FFT Options control area
self.optionsBox = gui.widgetBox(self.controlArea, "FFT Options")
box = gui.comboBox(
self.optionsBox, self, "apod_func",
label="Apodization function:",
items=self.apod_opts,
callback=self.setting_changed
)
box = gui.comboBox(
self.optionsBox, self, "zff",
label="Zero Filling Factor:",
items=(2**n for n in range(10)),
callback=self.setting_changed
)
box = gui.comboBox(
self.optionsBox, self, "phase_corr",
label="Phase Correction:",
items=self.phase_opts,
callback=self.setting_changed
)
grid = QGridLayout()
grid.setContentsMargins(0, 0, 0, 0)
le1 = gui.lineEdit(
self.optionsBox, self, "phase_resolution",
callback=self.setting_changed,
valueType=int, controlWidth=30
)
cb1 = gui.checkBox(
self.optionsBox, self, "phase_res_limit",
label="Limit phase resolution to ",
callback=self.setting_changed,
#.........这里部分代码省略.........