Skip to content

Commit

Permalink
Open error dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiarrr committed Nov 24, 2019
1 parent 2fa565b commit 2930c1c
Showing 1 changed file with 20 additions and 3 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

0 comments on commit 2930c1c

Please sign in to comment.