Пример #1
0
 def addAll(self):
     cfgMotes = configuration.c.getCfgValueAsList("motes")
     for portName in cfgMotes:
         Motelist.addMote(portName, "A statically added mote", "")
     Motelist.initialize(self.motesUpdated)
     Motelist.startPeriodicUpdate()
     self.refreshMotes(Motelist.getMotelist(False))
Пример #2
0
 def addAll(self):
     cfgMotes = configuration.c.getCfgValueAsList("motes")
     for portName in cfgMotes:
         Motelist.addMote(portName, "A statically added mote", "")
     Motelist.initialize(self.motesUpdated, False, False)
     Motelist.startPeriodicUpdate()
     self.refreshMotes(Motelist.getMotelist(False))
Пример #3
0
    def __init__(self, argv):
        self.loaded = False
        self.config = wx.Config("OSW-IDE", style = wx.CONFIG_USE_LOCAL_FILE)

        self.path = os.getcwd()

        # All functions here will be called upon exit
        self.onExit = [Settings.saveConfig]

        Settings()

        # All defined platforms
        self.platforms = self.getPlatformsFromMakefile()

        self.platformOnly = None
        self.excludedPlatforms = list()

        self.activePlatform = self.platforms.index("telosb")

        # Flag indicates that next thread's output shouldn't trigger 
        # force switching to info area tab.
        self.supressTabSwitching = False

        self.targets = [None]
        self.targetType = "USB"

        self.activeThreads = {}

        self.onExit.append(self.killAllThreads)

        if LOG_TO_FILE:
            path = os.getcwd()
            os.chdir(self.path)
            self.logFile = open(LOG_FILE_NAME, "a")
            os.chdir(path)
            self.onExit.append(self.logFile.close)

        # this is path from /osw/tools/IDE
        self.pathToMansos = os.path.join(self.path, "../..")

        # Try to get system default font
        #font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        #self.fontName = font.GetFaceName()
        #if self.fontName != "":
        #    print "Using system default font: {}".format(self.fontName)
        #else:
        self.fontName = "Courier New"
        #    print "Can't find system default font, defaulting to {}".\
        #                format(self.fontName)

        self.listenModules = list()

        self.editors = list()

        icon = os.path.normpath('../../doc/osw-32x32.ico')

### Module initializations

# Visual objects here can be used in forms only after they have been re-parented 
# using their Reparent() function, else they won't be visible!

        self.emptyFrame = wx.Frame(None)

        # Defines seal syntax
        self.sealSyntax = SealSyntax(self)

        # Init translation module
        Translater(self)

        # Init output_tools
        #self.outputTools = OutputTools(self.emptyFrame, self)

        # Init outputArea for info, 1st tab
        self.infoArea = OutputArea(self.emptyFrame, self, 0)
        self.printInfo = self.infoArea.printLine
        self.clearInfoArea = self.infoArea.clear

        # Init blockly handler
        if os.path.exists(os.path.join(self.path, Settings.get("blockly_location"))):
            self.blockly = Blockly(self.emptyFrame, self)
            self.foundBlockly = True
        else:
            print "Warning: No SEAL-Blockly found!"
            self.foundBlockly = False

        # Init seal parser
        self.sealParser = seal_parser.SealParser("msp430", self.printInfo, False, True)

        # Init tab manager 
        self.tabManager = TabManager(self.emptyFrame, self)

        # Init listenModule
        self.listenModules.append(ListenModule(self.emptyFrame, self))

        self.editPanel = ScrolledPanel(self.emptyFrame)

        self.editWindow = EditStatement(self.editPanel, self)

        self.frame = Frame(None, "OSW IDE", (0, 0), (0, 0), self)

        #self.outputTools.addTools()

        self.compiler = DoCompile(self)
        self.uploader = DoUpload(self)

### Shortcuts

# This allows modules to be disabled and dummy functions attached, so other 
# modules can keep saving the day... Each module updates his functions at 
# startup and restores them at termination. All function calls between modules 
# should go through here, but this ain't perfect world :(

        self.getKeywords = self.sealSyntax.getKeywords

        #self.printInfo = self.dummyPrint
        self.printOutput = self.dummyPrint

# Check if icon can be found
        if os.path.exists(icon):
            self.frame.SetIcon(wx.Icon(icon, wx.BITMAP_TYPE_ICO, 32, 32))
        else:
            self.logMsg(LOG_WARNING, "Icon not found in '{}'!".format(icon))

# Check that everything is OK
        assert len(self.emptyFrame.GetChildren()) == 0, \
        "There are parentless objects after API initialization.\n{}".format(\
                            self.emptyFrame.GetChildren())

        self.syncModuleCheckboxes()

# Initialize upload targets
        self.uploadTargets = ([], localize('the default device'))

