From 4c43de8fff2dbf856fe77e73922530b119f5f8ee Mon Sep 17 00:00:00 2001 From: deltragon Date: Wed, 19 Jun 2024 02:15:47 +0200 Subject: [PATCH 1/3] Fix crash in smartpause (#582) * smartpause: fix calling disable_safeeyes on main thread by adding missing parameter This was missed in 903d407faf58871fd84756ec76d6b5c2543f6540 * fix forwarding arguments in execute_main_thread This broke when the first parameter was None, but the second wasn't (the second parameter wasn't passed at all.) Use *args/**kwargs to make it behave properly in all cases. --- safeeyes/safeeyes.py | 4 ++-- safeeyes/utility.py | 20 ++++---------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/safeeyes/safeeyes.py b/safeeyes/safeeyes.py index 1345e9cf..bf1ddb43 100644 --- a/safeeyes/safeeyes.py +++ b/safeeyes/safeeyes.py @@ -71,8 +71,8 @@ def __init__(self, system_locale, config): self.show_about) self.context['api']['enable_safeeyes'] = lambda next_break_time=-1, reset_breaks=False: \ utility.execute_main_thread(self.enable_safeeyes, next_break_time, reset_breaks) - self.context['api']['disable_safeeyes'] = lambda status: utility.execute_main_thread( - self.disable_safeeyes, status) + self.context['api']['disable_safeeyes'] = lambda status=None, is_resting=False: utility.execute_main_thread( + self.disable_safeeyes, status, is_resting) self.context['api']['status'] = self.status self.context['api']['quit'] = lambda: utility.execute_main_thread( self.quit) diff --git a/safeeyes/utility.py b/safeeyes/utility.py index 39761400..ea25088b 100644 --- a/safeeyes/utility.py +++ b/safeeyes/utility.py @@ -94,28 +94,16 @@ def start_thread(target_function, **args): thread.start() -# def execute_main_thread(target_function, args=None): +# def execute_main_thread(target_function, *args, **kwargs): # """ -# Execute the given function in main thread. +# Execute the given function in main thread, forwarding positional and keyword arguments. # """ -# if args: -# GLib.idle_add(lambda: target_function(args)) -# else: -# GLib.idle_add(target_function) -def execute_main_thread(target_function, arg1=None, arg2=None): +def execute_main_thread(target_function, *args, **kwargs): """ Execute the given function in main thread. """ - if arg1 is not None and arg2 is not None: - GLib.idle_add(lambda: target_function(arg1, arg2)) - elif arg1 is not None: - GLib.idle_add(lambda: target_function(arg1)) - elif arg2 is not None: - GLib.idle_add(lambda: target_function(arg2)) - else: - GLib.idle_add(target_function) - + GLib.idle_add(lambda: target_function(*args, **kwargs)) def system_locale(category=locale.LC_MESSAGES): """ From 7960e3a0d6cf06f8e8c550104abfaa2fe8951a08 Mon Sep 17 00:00:00 2001 From: Tero Paloheimo Date: Wed, 19 Jun 2024 03:17:54 +0300 Subject: [PATCH 2/3] Update README.md virtual environment section (#559) Refer to the built-in venv module instead of the third party virtualenv module. Also do some minor text changes. Fixes issue #525. --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bddda205..f26b0947 100644 --- a/README.md +++ b/README.md @@ -120,11 +120,11 @@ python3 -m safeeyes Safe Eyes installers install the required icons to `/usr/share/icons/hicolor`. When you run Safe Eyes from source without, some icons may not appear. -### Install in Virtual Environment +### Install in a virtual environment -Some Linux systems like Cent OS do not have matching dependencies available in their repository. In such systems, you can install and use Safe Eyes in a Python Virtual Environment. The following instruction was tested on Cent OS 7. +Some Linux systems like CentOS do not have matching dependencies available in their repository. In such systems, you can install and use Safe Eyes in a Python virtual environment. -1. Install the necessary dependencies +1. Install the necessary dependencies for CentOS 7 ```bash sudo yum install python3-devel dbus dbus-devel cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel gobject-introspection-devel cairo-gobject-devel @@ -136,13 +136,12 @@ Some Linux systems like Cent OS do not have matching dependencies available in t mkdir ~/safeeyes cd ~/safeeyes/ - pip3 install virtualenv --user - virtualenv --no-site-packages venv + python3 -m venv venv source venv/bin/activate pip3 install dbus-python safeeyes ``` -3. Start Safe Eyes from terminal +3. Start Safe Eyes from the terminal ```bash cd ~/safeeyes & source venv/bin/activate From d43599000cab3bc500ba9a9f98f3318f90bb33d8 Mon Sep 17 00:00:00 2001 From: Gobinath Date: Tue, 18 Jun 2024 20:26:09 -0400 Subject: [PATCH 3/3] Bump version to 2.1.9 --- debian/changelog | 6 ++++++ safeeyes/glade/about_dialog.glade | 2 +- .../platform/io.github.slgobinath.SafeEyes.metainfo.xml | 2 +- safeeyes/safeeyes.py | 2 +- setup.py | 4 ++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index fc406bdc..f6565232 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +safeeyes (2.1.9) noble; urgency=medium + + * Fix crash in smartpause + + -- Gobinath Loganathan Tue, 18 Jun 2024 20:25:00 -0400 + safeeyes (2.1.8) noble; urgency=medium * Support Python 3.12 diff --git a/safeeyes/glade/about_dialog.glade b/safeeyes/glade/about_dialog.glade index ca2e39d0..9ebb8e5f 100644 --- a/safeeyes/glade/about_dialog.glade +++ b/safeeyes/glade/about_dialog.glade @@ -71,7 +71,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.center 10 10 - Safe Eyes 2.1.8 + Safe Eyes 2.1.9 center diff --git a/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml b/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml index 8dc939e3..e8d796df 100644 --- a/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml +++ b/safeeyes/platform/io.github.slgobinath.SafeEyes.metainfo.xml @@ -47,7 +47,7 @@ https://slgobinath.github.io/SafeEyes/ - + diff --git a/safeeyes/safeeyes.py b/safeeyes/safeeyes.py index bf1ddb43..f9b8bf4c 100644 --- a/safeeyes/safeeyes.py +++ b/safeeyes/safeeyes.py @@ -40,7 +40,7 @@ gi.require_version('Gtk', '3.0') from gi.repository import Gtk -SAFE_EYES_VERSION = "2.1.8" +SAFE_EYES_VERSION = "2.1.9" class SafeEyes: diff --git a/setup.py b/setup.py index b4033bb3..07a314b9 100644 --- a/setup.py +++ b/setup.py @@ -78,14 +78,14 @@ def __package_data(): setuptools.setup( name="safeeyes", - version="2.1.8", + version="2.1.9", description="Protect your eyes from eye strain using this continuous breaks reminder.", long_description=long_description, long_description_content_type="text/markdown", author="Gobinath Loganathan", author_email="slgobinath@gmail.com", url="https://github.com/slgobinath/SafeEyes", - download_url="https://github.com/slgobinath/SafeEyes/archive/v2.1.8.tar.gz", + download_url="https://github.com/slgobinath/SafeEyes/archive/v2.1.9.tar.gz", packages=setuptools.find_packages(), package_data={'safeeyes': __package_data()}, data_files=__data_files(),