xemonity 1.0__py3-none-any.whl

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.
Xemonity/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ from classes import *
2
+
3
+ if __name__ == "__main__":
4
+ menu = XemonityAM(["One","Two","Three"],"Test menu")
5
+ answer = menu.show_sync()
6
+ print(answer)
Xemonity/classes.py ADDED
@@ -0,0 +1,64 @@
1
+ from pynput import keyboard
2
+ from time import sleep as delay
3
+ import sys
4
+ import os
5
+
6
+ #def on_next():return pynput.keyboard.Listener.
7
+ #def on_prev():return keyboard.is_pressed("up")
8
+ #def on_enter():return keyboard.is_pressed("enter")
9
+
10
+ def open_alt_screen():
11
+ sys.stdout.write("\x1b[?1049h")
12
+ clear_screen()
13
+
14
+ def close_alt_screen():
15
+ #clear_screen()
16
+ sys.stdout.write("\x1b[?1049l")
17
+
18
+ def clear_screen():
19
+ # Для Windows
20
+ if os.name == 'nt':
21
+ os.system('cls')
22
+ # Для Linux и macOS
23
+ else:
24
+ os.system('clear')
25
+
26
+ class XemonityAM:
27
+ def __init__(self,elements:list,title:str):
28
+ self.cursor = 0
29
+ self.elements = elements
30
+ self.title = title
31
+ def update_screen(self,intertime=0.25):
32
+ clear_screen()
33
+ print(self.title)
34
+ for i in range(0,len(self.elements)):
35
+ if i == self.cursor: print(">>",end="")
36
+ print(self.elements[i])
37
+ delay(intertime)
38
+ def on_press(self,key:keyboard.Key):
39
+ try:
40
+ if key == keyboard.Key.down:
41
+ self.cursor += 1
42
+ if self.cursor >= len(self.elements):
43
+ self.cursor = 0
44
+ self.update_screen()
45
+ elif key == keyboard.Key.up:
46
+ self.cursor -= 1
47
+ if self.cursor <= -1:
48
+ self.cursor = len(self.elements)-1
49
+ self.update_screen()
50
+ elif key == keyboard.Key.enter:
51
+ close_alt_screen()
52
+ self.returned = self.elements[self.cursor]
53
+ return False
54
+ except AttributeError:
55
+ pass#print(f'Нажата спецклавиша: {key}')
56
+ def on_release(self,key):
57
+ if key == keyboard.Key.esc:
58
+ return False
59
+ def show_sync(self):
60
+ open_alt_screen()
61
+ self.update_screen()
62
+ with keyboard.Listener(on_press=self.on_press, on_release=self.on_release) as listener:
63
+ listener.join()
64
+ return self.elements[self.cursor]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 murzik_kukushnik(PyPI)
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,50 @@
1
+ Metadata-Version: 2.2
2
+ Name: xemonity
3
+ Version: 1.0
4
+ Summary: Libraly for simple menu with chosing
5
+ Home-page: https://github.com/MurzikYEET/Xemonity
6
+ Author: murzik_kukushnik
7
+ Author-email: siniykoshara@gmail.com
8
+ Project-URL: GitHub, https://github.com/MurzikYEET/Xemonity
9
+ Keywords: menu choose choice
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.6
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pynput
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: home-page
23
+ Dynamic: keywords
24
+ Dynamic: project-url
25
+ Dynamic: requires-dist
26
+ Dynamic: requires-python
27
+ Dynamic: summary
28
+
29
+ # Xemonity
30
+ Xemonity - Python3 lib for simple menu with choose mained on pynput
31
+ ## How to use?
32
+ Code look as
33
+ ```python
34
+ import Xemonity #import lib
35
+ am = Xemonity.XemonityAM(elements=['one','two','three'],'Its a title') #make class with elements and title
36
+ result = am.show_sync() #show menu (only sync) and return choosed string as str()
37
+ print(result) #print result to screen
38
+ ```
39
+ ## Classes and methods
40
+ `Xemonity.XemonityAM(elements:list,title:str)`
41
+ Main class for menu
42
+ 1. `XemonityAM.cursor` : int var : return a current selected element index
43
+ 2. `XemonityAM.title` : str var : just a title, shows over elements
44
+ 3. `XemonityAM.elements` : list var : list of elements
45
+ 4. `XemonityAM.show_sync()` : str func : show menu and return choosed element
46
+ Other methods not for you
47
+ ## Credits
48
+ [https://pypi.org/user/moses.palmer/](moses.palmer) : made pynput lib
49
+ ## License
50
+ Licensed under MIT license
@@ -0,0 +1,7 @@
1
+ Xemonity/__init__.py,sha256=mKoysWhImjcZbMF_l-I_SRLMLCSIRwLWeone0yzpYHA,154
2
+ Xemonity/classes.py,sha256=n3sIn87s1768C-jq03ToBG82YC4oZZkiViYzAMeeizU,2012
3
+ xemonity-1.0.dist-info/LICENSE,sha256=9KA3shpHLN5do39R0k4dil9RaR-n0rVdACLzKt_hlGw,1079
4
+ xemonity-1.0.dist-info/METADATA,sha256=NHdOupLTlvr-lQfgIEbjqtaoTfMdOW65IEy4hz-j27Q,1679
5
+ xemonity-1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
6
+ xemonity-1.0.dist-info/top_level.txt,sha256=wv0Hu5e_Db_lHAwglDI0dtyZr8vPkIykIUS_vjtYu9c,9
7
+ xemonity-1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ Xemonity