# Load last used tabs
        self.tabManager.loadRememberedTabs()
        for x in argv:
            self.tabManager.addPage(x)
        self.frame.auiManager.Update()

        self.loaded = True
        self.frame.checkToggleState()

        Motelist.startPeriodicUpdate()
        self.onExit.append(Motelist.stopPeriodicUpdate)

        self.loadUserMotes()
Пример #4
0
    def __init__(self, argv):
        self.loaded = False
        self.config = wx.Config("MansOS-IDE", style=wx.CONFIG_USE_LOCAL_FILE)

        self.path = os.getcwd()

        # All functions here will be called upon exit
        self.onExit = [Settings.saveConfig]

        Settings()

        # All defined platforms
        self.platforms = self.getPlatformsFromMakefile()

        self.platformOnly = None
        self.excludedPlatforms = list()

        self.activePlatform = self.platforms.index("telosb")

        # Flag indicates that next thread's output shouldn't trigger
        # force switching to info area tab.
        self.supressTabSwitching = False

        self.targets = [None]
        self.targetType = "USB"

        self.activeThreads = {}

        self.onExit.append(self.killAllThreads)

        if LOG_TO_FILE:
            path = os.getcwd()
            os.chdir(self.path)
            self.logFile = open(LOG_FILE_NAME, "a")
            os.chdir(path)
            self.onExit.append(self.logFile.close)

        # this is path from /mansos/tools/IDE
        self.pathToMansos = os.path.join(self.path, "../..")

        # Try to get system default font
        #font = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
        #self.fontName = font.GetFaceName()
        #if self.fontName != "":
        #    print "Using system default font: {}".format(self.fontName)
        #else:
        self.fontName = "Courier New"
        #    print "Can't find system default font, defaulting to {}".\
        #                format(self.fontName)

        self.listenModules = list()

        self.editors = list()

        icon = os.path.normpath('../../doc/mansos-32x32.ico')

        ### Module initializations

        # Visual objects here can be used in forms only after they have been re-parented
        # using their Reparent() function, else they won't be visible!

        self.emptyFrame = wx.Frame(None)

        # Defines seal syntax
        self.sealSyntax = SealSyntax(self)

        # Init translation module
        Translater(self)

        # Init output_tools
        #self.outputTools = OutputTools(self.emptyFrame, self)

        # Init outputArea for info, 1st tab
        self.infoArea = OutputArea(self.emptyFrame, self, 0)
        self.printInfo = self.infoArea.printLine
        self.clearInfoArea = self.infoArea.clear

        # Init blockly handler
        if os.path.exists(
                os.path.join(self.path, Settings.get("blockly_location"))):
            self.blockly = Blockly(self.emptyFrame, self)
            self.foundBlockly = True
        else:
            print "Warning: No SEAL-Blockly found!"
            self.foundBlockly = False

        # Init seal parser
        self.sealParser = seal_parser.SealParser("msp430", self.printInfo,
                                                 False, True)

        # Init tab manager
        self.tabManager = TabManager(self.emptyFrame, self)

        # Init listenModule
        self.listenModules.append(ListenModule(self.emptyFrame, self))

        self.editPanel = ScrolledPanel(self.emptyFrame)

        self.editWindow = EditStatement(self.editPanel, self)

        self.frame = Frame(None, "MansOS IDE", (0, 0), (0, 0), self)

        #self.outputTools.addTools()

        self.compiler = DoCompile(self)
        self.uploader = DoUpload(self)

        ### Shortcuts

        # This allows modules to be disabled and dummy functions attached, so other
        # modules can keep saving the day... Each module updates his functions at
        # startup and restores them at termination. All function calls between modules
        # should go through here, but this ain't perfect world :(

        self.getKeywords = self.sealSyntax.getKeywords

        #self.printInfo = self.dummyPrint
        self.printOutput = self.dummyPrint

        # Check if icon can be found
        if os.path.exists(icon):
            self.frame.SetIcon(wx.Icon(icon, wx.BITMAP_TYPE_ICO, 32, 32))
        else:
            self.logMsg(LOG_WARNING, "Icon not found in '{}'!".format(icon))

# Check that everything is OK
        assert len(self.emptyFrame.GetChildren()) == 0, \
        "There are parentless objects after API initialization.\n{}".format(\
                            self.emptyFrame.GetChildren())

        self.syncModuleCheckboxes()

        # Initialize upload targets
        self.uploadTargets = ([], localize('the default device'))

        # Load last used tabs
        self.tabManager.loadRememberedTabs()
        for x in argv:
            self.tabManager.addPage(x)
        self.frame.auiManager.Update()

        self.loaded = True
        self.frame.checkToggleState()

        Motelist.startPeriodicUpdate()
        self.onExit.append(Motelist.stopPeriodicUpdate)

        self.loadUserMotes()