当前位置: 首页>>代码示例>>Python>>正文


Python globals.GlobalData类代码示例

本文整理汇总了Python中utils.globals.GlobalData的典型用法代码示例。如果您正苦于以下问题:Python GlobalData类的具体用法?Python GlobalData怎么用?Python GlobalData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GlobalData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __onProjectChanged

    def __onProjectChanged( self, what ):
        " Triggered when a project is changed "
        if what != CodimensionProject.CompleteProject:
            return

        self.clear()
        model = self.bpointsList.model().sourceModel()
        project = GlobalData().project
        if project.isLoaded():
            bpoints = project.breakpoints
        else:
            bpoints = Settings().breakpoints

        for bp in bpoints:
            newBpoint = Breakpoint()
            try:
                if not newBpoint.deserialize( bp ):
                    # Non valid
                    continue
            except:
                continue
            # Need to check if it still points to a breakable line
            line = newBpoint.getLineNumber()
            fileName = newBpoint.getAbsoluteFileName()
            breakableLines = getBreakpointLines( fileName, None, True )
            if breakableLines is not None and line in breakableLines:
                model.addBreakpoint( newBpoint )
            else:
                logging.warning( "Breakpoint at " + fileName + ":" +
                                 str( line ) + " does not point to a breakable "
                                 "line anymore (the file is invalid or was "
                                 "modified outside of the "
                                 "IDE etc.). The breakpoint is deleted." )
        return
开发者ID:eaglexmw,项目名称:codimension,代码行数:34,代码来源:bpointviewer.py

示例2: __init__

    def __init__( self, fileName = None, lineNumber = None, condition = "",
                        temporary = False, enabled = True, ignoreCount = 0 ):

        if fileName is None:
            self.__fileName = fileName
        elif os.path.isabs( fileName ):
            project = GlobalData().project
            if project.isLoaded():
                if project.isProjectFile( fileName ):
                    # This is a project file; strip the project dir
                    self.__fileName = fileName.replace( project.getProjectDir(),
                                                        "" )
                else:
                    # Not a project file, save as is
                    self.__fileName = fileName
            else:
                # Pretty much impossible
                self.__fileName = fileName
        else:
            # Relative path, i.e. a project file
            self.__fileName = fileName

        self.__lineNumber = lineNumber
        self.__condition = condition
        self.__temporary = temporary
        self.__enabled = enabled
        self.__ignoreCount = ignoreCount

        return
开发者ID:eaglexmw,项目名称:codimension,代码行数:29,代码来源:breakpoint.py

示例3: getProjectSpecificModules

def getProjectSpecificModules( path = "", onlySpecified = False ):
    " Provides a dictionary of the project specific modules "
    specificModules = {}
    importDirs = []

    if not onlySpecified:
        importDirs = GlobalData().getProjectImportDirs()
        for importPath in importDirs:
            specificModules.update( getModules( importPath ) )

        projectFile = GlobalData().project.fileName
        if projectFile != "":
            basedir = os.path.dirname( projectFile )
            if basedir not in importDirs:
                importDirs.append( basedir )
                specificModules.update( getModules( basedir ) )

    if path and os.path.isabs( path ):
        path = os.path.normpath( path )
        basedir = ""
        if os.path.isfile( path ):
            basedir = os.path.dirname( path )
        elif os.path.isdir( path ):
            basedir = path

        if basedir and basedir not in importDirs:
            specificModules.update( getModules( basedir ) )

    return specificModules
开发者ID:eaglexmw,项目名称:codimension,代码行数:29,代码来源:completelists.py

示例4: getImportedNameDefinitionLine

def getImportedNameDefinitionLine( path, name, info = None ):
    """ Searches for the given name in the given file and provides its
        line number. -1 if not found.
        Only top level names are searched through. """
    if info is None:
        mainWindow = GlobalData().mainWindow
        widget = mainWindow.getWidgetForFileName( os.path.realpath( path ) )
        if widget is None:
            # The file is not opened now
            info = getBriefModuleInfoFromFile( path )
        else:
            editor = widget.getEditor()
            info = getBriefModuleInfoFromMemory( editor.text() )

    # Check the object names
    for classObj in info.classes:
        if classObj.name == name:
            return classObj.line
    for funcObj in info.functions:
        if funcObj.name == name:
            return funcObj.line
    for globalObj in info.globals:
        if globalObj.name == name:
            return globalObj.line

    return -1
