本文整理汇总了Python中sip.wrapinstance函数的典型用法代码示例。如果您正苦于以下问题:Python wrapinstance函数的具体用法?Python wrapinstance怎么用?Python wrapinstance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wrapinstance函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: BuildXlate
def BuildXlate(self,scope=True,tscope=True):
self.f2c = blocks.float_to_complex()
taps = filter.firdes.low_pass ( 1.0, rate, 2000, 750, filter.firdes.WIN_HAMMING )
self.xlate = filter.freq_xlating_fir_filter_ccf ( 12, taps, 10000, rate )
self.connect( self,self.f2c, self.xlate, self )
self.connect( (self,1), (self.f2c,1) )
if scope:
self.scope = qtgui.sink_c(1024, filter.firdes.WIN_BLACKMAN_hARRIS, fc=0, bw=rate/12, name="FFT%d" % self.i, plotfreq=True,
plotwaterfall=True, plottime=True, plotconst=True)
self.connect( self.xlate, self.scope )
# Get the reference pointer to the SpectrumDisplayForm QWidget
self.pyobj = sip.wrapinstance(self.scope.pyqwidget(), QtGui.QWidget)
self.pyobj.show()
if tscope:
self.tscope = qtgui.sink_c(1024, filter.firdes.WIN_BLACKMAN_hARRIS, fc=0, bw=rate, name="Top FFT%d" % self.i, plotfreq=True,
plotwaterfall=True, plottime=False, plotconst=False)
self.connect(self.f2c,self.tscope)
self.tpyobj = sip.wrapinstance(self.tscope.pyqwidget(), QtGui.QWidget)
self.tpyobj.show()
开发者ID:softerhardware,项目名称:gnuradio-examples,代码行数:28,代码来源:measurephase.py
示例2: 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
示例3: main
def main():
import maya.OpenMayaUI as apiUI
oldDialog = apiUI.MQtUtil.findWindow('DeadlineCheckIn')
try:
sip.wrapinstance(long(oldDialog), QWidget).close()
except:
pass
pgw = DeadlineCheckIn()
pgw.show()
开发者ID:TianD,项目名称:TianD_KX_submitDeadline,代码行数:10,代码来源:DeadlineCheckIn.py
示例4: init_sink
def init_sink(self):
if args.output_dir:
self.logfiles = {}
logdirpath = os.path.join(args.output_dir, 'unknown-frequency.log')
self.logfiles['unknown'] = open(logdirpath, 'w+')
self.push_text('All messages will be saved in "%s". One file for each frequency.'
% args.output_dir)
self.topblock.stop()
self.topblock.wait()
self.enable_selector_buttons(False)
#
# Source/premodulation
#
# Create the selector and connect the source to it
self.sel_c = stream_selector(3, gr.sizeof_gr_complex)
self.topblock.connect(self.topblock.source, (self.sel_c.ss, 0))
self.srcsink.source_source_radio.setEnabled(True)
self.sel_c.set_output(0)
# Add the sink
self.srcsink.grsink = qtgui.sink_c(FFTSIZE, gr.firdes.WIN_BLACKMAN_hARRIS,
self.topblock.source.get_center_freq(), self.topblock.source.get_sample_rate(),
"Source Signal", True, True, True, False)
self.srcsink.grsink.set_update_time(0.1)
self.topblock.connect(self.sel_c.ss, self.srcsink.grsink)
self.srcsink.sink = sip.wrapinstance(self.srcsink.grsink.pyqwidget(), QtGui.QWidget)
self.srcsink.horizontalLayout.addWidget(self.srcsink.sink)
# add a button group for the radio buttons
self.waveselc = QtGui.QButtonGroup(self.srcsink.verticalLayout)
self.waveselc.addButton(self.srcsink.source_source_radio, 0)
self.waveselc.addButton(self.srcsink.source_xlating_radio, 1)
self.waveselc.addButton(self.srcsink.source_interpolator_radio, 2)
self.waveselc.buttonClicked[int].connect(self.waveselc_toggled)
self.srcsink.source_source_radio.setChecked(True)
#
# Demodulation
#
# Add the sink
self.sel_f = stream_selector(4, gr.sizeof_float)
self.sel_f.set_output(0)
self.demodsink.grsink = qtgui.sink_f(FFTSIZE, gr.firdes.WIN_BLACKMAN_hARRIS,
0, self.args.symrate * SPS, "Demodulated Signal", True, True, True, False)
self.demodsink.grsink.set_update_time(0.1)
self.topblock.connect(self.sel_f.ss, self.demodsink.grsink)
self.demodsink.sink = sip.wrapinstance(self.demodsink.grsink.pyqwidget(), QtGui.QWidget)
self.demodsink.horizontalLayout.addWidget(self.demodsink.sink)
# Add the button group
self.waveself = QtGui.QButtonGroup(self.demodsink.verticalLayout)
self.waveself.addButton(self.demodsink.demodulation_quaddemod_radio, 0)
self.waveself.addButton(self.demodsink.demodulation_lowpass_radio, 1)
self.waveself.addButton(self.demodsink.demodulation_clockrecovery_radio, 2)
self.waveself.addButton(self.demodsink.demodulation_bits_radio, 3)
self.waveself.buttonClicked[int].connect(self.waveself_toggled)
self.demodsink.demodulation_quaddemod_radio.setChecked(True)
#
self.topblock.start()
开发者ID:ckuethe,项目名称:pocsag-mrt,代码行数:55,代码来源:pocsag-mrt.py
示例5: BuildFFT
def BuildFFT(self,scope=True):
fft0w = filter.window.blackmanharris(2048)
fft0 = fft.fft_vcc(2048, True, fft0w, True)
fft1w = filter.window.blackmanharris(2048)
fft1 = fft.fft_vcc(2048, True, fft1w, True)
self.connect(self.rx0,blocks.stream_to_vector(gr.sizeof_gr_complex, 2048),fft0)
self.connect(self.rx1,blocks.stream_to_vector(gr.sizeof_gr_complex, 2048),fft1)
v2s = blocks.vector_to_stream(gr.sizeof_float,20)
fp2 = findphase_c(2048)
self.connect(fft0,(fp2,0))
self.connect(fft1,(fp2,1))
self.connect(fp2,v2s)
if scope:
self.ffth = qtgui.histogram_sink_f(100,360,-179,180,"FFT Phase Histogram")
#self.ffth.enable_autoscale(False)
self.ffth.enable_accumulate(True)
self.ffth.enable_grid(True)
#self.histo.enable_menu(True)
self.connect(v2s,self.ffth)
self.ffthqt = sip.wrapinstance(self.ffth.pyqwidget(), QtGui.QWidget)
self.ffthqt.show()
开发者ID:softerhardware,项目名称:gnuradio-examples,代码行数:27,代码来源:measurephase.py
示例6: wrapinstance
def wrapinstance(ptr, base=None):
"""
Utility to convert a pointer to a Qt class instance
:param ptr: Pointer to QObject in memory
:type ptr: long or Swig instance
:param base: (Optional) Base class to wrap with (Defaults to QObject, which should handle anything)
:type base: QtGui.QWidget
:return: QWidget or subclass instance
:rtype: QtGui.QWidget
"""
if ptr is None:
return None
ptr = long(ptr) #Ensure type
if qt_lib == 'pyqt':
base = QtCore.QObject
return sip.wrapinstance(long(ptr), base)
elif qt_lib == 'pyside':
#Pyside makes this a pain for us, since unlike Pyqt it does not return the "best" matching class automatically
if base is None:
qObj = shiboken.wrapInstance(long(ptr), QtCore.QObject)
metaObj = qObj.metaObject()
cls = metaObj.className()
superCls = metaObj.superClass().className()
if hasattr(QtGui, cls):
base = getattr(QtGui, cls)
elif hasattr(QtGui, superCls):
base = getattr(QtGui, superCls)
else:
base = QtGui.QWidget
return shiboken.wrapInstance(long(ptr), base)
开发者ID:Temujin2887,项目名称:mlib,代码行数:31,代码来源:qt.py
示例7: getMayaWindow
def getMayaWindow():
'''
return maya window by Qt object..
'''
ptr = MQtUtil.mainWindow()
if ptr is not None:
return sip.wrapinstance(long(ptr),QtCore.QObject)
开发者ID:auqeyjf,项目名称:poseLibrary,代码行数:7,代码来源:uiTool.py
示例8: __init__
def __init__(self):
gr.top_block.__init__(self)
self.qapp = QtGui.QApplication(sys.argv)
data0 = 10*[0,] + 40*[1,0] + 10*[0,]
data0 += 10*[0,] + 40*[0,1] + 10*[0,]
data1 = 20*[0,] + [0,0,0,1,1,1,0,0,0,0] + 70*[0,]
# Adjust these to change the layout of the plot.
# Can be set to fractions.
ncols = 100.25
nrows = 100
fs = 200
src0 = blocks.vector_source_f(data0, True)
src1 = blocks.vector_source_f(data1, True)
thr = blocks.throttle(gr.sizeof_float, 50000)
hed = blocks.head(gr.sizeof_float, 10000000)
self.snk1 = qtgui.time_raster_sink_f(fs, nrows, ncols, [], [],
"Float Time Raster Example", 2)
self.connect(src0, thr, (self.snk1, 0))
self.connect(src1, (self.snk1, 1))
# Get the reference pointer to the SpectrumDisplayForm QWidget
pyQt = self.snk1.pyqwidget()
# Wrap the pointer as a PyQt SIP object
# This can now be manipulated as a PyQt4.QtGui.QWidget
pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
self.main_box = dialog_box(pyWin)
self.main_box.show()
开发者ID:Darren2340,项目名称:local_gnuradio,代码行数:34,代码来源:pyqt_time_raster_f.py
示例9: execute
def execute():
# Get the application this has been run from
appname = get_application()
# Now continue running in either Maya or Default Mode
if appname == 'maya':
print 'MAYA UI Setup'
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
import maya.OpenMayaUI as omui
main_window_ptr = omui.MQtUtil.mainWindow()
#shiboken.wrapInstance(main_window_ptr, QtCore.QObject) # Only works for PySide
parent = sip.wrapinstance(long(main_window_ptr), QtCore.QObject)
try:
test_ui.deleteLater()
except:
pass
# Create minimal UI object
try:
test_ui = NomenclateUI(parent=parent)
except:
test_ui.deleteLater()
traceback.print_exc()
elif appname == 'python':
print 'Linux UI Setup'
app = QtGui.QApplication(sys.argv)
test_ui = NomenclateUI()
sys.exit(app.exec_())
开发者ID:AndresMWeber,项目名称:aw,代码行数:29,代码来源:lib_nomenclate_UI.py
示例10: BT_GetMayaWindow
def BT_GetMayaWindow():
ptr = apiUI.MQtUtil.mainWindow()
if ptr is not None:
if BT_MayaVersionNumber < 2014:
return wrapinstance(long(ptr), QtCore.QObject)
else:
return wrapInstance(long(ptr), QtGui.QWidget)
开发者ID:SplineO,项目名称:BlendTransforms,代码行数:7,代码来源:BlendTransforms.py
示例11: __init__
def __init__(self):
gr.top_block.__init__(self)
Rs = 8000
f1 = 100
f2 = 200
npts = 2048
self.qapp = QtGui.QApplication(sys.argv)
src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.5, 0)
src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.5, 0)
src = blocks.add_cc()
channel = channels.channel_model(0.001)
thr = blocks.throttle(gr.sizeof_gr_complex, 100 * npts)
self.snk1 = qtgui.const_sink_c(npts, "Constellation Example", 1)
self.connect(src1, (src, 0))
self.connect(src2, (src, 1))
self.connect(src, channel, thr, (self.snk1, 0))
self.ctrl_win = control_box()
self.ctrl_win.attach_signal1(src1)
self.ctrl_win.attach_signal2(src2)
# Get the reference pointer to the SpectrumDisplayForm QWidget
pyQt = self.snk1.pyqwidget()
# Wrap the pointer as a PyQt SIP object
# This can now be manipulated as a PyQt4.QtGui.QWidget
pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
self.main_box = dialog_box(pyWin, self.ctrl_win)
self.main_box.show()
开发者ID:bolin-hsu,项目名称:jelli-gnuradio,代码行数:35,代码来源:pyqt_const_c.py
示例12: GetMayaMainWindow
def GetMayaMainWindow():
'''
:returns: `QtWidget` that pertains to the Maya Main Window
'''
ptr = mui.MQtUtil.mainWindow()
if ptr:
return sip.wrapinstance(long(ptr), QtCore.QObject)
开发者ID:wildparky,项目名称:spielenPipeline,代码行数:7,代码来源:import.py
示例13: wrap_instance
def wrap_instance(ptr, base):
'''Return QtGui object instance based on pointer address
'''
if globals().has_key('sip'):
return sip.wrapinstance(long(ptr), QtCore.QObject)
elif globals().has_key('shiboken'):
return shiboken.wrapInstance(long(ptr), base)
开发者ID:dieulinh,项目名称:anim_picker,代码行数:7,代码来源:qt_handlers.py
示例14: wrapinstance
def wrapinstance( ptr, base = None ):
"""
Nathan Horne
"""
if ptr is None:
return None
ptr = long( ptr ) #Ensure type
if globals().has_key( 'shiboken' ):
if base is None:
qObj = shiboken.wrapInstance( long( ptr ), QtCore.QObject )
metaObj = qObj.metaObject()
cls = metaObj.className()
superCls = metaObj.superClass().className()
if hasattr( QtGui, cls ):
base = getattr( QtGui, cls )
elif hasattr( QtGui, superCls ):
base = getattr( QtGui, superCls )
else:
base = QtGui.QWidget
return shiboken.wrapInstance( long( ptr ), base )
elif globals().has_key( 'sip' ):
base = QtCore.QObject
return sip.wrapinstance( long( ptr ), base )
else:
return None
开发者ID:StuTozer,项目名称:art_pipeline,代码行数:25,代码来源:maya_window.py
示例15: wrapinstance
def wrapinstance(ptr, base=None):
"""Convert a pointer to a Qt class instance.
:param int ptr: Pointer to QObject in memory.
:param class base: Base class to wrap with.
:returns: QWidget or subclass instance
"""
if ptr is None:
return None
ptr = long(ptr)
if sip is not None:
return sip.wrapinstance(ptr, base or QtCore.QObject)
if shiboken is not None:
if base is None:
# Do a generic wrap so that we can detect what type the object
# actually is.
q_obj = shiboken.wrapInstance(ptr, QtCore.QObject)
meta_obj = q_obj.metaObject()
class_name = meta_obj.className()
super_name = meta_obj.superClass().className()
base = (getattr(QtGui, class_name, None) or
getattr(QtGui, super_name, None) or
QtGui.QWidget)
return shiboken.wrapInstance(ptr, base)
开发者ID:westernx,项目名称:uitools,代码行数:31,代码来源:sip.py
示例16: 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
示例17: __init__
def __init__(self):
gr.top_block.__init__(self)
Rs = 8000
f1 = 100
npts = 2048
self.qapp = QtGui.QApplication(sys.argv)
src1 = analog.sig_source_f(Rs, analog.GR_SIN_WAVE, f1, 0, 0)
src2 = analog.noise_source_f(analog.GR_GAUSSIAN, 1)
src = blocks.add_ff()
thr = blocks.throttle(gr.sizeof_float, 100*npts)
self.snk1 = qtgui.histogram_sink_f(npts, 200, -5, 5,
"Histogram")
self.connect(src1, (src,0))
self.connect(src2, (src,1))
self.connect(src, thr, self.snk1)
self.ctrl_win = control_box(self.snk1)
self.ctrl_win.attach_signal1(src1)
self.ctrl_win.attach_signal2(src2)
# Get the reference pointer to the SpectrumDisplayForm QWidget
pyQt = self.snk1.pyqwidget()
# Wrap the pointer as a PyQt SIP object
# This can now be manipulated as a PyQt4.QtGui.QWidget
pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
#pyWin.show()
self.main_box = dialog_box(pyWin, self.ctrl_win)
self.main_box.show()
开发者ID:36V3mA21Hz,项目名称:gnuradio,代码行数:35,代码来源:pyqt_histogram_f.py
示例18: __init__
def __init__(self):
gr.top_block.__init__(self)
Rs = 8000
f1 = 1000
f2 = 2000
npts = 2048
self.qapp = QtGui.QApplication(sys.argv)
self.filt_taps = [1,]
src1 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f1, 0.1, 0)
src2 = analog.sig_source_c(Rs, analog.GR_SIN_WAVE, f2, 0.1, 0)
src = blocks.add_cc()
channel = channels.channel_model(0.01)
self.filt = filter.fft_filter_ccc(1, self.filt_taps)
thr = blocks.throttle(gr.sizeof_gr_complex, 100*npts)
self.snk1 = qtgui.freq_sink_c(npts, filter.firdes.WIN_BLACKMAN_hARRIS,
0, Rs,
"Complex Freq Example", 1)
self.connect(src1, (src,0))
self.connect(src2, (src,1))
self.connect(src, channel, thr, self.filt, (self.snk1, 0))
# Get the reference pointer to the SpectrumDisplayForm QWidget
pyQt = self.snk1.pyqwidget()
# Wrap the pointer as a PyQt SIP object
# This can now be manipulated as a PyQt4.QtGui.QWidget
pyWin = sip.wrapinstance(pyQt, QtGui.QWidget)
pyWin.show()
开发者ID:Darren2340,项目名称:local_gnuradio,代码行数:34,代码来源:gr_filtdes_live_upd.py
示例19: __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
示例20: __init__
def __init__(self, sample_rate, center_freq, gain, device_addr=""):
gr.top_block.__init__(self)
# Make a local QtApp so we can start it from our side
self.qapp = QtGui.QApplication(sys.argv)
fftsize = 2048
self.src = uhd.single_usrp_source(
device_addr="serial=4cfc2b4d", io_type=uhd.io_type_t.COMPLEX_FLOAT32, num_channels=1
)
self.src.set_samp_rate(sample_rate)
self.src.set_center_freq(center_freq, 0)
self.src.set_gain(gain, 0)
self.src.set_time_now(uhd.time_spec_t(0.0))
self.snk = qtgui.sink_c(
fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, center_freq, self.src.get_samp_rate(), "Realtime Display"
)
cmd = uhd.cmd_t(uhd.stream_cmd_t.STREAM_MODE_NUM_SAMPS_AND_DONE)
self.connect(self.src, self.snk)
# Tell the sink we want it displayed
self.pyobj = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
self.pyobj.show()
开发者ID:Exadios,项目名称:PWR,代码行数:25,代码来源:real-display.py
注:本文中的sip.wrapinstance函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论