Skip to content

Commit

Permalink
Exit functionality added
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishJii committed Jun 3, 2024
1 parent 25f304c commit 13c214c
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 17 deletions.
9 changes: 9 additions & 0 deletions .idea/ErpSnap.iml

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

9 changes: 9 additions & 0 deletions .idea/libraries/base_library.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/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.

51 changes: 51 additions & 0 deletions .idea/workspace.xml

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

40 changes: 28 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,37 @@ ErpSnap2 is a widget application that provides a one-click interface to view the
| Retrieve absent days and notices(HTML parsing) | ⏳80% |
| Check internet connectivity/slow internet | ✔️ |
| Implement loading animation | ✔️ |
| Add option to exit | ✔️ |
| Show last synced time | |
| Auto-sync data on startup if info exists | ✔️ |
| Check if login info is incorrect | |
| Add option to exit | |
| Add option to re-enter info | |

>[!NOTE]
>Consider using `urllib3` instead of `requests` library to reduce third party dependency requirements.
## Installation
## Installation FAQ

#### How do I install ErpSnap2?

1. Download the Latest Release: Visit the [latest release](https://github.com/ashishjii/ErpSnap/releases/latest) page on GitHub and download the ErpSnap setup file.
2. Run the Setup: Double-click the downloaded file (ErpSnapSetup.exe) to start installation.
3. Once the installation is complete, you can launch ErpSnap from the Start menu or desktop shortcut.
4. On initial launch, click the refresh button in the top-right corner to enter credentials.

#### I'm seeing a Windows Defender SmartScreen warning. What should I do?

If you encounter a Windows Defender SmartScreen warning, click on "More info" and then click "Run anyway". This warning appears because the program is not digitally signed with an **Extended Validation (EV) code signing certificate**, which costs around $300-$800. Rest assured, ErpSnap is not a virus.

#### How do I exit the app?

To exit the application, click on the info button located at the top right corner of the screen, then click "Exit application".

#### I entered my username and details incorrectly. What should I do?

If you've entered your username and/or details incorrectly, you can reset them by deleting the credentials file located at `%AppData%/ErpSnap`. To do this, open your file manager and copy-paste the provided location into the address bar. After deleting the file, restart the application, and you will be prompted to enter your credentials again.

## Contributing

1. Clone the repository:
```bash
Expand All @@ -42,19 +63,14 @@ python main.py
```
4. Convert to exe file:
```bash
pyinstaller --onefile --windowed --add-data "loading.gif:." main.py
pyinstaller --noconfirm --onefile --windowed --icon "assets/logo.ico" --name "ErpSnap" --add-data "assets;assets/" "main.py"
```

## Usage

1. Launch the application.
2. If prompted, enter your login credentials and click "Submit".
3. Click the "Refresh" button to fetch data from the backend server.
4. The application will display the fetched data on the screen.

## Contributing
#### How to Contribute

Contributions are welcome! If you'd like to contribute to ErpSnap2, please fork the repository and submit a pull request with your changes.
- Fork the repository.
- Make your changes in a feature branch.
- Submit a pull request with your changes.

## License

Expand Down
4 changes: 2 additions & 2 deletions backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class Backend:
def __init__(self, login_callback=None):

app_directory = os.path.join(os.getenv('APPDATA'), 'ErpSnap2')
app_directory = os.path.join(os.getenv('APPDATA'), 'ErpSnap')
if not os.path.exists(app_directory):
os.makedirs(app_directory)

Expand Down Expand Up @@ -156,7 +156,7 @@ def shorten_name(full_name):

def make_request(session, method,url, **kwargs):
try:
res = session.request(method, url, verify=False, timeout=50, **kwargs)
res = session.request(method, url, verify=False, timeout=5, **kwargs)
if res.status_code == 200:
return {'status': 'success','data':res}
else:
Expand Down
15 changes: 12 additions & 3 deletions gui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt6.QtWidgets import QMainWindow, QLabel, QPushButton, QVBoxLayout, QWidget, QDialog, QLineEdit, QTabWidget, QScrollArea, QHBoxLayout, QMessageBox

from PyQt6.QtCore import Qt, QPoint, pyqtSignal, QThread, QObject, QSize
from PyQt6.QtCore import Qt, QPoint, pyqtSignal, QThread, QObject, QSize, QCoreApplication
from PyQt6.QtGui import QGuiApplication, QMovie
import sys
import os
Expand Down Expand Up @@ -86,11 +86,11 @@ def setupUI(self):
refresh_button = QPushButton("⟳")
refresh_button.setStyleSheet("color: black;background-color: rgba(237,174,28,100%);border:none;font-size: 13px;padding-bottom:3px;")
refresh_button.clicked.connect(self.get_data)
refresh_button.setFixedSize(13, 13)
refresh_button.setFixedSize(14, 14)

info_button = QPushButton("🛈")
info_button.clicked.connect(self.show_info_dialog)
info_button.setFixedSize(13,13)
info_button.setFixedSize(14,14)

button_layout = QHBoxLayout()
button_layout.addStretch(1)
Expand Down Expand Up @@ -167,10 +167,19 @@ def show_info_dialog(self):
"<b>Developer: <a href='https://www.github.com/AshishJii'>Ashish Verma</a><br>"
"</div>"
)

close_button = dialog.addButton("Exit Application",QMessageBox.ButtonRole.RejectRole)
close_button.setStyleSheet("padding: 5px;")
close_button.clicked.connect(self.close_application)

dialog.setStandardButtons(QMessageBox.StandardButton.Ok)
dialog.setWindowFlags(Qt.WindowType.SplashScreen)
dialog.exec()

def close_application(self):
self.thread.exit()
self.close()
QCoreApplication.quit()
# button click handler
def get_data(self):
if not self.backend.credentials_present():
Expand Down

0 comments on commit 13c214c

Please sign in to comment.