首页 > 其他分享 >解决GNU Radio的内嵌代码块无法打开代码编辑器

解决GNU Radio的内嵌代码块无法打开代码编辑器

时间:2023-12-21 18:23:59浏览次数:43  
标签:executable gnuradio GNU default 代码 Radio choose config editor

摘要

解决GNU Radio的内嵌代码块无法打开编辑器的问题.通过修改py脚本实现使用VSCode编辑内嵌代码.

问题描述

环境:

  1. 系统macOS 13.5
  2. GNU Radio Companion 3.10.8.0 (Python 3.10.13)
代码块 选择应用程序是空的 选择应用程序是空的

实现

修改

/Users/workspace/radioconda/lib/python3.10/site-packages/gnuradio/grc/gui/Dialogs.py

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
        content_type = Gio.content_type_from_mime_type("text/plain")
    dialog = Gtk.AppChooserDialog.new_for_content_type(
        parent,
        Gtk.DialogFlags.MODAL,
        content_type,
    )
    dialog.set_heading("Choose an editor below")
    widget = dialog.get_widget()
    widget.set_default_text("Choose an editor")
    widget.set_show_default(True)
    widget.set_show_recommended(True)
    widget.set_show_fallback(True)

    editor = None
    response = dialog.run()
    if response == Gtk.ResponseType.OK:
        appinfo = dialog.get_app_info()
        editor = config.editor = appinfo.get_executable()
    dialog.destroy()

    # 设置默认编辑器
    editor = "/Applications/Visual Studio Code.app/Contents/MacOS/Electron"
    
    return editor

注意是使用app内的可执行文件.

效果

  1. 启动gnu radio companion
gnuradio-companion &
  1. 点击打开编辑器以直接打开VSCode编辑代码
图片 动图

参考文献

如何在windows上编辑gnuradio的python块?
如何在windows上编辑gnuradio的python块?我已经安装了python,比如PyScripter,Anaconda,但是按下‘使用默认值’‘在编辑器中打开’下面的两行错误将运行
我想任何编辑都行。我刚用代码试了一下。唯一的缺点是文件对话框默认不显示隐藏的文件,因此您需要右键单击对话,然后选择显示它们的选项,然后导航到您想要的目录(如果不更改目录就不会更新,或者可能有刷新选项。

如果您安装了Python,您可以使用Idle,可以像我一样使用,或者使用记事本(或者Notepad++作为其他回答状态)。numpy和gnuradio的导入被Visual代码标记为未解决,所以我还没有脱离困境,但作为一个编辑器,它工作得很好。
It is easily reproduced. Just create an embedded Python block in Windows and double-click it, and click "Open in Editor". A dialogue to choose the editor presents 3 options 1) Choose an editor, 2) Use the default editor 3) Cancel. Using the default editor gives the error "Unable to load the default editor, please choose an editor". Choosing an editor opens a file dialogue box, which curiously does not allow browsing the entire system. For instance, c:\users\username\AppData is not visible, although a directory called "Application Data" appears in the same place. Navigating into it shows no files, when there are actually hundreds of files there, including the default location of Visual Studio Code.

I tried setting the default editor to a shortcut to vscode.exe, which could be seen from the dialogue box. That yielded the error "Error opening an external editor. Please select a different editor", after which the clicking the "Open in Editor" button does not open the dialogue to choose the editor, but just produces the same error message.

Restarting gnu radio fixed that problem. Then I stumbled upon the right click menu in the file dialogue that adds hidden files to the view, and that works. Absent vscode, perhaps Idle or Notepad would suffice for casual use.

73,
Chris VE3NRT

Hi all,

This is not a fix, but a hack. Maybe it will help you

标签:executable,gnuradio,GNU,default,代码,Radio,choose,config,editor
From: https://www.cnblogs.com/qsbye/p/17919805.html

