Skip to content

Commit

Permalink
Merge pull request #4 from yukiarrr/feature/error-dialog
Browse files Browse the repository at this point in the history
Open error dialog
  • Loading branch information
yukiarrr authored Nov 24, 2019
2 parents 542b431 + 2930c1c commit 106bcd6
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 50 deletions.
23 changes: 20 additions & 3 deletions Il2cppSpy/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
from PySide2.QtCore import Qt
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import QApplication, QMainWindow, QFileDialog, QProgressDialog
from PySide2.QtWidgets import QApplication, QMainWindow, QFileDialog, QProgressDialog, QDialog, QLabel, QHBoxLayout
import qdarkstyle

from Il2cppSpy.presentation.presenter.action_presenter import ActionPresenter
Expand Down Expand Up @@ -33,7 +33,11 @@ def action_open_file(self):
progress_dialog.setWindowModality(Qt.WindowModal)
progress_dialog.setWindowFlags(Qt.Window | Qt.WindowTitleHint | Qt.CustomizeWindowHint)
progress_dialog.show()
self.action_presenter.open_file(file_path, lambda value: progress_dialog.setValue(value * 100))
try:
self.action_presenter.open_file(file_path, lambda value: progress_dialog.setValue(value * 100))
except: # noqa: E722
progress_dialog.close()
self.open_error_dialog()

def action_compare_files(self):
before_file_path, _ = QFileDialog.getOpenFileName(self, 'Open Before Apk', filter='Apk(*.apk)', options=QFileDialog.DontUseNativeDialog)
Expand All @@ -47,7 +51,20 @@ def action_compare_files(self):
progress_dialog.setWindowModality(Qt.WindowModal)
progress_dialog.setWindowFlags(Qt.Window | Qt.WindowTitleHint | Qt.CustomizeWindowHint)
progress_dialog.show()
self.action_presenter.compare_files(before_file_path, after_file_path, lambda value: progress_dialog.setValue(value * 100))
try:
self.action_presenter.compare_files(before_file_path, after_file_path, lambda value: progress_dialog.setValue(value * 100))
except: # noqa: E722
progress_dialog.close()
self.open_error_dialog()

def open_error_dialog(self):
error_dialog = QDialog(self)
label = QLabel()
label.setText('Sorry...\nNot support this apk.')
layout = QHBoxLayout()
layout.addWidget(label)
error_dialog.setLayout(layout)
error_dialog.show()


def resource_path(relative):
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ autopep8 = "*"
flake8 = "*"
mypy = "*"
pyinstaller = "*"
v = {editable = true,version = "*"}

[packages]
pyside2 = "*"
Expand Down
112 changes: 65 additions & 47 deletions Pipfile.lock

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

0 comments on commit 106bcd6

Please sign in to comment.