Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm-play-gui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roman Alifanov
eepm-play-gui
Commits
ba9639d4
Commit
ba9639d4
authored
Oct 28, 2024
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
errordialog: improved error preparation for bug reporting
parent
4d83504d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
command_runner.py
src/tools/command_runner.py
+2
-0
errordialog.py
src/widgets/errordialog.py
+25
-3
No files found.
src/tools/command_runner.py
View file @
ba9639d4
...
...
@@ -89,6 +89,8 @@ class CommandRunner:
env
=
os
.
environ
.
copy
()
env
[
'TERM'
]
=
'xterm'
self
.
append_log
(
f
"command: {command}
\n
"
)
process
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdout
=
slave_fd
,
stderr
=
slave_fd
,
stdin
=
slave_fd
,
text
=
True
,
env
=
env
)
...
...
src/widgets/errordialog.py
View file @
ba9639d4
import
webbrowser
import
webbrowser
,
subprocess
,
re
from
gi.repository
import
Gtk
,
GLib
,
Gdk
,
Adw
@Gtk.Template
(
resource_path
=
'/ru/eepm/PlayGUI/widgets/errordialog.ui'
)
...
...
@@ -24,10 +24,32 @@ class ErrorDialog(Adw.Dialog):
self
.
textbuffer
.
get_insert
(),
0
,
False
,
0.0
,
1.0
)
def
present_error
(
self
,
win
,
error
):
self
.
error
=
error
self
.
append_log
(
error
)
self
.
error
=
None
self
.
build_log
(
error
)
self
.
append_log
(
self
.
error
)
self
.
present
(
win
)
def
build_log
(
self
,
error
):
separator
=
"_________________"
distro_info
=
subprocess
.
run
(
[
"epm"
,
"print"
,
"info"
],
capture_output
=
True
,
text
=
True
,
check
=
True
)
.
stdout
filtered_error_lines
=
[
line
for
line
in
error
.
splitlines
()
if
'
%
'
not
in
line
]
filtered_error
=
'
\n
'
.
join
(
filtered_error_lines
)
filtered_error
=
re
.
sub
(
r'\n{3,}'
,
'
\n\n
'
,
filtered_error
)
if
filtered_error_lines
and
"command:"
in
filtered_error_lines
[
0
]
.
lower
():
first_line
=
filtered_error_lines
[
0
]
self
.
error
=
f
"{first_line}
\n
{separator}
\n
{distro_info}
\n
{separator}
\n
"
+
'
\n
'
.
join
(
filtered_error
.
splitlines
()[
-
30
:])
else
:
self
.
error
=
f
"{distro_info}
\n
{separator}
\n
"
+
'
\n
'
.
join
(
filtered_error
.
splitlines
()[
-
30
:])
def
copy_error
(
self
):
display
=
Gdk
.
Display
.
get_default
()
clipboard
=
display
.
get_clipboard
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment