Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
iogf committed Feb 29, 2020
2 parents d6b4919 + cdcbe57 commit 4216a43
Show file tree
Hide file tree
Showing 50 changed files with 89 additions and 138 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.core import setup

setup(name="vy",
version="4.0.0",
version="4.0.1",
description="A vim-like in python made from scratch.",
packages=["vyapp",
"vyapp.plugins",
Expand Down
1 change: 1 addition & 0 deletions vyapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@
# attempting to load a non existing file.
if not args.verbose:
sys.stderr = Debug()
root.event_generate('<<Started>>')

2 changes: 1 addition & 1 deletion vyapp/areavi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from vyapp.mixins import DataEvent, IdleEvent
from tkinter import *
from tkinter import Text, IntVar
import os

class AreaVi(Text, DataEvent, IdleEvent):
Expand Down
5 changes: 3 additions & 2 deletions vyapp/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
This module implements basic input data scheme.
"""

from tkinter import *
# from tkinter import *
from tkinter import Frame, Entry, BOTH
from vyapp.app import root
from vyapp.mixins import DataEvent, IdleEvent

class AskCancel(Exception):
pass

class InputBox(object):
class InputBox:
def __init__(self, default_data=''):
self.default_data = default_data

Expand Down
4 changes: 2 additions & 2 deletions vyapp/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def create_widgets(self):
Grid.rowconfigure(self, 0, weight=1)
Grid.columnconfigure(self, 0, weight=1)

class Debug(object):
class Debug:
def write(self, *args):
pass

def flush(object):
def flush(self):
"""
It seems python calls this method before exiting
if it doesnt exist then python3 ends up with an error
Expand Down
2 changes: 1 addition & 1 deletion vyapp/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from tkinter import LEFT, BOTH, Text, SCROLL
from vyapp.mixins import Echo

class Option(object):
class Option:
def __init__(self, name, type='', doc=''):
self.name = name
self.doc = doc
Expand Down
3 changes: 1 addition & 2 deletions vyapp/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from functools import wraps, update_wrapper
from vyapp.areavi import AreaVi
from functools import wraps

# ENV is a dict holding plugins objects, like functions, classes etc.
# Plugins should install their handles in ENV.
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/anchors.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""

class Anchors(object):
class Anchors:
def __init__(self, area):
area.add_mode('ANCHORS')
self.area = area
Expand Down
42 changes: 42 additions & 0 deletions vyapp/plugins/blink_pair.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Overview
========
This plugin implements a mechanism to highligh pairs of ( ) [ ] { }.
"""
from vyapp.areavi import AreaVi
from vyapp.app import root

class BlinkPair:
setup={'background':'pink',
'foreground':'black'}
max=1500
timeout=1000

def __init__(self, area, *pairs):
self.pairs = pairs
self.area = area

self.area.tag_config('(BLINK)', **self.setup)
self.id = self.area.hook('blink-pair', '-1',
'<FocusIn>', lambda e: self.scale())

self.area.hook('blink-pair', '-1', '<FocusOut>',
lambda e: self.area.after_cancel(self.id))

def scale(self):
self.id = self.area.after(self.timeout, self.scale)
index0 = 'insert -%sc' % self.max
index1 = 'insert +%sc' % self.max

if self.area.tag_ranges('(BLINK)'):
self.area.tag_remove('(BLINK)', index0, index1)
for lhs, lhr in self.pairs:
index = self.area.case_pair(
'insert', self.max, lhs, lhr)
if index: self.area.tag_add(
'(BLINK)', index, '%s +1c' % index)

install = BlinkPair
2 changes: 1 addition & 1 deletion vyapp/plugins/builtin_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Description: Get the AreaVi instance that is focused in ALPHA mode.
"""

class BuiltinModes(object):
class BuiltinModes:
def __init__(self, area):
self.area = area

Expand Down
1 change: 0 additions & 1 deletion vyapp/plugins/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"""

from vyapp.plugins import Command
from traceback import print_exc as debug
from vyapp.tools import exec_pipe, e_stop
from vyapp.ask import Ask
from vyapp.plugins import ENV
Expand Down
1 change: 0 additions & 1 deletion vyapp/plugins/cmd_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"""

from vyapp.plugins import Command
from vyapp.areavi import AreaVi

@Command()
def find(area, regex, handle, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/cursor_status.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from vyapp.app import root

class CursorStatus(object):
class CursorStatus:
def __init__(self, area, timeout=1000):
self.area = area
self.timeout = timeout
Expand Down
2 changes: 0 additions & 2 deletions vyapp/plugins/deadcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
from subprocess import Popen, STDOUT, PIPE
from os.path import relpath
from vyapp.widgets import LinePicker
from vyapp.areavi import AreaVi
from vyapp.plugins import ENV
from vyapp.tools import get_project_root
from vyapp.base import printd
from vyapp.app import root
Expand Down
5 changes: 0 additions & 5 deletions vyapp/plugins/delve.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,14 @@
"""

from subprocess import Popen, PIPE, STDOUT
from untwisted.expect import Expect, LOAD, CLOSE
from untwisted.wrappers import xmap
from untwisted.splits import Terminator
from vyapp.regutils import RegexEvent
from re import findall
from vyapp.dap import DAP
from vyapp.ask import Ask
from vyapp.areavi import AreaVi
from vyapp.app import root
import shlex
import sys
import os

class Delve(DAP):
def __call__(self, area):
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/fsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from vyapp.app import root


class FSearch(object):
class FSearch:
def __init__(self, area):
self.area = area
self.output = ''
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/fsniffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from os.path import basename


class FSniffer(object):
class FSniffer:
options = LinePicker()
wide = True

Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/fstmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from vyapp.base import printd
from vyapp.app import root

class Fstmt(object):
class Fstmt:
options = LinePicker()
path = 'ag'

Expand Down
6 changes: 0 additions & 6 deletions vyapp/plugins/gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,14 @@
"""

from subprocess import Popen, PIPE, STDOUT
from tkinter.filedialog import askopenfilename
from untwisted.expect import Expect, LOAD, CLOSE
from untwisted.wrappers import xmap
from untwisted.splits import Terminator
from vyapp.regutils import RegexEvent
from re import findall
from vyapp.dap import DAP
from vyapp.ask import Ask
from vyapp.areavi import AreaVi
from vyapp.app import root
import shlex
import sys
import os

class GDB(DAP):
def __call__(self, area):
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/gohints.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def build(self, data):
return [Option(ind['name'], 'Type:%s' % ind['type'],
'Class:%s' % ind['class']) for ind in data[1]]

class GolangCompletion(object):
class GolangCompletion:
PATH = 'gocode'

def __init__(self, area):
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from vyapp.app import root
from vyapp.ask import Ask

class Home(object):
class Home:
def __init__(self, area):
self.area = area
area.install('home',
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/ibash.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from vyapp.plugins import ENV
import sys

class Process(object):
class Process:
def __call__(self, area):
area.install('ibash',
('NORMAL', '<Control-F9>', lambda event: self.dump_region(event.widget)),
Expand Down
1 change: 0 additions & 1 deletion vyapp/plugins/inline_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"""

from re import escape
import os.path

DEFAULT = '#'
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"""

from tkinter.messagebox import *
# from tkinter.messagebox import *
from tkinter.filedialog import askopenfilename, asksaveasfilename
from vyapp.app import root
from vyapp.ask import Ask
Expand Down
1 change: 0 additions & 1 deletion vyapp/plugins/iocmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""

from vyapp.plugins import Command
from vyapp.areavi import AreaVi
from vyapp.app import root

@Command('s')
Expand Down
4 changes: 0 additions & 4 deletions vyapp/plugins/jsdebugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,13 @@
"""

from subprocess import Popen, PIPE, STDOUT
from untwisted.expect import Expect, LOAD, CLOSE
from untwisted.wrappers import xmap
from untwisted.splits import Terminator
from vyapp.regutils import RegexEvent
from vyapp.dap import DAP
from vyapp.ask import Ask
from vyapp.app import root
import shlex
import sys
import os

class JSDebugger(DAP):
def __call__(self, area):
Expand Down
7 changes: 0 additions & 7 deletions vyapp/plugins/jsonfmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"""

from vyapp.plugins import ENV
from vyapp.areavi import AreaVi
from subprocess import Popen, PIPE
from vyapp.app import root

Expand All @@ -45,9 +43,4 @@ def run_printer(self, event):

self.area.chmode('NORMAL')

def fmt_data(self, start, end, data):
self.area.delete(start, end)
self.area.insert(start, output)


install = FmtJSON
3 changes: 2 additions & 1 deletion vyapp/plugins/line_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
Description: Shows an input text field to insert a Line.Col value to place the cursor at that position.
"""
from vyapp.ask import *
from vyapp.ask import Ask
from tkinter import TclError

def go_to_pos(area):
ask = Ask()
Expand Down
42 changes: 0 additions & 42 deletions vyapp/plugins/match_sym_pair.py

This file was deleted.

2 changes: 1 addition & 1 deletion vyapp/plugins/mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"""

from subprocess import check_output, check_call, Popen
from subprocess import check_output, check_call
from os.path import expanduser, dirname, join
from vyapp.base import printd
from vyapp.tools import error
Expand Down
2 changes: 1 addition & 1 deletion vyapp/plugins/mode_shortcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from vyapp.app import root

class ModeShortcut(object):
class ModeShortcut:
target_id = 'NORMAL'

def __init__(self, area):
Expand Down
Loading

0 comments on commit 4216a43

Please sign in to comment.