本文整理汇总了Python中utils.globals.GlobalData类的典型用法代码示例。如果您正苦于以下问题:Python GlobalData类的具体用法?Python GlobalData怎么用?Python GlobalData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GlobalData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: __loadProject
def __loadProject( self ):
" handles 'Load' context menu item "
if self.__projectContextItem is None:
return
if not self.__projectContextItem.isValid():
return
if self.__debugMode:
return
projectFileName = self.__projectContextItem.getFilename()
if self.__projectContextItem.isCurrent():
GlobalData().mainWindow.openFile( projectFileName, -1 )
return # This is the current project, open for text editing
QApplication.processEvents()
QApplication.setOverrideCursor( QCursor( Qt.WaitCursor ) )
if os.path.exists( projectFileName ):
mainWin = GlobalData().mainWindow
editorsManager = mainWin.editorsManagerWidget.editorsManager
if editorsManager.closeRequest():
prj = GlobalData().project
prj.setTabsStatus( editorsManager.getTabsStatus() )
editorsManager.closeAll()
prj.loadProject( projectFileName )
mainWin.activateProjectTab()
else:
logging.error( "The project " + \
os.path.basename( projectFileName ) + \
" disappeared from the file system." )
self.__populateProjects()
QApplication.restoreOverrideCursor()
return
开发者ID:Alwnikrotikz,项目名称:codimension,代码行数:33,代码来源:recentprojectsviewer.py
示例17: __populateFromProject
def __populateFromProject( self ):
" Populates find name dialog from the project files "
mainWindow = GlobalData().mainWindow
for fname in GlobalData().project.filesList:
if detectFileType( fname ) in [ PythonFileType, Python3FileType ]:
widget = mainWindow.getWidgetForFileName( fname )
if widget is None:
info = GlobalData().briefModinfoCache.get( fname )
else:
content = widget.getEditor().text()
info = getBriefModuleInfoFromMemory( content )
self.__populateInfo( info, fname )
return
开发者ID:eaglexmw,项目名称:codimension,代码行数:14,代码来源:findname.py
示例18: __allItemActivated
def __allItemActivated( self, item, column ):
" Handles the double click (or Enter) in the total results tree "
# We process only the error messages and McCabe items
hiddenColumnText = str( item.text( 2 ) )
if not hiddenColumnText in [ "M", "E" ]:
return
fileName = self.__getTreeItemFileName( item )
lineNumber = 0
if hiddenColumnText == "M":
# This is McCabe item
objName = str( item.text( 0 ) )
self.__onMcCabeObject( objName, fileName )
return
elif hiddenColumnText == "E":
# This is an error message
message = str( item.text( 0 ) )
pos = message.find( "at line" )
if pos == -1:
logging.error( "Unknown format of the message. "
"Please inform the developers." )
return
parts = message[ pos: ].split()
try:
lineNumber = int( parts[ 2 ].replace( ',', '' ) )
except:
logging.error( "Unknown format of the message. "
"Please inform the developers." )
return
if fileName == "":
# This is an unsaved buffer, try to find the editor by UUID
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 )
editor.setFocus()
return
GlobalData().mainWindow.openFile( fileName, lineNumber )
return
开发者ID:eaglexmw,项目名称:codimension,代码行数:46,代码来源:pymetricsviewer.py
示例19: __onProjectChanged
def __onProjectChanged( self, what ):
" Triggered when a project is changed "
if what != CodimensionProject.CompleteProject:
return
self.clear()
project = GlobalData().project
if project.isLoaded():
self.__ignored = list( project.ignoredExcpt )
else:
self.__ignored = list( Settings().ignoredExceptions )
for exceptionType in self.__ignored:
item = QTreeWidgetItem( self.exceptionsList )
item.setText( 0, exceptionType )
self.__updateTitle()
return
开发者ID:eaglexmw,项目名称:codimension,代码行数:17,代码来源:ignoredexcptviewer.py
示例20: defaultFont
def defaultFont( self, style ):
""" Provides the default font for a style """
if style in [ PYGMENTS_COMMENT, PYGMENTS_PREPROCESSOR ]:
f = GlobalData().skin.nolexerFont
if style == PYGMENTS_PREPROCESSOR:
f.setItalic( True )
return f
if style in [ PYGMENTS_STRING ]:
return GlobalData().skin.nolexerFont
if style in [ PYGMENTS_KEYWORD, PYGMENTS_OPERATOR, PYGMENTS_WORD,
PYGMENTS_BUILTIN, PYGMENTS_ATTRIBUTE, PYGMENTS_FUNCTION,
PYGMENTS_CLASS, PYGMENTS_NAMESPACE, PYGMENTS_EXCEPTION,
PYGMENTS_ENTITY, PYGMENTS_TAG, PYGMENTS_SCALAR,
PYGMENTS_ESCAPE, PYGMENTS_HEADING, PYGMENTS_SUBHEADING,
PYGMENTS_STRONG, PYGMENTS_PROMPT ]:
f = LexerContainer.defaultFont( self, style )
f.setBold( True )
return f
if style in [ PYGMENTS_DOCSTRING, PYGMENTS_EMPHASIZE ]:
f = LexerContainer.defaultFont( self, style )
f.setItalic( True )
return f
return LexerContainer.defaultFont( self, style )
开发者ID:eaglexmw,项目名称:codimension,代码行数:28,代码来源:lexerpygments.py
注:本文中的utils.globals.GlobalData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论