开发者ID:eaglexmw,项目名称:codimension,代码行数:26,代码来源:importutils.py

示例5: search

    def search( self, expression ):
        " Perform search within this item "

        self.matches = []
        if self.bufferUUID != "":
            # Search item is the currently loaded buffer
            mainWindow = GlobalData().mainWindow
            widget = mainWindow.getWidgetByUUID( self.bufferUUID )
            if widget is not None:
                # Search in the buffer

                content = widget.getEditor().text().splitlines()
                self.__lookThroughLines( content, expression )
                return

        # Here: there were no buffer or have not found it
        #       try searching in a file
        if not os.path.isabs( self.fileName ) or \
           not os.path.exists( self.fileName ):
            # Unfortunately not all network file systems report the
            # fact that a file has been deleted from the disk so
            # let's simply ignore such files
            return

        # File exists, search in the file
        try:
            f = open( self.fileName )
            content = f.read().split( "\n" )
            f.close()
            self.__lookThroughLines( content, expression )
        except:
            logging.error( "Cannot read " + self.fileName )
        return
开发者ID:eaglexmw,项目名称:codimension,代码行数:33,代码来源:findinfiles.py

示例6: codimensionMain

def codimensionMain():
    """ The codimension driver """

    # Parse command line arguments
    parser = OptionParser(
    """
    %prog [options] [project file | python files]
    Runs codimension UI
    """,
    version = "%prog " + __version__ )

    parser.add_option( "--debug",
                       action="store_true", dest="debug", default=False,
                       help="switch on debug and info messages (default: Off)" )
    parser.add_option( "--clean-start",
                       action="store_true", dest="cleanStart", default=False,
                       help="do not restore previous IDE state (default: Off)" )

    options, args = parser.parse_args()

    # Configure logging
    setupLogging( options.debug )

    # The default exception handler can be replaced
    sys.excepthook = exceptionHook

    # Create global data singleton.
    # It's unlikely to throw any exceptions.
    globalData = GlobalData()
    globalData.version = __version__

    # Loading settings - they have to be loaded before the application is
    # created. This is because the skin name is saved there.
    settings = Settings()
    copySkin()

    # Load the skin
    globalData.skin = Skin()
    globalData.skin.load( settingsDir + "skins" +
                          os.path.sep + settings.skin )

    # QT on UBUNTU has a bug - the main menu bar does not generate the
    # 'aboutToHide' signal (though 'aboutToShow' is generated properly. This
    # prevents codimension working properly so this hack below disables the
    # global menu bar for codimension and makes it working properly.
    os.environ[ "QT_X11_NO_NATIVE_MENUBAR" ] = "1"

    # Create QT application
    codimensionApp = CodimensionApplication( sys.argv, settings.style )
    globalData.application = codimensionApp

    logging.debug( "Starting codimension v." + __version__ )

    try:
        # Process command line arguments
        projectFile = processCommandLineArgs( args )
    except Exception, exc:
        logging.error( str( exc ) )
        parser.print_help()
        return 1
开发者ID:eaglexmw,项目名称:codimension,代码行数:60,代码来源:codimension.py

示例7: __updateFindHistory

 def __updateFindHistory(self):
     " Updates the find history if required "
     if self.findtextCombo.currentText() != "":
         if self._addToHistory(self.findtextCombo, self.findHistory, self.findtextCombo.currentText()):
             prj = GlobalData().project
             prj.setFindHistory(self.findHistory)
     return
开发者ID:fukanchik,项目名称:codimension,代码行数:7,代码来源:findreplacewidget.py

示例8: __errorActivated

    def __errorActivated( self, item, column ):
        " Handles the double click (or Enter) on the item "

        linePos = str( item.text( 1 ) )
        if ":" in linePos:
            parts = linePos.split( ":" )
            lineNumber = int( parts[ 0 ] )
            pos = int( parts[ 1 ] )
        else:
            lineNumber = int( linePos )
            pos = 0

        if self.__reportOption in [ self.SingleFile, self.DirectoryFiles,
                                    self.ProjectFiles ]:
            fileName = str( item.text( 0 ) )
        else:
            # SingleBuffer
            if self.__reportFileName != "":
                if os.path.isabs( self.__reportFileName ):
                    fileName = self.__reportFileName
                else:
                    # Could be unsaved buffer, so try to search by the
                    mainWindow = GlobalData().mainWindow
                    widget = mainWindow.getWidgetByUUID( self.__reportUUID )
                    if widget is None:
                        logging.error( "The unsaved buffer has been closed" )
                        return
                    # The widget was found, so jump to the required
                    editor = widget.getEditor()
                    editor.gotoLine( lineNumber, pos )
                    editor.setFocus()
                    return

        GlobalData().mainWindow.openFile( fileName, lineNumber, pos )
        return
