chore: Update search input layout in URLManager, chore: added more icons for actions

This commit is contained in:
2024-07-12 19:22:34 +02:00
parent 50500cb46e
commit 91258bc3e1
7 changed files with 38 additions and 14 deletions

30
app.py
View File

@ -118,7 +118,7 @@ class URLManager(QWidget):
def add_url(self):
url = self.url_input.text()
description = self.description_input.toPlainText()
group = self.group_combobox.currentText()
group = self.group_combobox.currentText() # Assuming you have a group_combobox
if url:
date_added = QDateTime.currentDateTime().toString(Qt.ISODate)
self.urls.append({'url': url, 'description': description, 'date': date_added, 'group': group})
@ -166,17 +166,20 @@ class URLManager(QWidget):
# Action buttons
actions_layout = QHBoxLayout()
edit_button = QPushButton("Edit")
edit_button.setStyleSheet("padding: 2px;")
delete_button = QPushButton("Delete")
delete_button.setStyleSheet("padding: 2px;")
search_button = QPushButton("Search")
search_button.setStyleSheet("padding: 2px;")
edit_button = QPushButton()
edit_button.setFixedSize(30, 30) # Set fixed size for icon button
edit_icon_path = 'assets/edit_dark.svg' if self.is_dark_mode() else 'assets/edit_light.svg'
edit_button.setIcon(QIcon(edit_icon_path))
edit_button.clicked.connect(lambda ch, row=row_position: self.edit_url(row))
delete_button = QPushButton()
delete_button.setFixedSize(30, 30) # Set fixed size for icon button
delete_icon_path = 'assets/delete_dark.svg' if self.is_dark_mode() else 'assets/delete_light.svg'
delete_button.setIcon(QIcon(delete_icon_path))
delete_button.clicked.connect(lambda ch, row=row_position: self.delete_url(row))
search_button.clicked.connect(lambda ch, row=row_position: self.search_url(row))
actions_layout.addWidget(edit_button)
actions_layout.addWidget(search_button)
actions_layout.addWidget(delete_button)
actions_widget = QWidget()
actions_widget.setLayout(actions_layout)
@ -188,11 +191,10 @@ class URLManager(QWidget):
self.description_input.setPlainText(url['description'])
self.urls.pop(row)
def search_url(self, row):
url = self.urls[row]['url']
search_engine = self.search_engines[self.search_engine]
search_url = search_engine + QUrl(url).toString(QUrl.FullyEncoded)
QDesktopServices.openUrl(QUrl(search_url))
def is_dark_mode(self):
# Heuristic to check if the application is in dark mode
palette = self.palette()
return palette.color(palette.Window).value() < 128
def load_settings(self):
settings_path = 'data/settings.json'

4
assets/delete_dark.svg Normal file
View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" fill="#cecece" class="bi bi-trash" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>
<path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>
</svg>

After

Width:  |  Height:  |  Size: 537 B

4
assets/delete_light.svg Normal file
View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" fill="#212121" class="bi bi-trash" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>
<path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>
</svg>

After

Width:  |  Height:  |  Size: 537 B

3
assets/edit_dark.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" fill="#cecece" class="bi bi-pencil" viewBox="0 0 16 16">
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325"/>
</svg>

After

Width:  |  Height:  |  Size: 520 B

3
assets/edit_light.svg Normal file
View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" fill="#212121" class="bi bi-pencil" viewBox="0 0 16 16">
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325"/>
</svg>

After

Width:  |  Height:  |  Size: 520 B

4
assets/search_dark.svg Normal file
View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" fill="#cecece" class="bi bi-search-heart" viewBox="0 0 16 16">
<path d="M6.5 4.482c1.664-1.673 5.825 1.254 0 5.018-5.825-3.764-1.664-6.69 0-5.018"/>
<path d="M13 6.5a6.47 6.47 0 0 1-1.258 3.844q.06.044.115.098l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1-.1-.115h.002A6.5 6.5 0 1 1 13 6.5M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11"/>
</svg>

After

Width:  |  Height:  |  Size: 421 B

4
assets/search_light.svg Normal file
View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search-heart" viewBox="0 0 16 16">
<path d="M6.5 4.482c1.664-1.673 5.825 1.254 0 5.018-5.825-3.764-1.664-6.69 0-5.018"/>
<path d="M13 6.5a6.47 6.47 0 0 1-1.258 3.844q.06.044.115.098l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1-.1-.115h.002A6.5 6.5 0 1 1 13 6.5M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11"/>
</svg>

After

Width:  |  Height:  |  Size: 423 B