+ unify DLL export defines to namespace names

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2011-10-10 13:44:52 +00:00
commit 120ca87015
4155 changed files with 2965978 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
/***************************************************************************
* Copyright (c) 2010 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
#endif
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include "StartConfiguration.h"
extern struct PyMethodDef Start_methods[];
PyDoc_STRVAR(module_Start_doc,
"This module is the Start module.");
/* Python entry */
extern "C" {
void AppStartExport initStart()
{
Py_InitModule3("Start", Start_methods, module_Start_doc); /* mod name, table ptr */
Base::Console().Log("Loading Start module... done\n");
}
} // extern "C"

View File

@@ -0,0 +1,33 @@
/***************************************************************************
* Copyright (c) 2010 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
#endif
/* registration table */
struct PyMethodDef Start_methods[] = {
{NULL, NULL} /* end of table marker */
};

View File

@@ -0,0 +1,42 @@
include_directories(
${Boost_INCLUDE_DIRS}
${OCC_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)
set(Start_LIBS
FreeCADApp
)
SET(Start_SRCS
AppStart.cpp
AppStartPy.cpp
PreCompiled.cpp
PreCompiled.h
StartConfiguration.h
)
add_library(Start SHARED ${Start_SRCS})
target_link_libraries(Start ${Start_LIBS})
fc_copy_script("Mod/Start" "Start" Init.py)
if(MSVC)
set_target_properties(Start PROPERTIES SUFFIX ".pyd")
set_target_properties(Start PROPERTIES DEBUG_OUTPUT_NAME "Start_d")
set_target_properties(Start PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Mod/Start)
set_target_properties(Start PROPERTIES PREFIX "../")
elseif(MINGW)
set_target_properties(Start PROPERTIES SUFFIX ".pyd")
set_target_properties(Start PROPERTIES DEBUG_OUTPUT_NAME "Start_d")
set_target_properties(Start PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Mod/Start)
set_target_properties(Start PROPERTIES PREFIX "")
else(MSVC)
set_target_properties(Start PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Mod/Start)
set_target_properties(Start PROPERTIES PREFIX "")
endif(MSVC)
install(TARGETS Start DESTINATION lib)

View File

@@ -0,0 +1,46 @@
lib_LTLIBRARIES=libStart.la Start.la
libStart_la_SOURCES=\
AppStartPy.cpp \
StartConfiguration.h \
PreCompiled.cpp \
PreCompiled.h
# the library search path.
libStart_la_LDFLAGS = -L../../../Base -L../../../App $(all_libraries) -version-info \
@LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@
libStart_la_CPPFLAGS = -DStartAppExport=
libStart_la_LIBADD = \
@BOOST_REGEX_LIB@ @BOOST_SYSTEM_LIB@ \
-l@PYTHON_LIB@ \
-lxerces-c \
-lFreeCADBase \
-lFreeCADApp
#--------------------------------------------------------------------------------------
# Loader of libStart
Start_la_SOURCES=\
AppStart.cpp
# the library search path.
Start_la_LDFLAGS = $(libStart_la_LDFLAGS) -module -avoid-version
Start_la_CPPFLAGS = $(libStart_la_CPPFLAGS)
Start_la_LIBADD = \
$(libStart_la_LIBADD) \
-lStart
Start_la_DEPENDENCIES = libStart.la
#--------------------------------------------------------------------------------------
# set the include path found by configure
AM_CXXFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src $(all_includes)
libdir = $(prefix)/Mod/Start
EXTRA_DIST = \
CMakeLists.txt

View File

@@ -0,0 +1,24 @@
/***************************************************************************
* Copyright (c) 2010 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"

View File

@@ -0,0 +1,58 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef START_PRECOMPILED_H
#define START_PRECOMPILED_H
#include <FCConfig.h>
// Exporting of App classes
#ifdef FC_OS_WIN32
# define AppStartExport __declspec(dllexport)
# define PartExport __declspec(dllimport)
# define MeshExport __declspec(dllimport)
#else // for Linux
# define AppStartExport
# define PartExport
# define MeshExport
#endif
#ifdef _PreComp_
// standard
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <assert.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <bitset>
#include <Python.h>
#endif // _PreComp_
#endif

View File

@@ -0,0 +1,41 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef START_CONFIGURATION_H
#define START_CONFIGURATION_H
#include <FCConfig.h>
// Exporting of App classes
#ifdef FC_OS_WIN32
# define START_SHOW_SKETCHER
# define START_USE_DRAFTING
#else // for Linux
# define START_USE_DRAFTING
#endif
#endif

View File

@@ -0,0 +1,13 @@
add_subdirectory(App)
if(FREECAD_BUILD_GUI)
add_subdirectory(Gui)
endif(FREECAD_BUILD_GUI)
install(
FILES
Init.py
InitGui.py
DESTINATION
Mod/Start
)

View File

@@ -0,0 +1,95 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
#endif
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include <Gui/Application.h>
#include <Gui/WorkbenchManager.h>
#include <Gui/Language/Translator.h>
#include "Workbench.h"
#include <Mod/Start/App/StartConfiguration.h>
// use a different name to CreateCommand()
void CreateStartCommands(void);
void loadStartResource()
{
// add resources and reloads the translators
Q_INIT_RESOURCE(Start);
Gui::Translator::instance()->refresh();
}
/* registration table */
extern struct PyMethodDef StartGui_Import_methods[];
/* Python entry */
extern "C" {
void StartGuiExport initStartGui()
{
if (!Gui::Application::Instance) {
PyErr_SetString(PyExc_ImportError, "Cannot load Gui module in console application.");
return;
}
// load dependent module
try {
Base::Interpreter().runString("import WebGui");
}
catch(const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
return;
}
catch (Py::Exception& e) {
Py::Object o = Py::type(e);
if (o.isString()) {
Py::String s(o);
Base::Console().Error("%s\n", s.as_std_string().c_str());
}
else {
Py::String s(o.repr());
Base::Console().Error("%s\n", s.as_std_string().c_str());
}
// Prints message to console window if we are in interactive mode
PyErr_Print();
}
(void) Py_InitModule("StartGui", StartGui_Import_methods); /* mod name, table ptr */
Base::Console().Log("Loading GUI of Start module... done\n");
// instantiating the commands
CreateStartCommands();
StartGui::Workbench::init();
// add resources and reloads the translators
loadStartResource();
}
} // extern "C" {

View File

@@ -0,0 +1,33 @@
/***************************************************************************
* Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Python.h>
#endif
/* registration table */
struct PyMethodDef StartGui_Import_methods[] = {
{NULL, NULL} /* end of table marker */
};

View File

@@ -0,0 +1,75 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${COIN3D_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${SOQT_INCLUDE_DIR}
${PYTHON_INCLUDE_PATH}
${XERCESC_INCLUDE_DIR}
)
set(StartGui_LIBS
Start
FreeCADGui
)
qt4_add_resources(Start_QRC_SRCS Resources/Start.qrc)
SET(StartGui_SRCS
${Start_QRC_SRCS}
AppStartGui.cpp
AppStartGuiPy.cpp
Command.cpp
PreCompiled.cpp
PreCompiled.h
Workbench.cpp
Workbench.h
)
SET(StartPage_Resources
StartPage/StartPage.py
StartPage/PartDesign.py
StartPage/ArchDesign.py
StartPage/DefaultWorkbench.py
StartPage/Mesh.py
StartPage/LoadSchenkel.py
StartPage/LoadPartDesignExample.py
StartPage/LoadDrawingExample.py
StartPage/LoadRobotExample.py
StartPage/Background.jpg
StartPage/__init__.py
StartPage/FreeCAD.png
StartPage/ArchDesign.png
StartPage/PartDesign.png
StartPage/Mesh.png
StartPage/Complete.png
StartPage/LoadMRU0.py
StartPage/LoadMRU1.py
StartPage/LoadMRU2.py
StartPage/PartDesignExample.png
StartPage/ArchExample.png
StartPage/web.png
)
add_library(StartGui SHARED ${StartGui_SRCS})
target_link_libraries(StartGui ${StartGui_LIBS})
fc_copy_script("Mod/Start" "StartGui" InitGui.py)
fc_copy_script("Mod/Start" "StartGui" ${StartPage_Resources})
if(MSVC)
set_target_properties(StartGui PROPERTIES SUFFIX ".pyd")
set_target_properties(StartGui PROPERTIES DEBUG_OUTPUT_NAME "StartGui_d")
set_target_properties(StartGui PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Mod/Start)
set_target_properties(StartGui PROPERTIES PREFIX "../")
elseif(MINGW)
set_target_properties(StartGui PROPERTIES SUFFIX ".pyd")
set_target_properties(StartGui PROPERTIES DEBUG_OUTPUT_NAME "StartGui_d")
set_target_properties(StartGui PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Mod/Start)
set_target_properties(StartGui PROPERTIES PREFIX "")
else(MSVC)
set_target_properties(StartGui PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Mod/Start)
set_target_properties(StartGui PROPERTIES PREFIX "")
endif(MSVC)
install(TARGETS StartGui DESTINATION lib)

View File

@@ -0,0 +1,65 @@
/***************************************************************************
* Copyright (c) 2010 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include <Gui/Application.h>
#include <Gui/Command.h>
#include <Gui/MainWindow.h>
#include <Gui/FileDialog.h>
using namespace std;
DEF_STD_CMD(CmdStartConstraintAxle);
CmdStartConstraintAxle::CmdStartConstraintAxle()
:Command("Start_ConstraintAxle")
{
sAppModule = "Start";
sGroup = QT_TR_NOOP("Start");
sMenuText = QT_TR_NOOP("Constraint Axle...");
sToolTipText = QT_TR_NOOP("set a axle constraint between two objects");
sWhatsThis = sToolTipText;
sStatusTip = sToolTipText;
sPixmap = "actions/document-new";
}
void CmdStartConstraintAxle::activated(int iMsg)
{
// load the file with the module
//Command::doCommand(Command::Gui, "import Start, StartGui");
}
void CreateStartCommands(void)
{
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.addCommand(new CmdStartConstraintAxle());
}

View File

@@ -0,0 +1,71 @@
SUBDIRS=Resources
lib_LTLIBRARIES=libStartGui.la StartGui.la
libStartGui_la_SOURCES=\
AppStartGuiPy.cpp \
Command.cpp \
PreCompiled.cpp \
PreCompiled.h \
Workbench.cpp \
Workbench.h
# the library search path.
libStartGui_la_LDFLAGS = -L../../../Base -L../../../App -L../../../Gui -L../App $(QT_LIBS) $(GL_LIBS) \
$(all_libraries) -version-info @LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@
libStartGui_la_CPPFLAGS = -DStartAppExport= -DStartGuiExport=
libStartGui_la_LIBADD = \
@BOOST_SYSTEM_LIB@ \
-l@PYTHON_LIB@ \
-lxerces-c \
-lFreeCADBase \
-lFreeCADApp \
-lFreeCADGui \
-lStart
#--------------------------------------------------------------------------------------
# Loader of libStartGui
StartGui_la_SOURCES=\
AppStartGui.cpp
# the library search path.
StartGui_la_LDFLAGS = $(libStartGui_la_LDFLAGS) -module -avoid-version
StartGui_la_CPPFLAGS = $(libStartGui_la_CPPFLAGS)
StartGui_la_LIBADD = \
$(libStartGui_la_LIBADD) \
Resources/libResources.la \
-lStartGui
StartGui_la_DEPENDENCIES = libStartGui.la
#--------------------------------------------------------------------------------------
# rule for Qt MetaObject Compiler:
moc_%.cpp: %.h
$(QT_MOC) $< -o $(@F)
# rule for Qt MetaObject Compiler:
%.moc: %.h
$(QT_MOC) $< -o $(@F)
# rules for Qt User Interface Compiler:
ui_%.h: %.ui
$(QT_UIC) $< -o $(@F)
# rules for Qt Resource Compiler:
qrc_%.cpp: %.qrc
$(QT_RCC) -name $(*F) $< -o $(@F)
# set the include path found by configure
AM_CXXFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src $(QT_CXXFLAGS) $(all_includes)
libdir = $(prefix)/Mod/Start
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = \
CMakeLists.txt

View File

@@ -0,0 +1,24 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"

View File

@@ -0,0 +1,72 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel (juergen.riegel@web.de) *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef STARTGUI_PRECOMPILED_H
#define STARTGUI_PRECOMPILED_H
#include <FCConfig.h>
// Importing of App classes
#ifdef FC_OS_WIN32
# define StartAppExport __declspec(dllimport)
# define StartGuiExport __declspec(dllexport)
#else // for Linux
# define StartAppExport
# define StartGuiExport
#endif
#ifdef _PreComp_
// Python
#include <Python.h>
// standard
#include <iostream>
#include <assert.h>
#include <math.h>
// STL
#include <vector>
#include <map>
#include <string>
#include <list>
#include <set>
#include <algorithm>
#include <stack>
#include <queue>
#include <bitset>
#ifdef FC_OS_WIN32
# include <windows.h>
#endif
// Qt Toolkit
#ifndef __Qt4All__
# include <Gui/Qt4All.h>
#endif
#endif //_PreComp_
#endif // STARTGUI_PRECOMPILED_H

View File

@@ -0,0 +1,30 @@
noinst_LTLIBRARIES=libResources.la
BUILT_SOURCES=\
qrc_Start.cpp
nodist_libResources_la_SOURCES=\
qrc_Start.cpp
EXTRA_DIST = \
Start.qrc \
UpdateResources.bat
# rule for Qt MetaObject Compiler:
moc_%.cpp: %.h
$(QT_MOC) $< -o $(@F)
# rule for Qt MetaObject Compiler:
%.moc: %.h
$(QT_MOC) $< -o $(@F)
# rules for Qt Resource Compiler:
qrc_%.cpp: %.qrc
$(QT_RCC) -name $(*F) $< -o $(@F)
# set the include path found by configure
AM_CXXFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -I$(srcdir)/.. $(QT_CXXFLAGS) $(all_includes)
CLEANFILES = $(BUILT_SOURCES)

View File

@@ -0,0 +1,4 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
</qresource>
</RCC>

View File

@@ -0,0 +1,2 @@
python ..\..\..\..\Tools\dir2qrc.py -v -o Start.qrc
@pause

View File

@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS><TS version="1.1">
<context>
<name>StartPage</name>
<message>
<location filename="StartPage.py" line="6"/>
<source>FreeCAD Start Center</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="7"/>
<source>Start a new project</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="8"/>
<source>Recent Files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="9"/>
<source>Demos</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="10"/>
<source>Tutorials</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="11"/>
<source>Homepage</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="12"/>
<source>This is the FreeCAD Homepage. Here you will be able to find a lot of information about FreeCAD, tutorials, examples and user documentation.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="13"/>
<source>FreeCAD Homepage</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="14"/>
<source>Example projects</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="15"/>
<source>Schenkel STEP file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="16"/>
<source>Load a PartDesign example</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="17"/>
<source>Load a Drawing extraction</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="18"/>
<source>Load a Robot simulation example</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="19"/>
<source>Projects from the Web</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="20"/>
<source>Schenkel STEP</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="21"/>
<source>Complex Part</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="22"/>
<source>Close this window after opening or creating a file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="23"/>
<source>Don&apos;t show me this window again next time</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="24"/>
<source>Designing parts</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="25"/>
<source>The &lt;b&gt;Part Design&lt;/b&gt; workbench is designed to create complex pieces based on constrained 2D sketches. Use it to draw 2D shapes, constrain some of their elements and extrude them to form 3D pieces.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="26"/>
<source>Example workflow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="27"/>
<source>Part Design</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="28"/>
<source>Designing architectural elements</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="29"/>
<source>The &lt;b&gt;Architectural Design&lt;/b&gt; workbench is specially designed for working with architectural elements such as walls or windows. Start by drawing 2D shapes, and use them as guides to build architecutral objects.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="30"/>
<source>Architectual Design</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="31"/>
<source>Working with Meshes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="32"/>
<source>The &lt;b&gt;Mesh Workbench&lt;/b&gt; is used to work with Mesh objects. Meshes are simpler 3D objects than Part objects, but they are often easier to import and export to/from other applications.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="33"/>
<source>FreeCAD offers you several tools to convert between Mesh and Part objects.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="34"/>
<source>Work with Meshes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="35"/>
<source>The complete workbench</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="36"/>
<source>FreeCAD default workbench</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="38"/>
<source>file size:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="39"/>
<source>creation time:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="40"/>
<source>last modified:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="StartPage.py" line="37"/>
<source>populated with some of the most commonly used tools.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@@ -0,0 +1,120 @@
/***************************************************************************
* Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <qobject.h>
#endif
#include "Workbench.h"
#include <Gui/ToolBarManager.h>
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
#include <Gui/DockWindowManager.h>
#include <Gui/Application.h>
#include <Gui/Action.h>
#include <Gui/Command.h>
#include <Gui/Selection.h>
#include <Gui/ToolBoxManager.h>
#include <App/Document.h>
#include <App/DocumentObject.h>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Mod/Start/App/StartConfiguration.h>
using namespace StartGui;
TYPESYSTEM_SOURCE(StartGui::Workbench, Gui::StdWorkbench)
StartGui::Workbench::Workbench()
{
}
StartGui::Workbench::~Workbench()
{
}
void StartGui::Workbench::activated()
{
try {
Gui::Command::doCommand(Gui::Command::Gui,"import WebGui");
Gui::Command::doCommand(Gui::Command::Gui,"from StartPage import StartPage");
#if defined(FC_OS_WIN32)
Gui::Command::doCommand(Gui::Command::Gui,"WebGui.openBrowserHTML"
"(StartPage.handle(),App.getResourceDir() + 'Mod/Start/StartPage/','Start page')");
#else
Gui::Command::doCommand(Gui::Command::Gui,"WebGui.openBrowserHTML"
"(StartPage.handle(),'file://' + App.getResourceDir() + 'Mod/Start/StartPage/','Start page')");
#endif
}
catch (const Base::Exception& e) {
Base::Console().Error("%s\n", e.what());
}
}
void StartGui::Workbench::setupContextMenu(const char* recipient,Gui::MenuItem* item) const
{
}
Gui::MenuItem* StartGui::Workbench::setupMenuBar() const
{
return Gui::StdWorkbench::setupMenuBar();
}
Gui::ToolBarItem* StartGui::Workbench::setupToolBars() const
{
Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
// web navigation toolbar
Gui::ToolBarItem* navigation = new Gui::ToolBarItem(root);
navigation->setCommand("Navigation");
*navigation << "Web_OpenWebsite"
<< "Separator"
<< "Web_BrowserBack"
<< "Web_BrowserNext"
<< "Web_BrowserRefresh"
<< "Web_BrowserStop"
<< "Separator"
<< "Web_BrowserZoomIn"
<< "Web_BrowserZoomOut";
return root;
}
Gui::ToolBarItem* StartGui::Workbench::setupCommandBars() const
{
Gui::ToolBarItem* root = new Gui::ToolBarItem;
return root;
}
Gui::DockWindowItems* StartGui::Workbench::setupDockWindows() const
{
Gui::DockWindowItems* root = Gui::StdWorkbench::setupDockWindows();
root->setVisibility(false); // hide all dock windows by default
root->setVisibility("Std_CombiView",true); // except of the combi view
return root;
}

View File

@@ -0,0 +1,60 @@
/***************************************************************************
* Copyright (c) 2008 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef STARTGUI_WORKBENCH_H
#define STARTGUI_WORKBENCH_H
#include <Gui/Workbench.h>
namespace StartGui {
/**
* @author Werner Mayer
*/
class StartGuiExport Workbench : public Gui::StdWorkbench
{
TYPESYSTEM_HEADER();
public:
Workbench();
virtual ~Workbench();
/** Defines the standard context menu. */
virtual void setupContextMenu(const char* recipient,Gui::MenuItem*) const;
/** Run some actions when the workbench gets activated. */
virtual void activated();
protected:
/** Defines the standard menus. */
virtual Gui::MenuItem* setupMenuBar() const;
/** Defines the standard toolbars. */
virtual Gui::ToolBarItem* setupToolBars() const;
/** Defines the standard command bars. */
virtual Gui::ToolBarItem* setupCommandBars() const;
/** Returns a DockWindowItems structure of dock windows this workbench. */
virtual Gui::DockWindowItems* setupDockWindows() const;
}; // namespace StartGui
}
#endif // START_WORKBENCH_H

