예제 #1
0
파일: panel.py 프로젝트: zhangshiguang/vy
    def create(self, filename='none'):
        """
        This method creates a horizontal AreaVi widget. It returns the
        AreaVi widget that was created. It as well installs the plugins
        that appear in the vyrc file in the AreaVi widget.
        """
        frame     = Frame(master=self)
        scrollbar = Scrollbar(master=frame)
        area      = AreaVi(filename, frame , border=3, relief=RAISED, 
                           yscrollcommand=scrollbar.set)
        scrollbar.config(command=area.yview)
        scrollbar.pack(side='right', fill=Y)

        from vyapp.plugins import HANDLE

        for handle, args, kwargs in HANDLE:
            handle(area, *args, **kwargs)

        area.focus_set()
        area.pack(expand=True, side='left', fill=BOTH)
        self.add(frame)

        def save_focus(event):
            self.master.focused_area = area

        self.master.focused_area = area
        area.bind('<FocusIn>', save_focus)
        return area
예제 #2
0
def load(plugin, *args, **kwargs):
    autoload(plugin, *args, **kwargs)

    for ind in AreaVi.areavi_widgets(root):
        plugin.install(ind, *args, **kwargs)

    root.status.set_msg('Plugin loaded!')
예제 #3
0
 def handle_line(self, device, filename, line, args):
     """
 
     """
     try:
         area = AreaVi.get_opened_files(root)[filename]
     except KeyError:
         pass
     else:
         set_line(area, line)
예제 #4
0
    def restore_area_focus(self):
        """
        When an AreaVi is destroyed, the focused_area
        is a dead widget, so it gives focus to the first AreaVi
        in the active tab.
        """

        wid = self.nametowidget(self.select())
        seq = AreaVi.areavi_widgets(wid)
        area = next(seq)
        area.focus_set()
예제 #5
0
    def delete_all_breakpoints(self):
        """
        It deletes all added breakpoint tags.
        It is useful when restarting pdb as a different process.
        """

        widgets = AreaVi.get_opened_files(root)
        for index, (filename, line) in self.map_index.items():
            area = widgets.get(filename)
            if area:
                area.tag_delete('_breakpoint_%s' % index)
예제 #6
0
파일: tools.py 프로젝트: zhangshiguang/vy
def findline(filename, line, col=0):
    files = AreaVi.get_opened_files(root)
    filename = abspath(filename)

    try:
        area = files[filename]
    except KeyError:
        area = root.note.open(filename)
    else:
        pass
    finally:
        root.note.set_line(area, line)
예제 #7
0
파일: rope.py 프로젝트: smiled0g/vy
    def update_instances(self, changes):
        """
        After changes it updates all AreaVi instances which 
        were changed.
        """

        # Avoid having to calculate it multiple times.
        self.files = AreaVi.get_opened_files(root)
        for ind in changes.changes:
            if isinstance(ind, (MoveResource,)):
                self.on_move_resource(ind)
            else:
                self.on_general_case(ind)
예제 #8
0
    def delete_all_breakpoints(self):
        """
        It deletes all added breakpoint tags.
        It is useful when restarting pdb as a different process.
        """

        for index, (filename, line) in self.map_index.iteritems():
            try:
                area = AreaVi.get_opened_files(root)[filename]
            except KeyError:
                pass
            else:
                NAME = '_breakpoint_%s' % index
                area.tag_delete(NAME)
예제 #9
0
    def e_pmsg(self, con, nick, user, host, target, msg):
        """
        Private messages sent to the user are handled here.
        """
        # Attempt to retrieve the areavi which corresponds
        # to the target/user.
        base = lambda key_value: (key_value[0].lower(), key_value[1])
        files = iter(AreaVi.get_opened_files(root).items())
        targets = dict(list(map(base, files)))

        try:
            area = targets[nick.lower()]
        except KeyError:
            area = self.create_private_channel(nick)
        area.append(H1 % (nick, msg))
예제 #10
0
    def handle_breakpoint(self, device, index, filename, line):
        """
        When a break point is added.
        """

        self.map_index[index] = (filename, line)
        self.map_line[(filename, line)] = index
        map = AreaVi.get_opened_files(root)

        area = map[filename]

        NAME = '_breakpoint_%s' % index
        area.tag_add(NAME, '%s.0 linestart' % line, '%s.0 lineend' % line)

        area.tag_config(NAME, **self.setup)
예제 #11
0
    def handle_deleted_breakpoint(self, device, index):
        """
        When a break point is removed.
        """

        filename, line = self.map_index[index]
        NAME = '_breakpoint_%s' % index
        area = None

        try:
            area = AreaVi.get_opened_files(root)[filename]
        except KeyError:
            return

        area.tag_delete(NAME)
예제 #12
0
파일: dap.py 프로젝트: curiousTauseef/vy
    def handle_line(self, device, filename, line):
        """
    
        """
        filename = abspath(filename)

        wids = AreaVi.get_opened_files(root)
        area = wids.get(filename)

        if area: root.note.set_line(area, line)
        area.tag_delete('(DebuggerBP)')
        area.tag_add('(DebuggerBP)', '%s.0 linestart' % line,
                     '%s.0 lineend' % line)
        area.tag_config('(DebuggerBP)', **self.setup)
        root.status.set_msg('Debugger stopped at: %s:%s' % (filename, line))