本文整理汇总了Python中sip.isdeleted函数的典型用法代码示例。如果您正苦于以下问题:Python isdeleted函数的具体用法?Python isdeleted怎么用?Python isdeleted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isdeleted函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_removeMapLayersByLayer
def test_removeMapLayersByLayer(self):
""" test removing map layers by layer"""
store = QgsMapLayerStore()
# test no crash with empty store
store.removeMapLayers([None])
l1 = createLayer('test')
l2 = createLayer('test2')
l3 = createLayer('test3')
store.addMapLayers([l1, l2, l3])
self.assertEqual(store.count(), 3)
#remove bad layers
store.removeMapLayers([None])
self.assertEqual(store.count(), 3)
# remove valid layers
store.removeMapLayers([l1])
self.assertEqual(store.count(), 2)
# test that layer has been deleted
self.assertTrue(sip.isdeleted(l1))
# remove multiple
store.removeMapLayers([l2, l3])
self.assertEqual(store.count(), 0)
self.assertTrue(sip.isdeleted(l2))
self.assertTrue(sip.isdeleted(l3))
开发者ID:enzogis,项目名称:QGIS,代码行数:30,代码来源:test_qgsmaplayerstore.py
示例2: test_removeMapLayersByLayer
def test_removeMapLayersByLayer(self):
""" test removing map layers by layer"""
QgsMapLayerRegistry.instance().removeAllMapLayers()
# test no crash with empty registry
QgsMapLayerRegistry.instance().removeMapLayers([None])
l1 = createLayer('test')
l2 = createLayer('test2')
l3 = createLayer('test3')
QgsMapLayerRegistry.instance().addMapLayers([l1, l2, l3])
self.assertEqual(QgsMapLayerRegistry.instance().count(), 3)
#remove bad layers
QgsMapLayerRegistry.instance().removeMapLayers([None])
self.assertEqual(QgsMapLayerRegistry.instance().count(), 3)
# remove valid layers
QgsMapLayerRegistry.instance().removeMapLayers([l1])
self.assertEqual(QgsMapLayerRegistry.instance().count(), 2)
# test that layer has been deleted
self.assertTrue(sip.isdeleted(l1))
# remove multiple
QgsMapLayerRegistry.instance().removeMapLayers([l2, l3])
self.assertEqual(QgsMapLayerRegistry.instance().count(), 0)
self.assertTrue(sip.isdeleted(l2))
self.assertTrue(sip.isdeleted(l3))
开发者ID:lucacasagrande,项目名称:QGIS,代码行数:30,代码来源:test_qgsmaplayerregistry.py
示例3: search
def search(self, text):
logging.debug('Doing search.')
thread = QThread()
worker = SearchWorker(text, time.time())
worker.moveToThread(thread)
thread.started.connect(worker.process)
worker.finished.connect(thread.quit)
worker.finished.connect(worker.deleteLater)
worker.new_items.connect(functools.partial(self.repopulate, worker))
thread.finished.connect(thread.deleteLater)
self._threads.append(thread)
self.workers.append(worker)
thread.start()
# Revert search bar color.
palette = main_window.palette()
brush = palette.brush(QPalette.Highlight).color()
palette.setBrush(QPalette.Base, QBrush(brush))
search_bar.setPalette(palette)
# Clean up old threads.
self._threads = [thread for thread in self._threads
if not sip.isdeleted(thread)]
self.workers = [worker for worker in self.workers
if not sip.isdeleted(worker)]
开发者ID:spamalot,项目名称:spamalot_launcher,代码行数:28,代码来源:launcher.py
示例4: test_removeMapLayerByLayer
def test_removeMapLayerByLayer(self):
""" test removing a map layer by layer """
QgsMapLayerRegistry.instance().removeAllMapLayers()
# test no crash with empty registry
QgsMapLayerRegistry.instance().removeMapLayer('bad')
QgsMapLayerRegistry.instance().removeMapLayer(None)
l1 = createLayer('test')
l2 = createLayer('test2')
QgsMapLayerRegistry.instance().addMapLayers([l1, l2])
self.assertEqual(QgsMapLayerRegistry.instance().count(), 2)
#remove bad layers
QgsMapLayerRegistry.instance().removeMapLayer(None)
self.assertEqual(QgsMapLayerRegistry.instance().count(), 2)
l3 = createLayer('test3')
QgsMapLayerRegistry.instance().removeMapLayer(l3)
self.assertEqual(QgsMapLayerRegistry.instance().count(), 2)
# remove valid layers
QgsMapLayerRegistry.instance().removeMapLayer(l1)
self.assertEqual(QgsMapLayerRegistry.instance().count(), 1)
# test that layer has been deleted
self.assertTrue(sip.isdeleted(l1))
# remove second layer
QgsMapLayerRegistry.instance().removeMapLayer(l2)
self.assertEqual(QgsMapLayerRegistry.instance().count(), 0)
self.assertTrue(sip.isdeleted(l2))
开发者ID:af3dgce,项目名称:QGIS,代码行数:32,代码来源:test_qgsmaplayerregistry.py
示例5: slotFlashTimeout
def slotFlashTimeout(self):
'''Handle flashing of UI components.'''
# because we're flashing random UI components, the C++ object
# might be deleted, so we have to check before doing things to
# it: hence the sip.isdeleted
if ( self.flash is not self.oldflash and self.oldflash is not None
and not sip.isdeleted(self.oldflash) ):
# clear any flashing on previous widget
self.oldflash.setStyleSheet('')
self.oldflash = None
if self.flash is not None and not sip.isdeleted(self.flash):
# set flash state and toggle variable
if self.flashon:
self.flash.setStyleSheet('background: yellow;')
else:
self.flash.setStyleSheet('')
self.flashon = not self.flashon
self.oldflash = self.flash
# stop flashing after N iterations
self.flashct -= 1
if self.flashct == 0:
self.flash = None
开发者ID:Felipeasg,项目名称:veusz,代码行数:26,代码来源:tutorial.py
示例6: onclose
def onclose(e):
print 'destroying frame', f
print 'BEFORE: isdeleted?', sip.isdeleted(f)
print sip.dump(f)
f.Destroy()
#sip.setdeleted(f)
print 'AFTER: isdeleted?', sip.isdeleted(f)
print sip.dump(f)
开发者ID:ifwe,项目名称:wxpy,代码行数:8,代码来源:widgettest.py
示例7: _cleanup
def _cleanup(self):
"""
Delete the thread.
"""
if self._thread:
if not sip.isdeleted(self) and not sip.isdeleted(self._thread):
if self._thread.isRunning():
self._thread.quit()
if not self._thread.wait(3000):
self._thread.terminate()
self._thread.wait()
self._thread.deleteLater()
开发者ID:alearceo,项目名称:gns3-gui,代码行数:13,代码来源:progress_dialog.py
示例8: threadCleanup
def threadCleanup(self):
if (self.mesh_thread is not None):
if (sip.isdeleted(self.mesh_thread) == False):
if (isinstance(self.mesh_thread,MeshThread)):
self.mesh_thread.deleteLater()
self.mesh_thread = None
if (self.thread is not None):
if (sip.isdeleted(self.thread) == False):
if (isinstance(self.thread,QThread)):
self.thread.quit()
self.thread.wait()
self.thread.deleteLater()
self.thread = None
开发者ID:digitalenergy,项目名称:JapanMesh,代码行数:14,代码来源:JapanMesh.py
示例9: g_proxy
def g_proxy(self, *args, **kwargs):
g = func(self, *args, **kwargs)
result = None
while not sip.isdeleted(self):
result = g.send(result)
try:
result = yield result
except (GeneratorExit, StopIteration):
break
except Exception:
if not sip.isdeleted(self):
g.throw(*sys.exc_info()) # NB: can raise anything and we'll propagate it
else:
log.debug("Ignored exception on deleted object", exc_info=True)
g.close()
开发者ID:marscher,项目名称:deluge_qt,代码行数:15,代码来源:async_tools.py
示例10: purgeDeletedWidgets
def purgeDeletedWidgets():
"""Finds old references to stashed fields and deletes them"""
toremove = []
for field in AbstractEditorWidget.funit_fields:
if sip.isdeleted(field):
toremove.append(field)
for field in toremove:
AbstractEditorWidget.funit_fields.remove(field)
toremove = []
for field in AbstractEditorWidget.tunit_fields:
if sip.isdeleted(field):
toremove.append(field)
for field in toremove:
AbstractEditorWidget.tunit_fields.remove(field)
开发者ID:Joel-U,项目名称:sparkle,代码行数:15,代码来源:abstract_editor.py
示例11: __init__
def __init__(self,layer,style,renderer,controller):
QgsRendererV2Widget.__init__(self, layer, style)
self._controller=controller
if renderer is not None and renderer.type() != VectorFieldRenderer.rendererName:
renderer=None
import sip
if renderer is not None and sip.isdeleted(renderer):
renderer=None
if renderer is not None and not isinstance(renderer,VectorFieldRenderer):
renderer=self._controller.findLayerRenderer(layer)
self.r = VectorFieldRenderer() if renderer is None else renderer
self._layer=layer
self.validLayer = True
if layer is None or layer.type() != QgsMapLayer.VectorLayer or layer.geometryType() != QGis.Point:
self.setupBlankUi(layer)
self.validLayer = False
return
self._mode = VectorFieldRenderer.Cartesian
self._ellipsemode = VectorFieldRenderer.NoEllipse
self.buildWidget()
self.setupLayer(layer)
self.loadFromRenderer()
# Try creating a new renderer to save to ...
self.r=VectorFieldRenderer()
开发者ID:ccrook,项目名称:QGIS-VectorFieldRenderer-Plugin,代码行数:31,代码来源:VectorFieldRendererWidget.py
示例12: exit
def exit(self):
"""Destroy the Qt main event loop.
"""
GRobot.exit_lock.acquire()
if not self._deleted:
if self.inspector:
self.inspector.close()
sip.delete(self.inspector)
if self.display:
self.webview.close()
sip.delete(self.webview)
if self.page and not sip.isdeleted(self.page):
sip.delete(self.page)
GRobot._liveRobot -= 1
if GRobot._liveRobot == 0 and GRobot._loop is not None:
GRobot._kill_loop = gevent.spawn_later(20, self.kill_loop)
self._deleted = True
GRobot.exit_lock.release()
开发者ID:whitelok,项目名称:LandofBitCoinMonitor,代码行数:25,代码来源:GRobot.py
示例13: break_cycles
def break_cycles(self):
for tab in self.tabs:
if not sip.isdeleted(tab):
self.stack.removeWidget(tab)
tab.break_cycles()
tab.deleteLater()
self.tabs = []
开发者ID:kovidgoyal,项目名称:vise,代码行数:7,代码来源:window.py
示例14: test_wrapper
def test_wrapper():
"test wrapped objects' __nonzero__"
f = wx.Frame(None)
assert not sip.isdeleted(f)
assert f
weak_f = ref(f)
f.Destroy()
# calling ProcessIdle here forces wxApp::DeletePendingObjects(), which
# deletes all objects from the wxPendingDelete list
wx.GetApp().ProcessIdle()
assert sip.isdeleted(f)
开发者ID:ifwe,项目名称:wxpy,代码行数:16,代码来源:test_wrapper.py
示例15: _focus_changed
def _focus_changed(self, old, new):
""" Handle a change in focus that affects the current tab. """
# It is possible for the C++ layer of this object to be deleted between
# the time when the focus change signal is emitted and time when the
# slots are dispatched by the Qt event loop. This may be a bug in PyQt4.
if sip.isdeleted(self):
return
if self._repeat_focus_changes:
self.emit(QtCore.SIGNAL('focusChanged(QWidget *,QWidget *)'), old, new)
if isinstance(new, _DragableTabBar):
ntw = new.parent()
ntidx = ntw.currentIndex()
else:
ntw, ntidx = self._tab_widget_of(new)
if ntw is not None:
self._set_current_tab(ntw, ntidx)
# See if the widget that has lost the focus is ours.
otw, _ = self._tab_widget_of(old)
if otw is not None or ntw is not None:
if ntw is None:
nw = None
else:
nw = ntw.widget(ntidx)
self.emit(QtCore.SIGNAL('hasFocus'), nw)
开发者ID:diegomvh,项目名称:prymatex,代码行数:31,代码来源:splitter.py
示例16: __del__
def __del__(self):
import sip
if not sip.isdeleted(self.__process):
log.debug("X11CommandWidget: __del__ terminates x11...")
self.terminate()
else:
log.debug("X11CommandWidget: __del__ does nothing...")
开发者ID:tiagocoutinho,项目名称:qarbon,代码行数:7,代码来源:x11.py
示例17: captureEvent
def captureEvent(self, watched, event):
if self._shouldSaveEvent(event):
try:
eventstr = event_to_string(event)
except KeyError:
logger.warn("Don't know how to record event: {}".format( str(event) ))
print "Don't know how to record", str(event)
else:
# Perform a full garbage collection before determining the name of this widget
gc.collect()
if sip.isdeleted(watched):
return
timestamp_in_seconds = self._timer.seconds()
objname = str(get_fully_qualified_name(watched))
if not ( self._ignore_parent_events and objname.startswith(self._parent_name) ):
# Special case: If this is a MouseRelease and we somehow missed the MousePress,
# then create a "synthetic" MousePress and insert it immediately before the release
if event.type() == QEvent.MouseButtonPress or event.type() == QEvent.MouseButtonDblClick:
self._current_observed_mouse_presses.add( event.button() )
elif event.type() == QEvent.MouseButtonRelease:
try:
self._current_observed_mouse_presses.remove( event.button() )
except KeyError:
synthetic_press_event = QMouseEvent( QEvent.MouseButtonPress, event.pos(), event.globalPos(), event.button(), event.buttons(), event.modifiers() )
synthetic_eventstr = event_to_string(synthetic_press_event)
self._captured_events.append( (synthetic_eventstr, objname, timestamp_in_seconds) )
self._captured_events.append( (eventstr, objname, timestamp_in_seconds) )
return
开发者ID:ilastik,项目名称:eventcapture,代码行数:28,代码来源:eventRecorder.py
示例18: workaround_broken_under_mouse
def workaround_broken_under_mouse(ch):
import sip
from PyQt5.Qt import QCursor, QToolButton
# See https://bugreports.qt-project.org/browse/QTBUG-40233
if isinstance(ch, QToolButton) and not sip.isdeleted(ch):
ch.setAttribute(Qt.WA_UnderMouse, ch.rect().contains(ch.mapFromGlobal(QCursor.pos())))
ch.update()
开发者ID:d-faure,项目名称:calibre,代码行数:7,代码来源:__init__.py
示例19: setRowCount
def setRowCount( self, rows ):
"""Callback method to set the number of rows
@param rows the new number of rows
"""
self._rows = rows
if not sip.isdeleted(self):
self.layoutChanged.emit()
开发者ID:kurtraschke,项目名称:camelot,代码行数:7,代码来源:collection_proxy.py
示例20: _inject_userjs
def _inject_userjs(self, frame):
"""Inject user JavaScripts into the page.
Args:
frame: The QWebFrame to inject the user scripts into.
"""
if sip.isdeleted(frame):
log.greasemonkey.debug("_inject_userjs called for deleted frame!")
return
url = frame.url()
if url.isEmpty():
url = frame.requestedUrl()
log.greasemonkey.debug("_inject_userjs called for {} ({})"
.format(frame, url.toDisplayString()))
greasemonkey = objreg.get('greasemonkey')
scripts = greasemonkey.scripts_for(url)
# QtWebKit has trouble providing us with signals representing
# page load progress at reasonable times, so we just load all
# scripts on the same event.
toload = scripts.start + scripts.end + scripts.idle
if url.isEmpty():
# This happens during normal usage like with view source but may
# also indicate a bug.
log.greasemonkey.debug("Not running scripts for frame with no "
"url: {}".format(frame))
assert not toload, toload
for script in toload:
if frame is self.mainFrame() or script.runs_on_sub_frames:
log.webview.debug('Running GM script: {}'.format(script.name))
frame.evaluateJavaScript(script.code())
开发者ID:Harrison97,项目名称:qutebrowser,代码行数:35,代码来源:webpage.py
注:本文中的sip.isdeleted函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论