47
src/Mod/Start/Init.py Normal file
View File

@@ -0,0 +1,47 @@
# FreeCAD init script of the Start module
# (c) 2001 Juergen Riegel
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* FreeCAD is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
class StartDocument:
"Start document"
def Info(self):
return "Start document"
# Get the Parameter Group of this module
ParGrp = App.ParamGet("System parameter:Modules").GetGroup("Start")
# Set the needed information
ParGrp.SetString("HelpIndex", "Start/Help/index.html")
ParGrp.SetString("DocTemplateName", "Start")
ParGrp.SetString("DocTemplateScript","TemplStart.py")
ParGrp.SetString("WorkBenchName", "Start Design")
ParGrp.SetString("WorkBenchModule", "StartWorkbench.py")
#FreeCAD.EndingAdd("CAD formats (*.igs *.iges *.step *.stp *.brep *.brp)","Start")

76
src/Mod/Start/InitGui.py Normal file
View File

@@ -0,0 +1,76 @@
# Start gui init module
# (c) 2003 Juergen Riegel
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU General Public License (GPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* FreeCAD is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#* Juergen Riegel 2002 *
#***************************************************************************/
class StartWorkbench ( Workbench ):
"Start workbench object"
Icon = """
/* XPM */
static char * start_xpm[] = {
"16 16 9 1",
" c None",
". c #000200",
"+ c #081938",
"@ c #113155",
"# c #1133A0",
"$ c #1D56DC",
"% c #2161A8",
"& c #2670EB",
"* c #2C86F2",
" ",
" . ",
" #+ ",
" .#$+ ",
" .#$&+ ",
" ####$$$&&&+ ",
" .#$$$$$&&&&*@ ",
" .#$$$$&&&&***@ ",
" .#$$$&&&&***% ",
" .#$$&&&&***% ",
" .++++++%**% ",
" .%*@ ",
" .%@ ",
" .. ",
" ",
" "};
"""
MenuText = "Start"
ToolTip = "Start workbench"
def Initialize(self):
# load the module
import StartGui
import Start
def GetClassName(self):
return "StartGui::Workbench"
Gui.addWorkbench(StartWorkbench())

11
src/Mod/Start/Makefile.am Normal file
View File

@@ -0,0 +1,11 @@
SUBDIRS=App Gui StartPage
# Change data dir from default ($(prefix)/share) to $(prefix)
datadir = $(prefix)/Mod/Start
data_DATA = Init.py InitGui.py
EXTRA_DIST = \
$(data_DATA) \
CMakeLists.txt \
start.dox

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

View File

@@ -0,0 +1,3 @@
import FreeCADGui
FreeCADGui.activateWorkbench("ArchWorkbench")
App.newDocument()

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

View File

@@ -0,0 +1,5 @@
import FreeCAD, FreeCADGui
workbench = FreeCAD.ConfigGet("DefaultWorkbench")
if not workbench: workbench = "CompleteWorkbench"
FreeCADGui.activateWorkbench(workbench)
App.newDocument()

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,5 @@
import FreeCAD,FreeCADGui
FreeCADGui.activateWorkbench("DrawingWorkbench")
FreeCAD.open(FreeCAD.getResourceDir()+"data/examples/DrawingExample.FCStd")
FreeCADGui.SendMsgToActiveView("ViewFit")
FreeCADGui.activeDocument().activeView().viewAxometric()

View File

@@ -0,0 +1,3 @@
import FreeCAD,FreeCADGui,sys
rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles")
FreeCAD.loadFile(rf.GetString("MRU0"))

View File

@@ -0,0 +1,3 @@
import FreeCAD,FreeCADGui,sys
rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles")
FreeCAD.loadFile(rf.GetString("MRU1"))

View File

@@ -0,0 +1,4 @@
import FreeCAD,FreeCADGui,sys
rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles")
FreeCAD.loadFile(rf.GetString("MRU2"))

View File

@@ -0,0 +1,4 @@
import FreeCAD,FreeCADGui
FreeCAD.open(FreeCAD.getResourceDir()+"data/examples/PartDesignExample.FCStd")
FreeCADGui.SendMsgToActiveView("ViewFit")
FreeCADGui.activeDocument().activeView().viewAxometric()

View File

@@ -0,0 +1,4 @@
import FreeCAD,FreeCADGui
FreeCAD.open(FreeCAD.getResourceDir()+"data/examples/RobotExample.FCStd")
FreeCADGui.SendMsgToActiveView("ViewFit")
FreeCADGui.activeDocument().activeView().viewAxometric()

View File

@@ -0,0 +1,4 @@
import FreeCAD,FreeCADGui,Part
Part.open(FreeCAD.getResourceDir()+"data/examples/Schenkel.stp")
FreeCADGui.SendMsgToActiveView("ViewFit")
Gui.activeDocument().activeView().viewAxometric()

View File

@@ -0,0 +1,35 @@
# Change data dir from default ($(prefix)/share) to $(prefix)
pythondir = $(prefix)/Mod/Start/StartPage
datadir = @datadir@/Mod/Start/StartPage
# Only these two scripts must be here!
python_DATA = \
StartPage.py \
__init__.py
data_DATA = \
ArchDesign.py \
DefaultWorkbench.py \
LoadDrawingExample.py \
LoadPartDesignExample.py \
LoadRobotExample.py \
LoadSchenkel.py \
LoadMRU0.py \
LoadMRU1.py \
LoadMRU2.py \
Mesh.py \
PartDesign.py \
Background.jpg \
FreeCAD.png \
PartDesign.png \
ArchDesign.png \
Mesh.png \
Complete.png \
PartDesignExample.png \
ArchExample.png \
web.png
EXTRA_DIST = \
$(data_DATA) $(python_DATA)

BIN
src/Mod/Start/StartPage/Mesh.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

View File

@@ -0,0 +1,3 @@
import FreeCADGui
FreeCADGui.activateWorkbench("MeshWorkbench")
App.newDocument()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,3 @@
import FreeCADGui
FreeCADGui.activateWorkbench("PartDesignWorkbench")
App.newDocument()

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -0,0 +1,156 @@
<html>
<head>
<title>FreeCAD - Start page</title>
<script language="javascript">
function show(theText) {
ddiv = document.getElementById("description");
if (theText == "") theText = "&nbsp;";
ddiv.innerHTML = theText;
}
</script>
<style type="text/css">
body {
background: #171A2B url(Background.jpg);
color: white;
font-family: Arial, Helvetica, Sans;
}
a {
color: #0092E8;
font-weight: bold;
text-decoration: none;
padding: 2px;
}
a:hover {
color: white;
background: #0092E8;
border-radius: 5px;
}
p {
text-align: justify;
}
h1 {
font-size: 3em;
letter-spacing: 2px;
padding: 20px 0 0 80px;
}
h2 {
padding-left: 40px;
font-size: 1.2em;
}
ul {
list-style-type: none;
}
.column {
width: 340px;
float: left;
margin-left: 10px;
}
.block {
background: rgba(30,31,33,0.6);;
border-radius: 5px;
padding: 8px;
margin-bottom: 10px;
}
.options {
clear: both;
}
</style>
</head>
<body>
<h1>FreeCAD Start Center</h1>
<div class="column">
<div class="block">
<h2>Start a new project</h2>
<ul>
<li><a onMouseover="show('<p>The <b>Part Design</b> workbench is designed \
to create complex pieces based on constrained 2D sketches. \
Use it to draw 2D shapes, constrain some of their elements \
and extrude them to form 3D pieces.</p>')"
onMouseout="show('')"
href="PartDesign.py">Part Design</a></li>
<li><a onMouseover="show('<p>The <b>Architectural Design</b> workbench \
is specially designed for working with architectural \
elements such as walls or windows. Start by drawing \
2D shapes, and use them as guides to build architecutral \
objects.</p>')"
onMouseout="show('')"
href="ArchDesign.py">Architectual Design</a></li>
<li><a onMouseover="show('<p>The <b>Mesh Workbench</b> is used to work with \
Mesh objects. Meshes are simpler 3D objects than Part objects, \
but they are often easier to import and export to/from other \
applications.</p><p>FreeCAD offers you several tools to convert \
between Mesh and Part objects.</p>')"
onMouseout="show('')"
href="Mesh.py">Work with Meshes</a></li>
<li><a onMouseover="show('<p>This is the <b>FreeCAD default workbench</b>, \
populated with some of the most commonly used tools.</p>')"
onMouseout="show('')"
href="Complete.py">The Default Workbench</a></li>
</ul>
</div>
<div class="block">
<h2>Recent Files</h2>
</div>
<div class="block">
<h2>Demos</h2>
</div>
<div class="block">
<h2>Tutorials</h2>
</div>
</div>
<div class="column">
<div class="block">
<h2>Homepage</h2>
<ul>
<li><a onMouseover="show('<p>This is the FreeCAD Homepage. Here you will be \
able to find a lot of information about FreeCAD, tutorials, \
examples and user documentation.</p>')"
onMouseout="show('')"
href="http://free-cad.sf.net/">FreeCAD Homepage</a></li>
</ul>
</div>
<div class="block">
<h2>Example projects</h2>
<ul>
<li><a href="LoadSchenkel.py">Schenkel STEP file</a></li>
<li><a href="LoadPartDesignExample.py">Load a PartDesign example</a></li>
<li><a href="LoadDrawingExample.py">Load a Drawing extraction</a></li>
<li><a href="LoadRobotExample.py">Load a Robot simulation example</a></li>
</ul>
</div>
<div class="block">
<h2>Projects from the Web</h2>
<ul>
<li><a href="http://freecad-project.de/svn/ExampleData/FileFormates/Schenkel.stp">Schenkel STEP</a></li>
<li><a href="http://freecad-project.de/svn/ExampleData/Examples/CAD/Complex.FCStd">Complex Part</a></li>
</ul>
</div>
</div>
<div class="column" id="description">
&nbsp;
</div>
<form class="options">
<input type="checkbox" name="closeThisDialog">
Close this window after opening or creating a file<br/>
<input type="checkbox" name="dontShowAgain">
Don't show me this window again next time
</form>
</body>
</html>

View File

@@ -0,0 +1,473 @@
import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re
from PyQt4 import QtGui
from xml.etree.ElementTree import parse
def translate(context,text):
"convenience function for the Qt translator"
return str(QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).toUtf8())
# texts to be translated
text01 = translate("StartPage","FreeCAD Start Center")
text02 = translate("StartPage","Start a new project")
text03 = translate("StartPage","Recent Files")
text04 = translate("StartPage","Latest videos")
text05 = translate("StartPage","Latest news")
text06 = translate("StartPage","On the web")
text07 = translate("StartPage","This is the FreeCAD Homepage. Here you will be able to find a lot of information about FreeCAD, including tutorials, examples and user documentation.")
text08 = translate("StartPage","FreeCAD Homepage")
text09 = translate("StartPage","Example projects")
text10 = translate("StartPage","Schenkel STEP file")
text11 = translate("StartPage","Load a PartDesign example")
text12 = translate("StartPage","Load a Drawing extraction")
text13 = translate("StartPage","Load a Robot simulation example")
text14 = translate("StartPage","Projects from the Web")
text15 = translate("StartPage","Schenkel STEP")
text16 = translate("StartPage","Complex Part")
text17 = translate("StartPage","Close this window after opening or creating a file")
text18 = translate("StartPage","Don't show me this window again next time")
text19 = translate("StartPage","Designing parts")
text20 = translate("StartPage","The <b>Part Design</b> workbench is designed to create complex pieces based on constrained 2D sketches. Use it to draw 2D shapes, constrain some of their elements and extrude them to form 3D pieces.")
text21 = translate("StartPage","Example workflow")
text22 = translate("StartPage","Part Design")
text23 = translate("StartPage","Designing architectural elements")
text24 = translate("StartPage","The <b>Architectural Design</b> workbench is specially designed for working with architectural elements such as walls or windows. Start by drawing 2D shapes, and use them as guides to build architecutral objects.")
text25 = translate("StartPage","Architectual Design")
text26 = translate("StartPage","Working with Meshes")
text27 = translate("StartPage","The <b>Mesh Workbench</b> is used to work with Mesh objects. Meshes are simpler 3D objects than Part objects, but they are often easier to import and export to/from other applications.")
text28 = translate("StartPage","FreeCAD offers you several tools to convert between Mesh and Part objects.")
text29 = translate("StartPage","Work with Meshes")
text30 = translate("StartPage","The complete workbench")
text31 = translate("StartPage","FreeCAD default workbench")
text32 = translate("StartPage","populated with some of the most commonly used tools.")
text33 = translate("StartPage","file size:")
text34 = translate("StartPage","creation time:")
text35 = translate("StartPage","last modified:")
text36 = translate("StartPage","location:")
text37 = translate("StartPage","User manual")
text38 = translate("StartPage","http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Online_Help_Toc")
text39 = translate("StartPage","Tutorials")
text40 = translate("StartPage","Python resources")
text41 = translate("StartPage","File not found")
text42 = translate("StartPage","from <a href=http://twitter.com/FreeCADNews>@FreeCADNews</a>")
text43 = translate("StartPage","The FreeCAD-tutorial blog")
text44 = translate("StartPage","from <a href=http://www.youtube.com/user/FreeCADNews?feature=mhee>FreeCADNews channel</a>")
text45 = translate("StartPage","This is the official user manual of FreeCAD, built, maintained and translated by the FreeCAD community.")
text46 = translate("StartPage","The tutorials section on the FreeCAD website")
text47 = translate("StartPage","The section of the FreeCAd website dedicate dto python scripting, with examples, explanations, and API commands.")
text48 = translate("StartPage","A blog dedicated to teaching FreeCAD, maintained by members of the FreeCAD community")
# here is the html page skeleton
page = """
<html>
<head>
<title>FreeCAD - Start page</title>
<script language="javascript">
function JSONscriptRequest(fullUrl) {
// REST request path
this.fullUrl = fullUrl;
// Get the DOM location to put the script tag
this.headLoc = document.getElementsByTagName("head").item(0);
// Generate a unique script tag id
this.scriptId = 'JscriptId' + JSONscriptRequest.scriptCounter++;
}
// Static script ID counter
JSONscriptRequest.scriptCounter = 1;
JSONscriptRequest.prototype.buildScriptTag = function () {
// Create the script tag
this.scriptObj = document.createElement("script");
// Add script object attributes
this.scriptObj.setAttribute("type", "text/javascript");
this.scriptObj.setAttribute("charset", "utf-8");
this.scriptObj.setAttribute("src", this.fullUrl);
this.scriptObj.setAttribute("id", this.scriptId);
}
JSONscriptRequest.prototype.removeScriptTag = function () {
// Destroy the script tag
this.headLoc.removeChild(this.scriptObj);
}
JSONscriptRequest.prototype.addScriptTag = function () {
// Create the script tag
this.headLoc.appendChild(this.scriptObj);
}
function show(theText) {
ddiv = document.getElementById("description");
if (theText == "") theText = "&nbsp;";
ddiv.innerHTML = theText;
}
function loadFeeds() {
ddiv = document.getElementById("youtube");
ddiv.innerHTML = "Fetching data from the web...";
var obj=new JSONscriptRequest('http://gdata.youtube.com/feeds/base/users/FreeCADNews/favorites?alt=json-in-script&v=2&orderby=published&callback=showLinks');
obj.buildScriptTag(); // Build the script tag
obj.addScriptTag(); // Execute (add) the script tag
ddiv.innerHTML = "Done fetching";
ddiv = document.getElementById("news");
ddiv.innerHTML = "Fetching data from the web...";
var tobj=new JSONscriptRequest('http://twitter.com/status/user_timeline/FreeCADNews.json?count=10&callback=showTweets');
tobj.buildScriptTag(); // Build the script tag
tobj.addScriptTag(); // Execute (add) the script tag
ddiv.innerHTML = "Done fetching";
}
function showLinks(data) {
ddiv = document.getElementById('youtube');
ddiv.innerHTML = "Received";
var feed = data.feed;
var entries = feed.entry || [];
var html = ['<ul>'];
for (var i = 0; i < 5; i++) {
html.push('<li><a href="',entries[i].link[0].href,'">', entries[i].title.$t, '</a></li>');
}
html.push('</ul>');
ddiv.innerHTML = html.join('');
}
function showTweets(data) {
ddiv = document.getElementById('news');
ddiv.innerHTML = "Received";
var html = ['<ul>'];
for (var i = 0; i < Math.min(5,data.length); i++) {
tf = placeLinks(data[i].text);
html.push('<li>',tf,'</li>');
}
html.push('</ul>');
ddiv.innerHTML = html.join('');
}
function placeLinks(text) {
result=text.replace(/(https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/g,'<a href="$1">$1</a>');
return result;
}
</script>
<style type="text/css">
body {
background: #171A2B url(Background.jpg);
color: white;
font-family: Arial, Helvetica, Sans;
font-size: 11px;
}
a {
color: #0092E8;
font-weight: bold;
text-decoration: none;
padding: 2px;
}
a:hover {
color: white;
background: #0092E8;
border-radius: 5px;
}
p {
text-align: justify;
}
.left {
text-align: left;
}
h1 {
font-size: 3em;
letter-spacing: 2px;
padding: 20px 0 0 80px;
align: bottom;
}
h2 {
font-size: 1.2em;
}
ul {
list-style-type: none;
padding: 0;
}
.column {
width: 300px;
float: left;
margin-left: 10px;
}
.block {
background: rgba(30,31,33,0.6);;
border-radius: 5px;
padding: 8px;
margin-bottom: 10px;
}
.options {
clear: both;
}
.from {
font-size: 0.7em;
font-weight: normal;
}
</style>
</head>
<body onload="loadFeeds()">
<h1><img src="FreeCAD.png">&nbsp;""" + text01 + """</h1>
<div class="column">
<div class="block">
<h2>""" + text02 + """</h2>
defaultworkbenches
</div>
<div class="block">
<h2>""" + text03 + """</h2>
recentfiles
</div>
<div class="block">
<h2>""" + text04 + """ <span class="from">""" + text44 + """</span></h2>
<div id="youtube">youtube videos</div>
</div>
<div class="block">
<h2>""" + text05 + """ <span class="from">""" + text42 + """</span></h2>
<div id="news">news feed</div>
</div>
</div>
<div class="column">
<div class="block">
<h2>""" + text06 + """</h2>
defaultlinks
</div>
<div class="block">
<h2>""" + text09 + """</h2>
defaultexamples
</div>
<div class="block">
<h2>""" + text14 + """</h2>
webexamples
</div>
customblocks
</div>
<div class="column" id="description">
&nbsp;
</div>
<!--
<form class="options">
<input type="checkbox" name="closeThisDialog">
""" + text17 + """<br/>
<input type="checkbox" name="dontShowAgain">
""" + text18 + """
</form>
-->
</body>
</html>
"""
def getWebExamples():
return """
<ul>
<li><a href="http://freecad-project.de/svn/ExampleData/FileFormates/Schenkel.stp">""" + text15 + """</a></li>
<li><a href="http://freecad-project.de/svn/ExampleData/Examples/CAD/Complex.FCStd">""" + text16 + """</a></li>
</ul>"""
def getExamples():
return """
<ul>
<li><a href="LoadSchenkel.py">""" + text10 + """</a></li>
<li><a href="LoadPartDesignExample.py">""" + text11 + """</a></li>
<li><a href="LoadDrawingExample.py">""" + text12 + """</a></li>
<li><a href="LoadRobotExample.py">""" + text13 + """</a></li>
</ul>"""
def getLinks():
return """
<ul>
<li><img src="web.png">&nbsp;
<a onMouseover="show('<p>""" + text07 + """</p>')"
onMouseout="show('')"
href="http://free-cad.sf.net/">""" + text08 + """</a></li>
<li><img src="web.png">&nbsp;
<a onMouseover="show('<p>""" + text45 + """</p>')"
onMouseout="show('')"
href=""" + text38 + """>""" + text37 + """</a></li>
<li><img src="web.png">&nbsp;
<a onMouseover="show('<p>""" + text46 + """</p>')"
onMouseout="show('')"
href="http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Tutorials">""" + text39 + """</a></li>
<li><img src="web.png">&nbsp;
<a onMouseover="show('<p>""" + text47 + """</p>')"
onMouseout="show('')"
href="http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Power_users_hub">""" + text40 + """</a></li>
<li><img src="web.png">&nbsp;
<a onMouseover="show('<p>""" + text48 + """</p>')"
onMouseout="show('')"
href="http://freecad-tutorial.blogspot.com/">""" + text43 + """</a></li>
</ul>"""
def getWorkbenches():
return """
<ul>
<li><img src="PartDesign.png">&nbsp;
<a onMouseover="show('<h3>""" + text19 + """</h3> \
<p>""" + text20 + """</p><p><small>""" + text21 + """ \
:</small></p><img src=PartDesignExample.png>')"
onMouseout="show('')"
href="PartDesign.py">""" + text22 + """</a></li>
<li><img src="ArchDesign.png">&nbsp;
<a onMouseover="show('<h3>""" + text23 + """</h3> \
<p>""" + text24 + """</p><p><small>""" + text21 + """ \
:</small></p><img src=ArchExample.png>')"
onMouseout="show('')"
href="ArchDesign.py">""" + text25 + """</a></li>
<li><img src="Mesh.png">&nbsp;
<a onMouseover="show('<h3>""" + text26 + """</h3> \
<p>""" + text27 + """</p><p>""" + text28 + """</p>')"
onMouseout="show('')"
href="Mesh.py">""" + text29 + """</a></li>
<li><img src="Complete.png">&nbsp;
<a onMouseover="show('<h3>""" + text30 +"""</h3> \
<p>This is the <b>""" + text31 + """</b>, \
""" + text32 + """</p>')"
onMouseout="show('')"
href="DefaultWorkbench.py">""" + text31 + """</a></li>
</ul>
"""
def getInfo(filename):
"returns available file information"
def getLocalTime(timestamp):
"returns a local time from a timestamp"
return time.strftime("%m/%d/%Y %H:%M:%S",time.localtime(timestamp))
def getSize(size):
"returns a human-readable size"
if size > 1024*1024:
hsize = str(size/(1024*1024)) + "Mb"
elif size > 1024:
hsize = str(size/1024) + "Kb"
else:
hsize = str(size) + "b"
return hsize
html = '<h3>'+os.path.basename(filename)+'</h3>'
if os.path.exists(filename):
# get normal file info
s = os.stat(filename)
html += "<p>" + text33 + " " + getSize(s.st_size) + "<br/>"
html += text34 + " " + getLocalTime(s.st_ctime) + "<br/>"
html += text35 + " " + getLocalTime(s.st_mtime) + "<br/>"
html += "<span>" + text36 + " " + filename + "</span></p>"
# get additional info from fcstd files
if os.path.splitext(filename)[1] in [".fcstd",".FcStd"]:
zfile=zipfile.ZipFile(filename)
files=zfile.namelist()
# check for meta-file if it's really a FreeCAD document
if files[0] == "Document.xml":
html += "<p>FreeCAD Standard File</p>"
image="thumbnails/Thumbnail.png"
if image in files:
image=zfile.read(image)
thumbfile = tempfile.mkstemp(suffix='.png')[1]
thumb = open(thumbfile,"wb")
thumb.write(image)
thumb.close()
html += '<img src=file://'
html += thumbfile + '><br/>'
else:
html += "<p>" + text41 + "</p>"
return html
def getRecentFiles():
"returns a list of 3 latest recent files"
rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles")
ct=rf.GetInt("RecentFiles")
html = '<ul>'
for i in range(3):
if i < ct:
mr = rf.GetString("MRU%d" % (i))
fn = os.path.basename(mr)
html += '<li><a '
html += 'onMouseover="show(\''+getInfo(mr)+'\')" '
html += 'onMouseout="show(\'\')" '
html += 'href="LoadMRU'+str(i)+'.py">'
html += fn
html += '</a></li>'
html += '</ul>'
return html
def getFeed(url,numitems=3):
"returns a html list with links from the given RSS feed url"
xml = parse(urllib.urlopen(url)).getroot()
items = []
channel = xml.find('channel')
for element in channel.findall('item'):
items.append({
'title': element.find('title').text,
'description': element.find('description').text,
'link': element.find('link').text,
})
if len(items) > numitems:
items = items[:numitems]
resp = '<ul>'
for item in items:
descr = re.compile("style=\".*?\"").sub('',item['description'])
descr = re.compile("alt=\".*?\"").sub('',descr)
descr = re.compile("\"").sub('',descr)
d1 = re.findall("<img.*?>",descr)[0]
d2 = re.findall("<span>.*?</span>",descr)[0]
descr = "<h3>" + item['title'] + "</h3>"
descr += d1 + "<br/>"
descr += d2
resp += '<li><a onMouseover="show(\''
resp += descr
resp += '\')" onMouseout="show(\'\')" href="'
resp += item['link']
resp += '">'
resp += item['title']
resp += '</a></li>'
resp += '</ul>'
print resp
return resp
def getCustomBlocks():
"fetches custom html files in FreeCAD user dir"
output = ""
return output
def handle():
"returns the complete html startpage"
# add recent files
recentfiles = getRecentFiles()
html = page.replace("recentfiles",recentfiles)
# add default workbenches
html = html.replace("defaultworkbenches",getWorkbenches())
# add default web links
html = html.replace("defaultlinks",getLinks())
# add default examples
html = html.replace("defaultexamples",getExamples())
# add web examples
html = html.replace("webexamples",getWebExamples())
# add custom blocks
html = html.replace("customblocks",getCustomBlocks())
return html

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

3
src/Mod/Start/start.dox Normal file
View File

@@ -0,0 +1,3 @@
/** \defgroup START Start
* \ingroup WORKBENCHES */