From 936a9814cfcfa3758e07be4a0b7c9208dbf06e8c Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sat, 10 Feb 2024 19:08:36 +0330 Subject: [PATCH 1/9] fix AttributeError (handled) in getScreenSize and getWorkAreaSize AttributeError: NoneType object has no attribute get_geometry happened on Python 3.12.0, gi 3.46.0 also tested on 3.11.4, gi 3.44.1 --- scal3/ui_gtk/gtk_ud.py | 46 ++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/scal3/ui_gtk/gtk_ud.py b/scal3/ui_gtk/gtk_ud.py index 5270217ef..98e7a3547 100644 --- a/scal3/ui_gtk/gtk_ud.py +++ b/scal3/ui_gtk/gtk_ud.py @@ -529,17 +529,38 @@ def setDefault_adjustTimeCmd(): ############################################################ +def getMonitor(): + display = gdk.Display.get_default() + + monitor = display.get_monitor_at_point(1, 1) + if monitor is not None: + log.debug("getMonitor: using get_monitor_at_point") + return monitor + + monitor = display.get_primary_monitor() + if monitor is not None: + log.debug("getMonitor: using get_primary_monitor") + return monitor + + monitor = display.get_monitor_at_window(gdk.get_default_root_window()) + if monitor is not None: + log.debug("getMonitor: using get_monitor_at_window") + return monitor + + return None def getScreenSize(): # includes panels/docks - monitor = gdk.Display.get_default().get_primary_monitor() + monitor = getMonitor() + if monitor is None: + return None rect = monitor.get_geometry() return rect.width, rect.height - -def getWorkAreaSize(): - # excludes panels/docks - monitor = gdk.Display.get_default().get_primary_monitor() +def getWorkAreaSize() -> "tuple[int, int] | None": + monitor = getMonitor() + if monitor is None: + return None rect = monitor.get_workarea() return rect.width, rect.height @@ -547,14 +568,17 @@ def getWorkAreaSize(): rootWindow = gdk.get_default_root_window() - -try: - screenW, screenH = getScreenSize() - workAreaW, workAreaH = getWorkAreaSize() -except AttributeError: - log.exception("") +_screenSize = getScreenSize() +_workAreaSize = getWorkAreaSize() +if _screenSize is None: screenW, screenH = rootWindow.get_width(), rootWindow.get_height() +else: + screenW, screenH = _screenSize +if _workAreaSize is None: workAreaW, workAreaH = screenW, screenH +else: + workAreaW, workAreaH = _workAreaSize + # print(f"screen: {screenW}x{screenH}, work area: {workAreaW}x{workAreaH}") # for normal windows, we should use workAreaW and workAreaH From 492539b1d6fcafa85f17aa029e28b5914a705dcb Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sat, 10 Feb 2024 19:24:31 +0330 Subject: [PATCH 2/9] mark Python 3.12 as supported --- distro/base/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distro/base/install.sh b/distro/base/install.sh index 3bd8c9224..0db536964 100755 --- a/distro/base/install.sh +++ b/distro/base/install.sh @@ -85,7 +85,7 @@ if [ -z "$pyCmd" ] ; then fi fi if which "$pyCmd" && \ -"$pyCmd" -c 'import sys;exit((3, 8) <= sys.version_info < (3, 12))' ; then +"$pyCmd" -c 'import sys;exit((3, 8) <= sys.version_info < (3, 13))' ; then pyVer=$("$pyCmd" --version) printf "\e[31mWarning: %s is not officially supported.\e[m\n" "$pyVer" >&2 printf "\e[31mPress Enter to continue anyway.\e[m\n" >&2 From 99ae422c14b3c55f2dcdb39bbb6741342f7a54e7 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Fri, 23 Feb 2024 22:44:13 +0330 Subject: [PATCH 3/9] update codeql action --- .github/workflows/codeql-analysis.yml | 81 ++++++++++++++++----------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d422805d4..9389e3bb9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,58 +13,71 @@ name: "CodeQL" on: push: - branches: [ main, next ] + branches: ["main", "next"] pull_request: - # The branches below must be a subset of the branches above - branches: [ main, next ] + branches: ["main"] schedule: - - cron: '26 19 * * 2' + - cron: "30 16 * * 6" jobs: analyze: name: Analyze - runs-on: ubuntu-latest + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories actions: read contents: read - security-events: write strategy: fail-fast: false matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://git.io/codeql-language-support + language: ["python"] + # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] + # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - #- run: | - # make bootstrap - # make release + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From a800ec993540c3703c79c4396dbccb1cde109648 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sat, 2 Mar 2024 01:10:20 +0330 Subject: [PATCH 4/9] fix broken VcsDailyStatEvent --- scal3/event_lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scal3/event_lib.py b/scal3/event_lib.py index d6681b541..c4d678bed 100644 --- a/scal3/event_lib.py +++ b/scal3/event_lib.py @@ -5547,7 +5547,7 @@ def calcOccurrence(self, startJd: int, endJd: int) -> OccurSet: jd = self.jd if jd is not None: if startJd <= jd < endJd: - JdOccurSet({jd}) + return JdOccurSet({jd}) return JdOccurSet() From 0a8d36a29b4b07764e375fe7abb40df5834cd100 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Thu, 21 Mar 2024 17:50:56 +0330 Subject: [PATCH 5/9] bug fix in Right Panel: mainWinRightPanelResizeOnToggle not saved --- scal3/ui.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scal3/ui.py b/scal3/ui.py index cadae1bbc..f9f2dea9d 100644 --- a/scal3/ui.py +++ b/scal3/ui.py @@ -140,6 +140,7 @@ "mainWinRightPanelPluginsFont", "mainWinRightPanelEventJustification", "mainWinRightPanelPluginsJustification", + "mainWinRightPanelResizeOnToggle", "mainWinRightPanelEventSep", "eventDayViewEventSep", "mainWinRightPanelBorderWidth", From a495e554faf4770fe7eecf071289acc363b9707a Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Thu, 27 Jun 2024 22:37:37 +0330 Subject: [PATCH 6/9] remove unused math.log import in scal3/event_search_tree.py --- scal3/event_search_tree.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scal3/event_search_tree.py b/scal3/event_search_tree.py index 1c62c5bf6..82ec5241a 100644 --- a/scal3/event_search_tree.py +++ b/scal3/event_search_tree.py @@ -22,7 +22,6 @@ log = logger.get() import sys -from math import log from scal3.time_utils import * from scal3.bin_heap import MaxHeap From 43133478360fd8d4bb4cdd8fca39e367c18467bc Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Thu, 27 Jun 2024 23:11:01 +0330 Subject: [PATCH 7/9] fix shellcheck error in install-pip --- install-pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-pip b/install-pip index 0fcd0467c..192344de1 100755 --- a/install-pip +++ b/install-pip @@ -6,7 +6,7 @@ set -x -if [ $(id -u) != "0" ] ; then +if [ "$(id -u)" != "0" ] ; then echo "Run this script as root" >&2 exit 1 fi From b280d3e0b6b9c611e8f00e42706edc5bea53195a Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Thu, 27 Jun 2024 23:12:43 +0330 Subject: [PATCH 8/9] fix install-pip: no `./install` --- install-pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-pip b/install-pip index 192344de1..cabb4df15 100755 --- a/install-pip +++ b/install-pip @@ -36,5 +36,5 @@ $PIP install pygit2 if [ -f /bin/freebsd-version ] ; then ./distro/base/install.py --system else - ./install --system + ./install-auto.sh fi From 7101592899ca6674f76489a9ccfe115f5c8a93df Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sat, 20 Jul 2024 07:13:23 +0330 Subject: [PATCH 9/9] version 3.2.3 --- scal3/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scal3/core.py b/scal3/core.py index c62f20f83..dac9eb942 100644 --- a/scal3/core.py +++ b/scal3/core.py @@ -54,7 +54,7 @@ __file__ = join(os.path.dirname(inspect.getfile(scal3)), "core.py") -VERSION = "3.2.2" +VERSION = "3.2.3" # BRANCH = join(sourceDir, "branch") # FIXME: figure out a policy for updating it