Start: Migrate to simple command
This commit is contained in:
@@ -95,7 +95,7 @@ macro(PrintFinalReport)
|
||||
value(BUILD_DRAFT)
|
||||
value(BUILD_DRAWING)
|
||||
value(BUILD_FEM)
|
||||
value(BUILD_WEB)
|
||||
value(BUILD_GUI)
|
||||
value(BUILD_HELP)
|
||||
value(BUILD_IDF)
|
||||
value(BUILD_IMPORT)
|
||||
|
||||
@@ -10,7 +10,6 @@ SET(PreferencePackTemplates_Files
|
||||
Path_Colors.cfg
|
||||
Shortcuts.cfg
|
||||
Sketcher_Colors.cfg
|
||||
Start_Colors.cfg
|
||||
TechDraw_Colors.cfg
|
||||
View.cfg
|
||||
Window_Colors.cfg
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<FCParameters>
|
||||
<FCParamGroup Name="Root">
|
||||
<FCParamGroup Name="BaseApp">
|
||||
<FCParamGroup Name="Preferences">
|
||||
<FCParamGroup Name="Mod">
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1414812927"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294967295"/>
|
||||
<FCUInt Name="PageColor" Value="690563583"/>
|
||||
<FCUInt Name="PageTextColor" Value="3789677055"/>
|
||||
<FCUInt Name="BoxColor" Value="1296911871"/>
|
||||
<FCUInt Name="LinkColor" Value="3099197439"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
</FCParameters>
|
||||
@@ -35,15 +35,6 @@
|
||||
<FCUInt Name="DefaultBBoxSelectionColor" Value="3372220415"/>
|
||||
<FCUInt Name="DefaultBBoxNormalColor" Value="4294967295"/>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1331197183"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="1600086015"/>
|
||||
<FCUInt Name="PageColor" Value="4294967295"/>
|
||||
<FCUInt Name="PageTextColor" Value="255"/>
|
||||
<FCUInt Name="BoxColor" Value="3722305023"/>
|
||||
<FCUInt Name="LinkColor" Value="65535"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#feff9e</FCText>
|
||||
<FCText Name="TextColor">#000000</FCText>
|
||||
|
||||
@@ -23,15 +23,6 @@
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#9b4de6</FCText>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1010580735"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="858993663"/>
|
||||
<FCUInt Name="PageTextColor" Value="3570717951"/>
|
||||
<FCUInt Name="BoxColor" Value="1583243007"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="OutputWindow">
|
||||
<FCUInt Name="colorText" Value="3570717951"/>
|
||||
|
||||
@@ -23,15 +23,6 @@
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#9b4de6</FCText>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1010580735"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="858993663"/>
|
||||
<FCUInt Name="PageTextColor" Value="3570717951"/>
|
||||
<FCUInt Name="BoxColor" Value="1583243007"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="OutputWindow">
|
||||
<FCUInt Name="colorText" Value="3570717951"/>
|
||||
|
||||
@@ -23,15 +23,6 @@
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#9b4de6</FCText>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1010580735"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="858993663"/>
|
||||
<FCUInt Name="PageTextColor" Value="3570717951"/>
|
||||
<FCUInt Name="BoxColor" Value="1583243007"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="OutputWindow">
|
||||
<FCUInt Name="colorText" Value="3570717951"/>
|
||||
|
||||
@@ -23,15 +23,6 @@
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#9b4de6</FCText>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1010580735"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="858993663"/>
|
||||
<FCUInt Name="PageTextColor" Value="3570717951"/>
|
||||
<FCUInt Name="BoxColor" Value="1583243007"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="OutputWindow">
|
||||
<FCUInt Name="colorText" Value="3570717951"/>
|
||||
|
||||
@@ -23,15 +23,6 @@
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#9b4de6</FCText>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1010580735"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="858993663"/>
|
||||
<FCUInt Name="PageTextColor" Value="3570717951"/>
|
||||
<FCUInt Name="BoxColor" Value="1583243007"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="OutputWindow">
|
||||
<FCUInt Name="colorText" Value="3570717951"/>
|
||||
|
||||
@@ -4,15 +4,6 @@
|
||||
<FCParamGroup Name="BaseApp">
|
||||
<FCParamGroup Name="Preferences">
|
||||
<FCParamGroup Name="Mod">
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="4143380223"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="4294967295"/>
|
||||
<FCUInt Name="PageTextColor" Value="255"/>
|
||||
<FCUInt Name="BoxColor" Value="3974950143"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#feff9e</FCText>
|
||||
</FCParamGroup>
|
||||
|
||||
@@ -4,15 +4,6 @@
|
||||
<FCParamGroup Name="BaseApp">
|
||||
<FCParamGroup Name="Preferences">
|
||||
<FCParamGroup Name="Mod">
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="4143380223"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="4294967295"/>
|
||||
<FCUInt Name="PageTextColor" Value="255"/>
|
||||
<FCUInt Name="BoxColor" Value="3974950143"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#feff9e</FCText>
|
||||
</FCParamGroup>
|
||||
|
||||
@@ -23,15 +23,6 @@
|
||||
<FCParamGroup Name="Spreadsheet">
|
||||
<FCText Name="AliasedCellBackgroundColor">#9b4de6</FCText>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="Start">
|
||||
<FCUInt Name="BackgroundColor1" Value="1010580735"/>
|
||||
<FCUInt Name="BackgroundTextColor" Value="4294703103"/>
|
||||
<FCUInt Name="PageColor" Value="858993663"/>
|
||||
<FCUInt Name="PageTextColor" Value="3570717951"/>
|
||||
<FCUInt Name="BoxColor" Value="1583243007"/>
|
||||
<FCUInt Name="LinkColor" Value="1437270015"/>
|
||||
<FCUInt Name="BackgroundColor2" Value="2141107711"/>
|
||||
</FCParamGroup>
|
||||
</FCParamGroup>
|
||||
<FCParamGroup Name="OutputWindow">
|
||||
<FCUInt Name="colorText" Value="3570717951"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
/****************************************************************************
|
||||
* *
|
||||
# Copyright (c) 2024 The FreeCAD Project Association AISBL *
|
||||
* Copyright (c) 2024 The FreeCAD Project Association AISBL *
|
||||
* *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <3rdParty/GSL/include/gsl/pointers>
|
||||
|
||||
#include "Workbench.h"
|
||||
#include "Manipulator.h"
|
||||
|
||||
void loadStartResource()
|
||||
{
|
||||
@@ -73,7 +73,8 @@ PyMOD_INIT_FUNC(StartGui)
|
||||
{
|
||||
Base::Console().Log("Loading GUI of Start module... ");
|
||||
PyObject* mod = StartGui::initModule();
|
||||
StartGui::Workbench::init();
|
||||
auto manipulator = std::make_shared<StartGui::Manipulator>();
|
||||
Gui::WorkbenchManipulator::installManipulator(manipulator);
|
||||
loadStartResource();
|
||||
Base::Console().Log("done\n");
|
||||
|
||||
|
||||
@@ -23,17 +23,14 @@
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
${XercesC_INCLUDE_DIRS}
|
||||
${PYTHON_INCLUDE_DIRS}
|
||||
${QtCore_INCLUDE_DIRS}
|
||||
${QtWidgets_INCLUDE_DIRS}
|
||||
${QtSvg_INCLUDE_DIRS}
|
||||
#${QtNetwork_INCLUDE_DIRS}
|
||||
${QtUiTools_INCLUDE_DIRS}
|
||||
#${QtQuick_INCLUDE_DIRS}
|
||||
#${QtQuickWidgets_INCLUDE_DIRS}
|
||||
${QtWidgets_INCLUDE_DIRS}
|
||||
${XercesC_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
set(StartGui_LIBS
|
||||
@@ -52,17 +49,16 @@ SET(StartGui_SRCS
|
||||
${Start_QRC_SRCS}
|
||||
${StartGui_UIC_SRCS}
|
||||
AppStartGui.cpp
|
||||
Command.cpp
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
StartView.cpp
|
||||
StartView.h
|
||||
FileCardDelegate.cpp
|
||||
FileCardDelegate.h
|
||||
FileCardView.cpp
|
||||
FileCardView.h
|
||||
Workbench.cpp
|
||||
Workbench.h
|
||||
Manipulator.cpp
|
||||
Manipulator.h
|
||||
PreCompiled.cpp
|
||||
PreCompiled.h
|
||||
StartView.cpp
|
||||
StartView.h
|
||||
)
|
||||
|
||||
SET(StartGuiIcon_SVG
|
||||
|
||||
@@ -22,17 +22,22 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#include <QCoreApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QLayout>
|
||||
#endif
|
||||
|
||||
#include "Manipulator.h"
|
||||
#include "StartView.h"
|
||||
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/MenuManager.h>
|
||||
|
||||
#include <3rdParty/GSL/include/gsl/pointers>
|
||||
|
||||
#include "Workbench.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
DEF_STD_CMD(CmdStart)
|
||||
|
||||
CmdStart::CmdStart()
|
||||
@@ -50,13 +55,24 @@ CmdStart::CmdStart()
|
||||
void CmdStart::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
StartGui::Workbench::loadStart();
|
||||
auto mw = Gui::getMainWindow();
|
||||
auto doc = Gui::Application::Instance->activeDocument();
|
||||
auto existingView = mw->findChild<StartGui::StartView*>(QLatin1String("StartView"));
|
||||
if (!existingView) {
|
||||
existingView = gsl::owner<StartGui::StartView*>(new StartGui::StartView(doc, mw));
|
||||
mw->addWindow(existingView); // Transfers ownership
|
||||
}
|
||||
Gui::getMainWindow()->setActiveWindow(existingView);
|
||||
existingView->show();
|
||||
}
|
||||
|
||||
|
||||
void CreateStartCommands()
|
||||
void StartGui::Manipulator::modifyMenuBar(Gui::MenuItem* menuBar)
|
||||
{
|
||||
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto newCommand = gsl::owner<CmdStart*>(new CmdStart);
|
||||
rcCmdMgr.addCommand(newCommand); // Transfer ownership
|
||||
Gui::MenuItem* helpMenu = menuBar->findItem("&Help");
|
||||
Gui::MenuItem* loadStart = new Gui::MenuItem();
|
||||
loadStart->setCommand("Start_Start");
|
||||
helpMenu->appendItem(loadStart);
|
||||
}
|
||||
@@ -21,44 +21,23 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FREECAD_MANIPULATOR_H
|
||||
#define FREECAD_MANIPULATOR_H
|
||||
|
||||
#ifndef LAUNCHERGUI_WORKBENCH_H
|
||||
#define LAUNCHERGUI_WORKBENCH_H
|
||||
|
||||
#include <Gui/Workbench.h>
|
||||
#include <memory>
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
class MDIView;
|
||||
}
|
||||
#include <Gui/WorkbenchManipulator.h>
|
||||
|
||||
namespace StartGui
|
||||
{
|
||||
|
||||
class Workbench: public Gui::StdWorkbench
|
||||
class Manipulator: public Gui::WorkbenchManipulator
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE(); // NOLINT
|
||||
|
||||
public:
|
||||
Workbench() = default;
|
||||
|
||||
/** Run some actions when the workbench gets activated. */
|
||||
void activated() override;
|
||||
|
||||
static void loadStart();
|
||||
|
||||
protected:
|
||||
/** Defines the standard menus. */
|
||||
Gui::MenuItem* setupMenuBar() const override;
|
||||
/** Defines the standard toolbars. */
|
||||
Gui::ToolBarItem* setupToolBars() const override;
|
||||
/** Defines the standard command bars. */
|
||||
Gui::ToolBarItem* setupCommandBars() const override;
|
||||
/** Returns a DockWindowItems structure of dock windows this workbench. */
|
||||
Gui::DockWindowItems* setupDockWindows() const override;
|
||||
|
||||
}; // class Workbench
|
||||
/*!
|
||||
* This manipulator injects the command to load the start page into the Help menu.
|
||||
*/
|
||||
void modifyMenuBar(Gui::MenuItem* menuBar) override;
|
||||
};
|
||||
|
||||
} // namespace StartGui
|
||||
#endif // LAUNCHERGUI_WORKBENCH_H
|
||||
|
||||
#endif // FREECAD_MANIPULATOR_H
|
||||
@@ -1,87 +0,0 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Copyright (c) 2024 The FreeCAD Project Association AISBL *
|
||||
* *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
#include <QCoreApplication>
|
||||
#include <QLayout>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/DockWindowManager.h>
|
||||
#include <Gui/MDIView.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/ToolBarManager.h>
|
||||
|
||||
#include "Workbench.h"
|
||||
#include "StartView.h"
|
||||
|
||||
#include <3rdParty/GSL/include/gsl/pointers>
|
||||
|
||||
using namespace StartGui;
|
||||
|
||||
TYPESYSTEM_SOURCE(StartGui::Workbench, Gui::StdWorkbench) // NOLINT
|
||||
|
||||
void StartGui::Workbench::activated()
|
||||
{
|
||||
loadStart();
|
||||
}
|
||||
|
||||
void StartGui::Workbench::loadStart()
|
||||
{
|
||||
auto mw = Gui::getMainWindow();
|
||||
auto doc = Gui::Application::Instance->activeDocument();
|
||||
auto existingView = mw->findChild<StartView*>(QLatin1String("StartView"));
|
||||
if (!existingView) {
|
||||
existingView = gsl::owner<StartView*>(new StartView(doc, mw));
|
||||
mw->addWindow(existingView); // Transfers ownership
|
||||
}
|
||||
Gui::getMainWindow()->setActiveWindow(existingView);
|
||||
existingView->show();
|
||||
}
|
||||
|
||||
Gui::MenuItem* StartGui::Workbench::setupMenuBar() const
|
||||
{
|
||||
return Gui::StdWorkbench::setupMenuBar();
|
||||
}
|
||||
|
||||
Gui::ToolBarItem* StartGui::Workbench::setupToolBars() const
|
||||
{
|
||||
return Gui::StdWorkbench::setupToolBars();
|
||||
}
|
||||
|
||||
Gui::ToolBarItem* StartGui::Workbench::setupCommandBars() const
|
||||
{
|
||||
return Gui::StdWorkbench::setupCommandBars();
|
||||
}
|
||||
|
||||
Gui::DockWindowItems* StartGui::Workbench::setupDockWindows() const
|
||||
{
|
||||
Gui::DockWindowItems* root = Gui::StdWorkbench::setupDockWindows();
|
||||
root->setVisibility(false); // hide all dock windows by default
|
||||
root->setVisibility("Std_ComboView", true); // except of the combo view
|
||||
root->setVisibility("Std_TaskView", true); // and the task view
|
||||
return root;
|
||||
}
|
||||
@@ -21,31 +21,4 @@
|
||||
# *
|
||||
# **************************************************************************/
|
||||
|
||||
|
||||
class StartWorkbench(Workbench):
|
||||
"StartWorkbench workbench"
|
||||
|
||||
def __init__(self):
|
||||
self.__class__.Icon = (
|
||||
FreeCAD.getResourceDir() + "Mod/Start/Resources/icons/StartWorkbench.svg"
|
||||
)
|
||||
self.__class__.MenuText = "Start"
|
||||
self.__class__.ToolTip = "Start workbench"
|
||||
|
||||
def Initialize(self):
|
||||
import StartGui
|
||||
|
||||
def Activated(self):
|
||||
pass
|
||||
|
||||
def Deactivated(self):
|
||||
pass
|
||||
|
||||
def ContextMenu(self, recipient):
|
||||
pass
|
||||
|
||||
def GetClassName(self):
|
||||
return "StartGui::Workbench"
|
||||
|
||||
|
||||
Gui.addWorkbench(StartWorkbench())
|
||||
import StartGui
|
||||
|
||||
Reference in New Issue
Block a user