【问题标题】:Python Module for MySQL Workbench not workingMySQL Workbench 的 Python 模块不工作
【发布时间】:2016-11-10 11:05:36
【问题描述】:

我目前正在为 MySQL Workbench 编写一个插件,但是当我执行它时没有任何反应。 (没有错误)

代码:

from wb import *
import grt
import mforms

ModuleInfo = DefineModule(name= "Workbench Module", author= "OpenByte", version="1.0")


@ModuleInfo.plugin("openbyte.workbench_module", caption= "Workbench Module", input=[wbinputs.currentSQLEditor()], pluginMenu="SQL/Utilities")
@ModuleInfo.export(grt.INT, grt.classes.db_query_Editor)
def executeScript(editor):

        editor.replaceContents("test")

        return 0

【问题讨论】:

    标签: python mysql plugins module mysql-workbench


    【解决方案1】:

    如果你没有看到任何错误意味着你的插件没有被执行,因为你应该得到 AttributeError。 db_query_Editor 没有功能 replaceContents。试试这样的:

    from wb import DefineModule, wbinputs
    import grt
    
    ModuleInfo = DefineModule(name= "TESTModule", author= "Oracle Corp.", version="1.0")
    
    
    @ModuleInfo.plugin("wb.sqlide.test_module", caption= "Test module", input= [wbinputs.currentQueryEditor()], pluginMenu= "SQL/Utilities")
    @ModuleInfo.export(grt.INT, grt.classes.db_query_QueryEditor)
    def test_module(editor):
        editor.replaceContents("test")
        return 0
    

    【讨论】:

      猜你喜欢
      • 2014-12-20
      • 2010-11-25
      • 1970-01-01
      • 2014-04-06
      • 2022-12-21
      • 2013-08-26
      • 2020-10-21
      • 2019-05-12
      • 2011-04-01
      相关资源
      最近更新 更多