Ejemplo n.º 1
0
    def __init__(self, parent, API):
        super(ListenModule, self).__init__(parent)

        self.API = API

        self.haveMote = False
        self.listening = False
        self.args = {'serialPort': '/dev/ttyUSB0', 'baudrate': 38400}

        Motelist.addUpdateCallback(self.updateMotelist)

        self.SetBackgroundColour("white")
        self.main = wx.BoxSizer(wx.VERTICAL)
        self.listenControls = wx.BoxSizer(wx.HORIZONTAL)

        self.ports = wx.ComboBox(self, choices=[], size=(300, -1))
        self.clear = wx.Button(self, label=localize("Start listening"))
        self.refresh = wx.Button(self, label=localize("Refresh"))
        self.clearOutput = wx.Button(self, label=localize("Clear"))
        self.saveOutput = wx.Button(self, label=localize("Save to file"))
        self.baudrate = wx.ComboBox(self,
                                    choices=[
                                        '2400', '4800', '9600', '19200',
                                        '38400', '57600', '115200'
                                    ])
        self.baudrate.SetSelection(4)

        self.ports.SetEditable(False)

        # Init outputArea for output
        self.outputArea = OutputArea(self, self.API, 1)
        self.updateStatus = self.outputArea.printLine
        self.clearOutputArea = self.outputArea.clear

        self.listenControls.Add(self.ports)
        self.listenControls.Add(self.baudrate)
        self.listenControls.Add(self.refresh)
        self.listenControls.Add(self.clear)
        self.listenControls.Add(self.clearOutput)
        self.listenControls.Add(self.saveOutput)

        self.main.Add(self.listenControls, 0,
                      wx.EXPAND | wx.wx.TOP | wx.LEFT | wx.RIGHT, 10)
        self.main.Add(self.outputArea, 1, wx.EXPAND | wx.ALL, 5)

        self.Bind(wx.EVT_BUTTON, self.doClear, self.clear)
        self.Bind(wx.EVT_BUTTON, self.updateMotelist, self.refresh)
        self.Bind(wx.EVT_BUTTON, self.clearOutputArea, self.clearOutput)
        self.Bind(wx.EVT_BUTTON, self.saveOutputArea, self.saveOutput)
        self.Bind(wx.EVT_COMBOBOX, self.changeTarget, self.ports)
        self.Bind(wx.EVT_COMBOBOX, self.changeBaudrate, self.baudrate)
        self.Bind(wx.EVT_TEXT, self.changeTarget, self.ports)

        #self.updateMotelist()

        self.SetSizer(self.main)
        self.main.Fit(self)
        self.Show()
Ejemplo n.º 2
0
    def __init__(self, parent, API):
        super(UploadModule, self).__init__(parent=parent)

        self.API = API
        self.editorManager = self.API.tabManager.GetCurrentPage()
        self.filename = self.editorManager.fileName
        Motelist.addUpdateCallback(self.updateMotelist)

        self.tmpDir = self.API.path + '/temp/'
        self.haveMote = False
        self.platform = "telosb"
        self.moteOrder = list()
        # this is path from /osw/tools/IDE
        self.pathToMansos = self.API.path + "/../.."
        self.motes = []

        self.main = wx.BoxSizer(wx.VERTICAL)
        self.controls = wx.GridBagSizer(10, 10)

        #self.source = wx.ComboBox(self, choices = ["USB", "Shell"])
        #self.source.SetValue("USB")
        self.upload = wx.Button(self, label=localize("Upload"))
        self.platforms = wx.ComboBox(self, choices=self.API.getPlatforms())
        self.refresh = wx.Button(self, label=localize("Refresh"))
        self.compile = wx.Button(self, label=localize("Compile"))
        self.newMote = wx.Button(self, label=localize("Add mote"))
        self.platforms.SetValue(self.API.getActivePlatform())
        if self.API.platformOnly != None:
            self.platforms.Enable(False)

        self.controls.Add(self.compile, (0, 0), flag=wx.EXPAND | wx.ALL)
        self.controls.Add(self.platforms, (0, 1), flag=wx.EXPAND | wx.ALL)
        self.controls.Add(self.upload, (0, 2),
                          span=(2, 2),
                          flag=wx.EXPAND | wx.ALL)

        #self.controls.Add(self.source, (1, 1), flag = wx.EXPAND | wx.ALL)
        self.controls.Add(self.newMote, (1, 1), flag=wx.EXPAND | wx.ALL)
        self.controls.Add(self.refresh, (1, 0), flag=wx.EXPAND | wx.ALL)

        self.list = wx.CheckListBox(self, wx.ID_ANY, style=wx.MULTIPLE)

        self.main.Add(self.controls, 0, wx.EXPAND | wx.ALL, 3)
        self.main.Add(self.list, 0, wx.EXPAND | wx.ALL, 3)

        self.Bind(wx.EVT_BUTTON, self.API.doCompile, self.compile)
        self.Bind(wx.EVT_BUTTON, self.API.doUpload, self.upload)
        self.Bind(wx.EVT_BUTTON, self.updateMotelist, self.refresh)
        #self.Bind(wx.EVT_COMBOBOX, self.populateMotelist, self.source)
        self.Bind(wx.EVT_BUTTON, self.openNewMoteDialog, self.newMote)
        self.Bind(wx.EVT_COMBOBOX, self.API.changePlatform, self.platforms)
        self.Bind(wx.EVT_CHECKLISTBOX, self.modifyTargets, self.list)

        self.SetSizerAndFit(self.main)
        self.SetAutoLayout(1)
        self.Show()

        self.updateMotelist()
