本文整理汇总了Python中device.Device.port_scan方法的典型用法代码示例。如果您正苦于以下问题:Python Device.port_scan方法的具体用法?Python Device.port_scan怎么用?Python Device.port_scan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类device.Device
的用法示例。
在下文中一共展示了Device.port_scan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import port_scan [as 别名]
def __init__(self,app):
""" Builds the device properties dialog window """
self.app = app
builder = gtk.Builder()
glade_file = os.path.join(APP_DIR,'ui','device-dialog.glade')
builder.add_from_file(glade_file)
# Set defaults
glade = etree.parse(glade_file)
self.set_adjustment_values(builder,glade)
# Populate the combo boxes
# TODO: FIX FOR WINDOWS
#if os.name != 'nt':
# con = cups.Connection()
# printers = con.getPrinters()
# combo = builder.get_object("printer")
# self.set_model_from_list(combo,printers)
# combo.set_active(len(printers)-1)
# Scan for serial ports, should work on both linux and windows
ports = Device.port_scan()
combo = builder.get_object("port")
self.set_model_from_list(combo,ports)
combo.set_active(len(ports)-1)
combo = builder.get_object("baudrate")
self.set_model_from_list(combo,[2400,4800,9600,19200,38400,57600,115200])
combo.set_active(2)
combo = builder.get_object("parity")
self.set_model_from_list(combo,['None','Odd','Even','Mark','Space'])
combo.set_active(0)
combo = builder.get_object("stopbits")
self.set_model_from_list(combo,[1,1.5,2])
combo.set_active(0)
combo = builder.get_object("bytesize")
self.set_model_from_list(combo,[8,7,6,5])
combo.set_active(0)
# Connect the signals
builder.connect_signals(self)
self.widgets = self.keep_widgets(builder,[
'main',
])