本文整理汇总了Python中AnyQt.QtWidgets.QListView类的典型用法代码示例。如果您正苦于以下问题:Python QListView类的具体用法?Python QListView怎么用?Python QListView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QListView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CheckBoxPopup
class CheckBoxPopup(QWidget):
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()
def moved(self):
point = self.widget.rect().bottomRight()
global_point = self.widget.mapToGlobal(point)
self.move(global_point - QPoint(self.width(), 0))
示例2: test_dock_standalone
def test_dock_standalone(self):
widget = QWidget()
layout = QHBoxLayout()
widget.setLayout(layout)
layout.addStretch(1)
widget.show()
dock = CollapsibleDockWidget()
layout.addWidget(dock)
list_view = QListView()
list_view.setModel(QStringListModel(["a", "b"], list_view))
label = QLabel("A label. ")
label.setWordWrap(True)
dock.setExpandedWidget(label)
dock.setCollapsedWidget(list_view)
dock.setExpanded(True)
self.app.processEvents()
def toogle():
dock.setExpanded(not dock.expanded())
self.singleShot(2000, toogle)
toogle()
self.app.exec_()
示例3: __init__
def __init__(self, parent=None):
super().__init__(parent)
## Attributes
self.data = None
self.distances = None
self.groups = None
self.unique_pos = None
self.base_group_index = 0
## GUI
box = gui.widgetBox(self.controlArea, "Info")
self.info_box = gui.widgetLabel(box, "\n")
## Separate By box
box = gui.widgetBox(self.controlArea, "Separate By")
self.split_by_model = itemmodels.PyListModel(parent=self)
self.split_by_view = QListView()
self.split_by_view.setSelectionMode(QListView.ExtendedSelection)
self.split_by_view.setModel(self.split_by_model)
box.layout().addWidget(self.split_by_view)
self.split_by_view.selectionModel().selectionChanged.connect(
self.on_split_key_changed)
## Sort By box
box = gui.widgetBox(self.controlArea, "Sort By")
self.sort_by_model = itemmodels.PyListModel(parent=self)
self.sort_by_view = QListView()
self.sort_by_view.setSelectionMode(QListView.ExtendedSelection)
self.sort_by_view.setModel(self.sort_by_model)
box.layout().addWidget(self.sort_by_view)
self.sort_by_view.selectionModel().selectionChanged.connect(
self.on_sort_key_changed)
## Distance box
box = gui.widgetBox(self.controlArea, "Distance Measure")
gui.comboBox(box, self, "selected_distance_index",
items=[name for name, _ in self.DISTANCE_FUNCTIONS],
callback=self.on_distance_measure_changed)
self.scene = QGraphicsScene()
self.scene_view = QGraphicsView(self.scene)
self.scene_view.setRenderHints(QPainter.Antialiasing)
self.scene_view.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.mainArea.layout().addWidget(self.scene_view)
self.scene_view.installEventFilter(self)
self._disable_updates = False
self._cached_distances = {}
self._base_index_hints = {}
self.main_widget = None
self.resize(800, 600)
示例4: __init__
def __init__(self, *args, **kwargs):
QListView.__init__(self, *args, **kwargs)
self.setViewMode(QListView.IconMode)
self.setWrapping(False)
self.setWordWrap(True)
self.setSelectionMode(QListView.SingleSelection)
self.setEditTriggers(QListView.NoEditTriggers)
self.setMovement(QListView.Static)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setSizePolicy(QSizePolicy.Expanding,
QSizePolicy.Fixed)
self.setIconSize(QSize(120, 80))
示例5: __init__
def __init__(self, parent):
QFrame.__init__(self, parent)
self.setContentsMargins(0, 0, 0, 0)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(1)
self._setNameLineEdit = QLineEdit(self)
layout.addWidget(self._setNameLineEdit)
self._setListView = QListView(self)
self._listModel = QStandardItemModel(self)
self._proxyModel = QSortFilterProxyModel(self)
self._proxyModel.setSourceModel(self._listModel)
self._setListView.setModel(self._proxyModel)
self._setListView.setItemDelegate(ListItemDelegate(self))
self._setNameLineEdit.textChanged.connect(
self._proxyModel.setFilterFixedString)
self._completer = QCompleter(self._listModel, self)
self._setNameLineEdit.setCompleter(self._completer)
self._listModel.itemChanged.connect(self._onSetNameChange)
layout.addWidget(self._setListView)
buttonLayout = QHBoxLayout()
self._addAction = QAction(
"+", self, toolTip="Add a new sort key")
self._updateAction = QAction(
"Update", self, toolTip="Update/save current selection")
self._removeAction = QAction(
"\u2212", self, toolTip="Remove selected sort key.")
self._addToolButton = QToolButton(self)
self._updateToolButton = QToolButton(self)
self._removeToolButton = QToolButton(self)
self._updateToolButton.setSizePolicy(
QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
self._addToolButton.setDefaultAction(self._addAction)
self._updateToolButton.setDefaultAction(self._updateAction)
self._removeToolButton.setDefaultAction(self._removeAction)
buttonLayout.addWidget(self._addToolButton)
buttonLayout.addWidget(self._updateToolButton)
buttonLayout.addWidget(self._removeToolButton)
layout.addLayout(buttonLayout)
self.setLayout(layout)
self._addAction.triggered.connect(self.addCurrentSelection)
self._updateAction.triggered.connect(self.updateSelectedSelection)
self._removeAction.triggered.connect(self.removeSelectedSelection)
self._setListView.selectionModel().selectionChanged.connect(
self._onListViewSelectionChanged)
self.selectionModel = None
self._selections = []
示例6: __init__
def __init__(self):
super().__init__()
self.data = None
self.input_vars = ()
self._invalidated = False
box = gui.vBox(self.controlArea, "Domain Features")
self.domain_model = itemmodels.VariableListModel()
self.domain_view = QListView(
selectionMode=QListView.SingleSelection
)
self.domain_view.setModel(self.domain_model)
self.domain_view.selectionModel().selectionChanged.connect(
self._on_selection_changed)
box.layout().addWidget(self.domain_view)
box = gui.hBox(self.controlArea)
gui.button(box, self, "Reset Selected", callback=self.reset_selected)
gui.button(box, self, "Reset All", callback=self.reset_all)
gui.auto_commit(self.controlArea, self, "autocommit", "Apply")
box = gui.vBox(self.mainArea, "Edit")
self.editor_stack = QStackedWidget()
self.editor_stack.addWidget(DiscreteVariableEditor())
self.editor_stack.addWidget(ContinuousVariableEditor())
self.editor_stack.addWidget(VariableEditor())
box.layout().addWidget(self.editor_stack)
示例7: _setup_gui_values
def _setup_gui_values(self):
self.values_edit = QListView()
self.values_edit.setEditTriggers(QTreeView.CurrentChanged)
self.values_model = itemmodels.PyListModel(flags=Qt.ItemIsSelectable | \
Qt.ItemIsEnabled | Qt.ItemIsEditable)
self.values_edit.setModel(self.values_model)
self.values_model.dataChanged.connect(self.on_values_changed)
self.main_form.addRow("Values:", self.values_edit)
示例8: __init__
def __init__(self, parent=None):
super().__init__(self, parent)
self.data = None
self.partitions = []
self.matrix = None
self.split_groups = []
self._disable_updates = False
########
# GUI
########
box = gui.widgetBox(self.controlArea, "Input")
self.info_box = gui.widgetLabel(box, "No data on input\n")
box = gui.widgetBox(self.controlArea, "Separate By",
addSpace=True)
self.separate_view = QListView(
selectionMode=QListView.MultiSelection
)
box.layout().addWidget(self.separate_view)
box = gui.widgetBox(self.controlArea, "Sort By",
addSpace=True)
self.relevant_view = QListView(
selectionMode=QListView.MultiSelection)
box.layout().addWidget(self.relevant_view)
self.distance_view = gui.comboBox(
self.controlArea, self, "distance_measure",
box="Distance Measure",
items=[name for name, _ in self.DISTANCE_FUNCTIONS])
gui.rubber(self.controlArea)
gui.auto_commit(self.controlArea, self, "auto_commit", "Commit")
self.groups_box = gui.widgetBox(self.mainArea, "Groups")
self.groups_scroll_area = QScrollArea()
self.groups_box.layout().addWidget(self.groups_scroll_area)
示例9: test_focus_out
def test_focus_out(self):
cb = self.cb
cb.showPopup()
popup = cb.findChild(QListView)
# Activate some other window to simulate focus out
w = QListView()
w.show()
w.activateWindow()
w.hide()
self.assertFalse(popup.isVisible())
示例10: test_dock_standalone
def test_dock_standalone(self):
widget = QWidget()
layout = QHBoxLayout()
widget.setLayout(layout)
layout.addStretch(1)
widget.show()
dock = CollapsibleDockWidget()
layout.addWidget(dock)
list_view = QListView()
list_view.setModel(QStringListModel(["a", "b"], list_view))
label = QLabel("A label. ")
label.setWordWrap(True)
dock.setExpandedWidget(label)
dock.setCollapsedWidget(list_view)
dock.setExpanded(True)
dock.setExpanded(False)
timer = QTimer(dock, interval=200)
timer.timeout.connect(lambda: dock.setExpanded(not dock.expanded()))
timer.start()
示例11: __init__
def __init__(self):
self.data = None
self.indices = []
box = gui.vBox(self.controlArea, 'Axes')
self.combo_ax2_model = VariableListModel(parent=self)
self.combo_ax1_model = VariableListModel(parent=self)
for model in (self.combo_ax1_model, self.combo_ax2_model):
model[:] = [_enum_str(i) for i in Spiralogram.AxesCategories]
self.combo_ax2 = gui.comboBox(
box, self, 'ax2', label='Y axis:', callback=self.replot,
sendSelectedValue=True, orientation='horizontal',
model=self.combo_ax2_model)
self.combo_ax1 = gui.comboBox(
box, self, 'ax1', label='Radial:', callback=self.replot,
sendSelectedValue=True, orientation='horizontal',
model=self.combo_ax1_model)
gui.checkBox(box, self, 'invert_date_order', 'Invert Y axis order',
callback=self.replot)
box = gui.vBox(self.controlArea, 'Aggregation')
self.combo_func = gui.comboBox(
box, self, 'agg_func', label='Function:', orientation='horizontal',
callback=self.replot)
func_model = ListModel(AGG_FUNCTIONS, parent=self)
self.combo_func.setModel(func_model)
self.attrlist_model = VariableListModel(parent=self)
self.attrlist = QListView(selectionMode=QListView.SingleSelection)
self.attrlist.setModel(self.attrlist_model)
self.attrlist.selectionModel().selectionChanged.connect(
self.attrlist_selectionChanged)
box.layout().addWidget(self.attrlist)
gui.rubber(self.controlArea)
self.chart = chart = Spiralogram(self,
selection_callback=self.on_selection)
self.mainArea.layout().addWidget(chart)
示例12: OWQualityControl
class OWQualityControl(widget.OWWidget):
name = "Quality Control"
description = "Experiment quality control"
icon = "../widgets/icons/QualityControl.svg"
priority = 5000
inputs = [("Experiment Data", Orange.data.Table, "set_data")]
outputs = []
DISTANCE_FUNCTIONS = [("Distance from Pearson correlation",
dist_pcorr),
("Euclidean distance",
dist_eucl),
("Distance from Spearman correlation",
dist_spearman)]
settingsHandler = SetContextHandler()
split_by_labels = settings.ContextSetting({})
sort_by_labels = settings.ContextSetting({})
selected_distance_index = settings.Setting(0)
def __init__(self, parent=None):
super().__init__(parent)
## Attributes
self.data = None
self.distances = None
self.groups = None
self.unique_pos = None
self.base_group_index = 0
## GUI
box = gui.widgetBox(self.controlArea, "Info")
self.info_box = gui.widgetLabel(box, "\n")
## Separate By box
box = gui.widgetBox(self.controlArea, "Separate By")
self.split_by_model = itemmodels.PyListModel(parent=self)
self.split_by_view = QListView()
self.split_by_view.setSelectionMode(QListView.ExtendedSelection)
self.split_by_view.setModel(self.split_by_model)
box.layout().addWidget(self.split_by_view)
self.split_by_view.selectionModel().selectionChanged.connect(
self.on_split_key_changed)
## Sort By box
box = gui.widgetBox(self.controlArea, "Sort By")
self.sort_by_model = itemmodels.PyListModel(parent=self)
self.sort_by_view = QListView()
self.sort_by_view.setSelectionMode(QListView.ExtendedSelection)
self.sort_by_view.setModel(self.sort_by_model)
box.layout().addWidget(self.sort_by_view)
self.sort_by_view.selectionModel().selectionChanged.connect(
self.on_sort_key_changed)
## Distance box
box = gui.widgetBox(self.controlArea, "Distance Measure")
gui.comboBox(box, self, "selected_distance_index",
items=[name for name, _ in self.DISTANCE_FUNCTIONS],
callback=self.on_distance_measure_changed)
self.scene = QGraphicsScene()
self.scene_view = QGraphicsView(self.scene)
self.scene_view.setRenderHints(QPainter.Antialiasing)
self.scene_view.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
self.mainArea.layout().addWidget(self.scene_view)
self.scene_view.installEventFilter(self)
self._disable_updates = False
self._cached_distances = {}
self._base_index_hints = {}
self.main_widget = None
self.resize(800, 600)
def clear(self):
"""Clear the widget state."""
self.data = None
self.distances = None
self.groups = None
self.unique_pos = None
with disable_updates(self):
self.split_by_model[:] = []
self.sort_by_model[:] = []
self.main_widget = None
self.scene.clear()
self.info_box.setText("\n")
self._cached_distances = {}
def set_data(self, data=None):
"""Set input experiment data."""
self.closeContext()
self.clear()
#.........这里部分代码省略.........
示例13: OWImpute
class OWImpute(OWWidget):
name = "Impute"
description = "Impute missing values in the data table."
icon = "icons/Impute.svg"
priority = 2130
inputs = [("Data", Orange.data.Table, "set_data"),
("Learner", Learner, "set_learner")]
outputs = [("Data", Orange.data.Table)]
DEFAULT_LEARNER = SimpleTreeLearner()
METHODS = [AsDefault(), impute.DoNotImpute(), impute.Average(),
impute.AsValue(), impute.Model(DEFAULT_LEARNER), impute.Random(),
impute.DropInstances(), impute.Default()]
DEFAULT, DO_NOT_IMPUTE, MODEL_BASED_IMPUTER, AS_INPUT = 0, 1, 4, 7
settingsHandler = settings.DomainContextHandler()
_default_method_index = settings.Setting(DO_NOT_IMPUTE)
variable_methods = settings.ContextSetting({})
autocommit = settings.Setting(False)
default_value = settings.Setting(0.)
want_main_area = False
resizing_enabled = False
def __init__(self):
super().__init__()
main_layout = QVBoxLayout()
main_layout.setContentsMargins(10, 10, 10, 10)
self.controlArea.layout().addLayout(main_layout)
box = QGroupBox(title=self.tr("Default Method"), flat=False)
box_layout = QVBoxLayout(box)
main_layout.addWidget(box)
button_group = QButtonGroup()
button_group.buttonClicked[int].connect(self.set_default_method)
for i, method in enumerate(self.METHODS):
if not method.columns_only:
button = QRadioButton(method.name)
button.setChecked(i == self.default_method_index)
button_group.addButton(button, i)
box_layout.addWidget(button)
self.default_button_group = button_group
box = QGroupBox(title=self.tr("Individual Attribute Settings"),
flat=False)
main_layout.addWidget(box)
horizontal_layout = QHBoxLayout(box)
main_layout.addWidget(box)
self.varview = QListView(
selectionMode=QListView.ExtendedSelection
)
self.varview.setItemDelegate(DisplayFormatDelegate())
self.varmodel = itemmodels.VariableListModel()
self.varview.setModel(self.varmodel)
self.varview.selectionModel().selectionChanged.connect(
self._on_var_selection_changed
)
self.selection = self.varview.selectionModel()
horizontal_layout.addWidget(self.varview)
method_layout = QVBoxLayout()
horizontal_layout.addLayout(method_layout)
button_group = QButtonGroup()
for i, method in enumerate(self.METHODS):
button = QRadioButton(text=method.name)
button_group.addButton(button, i)
method_layout.addWidget(button)
self.value_combo = QComboBox(
minimumContentsLength=8,
sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength,
activated=self._on_value_selected
)
self.value_combo.currentIndexChanged.connect(self._on_value_changed)
self.value_double = QDoubleSpinBox(
editingFinished=self._on_value_selected,
minimum=-1000., maximum=1000., singleStep=.1, decimals=3,
value=self.default_value
)
self.value_stack = value_stack = QStackedLayout()
value_stack.addWidget(self.value_combo)
value_stack.addWidget(self.value_double)
method_layout.addLayout(value_stack)
button_group.buttonClicked[int].connect(
self.set_method_for_current_selection
)
method_layout.addStretch(2)
reset_button = QPushButton(
"Restore All to Default", checked=False, checkable=False,
#.........这里部分代码省略.........
示例14: OWPythonScript
class OWPythonScript(widget.OWWidget):
name = "Python Script"
description = "Write a Python script and run it on input data or models."
icon = "icons/PythonScript.svg"
priority = 3150
keywords = ["file", "program"]
class Inputs:
data = Input("Data", Table, replaces=["in_data"],
default=True, multiple=True)
learner = Input("Learner", Learner, replaces=["in_learner"],
default=True, multiple=True)
classifier = Input("Classifier", Model, replaces=["in_classifier"],
default=True, multiple=True)
object = Input("Object", object, replaces=["in_object"],
default=False, multiple=True)
class Outputs:
data = Output("Data", Table, replaces=["out_data"])
learner = Output("Learner", Learner, replaces=["out_learner"])
classifier = Output("Classifier", Model, replaces=["out_classifier"])
object = Output("Object", object, replaces=["out_object"])
signal_names = ("data", "learner", "classifier", "object")
settingsHandler = PrepareSavingSettingsHandler()
libraryListSource = \
Setting([Script("Hello world", "print('Hello world')\n")])
currentScriptIndex = Setting(0)
scriptText = Setting(None, schema_only=True)
splitterState = Setting(None)
class Error(OWWidget.Error):
pass
def __init__(self):
super().__init__()
for name in self.signal_names:
setattr(self, name, {})
for s in self.libraryListSource:
s.flags = 0
self._cachedDocuments = {}
self.infoBox = gui.vBox(self.controlArea, 'Info')
gui.label(
self.infoBox, self,
"<p>Execute python script.</p><p>Input variables:<ul><li> " +
"<li>".join(map("in_{0}, in_{0}s".format, self.signal_names)) +
"</ul></p><p>Output variables:<ul><li>" +
"<li>".join(map("out_{0}".format, self.signal_names)) +
"</ul></p>"
)
self.libraryList = itemmodels.PyListModel(
[], self,
flags=Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
self.libraryList.wrap(self.libraryListSource)
self.controlBox = gui.vBox(self.controlArea, 'Library')
self.controlBox.layout().setSpacing(1)
self.libraryView = QListView(
editTriggers=QListView.DoubleClicked |
QListView.EditKeyPressed,
sizePolicy=QSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Preferred)
)
self.libraryView.setItemDelegate(ScriptItemDelegate(self))
self.libraryView.setModel(self.libraryList)
self.libraryView.selectionModel().selectionChanged.connect(
self.onSelectedScriptChanged
)
self.controlBox.layout().addWidget(self.libraryView)
w = itemmodels.ModelActionsWidget()
self.addNewScriptAction = action = QAction("+", self)
action.setToolTip("Add a new script to the library")
action.triggered.connect(self.onAddScript)
w.addAction(action)
action = QAction(unicodedata.lookup("MINUS SIGN"), self)
action.setToolTip("Remove script from library")
action.triggered.connect(self.onRemoveScript)
w.addAction(action)
action = QAction("Update", self)
action.setToolTip("Save changes in the editor to library")
action.setShortcut(QKeySequence(QKeySequence.Save))
action.triggered.connect(self.commitChangesToLibrary)
w.addAction(action)
action = QAction("More", self, toolTip="More actions")
#.........这里部分代码省略.........
示例15: __init__
def __init__(self):
super().__init__()
for name in self.signal_names:
setattr(self, name, {})
for s in self.libraryListSource:
s.flags = 0
self._cachedDocuments = {}
self.infoBox = gui.vBox(self.controlArea, 'Info')
gui.label(
self.infoBox, self,
"<p>Execute python script.</p><p>Input variables:<ul><li> " +
"<li>".join(map("in_{0}, in_{0}s".format, self.signal_names)) +
"</ul></p><p>Output variables:<ul><li>" +
"<li>".join(map("out_{0}".format, self.signal_names)) +
"</ul></p>"
)
self.libraryList = itemmodels.PyListModel(
[], self,
flags=Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
self.libraryList.wrap(self.libraryListSource)
self.controlBox = gui.vBox(self.controlArea, 'Library')
self.controlBox.layout().setSpacing(1)
self.libraryView = QListView(
editTriggers=QListView.DoubleClicked |
QListView.EditKeyPressed,
sizePolicy=QSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Preferred)
)
self.libraryView.setItemDelegate(ScriptItemDelegate(self))
self.libraryView.setModel(self.libraryList)
self.libraryView.selectionModel().selectionChanged.connect(
self.onSelectedScriptChanged
)
self.controlBox.layout().addWidget(self.libraryView)
w = itemmodels.ModelActionsWidget()
self.addNewScriptAction = action = QAction("+", self)
action.setToolTip("Add a new script to the library")
action.triggered.connect(self.onAddScript)
w.addAction(action)
action = QAction(unicodedata.lookup("MINUS SIGN"), self)
action.setToolTip("Remove script from library")
action.triggered.connect(self.onRemoveScript)
w.addAction(action)
action = QAction("Update", self)
action.setToolTip("Save changes in the editor to library")
action.setShortcut(QKeySequence(QKeySequence.Save))
action.triggered.connect(self.commitChangesToLibrary)
w.addAction(action)
action = QAction("More", self, toolTip="More actions")
new_from_file = QAction("Import Script from File", self)
save_to_file = QAction("Save Selected Script to File", self)
restore_saved = QAction("Undo Changes to Selected Script", self)
save_to_file.setShortcut(QKeySequence(QKeySequence.SaveAs))
new_from_file.triggered.connect(self.onAddScriptFromFile)
save_to_file.triggered.connect(self.saveScript)
restore_saved.triggered.connect(self.restoreSaved)
menu = QMenu(w)
menu.addAction(new_from_file)
menu.addAction(save_to_file)
menu.addAction(restore_saved)
action.setMenu(menu)
button = w.addAction(action)
button.setPopupMode(QToolButton.InstantPopup)
w.layout().setSpacing(1)
self.controlBox.layout().addWidget(w)
self.execute_button = gui.button(self.controlArea, self, 'Run', callback=self.commit)
self.splitCanvas = QSplitter(Qt.Vertical, self.mainArea)
self.mainArea.layout().addWidget(self.splitCanvas)
self.defaultFont = defaultFont = \
"Monaco" if sys.platform == "darwin" else "Courier"
self.textBox = gui.vBox(self, 'Python Script')
self.splitCanvas.addWidget(self.textBox)
self.text = PythonScriptEditor(self)
self.textBox.layout().addWidget(self.text)
self.textBox.setAlignment(Qt.AlignVCenter)
self.text.setTabStopWidth(4)
#.........这里部分代码省略.........