eric4.Utilities.Startup

Module implementing some startup helper funcions

Global Attributes

loaded_translators

Classes

None

Functions

handleArgs Function to handle the always present commandline options.
initializeResourceSearchPath Function to initialize the default mime source factory.
loadTranslatorForLocale Function to find and load a specific translation.
loadTranslators Function to load all required translations.
makeAppInfo Function to generate a dictionary describing the application.
simpleAppStartup Function to start up an application that doesn't need a specialized start up.
usage Function to show the usage information.
version Function to show the version information.


handleArgs

handleArgs(argv, appinfo)

Function to handle the always present commandline options.

argv
list of commandline parameters (list of strings)
appinfo
dictionary describing the application
Returns:
index of the '--' option (integer). This is used to tell the application, that all additional option don't belong to the application.
Up


initializeResourceSearchPath

initializeResourceSearchPath()

Function to initialize the default mime source factory.

Up


loadTranslatorForLocale

loadTranslatorForLocale(dirs, tn)

Function to find and load a specific translation.

dirs
Searchpath for the translations. (list of strings)
tn
The translation to be loaded. (string)
Returns:
Tuple of a status flag and the loaded translator. (int, QTranslator)
Up


loadTranslators

loadTranslators(qtTransDir, app, translationFiles = ())

Function to load all required translations.

qtTransDir
directory of the Qt translations files (string)
app
reference to the application object (QApplication)
translationFiles
tuple of additional translations to be loaded (tuple of strings)
Returns:
the requested locale (string)
Up


makeAppInfo

makeAppInfo(argv, name, arg, description, options = [])

Function to generate a dictionary describing the application.

argv
list of commandline parameters (list of strings)
name
name of the application (string)
arg
commandline arguments (string)
description
text describing the application (string)
options
list of additional commandline options (list of tuples of two strings (commandline option, option description)). The options --version, --help and -h are always present and must not be repeated in this list.
Returns:
dictionary describing the application
Up


simpleAppStartup

simpleAppStartup(argv, appinfo, mwFactory, kqOptions = [], quitOnLastWindowClosed = True)

Function to start up an application that doesn't need a specialized start up.

This function is used by all of eric4's helper programs.

argv
list of commandline parameters (list of strings)
appinfo
dictionary describing the application
mwFactory
factory function generating the main widget. This function must accept the following parameter.
argv
list of commandline parameters (list of strings)
kqOptions=
list of acceptable command line options. This is only used, if the application is running under KDE and pyKDE can be loaded successfully.
quitOnLastWindowClosed=
flag indicating to quit the application, if the last window was closed (boolean)
Up


usage

usage(appinfo, optlen = 12)

Function to show the usage information.

appinfo
dictionary describing the application
optlen
length of the field for the commandline option (integer)
Up


version

version(appinfo)

Function to show the version information.

appinfo
dictionary describing the application
Up