diff --git a/src/Mod/Start/CMakeLists.txt b/src/Mod/Start/CMakeLists.txt index 30832b0eb6..7581fc42a8 100644 --- a/src/Mod/Start/CMakeLists.txt +++ b/src/Mod/Start/CMakeLists.txt @@ -8,41 +8,19 @@ if(BUILD_GUI) ) SET(StartPage_Resources - ArchDesign.py - DefaultWorkbench.py - LoadDrawingExample.py - LoadPartDesignExample.py - LoadRobotExample.py - LoadSchenkel.py - LoadMRU0.py - LoadMRU1.py - LoadMRU2.py - LoadMRU3.py - LoadArchExample.py - LoadFemExample2D.py - LoadFemExample3D.py - LoadFemExample3DNewSolver.py - Mesh.py - PartDesign.py - Ship.py + LoadMRU.py + LoadExample.py + LoadNew.py + LoadCustom.py StartPage.css StartPage.js StartPage.html EnableDownload.py - images/Background.jpg - images/FreeCAD.png - images/PartDesign.png - images/ArchDesign.png - images/Mesh.png - images/Complete.png - images/PartDesignExample.png - images/ArchExample.png - images/web.png - images/blank.png - images/freecad-doc.png - images/complete.jpg - images/Ship.png - images/ShipExample.png + images/userhub.png + images/poweruserhub.png + images/developerhub.png + images/manual.png + images/freecad.png ) add_subdirectory(Gui) diff --git a/src/Mod/Start/Gui/AppStartGui.cpp b/src/Mod/Start/Gui/AppStartGui.cpp index 820a2b8eca..bb44eb3881 100644 --- a/src/Mod/Start/Gui/AppStartGui.cpp +++ b/src/Mod/Start/Gui/AppStartGui.cpp @@ -35,6 +35,8 @@ #include #include #include "Workbench.h" +#include +#include "DlgStartPreferencesImp.h" #include @@ -104,6 +106,9 @@ PyMOD_INIT_FUNC(StartGui) PyObject* mod = StartGui::initModule(); Base::Console().Log("Loading GUI of Start module... done\n"); + // register preferences pages + new Gui::PrefPageProducer ("Start"); + // instantiating the commands CreateStartCommands(); StartGui::Workbench::init(); diff --git a/src/Mod/Start/Gui/CMakeLists.txt b/src/Mod/Start/Gui/CMakeLists.txt index 32db50f58c..5053a03e0c 100644 --- a/src/Mod/Start/Gui/CMakeLists.txt +++ b/src/Mod/Start/Gui/CMakeLists.txt @@ -12,14 +12,30 @@ set(StartGui_LIBS FreeCADGui ) +set(StartGui_MOC_HDRS + DlgStartPreferencesImp.h +) +fc_wrap_cpp(StartGui_MOC_SRCS ${StartGui_MOC_HDRS}) +SOURCE_GROUP("Moc" FILES ${StartGui_MOC_SRCS}) + +set(StartGui_UIC_SRCS + DlgStartPreferences.ui +) + if(BUILD_QT5) qt5_add_resources(Start_QRC_SRCS Resources/Start.qrc) + qt5_wrap_ui(StartGui_UIC_HDRS ${StartGui_UIC_SRCS}) else() qt4_add_resources(Start_QRC_SRCS Resources/Start.qrc) + qt4_wrap_ui(StartGui_UIC_HDRS ${StartGui_UIC_SRCS}) endif() SET(StartGui_SRCS ${Start_QRC_SRCS} + ${StartGui_UIC_SRCS} + DlgStartPreferences.ui + DlgStartPreferencesImp.cpp + DlgStartPreferencesImp.h AppStartGui.cpp Command.cpp PreCompiled.cpp diff --git a/src/Mod/Start/Gui/Command.cpp b/src/Mod/Start/Gui/Command.cpp index c226993263..b18eb526ff 100644 --- a/src/Mod/Start/Gui/Command.cpp +++ b/src/Mod/Start/Gui/Command.cpp @@ -23,6 +23,8 @@ #include "PreCompiled.h" #ifndef _PreComp_ +# include +# include #endif #include @@ -33,26 +35,74 @@ using namespace std; -DEF_STD_CMD(CmdStartConstraintAxle); +DEF_STD_CMD(CmdStartPage); -CmdStartConstraintAxle::CmdStartConstraintAxle() - :Command("Start_ConstraintAxle") +CmdStartPage::CmdStartPage() + :Command("Start_StartPage") { sAppModule = "Start"; sGroup = QT_TR_NOOP("Start"); - sMenuText = QT_TR_NOOP("Constraint Axle..."); - sToolTipText = QT_TR_NOOP("Set an axle constraint between two objects"); - sWhatsThis = "Start_ConstraintAxle"; + sMenuText = QT_TR_NOOP("Start Page"); + sToolTipText = QT_TR_NOOP("Displays the start page in a browser view"); + sWhatsThis = "Start_StartPage"; sStatusTip = sToolTipText; - sPixmap = "actions/document-new"; + sPixmap = "StartWorkbench"; } -void CmdStartConstraintAxle::activated(int iMsg) +void CmdStartPage::activated(int iMsg) { Q_UNUSED(iMsg); - // load the file with the module - //Command::doCommand(Command::Gui, "import Start, StartGui"); + + // Ensure that we don't open the Start page multiple times + QString title = QCoreApplication::translate("Workbench", "Start page"); + QList ch = Gui::getMainWindow()->windows(); + for (QList::const_iterator c = ch.begin(); c != ch.end(); ++c) { + if ((*c)->windowTitle() == title) + return; + } + + try { + QByteArray utf8Title = title.toUtf8(); + QByteArray cmd; + QTextStream str(&cmd); + str << "import WebGui" << endl; + str << "from StartPage import StartPage" << endl; + str << endl; + str << "class WebPage(object):" << endl; + str << " def __init__(self):" << endl; + str << " self.browser=WebGui.openBrowserWindow('" << utf8Title << "')" << endl; +#if defined(FC_OS_WIN32) + str << " self.browser.setHtml(StartPage.handle(), App.getResourceDir() + 'Mod/Start/StartPage/')" << endl; +#else + str << " self.browser.setHtml(StartPage.handle(), 'file://' + App.getResourceDir() + 'Mod/Start/StartPage/')" << endl; +#endif + str << " def onChange(self, par, reason):" << endl; + str << " if reason == 'RecentFiles':" << endl; +#if defined(FC_OS_WIN32) + str << " self.browser.setHtml(StartPage.handle(), App.getResourceDir() + 'Mod/Start/StartPage/')" << endl; +#else + str << " self.browser.setHtml(StartPage.handle(), 'file://' + App.getResourceDir() + 'Mod/Start/StartPage/')" << endl; +#endif + str << endl; + str << "class WebView(object):" << endl; + str << " def __init__(self):" << endl; + str << " self.pargrp = FreeCAD.ParamGet('User parameter:BaseApp/Preferences/RecentFiles')" << endl; + str << " self.webPage = WebPage()" << endl; + str << " self.pargrp.Attach(self.webPage)" << endl; + str << " def __del__(self):" << endl; + str << " self.pargrp.Detach(self.webPage)" << endl; + str << endl; + str << "webView=WebView()" << endl; + + //Base::Interpreter().runString(cmd); + // Gui::Command::runCommand(Gui::Command::Gui, cmd); + Command::doCommand(Command::Gui, "import Start, StartGui"); + Command::doCommand(Command::Gui, cmd); + } + catch (const Base::Exception& e) { + Base::Console().Error("%s\n", e.what()); + } } @@ -61,5 +111,5 @@ void CreateStartCommands(void) { Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); - rcCmdMgr.addCommand(new CmdStartConstraintAxle()); + rcCmdMgr.addCommand(new CmdStartPage()); } diff --git a/src/Mod/Start/Gui/DlgStartPreferences.ui b/src/Mod/Start/Gui/DlgStartPreferences.ui new file mode 100644 index 0000000000..2b6a28b586 --- /dev/null +++ b/src/Mod/Start/Gui/DlgStartPreferences.ui @@ -0,0 +1,488 @@ + + + DlgStartPreferences + + + + 0 + 0 + 476 + 507 + + + + Start page options + + + + + + Start page template + + + + + + An optional HTML template that will be used instead of the default start page. + + + Template + + + Mod/Start + + + + + + + + + + Start page options + + + + + + false + + + + 60 + 60 + + + + the down gradient for the background color (currently unsupported) + + + + 127 + 158 + 181 + + + + BackgroundColor2 + + + Mod/Start + + + + + + + Link color + + + + + + + + 60 + 60 + + + + the background of the main start page area + + + + 255 + 255 + 255 + + + + PageColor + + + Mod/Start + + + + + + + Box background color + + + + + + + + 60 + 60 + + + + the color of the links + + + + 0 + 0 + 255 + + + + LinkColor + + + Mod/Start + + + + + + + + 60 + 60 + + + + the color of the version text + + + + 255 + 251 + 247 + + + + BackgroundTextColor + + + Mod/Start + + + + + + + Background image + + + + + + + Background color + + + + + + + Page text color + + + + + + + + 60 + 60 + + + + the color of the text on he main pages + + + + 0 + 0 + 0 + + + + PageTextColor + + + Mod/Start + + + + + + + an optional image to display as background + + + BackgroundImage + + + Mod/Start + + + + + + + Page background color + + + + + + + Show examples folder contents + + + + + + + an optional custom folder to be displayed at the bottom of the first page + + + ShowCustomFolder + + + Mod/Start + + + + + + + Show additional folder + + + + + + + + 60 + 60 + + + + the background color of the boxes inside the pages + + + + 221 + 221 + 221 + + + + BoxColor + + + Mod/Start + + + + + + + + 60 + 60 + + + + the background color behind the panels + + + + 79 + 88 + 116 + + + + BackgroundColor1 + + + Mod/Start + + + + + + + + + false + + + in same page + + + true + + + InBrowser + + + Mod/Start + + + + + + + false + + + in external browser + + + InWeb + + + Mod/Start + + + + + + + + + if you want the examples to show on the first page + + + Qt::RightToLeft + + + + + + true + + + ShowExamples + + + Mod/Start + + + + + + + Background text color + + + + + + + false + + + Background color gradient down + + + + + + + false + + + Open links + + + + + + + Auto load module after loafing + + + + + + + + + + Close start page after loading + + + + + + + Should the start page be closed after loading? + + + Qt::RightToLeft + + + + + + closeStart + + + Mod/Start + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Gui::FileChooser + QWidget +
Gui/FileDialog.h
+
+ + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+ + Gui::PrefFileChooser + Gui::FileChooser +
Gui/PrefWidgets.h
+
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
+ + Gui::PrefRadioButton + QRadioButton +
Gui/PrefWidgets.h
+
+ + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
+
+ + +
diff --git a/src/Mod/Start/Gui/DlgStartPreferencesImp.cpp b/src/Mod/Start/Gui/DlgStartPreferencesImp.cpp new file mode 100644 index 0000000000..69cb133975 --- /dev/null +++ b/src/Mod/Start/Gui/DlgStartPreferencesImp.cpp @@ -0,0 +1,133 @@ +/*************************************************************************** + * Copyright (c) 2018 Yorik van Havre * + * * + * 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" + +#include "DlgStartPreferencesImp.h" +#include +#include +#include + +using namespace StartGui; + +/** + * Constructs a DlgSettings3DViewImp which is a child of 'parent' + */ +DlgStartPreferencesImp::DlgStartPreferencesImp( QWidget* parent ) + : PreferencePage( parent ) +{ + this->setupUi(this); + + // Hide currently unused controls + label_12->hide(); + label_7->hide(); + radioButton_1->hide(); + radioButton_2->hide(); + + // fills the combo box with all available workbenches + // sorted by their menu text + QStringList work = Gui::Application::Instance->workbenches(); + QMap menuText; + for (QStringList::Iterator it = work.begin(); it != work.end(); ++it) { + QString text = Gui::Application::Instance->workbenchMenuText(*it); + menuText[text] = *it; + } + + for (QMap::Iterator it = menuText.begin(); it != menuText.end(); ++it) { + QPixmap px = Gui::Application::Instance->workbenchIcon(it.value()); + if (px.isNull()) + AutoloadModuleCombo->addItem(it.key(), QVariant(it.value())); + else + AutoloadModuleCombo->addItem(px, it.key(), QVariant(it.value())); + } + +} + +/** + * Destroys the object and frees any allocated resources + */ +DlgStartPreferencesImp::~DlgStartPreferencesImp() +{ + // no need to delete child widgets, Qt does it all for us +} + +void DlgStartPreferencesImp::saveSettings() +{ + int index = AutoloadModuleCombo->currentIndex(); + QVariant data = AutoloadModuleCombo->itemData(index); + QString startWbName = data.toString(); + App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Start")-> + SetASCII("AutoloadModule", startWbName.toLatin1()); + colorButton_1->onSave(); + colorButton_2->onSave(); + colorButton_3->onSave(); + colorButton_4->onSave(); + colorButton_5->onSave(); + colorButton_6->onSave(); + colorButton_7->onSave(); + fileChooser_1->onSave(); + fileChooser_2->onSave(); + fileChooser_3->onSave(); + radioButton_1->onSave(); + radioButton_2->onSave(); + checkBox_1->onSave(); + checkBox_2->onSave(); +} + +void DlgStartPreferencesImp::loadSettings() +{ + std::string start = App::Application::Config()["StartWorkbench"]; + start = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Start")-> + GetASCII("AutoloadModule", start.c_str()); + QString startWbName = QLatin1String(start.c_str()); + AutoloadModuleCombo->setCurrentIndex(AutoloadModuleCombo->findData(startWbName)); + colorButton_1->onRestore(); + colorButton_2->onRestore(); + colorButton_3->onRestore(); + colorButton_4->onRestore(); + colorButton_5->onRestore(); + colorButton_6->onRestore(); + colorButton_7->onRestore(); + fileChooser_1->onRestore(); + fileChooser_2->onRestore(); + fileChooser_3->onRestore(); + radioButton_1->onRestore(); + radioButton_2->onRestore(); + checkBox_1->onRestore(); + checkBox_2->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void DlgStartPreferencesImp::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + retranslateUi(this); + } + else { + QWidget::changeEvent(e); + } +} + +#include "moc_DlgStartPreferencesImp.cpp" diff --git a/src/Mod/Start/Gui/DlgStartPreferencesImp.h b/src/Mod/Start/Gui/DlgStartPreferencesImp.h new file mode 100644 index 0000000000..190f29688e --- /dev/null +++ b/src/Mod/Start/Gui/DlgStartPreferencesImp.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * Copyright (c) 2018 Yorik van Havre * + * * + * 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_DLGSTARTPREFERENCESIMP_H +#define STARTGUI_DLGSTARTPREFERENCESIMP_H + +#include "ui_DlgStartPreferences.h" +#include + +namespace StartGui { + + class DlgStartPreferencesImp : public Gui::Dialog::PreferencePage, public Ui_DlgStartPreferences + { + Q_OBJECT + + public: + DlgStartPreferencesImp( QWidget* parent = 0 ); + ~DlgStartPreferencesImp(); + + protected: + void saveSettings(); + void loadSettings(); + void changeEvent(QEvent *e); + }; + +} // namespace StartGui + +#endif // STARTGUI_DLGSTARTPREFERENCESIMP_H diff --git a/src/Mod/Start/Gui/Resources/Start.qrc b/src/Mod/Start/Gui/Resources/Start.qrc index d8d21ae283..b032e7cb87 100644 --- a/src/Mod/Start/Gui/Resources/Start.qrc +++ b/src/Mod/Start/Gui/Resources/Start.qrc @@ -1,6 +1,7 @@ icons/StartWorkbench.svg + icons/preferences-start.svg translations/StartPage_af.qm translations/StartPage_de.qm translations/StartPage_fi.qm diff --git a/src/Mod/Start/Gui/Resources/icons/preferences-start.svg b/src/Mod/Start/Gui/Resources/icons/preferences-start.svg new file mode 100644 index 0000000000..c5583b64dd --- /dev/null +++ b/src/Mod/Start/Gui/Resources/icons/preferences-start.svg @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + [triplus] + + + StartWorkbench + 2016-02-26 + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + FreeCAD + + + FreeCAD/src/Mod/Start/Gui/Resources/icons/StartWorkbench.svg + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + [agryson] Alexander Gryson + + + + + arrow + right + + + Arrow pointing towards the right + + + + + + + + diff --git a/src/Mod/Start/Gui/Workbench.cpp b/src/Mod/Start/Gui/Workbench.cpp index e0f7da15e0..d0377edda6 100644 --- a/src/Mod/Start/Gui/Workbench.cpp +++ b/src/Mod/Start/Gui/Workbench.cpp @@ -128,7 +128,8 @@ Gui::ToolBarItem* StartGui::Workbench::setupToolBars() const // web navigation toolbar Gui::ToolBarItem* navigation = new Gui::ToolBarItem(root); navigation->setCommand("Navigation"); - *navigation << "Web_OpenWebsite" + *navigation << "Web_OpenWebsite" + << "Start_StartPage" << "Separator" << "Web_BrowserBack" << "Web_BrowserNext" diff --git a/src/Mod/Start/InitGui.py b/src/Mod/Start/InitGui.py index 17e4555462..359f2ea576 100644 --- a/src/Mod/Start/InitGui.py +++ b/src/Mod/Start/InitGui.py @@ -42,6 +42,7 @@ class StartWorkbench ( Workbench ): # load the module import StartGui import Start + def GetClassName(self): return "StartGui::Workbench" diff --git a/src/Mod/Start/StartPage/DefaultWorkbench.py b/src/Mod/Start/StartPage/DefaultWorkbench.py deleted file mode 100644 index 76ed2161da..0000000000 --- a/src/Mod/Start/StartPage/DefaultWorkbench.py +++ /dev/null @@ -1,28 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD, FreeCADGui -workbench = FreeCAD.ConfigGet("DefaultWorkbench") -if not workbench: workbench = "CompleteWorkbench" -FreeCADGui.activateWorkbench(workbench) -App.newDocument() diff --git a/src/Mod/Start/StartPage/LoadArchExample.py b/src/Mod/Start/StartPage/LoadArchExample.py deleted file mode 100644 index 6e19eef32c..0000000000 --- a/src/Mod/Start/StartPage/LoadArchExample.py +++ /dev/null @@ -1,26 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui -FreeCAD.open(FreeCAD.getResourceDir()+"examples/ArchDetail.FCStd") -FreeCADGui.activeDocument().sendMsgToViews("ViewFit") diff --git a/src/Mod/Start/StartPage/LoadMRU3.py b/src/Mod/Start/StartPage/LoadCustom.py similarity index 72% rename from src/Mod/Start/StartPage/LoadMRU3.py rename to src/Mod/Start/StartPage/LoadCustom.py index 5664ad0335..9f7b5816ba 100644 --- a/src/Mod/Start/StartPage/LoadMRU3.py +++ b/src/Mod/Start/StartPage/LoadCustom.py @@ -1,7 +1,6 @@ #*************************************************************************** #* * -#* Copyright (c) 2012 * -#* Yorik van Havre * +#* Copyright (c) 2018 Yorik van Havre * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * @@ -21,7 +20,16 @@ #* * #*************************************************************************** -import FreeCAD,FreeCADGui,sys -rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") -FreeCAD.loadFile(rf.GetString("MRU3")) +import FreeCAD,FreeCADGui,os,urllib +# filename will be given before this script is run +cfolder = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetString("ShowCustomFolder","") +if cfolder: + if not os.path.isdir(cfolder): + cfolder = os.path.dirname(cfolder) + f = urllib.unquote(filename).replace("+"," ") + FreeCAD.open(os.path.join(cfolder,f)) + FreeCADGui.activeDocument().sendMsgToViews("ViewFit") + from StartPage import StartPage + StartPage.postStart() + diff --git a/src/Mod/Start/StartPage/LoadDrawingExample.py b/src/Mod/Start/StartPage/LoadDrawingExample.py deleted file mode 100644 index af87833738..0000000000 --- a/src/Mod/Start/StartPage/LoadDrawingExample.py +++ /dev/null @@ -1,28 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui -FreeCADGui.activateWorkbench("DrawingWorkbench") -FreeCAD.open(FreeCAD.getResourceDir()+"examples/DrawingExample.FCStd") -FreeCADGui.activeDocument().sendMsgToViews("ViewFit") -FreeCADGui.activeDocument().sendMsgToViews("ViewAxo") diff --git a/src/Mod/Start/StartPage/LoadFemExample2D.py b/src/Mod/Start/StartPage/LoadExample.py similarity index 89% rename from src/Mod/Start/StartPage/LoadFemExample2D.py rename to src/Mod/Start/StartPage/LoadExample.py index e9f69a34c3..b8c797ca07 100644 --- a/src/Mod/Start/StartPage/LoadFemExample2D.py +++ b/src/Mod/Start/StartPage/LoadExample.py @@ -21,6 +21,10 @@ #* * #*************************************************************************** -import FreeCAD,FreeCADGui -FreeCAD.open(FreeCAD.getResourceDir()+"examples/FemCalculixCantilever2D.FCStd") +import FreeCAD,FreeCADGui,os +# filename will be given before this script is run +FreeCAD.open(os.path.join(FreeCAD.getResourceDir()+"examples",filename)) FreeCADGui.activeDocument().sendMsgToViews("ViewFit") + +from StartPage import StartPage +StartPage.postStart() diff --git a/src/Mod/Start/StartPage/LoadFemExample3D.py b/src/Mod/Start/StartPage/LoadFemExample3D.py deleted file mode 100644 index 80d2fecbd4..0000000000 --- a/src/Mod/Start/StartPage/LoadFemExample3D.py +++ /dev/null @@ -1,26 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui -FreeCAD.open(FreeCAD.getResourceDir()+"examples/FemCalculixCantilever3D.FCStd") -FreeCADGui.activeDocument().sendMsgToViews("ViewFit") diff --git a/src/Mod/Start/StartPage/LoadFemExample3DNewSolver.py b/src/Mod/Start/StartPage/LoadFemExample3DNewSolver.py deleted file mode 100644 index 0eba592c3f..0000000000 --- a/src/Mod/Start/StartPage/LoadFemExample3DNewSolver.py +++ /dev/null @@ -1,26 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui -FreeCAD.open(FreeCAD.getResourceDir()+"examples/FemCalculixCantilever3D_newSolver.FCStd") -FreeCADGui.activeDocument().sendMsgToViews("ViewFit") diff --git a/src/Mod/Start/StartPage/LoadForum.py b/src/Mod/Start/StartPage/LoadForum.py new file mode 100644 index 0000000000..5e50c40ba2 --- /dev/null +++ b/src/Mod/Start/StartPage/LoadForum.py @@ -0,0 +1,63 @@ +#*************************************************************************** +#* * +#* Copyright (c) 2018 Yorik van Havre * +#* * +#* 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. * +#* * +#* This program 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 program; if not, write to the Free Software * +#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +#* USA * +#* * +#*************************************************************************** + +# NOT WORKING - for further implementation + +# The forum has a "last posts" feed at +# https://forum.freecadweb.org/feed.php +# Javascript can't fetch it directly, because of cross-domain prohibition +# We can't fetch this from python at StartPAge load, becuase it could take +# several seconds or even fail +# So the idea is to have javascript call this script here, which would +# do it, then find a way to make the result available back to javascript +# a tempfile, for example... + +url = "https://forum.freecadweb.org/feed.php" +from xml.etree.ElementTree import parse +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 = '
    ' +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("",descr)[0] + d2 = re.findall(".*?",descr)[0] + descr = "

    " + item['title'] + "

    " + descr += d1 + "
    " + descr += d2 + resp += '
  • ' + resp += item['title'] + resp += '
  • ' +resp += '
' +print(resp) diff --git a/src/Mod/Start/StartPage/LoadMRU2.py b/src/Mod/Start/StartPage/LoadMRU.py similarity index 87% rename from src/Mod/Start/StartPage/LoadMRU2.py rename to src/Mod/Start/StartPage/LoadMRU.py index 12dcfdd1a9..fa5cbf902a 100644 --- a/src/Mod/Start/StartPage/LoadMRU2.py +++ b/src/Mod/Start/StartPage/LoadMRU.py @@ -1,7 +1,6 @@ #*************************************************************************** #* * -#* Copyright (c) 2012 * -#* Yorik van Havre * +#* Copyright (c) 2018 Yorik van Havre * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * @@ -21,7 +20,11 @@ #* * #*************************************************************************** -import FreeCAD,FreeCADGui,sys +import FreeCAD,sys +# MRU will be given before this script is run rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") -FreeCAD.loadFile(rf.GetString("MRU2")) +FreeCAD.loadFile(rf.GetString("MRU"+str(MRU))) + +from StartPage import StartPage +StartPage.postStart() diff --git a/src/Mod/Start/StartPage/LoadMRU0.py b/src/Mod/Start/StartPage/LoadMRU0.py deleted file mode 100644 index 4b25709602..0000000000 --- a/src/Mod/Start/StartPage/LoadMRU0.py +++ /dev/null @@ -1,26 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui,sys -rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") -FreeCAD.loadFile(rf.GetString("MRU0")) diff --git a/src/Mod/Start/StartPage/LoadMRU1.py b/src/Mod/Start/StartPage/LoadMRU1.py deleted file mode 100644 index 799a5b7e8d..0000000000 --- a/src/Mod/Start/StartPage/LoadMRU1.py +++ /dev/null @@ -1,26 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui,sys -rf=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") -FreeCAD.loadFile(rf.GetString("MRU1")) diff --git a/src/Mod/Start/StartPage/ArchDesign.py b/src/Mod/Start/StartPage/LoadNew.py similarity index 86% rename from src/Mod/Start/StartPage/ArchDesign.py rename to src/Mod/Start/StartPage/LoadNew.py index 37eb754384..d4c93d660b 100644 --- a/src/Mod/Start/StartPage/ArchDesign.py +++ b/src/Mod/Start/StartPage/LoadNew.py @@ -1,26 +1,27 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCADGui -FreeCADGui.activateWorkbench("ArchWorkbench") -App.newDocument() +#*************************************************************************** +#* * +#* Copyright (c) 2018 Yorik van Havre * +#* * +#* 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. * +#* * +#* This program 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 program; if not, write to the Free Software * +#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +#* USA * +#* * +#*************************************************************************** + +import FreeCAD,FreeCADGui +FreeCAD.newDocument() + +from StartPage import StartPage +StartPage.postStart() diff --git a/src/Mod/Start/StartPage/LoadPartDesignExample.py b/src/Mod/Start/StartPage/LoadPartDesignExample.py deleted file mode 100644 index 56579b4a41..0000000000 --- a/src/Mod/Start/StartPage/LoadPartDesignExample.py +++ /dev/null @@ -1,27 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui -FreeCAD.open(FreeCAD.getResourceDir()+"examples/PartDesignExample.FCStd") -FreeCADGui.activeDocument().sendMsgToViews("ViewFit") -FreeCADGui.activeDocument().sendMsgToViews("ViewAxo") diff --git a/src/Mod/Start/StartPage/LoadRobotExample.py b/src/Mod/Start/StartPage/LoadRobotExample.py deleted file mode 100644 index 38763e1203..0000000000 --- a/src/Mod/Start/StartPage/LoadRobotExample.py +++ /dev/null @@ -1,27 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui -FreeCAD.open(FreeCAD.getResourceDir()+"examples/RobotExample.FCStd") -FreeCADGui.activeDocument().sendMsgToViews("ViewFit") -FreeCADGui.activeDocument().sendMsgToViews("ViewAxo") diff --git a/src/Mod/Start/StartPage/LoadSchenkel.py b/src/Mod/Start/StartPage/LoadSchenkel.py deleted file mode 100644 index 2a84aba564..0000000000 --- a/src/Mod/Start/StartPage/LoadSchenkel.py +++ /dev/null @@ -1,27 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCAD,FreeCADGui,Part -Part.open(FreeCAD.getResourceDir()+"examples/Schenkel.stp") -FreeCADGui.activeDocument().sendMsgToViews("ViewFit") -FreeCADGui.activeDocument().sendMsgToViews("ViewAxo") diff --git a/src/Mod/Start/StartPage/Mesh.py b/src/Mod/Start/StartPage/Mesh.py deleted file mode 100644 index b5574fc722..0000000000 --- a/src/Mod/Start/StartPage/Mesh.py +++ /dev/null @@ -1,26 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCADGui -FreeCADGui.activateWorkbench("MeshWorkbench") -App.newDocument() diff --git a/src/Mod/Start/StartPage/PartDesign.py b/src/Mod/Start/StartPage/PartDesign.py deleted file mode 100644 index 8aa1c7b6b1..0000000000 --- a/src/Mod/Start/StartPage/PartDesign.py +++ /dev/null @@ -1,30 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCADGui -Gui.activateWorkbench("PartDesignWorkbench") -App.newDocument() -# Make the planes properly visible -#Gui.ActiveDocument.ActiveView.setCameraOrientation(App.ActiveDocument.BaseplaneXY.Placement.Rotation.Q) -#Gui.activeDocument().activeView().viewAxometric() -#Gui.SendMsgToActiveView("ViewFit") diff --git a/src/Mod/Start/StartPage/Ship.py b/src/Mod/Start/StartPage/Ship.py deleted file mode 100644 index 29dee30650..0000000000 --- a/src/Mod/Start/StartPage/Ship.py +++ /dev/null @@ -1,26 +0,0 @@ -#*************************************************************************** -#* * -#* Copyright (c) 2012 * -#* Yorik van Havre * -#* * -#* 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. * -#* * -#* This program 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 program; if not, write to the Free Software * -#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * -#* USA * -#* * -#*************************************************************************** - -import FreeCADGui -FreeCADGui.activateWorkbench("ShipWorkbench") -App.newDocument() diff --git a/src/Mod/Start/StartPage/StartPage.css b/src/Mod/Start/StartPage/StartPage.css index 2bd75be5d1..5c1d66553e 100644 --- a/src/Mod/Start/StartPage/StartPage.css +++ b/src/Mod/Start/StartPage/StartPage.css @@ -1,125 +1,150 @@ body { - background: #basecolor; - color: #textcolor; + background: BACKGROUND; + color: BGTCOLOR; font-family: Arial, Helvetica, Sans; - font-size: 11px; + font-size: 13px; } - -a { - color: #linkcolor; - font-weight: bold; +a, a:link, a:visited { text-decoration: none; - padding: 2px; + color: LINKCOLOR; + font-weight: bold; } - a:hover { - color: white; - background: #linkcolor; - border-radius: 5px; + text-decoration: underline; } - -p { - text-align: justify; -} - -.left { - text-align: left; -} - h1 { - font-size: 3em; - letter-spacing: 2px; - padding: 20px 0 0 80px; - align: bottom; - color: #ffffff; + width: 100%; + text-align: center; } - h2 { - font-size: 1.2em; -} - -ul { - list-style-type: none; - padding: 0; -} - -#column { - margin: 0 350px 0 10px; -} - -#column img { - max-width: 14px; -} - -.block { - background: #windowcolor !important; - border-radius: 5px; - padding: 8px; - margin-bottom: 10px; - color: #windowtextcolor; - width: auto; - clear: left; -} - -.half-block { - background: #windowcolor !important; - border-radius: 5px; - padding: 8px; - margin-bottom: 10px; - color: #windowtextcolor; -} - -.options { + text-align: center; + fint-size: 0.9em; clear: both; } - -.from { - font-size: 0.7em; - font-weight: normal; +.hidden { + display: none; } - -#versionbox { +.version { + font-size: 0.8em; float: right; - text-align: right; - font-size: 0.33em; - font-weight: normal; - padding-right: 20px; - letter-spacing: 0; - color: #ffffff; + padding-right: 40px; } - -#description { - background: #windowcolor; - border-radius: 5px; - padding: 8px; - color: #windowtextcolor; - float: right; - width: 316px; - right: 10px; - height: 640px; - position: relative; +.container { + margin: 2% } - -#description img { - max-width: 300px; +ul.tabs { + margin: 9px 0; +} +ul.tabs li { + list-style: none; + display: inline; +} +ul.tabs li a { + color: TEXTCOLOR; + background-color: BOXCOLOR; + padding: 8px 14px 8px 14px; + text-decoration: none; + font-size: 1em; + font-weight: bold; + text-transform: uppercase; + border:1px solid SHADOW; + border-radius: 1px; + box-shadow: #445 0 -5px 5px; + outline: 0; +} +ul.tabs li a:hover { + background-color: TEXTCOLOR; + color: BASECOLOR; +} +ul.tabs li a.active { + background-color: BASECOLOR; + border-bottom: 1px solid BASECOLOR; +} +.panel { + background: BASECOLOR; + color: TEXTCOLOR; + padding: 15px; + clear: both; + margin-bottom: 10px; + border-radius: 3px; + overflow: auto; + box-shadow: SHADOW 0 2px 5px; +} +ul.icons { clear: both; } - -#description p span { - text-align: left; +.icon { + list-style: none; + display: inline; + float: left; + padding: 5px 0px 15px 10px; + width: 138px; + height: 200px; + background: BOXCOLOR; + border-radius: 3px; + margin: 10px; + box-shadow: SHADOW 0 0px 6px; } - -.disabled { - opacity: 0.5; +.icon h4 { + margin: 3px 0; + max-width: 90%; + word-wrap: break-word; } - -pre { - width: 300px !important; - white-space: pre-wrap; +.icon img { + width: 128px; + height: 128px; } - -.stick { - position: fixed !important; - top: 0px; - right: 18px !important; +.icon p { + margin: 0; +} +.docbox { + float: left; + padding: 10px; + max-width: 360px; + background: BOXCOLOR; + border-radius: 3px; + margin: 10px; + box-shadow: SHADOW 0 0px 6px; +} +.docbox h2 { + text-align: center; +} +.docbox img { + max-width: 24px; + max-height: 24px; +} +.allwidth { + max-width: 98%; +} +h3 a { + height: 32px; + vertical-align: middle; + padding-bottom: 18px; + padding-left: 5px; +} +#commits ul { + margin: 30px 0; + padding: 10px; +} +#commits ul li, .forum ul li { + margin-bottom: 10px; +} +.footnote { + text-align: center; + display: block; + clear: both; + padding-top: 10px; +} +ul.workbenches, ul.addonslist { + overflow: hidden; + padding: 10px; +} +ul.workbenches li, ul.addonslist li { + list-style: none; + float: left; + display: inline; + width: 50%; +} +.forum ul { + padding: 10px; } diff --git a/src/Mod/Start/StartPage/StartPage.html b/src/Mod/Start/StartPage/StartPage.html index 44eb1cd334..ef5bfe16a2 100644 --- a/src/Mod/Start/StartPage/StartPage.html +++ b/src/Mod/Start/StartPage/StartPage.html @@ -1,103 +1,124 @@ - - FreeCAD - Start page - - - - -

 text01
 

-
-   -
-
-
-

text03

- recentfiles -
-
-

text02

- -
-
-

text06

- -
-
-

text09

- -
-
-

text05

-
news feed
-
- customblocks -
- + + T_TITLE + + + + + +
+
+
VERSIONSTRING
+
+ +
+ +

T_RECENTFILES

+ + UL_RECENTFILES + +
+ T_TIP: T_ADJUSTRECENT
+
+ + SECTION_EXAMPLES + + SECTION_CUSTOM + +
+ T_CUSTOM +
+ +
+ + + + +
+ diff --git a/src/Mod/Start/StartPage/StartPage.js b/src/Mod/Start/StartPage/StartPage.js index b68c0d77c1..57f898e61d 100644 --- a/src/Mod/Start/StartPage/StartPage.js +++ b/src/Mod/Start/StartPage/StartPage.js @@ -1,9 +1,68 @@ -var linkDescriptions = []; var allowDownloads = 0; +function toggle(tab) { + // switch to the given tab ID ("tab1", "tab2", etc...) + var tabs = document.getElementById("tabs").childElementCount; + document.getElementById(tab).classList.remove("hidden"); + document.getElementById("h"+tab).classList.add("active"); + for (var i = 1; i <= tabs; i++) { + if ("tab"+i != tab) { + document.getElementById("tab"+i).classList.add("hidden"); + document.getElementById("htab"+i).classList.remove("active"); + } + } +} + +function load() { + if (allowDownloads == 1) { + // load latest commits + ddiv = document.getElementById("commits"); + ddiv.innerHTML = "Connecting..."; + var tobj=new JSONscriptRequest('https://api.github.com/repos/FreeCAD/FreeCAD/commits?callback=printCommits'); + tobj.buildScriptTag(); // Build the script tag + tobj.addScriptTag(); // Execute (add) the script tag + ddiv.innerHTML = "Downloading latest news..."; + // load addons list + ddiv = document.getElementById("addons"); + ddiv.innerHTML = "Connecting..."; + var tobj=new JSONscriptRequest('https://api.github.com/repos/FreeCAD/FreeCAD-addons/contents?callback=printAddons'); + tobj.buildScriptTag(); // Build the script tag + tobj.addScriptTag(); // Execute (add) the script tag + ddiv.innerHTML = "Downloading addons list..."; + } +} + +function printCommits(data) { + ddiv = document.getElementById('commits'); + ddiv.innerHTML = "Received"; + var html = ['
    ']; + for (var i = 0; i < 25; i++) { + html.push('
  • ', data.data[i].commit.message, ' ', data.data[i].commit.committer.date.split("T")[0], ' - ', data.data[i].commit.author.name, '
  • '); + } + html.push('
'); + ddiv.innerHTML = html.join(''); +} + +function printAddons(data) { + ddiv = document.getElementById('addons'); + ddiv.innerHTML = "Received"; + var html = ['
    ']; + var blacklist = ['addons_installer.FCMacro','FreeCAD-Addon-Details.md','README.md']; + for (var i = 0; i < data.data.length; i++) { + if ( (data.data[i].name[0] != ".") && (blacklist.indexOf(data.data[i].name) < 0) ) { + html.push('
  • ', data.data[i].name, '
  • '); + } + } + html.push('
'); + ddiv.innerHTML = html.join(''); +} + +// below are JSON helper functions + + function JSONscriptRequest(fullUrl) { // REST request path - this.fullUrl = fullUrl; + 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 @@ -25,154 +84,10 @@ JSONscriptRequest.prototype.buildScriptTag = function () { JSONscriptRequest.prototype.removeScriptTag = function () { // Destroy the script tag - this.headLoc.removeChild(this.scriptObj); + 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 = " "; - ddiv.innerHTML = theText; -} - -function checkVersion(data) { - vdiv = document.getElementById("versionbox"); - console.log('test'); - var cmajor = vmajor; - var cminor = vminor; - var cbuild = vbuild; - var amajor = data[0]['major']; - var aminor = data[0]['minor']; - var abuild = data[0]['build']; - if (cmajor >= amajor && cminor >= aminor && cbuild >= abuild) { - vdiv.innerHTML=" text58: vmajor.vminor.vbuild"; - } else { - vdiv.innerHTML="text59:"+amajor+"."+aminor+"."+abuild+""; - } -} - -function load() { - ddiv = document.getElementById("news"); - if (allowDownloads == 0) { - ddiv.innerHTML = 'text70 text71'; - return; - } - // load latest news - ddiv.innerHTML = "Connecting..."; - var tobj=new JSONscriptRequest('https://api.github.com/repos/FreeCAD/FreeCAD/commits?callback=showTweets'); - tobj.buildScriptTag(); // Build the script tag - tobj.addScriptTag(); // Execute (add) the script tag - ddiv.innerHTML = "Downloading latest news..."; - - // load version - var script = document.createElement('script'); - script.src = 'http://www.freecadweb.org/version.php?callback=checkVersion'; - document.body.appendChild(script); -} - -function stripTags(text) { - // from http://www.pagecolumn.com/tool/all_about_html_tags.htm /<\s*\/?\s*span\s*.*?>/g - stripped = text.replace("']; - for (var i = 0; i < 4; i++) { - html.push('
  •  ', data.data[i].commit.message, '
  • '); - if ("message" in data.data[i].commit) { - linkDescriptions.push(stripTags(data.data[i].commit.message)+'
    '+data.data[i].commit.author.name+'
    '+data.data[i].commit.author.date); - } else { - linkDescriptions.push(""); - } - - } - html.push(''); - html.push('text63'); - ddiv.innerHTML = html.join(''); - resize(); - resize(); // intentional javascript hack -} - -function enableDownloads() { - allowDownloads = 1; - // load latest news - ddiv = document.getElementById("news"); - ddiv.innerHTML = "Connecting..."; - var tobj=new JSONscriptRequest('https://api.github.com/repos/FreeCAD/FreeCAD/commits?callback=showTweets'); - tobj.buildScriptTag(); // Build the script tag - tobj.addScriptTag(); // Execute (add) the script tag - ddiv.innerHTML = "Downloading latest news..."; -} - -function showDescr(d) { - if (d) { - show(linkDescriptions[d-1]); - } else { - show(""); - } -} - -function scroller() { - desc = document.getElementById("description"); - base = document.getElementById("column").offsetTop; - scro = window.scrollY; - if (scro > base) { - desc.className = "stick"; - } else { - desc.className = ""; - } -} - -function resize() { - var halfblocks = document.getElementsByClassName('half-block'); - var commits = document.getElementById("commits"); - var examples = document.getElementById("examples"); - var files = document.getElementById("files"); - var newproj = document.getElementById('newproject'); - var ontheweb = document.getElementById('ontheweb'); - var description = document.getElementById("description"); - - var w = files.offsetWidth; - var filesHeight = files.offsetHeight; - var h1 = newproj.getElementsByTagName('ul')[0].offsetHeight; - var h2 = ontheweb.getElementsByTagName('ul')[0].offsetHeight; - var h3 = examples.getElementsByTagName('ul')[0].offsetHeight; - var h4 = commits.getElementsByTagName('ul')[0].offsetHeight; - - var rowTwoHeight = h1 > h2 ? h1 : h2; - var rowThreeHeight = h3 > h4 ? h3 : h4; - rowTwoHeight = rowTwoHeight + 40; - rowThreeHeight = rowThreeHeight + 80; - var totalHeight = rowTwoHeight + rowThreeHeight + filesHeight + 36; - - w = w - 45; - for (var i = 0; i < halfblocks.length; i++) { - halfblocks[i].style.width = w/2 + 'px'; - } - newproj.style.height = rowTwoHeight + 'px'; - ontheweb.style.height = rowTwoHeight + 'px'; - examples.style.height = rowThreeHeight + 'px'; - commits.style.height = rowThreeHeight + 'px'; - description.style.height = totalHeight + 'px'; -} - -document.onmousemove=scroller; diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index f8a9f0d8f9..decb62967f 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -1,7 +1,6 @@ #*************************************************************************** #* * -#* Copyright (c) 2012 * -#* Yorik van Havre * +#* Copyright (c) 2018 Yorik van Havre * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * @@ -21,62 +20,64 @@ #* * #*************************************************************************** -# This is the start page template -import os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re -from PySide import QtGui -from xml.etree.ElementTree import parse +# This is the start page template. It builds a HTML global variable that contains +# the html code of the start page. It is built only once per FreeCAD session for now... -from .TranslationTexts import (text01, text02, text03, text04, text05, text06, - text07, text08, text09, text10, text11, text12, - text13, text14, text15, text16, text17, text18, - text19, text20, text21, text22, text23, text24, - text25, text26, text27, text28, text29, text30, - text31, text32, text33, text34, text35, text36, - text37, text38, text39, text40, text41, text42, - text43, text44, text45, text46, text47, text48, - text49, text50, text51, text52, text53, text54, - text55, text56, text57, text58, text59, text60, - text61, text62, text63, text64, text65, text66, - text67, text68, text69, text70, text71) - -try: - import io as cStringIO -except: - import cStringIO +import sys,os,FreeCAD,FreeCADGui,tempfile,time,zipfile,urllib,re,TranslationTexts +from PySide import QtCore,QtGui FreeCADGui.addLanguagePath(":/translations") FreeCADGui.updateLocale() -# get FreeCAD version -v = FreeCAD.Version() -vmajor, vminor = v[0], v[1] -vbuild = v[2].split(" ")[0] +iconprovider = QtGui.QFileIconProvider() +iconbank = {} # to store already created icons -# here is the html page skeleton -resources_dir = os.path.join(FreeCAD.getResourceDir(), "Mod", "Start", "StartPage") -html_filename = os.path.join(resources_dir, "StartPage.html") -js_filename = os.path.join(resources_dir, "StartPage.js") -css_filename = os.path.join(resources_dir, "StartPage.css") -with open(html_filename, 'r') as f: - startpage_html = f.read() -with open(js_filename, 'r') as f: - startpage_js = f.read() +def gethexcolor(color): + + "returns a color hex value #000000" + + r = str(hex(int(((color>>24)&0xFF))))[2:].zfill(2) + g = str(hex(int(((color>>16)&0xFF))))[2:].zfill(2) + b = str(hex(int(((color>>8)&0xFF))))[2:].zfill(2) + return "#"+r+g+b + + + +def isplainfile(filename): + + "check if this is any type we don't want to show" + + if os.path.isdir(filename): + return False + basename = os.path.basename(filename) + if basename.startswith("."): + return False + if basename[-1].isdigit(): + if basename[-7:-1].lower() == "fcstd": + return False + if basename.endswith("~"): + return False + if basename.lower().endswith(".bak"): + return False + return True + -with open(css_filename, 'r') as f: - startpage_css = f.read() def getInfo(filename): + "returns available file information" + global iconbank + def getLocalTime(timestamp): - "returns a local time from a 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" + "returns a human-readable size" if size > 1024*1024: hsize = str(size/(1024*1024)) + "Mb" elif size > 1024: @@ -84,234 +85,353 @@ def getInfo(filename): else: hsize = str(size) + "b" return hsize - - html = '

    '+os.path.basename(filename)+'

    ' - + if os.path.exists(filename): + # get normal file info s = os.stat(filename) - html += "

    " + text33 + " " + getSize(s.st_size) + "
    " - html += text34 + " " + getLocalTime(s.st_ctime) + "
    " - html += text35 + " " + getLocalTime(s.st_mtime) + "
    " - html += "" + text36 + " " + filename + "

    " + size = getSize(s.st_size) + #ctime = getLocalTime(s.st_ctime) + #mtime = getLocalTime(s.st_mtime) + author = TranslationTexts.T_UNKNOWN + #company = TranslationTexts.T_UNKNOWN + #lic = TranslationTexts.T_UNKNOWN + image = None + # get additional info from fcstd files - if os.path.splitext(filename)[1].upper() in [".FCSTD"]: + if filename.lower().endswith(".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 += "

    " + text65 + "

    " - image="thumbnails/Thumbnail.png" doc = str(zfile.read(files[0])) doc = doc.replace("\n"," ") - author = re.findall("Property name=\"CreatedBy.*?String value=\"(.*?)\"\/>",doc) - if author: - html += "

    " + text66 + ": " + author[0] + "

    " - company = re.findall("Property name=\"Company.*?String value=\"(.*?)\"\/>",doc) - if company: - html += "

    " + text67 + ": " + company[0] + "

    " - lic = re.findall("Property name=\"License.*?String value=\"(.*?)\"\/>",doc) - if lic: - html += "

    " + text68 + ": " + lic[0] + "

    " - if image in files: - image=zfile.read(image) - thumbfile = tempfile.mkstemp(suffix='.png')[1] - thumb = open(thumbfile,"wb") - thumb.write(image) - thumb.close() - html += '
    ' - else: - print ("not a freecad file: "+os.path.splitext(filename)[1].upper()) - else: - html += "

    " + text41 + "

    " - return html + r = re.findall("Property name=\"CreatedBy.*?String value=\"(.*?)\"\/>",doc) + if r: + author = r[0] + #r = re.findall("Property name=\"Company.*?String value=\"(.*?)\"\/>",doc) + #if r: + # company = r + #r = re.findall("Property name=\"License.*?String value=\"(.*?)\"\/>",doc) + #if r: + # lic =r + if "thumbnails/Thumbnail.png" in files: + if filename in iconbank: + image = iconbank[filename] + else: + imagedata=zfile.read("thumbnails/Thumbnail.png") + image = tempfile.mkstemp(suffix='.png')[1] + thumb = open(image,"wb") + thumb.write(imagedata) + thumb.close() + iconbank[filename] = image -def getRecentFiles(): - "returns a list of 3 latest recent files" - rf = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") - ct = rf.GetInt("RecentFiles") - html = '
    ' - return html + icon = iconprovider.icon(i) + px = icon.pixmap(128,128) + image = tempfile.mkstemp(suffix='.png')[1] + px.save(image) + iconbank[t] = image -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 = '
      ' - 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("",descr)[0] - d2 = re.findall(".*?",descr)[0] - descr = "

      " + item['title'] + "

      " - descr += d1 + "
      " - descr += d2 - resp += '
    • ' - resp += item['title'] - resp += '
    • ' - resp += '
    ' - print(resp) - return resp + return image,size,author -def getCustomBlocks(): - "fetches custom html files in FreeCAD user dir" - output = "" - return output + return None,None,None -def setColors(html): - "gets theme colors from the system, and sets appropriate styles" - defaults = {"#basecolor":"#191B26", - "#linkcolor":"#0092E8", - "#textcolor":"#FFFFFF", - "#windowcolor":"#FFFFFF", - "#windowtextcolor":"#000000"} - try: - palette = QtGui.QApplication.palette() - except: - pass - else: - #defaults["#basecolor"] = palette.base().color().name() - defaults["#basecolor"] = "#171A2B url(images/Background.jpg)" - #defaults["#linkcolor"] = palette.link().color().name() # UGLY!! - defaults["#textcolor"] = palette.text().color().name() - defaults["#windowcolor"] = palette.window().color().name() - defaults["#windowtextcolor"] = palette.windowText().color().name() - for k,v in defaults.items(): - html = html.replace(k,str(v)) - return html -def insert_page_resources(html): - html = html.replace("startpage_js", startpage_js) - html = html.replace("startpage_css", startpage_css) - return html - -def replace_html_text(html): - html = html.replace("text01", text01) - html = html.replace("text02", text02) - html = html.replace("text03", text03) - html = html.replace("text05", text05) - html = html.replace("text06", text06) - html = html.replace("text07", text07) - html = html.replace("text08", text08) - html = html.replace("text09", text09) - html = html.replace("text10", text10) - html = html.replace("text11", text11) - html = html.replace("text12", text12) - html = html.replace("text13", text13) - html = html.replace("text17", text17) - html = html.replace("text18", text18) - html = html.replace("text19", text19) - html = html.replace("text20", text20) - html = html.replace("text21", text21) - html = html.replace("text22", text22) - html = html.replace("text23", text23) - html = html.replace("text24", text24) - html = html.replace("text25", text25) - html = html.replace("text26", text26) - html = html.replace("text27", text27) - html = html.replace("text28", text28) - html = html.replace("text29", text29) - html = html.replace("text37", text37) - html = html.replace("text38", text38) - html = html.replace("text39", text39) - html = html.replace("text40", text40) - html = html.replace("text43", text43) - html = html.replace("text45", text45) - html = html.replace("text46", text46) - html = html.replace("text47", text47) - html = html.replace("text48", text48) - html = html.replace("text49", text49) - html = html.replace("text50", text50) - html = html.replace("text51", text51) - html = html.replace("text52", text52) - html = html.replace("text53", text53) - html = html.replace("text54", text54) - html = html.replace("text55", text55) - html = html.replace("text56", text56) - html = html.replace("text57", text57) - html = html.replace("text60", text60) - html = html.replace("text61", text61) - html = html.replace("text62", text62) - html = html.replace("text64", text64) - html = html.replace("text69", text69) - return html - -def replace_js_text(html): - html = html.replace("vmajor", vmajor) - html = html.replace("vminor", vminor) - html = html.replace("vbuild", vbuild) - html = html.replace("text58", text58) - html = html.replace("text59", text59) - html = html.replace("text63", text63) - html = html.replace("text70", text70) - html = html.replace("text71", text71) - return html def handle(): - "returns the complete html startpage" - # add strings into files - html = insert_page_resources(startpage_html) - html = replace_js_text(html) - - # add recent files - recentfiles = getRecentFiles() - html = html.replace("recentfiles",recentfiles) - - # add custom blocks - html = html.replace("customblocks",getCustomBlocks()) - - # enable web access if permitted - if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetBool("AllowDownload",False): - html = html.replace("var allowDownloads = 0;","var allowDownloads = 1;") - html = replace_html_text(html) - # fetches system colors - html = setColors(html) - return html + "builds the HTML code of the start page" + + global iconbank + + # build the html page skeleton + + resources_dir = os.path.join(FreeCAD.getResourceDir(), "Mod", "Start", "StartPage") + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Start") + template = p.GetString("Template","") + if template: + html_filename = template + else: + html_filename = os.path.join(resources_dir, "StartPage.html") + js_filename = os.path.join(resources_dir, "StartPage.js") + css_filename = os.path.join(resources_dir, "StartPage.css") + with open(html_filename, 'r') as f: + HTML = f.read() + + with open(js_filename, 'r') as f: + JS = f.read() + + with open(css_filename, 'r') as f: + CSS = f.read() + HTML = HTML.replace("JS",JS) + HTML = HTML.replace("CSS",CSS) + + + # get FreeCAD version + + v = FreeCAD.Version() + VERSIONSTRING = TranslationTexts.T_VERSION + " " + v[0] + "." + v[1] + " " + TranslationTexts.T_BUILD + " " + v[2] + HTML = HTML.replace("VERSIONSTRING",VERSIONSTRING) + + + # translate texts + + HTML = HTML.replace("T_TITLE",TranslationTexts.T_TITLE) + HTML = HTML.replace("T_DOCUMENTS",TranslationTexts.T_DOCUMENTS) + HTML = HTML.replace("T_HELP",TranslationTexts.T_HELP) + HTML = HTML.replace("T_ACTIVITY",TranslationTexts.T_ACTIVITY) + HTML = HTML.replace("T_RECENTFILES",TranslationTexts.T_RECENTFILES) + HTML = HTML.replace("T_TIP",TranslationTexts.T_TIP) + HTML = HTML.replace("T_ADJUSTRECENT",TranslationTexts.T_ADJUSTRECENT) + HTML = HTML.replace("T_GENERALDOCUMENTATION",TranslationTexts.T_GENERALDOCUMENTATION) + HTML = HTML.replace("T_USERHUB",TranslationTexts.T_USERHUB) + HTML = HTML.replace("T_DESCR_USERHUB",TranslationTexts.T_DESCR_USERHUB) + HTML = HTML.replace("T_POWERHUB",TranslationTexts.T_POWERHUB) + HTML = HTML.replace("T_DESCR_POWERHUB",TranslationTexts.T_DESCR_POWERHUB) + HTML = HTML.replace("T_DEVHUB",TranslationTexts.T_DEVHUB) + HTML = HTML.replace("T_DESCR_DEVHUB",TranslationTexts.T_DESCR_DEVHUB) + HTML = HTML.replace("T_MANUAL",TranslationTexts.T_MANUAL) + HTML = HTML.replace("T_DESCR_MANUAL",TranslationTexts.T_DESCR_MANUAL) + HTML = HTML.replace("T_WBHELP",TranslationTexts.T_WBHELP) + HTML = HTML.replace("T_DESCR_WBHELP",TranslationTexts.T_DESCR_WBHELP) + HTML = HTML.replace("T_COMMUNITYHELP",TranslationTexts.T_COMMUNITYHELP) + HTML = HTML.replace("T_DESCR_COMMUNITYHELP",TranslationTexts.T_DESCR_COMMUNITYHELP) + HTML = HTML.replace("T_ADDONS",TranslationTexts.T_ADDONS) + HTML = HTML.replace("T_DESCR_ADDONS",TranslationTexts.T_DESCR_ADDONS) + HTML = HTML.replace("T_OFFLINEHELP",TranslationTexts.T_OFFLINEHELP) + HTML = HTML.replace("T_OFFLINEPLACEHOLDER",TranslationTexts.T_OFFLINEPLACEHOLDER) + HTML = HTML.replace("T_RECENTCOMMITS",TranslationTexts.T_RECENTCOMMITS) + HTML = HTML.replace("T_DESCR_RECENTCOMMITS",TranslationTexts.T_DESCR_RECENTCOMMITS) + HTML = HTML.replace("T_SEEONGITHUB",TranslationTexts.T_SEEONGITHUB) + HTML = HTML.replace("T_CUSTOM",TranslationTexts.T_CUSTOM) + + + # build a "create new" icon with the FreeCAD background color gradient + + if not "createimg" in iconbank: + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/View") + c1 = gethexcolor(p.GetUnsigned("BackgroundColor2")) + c2 = gethexcolor(p.GetUnsigned("BackgroundColor3")) + gradient = QtGui.QLinearGradient(0, 0, 0, 128) + gradient.setColorAt(0.0, QtGui.QColor(c1)) + gradient.setColorAt(1.0, QtGui.QColor(c2)) + i = QtGui.QImage(128,128,QtGui.QImage.Format_RGB16) + pa = QtGui.QPainter(i) + pa.fillRect(i.rect(),gradient) + pa.end() + createimg = tempfile.mkstemp(suffix='.png')[1] + i.save(createimg) + iconbank["createimg"] = createimg + + + # build UL_RECENTFILES + + rf = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/RecentFiles") + rfcount = rf.GetInt("RecentFiles",0) + if rfcount: + UL_RECENTFILES = "
      " + for i in range(rfcount): + filename = rf.GetString("MRU%d" % (i)) + if os.path.exists(filename): + basename = os.path.basename(filename) + image,size,author = getInfo(filename) + if size: + UL_RECENTFILES += '
    • ' + UL_RECENTFILES += '' + UL_RECENTFILES += '' + UL_RECENTFILES += '' + UL_RECENTFILES += '
      ' + UL_RECENTFILES += '

      '+basename+'

      ' + UL_RECENTFILES += '

      '+size+'

      ' + UL_RECENTFILES += '

      '+author+'

      ' + UL_RECENTFILES += '
      ' + UL_RECENTFILES += '
    • ' + + UL_RECENTFILES += '
    • ' + UL_RECENTFILES += '' + UL_RECENTFILES += '' + UL_RECENTFILES += '' + UL_RECENTFILES += '
      ' + UL_RECENTFILES += '

      '+TranslationTexts.T_CREATENEW+'

      ' + UL_RECENTFILES += '
      ' + UL_RECENTFILES += '
    • ' + + UL_RECENTFILES += '
    ' + if sys.version_info.major < 3: + UL_RECENTFILES = UL_RECENTFILES.decode("utf8") + HTML = HTML.replace("UL_RECENTFILES",UL_RECENTFILES) + + + # build SECTION_EXAMPLES + + SECTION_EXAMPLES = "" + if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetBool("ShowExamples",True): + SECTION_EXAMPLES = "

    "+TranslationTexts.T_EXAMPLES+"

    " + SECTION_EXAMPLES += "
      " + for basename in os.listdir(FreeCAD.getResourceDir()+"examples"): + filename = FreeCAD.getResourceDir()+"examples"+os.sep+basename + image,size,author = getInfo(filename) + if size: + SECTION_EXAMPLES += '
    • ' + SECTION_EXAMPLES += '' + SECTION_EXAMPLES += '' + SECTION_EXAMPLES += '' + SECTION_EXAMPLES += '
      ' + SECTION_EXAMPLES += '

      '+basename+'

      ' + SECTION_EXAMPLES += '

      '+size+'

      ' + SECTION_EXAMPLES += '

      '+author+'

      ' + SECTION_EXAMPLES += '
      ' + SECTION_EXAMPLES += '
    • ' + SECTION_EXAMPLES += "
    " + if sys.version_info.major < 3: + SECTION_EXAMPLES = SECTION_EXAMPLES.decode("utf8") + HTML = HTML.replace("SECTION_EXAMPLES",SECTION_EXAMPLES) + + + # build SECTION_CUSTOM + + SECTION_CUSTOM = "" + cfolder = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetString("ShowCustomFolder","") + if cfolder: + if not os.path.isdir(cfolder): + cfolder = os.path.dirname(cfolder) + SECTION_CUSTOM = "

    "+os.path.basename(os.path.normpath(cfolder))+"

    " + SECTION_CUSTOM += "
      " + for basename in os.listdir(cfolder): + filename = os.path.join(cfolder,basename) + if isplainfile(filename): + image,size,author = getInfo(filename) + if size: + SECTION_CUSTOM += '
    • ' + SECTION_CUSTOM += '' + SECTION_CUSTOM += '' + SECTION_CUSTOM += '' + SECTION_CUSTOM += '
      ' + SECTION_CUSTOM += '

      '+basename+'

      ' + SECTION_CUSTOM += '

      '+size+'

      ' + SECTION_CUSTOM += '

      '+author+'

      ' + SECTION_CUSTOM += '
      ' + SECTION_CUSTOM += '
    • ' + SECTION_CUSTOM += "
    " + if sys.version_info.major < 3: + SECTION_CUSTOM = SECTION_CUSTOM.decode("utf8") + HTML = HTML.replace("SECTION_CUSTOM",SECTION_CUSTOM) + + + # build UL_WORKBENCHES + + UL_WORKBENCHES = '
      ' + FreeCAD.getResourceDir() + for wb in FreeCADGui.listWorkbenches().keys(): + if wb.endswith("Workbench"): + wn = wb[:-9] + if wb in iconbank: + img = iconbank[wb] + else: + img = os.path.join(FreeCAD.getResourceDir(),"data","Mod",wn,"Resources","icons",wn+"Workbench.svg") + if not os.path.exists(img): + w = FreeCADGui.listWorkbenches()[wb] + if hasattr(w,"Icon"): + xpm = w.Icon + if "XPM" in xpm: + r = [s[:-1].strip('"') for s in re.findall("(?s)\{(.*?)\};",xpm)[0].split("\n")[1:]] + p = QtGui.QPixmap(r) + p = p.scaled(24,24) + img = tempfile.mkstemp(suffix='.png')[1] + p.save(img) + else: + img = xpm + else: + img="images/freecad.png" + iconbank[wb] = img + UL_WORKBENCHES += '
    • ' + UL_WORKBENCHES += '' + UL_WORKBENCHES += ''+wn+'' + UL_WORKBENCHES += '

    • ' + UL_WORKBENCHES += '
    ' + HTML = HTML.replace("UL_WORKBENCHES",UL_WORKBENCHES) + + + # set and replace colors + + p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start") + if p.GetString("BackgroundImage",""): + BACKGROUND = gethexcolor(p.GetUnsigned("BackgroundColor1",1331197183))+" url("+p.GetString("BackgroundImage","")+")" + else: + BACKGROUND = gethexcolor(p.GetUnsigned("BackgroundColor1",1331197183)) + # linear gradient not supported by QT "linear-gradient("+gethexcolor(p.GetUnsigned("BackgroundColor1",1331197183))+","+gethexcolor(p.GetUnsigned("BackgroundColor2",2141107711))+")" + LINKCOLOR = gethexcolor(p.GetUnsigned("LinkColor",65535)) + BASECOLOR = gethexcolor(p.GetUnsigned("PageColor",4294967295)) + BOXCOLOR = gethexcolor(p.GetUnsigned("BoxColor",3722305023)) + TEXTCOLOR = gethexcolor(p.GetUnsigned("PageTextColor",255)) + BGTCOLOR = gethexcolor(p.GetUnsigned("BackgroundTextColor",4294703103)) + SHADOW = "#888888" + if QtGui.QColor(BASECOLOR).valueF() < 0.5: # dark page + SHADOW = "#000000" + + HTML = HTML.replace("BASECOLOR",BASECOLOR) + HTML = HTML.replace("BOXCOLOR",BOXCOLOR) + HTML = HTML.replace("LINKCOLOR",LINKCOLOR) + HTML = HTML.replace("TEXTCOLOR",TEXTCOLOR) + HTML = HTML.replace("BGTCOLOR",BGTCOLOR) + HTML = HTML.replace("BACKGROUND",BACKGROUND) + HTML = HTML.replace("SHADOW",SHADOW) + + + # enable web access if permitted + + if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start").GetBool("AllowDownload",False): + HTML = HTML.replace("var allowDownloads = 0;","var allowDownloads = 1;") + + # encode if necessary + + if sys.version_info.major < 3: + if isinstance(HTML,unicode): + HTML = HTML.encode("utf8") + + return HTML + + def exportTestFile(): + + "Allow to check if everything is Ok" + f = open(os.path.expanduser("~")+os.sep+"freecad-startpage.html","wb") f.write(handle()) f.close() + + +def postStart(): + + "executes needed operations after loading a file" + + param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Start") + + # switch workbench + wb = param.GetString("AutoloadModule","") + if wb: + FreeCADGui.activateWorkbench(wb) + + # close start tab + cl = param.GetBool("closeStart",False) + if cl: + title = QtGui.QApplication.translate("Workbench","Start page") + mw = FreeCADGui.getMainWindow() + if mw: + mdi = mw.findChild(QtGui.QMdiArea) + if mdi: + for mdichild in mdi.children(): + for subw in mdichild.findChildren(QtGui.QMdiSubWindow): + if subw.windowTitle() == title: + subw.close() + + diff --git a/src/Mod/Start/StartPage/TranslationTexts.py b/src/Mod/Start/StartPage/TranslationTexts.py index b33f897057..72c5f906b3 100644 --- a/src/Mod/Start/StartPage/TranslationTexts.py +++ b/src/Mod/Start/StartPage/TranslationTexts.py @@ -1,7 +1,7 @@ #*************************************************************************** #* * -#* Copyright (c) 2012 * -#* Yorik van Havre * +#* Copyright (c) 2012 * +#* Yorik van Havre * #* * #* This program is free software; you can redistribute it and/or modify * #* it under the terms of the GNU Lesser General Public License (LGPL) * @@ -25,8 +25,9 @@ import sys from PySide import QtGui def translate(context,text): + "convenience function for the Qt translator" - # return str(QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).toUtf8()) + try: _encoding = QtGui.QApplication.UnicodeUTF8 u = QtGui.QApplication.translate(context, text, None, _encoding) @@ -36,93 +37,40 @@ def translate(context,text): if sys.version_info.major < 3: u = u.encode("utf8") - # s = cStringIO.StringIO() - # for i in u: - # if sys.version_info.major > 2: #below only works correctly in python3 - # if i == 39: - # s.write("\\'") - # else: - # s.write(chr(i)) - # else: - # if ord(i) == 39: - # s.write(unicode("\\'")) - # else: - # s.write(unicode(i)) - # t = s.getvalue() - # s.close() - # return t - return u.replace(chr(39), "\\'") +T_TITLE = translate("StartPage", "Start") +T_DOCUMENTS = translate("StartPage", "Documents") +T_HELP = translate("StartPage", "Help") +T_ACTIVITY = translate("StartPage", "Activity") +T_RECENTFILES = translate("StartPage", "Recent files") +T_TIP = translate("StartPage", "Tip") +T_ADJUSTRECENT = translate("StartPage", "Adjust the number of recent files to be shown here in menu Edit -> Preferences -> General -> Size of recent file list") +T_EXAMPLES = translate("StartPage", "Examples") +T_GENERALDOCUMENTATION = translate("StartPage", "General documentation") +T_USERHUB = translate("StartPage", "User hub") +T_DESCR_USERHUB = translate("StartPage", "This section contains documentation useful for FreeCAD users in general: a list of all the workbenches, detailed instructions on how to install and use the FreeCAD application, tutorials, and all you need to get started.") +T_POWERHUB = translate("StartPage", "Power users hub") +T_DESCR_POWERHUB = translate("StartPage", "This section gathers documentation for advanced users and people interested in writing python scripts. You will also find there a repository of macros, instructions on how to install and use them, and more information about customizing FreeCAD to your specific needs.") +T_DEVHUB = translate("StartPage", "Developers hub") +T_DESCR_DEVHUB = translate("StartPage", "This section contains material for developers: How to compile FreeCAD yourself, how the FreeCAD source code is structured and how to navigate in it, and how to develop new workbenches, or embed FreeCAD in your own application.") +T_MANUAL = translate("StartPage", "Manual") +T_DESCR_MANUAL = translate("StartPage", "The FreeCAD manual is another, more linear way to present the information contained in this wiki. It is made to be read like a book, and will gently introduce you to many other pages from the hubs above. e-book versions are also available.") +T_WBHELP = translate("StartPage", "Workbenches help") +T_DESCR_WBHELP = translate("StartPage", "These are the help pages of all the workbenches currently installed on this computer") +T_COMMUNITYHELP = translate("StartPage", "Getting help from the community") +T_DESCR_COMMUNITYHELP = translate("StartPage", "

    The FreeCAD forum is a great place to get help from other FreeCAD users and developers. The forum has many sections for different types of issues and discussion subjects. If in doubt, post in the more general Help on using FreeCAD section.

    If it is the first time you are posting on the forum, be sure to read the guidelines first!

    FreeCAD also maintains a public bug tracker where anybody can submit bugs and propose new features. To avoid causing extra work and give the best chances to see your bug solved, make sure you read the bug submission guide before posting.

    ") +T_ADDONS = translate("StartPage", "Available addons") +T_DESCR_ADDONS = translate("StartPage", "Below is a list of available extra workbenches to be added to your FreeCAD installation. Browse and install them from menu Tools -> Addons mananger. You can learn more about any of them by clicking the links below.") +T_OFFLINEHELP = translate("StartPage", "If not bundled with your FreeCAD version, install the FreeCAD documentation package to get documentation hubs, workbench help and individual command documentation without an internet connection.") +T_OFFLINEPLACEHOLDER = translate("StartPage", "Cannot fetch information from GitHub. Authorize FreeCAD to access the internet and reload the Start page.") +T_RECENTCOMMITS = translate("StartPage", "Recent commits") +T_DESCR_RECENTCOMMITS = translate("StartPage", "Below are the latest changes added to the FreeCAD source code. These changes might not reflect yet in the FreeCAD version that you are currently running. Check the available options if you wish to obtain a development version.") +T_SEEONGITHUB = translate("StartPage", "See all commits on github") +T_CUSTOM = translate("StartPage", "You can configure a custom folder to display here in menu Edit -> Preferences -> Start -> Custom folder") +T_VERSION = translate("StartPage", "version") +T_BUILD = translate("StartPage", "build") +T_CREATENEW = translate("StartPage", "Create new...") +T_UNKNOWN = translate("StartPage", "Unknown") + -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 commits") -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 Part Design 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 Architectural Design 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 architectural objects.") -text25 = translate("StartPage", "Architectural Design") -text26 = translate("StartPage", "Working with Meshes") -text27 = translate("StartPage", "The Mesh Workbench 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 Complete 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://www.freecadweb.org/wiki/Online_Help_Toc") -text39 = translate("StartPage", "Tutorials") -text40 = translate("StartPage", "Python resources") -text41 = translate("StartPage", "File not found") -text42 = translate("StartPage", "from @FreeCADNews") -text43 = translate("StartPage", "The FreeCAD-tutorial blog") -text44 = translate("StartPage", "from FreeCADNews channel") -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 dedicated to python scripting, with examples, explanations, and API commands.") -text48 = translate("StartPage", "A blog dedicated to teaching FreeCAD, maintained by members of the FreeCAD community") -text49 = translate("StartPage", "Getting started") -text50 = translate("StartPage", "The FreeCAD interface is divided in workbenches, which are sets of tools suited for a specific task. You can start with one of the workbenches in this list, or with the complete workbench, which presents you with some of the most used tools gathered from other workbenches. Click to read more about workbenches on the FreeCAD website.") -text51 = translate("StartPage", "http://www.freecadweb.org/wiki/Getting_started") -text52 = translate("StartPage", "Ship Design") -text53 = translate("StartPage", "Designing and calculating ships") -text54 = translate("StartPage", "The Ship Design module offers several tools to help ship designers to view, model and calculate profiles and other specific properties of ship hulls.") -text55 = translate("StartPage", "Load an Architectural example model") -text56 = translate("StartPage", "http://www.freecadweb.org/wiki/Tutorials") -text57 = translate("StartPage", "http://www.freecadweb.org/wiki/Power_users_hub") -text58 = translate("StartPage", "Your version of FreeCAD is up to date.") -text59 = translate("StartPage", "There is a new release of FreeCAD available.") -text60 = translate("StartPage", "Load an FEM 3D example analysis") -text61 = translate("StartPage", "Obtain a development version") -text62 = translate("StartPage", "Development versions are made available by community members from time to time and usually contain the latest changes, but are more likely to contain bugs.") -text63 = translate("StartPage", "See all commits") -text64 = translate("StartPage", "Load an FEM 2D example analysis") -text65 = translate("StartPage", "FreeCAD Standard File") -text66 = translate("StartPage", "Author") -text67 = translate("StartPage", "Company") -text68 = translate("StartPage", "License") -text69 = translate("StartPage", "Load an FEM 3D new solver example analysis") -text70 = translate("StartPage", "Click here") -text71 = translate("StartPage", "to allow FreeCAD to access the internet") diff --git a/src/Mod/Start/StartPage/images/ArchDesign.png b/src/Mod/Start/StartPage/images/ArchDesign.png deleted file mode 100644 index 5ae3457e62..0000000000 Binary files a/src/Mod/Start/StartPage/images/ArchDesign.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/ArchExample.png b/src/Mod/Start/StartPage/images/ArchExample.png deleted file mode 100644 index ce6e233a1c..0000000000 Binary files a/src/Mod/Start/StartPage/images/ArchExample.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/Background.jpg b/src/Mod/Start/StartPage/images/Background.jpg deleted file mode 100644 index 5fa5511608..0000000000 Binary files a/src/Mod/Start/StartPage/images/Background.jpg and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/Banner.jpeg b/src/Mod/Start/StartPage/images/Banner.jpeg deleted file mode 100644 index 512b855713..0000000000 Binary files a/src/Mod/Start/StartPage/images/Banner.jpeg and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/Complete.png b/src/Mod/Start/StartPage/images/Complete.png deleted file mode 100755 index 4ab0e46164..0000000000 Binary files a/src/Mod/Start/StartPage/images/Complete.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/FreeCAD.png b/src/Mod/Start/StartPage/images/FreeCAD.png deleted file mode 100644 index 13674de03e..0000000000 Binary files a/src/Mod/Start/StartPage/images/FreeCAD.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/Mesh.png b/src/Mod/Start/StartPage/images/Mesh.png deleted file mode 100755 index 5032550443..0000000000 Binary files a/src/Mod/Start/StartPage/images/Mesh.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/PartDesign.png b/src/Mod/Start/StartPage/images/PartDesign.png deleted file mode 100755 index 368215b63d..0000000000 Binary files a/src/Mod/Start/StartPage/images/PartDesign.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/PartDesignExample.png b/src/Mod/Start/StartPage/images/PartDesignExample.png deleted file mode 100644 index db2b6ecde1..0000000000 Binary files a/src/Mod/Start/StartPage/images/PartDesignExample.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/Ship.png b/src/Mod/Start/StartPage/images/Ship.png deleted file mode 100644 index 533b3fcc53..0000000000 Binary files a/src/Mod/Start/StartPage/images/Ship.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/ShipExample.png b/src/Mod/Start/StartPage/images/ShipExample.png deleted file mode 100644 index be89b2f74a..0000000000 Binary files a/src/Mod/Start/StartPage/images/ShipExample.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/blank.png b/src/Mod/Start/StartPage/images/blank.png deleted file mode 100755 index ef2a9d0d6f..0000000000 Binary files a/src/Mod/Start/StartPage/images/blank.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/complete.jpg b/src/Mod/Start/StartPage/images/complete.jpg deleted file mode 100644 index 68c82d0304..0000000000 Binary files a/src/Mod/Start/StartPage/images/complete.jpg and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/developerhub.png b/src/Mod/Start/StartPage/images/developerhub.png new file mode 100644 index 0000000000..7cfde6975b Binary files /dev/null and b/src/Mod/Start/StartPage/images/developerhub.png differ diff --git a/src/Mod/Start/StartPage/images/freecad-doc.png b/src/Mod/Start/StartPage/images/freecad-doc.png deleted file mode 100644 index 900cb8b1ba..0000000000 Binary files a/src/Mod/Start/StartPage/images/freecad-doc.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/images/freecad.png b/src/Mod/Start/StartPage/images/freecad.png new file mode 100644 index 0000000000..25576e3f3f Binary files /dev/null and b/src/Mod/Start/StartPage/images/freecad.png differ diff --git a/src/Mod/Start/StartPage/images/manual.png b/src/Mod/Start/StartPage/images/manual.png new file mode 100644 index 0000000000..9aa7a5f2a7 Binary files /dev/null and b/src/Mod/Start/StartPage/images/manual.png differ diff --git a/src/Mod/Start/StartPage/images/poweruserhub.png b/src/Mod/Start/StartPage/images/poweruserhub.png new file mode 100644 index 0000000000..2b7c0a6fcd Binary files /dev/null and b/src/Mod/Start/StartPage/images/poweruserhub.png differ diff --git a/src/Mod/Start/StartPage/images/userhub.png b/src/Mod/Start/StartPage/images/userhub.png new file mode 100644 index 0000000000..dc4447c4ef Binary files /dev/null and b/src/Mod/Start/StartPage/images/userhub.png differ diff --git a/src/Mod/Start/StartPage/images/web.png b/src/Mod/Start/StartPage/images/web.png deleted file mode 100644 index c74603eca4..0000000000 Binary files a/src/Mod/Start/StartPage/images/web.png and /dev/null differ diff --git a/src/Mod/Start/StartPage/preferences.ui b/src/Mod/Start/StartPage/preferences.ui new file mode 100644 index 0000000000..256534339a --- /dev/null +++ b/src/Mod/Start/StartPage/preferences.ui @@ -0,0 +1,462 @@ + + + Form + + + + 0 + 0 + 500 + 507 + + + + Start page options + + + + + + Start page template + + + + + + An optional HTML template that will be used instead of the default start page. + + + Template + + + Mod/Start + + + + + + + + + + Start page options + + + + + + false + + + + 60 + 60 + + + + the down gradient for the background color (currently unsupported) + + + + 127 + 158 + 181 + + + + BackgroundColor2 + + + Mod/Start + + + + + + + Link color + + + + + + + + 60 + 60 + + + + the background of the main start page area + + + + 255 + 255 + 255 + + + + PageColor + + + Mod/Start + + + + + + + Box background color + + + + + + + + 60 + 60 + + + + the color of the links + + + + 0 + 0 + 255 + + + + LinkColor + + + Mod/Start + + + + + + + + 60 + 60 + + + + the color of the version text + + + + 255 + 251 + 247 + + + + BackgroundTextColor + + + Mod/Start + + + + + + + Background image + + + + + + + Background color + + + + + + + Page text color + + + + + + + + 60 + 60 + + + + the color of the text on he main pages + + + + 0 + 0 + 0 + + + + PageTextColor + + + Mod/Start + + + + + + + an optional image to display as background + + + BackgroundImage + + + Mod/Start + + + + + + + Page background color + + + + + + + Show examples folder contents + + + + + + + an optional custom folder to be displayed at the bottom of the first page + + + ShowCustomFolder + + + Mod/Start + + + + + + + Show additional folder + + + + + + + + 60 + 60 + + + + the background color of the boxes inside the pages + + + + 221 + 221 + 221 + + + + BoxColor + + + Mod/Start + + + + + + + + 60 + 60 + + + + the background color behind the panels + + + + 79 + 88 + 116 + + + + BackgroundColor1 + + + Mod/Start + + + + + + + + + false + + + in same page + + + true + + + InBrowser + + + Mod/Start + + + + + + + false + + + in external browser + + + InWeb + + + Mod/Start + + + + + + + + + if you want the examples to show on the first page + + + Qt::RightToLeft + + + + + + true + + + ShowExamples + + + Mod/Start + + + + + + + Background text color + + + + + + + false + + + Background color gradient down + + + + + + + false + + + Open links + + + + + + + Switch workbench after loading a file + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Gui::FileChooser + QWidget +
    Gui/FileDialog.h
    +
    + + Gui::ColorButton + QPushButton +
    Gui/Widgets.h
    +
    + + Gui::PrefFileChooser + Gui::FileChooser +
    Gui/PrefWidgets.h
    +
    + + Gui::PrefColorButton + Gui::ColorButton +
    Gui/PrefWidgets.h
    +
    + + Gui::PrefRadioButton + QRadioButton +
    Gui/PrefWidgets.h
    +
    + + Gui::PrefCheckBox + QCheckBox +
    Gui/PrefWidgets.h
    +
    +
    + + +