本文整理汇总了Python中GPS.parse_xml方法的典型用法代码示例。如果您正苦于以下问题:Python GPS.parse_xml方法的具体用法?Python GPS.parse_xml怎么用?Python GPS.parse_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GPS
的用法示例。
在下文中一共展示了GPS.parse_xml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register_doc
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def register_doc():
GPS.parse_xml ("""
<documentation_file>
<name>http://www.python.org/doc/2.4.2/tut/tut.html</name>
<descr>Python tutorial</descr>
<menu>/Python/Python Tutorial</menu>
<category>Scripts</category>
</documentation_file>
<documentation_file>
<shell lang="python">python_support.show_python_library()</shell>
<descr>Python Library</descr>
<menu>/Python/Python Library</menu>
<category>Scripts</category>
</documentation_file>""")
if has_pygtk:
GPS.parse_xml ("""
<documentation_file>
<name>http://www.pygtk.org/pygtk2tutorial/index.html</name>
<descr>PyGTK tutorial</descr>
<menu>/Python/PyGTK Tutorial</menu>
<category>Scripts</category>
</documentation_file>
<documentation_file>
<name>http://www.pygtk.org/pygtk2reference/index.html</name>
<descr>PyGTK Reference Manual</descr>
<menu>/Python/PyGTK Reference Manual</menu>
<category>Scripts</category>
</documentation_file>""")
示例2: __init__
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def __init__(self, tool_name, default_args):
"""
Initializes a new instance of the class :class:`TargetConnector` by
creating a build target associated to ``tool_name``, with
``default_args`` used as default arguments.
"""
xml = r"""
<target model="target connector" category="Bareboard"
name="%s">
<launch-mode>MANUALLY_WITH_NO_DIALOG</launch-mode>
<command-line>
<arg>%s</arg>""" % (tool_name, tool_name)
for arg in default_args:
xml += r"""<arg>%s</arg>\n""" % (arg)
xml += """</command-line>
</target>"""
try:
super(TargetConnector, self).__init__(tool_name)
except GPS.Exception:
GPS.parse_xml(xml)
super(TargetConnector, self).__init__(tool_name)
示例3: setup
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def setup(self):
GPS.parse_xml(targets)
GPS.Hook("compilation_finished").add(self.on_compilation_finished)
GPS.Hook("preferences_changed").add(self.on_preferences_changed)
# Initialize trusted_mode and other preferences
self.on_preferences_changed(None)
示例4: __init__
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def __init__(self):
# Whether we trust that there are no links in the project hierarchy
self.trusted_mode = True
cross_ref_runtime.create(
"Cross references in runtime files",
'boolean',
"Index files in the runtime for cross references queries",
False)
# When we support python, we add support for the --runtime attribute.
# This is not supported in GNAT Bench though
xml = self.xml
xml = xml.replace(
"<!-- Runtime_switch support -->",
"<arg>%python(cross_references.runtime_switch())</arg>")
GPS.parse_xml(xml)
GPS.Hook("project_view_changed").add(self.on_project_view_changed)
GPS.Hook("compilation_finished").add(self.on_compilation_finished)
GPS.Hook("preferences_changed").add(self.on_preferences_changed)
GPS.Hook("rsync_finished").add(self.on_rsync_finished)
self.gnatinspect_launch_registered = False
self.gnatinspect_already_running = False
# Initialize self.trusted_mode and other preferences
self.on_preferences_changed(None)
# An action for the menu item /Build/Recompute Xref Info
gps_utils.make_interactive(
lambda *args: self.recompute_xref(quiet=False),
name="recompute xref info")
示例5: __init__
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def __init__(self):
"""
Various initializations done before the gps_started hook
"""
self.port_pref = GPS.Preference("Plugins/python_support/port")
self.port_pref.create(
"Pydoc port", "integer",
"""Port that should be used when spawning the pydoc daemon.
This is a small local server to which your web browser connects to display the
documentation for the standard python library. It is accessed through the
/Python menu when editing a python file""",
9432)
# Add the language definition before the gps_started hook, so that
# python files are correctly found
GPS.Language.register(PythonLanguage(), "Python", ".py", "", ".pyc")
XML = """
<filter_and name="Python file">
<filter id="Source editor" />
<filter language="Python" />
</filter_and>
<documentation_file>
<name>http://docs.python.org/2/tutorial/</name>
<descr>Python tutorial</descr>
<menu>/Help/Python/Python Tutorial</menu>
<category>Scripts</category>
</documentation_file>
<documentation_file>
<shell lang="python">"""
XML += """GPS.execute_action('display python library help')</shell>
<descr>Python Library</descr>
<menu>/Help/Python/Python Library</menu>
<category>Scripts</category>
</documentation_file>
"""
if Gtk:
XML += """
<documentation_file>
<name>http://www.pygtk.org/pygtk2tutorial/index.html</name>
<descr>PyGTK tutorial</descr>
<menu>/Help/Python/PyGTK Tutorial</menu>
<category>Scripts</category>
</documentation_file>
<documentation_file>
<name>http://www.pygtk.org/pygtk2reference/index.html</name>
<descr>PyGTK Reference Manual</descr>
<menu>/Help/Python/PyGTK Reference Manual</menu>
<category>Scripts</category>
</documentation_file>
"""
GPS.parse_xml(XML)
示例6: __init__
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def __init__(self):
# Create all custom things that do not require GPS' GUI to be ready
# (i.e.: all but menus and hooks).
for xml_nodes in (
self.PROJECT_ATTRIBUTES, self.BUILD_MODES,
self.GNATCOV_DOCUMENTATION, self.GNATEMU_DOCUMENTATION,
):
GPS.parse_xml(list_to_xml(xml_nodes))
# Defer further initialization to when GPS is completely ready.
GPS.Hook('gps_started').add(self.on_gps_started)
示例7: on_gps_started
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def on_gps_started(hook_name):
"Initializes this module."
init = """<action name='%(action)s' category='Editor'>
<description>
End the current Ada block, by providing the appropriate "end" statement
</description>
<filter language="ada" error='%(action)s requires an Ada file' />
<shell lang="python"
output="none">block_completion.block_complete("%%F");</shell>
</action>""" % {"action": action_name}
GPS.parse_xml(init)
示例8: on_gps_started
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def on_gps_started (hook_name):
""" Called once, when GPS is starting.
"""
global gnatcov_menu_separator
if os_utils.locate_exec_on_path ("gnatcov") != "":
GPS.Hook("compilation_finished").add(on_compilation_finished)
menu = "/Tools/GNATcov/"
ref = "Coverage"
gnatcov_menu = GPS.Menu.create(menu + '-', ref=ref, add_before=False)
GPS.parse_xml(xml.replace("@[email protected]", 'menu="%s"' % menu))
示例9: on_gps_started
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def on_gps_started(hook_name):
global gnatcheckproc
gnatcheckproc = gnatCheckProc()
contextualMenu()
GPS.parse_xml(
"""
<tool name="GnatCheck" package="Check" index="Ada" override="false">
<language>Ada</language>
<switches lines="1" sections="-rules">
<check label="process RTL units" switch="-a" line="1"/>
<check label="debug mode" switch="-d" line="1"/>
<field label="Coding standard file" switch="-from" separator="=" as-file="true" line="1" section="-rules"/>
</switches>
</tool>
<action name="gnatcheck root project" category="Coding Standard" output="none">
<description>Check Coding Standard of the root project</description>
<shell lang="python">gnatcheck.gnatcheckproc.check_project (GPS.Project.root())</shell>
</action>
<action name="gnatcheck root project recursive" category="Coding Standard" output="none">
<description>Check Coding Standard of the root project and its subprojects</description>
<shell lang="python">gnatcheck.gnatcheckproc.check_project (GPS.Project.root(), True)</shell>
</action>
<action name="gnatcheck file" category="Coding Standard" output="none">
<description>Check Coding Standard of the selected file</description>
<filter id="Source editor"/>
<shell lang="python">gnatcheck.gnatcheckproc.check_file (GPS.EditorBuffer.get().file())</shell>
</action>
<action name="edit gnatcheck rules" category="Coding Standard" output="none">
<description>Edit the Coding Standard file (coding standard)</description>
<shell lang="python">gnatcheck.gnatcheckproc.edit ()</shell>
</action>
<submenu>
<title>Tools</title>
<submenu after="Browsers">
<title>Coding _Standard</title>
<menu action="edit gnatcheck rules">
<title>_Edit rules file</title>
</menu>
<menu action="gnatcheck root project recursive">
<title>Check root project and _subprojects</title>
</menu>
<menu action="gnatcheck root project">
<title>Check root _project</title>
</menu>
<menu action="gnatcheck file">
<title>Check current _file</title>
</menu>
</submenu>
</submenu>"""
)
示例10: __on_gps_started
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def __on_gps_started():
GPS.parse_xml("""
<tool name="GnatCheck" package="Check" index="Ada" override="false">
<language>Ada</language>
<switches sections="-rules">
<check label="process RTL units" switch="-a" line="1"/>
<check label="debug mode" switch="-d" line="1"/>
<field label="Coding standard file"
switch="-from"
separator="="
as-file="true"
line="1"
section="-rules"/>
</switches>
</tool>""")
示例11: load_xml_startup_script
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def load_xml_startup_script(name):
"""Load an XML startup script. Name must include the .xml extension"""
for dir in ("%sshare/gps/support/core/" % GPS.get_system_dir(),
"%sshare/gps/support/ui/" % GPS.get_system_dir(),
"%sshare/gps/library/" % GPS.get_system_dir(),
"%sshare/gps/plug-ins/" % GPS.get_system_dir()):
try:
f = file("%s%s" % (dir, name)).read()
break
except:
f = None
GPS.parse_xml(f)
process_all_events()
示例12: on_gps_started
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def on_gps_started (hook_name):
"Initializes this module."
global action_name, menu_name
init = "<action name='" + action_name + """' category='Editor'>
<description>End the current Ada block, by providing the appropriate "end" statement</description>
<filter language="ada"
error='""" + action_name + """ requires an Ada file' />
<shell lang="python" output="none">block_completion.block_complete("%F");</shell>
</action>
<menu action='""" + action_name + """' before="Refill">
<title>""" + menu_name + """</title>
</menu>"""
GPS.parse_xml (init)
示例13: init_switches
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
def init_switches(self):
global xmlCompilerHead, xmlCompilerDefault, xmlCompilerTrailer
# ensure_switches returns true if the gnat command is not identical to
# the previous one. In this case, we need to recreate the whole xml
# tree and call GPS.parse_xml to update the switch editor.
if self.__ensure_switches():
try:
xmlCompiler = self.__get_xml()
except:
GPS.Console("Messages").write ("Exception thrown in ada_support.py:\n")
name = sys.exc_info()[1]
tb = traceback.format_list (traceback.extract_tb(sys.exc_info()[2]))
for info in tb:
GPS.Console("Messages").write (info)
GPS.Console("Messages").write (str (name) + "\n");
xmlCompiler = xmlCompilerHead+xmlCompilerDefault+xmlCompilerTrailer
GPS.parse_xml ("""<?xml version="1.0" ?><GPS>"""+xmlCompiler+"</GPS>")
示例14: points
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
GPS.parse_xml ("""
<!-- Support for running GNATStack as a build target -->
<target-model name="gnatstack" category="">
<description>Run GNATStack for analysis</description>
<command-line>
<arg>gnat</arg>
<arg>stack</arg>
<arg>-pi</arg>
<arg>-Q</arg>
<arg>-x</arg>
<arg>-Wa</arg>
<arg>-P%PP</arg>
</command-line>
<switches>
</switches>
</target-model>
<target model="gnatstack" category="GNATStack" name="Run GNATStack">
<in-toolbar>FALSE</in-toolbar>
<in-menu>FALSE</in-menu>
<launch-mode>MANUALLY_WITH_DIALOG</launch-mode>
<command-line>
<arg>gnat</arg>
<arg>stack</arg>
<arg>-pi</arg>
<arg>-Q</arg>
<arg>-x</arg>
<arg>-Wa</arg>
<arg>-P%PP</arg>
</command-line>
</target>
<!-- Support for GNATStack's switches in Project Properties Editor -->
<tool name="GNATStack" package="Stack" attribute="switches" index="">
<switches lines="4">
<title line="1" column="1">Entry points</title>
<field line="1" column="1" switch="-e" separator=" " label="use specific list of subprograms as entry points (e1,e2,...)"/>
<field line="1" column="1" switch="-r" separator=" " label="use all subprograms matching reg-exp as entry points"/>
<check line="1" column="1" switch="-a" label="use all subprograms as entry points"/>
<title line="2" column="1">Stack frame sizes</title>
<spin line="2" column="1" switch="-c" separator=" " min="0" max="2147483647" default="0" label="size of frame for cycle entry"/>
<spin line="2" column="1" switch="-d" separator=" " min="0" max="2147483647" default="0" label="size of frame for unbounded (dynamic) calls"/>
<spin line="2" column="1" switch="-u" separator=" " min="0" max="2147483647" default="0" label="size of frame for unknown (external) calls"/>
<title line="3" column="1">CI in object files</title>
<field line="3" column="1" switch="-s" separator="=" label="name of the section where the .ci is in the object"/>
<field line="3" column="1" switch="-oc" separator="=" label="name of the objcopy executable"/>
<check line="4" column="1" switch="-ca" label="extract all cycles"/>
<check line="4" column="1" switch="-k" label="keep temporary files"/>
</switches>
</tool>
""")
示例15:
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import parse_xml [as 别名]
import GPS, os.path
GPS.parse_xml(
"""
<action name="simple_project_from_dialog" show-command="false" category="Projects">
<shell lang="python">simple_project.create_from_dialog()</shell>
</action>
<action name="simple_project_from_current" show-command="false" category="Projects">
<filter id="Source editor" />
<shell lang="python">simple_project.create_from_context()</shell>
</action>
<action name="simple_project_and_main" show-command="false" category="Projects">
<shell lang="python">simple_project.create_project_and_main()</shell>
</action>
<menu action="simple_project_from_dialog">
<title>/Project/Create from Dialog</title>
</menu>
<menu action="simple_project_from_current">
<title>/Project/Create from Current File</title>
</menu>
<menu action="simple_project_and_main">
<title>/Project/Create Project and Main Unit</title>
</menu>
"""
)