本文整理汇总了Python中peacock.utils.WidgetUtils类的典型用法代码示例。如果您正苦于以下问题:Python WidgetUtils类的具体用法?Python WidgetUtils怎么用?Python WidgetUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WidgetUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _callbackClipDirection
def _callbackClipDirection(self):
"""
Callback for when clip direction is altered.
"""
index = self.ClipDirection.currentIndex()
WidgetUtils.loadWidget(self.ClipSlider, self.stateKey(index), 'ClipDirection')
self.clip()
示例2: testDump
def testDump(self):
objs = [QObject()]
objs.append(QObject(parent=objs[0]))
objs.append(QObject(parent=objs[0]))
objs.append(QObject(parent=objs[1]))
objs.append(QObject(parent=objs[2]))
WidgetUtils.dumpQObjectTree(objs[0])
示例3: _callbackClipSlider
def _callbackClipSlider(self, value):
"""
Callback for slider.
"""
index = self.ClipDirection.currentIndex()
WidgetUtils.storeWidget(self.ClipSlider, self.stateKey(index), 'ClipDirection')
self.clip()
示例4: _addMenus
def _addMenus(self):
"""
Internal method to allow plugins to add menus to the main menu bar.
"""
super(PeacockMainWindow, self)._addMenus()
menubar = self.menuBar()
debug_menu = menubar.addMenu("Debug")
WidgetUtils.addAction(debug_menu, "Show Python Console", self._showConsole, "Ctrl+P", True)
示例5: addToMenu
def addToMenu(self, menu):
"""
Adds menu entries specific to the Arguments to the menubar.
"""
workingMenu = menu.addMenu("Recent &working dirs")
self._recent_working_menu = RecentlyUsedMenu(workingMenu,
"execute/recentWorkingDirs",
"execute/maxRecentWorkingDirs",
20,
)
self._recent_working_menu.selected.connect(self.setWorkingDir)
self._workingDirChanged()
exeMenu = menu.addMenu("Recent &executables")
self._recent_exe_menu = RecentlyUsedMenu(exeMenu,
"execute/recentExes",
"execute/maxRecentExes",
20,
)
self._recent_exe_menu.selected.connect(self.setExecutablePath)
argsMenu = menu.addMenu("Recent &arguments")
self._recent_args_menu = RecentlyUsedMenu(argsMenu,
"execute/recentArgs",
"execute/maxRecentArgs",
20,
)
self._recent_args_menu.selected.connect(self._setExecutableArgs)
self._force_reload_action = WidgetUtils.addAction(menu, "Reload executable syntax", self._reload_syntax)
self._force_reload_action.setEnabled(False)
示例6: __init__
def __init__(self, comments=""):
"""
Just holds a TextEdit and a label
"""
super(CommentEditor, self).__init__()
self.top_layout = WidgetUtils.addLayout(vertical=True)
self.setLayout(self.top_layout)
self.editor = QPlainTextEdit(self)
self.editor.resize(10, 10)
self.editor.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
self.editor.setPlainText(comments)
self.label = WidgetUtils.addLabel(self.top_layout, self, "Comment")
self.top_layout.addWidget(self.editor)
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
self.setMinimumSize(0, 20)
self.editor.textChanged.connect(self.textChanged)
示例7: __init__
def __init__(self, tree, **kwds):
"""
Input:
tree[InputTree]: The input tree to read blocks from.
"""
super(BlockTree, self).__init__(**kwds)
self.tree = tree
self.root_item = self.invisibleRootItem()
self.header().close()
self.setFocusPolicy(Qt.WheelFocus)
self._item_block_map = {}
self._path_item_map = {}
self.setAcceptDrops(True)
self.setDropIndicatorShown(True)
self.setDragDropMode(QAbstractItemView.InternalMove)
self._mime_type = "application/x-qabstractitemmodeldatalist"
self._current_drag = None
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self._treeContextMenu)
self.itemClicked.connect(self.onItemClicked)
self.itemDoubleClicked.connect(self.onItemDoubleClicked)
self.itemChanged.connect(self.onItemChanged)
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
self.setExpandsOnDoubleClick(False)
self.setItemsExpandable(True)
self.setMouseTracking(False)
self.setSelectionMode(QAbstractItemView.SingleSelection)
self.clone_shortcut = WidgetUtils.addShortcut(self, "Ctrl+N", self._newBlockShortcut, shortcut_with_children=True)
self.populateFromTree()
self.setup()
示例8: load
def load(self, key, cache, **kwargs):
"""
Load the state of the widget.
Args:
key[str]: The key to which the current settings should be stored.
cache[str|list]: A list of cache(s) that the values should be stored.
Kwargs:
passed to peacock.utils.WidgetUtils.storeWidget
"""
if not isinstance(cache, list):
cache = [cache]
for c in cache:
WidgetUtils.loadWidget(self, str(key), c, **kwargs)
示例9: __init__
def __init__(self, **kwds):
"""
Constructor.
"""
super(LogWidget, self).__init__(**kwds)
self.top_layout = WidgetUtils.addLayout(vertical=True)
self.setLayout(self.top_layout)
self.log = QTextBrowser(self)
self.log.setStyleSheet("QTextBrowser { background: black; color: white; }")
self.log.setReadOnly(True)
message.messageEmitter.message.connect(self._write)
self.button_layout = WidgetUtils.addLayout()
self.hide_button = WidgetUtils.addButton(self.button_layout, self, "Hide", lambda: self.hide())
self.clear_button = WidgetUtils.addButton(self.button_layout, self, "Clear", lambda: self.log.clear())
self.top_layout.addWidget(self.log)
self.top_layout.addLayout(self.button_layout)
self.resize(800, 500)
示例10: __init__
def __init__(self, **kwds):
super(CheckInputWidget, self).__init__(**kwds)
self.input_file = "peacock_check_input.i"
self.top_layout = WidgetUtils.addLayout(vertical=True)
self.setLayout(self.top_layout)
self.output = QTextBrowser(self)
self.output.setStyleSheet("QTextBrowser { background: black; color: white; }")
self.output.setReadOnly(True)
self.top_layout.addWidget(self.output)
self.button_layout = WidgetUtils.addLayout()
self.top_layout.addLayout(self.button_layout)
self.hide_button = WidgetUtils.addButton(self.button_layout, self, "Hide", lambda: self.hide())
self.check_button = WidgetUtils.addButton(self.button_layout, self, "Check", self._check)
self.resize(800, 500)
self.setup()
self.path = None
示例11: load
def load(self, *args, **kwargs):
"""
Load the state of the widget.
Args:
key[str]: The key to which the current settings should be stored.
*args[list]: List of widgets to store, if not provided self is used.
Kwargs:
passed to peacock.utils.WidgetUtils.storeWidget
"""
key = kwargs.pop('key', self.stateKey())
if args:
for widget in args:
WidgetUtils.loadWidget(widget, key, **kwargs)
else:
WidgetUtils.loadWidget(self, key, **kwargs)
示例12: store
def store(self, *args, **kwargs):
"""
Store the widget state.
Args:
*args[list]: List of widgets to store, if not provided self is used.
Kwargs:
passed to peacock.utils.WidgetUtils.storeWidget
"""
self.blockSignals(True)
key = kwargs.pop('key', self.stateKey())
if args:
for widget in args:
WidgetUtils.storeWidget(widget, key, **kwargs)
else:
WidgetUtils.storeWidget(self, key, **kwargs)
self.blockSignals(False)
示例13: __init__
def __init__(self):
super(ViewerCornerWidget, self).__init__()
self._icon_size = QtCore.QSize(24, 24)
self.MainLayout = QtWidgets.QHBoxLayout()
self.MainLayout.setContentsMargins(0, 0, 0, 0)
self.MainLayout.setSpacing(10)
self.setLayout(self.MainLayout)
self.CloseButton = QtWidgets.QPushButton(WidgetUtils.createIcon('close.ico'), 'Close')
self.CloneButton = QtWidgets.QPushButton(WidgetUtils.createIcon('copy.ico'), 'Clone')
#self.MainLayout.addStretch()
self.MainLayout.addWidget(self.CloneButton)
self.MainLayout.addWidget(self.CloseButton)
self.setup()
self.adjustSize()
示例14: _callbackHideButton
def _callbackHideButton(self):
"""
Toggles the collapsible content.
"""
self._collapsed = not self._collapsed
self._collapsible_widget.setHidden(self._collapsed)
# PeacockCollapsibleWidget.toggleCollapsed(self._collapsible_layout, self._collapsed)
name = 'plus.svg' if self._collapsed else 'minus.svg'
self._collapse_button.setIcon(WidgetUtils.createIcon(name))
示例15: _setupLiveTableButton
def _setupLiveTableButton(self, qobject):
"""
Setup method for python script output button.
"""
qobject.clicked.connect(self._callbackLiveTableButton)
qobject.setIcon(WidgetUtils.createIcon('table.svg'))
qobject.setIconSize(self._icon_size)
qobject.setFixedSize(qobject.iconSize())
qobject.setToolTip("Show a table of the CSV data for each open file.")
qobject.setStyleSheet("QPushButton {border:none}")