Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
breitburg committed Dec 15, 2019
1 parent 3b65d89 commit 6d337c8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion fluent/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.0-beta1'
__version__ = '1.0.0-beta2'
22 changes: 11 additions & 11 deletions fluent/widget/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@

class Widget:
def __init__(self, pressed=None):
self.__pressed__ = pressed
self.__update_instance__()
self._pressed = pressed
self._update_instance()

def build(self):
return NotImplemented

def __update_instance__(self):
self.__instance__ = self.build()
def _update_instance(self):
self._instance = self.build()

def render(self, xy):
self.__update_instance__()
self.__instance__.render(xy=xy)
self._update_instance()
self._instance.render(xy=xy)

widget_size = self.size
for touch in window.events:
if xy[0] + widget_size[0] > touch[0] > xy[0] and \
xy[1] + widget_size[1] > touch[1] > xy[1] and \
self.__pressed__:
self.__pressed__(self)
self._pressed:
self._pressed(self)

@property
def size(self):
return self.__instance__.size
return self._instance.size


class GenericWidget(Widget):
def __init__(self, size):
self.__size__ = size
self._size = size
super(GenericWidget, self).__init__()

def build(self):
return self

@property
def size(self):
return self.__size__
return self._size
3 changes: 3 additions & 0 deletions fluent/widget/shape/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FilledRoundedBox(GenericWidget):
def __init__(self, size, color=color.white, radius=10):
self.color = color
self.radius = radius

super(FilledRoundedBox, self).__init__(size=size)

def render(self, xy):
Expand All @@ -34,6 +35,7 @@ def render(self, xy):
class OutlineBox(GenericWidget):
def __init__(self, size, color=color.white):
self.color = color

super(OutlineBox, self).__init__(size=size)

def render(self, xy):
Expand All @@ -48,6 +50,7 @@ class OutlineRoundedBox(GenericWidget):
def __init__(self, size, color=color.white, radius=10):
self.color = color
self.radius = radius

super(OutlineRoundedBox, self).__init__(size=size)

def render(self, xy):
Expand Down
2 changes: 0 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
![](https://imgur.com/download/6hKZqiN/)

![](https://img.shields.io/pypi/v/libfluent?label=version)

**Fluent** – Simple and powerful multi-platform development framework.

## Example
Expand Down
10 changes: 7 additions & 3 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from fluent.material import * # Importing library
from fluent.widget.animation.slide import Slide


# Calling launch method
launch(
# Setting target to Text widget
target=Text(
text='Hello, Fluent', # Setting text to the widget
color=color.white # Setting color to the widget
target=Slide(
child=Text(
text='Hello, Fluent', # Setting text to the widget
color=color.white # Setting color to the widget
),
offset=10000
) # Text
) # launch

0 comments on commit 6d337c8

Please sign in to comment.