-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-making everything! Made a brand new QT Python app with PySide6
- Loading branch information
1 parent
8d8cd65
commit 35f26fd
Showing
25 changed files
with
451 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<center>SamsungFlashGUI<center> | ||
Made By [<i>justaCasualCoder<i>](https://github.com/justaCasualCoder/SamsungFlashGUI) | ||
|
||
This project would not be possible without: | ||
|
||
[Heimdall](https://github.com/Benjamin-Dobell/Heimdall) (Used to Flash Images) | ||
|
||
[Pyside6](https://doc.qt.io/qtforpython-6/quickstart.html) (Used for the GUI) | ||
|
||
[Python](https://www.python.org/) (What it is coded in) | ||
|
||
![](https://s3.dualstack.us-east-2.amazonaws.com/pythondotorg-assets/media/files/python-logo-only.svg) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2010-2017 Benjamin Dobell, Glass Echidna | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,55 @@ | ||
# SamsungFlashGUI | ||
|
||
A Python Script that can be used to easily flash .img files to any Samsung phone | ||
|
||
## WARNING!! | ||
|
||
THIS PROJECT IS CURRENTLY BEING REDONE AND IS VERY UNSTABLE! | ||
|
||
### Running | ||
Download the file corresponding to your OS. | ||
|
||
To run on Windows , open a Command Prompt in the directory where it was downloaded and run | ||
``` | ||
SamsungFlashGUI.exe | ||
``` | ||
To run on Linux , open a Terminal in the directory where it was downloaded and run | ||
Install PySide6 | ||
|
||
```bash | ||
pip install PySide6 | ||
``` | ||
./SamsungFlashGUILinux | ||
|
||
Install Heimdall (Example on Debian): | ||
|
||
```bash | ||
sudo apt install heimdall | ||
``` | ||
|
||
Download / save `gui.py` and run it. | ||
|
||
#### Building | ||
|
||
In order to build the Python file into a portable executable , you have to install [Pyinstaller](https://pyinstaller.org/en/stable/) and run the following command: | ||
|
||
On Windows | ||
``` | ||
pyinstaller --collect-all customtkinter -w --onefile --noconsole --add-data "%cd%\heimdall:heimdall" SamsungFlashGUI.py | ||
``` | ||
On Linux | ||
```bash | ||
pyinstaller --onefile --noconsole --add-binary "/bin/heimdall:." --add-data "$(pwd)/python-logo-only.svg:." gui.py | ||
``` | ||
pyinstaller --collect-all customtkinter -w --onefile --noconsole --add-data "$(pwd)/heimdall:heimdall" SamsungFlashGUI.py | ||
``` | ||
## Features | ||
- Ability to run on Linux and Windows | ||
- Can be built into a Linux executable or Windows EXE | ||
## Known Issues | ||
- It dosent look the greatest in Linux | ||
## Screenshots | ||
<img src="Images/FileSelect.png" width="600px" > <img src="Images/SelectPart.png" width="600px" > | ||
<img src="Images/FileSelectPy.png" width="600px"> | ||
<img src="Images/PartSelectPy.png" width="600px"> | ||
|
||
# Credits | ||
|
||
The following programs were used in the code: | ||
|
||
[Heimdall](https://github.com/Benjamin-Dobell/Heimdall) (Used to Flash Images) | ||
|
||
[Pyside6](https://doc.qt.io/qtforpython-6/quickstart.html) (Used for the GUI) | ||
|
||
[Python](https://www.python.org/) (What it is coded in) | ||
|
||
# Screenshots | ||
|
||
![](screenshots/main_window.png "Main Window") | ||
|
||
![](screenshots/about_window.png "About Window") | ||
|
||
# Why? | ||
|
||
- I wanted a easy way to flash `*IMG`'s to Samsung devices | ||
|
||
- The already made Heimdall-Frontend is awesome , but was overcomplicated for me. | ||
|
||
- WHY NOT |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import sys | ||
import os | ||
from PySide6.QtWidgets import * | ||
from PySide6.QtGui import * | ||
cwd = os.path.dirname(os.path.abspath(__file__)) | ||
os.chdir(cwd) | ||
class Form(QMainWindow): | ||
|
||
def __init__(self, parent=None): | ||
super(Form, self).__init__(parent) | ||
self.setWindowTitle("SamsungFlashGUI") | ||
# Create widgets | ||
self.label = QLabel(self) | ||
self.label.setText("Please select your IMG to Flash & partiton") | ||
self.filenameentry = QLineEdit("twrp.img") | ||
self.chooseimage = QPushButton("Choose Image") | ||
self.flash = QPushButton("Flash") | ||
self.buttoncheck = QComboBox() | ||
self.buttoncheck.addItems(["BOOT", "RECOVERY", "DATA" , "SYSTEM"]) | ||
layout = QVBoxLayout() | ||
hbox = QHBoxLayout() | ||
buttonbox = QHBoxLayout() | ||
# Set up Menu Buttons | ||
aboutbutton = QAction("About", self) | ||
aboutbutton.setStatusTip("About this project") | ||
aboutbutton.triggered.connect(self.aboutdialog) | ||
aboutbutton.setCheckable(False) | ||
# AutoDetctedButton = QAction("Auto Mode", self) | ||
# AutoDetctedButton.setStatusTip("Auto-Detcted Device") | ||
# AutoDetctedButton.triggered.connect(self.detectdevice) | ||
# AutoDetctedButton.setCheckable(False) | ||
quitbutton = QAction("Quit", self) | ||
quitbutton.setStatusTip("Exit this program") | ||
quitbutton.triggered.connect(lambda: quit()) | ||
quitbutton.setCheckable(False) | ||
menu = self.menuBar() | ||
file_menu = menu.addMenu("File") | ||
file_menu.addAction(aboutbutton) | ||
file_menu.addAction(quitbutton) | ||
# file_menu.addAction(AutoDetctedButton) | ||
widget = QWidget() | ||
widget.setLayout(layout) | ||
self.setCentralWidget(widget) | ||
layout.addWidget(self.label) | ||
hbox.addWidget(self.filenameentry) | ||
hbox.addWidget(self.chooseimage) | ||
hbox.addWidget(self.buttoncheck) | ||
layout.addLayout( buttonbox ) | ||
layout.addLayout( hbox ) | ||
layout.addWidget(self.flash) | ||
self.chooseimage.clicked.connect(self.Image) | ||
self.flash.clicked.connect(self.flashimage) | ||
def Image(self): | ||
global filename | ||
file_dialog = QFileDialog() | ||
file_dialog.setFileMode(QFileDialog.ExistingFile) | ||
file_dialog.setNameFilter("Image Files (*.img)") | ||
file_dialog.setViewMode(QFileDialog.List) | ||
if file_dialog.exec(): | ||
filenames = file_dialog.selectedFiles() | ||
if filenames: | ||
filename = filenames[0] | ||
print(f"File {filename} chosen") | ||
self.filenameentry.setText(filename) | ||
def flashimage(self): | ||
try: | ||
filename | ||
except NameError: | ||
filename = self.filenameentry.text() | ||
print(f"Flashing {filename} to {self.buttoncheck.currentText()}") | ||
print(f"heimdall flash --{self.buttoncheck.currentText()} {filename}") | ||
# Portions of this project are using code from the Heimdall project, developed by Benjamin Dobell and other contributors, which is licensed under the MIT License. | ||
heimdallbin = os.path.abspath(os.path.join(cwd,'heimdall')) | ||
os.system(f"if [ ! -f /bin/heimdall ]; then echo 'Using Local Heimdall' && {heimdallbin} flash --{self.buttoncheck.currentText()} {filename} ; else echo 'Using /bin/heimdall' && heimdall flash --{self.buttoncheck.currentText()} {filename} ; fi") | ||
def aboutdialog(self): | ||
logo = os.path.abspath(os.path.join(cwd,'python-logo-only.svg')) | ||
text = f""" | ||
<p><center>SamsungFlashGUI<center><p> | ||
<p><center><img src="{logo}" alt=""><center></p> | ||
Made By <a href="https://github.com/justaCasualCoder/SamsungFlashGUI"><i>justaCasualCoder<i></a></p> | ||
<p>This project would not be possible without:</p> | ||
<p><a href="https://github.com/Benjamin-Dobell/Heimdall">Heimdall</a> (Used to Flash Images)</p> | ||
<p><a href="https://doc.qt.io/qtforpython-6/quickstart.html">Pyside6</a> (Used for the GUI)</p> | ||
<p><a href="https://www.python.org/">Python</a> (What it is coded in)</p> | ||
""" | ||
dlg = QMessageBox(self) | ||
dlg.setWindowTitle("About") | ||
dlg.setText(text) | ||
button = dlg.exec() | ||
# def detectdevice(self): | ||
# print("") | ||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
# Create the Qt Application | ||
app = QApplication(sys.argv) | ||
# Create and show the form | ||
form = Form() | ||
form.show() | ||
# Run the main Qt loop | ||
sys.exit(app.exec()) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.