本文整理汇总了Python中sip.unwrapinstance函数的典型用法代码示例。如果您正苦于以下问题:Python unwrapinstance函数的具体用法?Python unwrapinstance怎么用?Python unwrapinstance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unwrapinstance函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: printDialog
def printDialog(self, documentName="qtgr-untitled"):
printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution)
printer.setDocName(documentName)
painter = QtGui.QPainter()
dlg = QtGui.QPrintDialog(printer)
if dlg.exec_() == QtGui.QPrintDialog.Accepted:
painter.begin(printer)
os.environ["GKSconid"] = "%x!%x" % (sip.unwrapinstance(self),
sip.unwrapinstance(painter))
# upscaling to paper size and
# alignment (horizontal and vertical centering)
xscale = printer.pageRect().width() / float(self.width());
yscale = printer.pageRect().height() / float(self.height());
scale = min(xscale, yscale);
painter.translate(printer.paperRect().x() +
printer.pageRect().width() / 2,
printer.paperRect().y() +
printer.pageRect().height() / 2)
painter.scale(scale, scale);
painter.translate(-self.width() / 2, -self.height() / 2);
self.draw(True)
gr.updatews()
painter.end()
开发者ID:albertocabello,项目名称:gr,代码行数:25,代码来源:__init__.py
示例2: isAlive
def isAlive(qobj):
import sip
try:
sip.unwrapinstance(qobj)
except RuntimeError:
return False
return True
开发者ID:marconb1,项目名称:Irony_Detection_Tool,代码行数:7,代码来源:experiments.py
示例3: objectIsAlive
def objectIsAlive(obj):
''' Test whether an object is alive; that is, whether the pointer
to the object still exists. '''
import sip
try:
sip.unwrapinstance(obj)
except RuntimeError:
return False
return True
开发者ID:azat-archive,项目名称:kate,代码行数:9,代码来源:__init__.py
示例4: isAlive
def isAlive(qobj):
"""
Function to check if window is alive
"""
import sip
try:
sip.unwrapinstance(qobj)
except RuntimeError:
return False
return True
开发者ID:hovo1990,项目名称:GROM,代码行数:10,代码来源:MainApp.py
示例5: paintEvent
def paintEvent(self, ev):
self.painter.begin(self)
if have_pyside:
environ['GKSconid'] = "%x!%x" % (
int(shiboken.getCppPointer(self)[0]),
int(shiboken.getCppPointer(self.painter)[0]))
else:
environ["GKSconid"] = "%x!%x" % (unwrapinstance(self),
unwrapinstance(self.painter))
updatews()
self.painter.end()
开发者ID:j-fu,项目名称:gr,代码行数:11,代码来源:mri.py
示例6: isAlive
def isAlive(qobj):
"""
return True if the object qobj exist
@param qobj: the name of the attribute
@return: C{True} or C{False}
"""
import sip
try:
sip.unwrapinstance(qobj)
except RuntimeError:
return False
return True
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:13,代码来源:MainView.py
示例7: isAlive
def isAlive(qobj):
"""is the underlying C++ object still valid?
This function is taken from the book
"Rapid GUI Programming with Python and Qt"
by Mark Summerfield."""
if qobj is None:
return False
try:
sip.unwrapinstance(qobj)
except RuntimeError:
return False
else:
return True
开发者ID:ospalh,项目名称:kajongg-fork,代码行数:13,代码来源:common.py
示例8: test_write_to_dead
def test_write_to_dead():
pidle = wx.GetApp().ProcessIdle
f = wx.Frame(None)
print sip.unwrapinstance(f)
f.Destroy()
pidle()
for x in xrange(1):
others = [wx.Frame(None) for x in xrange(10)]
print [sip.unwrapinstance(o) for o in others]
开发者ID:ifwe,项目名称:wxpy,代码行数:13,代码来源:test_frame.py
示例9: isAlive
def isAlive(qobj):
"""
Check a window is alive
"""
return True
import sip
try:
sip.unwrapinstance(qobj)
except RuntimeError:
return False
return True
开发者ID:Kenny-Jolley,项目名称:Atoman,代码行数:13,代码来源:mainWindow.py
示例10: SetRenderWindow
def SetRenderWindow(self,w):
""" SetRenderWindow(w: vtkRenderWindow)
Set a new render window to QVTKWidget and initialize the
interactor as well
"""
if w == self.mRenWin:
return
if self.mRenWin:
if system.systemType!='Linux':
self.mRenWin.SetInteractor(None)
if self.mRenWin.GetMapped():
self.mRenWin.Finalize()
self.mRenWin = w
if self.mRenWin:
self.mRenWin.Register(None)
if self.mRenWin.GetMapped():
self.mRenWin.Finalize()
if system.systemType=='Linux':
display = None
try:
display = int(QtGui.QX11Info.display())
except TypeError:
# This was changed for PyQt4.2
if isinstance(QtGui.QX11Info.display(), QtGui.Display):
display = sip.unwrapinstance(QtGui.QX11Info.display())
if display is not None:
v = vtk.vtkVersion()
version = [v.GetVTKMajorVersion(),
v.GetVTKMinorVersion(),
v.GetVTKBuildVersion()]
display = hex(display)[2:]
if version < [5, 7, 0]:
vp = ('_%s_void_p\0x00' % display)
elif version < [6, 2, 0]:
vp = ('_%s_void_p' % display)
else:
vp = ('_%s_p_void' % display)
self.mRenWin.SetDisplayId(vp)
self.resizeWindow(1,1)
self.mRenWin.SetWindowInfo(str(int(self.winId())))
if self.isVisible():
self.mRenWin.Start()
if not self.mRenWin.GetInteractor():
#iren = vtk.vtkRenderWindowInteractor()
iren = QVTKRenderWindowInteractor()
# if system.systemType=='Darwin':
# iren.InstallMessageProcOff()
iren.SetRenderWindow(self.mRenWin)
iren.Initialize()
# if system.systemType=='Linux':
# system.XDestroyWindow(self.mRenWin.GetGenericDisplayId(),
# self.mRenWin.GetGenericWindowId())
self.mRenWin.SetWindowInfo(str(int(self.winId())))
self.resizeWindow(self.width(), self.height())
self.mRenWin.SetPosition(self.x(), self.y())
开发者ID:hjanime,项目名称:VisTrails,代码行数:60,代码来源:vtkcell.py
示例11: doDialog
def doDialog(self, parentWidgetPtr):
parentWidget = wrapinstance(parentWidgetPtr, QtGui.QWidget)
self.widget = PyDiryGui.PyDiryUi(parentWidget)
self.widget.show()
return unwrapinstance(self.widget)
开发者ID:OpenNingia,项目名称:pylaunchy,代码行数:7,代码来源:pydiry.py
示例12: SetRenderWindow
def SetRenderWindow(self, w):
""" SetRenderWindow(w: vtkRenderWindow)
Set a new render window to QVTKViewWidget and initialize the
interactor as well
"""
if w == self.mRenWin:
return
if self.mRenWin:
if self.mRenWin.GetMapped():
self.mRenWin.Finalize()
self.mRenWin = w
if self.mRenWin:
self.mRenWin.Register(None)
if system.systemType == "Linux":
try:
vp = "_%s_void_p" % (hex(int(QtGui.QX11Info.display()))[2:])
except TypeError:
# This was change for PyQt4.2
if isinstance(QtGui.QX11Info.display(), QtGui.Display):
display = sip.unwrapinstance(QtGui.QX11Info.display())
vp = "_%s_void_p" % (hex(display)[2:])
self.mRenWin.SetDisplayId(vp)
if not self.mRenWin.GetMapped():
self.mRenWin.GetInteractor().Initialize()
system.XDestroyWindow(self.mRenWin.GetGenericDisplayId(), self.mRenWin.GetGenericWindowId())
self.mRenWin.Finalize()
self.mRenWin.SetWindowInfo(str(int(self.winId())))
else:
self.mRenWin.SetWindowInfo(str(int(self.winId())))
if self.isVisible():
self.mRenWin.Start()
开发者ID:pombredanne,项目名称:VisTrails,代码行数:35,代码来源:vtkviewcell.py
示例13: _pyqt5
def _pyqt5():
"""Initialise PyQt5"""
import PyQt5 as module
_setup(module, ["uic"])
try:
import sip
Qt.QtCompat.wrapInstance = (
lambda ptr, base=None: _wrapinstance(
sip.wrapinstance, ptr, base)
)
Qt.QtCompat.getCppPointer = lambda object: \
sip.unwrapinstance(object)
except ImportError:
pass # Optional
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.translate = Qt._QtCore.QCoreApplication.translate
if hasattr(Qt, "_QtWidgets"):
Qt.QtCompat.setSectionResizeMode = \
Qt._QtWidgets.QHeaderView.setSectionResizeMode
_reassign_misplaced_members("PyQt5")
_build_compatibility_members('PyQt5')
开发者ID:assumptionsoup,项目名称:guppy_animation_tools,代码行数:32,代码来源:qt.py
示例14: unwrap_instance
def unwrap_instance(qt_object):
'''Return pointer address for qt class instance
'''
if globals().has_key('sip'):
return long(sip.unwrapinstance(qt_object))
elif globals().has_key('shiboken'):
return long(shiboken.getCppPointer(qt_object)[0])
开发者ID:dieulinh,项目名称:anim_picker,代码行数:7,代码来源:qt_handlers.py
示例15: create
def create(docked=True):
global dialog
if dialog is None:
dialog = InterpolateIt()
if docked is True:
ptr = mui.MQtUtil.mainWindow()
main_window = sip.wrapinstance(long(ptr), qc.QObject)
dialog.setParent(main_window)
size = dialog.size()
name = mui.MQtUtil.fullName(long(sip.unwrapinstance(dialog)))
dock = mc.dockControl(
allowedArea =['right', 'left'],
area = 'right',
floating = False,
content = name,
width = size.width(),
height = size.height(),
label = 'Interpolate It')
widget = mui.MQtUtil.findControl(dock)
dock_widget = sip.wrapinstance(long(widget), qc.QObject)
dialog.connectDockWidget(dock, dock_widget)
else:
dialog.show()
开发者ID:mikebourbeauart,项目名称:Tutorials,代码行数:28,代码来源:interpolate_it.py
示例16: __init__
def __init__(self):
# Init the main window.
qt.QMainWindow.__init__(self)
self.resize(350, 350)
# Create the central widget.
self.CentralWidget = qt.QWidget(self)
self.setCentralWidget(self.CentralWidget)
self.Layout = qt.QGridLayout(self.CentralWidget)
# Create a button.
self.QuitButton = qt.QPushButton(self.centralWidget())
self.QuitButton.setText('Quit')
self.Layout.addWidget(self.QuitButton, 1, 0)
# Connect the button.
qt.QObject.connect(self.QuitButton, qt.SIGNAL('clicked()'), self.quit)
# Create a root histogram.
self.hist = ROOT.TH1F("pipo","pipo", 100, 0, 100)
# Create the main TQtWidget (using sip to get the pointer to the central widget).
self.Address = sip.unwrapinstance(self.CentralWidget)
self.Canvas = ROOT.TQtWidget(sip.voidptr(self.Address).ascobject())
# Place the TQtWidget in the main grid layout and draw the histogram.
self.Layout.addWidget(sip.wrapinstance(ROOT.AddressOf(self.Canvas)[0],qt.QWidget), 0, 0)
self.hist.Draw()
开发者ID:star-bnl,项目名称:star-soft,代码行数:28,代码来源:HelloPython.py
示例17: doDialog
def doDialog(self, parentWidgetPtr):
parentWidget = wrapinstance(parentWidgetPtr, QtGui.QWidget)
if self.widget == None:
self.widget = PyWebIndexUi(parentWidget)
self.widget.show()
return unwrapinstance(self.widget)
开发者ID:OpenNingia,项目名称:pylaunchy,代码行数:8,代码来源:pywebindex.py
示例18: registerObject
def registerObject(cls, obj):
"""
Workaround for PyQt bug in qgraphicsscene.items()
All subclasses of QGraphicsObject must register themselves with this function.
(otherwise, mouse interaction with those objects will likely fail)
"""
if HAVE_SIP and isinstance(obj, sip.wrapper):
cls._addressCache[sip.unwrapinstance(sip.cast(obj, QtGui.QGraphicsItem))] = obj
开发者ID:Rareson,项目名称:LammpsRelated,代码行数:8,代码来源:GraphicsScene.py
示例19: listQThreads
def listQThreads():
"""Prints Thread IDs (Qt's, not OS's) for all QThreads."""
thr = findObj('[Tt]hread')
thr = [t for t in thr if isinstance(t, QtCore.QThread)]
import sip
for t in thr:
print("--> ", t)
print(" Qt ID: 0x%x" % sip.unwrapinstance(t))
开发者ID:hiuwo,项目名称:acq4,代码行数:8,代码来源:debug.py
示例20: initPlayer
def initPlayer(self):
log.info("initPlayer")
# Get the address of the player's renderer (a QObject that emits signals when frames are ready)
self.renderer_address = self.player.GetRendererQObject()
self.player.SetQWidget(sip.unwrapinstance(self.videoPreview))
self.renderer = sip.wrapinstance(self.renderer_address, QObject)
self.videoPreview.connectSignals(self.renderer)
开发者ID:OpenShot,项目名称:openshot-qt,代码行数:8,代码来源:preview_thread.py
注:本文中的sip.unwrapinstance函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论