本文整理汇总了Python中sip.delete方法的典型用法代码示例。如果您正苦于以下问题:Python sip.delete方法的具体用法?Python sip.delete怎么用?Python sip.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sip
的用法示例。
在下文中一共展示了sip.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toggleFullscreen
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def toggleFullscreen(self) -> None:
if self.mediaAvailable:
pause = self.mpvWidget.property('pause')
mute = self.mpvWidget.property('mute')
vol = self.mpvWidget.property('volume')
pos = self.seekSlider.value() / 1000
if self.mpvWidget.originalParent is not None:
self.mpvWidget.shutdown()
sip.delete(self.mpvWidget)
del self.mpvWidget
self.mpvWidget = self.getMPV(parent=self, file=self.currentMedia, start=pos, pause=pause, mute=mute,
volume=vol)
self.videoplayerLayout.insertWidget(0, self.mpvWidget)
self.mpvWidget.originalParent = None
self.parent.show()
elif self.mpvWidget.parentWidget() != 0:
self.parent.hide()
self.mpvWidget.shutdown()
self.videoplayerLayout.removeWidget(self.mpvWidget)
sip.delete(self.mpvWidget)
del self.mpvWidget
self.mpvWidget = self.getMPV(file=self.currentMedia, start=pos, pause=pause, mute=mute, volume=vol)
self.mpvWidget.originalParent = self
self.mpvWidget.setGeometry(qApp.desktop().screenGeometry(self))
self.mpvWidget.showFullScreen()
示例2: _showSomething
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def _showSomething(self, **kwgs):
MW = self.parent()
if MW.objectName() == "MainWindow":
try:
# MW.Buttom_Vbox.setParent(None)#这是个严重的问题,如果用这个函数会造成78L无法成功
_parent = MW.Buttom_Vbox.parent() # 获取下面窗体对象的指针
for obj in _parent.children():
#print(obj)
sip.delete(obj)
MW.Buttom_Vbox = QVBoxLayout(_parent)
MW.Buttom_Vbox.setContentsMargins(0, 0, 0, 0)
MW.Buttom_Vbox.setSpacing(0)
MW.Buttom_Vbox.setObjectName("Buttom_Vbox")
except:
showERROR()
示例3: unload
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def unload(self, mod: "str"):
"""
3. 卸载插件 , 移除模块.
"""
if mod in sys.modules:
self.pluginsInfo["StartModule"][mod]["active"] = False
#删除对象
objInfo = self.findOldObj(mod)
oldObj = objInfo["oldObj"]
oldObj.flag="unload"
sip.delete(oldObj)
self.pluginsInfo["StartModule"][mod]["old"] = None
sys.modules.pop(mod)
return True
# 卸载所有插件
示例4: tearDown
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def tearDown(self):
if hasattr(self, "dialog"):
self.dialog.close()
try:
sip.delete(self.dialog)
except TypeError:
pass
self.dialog = None
if hasattr(self, "form"):
self.form.close_all_files()
self.form.close()
try:
sip.delete(self.form)
except TypeError:
pass
self.form = None
gc.collect()
示例5: convert_app_for_timing
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def convert_app_for_timing(app: QApplication) -> QApplication:
"""If necessary replace existing app with our special perfmon one.
Parameters
----------
app : QApplication
The existing application if any.
"""
if isinstance(app, QApplicationWithTiming):
# We're already using QApplicationWithTiming so there is nothing
# to do. This happens when napari is launched from the command
# line because we create a QApplicationWithTiming in gui_qt.
return app
if app is not None:
# Because we can't monkey patch QApplication.notify, since it's a
# SIP wrapped C++ method, we delete the current app and create a new one.
# This must be done very early before any Qt objects are created.
import sip
sip.delete(app)
# Is it right to pass in sys.argv here? I think so if there are any
# Qt flags on there?
return QApplicationWithTiming(sys.argv)
示例6: test_deleted_object
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def test_deleted_object(qtbot):
class Obj(QObject):
def func(self):
self.setObjectName("test")
obj = Obj()
throttled = throttle.Throttle(obj.func, DELAY, parent=obj)
throttled()
throttled()
sip.delete(obj)
qtbot.wait(int(1.5 * DELAY))
示例7: _pyside
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def _pyside():
"""Initialise PySide"""
import PySide as module
extras = ["QtUiTools"]
try:
try:
# Before merge of PySide and shiboken
import shiboken
except ImportError:
# After merge of PySide and shiboken, May 2017
from PySide import shiboken
extras.append("shiboken")
except ImportError:
pass
_setup(module, extras)
Qt.__binding_version__ = module.__version__
if hasattr(Qt, "_shiboken"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
Qt.QtCompat.delete = shiboken.delete
if hasattr(Qt, "_QtUiTools"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtGui"):
setattr(Qt, "QtWidgets", _new_module("QtWidgets"))
setattr(Qt, "_QtWidgets", Qt._QtGui)
if hasattr(Qt._QtGui, "QX11Info"):
setattr(Qt, "QtX11Extras", _new_module("QtX11Extras"))
Qt.QtX11Extras.QX11Info = Qt._QtGui.QX11Info
Qt.QtCompat.setSectionResizeMode = Qt._QtGui.QHeaderView.setResizeMode
if hasattr(Qt, "_QtCore"):
Qt.__qt_version__ = Qt._QtCore.qVersion()
_reassign_misplaced_members("PySide")
_build_compatibility_members("PySide")
示例8: _pyqt5
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def _pyqt5():
"""Initialise PyQt5"""
import PyQt5 as module
extras = ["uic"]
try:
import sip
extras.append(sip.__name__)
except ImportError:
sip = None
_setup(module, extras)
if hasattr(Qt, "_sip"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
Qt.QtCompat.delete = sip.delete
if hasattr(Qt, "_uic"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtCore"):
Qt.__binding_version__ = Qt._QtCore.PYQT_VERSION_STR
Qt.__qt_version__ = Qt._QtCore.QT_VERSION_STR
if hasattr(Qt, "_QtWidgets"):
Qt.QtCompat.setSectionResizeMode = \
Qt._QtWidgets.QHeaderView.setSectionResizeMode
_reassign_misplaced_members("PyQt5")
_build_compatibility_members('PyQt5')
示例9: _pyqt5
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def _pyqt5():
"""Initialise PyQt5"""
import PyQt5 as module
extras = ["uic"]
try:
import sip
extras += ["sip"]
except ImportError:
# Relevant to PyQt5 5.11 and above
try:
from PyQt5 import sip
extras += ["sip"]
except ImportError:
sip = None
_setup(module, extras)
if hasattr(Qt, "_sip"):
Qt.QtCompat.wrapInstance = _wrapinstance
Qt.QtCompat.getCppPointer = _getcpppointer
Qt.QtCompat.delete = sip.delete
if hasattr(Qt, "_uic"):
Qt.QtCompat.loadUi = _loadUi
if hasattr(Qt, "_QtCore"):
Qt.__binding_version__ = Qt._QtCore.PYQT_VERSION_STR
Qt.__qt_version__ = Qt._QtCore.QT_VERSION_STR
Qt.QtCompat.dataChanged = (
lambda self, topleft, bottomright, roles=None:
self.dataChanged.emit(topleft, bottomright, roles or [])
)
if hasattr(Qt, "_QtWidgets"):
Qt.QtCompat.setSectionResizeMode = \
Qt._QtWidgets.QHeaderView.setSectionResizeMode
_reassign_misplaced_members("PyQt5")
_build_compatibility_members('PyQt5')
示例10: __cleanupCanvas
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def __cleanupCanvas(self):
"""Cleans up the canvas"""
if self.__canvas is not None:
self.__canvas.cleanup()
self.__canvas = None
for item in self.scene().items():
sip.delete(item)
self.scene().clear()
示例11: eraseItem
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def eraseItem(self):
for x in self.ui.treeWidget_2.selectedItems():#delete with write click menu
#item = self.ui.treewidget.takeItem(self.ui.treewidget.currentRow())
sip.delete(x)
#item.delete
示例12: __init__
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def __init__(self, *args):
super(SearchQLineEdit, self).__init__(*args)
self.buttonSearch = QToolButton(self)
self.buttonSearch.setAutoRaise(True)
self.buttonSearch.setToolTip("Search")
self.buttonSearch.setCursor(Qt.PointingHandCursor)
self.buttonSearch.setFocusPolicy(Qt.NoFocus)
self.buttonSearch.setIcon(QIcon(":/picture/resourses/search.png"))
self.buttonSearch.setStyleSheet("QToolButton {border: none;}")
self.buttonStop = QToolButton(self)
self.buttonStop.setAutoRaise(True)
self.buttonStop.setToolTip("Stop")
self.buttonStop.setCursor(Qt.PointingHandCursor)
self.buttonStop.setFocusPolicy(Qt.NoFocus)
self.buttonStop.setIcon(QIcon(":/picture/resourses/delete.png"))
self.buttonStop.setStyleSheet("QToolButton {border: none;}")
self.buttonStop.setDisabled(True)
# self.buttonSearch.clicked.connect(self.viewFileContent)
layout = QHBoxLayout(self)
layout.addStretch()
layout.addWidget(self.buttonSearch, 0, Qt.AlignRight)
layout.addWidget(self.buttonStop, 0, Qt.AlignRight)
layout.setSpacing(6)
layout.setContentsMargins(5, 0, 5, 0)
frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
rightButtonWidth1 = self.buttonSearch.sizeHint().width()
rightButtonWidth2 = self.buttonStop.sizeHint().width()
self.setTextMargins(5, 0, rightButtonWidth1 + rightButtonWidth2 + frameWidth + 7, 0) ##这里设置一下距离
示例13: reload
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def reload(self, mod):
"""
2.2 重载插件.
"""
if mod in sys.modules:
#TODO: 旧对象替换
print("reload")
importlib.reload(sys.modules[mod])
moduleObj = sys.modules[mod]
try:
objInfo = self.findOldObj(mod, moduleObj , True)
except:
errmsg = traceback.format_exc()
QMessageBox.information(self.__mw,
"模块导入异常",
"%s,请在%s.py检查模块."%(errmsg,mod ))
oldObj, newObj, layout = objInfo["oldObj"],\
objInfo["newObj"],\
objInfo["layout"]
# 新对象替换旧对象 , 并把地址赋值给旧对象
layout.replaceWidget(oldObj, newObj )
self.pluginsInfo["StartModule"][mod]["old"] = newObj
oldObj.flag="reload"
sip.delete(oldObj)
else:
self.load(mod)
示例14: onPrepareQA
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def onPrepareQA(self, html, card, context):
if self.settings['prioEnabled']:
answerShortcuts = ['1', '2', '3', '4']
else:
answerShortcuts = ['4']
activeAnswerShortcuts = [
next(
(s for s in mw.stateShortcuts if s.key().toString() == i), None
)
for i in answerShortcuts
]
if isIrCard(card):
if context == 'reviewQuestion':
self.qshortcuts = mw.applyShortcuts(self.shortcuts)
mw.stateShortcuts += self.qshortcuts
for shortcut in activeAnswerShortcuts:
if shortcut:
mw.stateShortcuts.remove(shortcut)
sip.delete(shortcut)
else:
for shortcut in answerShortcuts:
if not activeAnswerShortcuts[answerShortcuts.index(shortcut)]:
mw.stateShortcuts += mw.applyShortcuts(
[
(
shortcut,
lambda: mw.reviewer._answerCard(int(shortcut)),
)
]
)
return html
示例15: onShowAnswer
# 需要导入模块: import sip [as 别名]
# 或者: from sip import delete [as 别名]
def onShowAnswer(self):
for qs in self.qshortcuts:
mw.stateShortcuts.remove(qs)
sip.delete(qs)