Example #1
0
    def __init__(self, parent=None):
        '''
        Constructor
        '''
        super(MultipleCppEditor, self).__init__(parent)

        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        self.DefaultKeywords = getLibraryKeywords()

        self.findDlg = FindDialog(self)

        self.setAcceptDrops(True)
        #self.setTabShape(QtGui.QTabWidget.Triangular)
        self.setMovable(True)
        self.setTabsClosable(True)

        self.sampleProjects = []
        try:
            for group in getExampleProjects(scanFirmwareLibs()):
                for fname in group[1]:
                    self.sampleProjects.append(fname)
            # print self.sampleProjects
        except:
            pass

        self.Outline = OutLineView(self)

        self.connect(self, QtCore.SIGNAL('tabCloseRequested(int)'),
                     self.closeFile)
        self.connect(self, QtCore.SIGNAL('currentChanged(int)'),
                     self.Outline.update)

        if self.count() == 0:
            self.newFile()
Example #2
0
 def __init__(self, parent=None):
     '''
     Constructor
     '''
     super(MultipleCppEditor, self).__init__(parent)
     
     self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     
     self.DefaultKeywords = getLibraryKeywords()
     
     self.findDlg = FindDialog(self)
     
     self.setAcceptDrops(True)
     #self.setTabShape(QtGui.QTabWidget.Triangular)
     self.setMovable(True)
     self.setTabsClosable(True)
     
     self.sampleProjects = []
     try:
         for group in getExampleProjects(scanFirmwareLibs()):
             for fname in group[1]:
                 self.sampleProjects.append(fname)
         # print self.sampleProjects
     except:
         pass
     
     self.Outline = OutLineView(self)
     
     self.connect(self, QtCore.SIGNAL('tabCloseRequested(int)'), self.closeFile)
     self.connect(self, QtCore.SIGNAL('currentChanged(int)'), self.Outline.update)
     
     if self.count()==0:
         self.newFile()
Example #3
0
 def updateApiKeywords(self):
     self.libraryAPIs.clear()
     self.apiKeywords = self.parent.getDefaultKeywords()
     headerfiles = []
     for line in range(self.lines()):
         txt = str(self.text(line)).strip()
         if txt.find('int') == 0:  # e.g. reached "int main()"
             break
         elif txt.find('#include') == 0:
             txt = ''.join(txt.split())
             temp = txt[len('#includes') - 1:]
             header = temp[1:-1]  # get the header file
             hfile = os.path.join('libraries', header[:-2], header)
             if os.path.isfile(hfile):
                 if not (hfile in headerfiles): headerfiles.append(hfile)
     if len(headerfiles):
         #print 'parsing: ', headerfiles
         self.apiKeywords += getLibraryKeywords(headerfiles)
     #self.apiKeywords = list(set(self.apiKeywords)) # remove duplicates
     for keyword in self.apiKeywords:
         self.libraryAPIs.add(keyword)
     self.libraryAPIs.prepare()
     self.lexer.setAPIs(self.libraryAPIs)
Example #4
0
 def updateApiKeywords(self):
     self.libraryAPIs.clear()
     self.apiKeywords = self.parent.getDefaultKeywords()
     headerfiles = []
     for line in range(self.lines()):
         txt = str(self.text(line)).strip()
         if txt.find('int') == 0: # e.g. reached "int main()"
             break
         elif txt.find('#include') == 0:
             txt = ''.join(txt.split())
             temp = txt[len('#includes')-1 : ]
             header = temp[1:-1] # get the header file
             hfile = os.path.join('libraries', header[:-2], header)
             if os.path.isfile(hfile):
                 if not (hfile in headerfiles): headerfiles.append( hfile )
     if len( headerfiles ):
         #print 'parsing: ', headerfiles
         self.apiKeywords += getLibraryKeywords( headerfiles )
     #self.apiKeywords = list(set(self.apiKeywords)) # remove duplicates
     for keyword in self.apiKeywords:
         self.libraryAPIs.add( keyword )
     self.libraryAPIs.prepare()
     self.lexer.setAPIs(self.libraryAPIs)
 def prepareLibraryAPIs(self):
     self.LibraryAPIs = QsciAPIs(QsciLexerCPP(self,True))
     keywords = getLibraryKeywords()
     for keyword in keywords:
         self.LibraryAPIs.add( keyword )
     self.LibraryAPIs.prepare()