示例#1
0
 def __init__(self):
     # adjust some paths
     sp = wx.StandardPaths.Get()
     wx.GetApp().SetAppName('pyTerm')
     self.config_path = sp.GetUserConfigDir()
     self.config_file = os.path.join(self.config_path, '.pyTerm')
     # create the config parser
     self.config_parser = ConfigParser.ConfigParser()
     self.config_parser.read((self.config_file))
     
     # hardcoded default settings
     available = scan_ports()
     if available:
         self.serial__port = available[0]
     else:
         self.serial__port = ''
     self.serial__speed = 9600
     self.serial__parity = None
     self.serial__bits = 8
     self.serial__stopbits = 1
     self.serial__flow_control = None
     
     self.local_echo = False
     
     # create objects out of config
     self.read_config()
    def __populate_controls(self):
        # find available serial ports
        available = scan_ports()
        self.choice_port.AppendItems(available)

        ser = serial.Serial()

        for baudrate in ser.BAUDRATES:
            self.choice_speed.Append(str(baudrate))

        lex = {'N': 'none', 'E': 'even', 'O': 'odd'}
        for parity in ser.PARITIES:
            self.choice_parity.Append(lex[parity])

        for bytesize in ser.BYTESIZES:
            self.choice_bits.Append(str(bytesize))

        for stopbit in ser.STOPBITS:
            self.choice_stopbits.Append(str(stopbit))
 def __populate_controls(self):
     # find available serial ports
     available = scan_ports()
     self.choice_port.AppendItems(available)
     
     ser = serial.Serial()
     
     for baudrate in ser.BAUDRATES:
         self.choice_speed.Append(str(baudrate))
         
     lex = {'N' : 'none', 'E' : 'even', 'O' : 'odd'}
     for parity in ser.PARITIES:
         self.choice_parity.Append(lex[parity])            
     
     for bytesize in ser.BYTESIZES:
         self.choice_bits.Append(str(bytesize))
         
     for stopbit in ser.STOPBITS:
         self.choice_stopbits.Append(str(stopbit))