Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
781faa57
Commit
781faa57
authored
8 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
New error handling
parent
b988a348
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/sakia/gui/mainwindow.py
+4
-1
4 additions, 1 deletion
src/sakia/gui/mainwindow.py
src/sakia/gui/transfer.py
+1
-0
1 addition, 0 deletions
src/sakia/gui/transfer.py
src/sakia/main.py
+29
-2
29 additions, 2 deletions
src/sakia/main.py
with
34 additions
and
3 deletions
src/sakia/gui/mainwindow.py
+
4
−
1
View file @
781faa57
...
...
@@ -5,8 +5,10 @@ Created on 1 févr. 2014
"""
import
aiohttp
import
logging
import
traceback
from
PyQt5.QtWidgets
import
QMainWindow
,
QAction
,
QFileDialog
,
QMessageBox
,
QLabel
,
QComboBox
,
QDialog
,
QApplication
from
PyQt5.QtWidgets
import
QMainWindow
,
QAction
,
QFileDialog
,
\
QMessageBox
,
QLabel
,
QComboBox
,
QDialog
,
QApplication
,
QErrorMessage
from
PyQt5.QtCore
import
QLocale
,
QEvent
,
\
pyqtSlot
,
QDateTime
,
QTimer
,
Qt
,
QObject
,
QUrl
from
PyQt5.QtGui
import
QIcon
...
...
@@ -29,6 +31,7 @@ from ..core.community import Community
from
..tools.decorators
import
asyncify
from
..__init__
import
__version__
from
.widgets
import
toast
from
.widgets.dialogs
import
QAsyncMessageBox
class
MainWindow
(
QObject
):
...
...
This diff is collapsed.
Click to expand it.
src/sakia/gui/transfer.py
+
1
−
0
View file @
781faa57
...
...
@@ -180,6 +180,7 @@ class TransferMoneyDialog(QObject):
@asyncify
async
def
relative_amount_changed
(
self
,
value
):
raise
Exception
(
"
Test
"
)
ud_block
=
await
self
.
community
.
get_ud_block
()
dividend
=
ud_block
[
'
dividend
'
]
base
=
ud_block
[
'
unitbase
'
]
...
...
This diff is collapsed.
Click to expand it.
src/sakia/main.py
+
29
−
2
View file @
781faa57
...
...
@@ -12,12 +12,14 @@ import traceback
# To debug missing spec
import
jsonschema
import
traceback
# To force cx_freeze import
import
PyQt5.QtSvg
from
quamash
import
QSelectorEventLoop
from
PyQt5.QtWidgets
import
QApplication
from
PyQt5.QtWidgets
import
QApplication
,
QMessageBox
from
PyQt5.QtCore
import
Qt
from
sakia.gui.mainwindow
import
MainWindow
from
sakia.core.app
import
Application
...
...
@@ -55,13 +57,38 @@ def async_exception_handler(loop, context):
for
ignored
in
(
"
Unclosed
"
,
"
socket.gaierror
"
):
if
ignored
in
line
:
return
os
.
_exit
(
1
)
exception_message
(
log_lines
,
exc_info
)
def
exception_handler
(
*
exc_info
):
logging
.
error
(
"
An unhandled exception occured
"
,
exc_info
=
exc_info
)
exception_message
([
"
An unhandled exception occured
"
],
exc_info
)
def
exception_message
(
log_lines
,
exc_info
):
stacktrace
=
traceback
.
format_exception
(
*
exc_info
)
if
exc_info
else
""
message
=
"""
{log_lines}
----
{stacktrace}
"""
.
format
(
log_lines
=
'
\n
'
.
join
(
log_lines
),
stacktrace
=
'
\n
'
.
join
(
stacktrace
))
mb
=
QMessageBox
(
QMessageBox
.
Critical
,
"
Critical error
"
,
"""
A critical error occured. Select the details to display it.
Please report it to <a href=
\"
https://github.com/duniter/sakia/issues/new
\"
>the developers github</a>
"""
,
QMessageBox
.
Ok
,
QApplication
.
activeWindow
())
mb
.
setDetailedText
(
message
)
mb
.
setTextFormat
(
Qt
.
RichText
)
mb
.
setTextInteractionFlags
(
Qt
.
TextSelectableByMouse
)
mb
.
exec
()
if
__name__
==
'
__main__
'
:
# activate ctrl-c interrupt
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_DFL
)
sakia
=
QApplication
(
sys
.
argv
)
sys
.
excepthook
=
exception_handler
sakia
.
setStyle
(
'
Fusion
'
)
loop
=
QSelectorEventLoop
(
sakia
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment