kivy-pinview 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Alchemist
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: kivy-pinview
3
+ Version: 0.0.1
4
+ Summary: This is an android pinview implementation for kivy
5
+ Author-email: Alchemist <tnbipin@gmail.com>
6
+ Project-URL: Homepage, https://github.com/Alchemist-T-N/kivy-pinview
7
+ Project-URL: Bug Tracker, https://github.com/Alchemist-T-N/kivy-pinview/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # kivy-pinview
16
+ This is an android pinview implementation for kivy
17
+ You can use [this platform](https://github.com/Alchemist-T-N/kivy-pinview/issues) to write your content.
18
+
19
+ # installation:
20
+ pip install kivy-pinview
21
+
22
+ # uninstall:
23
+ pip uninstall kivy-pinview
24
+
25
+ # kivy-pinview
26
+ This module is built using some ready to use kivy widgets like Label, TextInput, BoxLayout, FloatLayout etc.
27
+ Structure:
28
+ FloatLayout:
29
+ -> TextInput:
30
+ -> BoxLayout:
31
+ -> Labels:
32
+ Working:
33
+ On touching the view, TextInput takes focus and text entered in that is rendered to the Labels and on fully entering data into labels, on_otp(self, caller_obj, otp) is fired which can be overridden.
34
+ Use:
35
+ can be used to take otp(one time password) inputs...
36
+
37
+ # Example:
38
+
39
+ from kivy.lang import Builder
40
+ from kivy.app import App
41
+
42
+ kv = """
43
+ #:import PinView kivy-pinview.PinView
44
+
45
+ PinView:
46
+ size_hint_x:.8
47
+ pos_hint:{'center_x':.5,'center_y':.5}
48
+ #Box Related:
49
+ box_spacing:10
50
+ box_radius:[5, 5]
51
+ box_count:5
52
+
53
+ #Text Related:
54
+ text_color:[0,.4,1,1]
55
+ default_text:'-'
56
+ #font_name:'your_font_name.ttf'
57
+ font_size:50
58
+ markup:True
59
+ on_otp:print(self.otp)
60
+
61
+ #Box Canvas related:
62
+ box_bg_color:[1,.4,1,1]
63
+ #box_bg_image:'your_bg_image.jpg'
64
+ """
65
+
66
+ class MyApp(App):
67
+ def build(self):
68
+ return Builder.load_string(kv)
@@ -0,0 +1,54 @@
1
+ # kivy-pinview
2
+ This is an android pinview implementation for kivy
3
+ You can use [this platform](https://github.com/Alchemist-T-N/kivy-pinview/issues) to write your content.
4
+
5
+ # installation:
6
+ pip install kivy-pinview
7
+
8
+ # uninstall:
9
+ pip uninstall kivy-pinview
10
+
11
+ # kivy-pinview
12
+ This module is built using some ready to use kivy widgets like Label, TextInput, BoxLayout, FloatLayout etc.
13
+ Structure:
14
+ FloatLayout:
15
+ -> TextInput:
16
+ -> BoxLayout:
17
+ -> Labels:
18
+ Working:
19
+ On touching the view, TextInput takes focus and text entered in that is rendered to the Labels and on fully entering data into labels, on_otp(self, caller_obj, otp) is fired which can be overridden.
20
+ Use:
21
+ can be used to take otp(one time password) inputs...
22
+
23
+ # Example:
24
+
25
+ from kivy.lang import Builder
26
+ from kivy.app import App
27
+
28
+ kv = """
29
+ #:import PinView kivy-pinview.PinView
30
+
31
+ PinView:
32
+ size_hint_x:.8
33
+ pos_hint:{'center_x':.5,'center_y':.5}
34
+ #Box Related:
35
+ box_spacing:10
36
+ box_radius:[5, 5]
37
+ box_count:5
38
+
39
+ #Text Related:
40
+ text_color:[0,.4,1,1]
41
+ default_text:'-'
42
+ #font_name:'your_font_name.ttf'
43
+ font_size:50
44
+ markup:True
45
+ on_otp:print(self.otp)
46
+
47
+ #Box Canvas related:
48
+ box_bg_color:[1,.4,1,1]
49
+ #box_bg_image:'your_bg_image.jpg'
50
+ """
51
+
52
+ class MyApp(App):
53
+ def build(self):
54
+ return Builder.load_string(kv)
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "kivy-pinview"
7
+ version = "0.0.1"
8
+ authors = [
9
+ { name="Alchemist", email="tnbipin@gmail.com" },
10
+ ]
11
+ description = "This is an android pinview implementation for kivy"
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ [project.urls]
21
+ "Homepage" = "https://github.com/Alchemist-T-N/kivy-pinview"
22
+ "Bug Tracker" = "https://github.com/Alchemist-T-N/kivy-pinview/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,108 @@
1
+ from kivy.graphics import RoundedRectangle, Color
2
+ from kivy.lang import Builder
3
+ from kivy.properties import StringProperty
4
+ from kivy.uix.floatlayout import FloatLayout
5
+ from kivy.uix.label import Label
6
+
7
+ kv = """
8
+ <PinView>
9
+ id:pinview
10
+ box_count:4
11
+ size_hint:.99,None
12
+ height:(self.width-((self.box_count-1)*self.box_spacing))//self.box_count
13
+ text_color:[1,0,0,1]
14
+ font_name:''
15
+ font_size:70
16
+ box_size_hint:1,1
17
+ box_spacing:30
18
+ box_radius:[30]
19
+ box_bg_color:[1,1,0,1]
20
+ default_text:'-'
21
+ box_bg_image:None
22
+ markup:True
23
+ pos_hint:{'center_x':.5, 'center_y':.5}
24
+ TextInput:
25
+ id:otp
26
+ pos:self.parent.pos
27
+ background_color:[1,1,1,0]
28
+ foreground_color:[0,0,0,0]
29
+ cursor_color:[1,1,1,0]
30
+ input_type:'number'
31
+ on_text:
32
+ root._what_on_otp(self.text)
33
+ BoxLayout:
34
+ id:box_holder
35
+ spacing:pinview.box_spacing
36
+ pos:self.parent.pos
37
+ """
38
+
39
+ Builder.load_string(kv)
40
+
41
+
42
+ class Box(Label):
43
+ def __init__(self, box_radius=10, box_bg_color=None, box_bg_image=None, **kwargs):
44
+ super().__init__(**kwargs)
45
+ if box_bg_color is None:
46
+ box_bg_color = [0, 0, 1, 1]
47
+ self.radius = box_radius
48
+ self.source = box_bg_image
49
+ self.box_bg_color = box_bg_color
50
+
51
+ def on_size(self, *args):
52
+ with self.canvas.before:
53
+ self.canvas.before.clear()
54
+ Color(rgba=self.box_bg_color) if len(self.box_bg_color) > 3 else Color(rgb=self.box_bg_color)
55
+ RoundedRectangle(size=self.size, pos=self.pos, radius=self.radius, source=self.source)
56
+
57
+
58
+ class PinView(FloatLayout):
59
+ otp = StringProperty('')
60
+
61
+ def __init__(self, **kwargs):
62
+ super().__init__(**kwargs)
63
+ self.count = None
64
+
65
+ def on_kv_post(self, base_widget):
66
+ self.count = self.box_count
67
+ for i in range(self.count):
68
+ try:
69
+ self.ids.box_holder.add_widget(Box(
70
+ font_name=self.font_name if self.font_name != '' else self.font_name,
71
+ color=self.text_color,
72
+ text=self.default_text,
73
+ font_size=self.font_size,
74
+ size_hint=self.box_size_hint,
75
+ markup=self.markup,
76
+ box_radius=self.box_radius,
77
+ box_bg_color=self.box_bg_color,
78
+ box_bg_image=self.box_bg_image
79
+ ))
80
+ except IOError:
81
+ self.ids.box_holder.add_widget(Box(
82
+ color=self.text_color,
83
+ text=self.default_text,
84
+ font_size=self.font_size,
85
+ markup=self.markup,
86
+ size_hint=self.box_size_hint,
87
+ box_radius=self.box_radius,
88
+ box_bg_color=self.box_bg_color,
89
+ box_bg_image=self.box_bg_image
90
+ ))
91
+
92
+ def on_otp(self, who, otp):
93
+ pass
94
+
95
+ def _what_on_otp(self, text):
96
+ # maintain text length according to the box count
97
+ if len(text) > self.count:
98
+ self.ids.otp.text = text[0:self.count]
99
+ # set the text to their respective boxes
100
+ for i, box in enumerate(reversed(self.ids.box_holder.children)):
101
+ try:
102
+ box.text = text[i]
103
+ except IndexError:
104
+ box.text = self.default_text
105
+ # if full otp is entered, invoke the on_otp
106
+ if len(text) == self.box_count:
107
+ self.otp = text
108
+
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: kivy-pinview
3
+ Version: 0.0.1
4
+ Summary: This is an android pinview implementation for kivy
5
+ Author-email: Alchemist <tnbipin@gmail.com>
6
+ Project-URL: Homepage, https://github.com/Alchemist-T-N/kivy-pinview
7
+ Project-URL: Bug Tracker, https://github.com/Alchemist-T-N/kivy-pinview/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # kivy-pinview
16
+ This is an android pinview implementation for kivy
17
+ You can use [this platform](https://github.com/Alchemist-T-N/kivy-pinview/issues) to write your content.
18
+
19
+ # installation:
20
+ pip install kivy-pinview
21
+
22
+ # uninstall:
23
+ pip uninstall kivy-pinview
24
+
25
+ # kivy-pinview
26
+ This module is built using some ready to use kivy widgets like Label, TextInput, BoxLayout, FloatLayout etc.
27
+ Structure:
28
+ FloatLayout:
29
+ -> TextInput:
30
+ -> BoxLayout:
31
+ -> Labels:
32
+ Working:
33
+ On touching the view, TextInput takes focus and text entered in that is rendered to the Labels and on fully entering data into labels, on_otp(self, caller_obj, otp) is fired which can be overridden.
34
+ Use:
35
+ can be used to take otp(one time password) inputs...
36
+
37
+ # Example:
38
+
39
+ from kivy.lang import Builder
40
+ from kivy.app import App
41
+
42
+ kv = """
43
+ #:import PinView kivy-pinview.PinView
44
+
45
+ PinView:
46
+ size_hint_x:.8
47
+ pos_hint:{'center_x':.5,'center_y':.5}
48
+ #Box Related:
49
+ box_spacing:10
50
+ box_radius:[5, 5]
51
+ box_count:5
52
+
53
+ #Text Related:
54
+ text_color:[0,.4,1,1]
55
+ default_text:'-'
56
+ #font_name:'your_font_name.ttf'
57
+ font_size:50
58
+ markup:True
59
+ on_otp:print(self.otp)
60
+
61
+ #Box Canvas related:
62
+ box_bg_color:[1,.4,1,1]
63
+ #box_bg_image:'your_bg_image.jpg'
64
+ """
65
+
66
+ class MyApp(App):
67
+ def build(self):
68
+ return Builder.load_string(kv)
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/kivy-pinview/__init__.py
5
+ src/kivy_pinview.egg-info/PKG-INFO
6
+ src/kivy_pinview.egg-info/SOURCES.txt
7
+ src/kivy_pinview.egg-info/dependency_links.txt
8
+ src/kivy_pinview.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ kivy-pinview