Skip to content

Commit 0c57f02

Browse files
authored
cs_info: Fix space in URLs (#11714)
1 parent 380a660 commit 0c57f02

File tree

1 file changed

+3
-22
lines changed
  • files/usr/share/cinnamon/cinnamon-settings/modules

1 file changed

+3
-22
lines changed

files/usr/share/cinnamon/cinnamon-settings/modules/cs_info.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -222,32 +222,13 @@ def on_module_selected(self):
222222

223223
def on_copy_clipboard_button_clicked(self, button):
224224
try:
225-
# taken from https://github.com/linuxmint/xapp/blob/master/scripts/upload-system-info
226-
subproc = Gio.Subprocess.new(['inxi', '-Fxxrzc0'], Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE)
227-
subproc.wait_check_async(None, self.on_copy_clipboard_complete)
225+
inxiOutput = subprocess.run(['inxi', '-Fxxrzc0'], check=True, stdout=subprocess.PIPE).stdout
226+
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
227+
clipboard.set_text(inxiOutput.decode("utf-8"), -1)
228228
except Exception as e:
229229
print("An error occurred while copying the system information to clipboard")
230230
print(e)
231231

232-
def on_copy_clipboard_complete(self, subproc, result):
233-
def _convert_stream_to_string(stream):
234-
"""Convert Gio.InputStream to string"""
235-
bytes = bytearray(0)
236-
buf = stream.read_bytes(1024, None).get_data()
237-
while buf:
238-
bytes += buf
239-
buf = stream.read_bytes(1024, None).get_data()
240-
stream.close()
241-
content = bytes.decode("utf-8")
242-
return content
243-
try:
244-
status = subproc.wait_check_finish(result)
245-
if status:
246-
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
247-
clipboard.set_text(_convert_stream_to_string(subproc.get_stdout_pipe()), -1)
248-
except Exception as e:
249-
print("copying to clipboard failed : %s" % e.message)
250-
251232
def on_button_clicked(self, button, spinner):
252233

253234
try:

0 commit comments

Comments
 (0)