itom
Loading...
Searching...
No Matches
ito::PipManager Class Reference
Inheritance diagram for ito::PipManager:

Public Types

enum  Task {
  taskNo , taskCheckAvailable , taskListPackages , taskFetchPackagesDetails ,
  taskCheckUpdates , taskInstall , taskUninstall , taskVerifyInstalledPackages
}
 
enum  PipMode { pipModeDirect , pipModeRunPipUtf8 }
 

Signals

void pipManagerBusy ()
 
void outputAvailable (const QString &text, bool success)
 
void pipVersion (const QString &version)
 
void pipRequestStarted (const PipManager::Task &task, const QString &text, bool outputSilent=false)
 
void pipRequestFinished (const PipManager::Task &task, const QString &text, bool success)
 
void pipFetchDetailsProgress (int totalNumberOfUnfetchedDetails, int recentlyFetchedDetails, bool finished)
 

Public Member Functions

 PipManager (ito::RetVal &retval, QObject *parent=0)
 
 ~PipManager ()
 
QVariant data (const QModelIndex &index, int role) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 
QModelIndex parent (const QModelIndex &index) const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 
void startPipProcess ()
 
bool isPipStarted () const
 
int getPipVersion () const
 
void checkPipAvailable (const PipGeneralOptions &options=PipGeneralOptions())
 
void listAvailablePackages (const PipGeneralOptions &options=PipGeneralOptions(), bool forceReloadDetails=false)
 
void checkPackageUpdates (const PipGeneralOptions &options=PipGeneralOptions())
 
void checkVerifyInstalledPackages (const PipGeneralOptions &options=PipGeneralOptions())
 
void installPackage (const PipInstall &installSettings, const PipGeneralOptions &options=PipGeneralOptions())
 
void uninstallPackage (const QString &packageName, bool runAsSudo, const PipGeneralOptions &options=PipGeneralOptions())
 
void interruptPipProcess ()
 
bool isPackageInUseByOther (const QModelIndex &index)
 

Private Slots

void processError (QProcess::ProcessError error)
 
void processFinished (int exitCode, QProcess::ExitStatus exitStatus)
 
void processReadyReadStandardError ()
 
void processReadyReadStandardOutput ()
 

Private Member Functions

QStringList parseGeneralOptions (const PipGeneralOptions &options, bool ignoreRetries=false, bool ignoreVersionCheck=true) const
 
void clearBuffers ()
 
ito::RetVal initPythonIfStandalone ()
 
ito::RetVal checkCallMode ()
 check if pip can be called via the itom-packages/pipProcess/runPipUtf8.py script or directly
 
void startProcess (const QStringList &arguments)
 the arguments string list must not contain -m as first entry.
 
void fetchPackageDetails (const QStringList &names, int totalNumberOfUnfetchedDetails, bool firstCall)
 
void updatePythonPackageDetails (const PythonPackage &details)
 
bool triggerFetchDetailsForOpenPackages (bool firstCall)
 
void finalizeTask (int exitCode=0)
 
void finalizeTaskCheckAvailable (const QString &error, const QString &output, int exitCode)
 
void finalizeTaskListPackages (const QString &error, const QString &output)
 
void finalizeTaskFetchPackagesDetails (const QString &error, const QString &output)
 
void finalizeTaskCheckUpdates (const QString &error, const QString &output)
 
void finalizeTaskVerifyInstalledPackages (const QString &error, const QString &output)
 
void finalizeTaskInstall (const QString &error, const QString &output)
 
void finalizeTaskUninstall (const QString &error, const QString &output)
 

Private Attributes

QList< QString > m_headers
 string list of names of column headers
 
QList< QVariant > m_alignment
 list of alignments for the corresponding headers
 
QList< PythonPackagem_pythonPackages
 list with installed python packages
 
QProcess m_pipProcess
 
bool m_pipAvailable
 
QByteArray m_standardOutputBuffer
 
QByteArray m_standardErrorBuffer
 
Task m_currentTask
 
PipGeneralOptions m_generalOptionsCache
 
QString m_pythonPath
 
int m_pipVersion
 
wchar_t * m_pUserDefinedPythonHome
 
PipMode m_pipCallMode
 
QString m_runPipUtf8Path
 only valid if m_pipCallMode == pipModeRunPipUtf8
 
int m_numberOfUnfetchedPackageDetails
 
int m_numberOfNewlyObtainedPackageDetails
 
bool m_fetchDetailCancelRequested
 

Member Enumeration Documentation

◆ PipMode

Enumerator
pipModeDirect 

directly call pip as process (might cause encoding errors under windows)

call pip via runPipUtf8.py module (uses a non-official interface of pip, but sets the cout and cerr streams to UTF8; recommended under Windows)

Constructor & Destructor Documentation

◆ PipManager()

ito::PipManager::PipManager ( ito::RetVal & retval,
QObject * parent = 0 )

constructor

constructor, creating column headers for the tree view

◆ ~PipManager()

ito::PipManager::~PipManager ( )

destructor - clean up, clear header and alignment list

Member Function Documentation

◆ columnCount()

int ito::PipManager::columnCount ( const QModelIndex & parent = QModelIndex()) const

return column count

Parameters
[in]parentparent of current item
Returns
2 for child elements (instances) and the header size for root elements (plugins)

◆ data()

QVariant ito::PipManager::data ( const QModelIndex & index,
int role ) const

return data elements for a given row

Parameters
[in]indexindex for which the data elements should be delivered
[in]rolethe current role of the model
Returns
data of the selected element, depending on the element's row and column (passed in index.row and index.column)

◆ headerData()

QVariant ito::PipManager::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const

return the header / captions for the tree view model

◆ index()

QModelIndex ito::PipManager::index ( int row,
int column,
const QModelIndex & parent = QModelIndex() ) const

return current index element

Parameters
[in]rowrow of current element
[in]columncolumn of current element
[in]parentparent of current element
Returns
QModelIndex - element at current index

returns the passed row as index, as the users are arranged in a simple one dimensional list

◆ parent()

QModelIndex ito::PipManager::parent ( const QModelIndex & index) const

return parent element

Parameters
[in]indexthe element's index for which the parent should be returned
Returns
the parent element.

◆ rowCount()

int ito::PipManager::rowCount ( const QModelIndex & parent = QModelIndex()) const

return number of rows

Parameters
[in]parentparent of current item
Returns
returns number of users

The documentation for this class was generated from the following files: