예제 #1
0
파일: cmd.py 프로젝트: zhangshiguang/vy
    def exec_cmd(self, event):
        ask = Ask()
        Command.set_target(self.area)
        sys.stdout.write('(cmd) Executed code:\n>>> %s\n' % ask.data)

        data = ask.data.encode('utf-8')
        exec_pipe(data, ENV)
예제 #2
0
    def send_cmd(self, event):
        """
        Used to drop irc commands.
        """

        ask = Ask()
        send_cmd(self.con, ask.data)
예제 #3
0
파일: cmd.py 프로젝트: curiousTauseef/vy
    def exec_cmd(self, event):
        ask = Ask()
        Command.set_target(self.area)
        print('\n(cmd) Executed code:\n>>> %s\n' % ask.data)

        data = ask.data.encode('utf-8')
        self.runcode(data, ENV)
예제 #4
0
파일: home.py 프로젝트: Happy-Ferret/vy
    def set_home(self, event):
        """    
        Set the AreaVi home dir.
        """

        root.status.set_msg('Set home dir!')
        ask         = Ask(self.area.filename)
        AreaVi.HOME = ask.data
예제 #5
0
def exec_cmd(area, env):
    ask = Ask()
    area.active()
    sys.stdout.write('\nLine executed:\n%s\n>>>\n' % ask.data)

    data = ask.data.encode('utf-8')
    exec_pipe(data, env)
    return 'break'
예제 #6
0
파일: mc.py 프로젝트: smiled0g/vy
    def rename(self):
        path = self.area.get_line()
        ask = Ask()
        destin = join(dirname(path), ask.data)
        code = check_call('mv "%s" %s' % (path, destin), shell=1)

        root.status.set_msg('File renamed!')
        self.ls(self.ph)
예제 #7
0
파일: debug.py 프로젝트: yutzhead/vy
    def start_debug_args(self, area):
        ask  = Ask(area)
        ARGS = 'python -u -m pdb %s %s' % (area.filename, ask.data)
        ARGS = shlex.split(ARGS)

        self.kill_debug_process()
        self.create_process(ARGS)
        
        set_status_msg('Debug started ! Args: %s' % ask.data)
예제 #8
0
파일: delve.py 프로젝트: zhangshiguang/vy
    def run_args(self, event):
        ask = Ask()

        self.kill_process()

        self.create_process(
            shlex.split('dlv debug %s %s' % (event.widget.filename, ask.data)))

        root.status.set_msg('(delve) Started: %s' % ask.data)
        event.widget.chmode('NORMAL')
예제 #9
0
    def dump_signal(self, event):
        root.status.set_msg('(ibash) Signal number SIGINT(2)/SIGQUIT(3):')
        ask = Ask()
        signal = None

        try:
            signal = int(ask.data)
        except ValueError as e:
            root.status.set_msg('(ibash) Invalid signal')
        killpg(self.child.pid, signal)
예제 #10
0
파일: mc.py 프로젝트: smiled0g/vy
    def create_dir(self):
        root.status.set_msg('Type dir name:')
        path = self.area.get_line()

        ask = Ask()
        path = join(path, ask.data)
        code = check_call('mkdir "%s"' % path, shell=1)

        root.status.set_msg('Folder created!')
        self.ls(self.ph)
예제 #11
0
파일: home.py 프로젝트: curiousTauseef/vy
    def set_home(self, event):
        """    
        Set the AreaVi home dir.
        """

        root.status.set_msg('Home dir:')
        ask = Ask(self.area.filename)

        AreaVi.HOME = ask.data
        root.status.set_msg('AreaVi HOME: %s' % AreaVi.HOME)
예제 #12
0
    def run_args(self, event):
        ask = Ask()
        ARGS = '%s -u -m pdb %s %s' % (self.python, event.widget.filename,
                                       ask.data)
        self.kill_process()

        ARGS = shlex.split(ARGS)
        self.create_process(ARGS)

        root.status.set_msg('(pdb) Started with Args: %s' % ask.data)
        event.widget.chmode('NORMAL')
예제 #13
0
    def run_args(self, event):
        ask = Ask()

        self.kill_process()

        self.create_process(
            shlex.split('node inspect %s %s' %
                        (event.widget.filename, ask.data)))

        root.status.set_msg('JSDebugger debug started: %s' % ask.data)
        event.widget.chmode('NORMAL')
예제 #14
0
def go_to_pos(area):
    ask = Ask()

    try:
        area.seecur(ask.data)
    except TclError:
        pass

    try:
        area.setcur(ask.data)
    except TclError:
        pass
예제 #15
0
    def start_debug_args(self, area):
        ask = Ask(area)
        ARGS = '%s -u -m pdb %s %s' % (self.python, area.filename, ask.data)
        ARGS = shlex.split(ARGS)

        self.kill_debug_process()
        self.delete_all_breakpoints()
        self.clear_breakpoint_map()

        self.create_process(ARGS)

        root.status.set_msg('Debug started ! Args: %s' % ask.data)
예제 #16
0
    def find(self, event):
        root.status.set_msg('Search Topic:')
        ask = Ask()

        data = check_output(
            ['googler', '--json', '-w', 'https://stackoverflow.com', ask.data])

        area = root.note.create('(?) %s...' % ask.data[:15])
        hits = json.loads(data)

        for ind in hits:
            self.insert_hits(area, ind)
        self.area.chmode('NORMAL')
        root.status.set_msg('Found %s links.' % len(hits))
예제 #17
0
파일: io.py 프로젝트: smiled0g/vy
def rename(area):
    # self.area.filename
    root.status.set_msg('New filename:')

    ask = Ask()
    dir = os.path.dirname(area.filename)
    dst = os.path.join(dir, ask.data)

    try:
        os.rename(area.filename, dst)
    except OSError:
        root.status.set_msg('Failed to rename!')
    else:
        area.filename = dst
        root.status.set_msg('File renamed')
예제 #18
0
    def find(self, event):
        """
        """
        ask = Ask()

        # If it is none then the user canceled the entry.
        # It should accept '' as a valid entry.
        if ask.data == None: return
        
        matches = self.build_sql(ask.data)

        if not len(matches):
            root.status.set_msg('No snippet found')
        else:
            self.choices(matches)
        self.area.chmode('NORMAL')
예제 #19
0
파일: io.py 프로젝트: zhangshiguang/vy
    def rename(self, event):
        """
        Rename the current AreaVi instance file.
        """

        root.status.set_msg('Type a filename:')

        ask = Ask()
        dir = os.path.dirname(self.area.filename)
        dst = os.path.join(dir, ask.data)

        try:
            os.rename(self.area.filename, dst)
        except OSError:
            root.status.set_msg('Failed to rename!')
        else:
            self.area.filename = dst
            root.status.set_msg('File renamed')
예제 #20
0
    def match(self, event):
        """

        """

        ask = Ask()
        data = ask.data.split(' ')
        find = lambda ind: self.area.find(
            escape(ind).lower(), '1.0', step='+1l linestart')

        seq = self.match_regions(find, data)
        matches = ((self.area.filename, line,
                    self.area.get_line('%s.0' % line)) for count, line in seq)

        if not seq:
            root.status.set_msg('No pattern found!')
        else:
            self.options(matches)
예제 #21
0
파일: rope.py 프로젝트: zhangshiguang/vy
    def rename(self, name):
        ask = Ask()

        tmp0    = self.area.get('1.0', 'insert')
        offset  = len(tmp0)
        path    = self.get_root_path()
        project = Project(path)
        mod     = path_to_resource(project, self.area.filename)
        renamer = Rename(project, mod, offset)
        changes = renamer.get_changes(ask.data)
        project.do(changes)

        self.update_instances(changes)

        print('\nRope - Renamed resource ..\n')
        print(changes.get_description())
        self.area.chmode('NORMAL')
        root.status.set_msg('Resources renamed!')
        project.close()
예제 #22
0
    def put(self, event):
        """
        In order to update a snippet it has to contain
        a field @(id)
        """

        ask = Ask()

        if not ask.data: 
            return

        values = (ask.data, self.area.join_ranges('sel', '\n'))

        self.area.tag_remove('sel', 'sel.first', 'sel.last')
        
        self.cur.execute('''INSERT INTO snippet 
        (title, data) VALUES (?, ?)''', values)

        self.conn.commit()
        self.area.chmode('NORMAL')

        root.status.set_msg('Snippet saved!')
예제 #23
0
파일: rope.py 프로젝트: zhangshiguang/vy
    def move(self, event):
        """
        """
        ask = Ask()

        tmp0    = self.area.get('1.0', 'insert')
        offset  = len(tmp0)

        path    = self.get_root_path()
        project = Project(path)

        project = Project(path)
        mod     = path_to_resource(project, self.area.filename)
        mover   = create_move(project, mod, offset)
        destin  = path_to_resource(project, ask.data)
        changes = mover.get_changes(destin)
        project.do(changes)

        self.update_instances(changes)
        project.close()

        self.area.chmode('NORMAL')
        root.status.set_msg('Resources moved!')
예제 #24
0
 def open_private_channel(self, event):
     data = Ask().data
     if data: self.create_private_channel(data)
예제 #25
0
    def get_pattern(self, event):
        root.status.set_msg('Snippet pattern:')
        ask = Ask()

        if ask.data:
            self.find(ask.data)
예제 #26
0
 def ask_data_and_dump(self, area):
     ask = Ask()
     data = ask.data.encode('utf-8')
     self.stdin.dump('%s\n' % data)
예제 #27
0
파일: delve.py 프로젝트: zhangshiguang/vy
 def send_dcmd(self, event):
     ask = Ask()
     self.send('%s\r\n' % ask.data)
     root.status.set_msg('(delve) Sent cmd!')
예제 #28
0
 def execute_statement(self, area):
     ask = Ask(area)
     self.send('!%s\r\n' % ask.data)
예제 #29
0
 def evaluate_expression(self, area):
     ask = Ask(area)
     self.send('print %s\r\n' % ask.data)
예제 #30
0
파일: delve.py 프로젝트: zhangshiguang/vy
    def evaluate_expression(self, event):
        ask = Ask()

        self.send("print %s\r\n" % ask.data)
        root.status.set_msg('(delve) Sent expression!')