|
4 | 4 |
|
5 | 5 | import requests
|
6 | 6 | import subprocess
|
7 |
| -import glob, os |
| 7 | +import glob, os, json, datetime |
8 | 8 |
|
9 | 9 | import base64
|
10 | 10 | from io import BytesIO
|
@@ -46,7 +46,7 @@ def show_window(self):
|
46 | 46 | self.textview.set_size_request(400, 200)
|
47 | 47 | self.textview.set_wrap_mode(Gtk.WrapMode.WORD)
|
48 | 48 | textbuffer = self.textview.get_buffer()
|
49 |
| - textbuffer.set_text(_("Start typing your note here")) |
| 49 | + textbuffer.set_text(_("")) |
50 | 50 |
|
51 | 51 | label = Gtk.Label(_("Note:"))
|
52 | 52 | label.set_direction(Gtk.TextDirection.LTR)
|
@@ -83,19 +83,23 @@ def on_send_click(self, button):
|
83 | 83 | hostname = controls.execute("hostname")
|
84 | 84 | username = controls.execute("whoami")
|
85 | 85 |
|
| 86 | + |
86 | 87 | list_of_files = glob.glob(summary.MAINDIR+'ss/*')
|
87 | 88 | latest_file = max(list_of_files, key=os.path.getctime)
|
88 | 89 |
|
89 |
| - data = { |
| 90 | + data = [] |
| 91 | + data.append({ |
90 | 92 | "machine_name": hostname,
|
91 | 93 | "username": username,
|
92 | 94 | "note": text,
|
93 | 95 | "filename": latest_file
|
94 |
| - } |
| 96 | + }) |
| 97 | + |
| 98 | + with open(summary.MAINDIR + "ss/main.json", "a") as outfile: |
| 99 | + json.dump(data, outfile) |
95 | 100 |
|
96 | 101 | file_object = open(summary.MAINDIR + "ss/main.json", 'a')
|
97 | 102 | file_object.write("\n")
|
98 |
| - file_object.write(str(data)) |
99 | 103 | file_object.close()
|
100 | 104 |
|
101 | 105 | # create new script that handles all api calls
|
|
0 commit comments