Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"qtForPython.uic.liveExecution.enabled" : false ,

"files.associations" : {
"*.ts" : "xml"
},

"search.exclude" : {
"uv.lock" : true
}
}
6 changes: 2 additions & 4 deletions AddonManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@
from Widgets.addonmanager_widget_progress_bar import Progress
from package_list import PackageListItemModel
from Addon import Addon, cycle_to_sub_addon, MissingDependencies
from addonmanager_python_deps_gui import (
PythonPackageManagerGui,
)
from Manager.Dependencies import DependenciesDialog
from addonmanager_firstrun import FirstRunDialog
from addonmanager_connection_checker import ConnectionCheckerGUI

Expand Down Expand Up @@ -480,7 +478,7 @@ def check_missing_dependencies(self) -> None:

def show_python_updates_dialog(self) -> None:
if not self.manage_python_packages_dialog:
self.manage_python_packages_dialog = PythonPackageManagerGui(self.item_model.repos)
self.manage_python_packages_dialog = DependenciesDialog(self.item_model.repos)
self.manage_python_packages_dialog.show()

def fetch_addon_stats(self) -> None:
Expand Down
1 change: 0 additions & 1 deletion AddonManagerTest/data/DoNothing.FCMacro
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-

__Title__ = 'Do Nothing'
__Author__ = 'Chris Hennes'
Expand Down
2 changes: 1 addition & 1 deletion AddonManagerTest/data/macro_template.FCStd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: LGPL-2.1-or-later

# ***************************************************************************
# * Copyright (c) 2022 FreeCAD Project Association *
Expand Down
2 changes: 1 addition & 1 deletion AddonManagerTest/data/missing_macro_metadata.FCStd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: LGPL-2.1-or-later

# ***************************************************************************
# * Copyright (c) 2022 FreeCAD Project Association *
Expand Down
4 changes: 2 additions & 2 deletions AddonManagerTest/gui/test_python_deps_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from PySideWrapper import QtCore, QtWidgets


from addonmanager_python_deps_gui import PythonPackageManagerGui
from Manager.Dependencies import DependenciesDialog


class TestPythonPackageManagerGui(unittest.TestCase):

def setUp(self) -> None:
self.manager = PythonPackageManagerGui([])
self.manager = DependenciesDialog([])


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ SET(AddonManager_SRCS
progress.ui
proxy_authentication.ui
PySideWrapper.py
PythonDependencyUpdateDialog.ui
select_toolbar_dialog.ui
TestAddonManagerApp.py
TestAddonManagerGui.py
toolbar_button.ui
update_all_progress.ui
update_all.ui
Manager/Dependencies.py
Manager/Dependencies.ui
)

SOURCE_GROUP("" FILES ${AddonManager_SRCS})
Expand Down
126 changes: 126 additions & 0 deletions Manager/Dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# ***************************************************************************
# * *
# * Copyright (c) 2022-2025 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/>. *
# * *
# ***************************************************************************

'''
UI for managing Python dependencies.
'''

from addonmanager_freecad_interface import loadUi
from addonmanager_python_deps import PythonPackageListModel
from PySideWrapper import QtWidgets , QtGui
from os.path import dirname , join


ResizeToContents = QtWidgets.QHeaderView.ResizeMode.ResizeToContents
openUrl = QtGui.QDesktopServices.openUrl


class UI ( QtWidgets.QDialog ):

Location_Copy : QtWidgets.QPushButton
Location_Open : QtWidgets.QPushButton
Location_Path : QtWidgets.QLabel

Update_Progress : QtWidgets.QLabel
Update_All : QtWidgets.QPushButton
tableView : QtWidgets.QTableView


class DependenciesDialog :

model : PythonPackageListModel
ui : UI

def __init__ ( self , addons : list[ object ] ):

path = join(dirname(__file__),'Dependencies.ui')

self.ui = loadUi(path) # type: ignore

self.model = PythonPackageListModel(addons)

table = self.ui.tableView
table.setModel(self.model)

header = table.horizontalHeader()
header.setStretchLastSection(True)
header.setSectionResizeMode(ResizeToContents)

self.ui.Location_Copy.clicked.connect(self._onLocationCopy)
self.ui.Location_Open.clicked.connect(self._onLocationOpen)

self.ui.Update_All.clicked.connect(self._onUpdateAll)

self.model.update_complete.connect(self._onUpdateComplete)
self.model.modelReset.connect(self._onModelReset)

def show ( self ):

self.ui.Update_Progress.show()
self.ui.Update_All.setEnabled(False)

self.model.reset_package_list()

self.ui.Location_Path.setText(self.path)

self.ui.exec()

# Properties

@property
def path ( self ):
return self.model.vendor_path

# Events

def _onLocationCopy ( self ):

text = self.path

clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText(text,mode = clipboard.Mode.Clipboard)

if clipboard.supportsSelection() :
clipboard.setText(text,mode = clipboard.Mode.Selection)

def _onLocationOpen ( self ):
openUrl(self.path)

def _onUpdateComplete ( self ):
self.ui.Update_Progress.hide()
self.model.reset_package_list()

def _onUpdateAll ( self ):
self.ui.Update_All.setEnabled(False)
self.ui.Update_Progress.show()
self.model.update_all_packages()

def _onModelReset ( self ):

self.ui.Update_Progress.hide()

hasUpdates = self.model.updates_are_available()

self.ui.Update_All.setEnabled(hasUpdates)


Loading
Loading