Merge remote-tracking branch 'origin/2.5'

This commit is contained in:
Eike Ziller
2012-04-04 16:20:10 +02:00
40 changed files with 218 additions and 65 deletions

View File

@@ -136,8 +136,8 @@ Project {
Depends { name: "app_version_header" }
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["gui", "network"] }
Depends { name: "utils" }
Depends { name: "extensionsystem" }
Depends { name: "Utils" }
Depends { name: "ExtensionSystem" }
files: [
"src/app/main.cpp",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
name: "botan"
destination: "lib"
QtcLibrary {
name: "Botan"
Depends { name: "cpp" }
Depends { name: "qt"; submodules: 'core' }

10
src/libs/QtcLibrary.qbs Normal file
View File

@@ -0,0 +1,10 @@
import qbs.base 1.0
DynamicLibrary {
destination: {
if (qbs.targetOS === "windows")
return "bin"
else
return "lib"
}
}

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
name: "aggregation"
destination: "lib"
QtcLibrary {
name: "Aggregation"
cpp.includePaths: [
".",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "CPlusPlus"
destination: "lib"
cpp.includePaths: [
".",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
name: "extensionsystem"
destination: "lib"
QtcLibrary {
name: "ExtensionSystem"
cpp.includePaths: [
".",
@@ -15,7 +15,7 @@ DynamicLibrary {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["core", "gui"] }
Depends { name: "aggregation" }
Depends { name: "Aggregation" }
files: [
"plugindetailsview.ui",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "GLSL"
destination: "lib"
cpp.includePaths: [
".",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "LanguageUtils"
destination: "lib"
cpp.includePaths: [
".",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "QmlEditorWidgets"
destination: "lib"
cpp.includePaths: [
".",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "QmlJS"
destination: "lib"
cpp.includePaths: [
".",
@@ -15,8 +15,8 @@ DynamicLibrary {
]
cpp.optimization: "fast"
Depends { name: "utils" }
Depends { name: "languageutils" }
Depends { name: "Utils" }
Depends { name: "LanguageUtils" }
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ['gui', 'script'] }

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "QmlJSDebugClient"
destination: "lib"
cpp.includePaths: [
".",

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "symbianutils"
destination: "lib"
cpp.includePaths: [
".",
@@ -21,7 +21,7 @@ DynamicLibrary {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["network"]}
Depends { name: "utils" }
Depends { name: "Utils" }
Group {
condition: qbs.targetOS == "linux" || qbs.targetOS == "mac"

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
name: "utils"
destination: "lib"
QtcLibrary {
name: "Utils"
cpp.defines: ["QTCREATOR_UTILS_LIB"]
cpp.includePaths: [ ".", "..",
@@ -19,7 +19,7 @@ DynamicLibrary {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ['gui', 'network', 'script'] }
Depends { name: "botan" }
Depends { name: "Botan" }
Depends { name: "app_version_header" }
files: [

View File

@@ -1,8 +1,8 @@
import qbs.base 1.0
import "../QtcLibrary.qbs" as QtcLibrary
DynamicLibrary {
QtcLibrary {
name: "zeroconf"
destination: "lib"
Depends { name: "cpp" }
Depends { name: "Qt.network" }

View File

@@ -4,6 +4,18 @@ import qbs.fileinfo 1.0 as FileInfo
Product {
type: ["dynamiclibrary", "pluginSpec"]
destination: "lib/qtcreator/plugins/Nokia"
targetName: {
// see PluginSpecPrivate::loadLibrary()
if (qbs.debugInformation) {
switch (qbs.targetOS) {
case "windows":
return name + "d";
case "mac":
return name + "_debug";
}
}
return name;
}
Depends { name: "pluginspec" }
Depends { name: 'cpp' }

View File

@@ -434,7 +434,7 @@ QString BaseFileWizard::descriptionImage() const
return d->m_parameters.descriptionImage();
}
void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QString &platform)
void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues)
{
QTC_ASSERT(!path.isEmpty(), return);
@@ -500,7 +500,7 @@ void BaseFileWizard::runWizard(const QString &path, QWidget *parent, const QStri
}
if (firstExtensionPageHit)
foreach (IFileWizardExtension *ex, extensions)
ex->firstExtensionPageShown(files);
ex->firstExtensionPageShown(files, extraValues);
if (accepted)
break;
}

View File

@@ -169,7 +169,7 @@ public:
virtual QString descriptionImage() const;
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform);
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues);
virtual Core::FeatureSet requiredFeatures() const;
virtual WizardFlags flags() const;

View File

@@ -5,10 +5,9 @@ QtcPlugin {
name: "Core"
Depends { name: "qt"; submodules: ['core', 'gui', 'xml', 'network', 'script', 'sql', 'help'] }
Depends { name: "utils" }
Depends { name: "extensionsystem" }
Depends { name: "aggregation" }
Depends { name: "pluginspec" }
Depends { name: "Utils" }
Depends { name: "ExtensionSystem" }
Depends { name: "Aggregation" }
cpp.includePaths: [
".",
@@ -240,9 +239,9 @@ QtcPlugin {
}
ProductModule {
Depends { name: "aggregation" }
Depends { name: "extensionsystem" }
Depends { name: "utils" }
Depends { name: "Aggregation" }
Depends { name: "ExtensionSystem" }
Depends { name: "Utils" }
cpp.includePaths: [
"../..",
"../../libs",

View File

@@ -37,6 +37,7 @@
#include <coreplugin/featureprovider.h>
#include <QObject>
#include <QVariantMap>
QT_BEGIN_NAMESPACE
class QIcon;
@@ -78,7 +79,7 @@ public:
virtual FeatureSet requiredFeatures() const = 0;
virtual WizardFlags flags() const = 0;
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform) = 0;
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &variables) = 0;
bool isAvailable(const QString &platformName) const;
QStringList supportedPlatforms() const;

View File

@@ -385,9 +385,10 @@ ICore::~ICore()
void ICore::showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards,
const QString &defaultLocation)
const QString &defaultLocation,
const QVariantMap &extraVariables)
{
m_mainwindow->showNewItemDialog(title, wizards, defaultLocation);
m_mainwindow->showNewItemDialog(title, wizards, defaultLocation, extraVariables);
}
bool ICore::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)

View File

@@ -81,7 +81,8 @@ public:
static void showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards,
const QString &defaultLocation = QString());
const QString &defaultLocation = QString(),
const QVariantMap &extraVariables = QVariantMap());
static bool showOptionsDialog(const QString &group = QString(),
const QString &page = QString(),

View File

@@ -37,6 +37,7 @@
#include <QObject>
#include <QList>
#include <QVariantMap>
QT_BEGIN_NAMESPACE
class QWizardPage;
@@ -71,8 +72,9 @@ public:
public slots:
/* Notification about the first extension page being shown. */
virtual void firstExtensionPageShown(const QList<GeneratedFile> &files) {
virtual void firstExtensionPageShown(const QList<GeneratedFile> &files, const QVariantMap &extraValues) {
Q_UNUSED(files)
Q_UNUSED(extraValues)
}
};

View File

@@ -966,7 +966,8 @@ void MainWindow::setFocusToEditor()
void MainWindow::showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards,
const QString &defaultLocation)
const QString &defaultLocation,
const QVariantMap &extraVariables)
{
// Scan for wizards matching the filter and pick one. Don't show
// dialog if there is only one.
@@ -1007,7 +1008,7 @@ void MainWindow::showNewItemDialog(const QString &title,
break;
}
}
wizard->runWizard(path, this, selectedPlatform);
wizard->runWizard(path, this, selectedPlatform, extraVariables);
}
bool MainWindow::showOptionsDialog(const QString &category,

View File

@@ -141,7 +141,8 @@ public slots:
void showNewItemDialog(const QString &title,
const QList<IWizard *> &wizards,
const QString &defaultLocation = QString());
const QString &defaultLocation = QString(),
const QVariantMap &extraVariables = QVariantMap());
bool showOptionsDialog(const QString &category = QString(),
const QString &page = QString(),

View File

@@ -805,7 +805,7 @@ void GdbEngine::interruptInferior()
qDebug() << "INTERRUPT INFERIOR: " << state(); return);
if (usesExecInterrupt()) {
postCommand("-exec-interrupt");
postCommand("-exec-interrupt", Immediate);
} else {
showStatusMessage(tr("Stop requested..."), 5000);
showMessage(_("TRYING TO INTERRUPT INFERIOR"));

View File

@@ -2577,10 +2577,12 @@ void ProjectExplorerPlugin::addNewFile()
QTC_ASSERT(d->m_currentNode, return)
QString location = directoryFor(d->m_currentNode);
QVariantMap map;
map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path());
Core::ICore::showNewItemDialog(tr("New File", "Title of dialog"),
Core::IWizard::wizardsOfKind(Core::IWizard::FileWizard)
+ Core::IWizard::wizardsOfKind(Core::IWizard::ClassWizard),
location);
location, map);
}
void ProjectExplorerPlugin::addNewSubproject()
@@ -2591,9 +2593,11 @@ void ProjectExplorerPlugin::addNewSubproject()
if (d->m_currentNode->nodeType() == ProjectNodeType
&& d->m_currentNode->projectNode()->supportedActions(
d->m_currentNode->projectNode()).contains(ProjectNode::AddSubProject)) {
QVariantMap map;
map.insert(QLatin1String(Constants::PREFERED_PROJECT_NODE), d->m_currentNode->projectNode()->path());
Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"),
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard),
location);
location, map);
}
}

View File

@@ -209,6 +209,9 @@ const char PROJECT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplore
const char IMPORT_WIZARD_CATEGORY[] = "T.Import";
const char IMPORT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplorer", "Import Project");
// Wizard extra values
const char PREFERED_PROJECT_NODE[] = "ProjectExplorer.PreferedProjectNode";
// Build step lists ids:
const char BUILDSTEPS_CLEAN[] = "ProjectExplorer.BuildSteps.Clean";
const char BUILDSTEPS_BUILD[] = "ProjectExplorer.BuildSteps.Build";

View File

@@ -231,15 +231,23 @@ static QList<ProjectEntry> findDeployProject(const QList<ProjectEntry> &projects
// the longest matching path (list containing"/project/subproject1" matching
// common path "/project/subproject1/newuserpath").
static int findMatchingProject(const QList<ProjectEntry> &projects,
const QString &commonPath)
const QString &commonPath,
const QString &preferedProjectNode)
{
if (projects.isEmpty() || commonPath.isEmpty())
return -1;
const int count = projects.size();
if (!preferedProjectNode.isEmpty()) {
for (int p = 0; p < count; ++p) {
if (projects.at(p).node->path() == preferedProjectNode)
return p;
}
}
int bestMatch = -1;
int bestMatchLength = 0;
bool bestMatchIsProFile = false;
const int count = projects.size();
for (int p = 0; p < count; p++) {
// Direct match or better match? (note that the wizards' files are native).
const ProjectEntry &entry = projects.at(p);
@@ -268,7 +276,8 @@ static QString generatedProjectFilePath(const QList<Core::GeneratedFile> &files)
}
void ProjectFileWizardExtension::firstExtensionPageShown(
const QList<Core::GeneratedFile> &files)
const QList<Core::GeneratedFile> &files,
const QVariantMap &extraValues)
{
initProjectChoices(generatedProjectFilePath(files));
@@ -302,7 +311,8 @@ void ProjectFileWizardExtension::firstExtensionPageShown(
m_context->page->setAdditionalInfo(text);
bestProjectIndex = -1;
} else {
bestProjectIndex = findMatchingProject(m_context->projects, m_context->commonDirectory);
bestProjectIndex = findMatchingProject(m_context->projects, m_context->commonDirectory,
extraValues.value(QLatin1String(Constants::PREFERED_PROJECT_NODE)).toString());
m_context->page->setNoneLabel(tr("<None>"));
}

View File

@@ -54,7 +54,7 @@ public:
void applyCodeStyle(Core::GeneratedFile *file) const;
public slots:
void firstExtensionPageShown(const QList<Core::GeneratedFile> &files);
void firstExtensionPageShown(const QList<Core::GeneratedFile> &files, const QVariantMap &extraValues);
void initializeVersionControlChoices();
private:

View File

@@ -83,9 +83,15 @@ bool SubdirsProjectWizard::postGenerateFiles(const QWizard *w, const Core::Gener
{
const SubdirsProjectWizardDialog *wizard = qobject_cast< const SubdirsProjectWizardDialog *>(w);
if (QtWizard::qt4ProjectPostGenerateFiles(wizard, files, errorMessage)) {
const QtProjectParameters params = wizard->parameters();
const QString projectPath = params.projectPath();
const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix());
QVariantMap map;
map.insert(QLatin1String(ProjectExplorer::Constants::PREFERED_PROJECT_NODE), profileName);
Core::ICore::showNewItemDialog(tr("New Subproject", "Title of dialog"),
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard),
wizard->parameters().projectPath());
wizard->parameters().projectPath(),
map);
} else {
return false;
}

View File

@@ -129,8 +129,9 @@ void BaseCheckoutWizard::setId(const QString &id)
d->id = id;
}
void BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent, const QString & /*platform*/)
void BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent, const QString & /*platform*/, const QVariantMap &extraValues)
{
Q_UNUSED(extraValues)
// Create dialog and launch
d->parameterPages = createParameterPages(path);
Internal::CheckoutWizardDialog dialog(d->parameterPages, parent);

View File

@@ -66,7 +66,7 @@ public:
virtual QString descriptionImage() const;
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform);
virtual void runWizard(const QString &path, QWidget *parent, const QString &platform, const QVariantMap &extraValues);
virtual Core::FeatureSet requiredFeatures() const;

View File

@@ -12,8 +12,15 @@ def __handleProcessExited__(object, exitCode):
processExited = True
def openQmakeProject(projectPath, targets=QtQuickConstants.Targets.DESKTOP):
cleanUpUserFiles(projectPath)
invokeMenuItem("File", "Open File or Project...")
selectFromFileDialog(projectPath)
try:
# handle update generated files dialog
waitForObject("{type='QMessageBox' unnamed='1' visible='1' windowTitle='Update of Generated Files'}", 3000)
clickButton(waitForObject("{text='Yes' type='QPushButton' unnamed='1' visible='1'}"))
except:
pass
selectFromCombo(waitForObject(":Qt Creator.Create Build Configurations:_QComboBox", 180000),
"For Each Qt Version One Debug And One Release")
__chooseTargets__(targets)

View File

@@ -34,3 +34,9 @@ def checkSyntaxError(issuesView, expectedTextsArray, warnIfMoreIssues = True):
return True
return False
# copy example project (sourceExample is path to project) to <temp>/template dir
def prepareTemplate(sourceExample):
templateDir = os.path.abspath(tempDir() + "/template")
shutil.copytree(sourceExample, templateDir)
return templateDir

View File

@@ -0,0 +1 @@
QT_PLATFORM_PLUGIN=nonesuch

View File

@@ -0,0 +1,13 @@
:Compile Output - Qt Creator_Core::Internal::OutputPaneToggleButton {occurrence='4' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Issues - Qt Creator_Core::Internal::OutputPaneToggleButton {occurrence='1' type='Core::Internal::OutputPaneToggleButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Compile Output_Core::OutputWindow {type='Core::OutputWindow' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Compile Output'}
:Qt Creator.Create Build Configurations:_QComboBox {leftWidget=':Qt Creator.Create Build Configurations:_QLabel' type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Create Build Configurations:_QLabel {text='Create build configurations:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.scrollArea_QScrollArea {name='scrollArea' type='QScrollArea' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1' windowTitle?='*Qt Creator'}
:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:scrollArea.Edit build configuration:_QComboBox {container=':Qt Creator.scrollArea_QScrollArea' leftWidget=':scrollArea.Edit build configuration:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:scrollArea.Edit build configuration:_QLabel {container=':Qt Creator.scrollArea_QScrollArea' text='Edit build configuration:' type='QLabel' unnamed='1' visible='1'}

View File

@@ -0,0 +1,10 @@
AUT=qtcreator
CLASS=
CLASSPATH=
ENVVARS=envvars
HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
TEST_CASES=tst_CCOM01 tst_CCOM02
VERSION=2
WRAPPERS=Qt

View File

@@ -0,0 +1,32 @@
source("../../shared/suites_qtta.py")
source("../../shared/qtcreator.py")
# entry of test
def main():
# prepare example project
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
if not neededFilePresent(sourceExample):
return
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = templateDir + "/propertyanimation.pro"
startApplication("qtcreator" + SettingsPath)
# open example project
openQmakeProject(examplePath)
# build and wait until finished - on all (except Qt 4.7.0 (would fail)) build configurations
for config in iterateBuildConfigs(1, 0, "(?!.*4\.7\.0.*)"):
selectBuildConfig(1, 0, config)
# try to build project
test.log("Testing build configuration: " + config)
invokeMenuItem("Build", "Build All")
waitForSignal("{type='ProjectExplorer::BuildManager' unnamed='1'}", "buildQueueFinished(bool)")
# verify build successful
ensureChecked(waitForObject(":Compile Output - Qt Creator_Core::Internal::OutputPaneToggleButton"))
compileOutput = waitForObject(":Qt Creator.Compile Output_Core::OutputWindow")
if not test.verify(str(compileOutput.plainText).endswith("exited normally."),
"Verifying building of existing complex qt application."):
test.log(compileOutput.plainText)
# exit
invokeMenuItem("File", "Exit")
# no cleanup needed, as whole testing directory gets properly removed after test finished

View File

@@ -0,0 +1,32 @@
source("../../shared/suites_qtta.py")
source("../../shared/qtcreator.py")
# entry of test
def main():
# prepare example project
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
if not neededFilePresent(sourceExample):
return
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = templateDir + "/propertyanimation.pro"
startApplication("qtcreator" + SettingsPath)
# open example project
openQmakeProject(examplePath)
# create syntax error
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.QML.qml.property-animation\\.qml", 5, 5, 0, Qt.LeftButton)
if not appendToLine(waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget"), "Image {", "SyntaxError"):
invokeMenuItem("File", "Exit")
return
# save all to invoke qml parsing
invokeMenuItem("File", "Save All")
# open issues list view
ensureChecked(waitForObject(":Issues - Qt Creator_Core::Internal::OutputPaneToggleButton"))
issuesView = waitForObject(":Qt Creator.Issues_QListView")
# verify that error is properly reported
test.verify(checkSyntaxError(issuesView, ["Syntax error"], True),
"Verifying QML syntax error while parsing complex qt quick application.")
# exit qt creator
invokeMenuItem("File", "Exit")
# no cleanup needed, as whole testing directory gets properly removed after test finished

View File

@@ -10,7 +10,7 @@ def main():
selectBuildConfig(1, 0, config)
test.log("Testing build configuration: " + config)
runAndCloseApp()
sendEvent("QCloseEvent", waitForObject(":Qt Creator_Core::Internal::MainWindow"))
invokeMenuItem("File", "Exit")
waitForCleanShutdown()
def init():