Ejemplo n.º 3
0
    def __init__(self, parent, API):
        super(ListenModule, self).__init__(parent)

        self.API = API

        self.haveMote = False
        self.listening = False
        self.args = {
             'serialPort': '/dev/ttyUSB0',
             'baudrate': 38400
         }

        Motelist.addUpdateCallback(self.updateMotelist)

        self.SetBackgroundColour("white")
        self.main = wx.BoxSizer(wx.VERTICAL)
        self.listenControls = wx.BoxSizer(wx.HORIZONTAL)

        self.ports = wx.ComboBox(self, choices = [], size = (300, -1))
        self.clear = wx.Button(self, label = localize("Start listening"))
        self.refresh = wx.Button(self, label = localize("Refresh"))
        self.clearOutput = wx.Button(self, label = localize("Clear"))
        self.saveOutput = wx.Button(self, label = localize("Save to file"))
        self.baudrate = wx.ComboBox(self, choices = ['2400', '4800', '9600', '19200', '38400', '57600', '115200'])
        self.baudrate.SetSelection(4);

        self.ports.SetEditable(False)

        # Init outputArea for output
        self.outputArea = OutputArea(self, self.API, 1)
        self.updateStatus = self.outputArea.printLine
        self.clearOutputArea = self.outputArea.clear

        self.listenControls.Add(self.ports)
        self.listenControls.Add(self.baudrate)
        self.listenControls.Add(self.refresh)     
        self.listenControls.Add(self.clear)
        self.listenControls.Add(self.clearOutput)
        self.listenControls.Add(self.saveOutput)

        self.main.Add(self.listenControls, 0,
                      wx.EXPAND | wx.wx.TOP | wx.LEFT | wx.RIGHT, 10);
        self.main.Add(self.outputArea, 1, wx.EXPAND | wx.ALL, 5);

        self.Bind(wx.EVT_BUTTON, self.doClear, self.clear)         
        self.Bind(wx.EVT_BUTTON, self.updateMotelist, self.refresh)
        self.Bind(wx.EVT_BUTTON, self.clearOutputArea, self.clearOutput)
        self.Bind(wx.EVT_BUTTON, self.saveOutputArea, self.saveOutput)
        self.Bind(wx.EVT_COMBOBOX, self.changeTarget, self.ports)
        self.Bind(wx.EVT_COMBOBOX, self.changeBaudrate, self.baudrate)
        self.Bind(wx.EVT_TEXT, self.changeTarget, self.ports)

        #self.updateMotelist()

        self.SetSizer(self.main)
        self.main.Fit(self)
        self.Show()
Ejemplo n.º 4
0
    def __init__(self, parent, API):
        super(UploadModule, self).__init__(parent = parent)

        self.API = API
        self.editorManager = self.API.tabManager.GetCurrentPage()
        self.filename = self.editorManager.fileName
        Motelist.addUpdateCallback(self.updateMotelist)

        self.tmpDir = self.API.path + '/temp/'
        self.haveMote = False
        self.platform = "telosb"
        self.moteOrder = list()
        # this is path from /mansos/tools/IDE
        self.pathToMansos = self.API.path + "/../.."
        self.motes = []

        self.main = wx.BoxSizer(wx.VERTICAL)
        self.controls = wx.GridBagSizer(10, 10)

        #self.source = wx.ComboBox(self, choices = ["USB", "Shell"])
        #self.source.SetValue("USB")
        self.upload = wx.Button(self, label = localize("Upload"))
        self.platforms = wx.ComboBox(self, choices = self.API.getPlatforms())
        self.refresh = wx.Button(self, label = localize("Refresh"))
        self.compile = wx.Button(self, label = localize("Compile"))
        self.newMote = wx.Button(self, label = localize("Add mote"))
        self.platforms.SetValue(self.API.getActivePlatform())
        if self.API.platformOnly != None:
            self.platforms.Enable(False)

        self.controls.Add(self.compile, (0, 0), flag = wx.EXPAND | wx.ALL)
        self.controls.Add(self.platforms, (0, 1), flag = wx.EXPAND | wx.ALL)
        self.controls.Add(self.upload, (0, 2), span = (2, 2),
                          flag = wx.EXPAND | wx.ALL)

        #self.controls.Add(self.source, (1, 1), flag = wx.EXPAND | wx.ALL)
        self.controls.Add(self.newMote, (1, 1), flag = wx.EXPAND | wx.ALL)
        self.controls.Add(self.refresh, (1, 0), flag = wx.EXPAND | wx.ALL)

        self.list = wx.CheckListBox(self, wx.ID_ANY, style = wx.MULTIPLE)

        self.main.Add(self.controls, 0, wx.EXPAND | wx.ALL, 3);
        self.main.Add(self.list, 0, wx.EXPAND | wx.ALL, 3);

        self.Bind(wx.EVT_BUTTON, self.API.doCompile, self.compile)
        self.Bind(wx.EVT_BUTTON, self.API.doUpload, self.upload)
        self.Bind(wx.EVT_BUTTON, self.updateMotelist, self.refresh)
        #self.Bind(wx.EVT_COMBOBOX, self.populateMotelist, self.source)
        self.Bind(wx.EVT_BUTTON, self.openNewMoteDialog, self.newMote)
        self.Bind(wx.EVT_COMBOBOX, self.API.changePlatform, self.platforms)
        self.Bind(wx.EVT_CHECKLISTBOX, self.modifyTargets, self.list)

        self.SetSizerAndFit(self.main)
        self.SetAutoLayout(1)
        self.Show()

        self.updateMotelist()