本文整理汇总了Python中utils.globals.GlobalData.get方法的典型用法代码示例。如果您正苦于以下问题:Python GlobalData.get方法的具体用法?Python GlobalData.get怎么用?Python GlobalData.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.globals.GlobalData
的用法示例。
在下文中一共展示了GlobalData.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __process
# 需要导入模块: from utils.globals import GlobalData [as 别名]
# 或者: from utils.globals.GlobalData import get [as 别名]
def __process( self ):
" Accumulation process "
# Intermediate working data
self.__participantFiles = []
self.__projectImportDirs = []
self.__projectImportsCache = {}
self.dataModel.clear()
self.__inProgress = True
try:
self.infoLabel.setText( 'Building the list of files to analyze...' )
QApplication.processEvents()
# Build the list of participating python files
self.__buildParticipants()
self.__projectImportDirs = \
GlobalData().project.getImportDirsAsAbsolutePaths()
QApplication.processEvents()
if self.__cancelRequest == True:
QApplication.restoreOverrideCursor()
self.close()
return
self.progressBar.setRange( 0, len( self.__participantFiles ) )
index = 1
# Now, parse the files and build the diagram data model
if self.__what == ImportsDiagramDialog.SingleBuffer:
info = getBriefModuleInfoFromMemory( str( self.__buf ) )
self.__addSingleFileToDataModel( info, self.__path )
else:
infoSrc = GlobalData().briefModinfoCache
for fName in self.__participantFiles:
self.progressBar.setValue( index )
self.infoLabel.setText( 'Analyzing ' + fName + "..." )
QApplication.processEvents()
if self.__cancelRequest == True:
QApplication.restoreOverrideCursor()
self.dataModel.clear()
self.close()
return
info = infoSrc.get( fName )
self.__addSingleFileToDataModel( info, fName )
index += 1
# The import caches and other working data are not needed anymore
self.__participantFiles = None
self.__projectImportDirs = None
self.__projectImportsCache = None
# Generating the graphviz layout
self.infoLabel.setText( 'Generating layout using graphviz...' )
QApplication.processEvents()
graph = getGraphFromDescriptionData( self.dataModel.toGraphviz() )
graph.normalize( self.physicalDpiX(), self.physicalDpiY() )
QApplication.processEvents()
if self.__cancelRequest == True:
QApplication.restoreOverrideCursor()
self.dataModel.clear()
self.close()
return
# Generate graphics scene
self.infoLabel.setText( 'Generating graphics scene...' )
QApplication.processEvents()
self.__buildGraphicsScene( graph )
# Clear the data model
self.dataModel = None
except Exception, exc:
QApplication.restoreOverrideCursor()
logging.error( str( exc ) )
self.__inProgress = False
self.__onClose()
return
示例2: __createLayout
# 需要导入模块: from utils.globals import GlobalData [as 别名]
# 或者: from utils.globals.GlobalData import get [as 别名]
def __createLayout( self, action, title, files ):
""" Creates the dialog layout """
self.resize( 400, 300 )
self.setSizeGripEnabled( True )
# Top level layout
layout = QVBoxLayout( self )
# Pixmap and the message
topLayout = QHBoxLayout()
pixmap = QLabel()
pixmap.setPixmap( PixmapCache().getPixmap( 'warning.png' ) )
topLayout.addWidget( pixmap )
hSpacer = QWidget()
hSpacer.setFixedSize( 15, 15 )
topLayout.addWidget( hSpacer )
message = QLabel( "All the project files must be " \
"saved before start debugging" )
message.setAlignment( Qt.AlignHCenter | Qt.AlignVCenter )
message.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding )
message.setWordWrap( True )
topLayout.addWidget( message )
layout.addLayout( topLayout )
vSpacer = QWidget()
vSpacer.setFixedSize( 15, 15 )
layout.addWidget( vSpacer )
layout.addWidget( QLabel( title + ":" ) )
filesList = QTreeWidget()
filesList.setRootIsDecorated( False )
filesList.setAlternatingRowColors( True )
filesList.setUniformRowHeights( True )
filesList.setItemsExpandable( False )
filesList.setItemDelegate( NoOutlineHeightDelegate( 4 ) )
filesList.setSelectionMode( QAbstractItemView.NoSelection )
filesList.setHeaderHidden( True )
for item in files:
fileName = item[ 0 ]
fileItem = QTreeWidgetItem( [ fileName ] )
fileType = detectFileType( fileName )
fileItem.setIcon( 0, getFileIcon( fileType ) )
if fileType in [ PythonFileType, Python3FileType ]:
infoSrc = GlobalData().briefModinfoCache
info = infoSrc.get( fileName )
if info.docstring is not None:
fileItem.setToolTip( 0, info.docstring.text )
else:
fileItem.setToolTip( 0, "" )
filesList.addTopLevelItem( fileItem )
layout.addWidget( filesList )
# Buttons at the bottom
buttonBox = QDialogButtonBox()
buttonBox.setOrientation( Qt.Horizontal )
buttonBox.setStandardButtons( QDialogButtonBox.Cancel )
continueButton = buttonBox.addButton( action,
QDialogButtonBox.ActionRole )
continueButton.setDefault( True )
layout.addWidget( buttonBox )
continueButton.clicked.connect( self.accept )
buttonBox.rejected.connect( self.close )
continueButton.setFocus()
return