Skip to content

Commit 5fda6f6

Browse files
Merge pull request #23 from Deepanshusharwan/beta
peppy update ver3.2.0
2 parents ceeba97 + cf5bf45 commit 5fda6f6

7 files changed

Lines changed: 144 additions & 76 deletions

File tree

‎PKGBUILD‎

Lines changed: 0 additions & 38 deletions
This file was deleted.

‎Readme.md‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ Peppy supports Wayland as well as X11 windowing protocols
1212
https://github.com/user-attachments/assets/588bcf6a-d648-4b8e-a3cc-66e80afe3256
1313

1414
# Content list:
15-
* [Features](#features)
16-
* [Installation](#installation--)
17-
* [Usage](#usage--)
18-
* [Customization](#customization)
19-
* [File Tree Structure](#file-tree-structure)
20-
* [Planned Feature](#planned-features)
21-
* [Thanks](#thanks-to)
22-
* [Contributors](#-contributors)
15+
16+
- [Features](#features)
17+
- [Installation](#installation--)
18+
- [Usage](#usage--)
19+
- [Customization](#customization)
20+
- [File Tree Structure](#file-tree-structure)
21+
- [Planned Feature](#planned-features)
22+
- [Thanks](#thanks-to)
23+
- [Contributors](#-contributors)
2324

2425
# Features
2526

@@ -166,11 +167,10 @@ python src/main.py
166167
### Use the dictionary:
167168

168169
FORMAT: \
169-
```meaning <word>```
170+
`meaning <word>`
170171

171172
- Type the word you want the meaning for in the above format
172-
![](./assets/screenshot10.png)
173-
173+
![](./assets/screenshot10.png)
174174

175175
### Use the colour converter:
176176

@@ -183,7 +183,6 @@ FORMAT: \
183183
- If an invalid value is entered then the dialogue box will show the colour of the background
184184
![](./assets/screenshot9.png)
185185

186-
187186
# Customization
188187

189188
- You can customize peppy by putting css inside the peppy.conf to customize it to your needs.
@@ -272,7 +271,8 @@ Total files: 58
272271
- Integration with clipboard, browser bookmarks, system settings
273272

274273
## Thanks to
275-
- [meetDeveloper](https://github.com/meetDeveloper/freeDictionaryAPI) (For the dictionary api)
274+
275+
- [meetDeveloper](https://github.com/meetDeveloper/freeDictionaryAPI) (For the dictionary api)
276276
- [Contributors](#-contributors)
277277

278278
## Listing bugs
@@ -298,3 +298,8 @@ Pull requests are welcome! Feel free to fork this repo, open issues, and suggest
298298
</a>
299299

300300
Made with [contrib.rocks](https://contrib.rocks).
301+
302+
## Star History
303+
304+
305+
[![Star History Chart](https://api.star-history.com/svg?repos=deepanshusharwan/peppy&type=Date)](https://www.star-history.com/#deepanshusharwan/peppy&Date)

‎assets/screenshot10.png‎

39.5 KB
Loading

‎peppy-git/.SRCINFO‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
pkgbase = peppy
2+
pkgdesc = A lightweight application launcher for Wayland and X11 (latest git version)
3+
pkgver = 3.1.0.1.gceeba97
4+
pkgrel = 1
5+
url = https://github.com/Deepanshusharwan/peppy
6+
arch = any
7+
license = MIT
8+
makedepends = git
9+
makedepends = python-build
10+
makedepends = python-installer
11+
makedepends = python-wheel
12+
makedepends = python-setuptools
13+
depends = python
14+
depends = python-pyqt6
15+
depends = python-requests
16+
depends = python-gobject
17+
depends = hicolor-icon-theme
18+
source = git+https://github.com/Deepanshusharwan/peppy.git#branch=main
19+
sha256sums = SKIP
20+
21+
pkgname = peppy

‎peppy-git/PKGBUILD‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Maintainer: Deepanshu Sharwan <deepanshusharwan35@gmail.com>
2+
pkgname=peppy
3+
pkgver=3.1.0.1.gceeba97 # will be auto-generated
4+
pkgrel=1
5+
pkgdesc="A lightweight application launcher for Wayland and X11 (latest git version)"
6+
arch=('any')
7+
url="https://github.com/Deepanshusharwan/peppy"
8+
license=('MIT')
9+
depends=('python' 'python-pyqt6' 'python-requests' 'python-gobject' 'hicolor-icon-theme')
10+
makedepends=('git' 'python-build' 'python-installer' 'python-wheel' 'python-setuptools')
11+
source=("git+$url.git#branch=main")
12+
sha256sums=('SKIP')
13+
14+
pkgver() {
15+
cd "$srcdir/$pkgname"
16+
git describe --tags --long \
17+
| head -n1 \
18+
| sed 's/^v//;s/-/./g;s/:/./g'
19+
}
20+
21+
22+
build() {
23+
cd "$srcdir/$pkgname"
24+
python -m build --wheel --no-isolation
25+
}
26+
27+
package() {
28+
cd "$srcdir/$pkgname"
29+
30+
# Install Python package
31+
python -m installer --destdir="$pkgdir" dist/*.whl
32+
33+
# install license
34+
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
35+
36+
# Install launcher script
37+
install -Dm755 /dev/stdin "$pkgdir/usr/bin/peppy" <<EOF
38+
#!/usr/bin/env python3
39+
import main
40+
EOF
41+
42+
# Install icon
43+
install -Dm644 peppy.svg "$pkgdir/usr/share/icons/hicolor/64x64/apps/peppy.svg"
44+
45+
# Install desktop entry
46+
install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/peppy.desktop" <<EOF
47+
[Desktop Entry]
48+
Type=Application
49+
Name=Peppy
50+
GenericName=Application Launcher
51+
Comment=A fast, lightweight launcher
52+
Exec=peppy
53+
Icon=peppy
54+
Terminal=false
55+
Categories=Utility;System;
56+
EOF
57+
}
58+

‎src/ui/main_window.py‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,19 @@ def __init__(self,applications,*args, **kwargs):
3131
self.config_manager()
3232

3333
#font
34-
font_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','JetBrainsMonoNerdFont-Bold.ttf'))
35-
font_id = QFontDatabase.addApplicationFont(font_path)
36-
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
37-
font = QFont(font_family, 10)
38-
self.font = font
34+
try:
35+
font_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','JetBrainsMonoNerdFont-Bold.ttf'))
36+
font_id = QFontDatabase.addApplicationFont(font_path)
37+
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
38+
font = QFont(font_family, 10)
39+
self.font = font
40+
except IndexError:
41+
font_path = "/usr/share/fonts/TTF/JetBrainsMonoNerdFont-Bold.ttf"
42+
font_id = QFontDatabase.addApplicationFont(font_path)
43+
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
44+
font = QFont(font_family, 10)
45+
self.font = font
46+
3947

4048
# output area for the shell output
4149
self.command_display= QTextEdit()

‎src/ui/widget.py‎

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,18 @@ def __init__(self,name:str,app_info: dict):
2323
# self.btn = QPushButton(text = name, icon=QIcon(app_info.get('icon')))
2424
self.btn.setFixedHeight(35)
2525

26-
font_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','JetBrainsMonoNerdFont-Bold.ttf'))
27-
font_id = QFontDatabase.addApplicationFont(font_path)
28-
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
26+
try:
27+
font_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','JetBrainsMonoNerdFont-Bold.ttf'))
28+
font_id = QFontDatabase.addApplicationFont(font_path)
29+
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
30+
except IndexError:
31+
font_path = "/usr/share/fonts/TTF/JetBrainsMonoNerdFont-Bold.ttf"
32+
font_id = QFontDatabase.addApplicationFont(font_path)
33+
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
34+
font = QFont(font_family, 10)
35+
self.font = font
36+
37+
2938
font = QFont(font_family, 11)
3039
self.btn.setFont(font)
3140
self.hbox = QHBoxLayout() # a horizontal layout to encapsulate the above
@@ -88,7 +97,10 @@ def __init__(self, word: str):
8897
self.get_word_data(word)
8998

9099
def get_word_data(self, word):
91-
r = requests.get(f"https://api.dictionaryapi.dev/api/v2/entries/en/{word}")
100+
try:
101+
r = requests.get(f"https://api.dictionaryapi.dev/api/v2/entries/en/{word}")
102+
except requests.exceptions.ConnectionError() or requests.exceptions.ConnectTimeout():
103+
self.text_edit.setHtml("<b>Error:</b> Could not connect to the api. Please check your internet connection.")
92104

93105
try:
94106
entries = r.json()
@@ -101,23 +113,25 @@ def get_word_data(self, word):
101113
return
102114

103115
html_content = ""
104-
for entry in entries:
105-
# Word heading
106-
html_content += f"<h1 style='color:white;'>{entry.get('word', 'N/A').title()}</h1>"
107-
html_content += f"<p style='color:#8424e3;'><b>Phonetic:</b> {entry.get('phonetic', 'N/A')}</p>"
108-
109-
# Phonetics list
110-
if entry.get("phonetics"):
111-
html_content += "<p><b>Phonetics:</b></p><ul>"
112-
for p in entry["phonetics"]:
113-
text = p.get("text")
114-
audio = p.get("audio")
115-
if text:
116-
html_content += f"<li>{text}</li>"
117-
if audio:
118-
html_content += f"<li><a href='{audio}' style='color:rgb(36,141,227);'>Audio</a></li>"
119-
html_content += "</ul>"
116+
# Word heading
117+
html_content += f"<h1 style='color:white;'>{entries[0].get('word', 'N/A').title()}</h1>"
118+
html_content += f"<p style='color:#8424e3;'><b>Phonetic:</b> {entries[0].get('phonetic', 'N/A')}</p>"
119+
120+
# Phonetics list
121+
if entries[0].get("phonetics"):
122+
html_content += "<p><b>Phonetics:</b></p><ul>"
123+
for p in entries[0]["phonetics"]:
124+
text = p.get("text")
125+
audio = p.get("audio")
126+
if text:
127+
html_content += f"<li>{text}</li>"
128+
if audio:
129+
html_content += f"<li><a href='{audio}' style='color:rgb(36,141,227);'>Audio</a></li>"
130+
html_content += "</ul>"
120131

132+
133+
for entry in entries:
134+
121135
# Meanings
122136
for meaning in entry.get("meanings", []):
123137
html_content += f"<h3 style='color:darkgreen;'>{meaning.get('partOfSpeech', 'N/A')}</h3>"

0 commit comments

Comments
 (0)