Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fluent_ui
Browse files Browse the repository at this point in the history
  • Loading branch information
YisusChrist committed Aug 25, 2024
2 parents 896a172 + 5cc189b commit 1dcd413
Show file tree
Hide file tree
Showing 15 changed files with 551 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/AnimeSnap.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 96 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

171 changes: 171 additions & 0 deletions AnimeSearch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import sys
import os
import json_operations
import search
from qfluentwidgets import *
from qfluentwidgets import FluentIcon as FIF
from qframelesswindow import *

import qdarktheme
from PyQt6.QtCore import *
from PyQt6.QtGui import *
from PyQt6.QtWidgets import *


class App(QWidget):
def __init__(self, parent=None):
super().__init__(parent)

self.setObjectName("AnimeSnap")
self.setGeometry(100, 100, 450, 150)

self.mainApp = parent

# Create a stacked widget to manage different screens
self.stacked_widget = QStackedWidget(self)

# Create the main menu widget
self.main_menu_widget = QWidget(self)
self.stacked_widget.addWidget(self.main_menu_widget)

self.img_path = ""
self.img_url = ""
self.anilist_id = ""
self.ctheme = "dark"

layout = QVBoxLayout(self)
layout.addStretch()
self.setLayout(layout)

self.buttons_frame = QWidget(self)
layout.addWidget(self.buttons_frame)

# Create a horizontal layout
top_layout = QHBoxLayout()
button_layout = QHBoxLayout()
checkbox_layout = QHBoxLayout()

layout.addLayout(top_layout)

layout.addWidget(QLabel(""))

self.img_url_entry = LineEdit(self)
self.img_url_entry.setPlaceholderText("Enter image URL or Upload an image")

self.file_path_label = CaptionLabel()

button_layout.addWidget(self.img_url_entry)

open_image_icon = QIcon("icons/folder.png")
self.open_image_button = QPushButton(self)
self.open_image_button.setStyleSheet("""
QPushButton {
border: none;
}
""")
self.open_image_button.clicked.connect(self.open_image)
self.open_image_button.setIcon(open_image_icon)
self.open_image_button.setIconSize(QSize(23, 23))
self.open_image_button.setFixedSize(28, 28)
button_layout.addWidget(self.open_image_button)

layout.addLayout(button_layout) # Add the button layout to the main layout
layout.addWidget(self.file_path_label)

layout.addWidget(QLabel(""))

layout.addLayout(checkbox_layout) # Add the checkbox layout to the main layout

self.checkbox_rbb = CheckBox()
self.checkbox_rbb.setText("Remove Black Borders")
checkbox_layout.addWidget(self.checkbox_rbb)

self.checkbox_iad = CheckBox()
self.checkbox_iad.setText("Include All Details")
checkbox_layout.addWidget(self.checkbox_iad)

layout.addWidget(QLabel(""))

anilist_label = CaptionLabel()
anilist_label.setText("Anilist Anime ID [OPTIONAL] [https://anilist.co/]")
layout.addWidget(anilist_label)

self.anilist_entry = LineEdit(self)
self.anilist_entry.setPlaceholderText(
"Use this if you know what anime it is and you just need the scene details"
)
layout.addWidget(self.anilist_entry)

search_button = PrimaryPushButton()
search_button.setText("Search")
search_button.clicked.connect(self.onClickSearch)
layout.addWidget(search_button)

def open_image(self):
# options = QFileDialog.Options()
file_path, _ = QFileDialog.getOpenFileName(
self,
"Open Image to Search",
"",
"Image Files (*.jpg *.png *.bmp);;All Files (*)",
)

if file_path:
self.img_path = file_path
self.file_path_label.setText(file_path)

def returnToMenu(self):
self.stacked_widget.setCurrentWidget(self.main_menu_widget)
self.img_path = ""
self.file_path_label.setText("") # Use self.file_path_label instead of self.main_menu_widget.file_path_label

def onClickSearch(self):
self.img_url = self.img_url_entry.text()
anilist_id = self.anilist_entry.text()
iad_status = self.checkbox_iad.isChecked()
rbb_status = self.checkbox_rbb.isChecked()
anilist_status = anilist_id if anilist_id else None

if self.img_url or self.img_path != "":
while self.layout().count():
item = self.layout().takeAt(0)
widget = item.widget()
if widget is not None:
widget.deleteLater()

if self.checkbox_iad.isChecked():
iad_status = True
else:
iad_status = False

if self.checkbox_rbb.isChecked():
rbb_status = True
else:
rbb_status = False

if anilist_id == "":
anilist_status = None
else:
anilist_status = anilist_id

if self.img_url == "":
search.search_img(self, anilist_info=anilist_status, rbb=rbb_status)
else:
search.search_url(self)

if iad_status is True:
json_operations.json_to_tabular(self, include_all_details=True)
else:
json_operations.json_to_tabular(self, include_all_details=False)

else:
dlg = QMessageBox(self)
dlg.setWindowTitle("Error")
dlg.setText("Select any Image or Enter any URL to search")
dlg.setStandardButtons(QMessageBox.StandardButton.Ok)
button = dlg.exec()

if button == QMessageBox.StandardButton.Ok:
pass
else:
pass
13 changes: 13 additions & 0 deletions FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: 'https://ko-fi.com/rohankishore'
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom:
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<div align="center">

![icon](https://github.com/user-attachments/assets/e7244321-0452-4a9d-b24d-1b70eedb16e7)

</div>

<h1 align="center">⛩️ AnimeSnap 🍥</h1>

<div align="center">
Expand Down Expand Up @@ -30,7 +36,7 @@ And much more if you check `Include All Details`. It will also show multiple res

### Using the App

![image](https://github.com/rohankishore/AnimeSnap/assets/109947257/17b36284-4231-4747-b047-185e892b9252)
![image](https://github.com/user-attachments/assets/fc462b43-856f-410c-b998-f6841e2fd7df)

You can either use an image link or upload an image from your PC. With v2.0, there are 2 new checkboxes. Removing black bars will help to increase the accuracy of the overall results if there are any black borders in your image, though the processing time may slightly increase. By checking `Include All Details`, you can get all the info that you get by uploading to JSON.

Expand Down
Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
certifi==2023.7.22
charset-normalizer==3.3.0
darkdetect==0.7.1
idna==3.4
PyQt6==6.5.3
PyQt6-Qt6==6.5.3
PyQt6-sip==13.6.0
pyqtdarktheme==2.1.0
requests==2.31.0
urllib3==2.0.6
Loading

0 comments on commit 1dcd413

Please sign in to comment.