开发者ID:eaglexmw,项目名称:codimension,代码行数:35,代码来源:pylintviewer.py

示例9: __updateReplaceHistory

    def __updateReplaceHistory(self, text, replaceText):
        " Updates the history in the project and in the combo boxes "

        changedWhat = self._addToHistory(self.findtextCombo, self.findHistory, text)
        changedReplace = self._addToHistory(self.replaceCombo, self.replaceHistory, replaceText)
        if changedWhat or changedReplace:
            prj = GlobalData().project
            prj.setReplaceHistory(self.findHistory, self.replaceHistory)
        return
开发者ID:fukanchik,项目名称:codimension,代码行数:9,代码来源:findreplacewidget.py

示例10: __onRemoveAllFromIgnore

    def __onRemoveAllFromIgnore( self ):
        " Triggered when all the ignored exceptions should be deleted "
        self.clear()

        project = GlobalData().project
        if project.isLoaded():
            project.setExceptionFilters( [] )
        else:
            Settings().setExceptionFilters( [] )
        return
开发者ID:eaglexmw,项目名称:codimension,代码行数:10,代码来源:ignoredexcptviewer.py

示例11: __serializeBreakpoints

    def __serializeBreakpoints( self ):
        " Saves the breakpoints into a file "
        model = self.bpointsList.model().sourceModel()

        project = GlobalData().project
        if project.isLoaded():
            project.setBreakpoints( model.serialize() )
        else:
            Settings().breakpoints = model.serialize()
        return
开发者ID:eaglexmw,项目名称:codimension,代码行数:10,代码来源:bpointviewer.py

示例12: keyPressEvent

 def keyPressEvent( self, event ):
     """ Handles the key press events """
     if event.key() == Qt.Key_Escape:
         editorsManager = GlobalData().mainWindow.editorsManager()
         activeWindow = editorsManager.currentWidget()
         if activeWindow:
             activeWindow.setFocus()
         event.accept()
         self.hide()
     return
开发者ID:eaglexmw,项目名称:codimension,代码行数:10,代码来源:importlist.py

示例13: __init__

    def __init__(self, items, tooltip):
        QTreeWidgetItem.__init__(self, items)
        self.__intColumn = 0
        self.__tooltip = tooltip
        self.__fileModified = False

        # Memorize the screen width
        global screenWidth
        screenSize = GlobalData().application.desktop().screenGeometry()
        screenWidth = screenSize.width()
        return
开发者ID:fukanchik,项目名称:codimension,代码行数:11,代码来源:findinfilesviewer.py

示例14: getAbsoluteFileName

    def getAbsoluteFileName( self ):
        " Provides the absolute file name "
        if self.__fileName is None:
            return None
        if os.path.isabs( self.__fileName ):
            return self.__fileName

        project = GlobalData().project
        if project.isLoaded():
            return project.getProjectDir() + self.__fileName
        return os.path.abspath( self.__fileName )
开发者ID:eaglexmw,项目名称:codimension,代码行数:11,代码来源:breakpoint.py

示例15: getIndicatorPixmap

def getIndicatorPixmap(indicatorID):
    " Provides a pixmap or None "
    for descriptor in IND_DESCRIPTION:
        if descriptor[0] == indicatorID:
            return descriptor[1]
    if indicatorID < 0:
        # It is an IDE defined indicator
        vcsManager = GlobalData().mainWindow.vcsManager
        systemIndicator = vcsManager.getSystemIndicator(indicatorID)
        if systemIndicator:
            return systemIndicator.pixmap
    return None
开发者ID:fukanchik,项目名称:codimension,代码行数:12,代码来源:svnindicators.py


注:本文中的utils.globals.GlobalData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。