相关文章

  • [转载]使用GoEasy在uniapp下实现实时音视频通话附关键代码
    GRTC(GoEasyReal-TimeCommunication)是GoEasy推出的新功能,用于协助开发者在uniapp下轻松实现一对一和多人场景下的实时音视频通话功能。集成步骤1.配置云厂商音视频服务GRTC功能依赖于云厂商的音视频服务,目前已集成七牛云音视频服务(每月免费5000分钟),并计划未来支持更多云厂......
  • Python代码中的偏函数
    技术背景在数学中我们都学过偏导数\(\frac{\partialf(x,y)}{\partialx}\),而这里我们提到的偏函数,指的是\(f(y)(x)\)。也就是说,在代码实现的过程中,虽然我们实现的一个函数可能带有很多个变量,但是可以用偏函数的形式把其中一些不需要拆分和变化的变量转变为固有变量。比较典型的......
  • [转]SAP PS常用事务代码T-CODE
    SAPPS常用事务代码:工作分解结构CJ01创建WBSCJ02更改WBSCJ03显示WBS日期CJ21更改基本日期CJ22显示基本日期CJ23更改预测日期CJ24显示预测日期CJ25更改实际日期CJ26显示实际日期网络CN21创建网络CN22更改网络CN23显示网络结构计划CJ20更改项目项目构造器CJ20N项目构造器项目负责......
  • 医保购药小程序与智能医疗的代码融合
    在当今数字时代,医保购药小程序的兴起为智能医疗开创了崭新的篇章。通过技术代码的巧妙运用,这一小程序不仅为患者提供了便捷的购药体验,同时在医保结算、用药监控等方面实现了高度智能化,让我们一起深入代码世界,探索其背后的技术奥秘。#医保购药小程序的用户类定义classUser:d......
  • 无论怎么写代码总会遇到下面额问题
    Noqualifyingbeanoftype'org.springframework.transaction.TransactionManager'available:expectedsinglematchingbeanbutfound2:dataSourceTransactionManager,kafkaTransactionManagerNoqualifyingbeanoftype'TransactionManager'......
  • 一文教你Vue3中的useDialog,让你的代码更加优雅!
    在日常开发时,弹窗是一个经常使用的功能,而且重复性极高,你可能会遇到下面这些问题:1、一个页面内多个弹窗,要维护多套弹窗状态,看的眼花缭乱2、弹窗内容比较简单,声明变量+模板语法的方式写起来比较麻烦关于这些问题,我首先想到的是应该弄一个即用即走的Dialog,不用去单独维护它......
  • t-SNE完整笔记 (附Python代码)
    t-SNE(t-distributedstochasticneighborembedding)是用于降维的一种机器学习算法,是由LaurensvanderMaaten和GeoffreyHinton在08年提出来。此外,t-SNE是一种非线性降维算法,非常适用于高维数据降维到2维或者3维,进行可视化。t-SNE是由SNE(StochasticNeighborEmbedding,SN......
  • 代码随想录算法训练营第六天|454.四数相加二、383.赎金信、15.三数之和、18.四数之和
    LeetCode454.四数相加二题目链接:454.四数相加二提示:统计出现的次数; 采用map,key存值,value存次数!!! LeetCode383.赎金信题目链接:383.赎金信提示:字符串.length()可以直接求出字符串的长度,字符串.toCharArray()返回字符串对应的char数组 LeetCode15.三......
  • 企业数字化转型利器:低代码开发平台
    第一部分:数字化转型的背景与挑战背景:数字时代的企业演变在21世纪的数字浪潮中,企业正在经历一场深刻的变革。从传统的业务模式转向以数据和技术为核心的数字化运营,已成为企业生存和发展的关键。这种转变不仅关乎技术的更新换代,更涉及到企业战略、运营模式、组织结构乃至文化的全面革......
  • 德语 Alt 代码表
    德语的Alt代码表,请参考下图。输入方法就是按住Alt键不松开,然后在小键盘上输入字符,松开Alt键,计算机就能输出上面的字符了。......