chore: Update search input layout in URLManager, chore: added more icons for actions
This commit is contained in:
30
app.py
30
app.py
@ -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'
|
||||
|
||||
Reference in New Issue
Block a user