Skip to content

Commit

Permalink
Merge branch 'release/1.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbetancourt committed Dec 7, 2017
2 parents b42028d + 6d0741f commit a18a821
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 61 deletions.
47 changes: 25 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
# Config file for automatic testing at travis-ci.org
# This file will be regenerated if you run travis_pypi_setup.py

language: python
python:
- 3.6
- 3.5
- 3.4
- 3.3

# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -U tox-travis

# command to run tests, e.g. python setup.py test
script: tox

# After you create the Github repo and add it to Travis, run the
# travis_pypi_setup.py script to finish PyPI deployment setup
# This file was autogenerated and will overwrite each time you run travis_pypi_setup.py
deploy:
provider: pypi
distributions: sdist bdist_wheel
user: akhail
password:
secure: PLEASE_REPLACE_ME
on:
tags: true
repo: akhail/tebless
secure: !!binary |
bDVpZ2hodnB3MkxsWlZFL3NpdTJlUS9qVHd2VXk3K3NFTm1kR3F3SUJWaCtyUSszZkNVOERkbmJM
UW03TEhXbFVreHZFb3ZuRzd4WUowOXM2VXA5NVFqNW5GVk9OQzhPaUJ0ZWdrbWdJdFZHMUdLMTFo
RGdFVG1vSEZ0SDg1SXJENUlDOUlhU2dicWlKR3RNa2xZVU16WTNkWUNvUFM1ZU94SCtXQ0NTMEJK
THB4TzVmTVFzWnVHdUVHWnlIbFRTaGNJSHFOQ2l6TWNpbUhGaW5rSXVMWGR4TTNOSHZQZ0pJK3VX
UTVIOG1UQzBYTE03VC9Tb3h5dEo1TkZrWkRSVEQ2R2pkNCszbE0zSTZWbnZmbzYzVXRXTWoxTFZW
aUNyeVpRUHZMd0IxUFNpRlJ4OVBFTHNXK09vTXZjeWZFRmtnd0FRTlRBRk4wNVBGVG5neVVQL3l2
VkZjSjkzb0VtVVFQdjhwL0N4cEZubVR0aVRhZWMvU3lEL3phS29HZTcwNnMwSDNRdHZQQkgzTWZL
L2h0K0ZRNjBxV2UrcjRVcitvL1EvdklzSWN2blY0cUhXY3FKN1dFclJGSldaWm56MXJORXlVV2Mz
ZFZRaHZHYytMcGQ2d3lsSmswcG80SDN5a3lqWUFvbW9YSFFRUnFrVDluL3ArS3VTWnljaUs4dWVG
d1FYdHE4RHErNGloZnhlODdkWEJnMXJlRVVGU3loRmNxc1FsV21vK2VubGx5UjMxYUlEckN2MzRJ
VHJHeUdBaGlmZjEvb3FjbExSZXFEZ3FJUjkyNzZJMUt6K3dvU3VmbVhLeUVSbkNhYU5sUk1PQnJS
aWZGeFpYOGVDYUQ4UE8yTFk4TlBqQy8vbi9HVGhYc3BiMXZxVkMzQzkxdXUwaHFiZXpDdXp3azQ9
true:
python: 3.6
repo: akhail/tebless
tags: true
install: pip install -U tox-travis
language: python
python:
- 3.6
- 3.5
- 3.4
- 3.3
script: tox
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ name = "pypi"

blessed = "*"
events = {git = "git://github.com/Akhail/events.git"}
"flake8" = "*"


[dev-packages]

bumpversion = "==0.5.3"
watchdog = "==0.8.3"
"flake8" = "==2.6.0"
tox = "==2.3.1"
tox = "*"
coverage = "==4.1"
sphinx = "==1.4.8"
cryptography = "*"
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Tebless


.. image:: https://img.shields.io/pypi/v/tebless.svg
:target: https://pypi.python.org/pypi/tebless
:target: https://pypi.python.org/pypi/tebless

.. image:: https://img.shields.io/travis/akhail/tebless.svg
:target: https://travis-ci.org/akhail/tebless
:target: https://travis-ci.org/akhail/tebless

.. image:: https://readthedocs.org/projects/tebless/badge/?version=latest
:target: https://tebless.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
:target: http://tebless.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status

.. image:: https://pyup.io/repos/github/akhail/tebless/shield.svg
:target: https://pyup.io/repos/github/akhail/tebless/
.. image:: https://pyup.io/repos/github/Akhail/Tebless/shield.svg
:target: https://pyup.io/repos/github/Akhail/Tebless/
:alt: Updates


Expand Down
2 changes: 1 addition & 1 deletion tebless/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__author__ = """Michel Betancourt"""
__email__ = 'MichelBetancourt23@gmail.com'
__version__ = '1.2.0'
__version__ = '1.2.1'
6 changes: 4 additions & 2 deletions tebless/devs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

import logging
import functools

echo = functools.partial(print, end='', flush=True)

from ._debug import init_debug, Debug
from ._widget import Widget

echo = functools.partial(print, end='', flush=True)

__all__ = ['Widget', 'init_debug', 'Debug']
5 changes: 1 addition & 4 deletions tebless/devs/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT

import logging
from functools import partial
from copy import copy
from events import Events
from blessed import Terminal
from tebless.utils import Store, dict_diff
from tebless.utils import Store
from tebless.devs import echo, Debug


