本文整理汇总了Python中sip.delete函数的典型用法代码示例。如果您正苦于以下问题:Python delete函数的具体用法?Python delete怎么用?Python delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete
def delete(self):
"""
Remove this part from our score.
"""
del self.l.part
sip.delete(self.w)
sip.delete(self.l)
示例2: main
def main():
import gc
import sip
from AnyQt.QtWidgets import QApplication
from Orange.classification import (LogisticRegressionLearner, SVMLearner,
NuSVMLearner)
app = QApplication([])
w = OWROCAnalysis()
w.show()
w.raise_()
# data = Orange.data.Table("iris")
data = Orange.data.Table("ionosphere")
results = Orange.evaluation.CrossValidation(
data,
[LogisticRegressionLearner(),
LogisticRegressionLearner(penalty="l1"),
SVMLearner(probability=True),
NuSVMLearner(probability=True)],
k=5,
store_data=True,
)
results.learner_names = ["Logistic", "Logistic (L1 reg.)", "SVM", "NuSVM"]
w.set_results(results)
rval = app.exec_()
w.deleteLater()
sip.delete(w)
del w
app.processEvents()
sip.delete(app)
del app
gc.collect()
return rval
示例3: main
def main():
import sip
from PyQt4.QtGui import QApplication
from Orange.classification import logistic_regression, svm
from Orange.evaluation import testing
app = QApplication([])
w = OWLiftCurve()
w.show()
w.raise_()
data = Orange.data.Table("ionosphere")
results = testing.CrossValidation(
data,
[logistic_regression.LogisticRegressionLearner(penalty="l2"),
logistic_regression.LogisticRegressionLearner(penalty="l1"),
svm.SVMLearner(probability=True),
svm.NuSVMLearner(probability=True)
],
store_data=True
)
results.fitter_names = ["LR l2", "LR l1", "SVM", "Nu SVM"]
w.set_results(results)
rval = app.exec_()
sip.delete(w)
del w
app.processEvents()
del app
return rval
示例4: __init__
def __init__(self, main_window):
super(backend_settings, self).__init__(main_window,
ui=u'widgets.backend_settings')
self.tab_name = u'__backend_settings__'
for backend_type in backend._backend_types:
try:
_backend = backend.get_backend_class(self.experiment,
backend_type)
except:
_backend = None
layout = getattr(self.ui, u'layout_%s' % backend_type)
label = getattr(self.ui, u'label_%s' % backend_type)
# Horribly ugly way to clear the previous settings
while layout.count() > 1:
w = layout.itemAt(1)
layout.removeItem(w)
w.widget().hide()
sip.delete(w)
if _backend is None:
label.setText(_(u"Failed to load backend"))
elif not hasattr(_backend, u"settings") or _backend.settings == \
None:
label.setText(_(u"No settings for %s") % _backend.__name__)
else:
label.setText(_(u"Settings for %s:") % _backend.__name__)
layout.addWidget(settings_widget(self.main_window,
_backend.settings))
示例5: __init__
def __init__(self, parent=None):
super(QtWidgets.QWidget, self).__init__(parent)
self.setupUi(self)
self.state = True
self.name = None
self.psf, self. dcd = "", ""
self.allSasas = []
self.totalFramesToProcess = 0
sip.delete(self.sasaProgressBar)
self.sasaProgressBar = PbWidget(total=100)
self.sasaProgressBar.setProperty("value", 0)
self.sasaProgressBar.setTextVisible(True)
self.sasaProgressBar.setInvertedAppearance(False)
self.sasaProgressBar.setObjectName("sasaProgressBar")
self.previewPlot = SimplePlotter(None, width=4, height=2, dpi=70)
self.graphGridLayout.addWidget(self.previewPlot)
self.gridLayout.addWidget(self.sasaProgressBar, 8, 1, 1, 2)
self.calcSasaButton.clicked.connect(self.calculateSasa)
self.loadDataButton.clicked.connect(self.loadData)
self.clearDataButton.clicked.connect(self.clearData)
self.savePlotButton.clicked.connect(self.savePlot)
self.exportDataButton.clicked.connect(self.exportData)
self.topoloader = TopoTrajLoaderDialog()
示例6: move_itemsAcross
def move_itemsAcross(self, source, modifiers):
""" Create new tree items and populate the target tree. Originally made
for moving items from fileDataTree to workingDataTree, but then modified
to copy items when the move is internal in workingDataTree and Ctrl is
pressed.
"""
if (source==self.ui.workingDataTree) and (modifiers==QtCore.Qt.ControlModifier):
# Copy internally
#print 'copying'
targetItems = []
for item in self.copyItems:
i = h5Item([str(item.text(0))])
i.data = item.data
targetItems.append(i)
parentIndex = self.ui.workingDataTree.indexFromItem(self.dragTargetParent)
for row in np.arange(0, len(self.copyItems)):
index = self.ui.workingDataTree.model().index(self.dragTargetRow+row, 0, parentIndex)
temp_item = self.ui.workingDataTree.itemFromIndex(QtCore.QModelIndex(index))
sip.delete(temp_item)
if parentIndex.isValid():
self.make_nameUnique(self.dragTargetParent, targetItems[row], targetItems[row].text(0))
self.dragTargetParent.insertChild(index.row(), targetItems[row])
originalParentWidget = self.copyItems[row]
h5.populate_h5copyItems(self, originalParentWidget, targetItems[row])
else:
self.make_nameUnique(self.ui.workingDataTree.invisibleRootItem(), targetItems[row], targetItems[row].text(0))
self.ui.workingDataTree.insertTopLevelItem(index.row(), targetItems[row])
originalParentWidget = self.copyItems[row]
h5.populate_h5copyItems(self, originalParentWidget, targetItems[row])
elif source==self.ui.workingDataTree:
pass
else:
# Move across
#print 'moving'
targetItems = []
for item in self.dragItems:
i = h5Item([str(item[1])])
i.path = item[0]
i.listIndex = item[2]
i.originalIndex = item[3]
i.data = item[4]
i.attrs = item[5]
#item = i[0]
#item.originalIndex = i[1]
targetItems.append(i)
parentIndex = self.ui.workingDataTree.indexFromItem(self.dragTargetParent)
for row in np.arange(0, len(self.dragItems)):
index = self.ui.workingDataTree.model().index(self.dragTargetRow+row, 0, parentIndex)
temp_item = self.ui.workingDataTree.itemFromIndex(QtCore.QModelIndex(index))
sip.delete(temp_item)
if parentIndex.isValid():
self.make_nameUnique(self.dragTargetParent, targetItems[row], targetItems[row].text(0))
self.dragTargetParent.insertChild(index.row(), targetItems[row])
originalParentWidget = self.ui.fileDataTree.itemFromIndex(QtCore.QModelIndex(targetItems[row].originalIndex))
h5.populate_h5dragItems(self, originalParentWidget, targetItems[row])
else:
self.make_nameUnique(self.ui.workingDataTree.invisibleRootItem(), targetItems[row], targetItems[row].text(0))
self.ui.workingDataTree.insertTopLevelItem(index.row(), targetItems[row])
originalParentWidget = self.ui.fileDataTree.itemFromIndex(QtCore.QModelIndex(targetItems[row].originalIndex))
h5.populate_h5dragItems(self, originalParentWidget, targetItems[row])
示例7: plotClusterSelection
def plotClusterSelection(self, index, boolean=False):
"""
Allow to plot peak and cluster tables
"""
if not index.isValid():
return
string = str(index.data().toString())#.model().data(index.parent(), Qt.DisplayRole).toString()
if string in ("fragments/adducts:","isotopic cluster:"):
return
data = string.split('/')
#print data
prec=float(data[0])
rt = float(data[1])
#print prec, rt
peaks=self.getElementsToPlot(flags='peak', prec=prec, rt=rt)
pw = ClusterWidget(peaks, self.view)#MSQtCanvas(peaks, "[email protected]%s/%s"%(str(prec), str(rt)), labels={'bottom':'RT(s)', 'left':'INTENSITY'}, flags='peak')
QObject.connect(qApp.instance(), SIGNAL('redraw()'), pw.widget.mainWidget.redraw)
title="[email protected]%s/%s"%(str(prec), str(rt))
win=self.view.mdiArea.activeSubWindow()
isMax=False
if win is not None and boolean:
isMax=win.isMaximized()
w=win.widget()
#w.setParent(None)
sip.delete(w)#
#del w
win.setWidget(pw)
else:
self.view.addMdiSubWindow(MSView(pw), title, isMax)
self.view.mdiArea.tileSubWindows()
示例8: move_itemsAcross
def move_itemsAcross(self):
""" Create new tree items and populate the target tree
"""
targetItems = []
for item in self.dragItems:
i = h5Item([str(item[1])])
i.path = item[0]
i.listIndex = item[2]
i.originalIndex = item[3]
targetItems.append(i)
parentIndex = self.ui.workingDataTree.indexFromItem(self.dragTargetParent)
for row in np.arange(0, len(self.dragItems)):
index = self.ui.workingDataTree.model().index(self.dragTargetRow+row, 0, parentIndex)
temp_item = self.ui.workingDataTree.itemFromIndex(QtCore.QModelIndex(index))
sip.delete(temp_item)
if parentIndex.isValid():
self.make_nameUnique(self.dragTargetParent, targetItems[row], targetItems[row].text(0))
self.dragTargetParent.insertChild(index.row(), targetItems[row])
originalParentWidget = self.ui.fileDataTree.itemFromIndex(QtCore.QModelIndex(targetItems[row].originalIndex))
h5.populate_h5dragItems(self, originalParentWidget, targetItems[row])
else:
self.make_nameUnique(self.ui.workingDataTree.invisibleRootItem(), targetItems[row], targetItems[row].text(0))
self.ui.workingDataTree.insertTopLevelItem(index.row(), targetItems[row])
originalParentWidget = self.ui.fileDataTree.itemFromIndex(QtCore.QModelIndex(targetItems[row].originalIndex))
h5.populate_h5dragItems(self, originalParentWidget, targetItems[row])
示例9: plotSelection
def plotSelection(self, index, boolean=False):
"""
Allow to plot spectrum
"""
if not index.isValid():
return
chromas=self.getElementsToPlot(flags='spectra', index=index.row())
title="[email protected]%s"%str(chromas[0].rtmin)
legend={'bottom':'m/z', 'left':'INTENSITY'}
flags='spectra'
#useOpenGL=False
pw = MSQtCanvas(chromas, title, labels=legend, flags=flags)#, useOpenGL=useOpenGL)
QObject.connect(qApp.instance(), SIGNAL('redraw()'), pw.redraw)
a=self.view.mdiArea.activeSubWindow()
isMax=False
if a is not None and boolean:
isMax=a.isMaximized()
w=a.widget()
#w.connect(w, SIGNAL('destroyed (QObject *)'), self.destroyed)
#w.setParent(None)
#print "parent of w just before elimination", w.parent()
sip.delete(w)#; del w
del w
a.setWidget(pw)
#a.close()
else:
self.view.addMdiSubWindow(pw, title, isMax)
self.view.mdiArea.tileSubWindows()
示例10: plotPeakSelection
def plotPeakSelection(self, index, boolean=False):
"""
Allow to plot peak and peak tables
"""
if not index.isValid():
return
data = index.data().toString().split("/")
prec, rt =float(data[0]), float(data[1])
peaks=self.getElementsToPlot(flags='peak', prec=prec, rt=rt)
pw = MSQtCanvas(peaks, "[email protected]%s/%s"%(str(prec), str(rt)),
labels={'bottom':'RT(s)', 'left':'INTENSITY'},
flags='peak')
QObject.connect(qApp.instance(), SIGNAL('redraw()'), pw.redraw)
title="[email protected]%s/%s"%(str(prec), str(rt))
win=self.view.mdiArea.activeSubWindow()
isMax=False
if win is not None and boolean:
isMax=win.isMaximized()
w=win.widget()
#w.connect(w, SIGNAL('destroyed (QObject *)'), self.destroyed)
#w.setParent(None)
sip.delete(w)
del w
win.setWidget(MSView(pw))
#win.close()
else:
self.view.addMdiSubWindow(MSView(pw), title, isMax)
self.view.mdiArea.tileSubWindows()
示例11: clearLayout
def clearLayout(self):
if self.layout() is not None:
old_layout = self.layout()
for i in reversed(range(old_layout.count())):
old_layout.itemAt(i).widget().setParent(None)
import sip
sip.delete(old_layout)
示例12: test_main
def test_main(argv=None):
import sys
import sip
argv = sys.argv[1:] if argv is None else argv
if argv:
filename = argv[0]
else:
filename = "iris"
data = Orange.data.Table(filename)
app = QApplication([])
w = OWLinearProjection()
w.set_data(data)
w.set_subset_data(data[::10])
w.handleNewSignals()
w.show()
w.raise_()
r = app.exec()
w.set_data(None)
w.saveSettings()
sip.delete(w)
del w
return r
示例13: _request_page
def _request_page(self):
self.n += 1
print('Попытка:', self.n)
sip.delete(self.page)
self.page = QWebPage(self)
self.page.loadFinished.connect(self._check_goods)
self.page.mainFrame().load(QUrl(self.url))
示例14: plotAttribute
def plotAttribute(self):
"""Plots the selected attribute."""
sip.delete(self.contactPlotter)
self.contactPlotter = ContactPlotter(None, width=4, height=2, dpi=70)
if self.attributeBox.currentText() == "Score":
self.contactPlotter.plot_contact_figure(self.contact)
self.plotGridLayout.addWidget(self.contactPlotter)
示例15: qt
def qt():
application = QApplication([])
yield application
application.exit()
# If we don't force deletion of the C++ wrapped object, it causes the test suite to eventually crash
# Never ever remove this!!
sip.delete(application)