Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim
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
Operate
Environments
Monitor
Incidents
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
Show more breadcrumbs
Philipp Hörist
gajim
Commits
124e501f
Commit
124e501f
authored
6 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
Make ExceptionDialog easier to test
parent
188fb85b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gajim/gtkexcepthook.py
+18
-2
18 additions, 2 deletions
gajim/gtkexcepthook.py
with
18 additions
and
2 deletions
gajim/gtkexcepthook.py
+
18
−
2
View file @
124e501f
...
...
@@ -31,11 +31,17 @@
from
urllib.parse
import
urlencode
import
nbxmpp
import
gajim
import
gi
gi
.
require_version
(
'
Gtk
'
,
'
3.0
'
)
from
gi.repository
import
Gtk
,
GObject
try
:
import
gajim
gajim_version
=
gajim
.
__version__
except
ImportError
:
# For standalone testing
gajim_version
=
'
Package not installed
'
if
__name__
==
'
__main__
'
:
glade_file
=
os
.
path
.
join
(
'
data
'
,
'
gui
'
,
'
exception_dialog.ui
'
)
else
:
...
...
@@ -59,6 +65,7 @@
## Steps to reproduce the problem
...
'''
def
_hook
(
type_
,
value
,
tb
):
if
not
_exception_in_progress
.
acquire
(
False
):
# Exceptions have piled up, so we use the default exception
...
...
@@ -83,8 +90,11 @@ def __init__(self, type_, value, tb):
traceback
.
print_exception
(
type_
,
value
,
tb
,
None
,
trace
)
self
.
text
=
self
.
get_issue_text
(
trace
.
getvalue
())
buffer_
.
set_text
(
self
.
text
)
print
(
self
.
text
)
self
.
exception_view
.
set_editable
(
False
)
self
.
dialog
.
show
()
if
__name__
==
'
__main__
'
:
self
.
dialog
.
connect
(
'
delete-event
'
,
self
.
_on_delete_event
)
def
on_report_clicked
(
self
,
*
args
):
issue_url
=
'
https://dev.gajim.org/gajim/gajim/issues/new
'
...
...
@@ -94,6 +104,11 @@ def on_report_clicked(self, *args):
def
on_close_clicked
(
self
,
*
args
):
self
.
dialog
.
destroy
()
if
__name__
==
'
__main__
'
:
Gtk
.
main_quit
()
def
_on_delete_event
(
self
,
*
args
):
Gtk
.
main_quit
()
def
get_issue_text
(
self
,
traceback_text
):
gtk_ver
=
'
%i.%i.%i
'
%
(
...
...
@@ -106,7 +121,7 @@ def get_issue_text(self, traceback_text):
gtk_ver
,
gobject_ver
,
nbxmpp
.
__version__
,
gajim
.
_
_version
__
,
gajim_version
,
traceback_text
)
...
...
@@ -126,6 +141,7 @@ def get_os_info():
return
platform
.
system
()
return
''
# this is just to assist testing (python3 gtkexcepthook.py)
if
__name__
==
'
__main__
'
:
init
()
...
...
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