Esempio n. 1
0
def on_gps_started(hook_name):
    parse_xml("""
  <action name='vi_command_line' category="Editor" output="none">
     <description />
     <filter id="Source editor" />
     <shell lang="python">vi.CmdLine()</shell>
  </action>
  <action name='vi_repeat_cmd' category="Editor" output="none">
     <description />
     <filter id="Source editor" />
     <shell lang="python">vi.CmdLine.repeat_command()</shell>
  </action>
  <menu action='vi_command_line' after="Refill">
    <title>/Edit/Vi command line</title>
  </menu>
  <key action="vi_command_line">control-colon</key>
  <key action="vi_repeat_cmd">control-period</key>
""")
Esempio n. 2
0
"""This file makes every other line read-only.
   This is an example of using overlays"""

# ??? For a real production script, this script should be based
# on gps_utils.highlighter.py, which provides on-the-fly highlighting

from GPS import parse_xml, EditorBuffer

parse_xml("""
  <action name="make lines readonly">
     <shell lang="python">readonly.make_readonly()</shell>
  </action>
  <menu action="make lines readonly">
     <title>/Tests/Make Lines Readonly</title>
  </menu>
""")


def make_readonly():
    """Make every other line readonly in the current file"""
    buffer = EditorBuffer.get()
    loc = buffer.at(1, 1)

    overlay = buffer.create_overlay("readonly")
    overlay.set_property("editable", False)

    while loc < buffer.end_of_buffer():
        eol = loc.end_of_line()
        buffer.apply_overlay(overlay, loc, eol - 1)
        loc = loc.forward_line(2)
Esempio n. 3
0
        loc = start.search('</' + buffer.get_chars(start, end - 1),
                           dialog_on_failure=False,
                           case_sensitive=True)
        if loc:
            buffer.current_view().goto(loc[0])
    except:
        pass


parse_xml('''
  <Language>
    <Name>XML</Name>
    <Body_Suffix>.xml</Body_Suffix>
    <Keywords>(&lt;/?\w+&gt;?)|(/?&gt;)</Keywords>
    <Wordchars>&lt;&gt;/</Wordchars>
    <Context>
      <Comment_Start>&lt;!--</Comment_Start>
      <Comment_End>--&gt;</Comment_End>
      <String_Delimiter>&quot;</String_Delimiter>
      <Can_Indent>True</Can_Indent>
      <Syntax_Highlighting>True</Syntax_Highlighting>
      <Case_Sensitive>True</Case_Sensitive>
    </Context>
  </Language>

  <Language>
    <Name>HTML</Name>
    <Spec_Suffix>.html</Spec_Suffix>
    <Parent>XML</Parent>
  </Language>''')
Esempio n. 4
0
                return self.read_targets()
        return None


ant_support = False


# This module needs to be initialized before the others
@hook('gps_started', last=False)
def __on_gps_started():
    Makefile()
    if ant_support:
        Antfile()


parse_xml(Make_Model)
parse_xml(Ant_Model_Template)
parse_xml("""
  <project_attribute
    name="Makefile"
    package="Make"
    editor_page="Build/Make"
    editor_section="Make"
    hide_in="wizard library_wizard"
    description="Makefile to use for this project.">
    <string type="file"/>
  </project_attribute>
  <project_attribute
    name="Make"
    package="Make"
    editor_page="Build/Make"