[Xfce4-commits] [apps/catfish] 01/01: Avoid None type on Wayland session (patched) (bug #15297)
noreply at xfce.org
noreply at xfce.org
Mon Jul 22 19:36:12 CEST 2019
This is an automated email from the git hooks/post-receive script.
b l u e s a b r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/catfish.
commit 9caeadd8b32f443809debbad4596a1956c43995d
Author: Olivier Duchateau <duchateau.olivier at gmail.com>
Date: Wed May 8 22:09:13 2019 +0200
Avoid None type on Wayland session (patched) (bug #15297)
Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
catfish/CatfishWindow.py | 17 ++++++--
catfish/__init__.py | 7 +++-
catfish_lib/__init__.py | 2 +-
catfish_lib/helpers.py | 24 ++++++++++-
po/catfish.pot | 101 +++++++++++++++++++++++++----------------------
5 files changed, 95 insertions(+), 56 deletions(-)
diff --git a/catfish/CatfishWindow.py b/catfish/CatfishWindow.py
index 1251dbb..27f00e1 100644
--- a/catfish/CatfishWindow.py
+++ b/catfish/CatfishWindow.py
@@ -28,7 +28,14 @@ from shutil import copy2, rmtree
from xml.sax.saxutils import escape
import pexpect
-from gi.repository import Gdk, GdkPixbuf, GLib, GObject, Gtk, Pango
+import gi
+gi.require_version('GLib', '2.0')
+gi.require_version('GObject', '2.0')
+gi.require_version('Pango', '1.0')
+gi.require_version('Gdk', '3.0')
+gi.require_version('GdkPixbuf', '2.0')
+gi.require_version('Gtk', '3.0')
+from gi.repository import GLib, GObject, Pango, Gdk, GdkPixbuf, Gtk
from catfish.AboutCatfishDialog import AboutCatfishDialog
from catfish.CatfishSearchEngine import CatfishSearchEngine
@@ -317,9 +324,11 @@ class CatfishWindow(Window):
return (s.get_width(), s.get_height())
def get_display_size(self):
- s = self.get_screen()
- m = s.get_monitor_at_window(s.get_active_window())
- monitor = s.get_monitor_geometry(m)
+ d = Gdk.Display.get_default()
+ w = Gdk.get_default_root_window()
+
+ m = d.get_monitor_at_window(w)
+ monitor = m.get_geometry()
return (monitor.width, monitor.height)
def on_calendar_day_changed(self, widget):
diff --git a/catfish/__init__.py b/catfish/__init__.py
index 45be7f2..00723cb 100644
--- a/catfish/__init__.py
+++ b/catfish/__init__.py
@@ -17,6 +17,7 @@
# with this program. If not, see <https://www.gnu.org/licenses/>.
import optparse
+import sys
from locale import gettext as _
@@ -27,7 +28,7 @@ from gi.repository import Gtk
from catfish import CatfishWindow
-from catfish_lib import set_up_logging, get_version
+from catfish_lib import set_up_logging, get_version, check_x11_session
import signal
@@ -72,6 +73,10 @@ def main():
'constructor for your class instances'
options, args = parse_options()
+ if not check_x11_session():
+ sys.stderr.write(_('Try GDK_BACKEND=x11 {0}\n'.format(sys.argv[0])))
+ sys.exit(0)
+
# Run the application.
window = CatfishWindow.CatfishWindow()
window.parse_options(options, args)
diff --git a/catfish_lib/__init__.py b/catfish_lib/__init__.py
index 1e7f503..e237a1b 100644
--- a/catfish_lib/__init__.py
+++ b/catfish_lib/__init__.py
@@ -19,6 +19,6 @@
'''facade - makes catfish_lib package easy to refactor
while keeping its api constant'''
-from . helpers import set_up_logging # noqa
+from . helpers import set_up_logging, check_x11_session # noqa
from . Window import Window # noqa
from . catfishconfig import get_version # noqa
diff --git a/catfish_lib/helpers.py b/catfish_lib/helpers.py
index 46a9c78..6adbc81 100644
--- a/catfish_lib/helpers.py
+++ b/catfish_lib/helpers.py
@@ -22,9 +22,12 @@ import os
import sys
import gi
-gi.require_version('Gtk', '3.0') # noqa
+gi.require_version('GLib', '2.0')
+gi.require_version('GObject', '2.0')
+gi.require_version('Gdk', '3.0')
+gi.require_version('Gtk', '3.0')
-from gi.repository import Gtk, GObject
+from gi.repository import GLib, GObject, Gdk, Gtk
from . catfishconfig import get_data_file
from . Builder import Builder
@@ -152,3 +155,20 @@ def alias(alternative_function_name):
function.aliases.append(alternative_function_name)
return function
return decorator
+
+
+def check_x11_session():
+ '''Is it an X.org session?'''
+ backend_env = GLib.environ_getenv(GLib.get_environ(), 'GDK_BACKEND')
+ if backend_env is None:
+ # We look for default display
+ display = Gdk.Display.get_default().get_name()
+ if display.startswith('wayland'):
+ return False
+ else:
+ return True
+ else:
+ if backend_env.lower() == 'x11':
+ return True
+ else:
+ return False
diff --git a/po/catfish.pot b/po/catfish.pot
index 9b85faf..78ed131 100644
--- a/po/catfish.pot
+++ b/po/catfish.pot
@@ -8,17 +8,17 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-03-05 20:20-0500\n"
+"POT-Creation-Date: 2019-07-22 13:32-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../org.xfce.Catfish.desktop.in.h:1 ../data/ui/CatfishWindow.ui.h:28
-#: ../catfish/CatfishWindow.py:666
+#: ../catfish/CatfishWindow.py:675
msgid "Catfish File Search"
msgstr ""
@@ -137,7 +137,7 @@ msgstr ""
msgid "File Type"
msgstr ""
-#: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1133
+#: ../data/ui/CatfishWindow.ui.h:27 ../catfish/CatfishWindow.py:1142
msgid "Modified"
msgstr ""
@@ -228,202 +228,207 @@ msgid ""
"This action requires administrative rights."
msgstr ""
-#: ../catfish/__init__.py:37
+#: ../catfish/__init__.py:38
msgid "Usage: %prog [options] path query"
msgstr ""
-#: ../catfish/__init__.py:42
+#: ../catfish/__init__.py:43
msgid "Show debug messages (-vv will also debug catfish_lib)"
msgstr ""
-#: ../catfish/__init__.py:45
+#: ../catfish/__init__.py:46
msgid "Use large icons"
msgstr ""
-#: ../catfish/__init__.py:47
+#: ../catfish/__init__.py:48
msgid "Use thumbnails"
msgstr ""
-#: ../catfish/__init__.py:49
+#: ../catfish/__init__.py:50
msgid "Display time in ISO format"
msgstr ""
#. Translators: Do not translate PATH, it is a variable.
-#: ../catfish/__init__.py:51
+#: ../catfish/__init__.py:52
msgid "Set the default search path"
msgstr ""
-#: ../catfish/__init__.py:53
+#: ../catfish/__init__.py:54
msgid "Perform exact match"
msgstr ""
-#: ../catfish/__init__.py:55
+#: ../catfish/__init__.py:56
msgid "Include hidden files"
msgstr ""
-#: ../catfish/__init__.py:57
+#: ../catfish/__init__.py:58
msgid "Perform fulltext search"
msgstr ""
-#: ../catfish/__init__.py:59
+#: ../catfish/__init__.py:60
msgid ""
"If path and query are provided, start searching when the application is "
"displayed."
msgstr ""
+#: ../catfish/__init__.py:77
+#, python-brace-format
+msgid "Try GDK_BACKEND=x11 {0}\n"
+msgstr ""
+
#. Translators: this text is displayed next to
#. a filename that is not utf-8 encoded.
-#: ../catfish/CatfishWindow.py:84
+#: ../catfish/CatfishWindow.py:91
#, python-format
msgid "%s (invalid encoding)"
msgstr ""
-#: ../catfish/CatfishWindow.py:238
+#: ../catfish/CatfishWindow.py:245
msgid "Unknown"
msgstr ""
-#: ../catfish/CatfishWindow.py:242
+#: ../catfish/CatfishWindow.py:249
msgid "Never"
msgstr ""
-#: ../catfish/CatfishWindow.py:634
+#: ../catfish/CatfishWindow.py:643
msgid "An error occurred while updating the database."
msgstr ""
-#: ../catfish/CatfishWindow.py:636
+#: ../catfish/CatfishWindow.py:645
msgid "Authentication failed."
msgstr ""
-#: ../catfish/CatfishWindow.py:642
+#: ../catfish/CatfishWindow.py:651
msgid "Authentication cancelled."
msgstr ""
-#: ../catfish/CatfishWindow.py:648
+#: ../catfish/CatfishWindow.py:657
msgid "Search database updated successfully."
msgstr ""
#. Set the dialog status to running.
-#: ../catfish/CatfishWindow.py:723
+#: ../catfish/CatfishWindow.py:732
msgid "Updating..."
msgstr ""
-#: ../catfish/CatfishWindow.py:757
+#: ../catfish/CatfishWindow.py:766
msgid "Stop Search"
msgstr ""
-#: ../catfish/CatfishWindow.py:758
+#: ../catfish/CatfishWindow.py:767
msgid ""
"Search is in progress...\n"
"Press the cancel button or the Escape key to stop."
msgstr ""
-#: ../catfish/CatfishWindow.py:767
+#: ../catfish/CatfishWindow.py:776
msgid "Begin Search"
msgstr ""
-#: ../catfish/CatfishWindow.py:959
+#: ../catfish/CatfishWindow.py:968
#, python-format
msgid "\"%s\" could not be opened."
msgstr ""
-#: ../catfish/CatfishWindow.py:1005
+#: ../catfish/CatfishWindow.py:1014
#, python-format
msgid "\"%s\" could not be saved."
msgstr ""
-#: ../catfish/CatfishWindow.py:1022
+#: ../catfish/CatfishWindow.py:1031
#, python-format
msgid "\"%s\" could not be deleted."
msgstr ""
-#: ../catfish/CatfishWindow.py:1062
+#: ../catfish/CatfishWindow.py:1071
#, python-format
msgid "Save \"%s\" as..."
msgstr ""
-#: ../catfish/CatfishWindow.py:1097
+#: ../catfish/CatfishWindow.py:1106
#, python-format
msgid ""
"Are you sure that you want to \n"
"permanently delete \"%s\"?"
msgstr ""
-#: ../catfish/CatfishWindow.py:1101
+#: ../catfish/CatfishWindow.py:1110
#, python-format
msgid ""
"Are you sure that you want to \n"
"permanently delete the %i selected files?"
msgstr ""
-#: ../catfish/CatfishWindow.py:1104
+#: ../catfish/CatfishWindow.py:1113
msgid "If you delete a file, it is permanently lost."
msgstr ""
-#: ../catfish/CatfishWindow.py:1127
+#: ../catfish/CatfishWindow.py:1136
msgid "Filename"
msgstr ""
-#: ../catfish/CatfishWindow.py:1129
+#: ../catfish/CatfishWindow.py:1138
msgid "Size"
msgstr ""
-#: ../catfish/CatfishWindow.py:1131
+#: ../catfish/CatfishWindow.py:1140
msgid "Location"
msgstr ""
-#: ../catfish/CatfishWindow.py:1143
+#: ../catfish/CatfishWindow.py:1152
msgid "Preview"
msgstr ""
-#: ../catfish/CatfishWindow.py:1151
+#: ../catfish/CatfishWindow.py:1160
msgid "Details"
msgstr ""
-#: ../catfish/CatfishWindow.py:1374
+#: ../catfish/CatfishWindow.py:1383
msgid "Today"
msgstr ""
-#: ../catfish/CatfishWindow.py:1376
+#: ../catfish/CatfishWindow.py:1385
msgid "Yesterday"
msgstr ""
-#: ../catfish/CatfishWindow.py:1457
+#: ../catfish/CatfishWindow.py:1466
msgid "No files found."
msgstr ""
-#: ../catfish/CatfishWindow.py:1459
+#: ../catfish/CatfishWindow.py:1468
msgid ""
"Try making your search less specific\n"
"or try another directory."
msgstr ""
-#: ../catfish/CatfishWindow.py:1465
+#: ../catfish/CatfishWindow.py:1474
msgid "1 file found."
msgstr ""
-#: ../catfish/CatfishWindow.py:1467
+#: ../catfish/CatfishWindow.py:1476
#, python-format
msgid "%i files found."
msgstr ""
-#: ../catfish/CatfishWindow.py:1473
+#: ../catfish/CatfishWindow.py:1482
msgid "bytes"
msgstr ""
-#: ../catfish/CatfishWindow.py:1581 ../catfish/CatfishWindow.py:1590
+#: ../catfish/CatfishWindow.py:1590 ../catfish/CatfishWindow.py:1599
msgid "Searching..."
msgstr ""
-#: ../catfish/CatfishWindow.py:1583
+#: ../catfish/CatfishWindow.py:1592
msgid "Results will be displayed as soon as they are found."
msgstr ""
-#: ../catfish/CatfishWindow.py:1588
+#: ../catfish/CatfishWindow.py:1597
#, python-format
msgid "Searching for \"%s\""
msgstr ""
-#: ../catfish/CatfishWindow.py:1678
+#: ../catfish/CatfishWindow.py:1687
#, python-format
msgid "Search results for \"%s\""
msgstr ""
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list