-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaggins_setup.py
executable file
·34 lines (34 loc) · 979 Bytes
/
baggins_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import os
import gi
gi.require_version("Gtk","4.0")
gi.require_version("Adw","1")
from gi.repository import Gtk, Adw
bagpath=os.path.expanduser("~")+"/.baggins"
if (not os.path.exists(bagpath)):
os.mkdir(bagpath)
def saveetc(entry,window):
global path
text=entry.get_text()
file=open(bagpath+"/searchengine","w")
file.write(text)
file.close()
window.destroy()
def activate(application):
window=Gtk.ApplicationWindow()
window.set_application(application)
window.set_title("Setup")
box=Gtk.Box()
window.set_child(box)
label=Gtk.Label(label="The search engine:")
box.append(label)
entry=Gtk.Entry()
entry.set_text(open(bagpath+"/searchengine").read())
box.append(entry)
button=Gtk.Button(label="Save and exit")
button.connect("clicked",lambda x: saveetc(entry,window))
box.append(button)
window.present()
application=Gtk.Application(application_id="org.freedesktop.Baggins")
application.connect("activate",activate)
application.run(None)