Gui: Remove references to the Addon Manager if no Std_AddonMgr (#23167)

* Gui: Remove references to the Addon Manager if no Std_AddonMgr

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Gui: Switch to disabling controls rather than hiding

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Chris Hennes
2025-09-22 11:20:07 -05:00
committed by GitHub
parent 707ee60d64
commit a23bd23159
5 changed files with 21 additions and 5 deletions

View File

@@ -124,6 +124,8 @@ DlgMacroExecuteImp::DlgMacroExecuteImp(QWidget* parent, Qt::WindowFlags fl)
}
fillUpList();
ui->LineEditFind->setFocus();
ui->addonsButton->setEnabled(
Application::Instance->commandManager().getCommandByName("Std_AddonMgr") != nullptr);
}
/**

View File

@@ -42,7 +42,12 @@ DlgPreferencePackManagementImp::DlgPreferencePackManagementImp(QWidget* parent)
, ui(new Ui_DlgPreferencePackManagement)
{
ui->setupUi(this);
connect(ui->pushButtonOpenAddonManager, &QPushButton::clicked, this, &DlgPreferencePackManagementImp::showAddonManager);
if (Application::Instance->commandManager().getCommandByName("Std_AddonMgr")) {
connect(ui->pushButtonOpenAddonManager, &QPushButton::clicked, this, &DlgPreferencePackManagementImp::showAddonManager);
}
else {
ui->pushButtonOpenAddonManager->setDisabled(true);
}
connect(this, &DlgPreferencePackManagementImp::packVisibilityChanged, this, &DlgPreferencePackManagementImp::updateTree);
updateTree();
}

View File

@@ -127,6 +127,8 @@ DlgSettingsGeneral::DlgSettingsGeneral( QWidget* parent )
const auto visible = UnitsApi::isMultiUnitLength();
ui->comboBox_FracInch->setVisible(visible);
ui->fractionalInchLabel->setVisible(visible);
ui->moreThemesLabel->setEnabled(
Application::Instance->commandManager().getCommandByName("Std_AddonMgr") != nullptr);
}
/**

View File

@@ -718,8 +718,10 @@ MenuItem* StdWorkbench::setupMenuBar() const
auto tool = new MenuItem( menuBar );
tool->setCommand("&Tools");
#ifdef BUILD_ADDONMGR
*tool << "Std_AddonMgr"
<< "Separator";
if (Application::Instance->commandManager().getCommandByName("Std_AddonMgr")) {
*tool << "Std_AddonMgr"
<< "Separator";
}
#endif
*tool << "Std_Measure"
<< "Std_ClarifySelection"

View File

@@ -236,8 +236,13 @@ bool ThemeSelectorWidget::eventFilter(QObject* object, QEvent* event)
void ThemeSelectorWidget::retranslateUi()
{
_titleLabel->setText(QLatin1String("<h2>") + tr("Theme") + QLatin1String("</h2>"));
_descriptionLabel->setText(tr("Looking for more themes? You can obtain them using "
"<a href=\"freecad:Std_AddonMgr\">Addon Manager</a>."));
if (Gui::Application::Instance->commandManager().getCommandByName("Std_AddonMgr")) {
_descriptionLabel->setText(tr("Looking for more themes? You can obtain them using "
"<a href=\"freecad:Std_AddonMgr\">Addon Manager</a>."));
}
else {
_descriptionLabel->hide();
}
_buttons[static_cast<int>(Theme::Dark)]->setText(tr("FreeCAD Dark", "Visual theme name"));
_buttons[static_cast<int>(Theme::Light)]->setText(tr("FreeCAD Light", "Visual theme name"));
_buttons[static_cast<int>(Theme::Classic)]->setText(tr("FreeCAD Classic", "Visual theme name"));