Exemplo n.º 1
0
def generateManifest(moduleName, outpath):
    module = getattr(grt.modules, moduleName, None)
    if not module:
        raise ValueError("Invalid module name")

    dict = grt.Dict()

    dict["name"] = module.__name__
    dict["iconFile"] = os.path.basename(module.__iconpath__)
    pluginList = grt.List()
    dict["plugins"] = pluginList
    dict["author"] = module.__author__
    dict["description"] = module.__description__
    dict["version"] = module.__version__

    if not hasattr(module, "getPluginInfo"):
        raise ValueError("Module '%s' is not a plugin module" % moduleName)

    plugins = module.getPluginInfo()
    for plugin in plugins:
        entry = grt.Dict()
        entry["name"] = plugin.name
        entry["caption"] = plugin.caption
        entry["description"] = plugin.description
        pluginList.append(entry)

    grt.serialize(dict, outpath)

    return 0
Exemplo n.º 2
0
def generateManifest(moduleName, outpath):
    module = getattr(grt.modules, moduleName, None)
    if not module:
        raise ValueError("Invalid module name")

    dict = grt.Dict()

    dict["name"] = module.__name__
    dict["iconFile"] = os.path.basename(module.__iconpath__)
    pluginList = grt.List()
    dict["plugins"] = pluginList
    dict["author"] = module.__author__
    dict["description"] = module.__description__
    dict["version"] = module.__version__

    if not hasattr(module, "getPluginInfo"):
        raise ValueError("Module '%s' is not a plugin module" % moduleName)
    
    plugins = module.getPluginInfo()
    for plugin in plugins:
        entry = grt.Dict()
        entry["name"] = plugin.name
        entry["caption"] = plugin.caption
        entry["description"] = plugin.description
        pluginList.append(entry)

    grt.serialize(dict, outpath)

    return 0
def run():
    import grt
    import os

    datadir = mforms.App.get().get_user_data_folder()
    path = datadir + "/migration_generic_typemap.xml"
    if grt.root.wb.migration:
        typemap = grt.root.wb.migration.genericDatatypeMappings
    else:
        if os.path.exists(path):
            typemap = grt.unserialize(path)
        else:
            global_path = mforms.App.get().get_resource_path("")
            global_path += "/modules/data/migration_generic_typemap.xml"
            if os.path.exists(global_path):
                typemap = grt.unserialize(global_path)
            else:
                typemap = grt.List(grt.OBJECT, "db.migration.DatatypeMapping")
    form = DatatypeMappingEditor()
    if form.run(typemap):
        grt.serialize(typemap, path)
        return 1
    return 0
def run():
    import grt
    import os
    
    datadir = mforms.App.get().get_user_data_folder()
    path = datadir + "/migration_generic_typemap.xml"
    if grt.root.wb.migration:
        typemap = grt.root.wb.migration.genericDatatypeMappings
    else:        
        if os.path.exists(path):
            typemap = grt.unserialize(path)
        else:
            global_path = mforms.App.get().get_resource_path("")
            global_path += "/modules/data/migration_generic_typemap.xml"
            if os.path.exists(global_path):
                typemap = grt.unserialize(global_path)
            else:
                typemap = grt.List(grt.OBJECT, "db.migration.DatatypeMapping")
    form = DatatypeMappingEditor()
    if form.run(typemap):
        grt.serialize(typemap, path)
        return 1
    return 0
 def export_templates(self):
     dlg = mforms.FileChooser(mforms.SaveFile)
     dlg.set_title("Export Table Templates")
     if dlg.run_modal():
         print dlg.get_path()
         grt.serialize(self.templates, dlg.get_path())
Exemplo n.º 6
0
 def export_templates(self):
     dlg = mforms.FileChooser(mforms.SaveFile)
     dlg.set_title("Export Table Templates")
     if dlg.run_modal():
         grt.serialize(self.templates, dlg.get_path())