Skip to content

Commit

Permalink
Merge pull request #2 from Xevib/master
Browse files Browse the repository at this point in the history
Add extra button to open report
  • Loading branch information
wb7odyfred authored Mar 20, 2023
2 parents 7e53f8a + f563162 commit b1a173c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion User_Report.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,26 @@ class MyWindow(Gtk.Window):

def __init__(self):
Gtk.Window.__init__(self, title="User Computer configuration report")
self.set_border_width(10)

hbox = Gtk.Box(spacing=6)
self.add(hbox)

self.button = Gtk.Button(label="Create User Computer report")
self.button.connect("clicked", self.on_button_clicked)
self.add(self.button)
hbox.pack_start(self.button,True,True,0)

self.button_open = Gtk.Button(label="Open generated report")
self.button_open.connect("clicked", self.on_button_open_clicked)
hbox.pack_end(self.button_open, True,True,0)

def on_button_clicked(self, widget):
# os.system('/bin/sh /usr/share/generate_user_report/User_Report.sh')
os.system('/bin/sh /usr/share/generate_user_report/User_Report.sh > ~/Desktop/Report_$(hostname)_$(date +%F) && gzip -fk ~/Desktop/Report_$(hostname)_$(date +%F)')

def on_button_open_clicked(self,widget):
os.system("xdg-open ~/Desktop/Report_$(hostname)_$(date +%F)")

win = MyWindow()
win.connect("destroy", Gtk.main_quit)
win.show_all()
Expand Down

0 comments on commit b1a173c

Please sign in to comment.