ryanvolz / radioconda

Software radio distribution and installer for conda
Other
340 stars 39 forks source link

Unable to choose editor for Python block on MacOS #86

Open techfoamer opened 4 months ago

techfoamer commented 4 months ago

Message on console when clicking "Open in Editor" or "Choose Editor" is: GLib-GIO-WARNING **: 18:00:23.566: No default handler found for content type 'dyn.agq81k3p2su11upputf4gu55s'

Observed this on MacOS 14.3 on both Intel and Apple silicon.

ryanvolz commented 4 months ago

If you make the following edit to $CONDA_PREFIX/lib/python3.11/site-packages/gnuradio/grc/gui/Dialogs.py (replace if content_type == "*": with if Gio.content_type_is_unknown(content_type):):

--- a/grc/gui/Dialogs.py
+++ b/grc/gui/Dialogs.py
@@ -408,8 +408,8 @@ def choose_editor(parent, config):
     Give the option to either choose an editor or use the default.
     """
     content_type = Gio.content_type_from_mime_type("text/x-python")
-    if content_type == "*":
-        # fallback to plain text on Windows if no useful x-python association
+    if Gio.content_type_is_unknown(content_type):
+        # fallback to plain text if no useful x-python association
         content_type = Gio.content_type_from_mime_type("text/plain")
     dialog = Gtk.AppChooserDialog.new_for_content_type(
         parent,

does that fix it?

techfoamer commented 4 months ago

It changes it. I now have some choices of editors, if I select any of the editor options and click "Open in Editor" the console shows this error: "Error opening an external editor. Please select a different editor."

ryanvolz commented 4 months ago

Looks like that's going to require some digging around here to see why it doesn't work on a Mac. It might be time to open a new issue upstream or raise it in the Matrix chat to see if someone with a Mac can help debug.

WTPhD commented 1 month ago

@techfoamer @ryanvolz Sorry I didn't see this earlier when you posted it. I've been using gnuradio via radioconda on multiple arm64 macs for at least 9 mos - I recall there being an issue with the button initially, but resolved it by manually editing ~/.gnuradio/config.conf. See snippet below.

Note that not all editors work properly with the button: textmate (mate) definitely does, sublime (subl) definitely doesn't. Fortunately, textmate is free.

# ... other ...
[grc]
editor = /usr/local/bin/mate
canvas_default_size = 1280, 1024
canvas_font_size = 8
default_flow_graph = 
# ... other ...
ryanvolz commented 1 month ago

@WTPhD There is a little more discussion over at https://github.com/gnuradio/gnuradio/issues/7115, but still no good solution. I'd be interested in hearing if the change I've proposed in https://github.com/gnuradio/gnuradio/issues/7115#issuecomment-1932586390 helps at all when "Choose Editor" is used (probably also the change in https://github.com/ryanvolz/radioconda/issues/86#issuecomment-1930406202 is needed as well).