Skip to content

Commit

Permalink
Gestures 1.0 release!
Browse files Browse the repository at this point in the history
Currently releasing the first version.
  • Loading branch information
jerobado committed Jul 4, 2017
1 parent 00fdf10 commit beb5fea
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
28 changes: 15 additions & 13 deletions src/core/gestures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class Gestures:

def __init__(self):
self.__version__ = '1.0'
self.abbv = ''
self.equivalent = ''

Expand All @@ -19,6 +20,20 @@ def show_gestures(self) -> None:

print(kb._word_listeners.items())

def add_gesture_to_keyboard(self) -> None:
""" Register new gesture to keyboard library. """

if self.validate_user_input():
kb.add_abbreviation(self.abbv, self.equivalent)

def validate_user_input(self) -> bool:
""" Return True if user's input passes all validations. """

argument_type = self.check_argument_type(self.abbv, self.equivalent)
unique_gesture = self.check_unique_gesture(self.abbv)

return argument_type and unique_gesture

def check_argument_type(self, abbv, equivalent):
""" Return True if self.abbv and self.equivalent are both str type. """

Expand All @@ -35,16 +50,3 @@ def check_unique_gesture(self, abbv: str) -> bool:
else:
print('\'{}\' already exist.'.format(abbv))
return False

def validate_user_input(self) -> bool:

argument_type = self.check_argument_type(self.abbv, self.equivalent)
unique_gesture = self.check_unique_gesture(self.abbv)

return argument_type and unique_gesture

def add_gesture_to_keyboard(self) -> None:
""" Register new gesture to keyboard library. """

if self.validate_user_input():
kb.add_abbreviation(self.abbv, self.equivalent)
1 change: 0 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

APP = QApplication(sys.argv)


if __name__ == '__main__':
from src.gui.main_window import GesturesUI
window = GesturesUI()
Expand Down
6 changes: 6 additions & 0 deletions tests/gestures_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def test_show_gesture(self):
result = self.app.show_gestures()
self.assertIsNone(result)

def test_current_version(self):
""" Test for current version. """

current_version = '1.0'
result = self.app.__version__
self.assertEqual(result, current_version)

if __name__ == '__main__':
unittest.main()

0 comments on commit beb5fea

Please sign in to comment.