Expand Down
4 changes: 3 additions & 1 deletion tebless/examples/filter_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def change(sender):
'validation': r'\d'
}, {
'cordy': 1,
'items': ['Valor {:04d}'.format(randint(0, 1000)) for x in range(10000)],
'items': [
'Valor {:04d}'.format(randint(0, 1000)) for x in range(10000)
],
'header': 'Lista',
'footer': '{page}/{last}, Total: {count}',
'on_enter': change
Expand Down
2 changes: 1 addition & 1 deletion tebless/examples/nested_windows.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from tebless.devs import init_debug
from tebless.utils import Store
from tebless.widgets import Window, Input, FilterMenu, Label
from tebless.widgets import Window, Input, Label

_store = Store()

Expand Down
6 changes: 3 additions & 3 deletions tebless/themes/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import functools
from tebless.utils.styles import red, white, underline_ns
from tebless.utils.styles import red, underline_ns
from tebless.devs.decorators import theme
__all__ = ['single', 'double']

Expand Down Expand Up @@ -97,6 +97,6 @@ def double(window, config):
return {
'header': header,
'footer': footer,
'formater': lambda text, **kwargs: f'{l_eq} {for_s(text)}',
'selector': lambda text, **kwargs: f'{l_eq} {underline_ns(for_s(text))}',
'formater': lambda text, **_: f'{l_eq} {for_s(text)}',
'selector': lambda text, **_: f'{l_eq} {underline_ns(for_s(text))}',
}
28 changes: 15 additions & 13 deletions tebless/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@


from collections import OrderedDict, MutableMapping
from pprint import pprint
from inspect import ismethod


def dict_diff(first, second):
""" Return a dict of keys that differ with another config object. If a value is
not found in one fo the configs, it will be represented by KEYNOTFOUND.
@param first: Fist dictionary to diff.
@param second: Second dicationary to diff.
@return diff: Dict of Key => (first.val, second.val)
""" Return a dict of keys that differ with another config object.
If a value is not found in one fo the configs, it will be represented
by KEYNOTFOUND.
@param first: Fist dictionary to diff.
@param second: Second dicationary to diff.
@return diff: Dict of Key => (first.val, second.val)
"""
diff = {}
# Check all keys in first dict
Expand Down Expand Up @@ -46,13 +46,13 @@ def __init__(self, *args, **kwargs):
if isinstance(v, dict):
v = Store(v, _dynamic=self._dynamic)
if type(v) is list:
l = []
ele = []
for i in v:
n = i
if type(i) is dict:
n = Store(i, _dynamic=self._dynamic)
l.append(n)
v = l
ele.append(n)
v = ele
self._map[k] = v
if kwargs:
for k, v in self.__call_items(kwargs):
Expand All @@ -78,19 +78,22 @@ def __setitem__(self, k, v):
self._map[k] = v

def __getitem__(self, k):
if k not in self._map and self._dynamic and k != '_ipython_canary_method_should_not_exist_':
if k not in self._map and \
self._dynamic and k != '_ipython_canary_method_should_not_exist_':
# automatically extend to new Store
self[k] = Store()
return self._map[k]

def __setattr__(self, k, v):
if k in {'_map', '_dynamic', '_ipython_canary_method_should_not_exist_'}:
if k in {'_map', '_dynamic',
'_ipython_canary_method_should_not_exist_'}:
super(Store, self).__setattr__(k, v)
else:
self[k] = v

def __getattr__(self, k):
if k == {'_map', '_dynamic', '_ipython_canary_method_should_not_exist_'}:
if k == {'_map', '_dynamic',
'_ipython_canary_method_should_not_exist_'}:
super(Store, self).__getattr__(k)
else:
return self[k]
Expand All @@ -104,7 +107,6 @@ def __contains__(self, k):
def __str__(self):
items = []
for k, v in self.__call_items(self._map):
# bizarre recursive assignment situation (why someone would do this is beyond me)
if id(v) == id(self):
items.append('{0}=Store(...)'.format(k))
else:
Expand Down
3 changes: 2 additions & 1 deletion tebless/utils/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
class Style(object):
def __getattr__(self, name):
formatters = blessed.formatters.split_compound(name)
compoundables, colors = blessed.formatters.COMPOUNDABLES, blessed.formatters.COLORS
compoundables = blessed.formatters.COMPOUNDABLES
colors = blessed.formatters.COLORS
if name in colors or all(fmt in compoundables for fmt in formatters):
return TERM.__getattr__(name)
else:
Expand Down
2 changes: 2 additions & 0 deletions tebless/widgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
from .checkbox import CheckBox
from .filter_menu import FilterMenu
from .label import Label

__all__ = ['Window', 'Menu', 'Input', 'CheckBox', 'FilterMenu', 'Label']
3 changes: 2 additions & 1 deletion tebless/widgets/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def __init__(self,

def paint(self):
echo(self.term.move(self.y, self.x))
echo(self._render.format(check=self._check(self._state), label=self._label))
echo(self._render.format(check=self._check(self._state),
label=self._label))

def _on_key(self, key):
if key.code == self._key:
Expand Down
2 changes: 1 addition & 1 deletion tebless/widgets/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, items=None, *args, **kwargs):
self._is_menu = kwargs.get('is_menu', True)
self._limit = round(kwargs.get('limit', 4))

if not 'width' in kwargs:
if 'width' not in kwargs:
self._width = self.term.width

self._header = kwargs.get('header', '')
Expand Down
3 changes: 2 additions & 1 deletion tebless/widgets/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@


class Window(Widget):
"""Class that encapsulates a whole window and allows to own the elements inside.
"""Class that encapsulates a whole window and allows to own the elements
inside.
:param store: Global storage is necessary
:param parent: If you do not provider it is the main window
Expand Down
Empty file added tests/__init__.py
Empty file.
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[tox]
envlist = py33, py34, py35, flake8
envlist = py35, py36, flake8

[travis]
python =
3.6: py36
3.5: py35
3.4: py34
3.3: py33

[testenv:flake8]
basepython=python
Expand Down

0 comments on commit a18a821

Please sign in to comment.