62c3836c.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From 62c3836c97a56db24e3ef567a31eba2d0893b945 Mon Sep 17 00:00:00 2001
  2. From: Ladislav Michl <ladis@linux-mips.org>
  3. Date: Tue, 23 Jan 2024 12:46:32 +0100
  4. Subject: [PATCH] Addon Manager: Qt6 fixes
  5. ---
  6. src/Mod/AddonManager/addonmanager_utilities.py | 4 ++--
  7. src/Mod/AddonManager/change_branch.py | 2 +-
  8. src/Mod/AddonManager/package_details.py | 7 +++----
  9. src/Mod/AddonManager/package_list.py | 7 +++----
  10. 4 files changed, 9 insertions(+), 11 deletions(-)
  11. diff --git a/src/Mod/AddonManager/addonmanager_utilities.py b/src/Mod/AddonManager/addonmanager_utilities.py
  12. index 9ceabc2e9add..183a2047b086 100644
  13. --- a/src/Mod/AddonManager/addonmanager_utilities.py
  14. +++ b/src/Mod/AddonManager/addonmanager_utilities.py
  15. @@ -36,7 +36,7 @@
  16. from urllib.parse import urlparse
  17. try:
  18. - from PySide import QtCore, QtWidgets
  19. + from PySide import QtCore, QtGui, QtWidgets
  20. except ImportError:
  21. QtCore = None
  22. QtWidgets = None
  23. @@ -245,7 +245,7 @@ def get_readme_html_url(repo):
  24. def is_darkmode() -> bool:
  25. """Heuristics to determine if we are in a darkmode stylesheet"""
  26. pl = fci.FreeCADGui.getMainWindow().palette()
  27. - return pl.color(pl.Background).lightness() < 128
  28. + return pl.color(QtGui.QPalette.Window).lightness() < 128
  29. def warning_color_string() -> str:
  30. diff --git a/src/Mod/AddonManager/change_branch.py b/src/Mod/AddonManager/change_branch.py
  31. index 332795a22afc..ebe1819bc755 100644
  32. --- a/src/Mod/AddonManager/change_branch.py
  33. +++ b/src/Mod/AddonManager/change_branch.py
  34. @@ -216,7 +216,7 @@ def data(self, index: QtCore.QModelIndex, role: int = QtCore.Qt.DisplayRole):
  35. dd = self.display_data[row]
  36. if column == 3 or column == 4:
  37. if dd[column] is not None:
  38. - qdate = QtCore.QDateTime.fromTime_t(dd[column])
  39. + qdate = QtCore.QDateTime.fromSecsSinceEpoch(dd[column])
  40. return QtCore.QLocale().toString(qdate, QtCore.QLocale.ShortFormat)
  41. elif column < len(dd):
  42. return dd[column]
  43. diff --git a/src/Mod/AddonManager/package_details.py b/src/Mod/AddonManager/package_details.py
  44. index 93dfb8bee962..8310b5e90343 100644
  45. --- a/src/Mod/AddonManager/package_details.py
  46. +++ b/src/Mod/AddonManager/package_details.py
  47. @@ -133,10 +133,9 @@ def display_repo_status(self, status):
  48. date = ""
  49. installed_version_string = "<h3>"
  50. if repo.updated_timestamp:
  51. - date = (
  52. - QtCore.QDateTime.fromTime_t(repo.updated_timestamp)
  53. - .date()
  54. - .toString(QtCore.Qt.SystemLocaleShortDate)
  55. + date = QtCore.QLocale().toString(
  56. + QtCore.QDateTime.fromSecsSinceEpoch(int(round(repo.updated_timestamp, 0))),
  57. + QtCore.QLocale.ShortFormat,
  58. )
  59. if version and date:
  60. installed_version_string += (
  61. diff --git a/src/Mod/AddonManager/package_list.py b/src/Mod/AddonManager/package_list.py
  62. index a9dd3dc59856..d26b4f5489c3 100644
  63. --- a/src/Mod/AddonManager/package_list.py
  64. +++ b/src/Mod/AddonManager/package_list.py
  65. @@ -465,10 +465,9 @@ def get_expanded_update_string(repo: Addon) -> str:
  66. installed_date_string = (
  67. "<br/>" + translate("AddonsInstaller", "Installed on") + ": "
  68. )
  69. - installed_date_string += (
  70. - QtCore.QDateTime.fromTime_t(repo.updated_timestamp)
  71. - .date()
  72. - .toString(QtCore.Qt.SystemLocaleShortDate)
  73. + installed_date_string += QtCore.QLocale().toString(
  74. + QtCore.QDateTime.fromSecsSinceEpoch(int(round(repo.updated_timestamp, 0))),
  75. + QtCore.QLocale.ShortFormat,
  76. )
  77. available_version_string = ""