本文整理汇总了Python中channel.Channel._file_方法的典型用法代码示例。如果您正苦于以下问题:Python Channel._file_方法的具体用法?Python Channel._file_怎么用?Python Channel._file_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel.Channel
的用法示例。
在下文中一共展示了Channel._file_方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createProto
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import _file_ [as 别名]
def createProto(self, name, proto):
scroll = QtGui.QScrollArea()
scroll.setWidgetResizable(True)
scroll.setFrameStyle(QtGui.QFrame.NoFrame)
scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
layout = QtGui.QVBoxLayout()
widget = QtGui.QWidget()
sock = socket.socket()
try:
sock.connect((self.host, self.port + proto["id"]))
except:
print ("Failed to connect on %s %d" % (self.host, self.port))
sys.exit(-1)
file = sock.makefile(mode="rw")
chan = Channel(file.buffer, print_packet, proto = name,
transmitter = self.transmitter,
symmetrical = self.symmetrical)
chan._file_ = file # archi moche
for packet in proto['packets']:
if proto['packets'][packet]['transmitter'] == self.transmitter \
or proto['packets'][packet]['transmitter'] == 'both' \
or self.transmitter == 'both':
layout.addWidget(self.createPacket(packet,
proto['packets'][packet], chan), 0)
widget.setLayout(layout)
scroll.setWidget(widget)
return scroll