def selfRegister(): application = ApplicationLocator.getManager() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text", File(getResource(__file__, "i18n"))) # # Registramos los iconos en el tema de iconos icon = File( getResource(__file__, "images", "view-query-coordinate-capture.png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting.CoordinateCaptureExtension", "action", "view-query-coordinate-capture", None, icon) # # Creamos la accion extension = CoordinateCaptureExtension() actionManager = PluginsLocator.getActionInfoManager() action = actionManager.createAction( extension, "view-query-coordinate-capture", # Action name "Coordinate capture", # Text "view-query-coordinate-capture", # Action command "view-query-coordinate-capture", # Icon name None, # Accelerator 650700600, # Position "_Show_the_coordinate_capture" # Tooltip ) action = actionManager.registerAction(action) application.addMenu(action, "View/Query/Coordinate capture")
def selfRegister(): application = ApplicationLocator.getManager() # # Registramos los iconos en el tema de iconos iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() icon = File(getResource(__file__, "images", "dbeaver16x16.png")).toURI().toURL() iconTheme.registerDefault("scripting.DBeaverExtension", "action", "dbeaver-launch", None, icon) # # Creamos la accion actionManager = PluginsLocator.getActionInfoManager() extension = DBeaverExtension() action = actionManager.createAction( extension, "dbeaver-launch", # Action name "DBeaver", # Text "dbeaver-launch", # Action command "dbeaver-launch", # Icon name None, # Accelerator 650700600, # Position "_Show_the_DBeaver_database_administrator_tool" # Tooltip ) action = actionManager.registerAction(action) application.addMenu(action, "tools/DBeaver")
def selfRegister(): application = ApplicationLocator.getManager() i18n = ToolsLocator.getI18nManager() icon_show = File(gvsig.getResource(__file__, "images", "snap16x16.png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting.quick-snapping-tool", "action", "tools-quick-snapping-tool", None, icon_show) extension = QuickSnappingToolExtension() actionManager = PluginsLocator.getActionInfoManager() action_show = actionManager.createAction( extension, "tools-quick-snapping-tool", # Action name i18n.getTranslation("_Quick_Snapping_Tool"), # Text "show", # Action command "tools-quick-snapping-tool", # Icon name None, # Accelerator 1009000000, # Position "Quick Snapping Tool" # Tooltip ) action_show = actionManager.registerAction(action_show) application.addTool(action_show, i18n.getTranslation("_Quick_Snapping_Tool"))
def selfRegister(): i18n = ToolsLocator.getI18nManager() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() quickinfo_icon = File( gvsig.getResource(__file__, "images", "reportbypoint1.png")).toURI().toURL() iconTheme.registerDefault("scripting.reportbypoint", "action", "tools-reportbypoint", None, quickinfo_icon) reportbypoint_extension = ReportByPointExtension() reportbypoint_action = actionManager.createAction( reportbypoint_extension, "tools-reportbypoint", # Action name "Show report by point", # Text "settool-reportbypoint", # Action command "tools-reportbypoint", # Icon name None, # Accelerator 1009000000, # Position i18n.getTranslation("_Report_by_point_info") # Tooltip ) reportbypoint_action = actionManager.registerAction(reportbypoint_action) # Añadimos la entrada "Report by point" en el menu herramientas application.addMenu( reportbypoint_action, "tools/" + i18n.getTranslation("_Report_by_point_info")) # Añadimos el la accion como un boton en la barra de herramientas "Quickinfo". application.addSelectableTool(reportbypoint_action, "ReportByPoint")
def selfRegister(): application = ApplicationLocator.getManager() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text", File(getResource(__file__, "i18n"))) # # Registramos los iconos en el tema de iconos icon = File(getResource(__file__, "images", "mobile-forms-designer.png")).toURI().toURL() print "ICON:", icon iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting.MobileFormsExtension", "action", "mobile-forms-designer", None, icon) # # Creamos la accion extension = MobileFormsExtension() actionManager = PluginsLocator.getActionInfoManager() action = actionManager.createAction( extension, "mobile-forms-designer", # Action name "Mobile forms designer", # Text "mobile-forms-designer", # Action command "mobile-forms-designer", # Icon name None, # Accelerator 650151000, # Position "_Show_mobile_forms_designer" # Tooltip ) action = actionManager.registerAction(action) application.addMenu(action, "HMachine/GvSIG Mobile-Geopaparazzi/Forms designer")
def selfRegister(): i18n = ToolsLocator.getI18nManager() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() quickinfo_icon = File( gvsig.getResource(__file__, "images", "sentineldownloader.png")).toURI().toURL() iconTheme.registerDefault("scripting.sentineldownloader", "action", "tools-sentineldownloader", None, quickinfo_icon) reportbypoint_extension = SentinelDownloaderExtension() reportbypoint_action = actionManager.createAction( reportbypoint_extension, "tools-sentineldownloader", # Action name "Sentinel Downloader", # Text "settool-sentineldownloader", # Action command "tools-sentineldownloader", # Icon name None, # Accelerator 1009000000, # Position i18n.getTranslation("_Sentinel_Downloader") # Tooltip ) reportbypoint_action = actionManager.registerAction(reportbypoint_action) application.addMenu(reportbypoint_action, "tools/_Sentinel_Downloader") application.addSelectableTool(reportbypoint_action, "SentinelDownloader")
def selfRegister(): selfRegisterI18n() i18n = ToolsLocator.getI18nManager() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() toolfinder_icon = File(gvsig.getResource(__file__,"images","toolFinder.png")).toURI().toURL() iconTheme.registerDefault("scripting.toolfinder", "action", "tools-toolfinder", None, toolfinder_icon) #quickinfo_icon) mytool_extension = ToolFinderExtension() mytool_action = actionManager.createAction( mytool_extension, "tools-toolfinder", # Action name "Tool finder", # Text "settool-toolfinder", # Action command "tools-toolfinder", # Icon name None, # Accelerator 1009000000, # Position i18n.getTranslation("_Tool_finder") # Tooltip ) mytool_action = actionManager.registerAction(mytool_action) # Añadimos la entrada en el menu herramientas application.addMenu(mytool_action, "tools/"+i18n.getTranslation("_Tool_finder"))
def selfRegister(): i18n = ToolsLocator.getI18nManager() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() exportmaptiles_icon = File( gvsig.getResource(__file__, "images", "exportmaptiles.png")).toURI().toURL() iconTheme.registerDefault("scripting.exportmaptiles", "action", "tools-exportmaptiles", None, exportmaptiles_icon) exportmaptiles_extension = ExportMapTilesPanelExtension() exportmaptiles_action = actionManager.createAction( exportmaptiles_extension, "tools-exportmaptiles", # Action name "Export map tiles", # Text "settool-exportmaptiles", # Action command "tools-exportmaptiles", # Icon name None, # Accelerator 1009000000, # Position i18n.getTranslation("_Export_map_tiles") # Tooltip ) exportmaptiles_action = actionManager.registerAction(exportmaptiles_action) # Añadimos la entrada "Quickinfo" en el menu herramientas application.addMenu(exportmaptiles_action, "tools/_ExportMapTiles") # Añadimos el la accion como un boton en la barra de herramientas "Quickinfo". application.addSelectableTool(exportmaptiles_action, "ExportMapTiles")
def selfRegister(): application = ApplicationLocator.getManager() i18n = ToolsLocator.getI18nManager() icon_show = File( gvsig.getResource(__file__, "images", "fieldcalculator16x16.png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting.field-calculator-tool", "action", "tools-field-calculator-tool", None, icon_show) extension = FieldCalculatorToolExtension() actionManager = PluginsLocator.getActionInfoManager() action_show = actionManager.createAction( extension, "tools-field-calculator-tool", # Action name i18n.getTranslation("_Field_Calculator_Tool"), # Text "show", # Action command "tools-field-calculator-tool", # Icon name None, # Accelerator 501100000, # Position "_Field_Calculator_Tool" # Tooltip ) action_show = actionManager.registerAction(action_show) application.addMenu(action_show, "Table/_Field_Calculator_Tool") application.addTool( action_show, "table_tools") #/ )#i18n.getTranslation("_Field_Calculator_Tool"))
def selfRegister(): application = ApplicationLocator.getManager() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text", File(getResource(__file__, "i18n"))) # # Registramos los iconos en el tema de iconos icon = File(getResource(__file__, "images", "table-import-fields.png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting.ImportFieldsExtension", "action", "table-import-fields", None, icon) # # Creamos la accion extension = ImportFieldsExtension() actionManager = PluginsLocator.getActionInfoManager() action = actionManager.createAction( extension, "table-import-fields", # Action name "_Import_fields", # Text "table-import-fields", # Action command "table-import-fields", # Icon name None, # Accelerator 508200000, # Position "_Show_the_import_fields_dialog" # Tooltip ) action = actionManager.registerAction(action) application.addMenu(action, "Table/_Import_fields")
def selfRegister(): i18n = ToolsLocator.getI18nManager() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() cadastralparcelsdownloader_icon = File( gvsig.getResource(__file__, "images", "cadastralparcelsdownloader.png")).toURI().toURL() iconTheme.registerDefault("scripting.cadastralparcelsdownloader", "action", "tools-cadastralparcelsdownloader", None, cadastralparcelsdownloader_icon) cadastralparcelsdownloader_extension = CadastralDownloaderExtension() cadastralparcelsdownloader_action = actionManager.createAction( cadastralparcelsdownloader_extension, "tools-cadastralparcelsdownloader", # Action name "Show cadastral parcels downloader", # Text "settool-cadastralparcelsdownloader", # Action command "tools-cadastralparcelsdownloader", # Icon name None, # Accelerator 1009000000, # Position i18n.getTranslation("_Show_cadastral_parcels_downloader") # Tooltip ) cadastralparcelsdownloader_action = actionManager.registerAction( cadastralparcelsdownloader_action) # Añadimos la entrada "Quickinfo" en el menu herramientas application.addMenu(cadastralparcelsdownloader_action, "tools/_cadastralparcelsdownloader") # Añadimos el la accion como un boton en la barra de herramientas "Quickinfo". application.addSelectableTool(cadastralparcelsdownloader_action, "CadastralParcelsDownloader")
def selfRegister(): application = ApplicationLocator.getManager() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text",File(getResource(__file__,"i18n"))) # # Registramos los iconos en el tema de iconos icon = File(getResource(__file__,"images","view-time-add-basic-support-to-datasource.png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting.addBasicTimeSupportToDatasource", "action", "view-time-add-basic-support-to-datasource", None, icon) # # Creamos la accion extension = AddBasicTimeSupportToDatasourceExtension() actionManager = PluginsLocator.getActionInfoManager() action = actionManager.createAction( extension, "view-time-add-basic-support-to-datasource", # Action name "Add basic support", # Text "view-time-add-basic-support-to-datasource", # Action command "view-time-add-basic-support-to-datasource", # Icon name None, # Accelerator 650151000, # Position "_Add_basic_time_support_to_vectorial_layer" # Tooltip ) action = actionManager.registerAction(action) application.addMenu(action, "View/Time/_Add_basic_time_support")
def selfRegister(): test = TestPlayer() application = ApplicationLocator.getManager() icon = File(os.path.join(os.path.dirname(__file__),"testdata", "testplayer.png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting.test-" + test.getId(), "action", "tools-test-" + test.getId(), None, icon) extension = TestExtension() actionManager = PluginsLocator.getActionInfoManager() action_show = actionManager.createAction( extension, "tools-test-" + test.getId(), # Action name test.getName(), # Text "show", # Action command "tools-test-" + test.getId(), # Icon name None, # Accelerator 1009100000, # Position "TestPlayer-" + test.getId() # Tooltip ) action_show = actionManager.registerAction(action_show) application.addMenu(action_show, "File/TestPlayer/Tests/" + test.getId()) application.addTool(action_show, test.getId())
def getHelpFile(self): name = "distribucionPoblacionPorCentros" extension = ".xml" locale = PluginsLocator.getLocaleManager().getCurrentLocale() tag = locale.getLanguage() helpPath = getResource(__file__, "help", name + "_" + tag + extension) if os.path.exists(helpPath): return File(helpPath) #Alternatives alternatives = PluginsLocator.getLocaleManager().getLocaleAlternatives(locale) for alt in alternatives: helpPath = getResource(__file__, "help", name + "_" + alt.toLanguageTag() + extension ) if os.path.exists(helpPath): return File(helpPath) # More Alternatives helpPath = getResource(__file__, "help", name + extension) if os.path.exists(helpPath): return File(helpPath) return None
def getHelpFile(self): name = "convertfieldtodate" extension = ".xml" locale = PluginsLocator.getLocaleManager().getCurrentLocale() tag = locale.getLanguage() #extension = ".properties" helpPath = gvsig.getResource(__file__, "help", name + "_" + tag + extension) if os.path.exists(helpPath): return File(helpPath) #Alternatives alternatives = PluginsLocator.getLocaleManager().getLocaleAlternatives(locale) for alt in alternatives: helpPath = gvsig.getResource(__file__, "help", name + "_" + alt.toLanguageTag() + extension ) if os.path.exists(helpPath): return File(helpPath) # More Alternatives helpPath = gvsig.getResource(__file__, "help", name + extension) if os.path.exists(helpPath): return File(helpPath) return None
def selfRegister(): registerAction() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() application.addMenu( actionManager.getAction("arena2-importer-showimporter"), "tools/ARENA2/Importador") application.addMenu( actionManager.getAction("arena2-importer-showtablecreator"), "tools/ARENA2/Crear tablas") application.addMenu( actionManager.getAction("arena2-importer-showvalidator"), "tools/ARENA2/Validador")
def launchHexEditor(): pluginsManager = PluginsLocator.getManager() appfolder = pluginsManager.getApplicationFolder().getAbsolutePath() java = os.path.join(System.getProperties().getProperty("java.home"), "bin", "java") installDir = getResource(__file__, "app").replace("\\", "/") profileDir = getDataFolder().replace("\\", "/") cmd = [ java, "-Duser.home=" + profileDir, "-jar", installDir + "/hexeditor-1.0.jar" ] #print cmd subprocess.call(cmd)
def sigpac2csv(): i18n = ToolsLocator.getI18nManager() initPath = ToolsUtilLocator.getFileDialogChooserManager().getLastPath( "OPEN_LAYER_FILE_CHOOSER_ID", None) f = openFileDialog(i18n.getTranslation("_Select_the_SIGPAC_XML_file"), initialPath=initPath.getAbsolutePath()) if f == None or len(f) == 0 or f[0] == None: return xmlf = f[0] #layername = os.path.splitext(os.path.basename(xmlf))[0] with open(getResource(__file__, xmlf), 'r') as f: xml = f.read() data = xmltodic.parse(xml) if hasOnlyPoligons(data): output = "shp" else: output = "csv" outf = os.path.splitext(xmlf)[0] + "." + output if os.path.exists(outf): if confirmDialog( i18n.getTranslation( "_The_file_%s_already_existsXnlXDo_you_want_to_overwrite_itXquestionX" ) % os.path.basename(outf)) == NO: return if output == "csv": convert2cvs(data, outf) else: convert2shp(data, outf) view = currentView() if view == None: return if confirmDialog( i18n.getTranslation( "_File_%s_creaded_XnlXDo_you_want_to_load_it_in_the_current_viewXquestionX" ) % os.path.basename(outf)) == NO: return listfiles = (File(outf), ) actions = PluginsLocator.getActionInfoManager() addlayer = actions.getAction("view-layer-add") addlayer.execute((listfiles, ))
def getRExecPathname(self): if self.getArchitecture() != "x86_64": raise Exception("Architecture not supported.") plugin = PluginsLocator.getManager().getPlugin( "org.gvsig.r.app.mainplugin") pluginFolder = plugin.getPluginDirectory() if self.getOperatingSystem() == "win": f = File(pluginFolder, "R/bin/x64/Rterm.exe") return f.getAbsolutePath().replace("\\", "/") if self.getOperatingSystem() == "lin": f = File(pluginFolder, "R/bin/R") return f.getAbsolutePath() raise Exception("Operating system not supported.")
def selfRegister(): application = ApplicationLocator.getManager() icon = File(os.path.join(os.path.dirname(__file__), "icon.png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("Games", "action", "Games", None, icon) gameExtension = GameExtension() actionManager = PluginsLocator.getActionInfoManager() action_show = actionManager.createAction( gameExtension, "Games", # Action name "Games", # Text "show", # Action command "Games", # Icon name None, # Accelerator 1009100000, # Position "Games" # Tooltip ) action_show = actionManager.registerAction(action_show) application.addTool(action_show, "Games")
def updateControls(self): i18n = ToolsLocator.getI18nManager(); indexAttributes = self.lstActions.getSelectedIndex() toolsSwingManager = ToolsSwingLocator.getToolsSwingManager() model = toolsSwingManager.createFilteredListModel() actions = PluginsLocator.getActionInfoManager().getActions() for action in actions: #print action.getName(), action.getLabel() if action.getLabel()==None: label = action.getName() else: label = "%s (%s)" %(i18n.getTranslation(action.getLabel()),action.getName()) if label.startswith("_"): label = label.replace("_"," ").strip() labeled = LabeledValueImpl(label, action) model.addElement(labeled) model.setFilter(self.txtFilter.getText()) model.sort(True) self.lstActions.setModel(model); self.lstActions.setSelectedIndex(indexAttributes);
def selfRegister(): i18n = ToolsLocator.getI18nManager() moduleId = "sigpac2csv" actionName = "tools-sigpac-sigpac2csv" tooltip_key = i18n.getTranslation("_Convert_SIGPAC_XML_to_gvSIG_format") menu_entry = "tools/SIGPAC/_Convert_XML_to_gvSIG" extension = SIGPAC2CSVExtension() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text", File(getResource(__file__, "i18n"))) # # Registramos los iconos en el tema de iconos icon = File(getResource(__file__, "images", actionName + ".png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting." + moduleId, "action", actionName, None, icon) action = actionManager.createAction( extension, actionName, # Action name tooltip_key, # Text actionName, # Action command actionName, # Icon name None, # Accelerator 1009000000, # Position i18n.getTranslation(tooltip_key) # Tooltip ) action = actionManager.registerAction(action) # Añadimos la entrada en el menu herramientas application.addMenu(action, menu_entry)
def selfRegister(): i18n = ToolsLocator.getI18nManager() moduleId = "SelectTableDuplicates" actionName = "selection-table-select-duplicatesnofirst" tooltip_key = i18n.getTranslation("_Select_all_duplicates_except_the_first") menu_entry = "Selection/_Select_table_duplicates/_Select_all_duplicates_except_the_first" extension = SelectTableDuplicatesExtension() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() # # Registramos los iconos en el tema de iconos icon = File(getResource(__file__,"images",actionName + ".png")).toURI().toURL() iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() iconTheme.registerDefault("scripting." + moduleId, "action", actionName, None, icon) action = actionManager.createAction( extension, actionName, # Action name tooltip_key, # Text actionName, # Action command actionName, # Icon name None, # Accelerator 300450200, # Position i18n.getTranslation(tooltip_key) # Tooltip ) action = actionManager.registerAction(action) # Añadimos la entrada en el menu herramientas application.addMenu(action, menu_entry) # Añadimos la accion como un boton en la barra de herramientas. #application.addTool(action, "selection") application.getMainFrame().addTool(action,"selection","selection-table-duplicates"); application.refreshMenusAndToolBars()
def selfRegister(): config = AccidentRateConfig() config.readConfig() if not config.getboolean("ARENA2", "alreadyDisabled"): disableArena2() config.set("ARENA2", "alreadyDisabled", "false") config.writeConfig() application = ApplicationLocator.getManager() actionManager = PluginsLocator.getActionInfoManager() registerActions() action = actionManager.getAction("accidentrate-importer-showtablecreator") application.addMenu( action, u"tools/_AccidentRate/Administration/Crear tablas de accidentes") action = actionManager.getAction("accidentrate-importer-showimporter") application.addMenu( action, u"tools/_AccidentRate/Administration/Importador de accidentes") action = actionManager.getAction("accidentrate-closingdate-showdialog") application.addMenu(action, u"tools/_AccidentRate/Administration/Fecha de cierre") action = actionManager.getAction("accidentrate-search") application.addMenu(action, u"tools/_AccidentRate/Busqueda de accidentes") action = actionManager.getAction("accidentrate-addlayer") application.addMenu(action, u"tools/_AccidentRate/A\u00F1adir capa de accidentes") action = actionManager.getAction("accidentrate-importer-showvalidator") application.addMenu( action, u"tools/_AccidentRate/Administration/Validador de accidentes")
def launchJEdit(): pluginsManager = PluginsLocator.getManager() appfolder = pluginsManager.getApplicationFolder().getAbsolutePath() java = os.path.join( System.getProperties().getProperty("java.home"), "bin", "java") jeditInstallDir = getResource(__file__, "app").replace("\\","/") jeditProfileDir = getDataFolder().replace("\\","/") CP = "" #jeditInstallDir+"/jedit.jar" for fname in os.listdir(jeditInstallDir+"/jars"): CP += ":"+jeditInstallDir+"/lib/"+fname cmd = [ java, "-cp",CP, "-splash:"+getResource(__file__, "images","jedit-splash"), "-Duser.home="+jeditProfileDir, "-jar", jeditInstallDir+"/jedit.jar", "-settings="+jeditProfileDir, ] #print cmd subprocess.call(cmd)
def addDependencyWithPlugin(pluginCode): pluginsManager = PluginsLocator.getManager() scriptingPlugin = pluginsManager.getPlugin("org.gvsig.scripting.app.extension") scriptingPlugin.addDependencyWithPlugin(pluginsManager.getPlugin(pluginCode))
def addDependencyWithPlugin(pluginCode): pluginsManager = PluginsLocator.getManager() scriptingPlugin = pluginsManager.getPlugin( "org.gvsig.scripting.app.extension") scriptingPlugin.addDependencyWithPlugin( pluginsManager.getPlugin(pluginCode))
def getPluginFolder(): pluginsManager = PluginsLocator.getManager() plugin = pluginsManager.getPlugin("org.gvsig.r.app.mainplugin") f = plugin.getPluginDirectory() return f.getAbsolutePath()
def selfRegister(): config = AccidentRateConfig() config.readConfig() if not config.getboolean("ARENA2", "alreadyDisabled"): disableArena2() config.set("ARENA2", "alreadyDisabled", "false") config.writeConfig() application = ApplicationLocator.getManager() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text", File(getResource(__file__, "i18n"))) # # Registramos los iconos en el tema de iconos iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() icon = File( getResource(__file__, "images", "accidentrate-importer-showimporter.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-importer-showimporter", None, icon) icon = File( getResource( __file__, "images", "accidentrate-importer-showtablecreator.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-importer-showtablecreator", None, icon) icon = File( getResource( __file__, "images", "accidentrate-closingdate-showdialog.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-closingdate-showdialog", None, icon) icon = File(getResource(__file__, "images", "accidentrate-search.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-search", None, icon) icon = File(getResource(__file__, "images", "accidentrate-addlayer.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-addlayer", None, icon) # # Creamos la accion actionManager = PluginsLocator.getActionInfoManager() extension = AccidentRateExtension() action = actionManager.createAction( extension, "accidentrate-importer-showtablecreator", # Action name "Creador de las tablas de accidentes", # Text "accidentrate-importer-showtablecreator", # Action command "accidentrate-importer-showtablecreator", # Icon name None, # Accelerator 1009000901, # Position "_Show_the_accidents_tables_creator_tool" # Tooltip ) action = actionManager.registerAction(action) application.addMenu( action, u"_AccidentRate/Administration/Gesti\u00F3n de accidentes/Crear tablas de accidentes" ) action = actionManager.createAction( extension, "accidentrate-importer-showimporter", # Action name "Importador de accidentes", # Text "accidentrate-importer-showimporter", # Action command "accidentrate-importer-showimporter", # Icon name None, # Accelerator 1009000902, # Position "_Show_the_accidents_import_tool" # Tooltip ) action = actionManager.registerAction(action) application.addMenu( action, u"_AccidentRate/Administration/Gesti\u00F3n de accidentes/Importador de accidentes" ) action = actionManager.createAction( extension, "accidentrate-closingdate-showdialog", # Action name "Administrar fecha de cierre", # Text "accidentrate-closingdate-showdialog", # Action command "accidentrate-closingdate-showdialog", # Icon name None, # Accelerator 1009000903, # Position "_Show_the_accidents_closing_date_tool" # Tooltip ) action = actionManager.registerAction(action) application.addMenu( action, u"_AccidentRate/Administration/Gesti\u00F3n de accidentes/Fecha de cierre" ) action = actionManager.createAction( extension, "accidentrate-search", # Action name "Busqueda de accidentes", # Text "accidentrate-search", # Action command "accidentrate-search", # Icon name None, # Accelerator 1009000100, # Position "Busqueda de accidentes" # Tooltip ) action = actionManager.registerAction(action) application.addMenu( action, u"_AccidentRate/Gesti\u00F3n de accidentes/Busqueda de accidentes") action = actionManager.createAction( extension, "accidentrate-addlayer", # Action name "Añadir capa de accidentes", # Text "accidentrate-addlayer", # Action command "accidentrate-addlayer", # Icon name None, # Accelerator 1009000200, # Position "Añadir capa de accidentes" # Tooltip ) action = actionManager.registerAction(action) application.addMenu( action, u"_AccidentRate/Gesti\u00F3n de accidentes/A\u00F1adir capa de accidentes" )
def getRExecPathname(): manager = PluginsLocator.getManager() plugin = manager.getPlugin("org.gvsig.r.app.mainplugin") return File(plugin.getPluginDirectory(), "R/bin/x64/R.exe")
def registerActions(): application = ApplicationLocator.getManager() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text", File(getResource(__file__, "i18n"))) # # Registramos los iconos en el tema de iconos iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() icon = File( getResource(__file__, "images", "accidentrate-importer-showimporter.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-importer-showimporter", None, icon) icon = File( getResource( __file__, "images", "accidentrate-importer-showtablecreator.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-importer-showtablecreator", None, icon) icon = File( getResource( __file__, "images", "accidentrate-closingdate-showdialog.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-closingdate-showdialog", None, icon) icon = File(getResource(__file__, "images", "accidentrate-search.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-search", None, icon) icon = File(getResource(__file__, "images", "accidentrate-addlayer.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-addlayer", None, icon) icon = File( getResource(__file__, "images", "arena2-importer-showvalidator.png")).toURI().toURL() iconTheme.registerDefault("scripting.AccidentRateExtension", "action", "accidentrate-importer-showvalidator", None, icon) # # Creamos la accion actionManager = PluginsLocator.getActionInfoManager() extension = AccidentRateExtension() action = actionManager.createAction( extension, "accidentrate-importer-showtablecreator", # Action name "Creador de las tablas de accidentes", # Text "accidentrate-importer-showtablecreator", # Action command "accidentrate-importer-showtablecreator", # Icon name None, # Accelerator 1009000901, # Position "_Show_the_accidents_tables_creator_tool" # Tooltip ) action = actionManager.registerAction(action, True) action = actionManager.createAction( extension, "accidentrate-importer-showimporter", # Action name "Importador de accidentes", # Text "accidentrate-importer-showimporter", # Action command "accidentrate-importer-showimporter", # Icon name None, # Accelerator 1009000902, # Position "_Show_the_accidents_import_tool" # Tooltip ) action = actionManager.registerAction(action, True) action = actionManager.createAction( extension, "accidentrate-closingdate-showdialog", # Action name "Administrar fecha de cierre", # Text "accidentrate-closingdate-showdialog", # Action command "accidentrate-closingdate-showdialog", # Icon name None, # Accelerator 1009000903, # Position "_Show_the_accidents_closing_date_tool" # Tooltip ) action = actionManager.registerAction(action, True) action = actionManager.createAction( extension, "accidentrate-search", # Action name "Busqueda de accidentes", # Text "accidentrate-search", # Action command "accidentrate-search", # Icon name None, # Accelerator 1009000100, # Position "Busqueda de accidentes" # Tooltip ) action = actionManager.registerAction(action, True) action = actionManager.createAction( extension, "accidentrate-addlayer", # Action name "Añadir capa de accidentes", # Text "accidentrate-addlayer", # Action command "accidentrate-addlayer", # Icon name None, # Accelerator 1009000200, # Position "Añadir capa de accidentes" # Tooltip ) action = actionManager.registerAction(action, True) action = actionManager.createAction( extension, "accidentrate-importer-showvalidator", # Action name "ARENA2 validator", # Text "accidentrate-importer-showvalidator", # Action command "accidentrate-importer-showvalidator", # Icon name None, # Accelerator 1009000904, # Position "_Show_the_ARENA2_validator_tool" # Tooltip ) action = actionManager.registerAction(action, True)
def registerAction(): #application = ApplicationLocator.getManager() # # Registramos las traducciones i18n = ToolsLocator.getI18nManager() i18n.addResourceFamily("text", File(getResource(__file__, "i18n"))) # # Registramos los iconos en el tema de iconos iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent() icon = File( getResource(__file__, "images", "arena2-importer-showimporter.png")).toURI().toURL() iconTheme.registerDefault("scripting.Arena2ImporterExtension", "action", "arena2-importer-showimporter", None, icon) icon = File( getResource(__file__, "images", "arena2-importer-showtablecreator.png")).toURI().toURL() iconTheme.registerDefault("scripting.Arena2ImporterExtension", "action", "arena2-importer-showtablecreator", None, icon) icon = File( getResource(__file__, "images", "arena2-importer-showvalidator.png")).toURI().toURL() iconTheme.registerDefault("scripting.Arena2ImporterExtension", "action", "arena2-importer-showvalidator", None, icon) # # Creamos la accion actionManager = PluginsLocator.getActionInfoManager() extension = Arena2ImporterExtension() action = actionManager.createAction( extension, "arena2-importer-showimporter", # Action name "ARENA2 importardor", # Text "arena2-importer-showimporter", # Action command "arena2-importer-showimporter", # Icon name None, # Accelerator 650700600, # Position "_Show_the_ARENA2_import_tool" # Tooltip ) action = actionManager.registerAction(action, True) action = actionManager.createAction( extension, "arena2-importer-showtablecreator", # Action name "ARENA2 Creador de tablas", # Text "arena2-importer-showtablecreator", # Action command "arena2-importer-showtablecreator", # Icon name None, # Accelerator 650700600, # Position "_Show_the_ARENA2_tables_creator_tool" # Tooltip ) action = actionManager.registerAction(action, True) action = actionManager.createAction( extension, "arena2-importer-showvalidator", # Action name "ARENA2 validator", # Text "arena2-importer-showvalidator", # Action command "arena2-importer-showvalidator", # Icon name None, # Accelerator 650700600, # Position "_Show_the_ARENA2_validator_tool" # Tooltip ) action = actionManager.registerAction(action, True)