From 51cdb5164c4e5c5b07c476c0e6accb27721d98d6 Mon Sep 17 00:00:00 2001 From: Axel Rafn Date: Thu, 11 Jul 2024 23:03:30 +0200 Subject: [PATCH] Add .gitignore and requirements.txt files --- .gitignore | 1 + THANKS.md | 4 ++ app.py | 146 ++++++++++++++++++++++++++++++++++++++ assets/cogwheel_dark.svg | 4 ++ assets/cogwheel_light.svg | 4 ++ assets/info-circle.svg | 4 ++ assets/logo.png | Bin 0 -> 1859 bytes assets/logo.svg | 4 ++ requirements.txt | 1 + 9 files changed, 168 insertions(+) create mode 100644 .gitignore create mode 100644 THANKS.md create mode 100644 app.py create mode 100644 assets/cogwheel_dark.svg create mode 100644 assets/cogwheel_light.svg create mode 100644 assets/info-circle.svg create mode 100644 assets/logo.png create mode 100644 assets/logo.svg create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7275bb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv/ diff --git a/THANKS.md b/THANKS.md new file mode 100644 index 0000000..047c380 --- /dev/null +++ b/THANKS.md @@ -0,0 +1,4 @@ +# Thanks go to + +- [Sunna]() for the initial idea and her efforts in helping me with getting this off the ground. +- [Bootstrap Icons](https://icons.getbootstrap.com/) for their epic icons. diff --git a/app.py b/app.py new file mode 100644 index 0000000..5413003 --- /dev/null +++ b/app.py @@ -0,0 +1,146 @@ +import sys +from PyQt5.QtWidgets import ( + QApplication, QWidget, QVBoxLayout, QHBoxLayout, + QLineEdit, QPushButton, QListWidget, QTextEdit, QComboBox, QMessageBox, QSpacerItem, QSizePolicy +) +from PyQt5.QtGui import QIcon, QPixmap +from PyQt5.QtCore import Qt +from PyQt5.QtSvg import QSvgWidget + + +class URLManager(QWidget): + def __init__(self): + super().__init__() + + self.setWindowTitle('tabRemember - URL Manager') + self.setGeometry(100, 100, 340, 500) + + # Set the application icon + self.setWindowIcon(QIcon('assets/logo.png')) + + self.layout = QVBoxLayout() + + # URL input and settings button layout + self.url_layout = QHBoxLayout() + self.url_input = QLineEdit() + self.url_input.setPlaceholderText("URL") + self.url_layout.addWidget(self.url_input) + + # Settings button + self.settings_button = QPushButton() + self.settings_button.setFixedHeight(self.url_input.sizeHint().height()) + self.settings_button.setFixedWidth(self.url_input.sizeHint().height()) + self.url_layout.addWidget(self.settings_button) + + # Info button + self.info_button = QPushButton() + self.info_button.setFixedHeight(self.url_input.sizeHint().height()) + self.info_button.setFixedWidth(self.url_input.sizeHint().height()) + self.url_layout.addWidget(self.info_button) + + self.layout.addLayout(self.url_layout) + + # Update icons based on the color mode + self.update_icon_color() + + # Description/Thoughts input + self.description_input = QTextEdit() + self.description_input.setPlaceholderText("Enter Description or Thoughts") + self.description_input.setMaximumHeight(100) # Limit height to approximately 5 lines + self.layout.addWidget(self.description_input) + + # Add URL button + self.add_button = QPushButton("Add URL") + self.add_button.clicked.connect(self.add_url) + self.layout.addWidget(self.add_button) + + # Add space between the Add URL button and URL list + self.layout.addSpacerItem(QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Fixed)) + + # Group selection and search input + self.group_search_layout = QHBoxLayout() + self.group_combobox = QComboBox() + self.group_combobox.addItem("Default") + self.group_search_layout.addWidget(self.group_combobox) + self.search_input = QLineEdit() + self.search_input.setPlaceholderText("Search ...") + self.group_search_layout.addWidget(self.search_input) + self.layout.addLayout(self.group_search_layout) + + # Ensure the dropdown and search input are of equal width + self.group_combobox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + self.search_input.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + + # URL list + self.url_list = QListWidget() + self.layout.addWidget(self.url_list) + + self.setLayout(self.layout) + + self.urls = {} + + def update_icon_color(self): + # Heuristic to check if the application is in dark mode + palette = self.palette() + if palette.color(palette.Window).value() < 128: + settings_icon_path = 'assets/cogwheel_dark.svg' + info_icon_path = 'assets/info_dark.svg' + else: + settings_icon_path = 'assets/cogwheel_light.svg' + info_icon_path = 'assets/info_light.svg' + + self.settings_button.setIcon(QIcon(settings_icon_path)) + self.info_button.setIcon(QIcon(info_icon_path)) + + def add_url(self): + url = self.url_input.text() + description = self.description_input.toPlainText() + group = self.group_combobox.currentText() + if url: + self.url_list.addItem(f"{group}: {url}") + if group not in self.urls: + self.urls[group] = [] + self.urls[group].append({'url': url, 'description': description}) + self.url_input.clear() + self.description_input.clear() + + def update_url(self): + selected_item = self.url_list.currentItem() + if selected_item: + group, url = selected_item.text().split(": ", 1) + new_url = self.url_input.text() + new_description = self.description_input.toPlainText() + selected_item.setText(f"{group}: {new_url}") + for item in self.urls[group]: + if item['url'] == url: + item['url'] = new_url + item['description'] = new_description + break + self.url_input.clear() + self.description_input.clear() + + def delete_url(self): + selected_item = self.url_list.currentItem() + if selected_item: + group, url = selected_item.text().split(": ", 1) + self.url_list.takeItem(self.url_list.row(selected_item)) + for item in self.urls[group]: + if item['url'] == url: + self.urls[group].remove(item) + break + + def search_url(self): + search_term = self.search_input.text() + if search_term: + search_engine = "https://www.google.com/search?q=" + search_url = search_engine + search_term + QMessageBox.information(self, "Search", f"Searching for: {search_term}\nURL: {search_url}") + self.search_input.clear() + + +if __name__ == '__main__': + app = QApplication(sys.argv) + app.setWindowIcon(QIcon('assets/logo.png')) # Set the application icon using PNG for compatibility + window = URLManager() + window.show() + sys.exit(app.exec_()) diff --git a/assets/cogwheel_dark.svg b/assets/cogwheel_dark.svg new file mode 100644 index 0000000..f3d2e05 --- /dev/null +++ b/assets/cogwheel_dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/cogwheel_light.svg b/assets/cogwheel_light.svg new file mode 100644 index 0000000..687aa98 --- /dev/null +++ b/assets/cogwheel_light.svg @@ -0,0 +1,4 @@ + + + + diff --git a/assets/info-circle.svg b/assets/info-circle.svg new file mode 100644 index 0000000..e2b50eb --- /dev/null +++ b/assets/info-circle.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..287540db6a660d16d98a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