base update

This commit is contained in:
Eshan Roy (Eshanized)
2024-02-23 09:43:39 +05:30
parent 0081034a28
commit b5f99f1de1
43 changed files with 1588 additions and 1548 deletions

View File

@@ -1,11 +1 @@
<h1 align="center" id="title">SNIGDHA OS WELCOME</h1>
<p align="center"><img src="https://socialify.git.ci/snigdhalinux/snigdhaos-welcome/image?font=KoHo&amp;issues=1&amp;language=1&amp;name=1&amp;pattern=Floating%20Cogs&amp;theme=Dark" alt="project-image"></p>
<p id="description">Snigdha OS Welcome App: It will help you to install Snigdha OS from a live environment.</p>
<h2>Project Screenshots:</h2>
<img src="https://github.com/snigdhalinux/snigdhaos-welcome/assets/148610067/ef2b3c9a-9746-4c70-89ce-304474e001ff" alt="project-screenshot" width="400" height="400/">
<img src="https://github.com/snigdhalinux/snigdhaos-welcome/assets/148610067/8d2b26d6-bf98-4dbd-9b8d-2fc9633748cf" alt="project-screenshot" width="400" height="400/">
# snigdha-welcome

View File

@@ -1,10 +1,10 @@
[Desktop Entry]
Name=Snigdha OS Welcome App
GenericName=Snigdha OS Welcome App
X-GNOME-FullName=Snigdha OS Welcome App
Comment=Welcome Application for Snigdha OS Installations
Name=Snigdha OS Welcome
GenericName=Snigdha OS Welcome
X-GNOME-FullName=Snigdha Welcome
Comment=Welcome Application for System Installations
Exec=/usr/local/bin/snigdhaos-welcome
Icon=snigdhaos-icon
Icon=snigdha-hello
Terminal=false
Type=Application
Categories=GTK;Settings;Security;X-GNOME-Settings-Panel;X-GNOME-SystemSettings;X-Unity-Settings-Panel;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;

View File

@@ -1,3 +1,2 @@
#!/usr/bin/env bash
python3 /usr/share/snigdhaos-welcome/snigdhaos-welcome.py

View File

@@ -1,10 +1,10 @@
[Desktop Entry]
Name=Snigdha OS Welcome
GenericName=Snigdha OS Welcome Welcome
X-GNOME-FullName=Snigdha OS Welcome Welcome
Comment=Welcome Application for Snigdha OS Installs
Exec=/usr/local/bin/snigdhaos-welcome
Icon=snigdhaos-welcome
GenericName=Snigdha OS Welcome
X-GNOME-FullName=Snigdha Welcome
Comment=Welcome Application for System Installations
Exec=/usr/local/bin/snigdha-welcome
Icon=snigdha-hello
Terminal=false
Type=Application
Categories=GTK;Settings;Security;X-GNOME-Settings-Panel;X-GNOME-SystemSettings;X-Unity-Settings-Panel;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;

View File

@@ -0,0 +1,18 @@
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400">
<title>snigdhaos-</title>
<style>
.s0 { fill: #000000 }
</style>
<filter id="f0">
<feFlood flood-color="#ae3cf7" flood-opacity="1" />
<feBlend mode="normal" in2="SourceGraphic"/>
<feComposite in2="SourceAlpha" operator="in" />
</filter>
<g id="Folder 1" filter="url(#f0)">
<path id="Layer" class="s0" d="m174.2 82.1l24.3-7.5c-4.8-14.1-15.7-27.7-21.1-33.9-10 16.9-5.5 34.7-3.2 41.4z"/>
<path id="Layer" class="s0" d="m230.2 122.1q-0.9 1.4-1.3 3-0.3 1.6-0.2 3.2 0.2 1.6 0.9 3.1 0.7 1.5 1.8 2.7 1.1 1.1 2.3 2.1 1.2 1.1 2.5 2 1.3 1 2.7 1.8 1.4 0.8 2.8 1.5c4-10.5 10.7-31 9.5-41.1-0.9-8-3.7-20.4-5.8-29.4q-1.1-4.5-2.6-9-1.4-4.4-3.2-8.7-1.8-4.3-4-8.4-2.2-4.2-4.7-8.1-0.8-1.3-1.6-2.6-0.9-1.3-1.8-2.5-0.9-1.2-1.9-2.4-1-1.2-2.1-2.3-0.3 0.4-0.6 0.7-0.3 0.4-0.6 0.8-0.3 0.4-0.6 0.8-0.3 0.4-0.6 0.8c16.8 39.6 16.1 66.2 14.1 78.6q-0.3 1.7-0.8 3.5-0.4 1.7-1.1 3.4-0.6 1.7-1.4 3.3-0.8 1.6-1.7 3.2z"/>
<path id="Layer" class="s0" d="m72.1 156.9q-1.9-0.6-3.5-1.5-1.7-1-3.1-2.3-1.4-1.2-2.6-2.8-1.1-1.5-1.8-3.3-1.2 0.2-2.2 0.4-0.2 0-0.3 0-0.1 0.1-0.1 0.1-0.1 0.1-0.2 0.1-0.1 0.1-0.1 0.2-0.1 0.1-0.1 0.2-0.1 0.1-0.1 0.2 0 0.1 0 0.2 0 0.1 0 0.2 0.4 1.5 0.9 3.1 0.4 1.5 0.9 3 0.5 1.5 1.1 3 0.5 1.5 1.1 3 1.2-0.2 2.4-0.5 1.1-0.2 2.3-0.6 1.1-0.4 2.2-1 1.1-0.5 2.1-1.1 0.6-0.3 1.1-0.6z"/>
<path id="Layer" class="s0" d="m284.5 118.4c-7.3-7.7-18.8-16-26.2-20.9q0.2 1 0.3 2c1.5 12.9-6.7 36.2-10.1 44.9q4 1.8 7.6 4.3 3.5 2.5 6.6 5.5 3.1 3 5.6 6.6 2.5 3.5 4.4 7.5 0.1 0.3 0.3 0.6c1.6 3.7 2.6 7.7 2.8 11.7 0.2 4-0.4 8.1-1.6 11.9-1.3 3.8-3.3 7.4-5.8 10.5-2.6 3.1-5.7 5.7-9.3 7.7-4.5 2.5-21.1 12.5-31.1 30.4q0 0.2-0.1 0.4l-0.2 0.3q-2 3.7-3.5 7.6-1.5 3.9-2.4 8-0.9 4.1-1.2 8.2-0.3 4.2-0.1 8.4 0.1 0.7-0.2 1.4-0.2 0.7-0.7 1.3-0.5 0.5-1.2 0.9-0.6 0.3-1.4 0.3-0.1 0-0.2 0-0.7 0-1.4-0.2-0.6-0.3-1.1-0.8-0.6-0.5-0.9-1.1-0.3-0.7-0.3-1.4-0.1-1.1-0.1-2.2 0-1.1 0-2.3 0-1.1 0-2.2 0.1-1.1 0.1-2.2l-17.3 28.3c-11.2 18.3-12.5 40.4-3.5 59.3q1.3 2.8 2.9 5.5 1.7 2.6 3.7 5.1 1.9 2.4 4.2 4.6 2.3 2.2 4.8 4.1c-0.5-10.1 1-28.5 13.6-49.7 0.5-0.8 1.3-1.4 2.3-1.7 1-0.2 2-0.1 2.8 0.4 0.9 0.5 1.5 1.4 1.7 2.3 0.3 1 0.1 2-0.4 2.9q-0.6 1-1.2 2.1-0.6 1.1-1.2 2.2-0.6 1.1-1.2 2.2-0.5 1.1-1 2.2c-1 5.4-2 17.8 1.4 25.5 8.9-13.5 34.4-54.7 37.7-87 0.1-1 0.6-1.9 1.4-2.5 0.7-0.6 1.7-0.9 2.7-0.8 1 0.1 1.9 0.6 2.5 1.3 0.7 0.8 0.9 1.8 0.8 2.8-1.3 13.2-6 27.6-11.8 41.1q2.9-1.5 5.7-3.1 2.8-1.7 5.5-3.4 2.7-1.8 5.3-3.8 2.6-2 5-4.1c14.6-12.4 33.7-35.4 42-74.2 0.2-1 0.8-1.8 1.6-2.4 0.8-0.5 1.8-0.7 2.8-0.5 1 0.2 1.8 0.8 2.4 1.6 0.5 0.8 0.7 1.8 0.5 2.8q-1.6 7.1-3.5 13.6c7.9-11.1 11.1-25 9.7-41.6q-0.3-3.7-0.9-7.3-0.6-3.7-1.5-7.3-0.8-3.7-2-7.2-1.1-3.6-2.4-7.1-1.2 0.3-2.4 0.4-1.1 0.2-2.3 0.3-1.2 0.1-2.4 0.1-1.2 0.1-2.4 0.1-1.2 0-2.4-0.1-1.2 0-2.4-0.1-1.1-0.1-2.3-0.2-1.2-0.1-2.4-0.2c-1-0.2-1.9-0.7-2.5-1.5-0.6-0.7-0.9-1.7-0.8-2.7 0.2-1 0.7-1.9 1.5-2.5 0.8-0.6 1.8-0.9 2.7-0.7 12.4 1.5 21.6-0.1 26.9-4.8q0.7-0.7 1.3-1.4 0.6-0.7 1.1-1.5 0.5-0.7 0.9-1.6 0.4-0.8 0.7-1.7c-8.9-0.8-29.1-6.2-56.5-35.2z"/>
<path id="Layer" fill-rule="evenodd" class="s0" d="m183.1 302.8c-1.6 4.5-2.8 9.2-3.5 14-0.7 4.7-0.8 9.5-0.5 14.3 0.3 4.8 1 9.5 2.3 14.2-26.7-26-3.4-86.5-3.1-87.2q0 0 0-0.1 0.1 0 0.1-0.1 0 0 0-0.1 0 0 0 0c6-21.4 5.3-36.2-2.1-45.3-8.7-10.5-24.4-10.5-35.5-9.7-8.8 0.8-16.7 3-23.6 5-9.9 2.8-17.7 5.1-25.3 2.4-8-2.9-8.7-12.3-8.4-17.7q2.3 0.3 4.6 0.6 2.3 0.2 4.6 0.4 2.3 0.1 4.6 0.2 2.3 0.1 4.6 0.1c17.2 0 39.3-2.8 52.1-11.9h0.1c0.8-0.6 1.3-1.5 1.5-2.4 0.2-1-0.1-2-0.6-2.8-0.6-0.8-1.5-1.4-2.4-1.5-1-0.2-2 0-2.8 0.6h-0.1c-18.3 13-60.2 11.2-68.3 8.7-7.1-2.2-12.4-9.2-16.3-16.8q1.3-0.3 2.5-0.6 1.3-0.4 2.5-0.9 1.2-0.4 2.4-1 1.1-0.6 2.3-1.2c4.2-2.5 6.2-5.2 5.8-8.3-0.2-1.9-1.4-4.4-6.1-5.9q-0.9-0.2-1.7-0.6-0.8-0.4-1.5-1-0.8-0.5-1.4-1.1-0.6-0.7-1.1-1.4c8.4-1.5 19-3.6 29.1-6 25.7-6.2 31.4-10.8 33.5-14 2.6-4.1 4.1-8.4 5.6-12.5 2.5-6.8 4.5-12.3 10.5-15.1l55.1-17q1.7-0.5 3.1-1.5 1.5-1 2.5-2.5 1.1-1.4 1.7-3 0.6-1.7 0.6-3.5c0.2-6.8 1.2-20.4 6.1-32.1 13.7 34.8 13 57.9 11.2 69q-0.2 1.4-0.6 2.8-0.3 1.4-0.8 2.7-0.5 1.4-1.2 2.7-0.6 1.2-1.4 2.5c-1 1.6-1.7 3.4-2.1 5.2-0.5 1.9-0.6 3.8-0.4 5.7 0.2 1.9 0.7 3.8 1.5 5.5 0.9 1.7 2 3.3 3.3 4.7q1.7 1.7 3.6 3.3 1.9 1.5 3.9 2.9 2.1 1.3 4.3 2.4 2.2 1.1 4.4 2h0.1q0 0 0 0.1 3.9 1.4 7.4 3.5 3.5 2.1 6.5 4.9 3 2.7 5.4 6 2.5 3.3 4.2 7l0.3 0.6c1.3 2.8 2 5.9 2.1 9 0.2 3.1-0.2 6.2-1.2 9.1-1 3-2.5 5.7-4.5 8.1-1.9 2.4-4.3 4.4-7.1 5.9-5 2.8-23.4 14-34.3 34l-31.8 51.8c-2.5 4.1-4.6 8.4-6.3 12.9zm-22.9-168c1.1-0.5 2.2-1.2 3.1-2.1 0.9-0.9 1.6-2 2.1-3.2 0.5-1.1 0.7-2.4 0.7-3.7 0-3.9-2.3-7.4-5.9-8.9-3.6-1.5-7.8-0.7-10.6 2.1-2.7 2.8-3.6 6.9-2.1 10.5 1.5 3.7 5.1 6 9 6 1.2 0 2.5-0.2 3.7-0.7z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,528 @@
# =================================================================
# = Authors: Brad Heffernan & Erik Dubois =
# =================================================================
import os
import getpass
from os.path import expanduser
DEBUG = False
#DEBUG = True
base_dir = os.path.dirname(os.path.realpath(__file__))
home = expanduser("~")
username = getpass.getuser()
if DEBUG:
user = username
else:
user = "eshan"
Settings = home + "/.config/snigdha-welcome/settings.conf"
Skel_Settings = "/etc/skel/.config/snigdha-welcome/settings.conf"
dot_desktop = "/usr/share/applications/snigdha-welcome.desktop"
autostart = home + "/.config/autostart/snigdha-welcome.desktop"
# check if path exists
def file_check(path):
if os.path.isfile(path):
return True
return False
def GUI(self, Gtk, GdkPixbuf):
autostart = eval(self.load_settings())
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
self.add(self.vbox)
hbox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox2 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox3 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox4 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox5 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox6 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox7 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox8 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox9 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
# vbox1 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
# vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
infoE = Gtk.EventBox()
pbinfo = GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/question.png"), 38, 38
)
infoimage = Gtk.Image().new_from_pixbuf(pbinfo)
infoE.add(infoimage)
infoE.connect("button_press_event", self.on_info_clicked)
infoE.set_property("has-tooltip", True)
infoE.connect("query-tooltip", self.tooltip_callback, "Conflicts Info")
# ======================================================================
# WELCOME LABEL
# ======================================================================
self.cc = Gtk.Label()
label = Gtk.Label(xalign=0)
label.set_markup("<big>Welcome to <b>Snigdha OS</b></big>")
label.set_line_wrap(True)
# pixbuf = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, 'images/arcolinux-one-liner.png'), 145, 145)
# image = Gtk.Image().new_from_pixbuf(pixbuf)
label2 = Gtk.Label(xalign=0)
label2.set_justify(Gtk.Justification.CENTER)
label2.set_line_wrap(True)
label_warning = Gtk.Label(xalign=0)
label_warning.set_justify(Gtk.Justification.CENTER)
label_warning.set_line_wrap(True)
if username == user:
label2.set_markup(
"We advise to clean the computer with <b>Gparted</b> before installing.\n"
+ "During the Calamares installation many options will be open to you. You have the freedom of choice.\n"
+ "We communicate with our community via a diversity of social media." # noqa
+ "Do join us to learn the latest news, ask questions or for casual talk.\n" # noqa
# + "<b>Forum</b> is for support\n" # noqa
+ "We have a <b>forum</b> for the longer and more technical questions.\n" # noqa
)
label_warning.set_markup(
"\n<span size='x-large'><b>Use Basic Installation\n"
+ "in case the Advanced Installation fails</b></span>\n" # noqa
) # noqa
else:
label2.set_markup(
"The links below will help you started on Snigdha OS. We communicate with our community via a diversity of social media.\n"
"Do join us to learn the latest news, ask questions or for casual talk.\n"
# + "<b>Telegram</b> is for chitchat - <b>Discord</b> is for assistance.\n" # noqa
+ "We have a <b>forum</b> for the longer and more technical questions.\n" # noqa
# + "Learn, have fun and enjoy." # noqa
)
hbox4.set_center_widget(label2)
hbox1.pack_start(label, False, False, 0)
hbox1.pack_end(self.cc, False, False, 0)
# hbox4.pack_start(label2, False, False, 0)
hbox8.pack_start(label_warning, True, False, 0)
# ======================================================================
# MAIN BUTTONS
# ======================================================================
button1 = Gtk.Button(label="")
button1_label = button1.get_child()
button1_label.set_markup("<span size='large'><b>Run GParted</b></span>")
button1.connect("clicked", self.on_gp_clicked)
button1.set_size_request(0, 60)
buttongrub = Gtk.Button(label="")
buttongrub_label = buttongrub.get_child()
buttongrub_label.set_markup(
"<span size='large'><b>Grub installation (Default)</b></span>"
)
buttongrub.connect("clicked", self.on_grub_clicked)
buttongrub.set_size_request(0, 60)
buttonsystemboot = Gtk.Button(label="")
buttonsystemboot_label = buttonsystemboot.get_child()
buttonsystemboot_label.set_markup(
"<span size='large'><b>Systemd-boot installation</b></span>"
)
buttonsystemboot.connect("clicked", self.on_systemboot_clicked)
buttonsystemboot.set_size_request(0, 60)
button2 = Gtk.Button(label="")
button2_label = button2.get_child()
button2_label.set_markup(
"<span size='large'><b>Basic Installation (Offline)</b></span>"
)
button2.connect("clicked", self.on_ai_clicked)
button2.set_size_request(0, 60)
buttonca = Gtk.Button(label="")
buttonca_label = buttonca.get_child()
buttonca_label.set_markup(
"<span size='large'><b>Advanced Installation (Online)</b></span>"
)
buttonca.connect("clicked", self.on_aica_clicked)
buttonca.set_size_request(0, 60)
self.button8 = Gtk.Button(label="")
button8_label = self.button8.get_child()
button8_label.set_markup(
"<span size='large'><b>Update Mirrorlists</b></span>"
)
self.button8.connect("clicked", self.on_mirror_clicked)
self.button8.set_size_request(420, 60)
# self.buttonatt = Gtk.Button(label="")
# buttonatt_label = self.buttonatt.get_child()
# buttonatt_label.set_markup(
# "<span size='large'><b>Launch Arch Linux Tweak Tool</b></span>"
# )
# self.buttonatt.connect("clicked", self.on_buttonatt_clicked)
# self.buttonatt.set_size_request(420, 60)
self.button_sofi = Gtk.Button(label="")
button_sofi_label = self.button_sofi.get_child()
button_sofi_label.set_markup("<span size='large'><b>Snigdha App Installer</b></span>")
self.button_sofi.connect("clicked", self.on_button_sofi_clicked)
self.button_sofi.set_size_request(420, 70)
# grid.add(button1)
if username == user:
grid = Gtk.Grid()
grid.attach(self.button8, 2, 0, 2, 2)
# grid.attach(button13, 2, 0, 2, 2)
grid.attach(button1, 2, 2, 2, 2)
if file_check("/sys/firmware/efi/fw_platform_size"):
grid.attach(buttongrub, 1, 4, 2, 2)
grid.attach(buttonsystemboot, 3, 4, 2, 2)
grid.attach(button2, 1, 6, 2, 2)
grid.attach(buttonca, 3, 6, 2, 2)
grid.set_column_homogeneous(True)
grid.set_row_homogeneous(True)
else:
grid = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
self.button8.set_size_request(300, 70)
# self.buttonatt.set_size_request(300, 70)
self.button_sofi.set_size_request(300, 70)
grid.pack_start(self.button_sofi, True, False, 0)
# grid.pack_start(self.buttonatt, True, False, 0)
grid.pack_start(self.button8, True, False, 0)
# grid.set_row_homogeneous(True)
# ======================================================================
# NOTICE
# ======================================================================
# label3 = Gtk.Label(xalign=0)
# label3.set_line_wrap(True)
# label4 = Gtk.Label(xalign=0)
# label4.set_line_wrap(True)
# self.vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
# self.vbox2.pack_start(label3, False,False,0)
# self.vbox2.pack_start(label4, False,False,0)
# ======================================================================
# USER INFO
# ======================================================================
lblusrname = Gtk.Label(xalign=0)
lblusrname.set_text("User:")
lblpassword = Gtk.Label(xalign=0)
lblpassword.set_text("Pass:")
lblusr = Gtk.Label(xalign=0)
lblusr.set_text("liveuser |")
lblpass = Gtk.Label(xalign=0)
lblpass.set_markup("<i>No Password</i>")
hboxUser = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hboxUser.pack_start(lblusrname, False, False, 0)
hboxUser.pack_start(lblusr, False, False, 0)
hboxUser.pack_start(lblpassword, False, False, 0)
hboxUser.pack_start(lblpass, False, False, 0)
# ======================================================================
# FOOTER BUTTON LINKS
# ======================================================================
# change this one every year
button3 = Gtk.Button(label="About Snigdha OS")
button3.connect(
"clicked", self.on_link_clicked, "https://snigdhaos.org/"
)
button3.set_size_request(180, 50)
# button4 = Gtk.Button(label="Choose your project")
# button4.connect(
# "clicked", self.on_link_clicked, "https://arcolinux.info/choose-your-project/"
# )
# button4.set_size_request(180, 50)
# button5 = Gtk.Button(label="Core info")
# button5.connect(
# "clicked", self.on_link_clicked, "https://arcolinux.info/arcolinux-editions/"
# )
# button5.set_size_request(180, 50)
# button6 = Gtk.Button(label="Fast track")
# button6.connect(
# "clicked", self.on_link_clicked, "https://arcolinux.info/fast-track/"
# )
# button6.set_size_request(180, 50)
button7 = Gtk.Button(label="Forum")
button7.connect("clicked", self.on_link_clicked, "http://forum.snigdhaos.org/")
button7.set_size_request(180, 50)
button70 = Gtk.Button(label="Screen resolution")
button70.set_size_request(180, 50)
button70.set_property("has-tooltip", True)
button70.connect("query-tooltip", self.tooltip_callback, "Fix Screen Resolution")
button70.connect("clicked", self.on_buttonarandr_clicked)
hbox2.pack_start(button3, True, True, 0)
# hbox2.pack_start(button4, True, True, 0)
# hbox2.pack_start(button5, True, True, 0)
# hbox2.pack_start(button6, True, True, 0)
hbox2.pack_start(button7, True, True, 0)
hbox2.pack_start(button70, True, True, 0)
# button8 = Gtk.Button(label="")
# button8_label = button8.get_child()
# button8_label.set_markup("<b>Donate</b>")
# button8.connect("clicked", self.on_link_clicked, "https://arcolinux.info/donation/")
button9 = Gtk.Button(label="Become Beta Tester")
button9.connect(
"clicked",
self.on_link_clicked,
"https://snigdhaos.org/",
)
button10 = Gtk.Button(label="Snigdha Develop")
button10.connect(
"clicked",
self.on_link_clicked,
"https://snigdhaos.org/",
)
# button11 = Gtk.Button(label="Youtube ArcoLinux Channel")
# button11.connect(
# "clicked", self.on_link_clicked, "https://www.youtube.com/erikdubois"
# )
button12 = Gtk.Button(label="Quit")
button12.set_size_request(200, 50)
button12.connect("clicked", Gtk.main_quit)
# button12.set_tooltip_markup("Quit the ArcoLinux Welcome App")
# hbox5.pack_start(button8, True, True, 0)
hbox5.pack_start(button9, True, True, 0)
hbox5.pack_start(button10, True, True, 0)
# hbox5.pack_start(button11, True, True, 0)
hbox5.pack_start(button12, True, True, 0)
# hbox8.pack_start(self.button8, True, False, 0)
# ======================================================================
# Add to startup
# ======================================================================
check = Gtk.CheckButton(label="Autostart")
check.connect("toggled", self.statup_toggle)
check.set_active(autostart)
hbox3.pack_end(check, False, False, 0)
# ======================================================================
# SOCIAL LINKS
# ======================================================================
# fbE = Gtk.EventBox()
# tE = Gtk.EventBox()
# meE = Gtk.EventBox()
# inE = Gtk.EventBox()
# liE = Gtk.EventBox()
# pE = Gtk.EventBox()
# yE = Gtk.EventBox()
# dE = Gtk.EventBox()
# tgE = Gtk.EventBox()
# elE = Gtk.EventBox()
# pbfb = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/facebook.png"), 28, 28
# )
# fbimage = Gtk.Image().new_from_pixbuf(pbfb)
# pbt = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/twitter.png"), 28, 28
# )
# timage = Gtk.Image().new_from_pixbuf(pbt)
# pbme = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/mewe.png"), 23, 23
# )
# meimage = Gtk.Image().new_from_pixbuf(pbme)
# pbin = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/insta.png"), 28, 28
# )
# inimage = Gtk.Image().new_from_pixbuf(pbin)
# pbli = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/linkedin.png"), 28, 28
# )
# liimage = Gtk.Image().new_from_pixbuf(pbli)
# pbp = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/patreon.png"), 28, 28
# )
# pimage = Gtk.Image().new_from_pixbuf(pbp)
# pby = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/youtube.png"), 28, 28
# )
# yimage = Gtk.Image().new_from_pixbuf(pby)
# pbd = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/discord.png"), 28, 28
# )
# dimage = Gtk.Image().new_from_pixbuf(pbd)
# pbtg = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/tg.png"), 28, 28
# )
# tgimage = Gtk.Image().new_from_pixbuf(pbtg)
# pbel = GdkPixbuf.Pixbuf().new_from_file_at_size(
# os.path.join(base_dir, "images/element.png"), 28, 28
# )
# elimage = Gtk.Image().new_from_pixbuf(pbel)
# fbE.add(fbimage)
# tE.add(timage)
# meE.add(meimage)
# inE.add(inimage)
# liE.add(liimage)
# pE.add(pimage)
# yE.add(yimage)
# dE.add(dimage)
# tgE.add(tgimage)
# elE.add(elimage)
# fbE.connect(
# "button_press_event",
# self.on_social_clicked,
# "https://www.facebook.com/groups/arcolinux",
# )
# tE.connect(
# "button_press_event", self.on_social_clicked, "https://twitter.com/arcolinux"
# )
# meE.connect(
# "button_press_event",
# self.on_social_clicked,
# "https://mewe.com/group/5bbc4577a40f3002b313671d",
# )
# inE.connect(
# "button_press_event",
# self.on_social_clicked,
# "https://www.instagram.com/arcolinux/",
# )
# liE.connect(
# "button_press_event",
# self.on_social_clicked,
# "https://www.linkedin.com/in/arcolinux/",
# )
# pE.connect(
# "button_press_event",
# self.on_social_clicked,
# "https://www.patreon.com/arcolinux",
# )
# yE.connect(
# "button_press_event", self.on_social_clicked, "https://youtube.com/c/erikdubois"
# )
# dE.connect(
# "button_press_event",
# self.on_social_clicked,
# "https://discordapp.com/invite/stBhS4taje",
# )
# tgE.connect(
# "button_press_event", self.on_social_clicked, "https://t.me/arcolinux_d_b"
# )
# elE.connect(
# "button_press_event",
# self.on_social_clicked,
# "https://app.element.io/#/room/!jUDkosOsuDbGWNzKYl:matrix.org",
# )
# fbE.set_property("has-tooltip", True)
# tE.set_property("has-tooltip", True)
# meE.set_property("has-tooltip", True)
# inE.set_property("has-tooltip", True)
# liE.set_property("has-tooltip", True)
# pE.set_property("has-tooltip", True)
# yE.set_property("has-tooltip", True)
# dE.set_property("has-tooltip", True)
# tgE.set_property("has-tooltip", True)
# elE.set_property("has-tooltip", True)
# fbE.connect("query-tooltip", self.tooltip_callback, "Facebook")
# tE.connect("query-tooltip", self.tooltip_callback, "Twitter")
# meE.connect("query-tooltip", self.tooltip_callback, "Mewe")
# inE.connect("query-tooltip", self.tooltip_callback, "Instagram")
# liE.connect("query-tooltip", self.tooltip_callback, "LinkedIn")
# pE.connect("query-tooltip", self.tooltip_callback, "Patreon")
# yE.connect("query-tooltip", self.tooltip_callback, "Youtube")
# dE.connect("query-tooltip", self.tooltip_callback, "Discord")
# tgE.connect("query-tooltip", self.tooltip_callback, "Telegram")
# elE.connect("query-tooltip", self.tooltip_callback, "Element-Matrix")
# hbox3.pack_start(fbE, False, False, 0)
# hbox3.pack_start(tE, False, False, 0)
# hbox3.pack_start(meE, False, False, 0)
# hbox3.pack_start(inE, False, False, 0)
# hbox3.pack_start(liE, False, False, 0)
# hbox3.pack_start(elE, False, False, 0)
# hbox6.pack_start(pE, False, False, 50)
# hbox6.pack_start(yE, False, False, 0)
# hbox6.pack_start(dE, False, False, 0)
# hbox6.pack_start(tgE, False, False, 0)
# if username == user:
# hbox3.pack_start(hboxUser, True, False, 0)
# hbox3.pack_start(hbox6, True, False, 0)
# ======================================================================
# Start Arcolinux Tweak Tool
# ======================================================================
launchBox = Gtk.EventBox()
pblaunch = GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/archlinux-tweak-tool.svg"), 40, 40
)
launchimage = Gtk.Image().new_from_pixbuf(pblaunch)
launchBox.add(launchimage)
launchBox.connect("button_press_event", self.on_launch_clicked, "")
launchBox.set_property("has-tooltip", True)
launchBox.connect(
"query-tooltip", self.tooltip_callback, "Launch Arcolinux Tweak Tool"
)
hbox6.pack_start(launchBox, False, False, 0)
# hbox6.pack_start(infoE, False, False, 0)
# ======================================================================
# PACK TO WINDOW
# ======================================================================
label3 = Gtk.Label("v20.6-4")
hbox7.pack_end(label3, False, False, 0)
# if self.is_connected():
# self.get_message(label3, label4)
self.vbox.pack_start(hbox1, False, False, 7) # Logo
self.vbox.pack_start(hbox4, False, False, 7) # welcome Label
self.vbox.pack_start(hbox8, False, False, 7) # warning Label
self.vbox.pack_start(grid, True, False, 7) # Run GParted/Calamares
# if self.results and self.is_connected():
# self.vbox.pack_start(self.vbox2, False, False, 0) # Notice
self.vbox.pack_end(hbox3, False, False, 0) # Footer
# self.vbox.pack_end(hbox7, False, False, 0) # Version
self.vbox.pack_end(hbox5, False, False, 7) # Buttons
self.vbox.pack_end(hbox2, False, False, 7) # Buttons

View File

@@ -16,7 +16,7 @@ class Conflicts(Gtk.Window):
self.set_border_width(10)
self.set_default_size(550, 250)
self.connect("delete-event", self.close)
self.set_icon_from_file(os.path.join(base_dir, 'images/snigdhaos-icon.png'))
self.set_icon_from_file(os.path.join(base_dir, 'images/arcolinux.png'))
self.set_position(Gtk.WindowPosition.CENTER)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
viewBox="0 0 512 512"
id="svg20"
sodipodi:docname="archlinux-tweak-tool-candy.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs24">
<linearGradient
inkscape:collect="always"
id="linearGradient1839-3">
<stop
style="stop-color:#ffb74c;stop-opacity:1"
offset="0"
id="stop1835" />
<stop
style="stop-color:#e23600;stop-opacity:1"
offset="1"
id="stop1837" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1839-3"
id="linearGradient1841"
x1="86.50972"
y1="245.53781"
x2="430.61194"
y2="245.53781"
gradientUnits="userSpaceOnUse"
spreadMethod="repeat" />
</defs>
<sodipodi:namedview
id="namedview22"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="1.4199219"
inkscape:cx="256.35213"
inkscape:cy="256"
inkscape:window-width="948"
inkscape:window-height="504"
inkscape:window-x="2884"
inkscape:window-y="28"
inkscape:window-maximized="1"
inkscape:current-layer="svg20" />
<path
d="m 222.11912,404.52403 c -8.21975,-2.95659 -16.81353,-6.89279 -19.09573,-8.74692 -3.00048,-2.43673 -4.15133,-1.87748 -4.15133,2.01714 0,2.96351 -1.2019,5.38831 -2.67086,5.38831 -6.39053,0 -33.46789,-20.07123 -44.56182,-33.03148 l -12.10615,-14.14369 -1.05104,12.79402 -1.05099,12.79402 -15.56846,-20.8401 C 93.316065,322.54078 81.319787,272.92425 88.582246,223.10491 93.195409,191.45456 108.70739,156.12805 126.90333,135.83604 l 11.91233,-13.28499 0.1381,12.25531 0.13811,12.2553 16.39894,-17.33979 c 19.33446,-20.44348 35.85662,-54.093639 37.59458,-46.654048 1.48445,6.353946 5.15496,25.941018 24.45978,17.229408 22.61143,-10.202613 59.67204,-10.169369 82.37845,0.0738 12.38238,5.58612 20.70148,-14.557002 22.60502,-17.638862 3.82517,-6.189391 14.22456,23.314832 36.58569,45.364052 l 19.09572,18.83002 0.1381,-12.18843 0.1381,-12.18842 11.91233,13.28498 c 17.18063,19.1599 33.45121,55.46064 37.89109,84.54128 8.4368,55.25014 -6.34381,109.44646 -40.60328,148.88168 l -9.47713,10.90909 -0.099,-12.56965 -0.099,-12.56977 -12.35504,13.80354 c -12.24118,13.67648 -38.968,34.35228 -44.40394,34.35228 -1.55261,0 -2.82283,-2.27218 -2.82283,-5.04919 0,-4.16777 -2.46408,-3.77769 -14.11417,2.23393 -18.82104,9.71177 -60.84524,11.83686 -82.19748,4.15672 z m 65.72922,-66.69576 c 4.94741,-3.6664 13.85233,-12.9949 19.78885,-20.731 l 10.79357,-14.06411 v 28.39393 l 9.98158,-13.57251 c 14.41325,-19.59888 19.90823,-38.16705 19.90823,-67.26823 0,-29.84052 -6.27745,-50.91936 -19.91336,-66.86776 l -9.70664,-11.35269 -0.13477,12.95254 -0.13478,12.95254 -9.6458,-13.31579 c -29.33478,-40.49418 -77.20822,-38.6407 -103.70118,4.0163 l -6.18798,9.96335 -0.0864,-14.94464 -0.0864,-14.94465 -6.80422,8.30279 c -3.74226,4.56657 -10.71938,16.52216 -15.50428,26.56869 -16.42974,34.49219 -10.24253,89.99262 13.06549,117.21079 l 9.12107,10.65122 0.13478,-12.71225 0.13492,-12.71239 10.79357,14.0346 c 15.29634,19.88897 29.85206,27.05901 51.61505,25.42502 10.66085,-0.80035 21.11222,-3.94134 26.56869,-7.98537 z"
fill="#ffffff"
stroke-width="3.32112"
id="path18"
style="fill-opacity:1;fill:url(#linearGradient1841);opacity:1"
inkscape:export-filename="/home/erik/Insync/Arcolinux/ATT/archlinux-tweak-tool-candy.png"
inkscape:export-xdpi="88"
inkscape:export-ydpi="88" />
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
viewBox="0 0 512 512"
id="svg20"
sodipodi:docname="archlinux-tweak-tool.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs24" />
<sodipodi:namedview
id="namedview22"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="1.4199219"
inkscape:cx="126.76754"
inkscape:cy="256"
inkscape:window-width="1920"
inkscape:window-height="1080"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg20" />
<path
d="m 431.29156,253.05 c 0,98.44406 -79.80564,178.24156 -178.24156,178.24156 -98.44406,0 -178.241558,-79.80564 -178.241558,-178.24156 0,-98.44406 79.805638,-178.241558 178.241558,-178.241558 98.44406,0 178.24156,79.805638 178.24156,178.241558"
fill="#80b3ff"
id="path2"
style="fill-rule:evenodd;stroke-width:0.81426" />
<path
d="m 229.93248,353.90605 c -5.21436,-1.87556 -10.666,-4.37258 -12.11375,-5.54877 -1.90342,-1.5458 -2.63348,-1.19102 -2.63348,1.27961 0,1.87996 -0.76245,3.41818 -1.69432,3.41818 -4.05395,0 -21.23102,-12.73259 -28.26867,-20.95417 l -7.67977,-8.97234 -0.66675,8.11614 -0.66672,8.11614 -9.87616,-13.22033 c -18.10915,-24.24215 -25.71922,-55.71738 -21.11214,-87.32126 2.92645,-20.07803 12.76679,-42.4881 24.30974,-55.36074 l 7.55682,-8.42759 0.0876,7.77439 0.0876,7.77439 10.40299,-10.99984 c 12.2652,-12.96872 22.74636,-34.31536 23.84887,-29.59591 0.94169,4.03075 3.27015,16.4562 15.51654,10.92981 14.34401,-6.47223 37.85414,-6.45114 52.25841,0.0468 7.855,3.54366 13.13239,-9.23452 14.33993,-11.18956 2.42658,-3.92636 9.02364,14.79022 23.20886,28.77758 l 12.11375,11.9452 0.0876,-7.73197 0.0876,-7.73197 7.55683,8.42759 c 10.89887,12.15446 21.22043,35.18256 24.03696,53.63044 5.35205,35.04901 -4.02432,69.42952 -25.75749,94.44604 l -6.01201,6.92039 -0.0628,-7.9738 -0.0628,-7.97389 -7.83766,8.75656 c -7.76544,8.67594 -24.72013,21.79204 -28.16852,21.79204 -0.98493,0 -1.79072,-1.4414 -1.79072,-3.20305 0,-2.64391 -1.56314,-2.39645 -8.95361,1.41713 -11.9395,6.16086 -38.59837,7.50895 -52.14359,2.6369 z m 41.69663,-42.30977 c 3.13849,-2.32586 8.7875,-8.24357 12.55345,-13.15112 l 6.84712,-8.92185 v 18.01225 l 6.33201,-8.60999 c 9.14333,-12.43293 12.62918,-24.21202 12.62918,-42.67293 0,-18.92992 -3.98223,-32.3017 -12.63244,-42.41889 l -6.1576,-7.2018 -0.0855,8.2167 -0.0855,8.2167 -6.119,-8.44714 c -18.60911,-25.68828 -48.97857,-24.51249 -65.7849,2.54782 l -3.92547,6.32045 -0.0548,-9.48043 -0.0548,-9.48043 -4.31639,5.26704 c -2.37397,2.8969 -6.80005,10.48116 -9.83545,16.85437 -10.42253,21.8808 -6.49755,57.0886 8.28836,74.35499 l 5.78613,6.75681 0.0855,-8.06427 0.0856,-8.06435 6.84712,8.90312 c 9.70354,12.61696 18.93725,17.16542 32.74303,16.12887 6.76292,-0.50772 13.39295,-2.50027 16.85437,-5.06568 z"
fill="#ffffff"
stroke-width="2.10682"
id="path18" />
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,12 @@
<svg width="500" height="500" version="1.1" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
<g>
<ellipse cx="255.01" cy="246.5" rx="188.48" ry="176.7" fill="#1c7cc7"/>
<ellipse cx="339.28" cy="246.5" rx="91.523" ry="142.27" fill="#3496e3"/>
<ellipse cx="175.27" cy="241.97" rx="91.523" ry="142.27" fill="#3496e3"/>
<circle cx="365.56" cy="65.263" r="18.123" fill="#fb6589"/>
<circle cx="434.43" cy="137.76" r="24.467" fill="#f90641"/>
<ellipse cx="86.462" cy="384.23" rx="18.123" ry="17.217" fill="#4e479e"/>
<circle cx="425.37" cy="382.42" r="22.654" fill="#fffdff"/>
</g>
<path d="m161.8 307.37c-16.706-1.4592-30.184-7.3334-39.663-17.287-10.567-11.096-16.029-26.393-16.72-46.828-0.27552-8.1488 0.5072-13.789 2.9129-20.989 7.7705-23.256 30.138-41.607 57.344-47.046 9.1137-1.822 20.263-2.2037 27.656-0.94695 22.521 3.8288 48.516 19.164 75.333 44.439 2.8369 2.6739 5.2223 4.8616 5.3009 4.8616 0.0786 0 1.4724-1.6563 3.0973-3.6805 4.3219-5.3843 6.5721-7.9023 12.118-13.561 17.303-17.653 33.569-27.429 48.827-29.344 5.2273-0.65596 16.444 0.10014 22.847 1.5401 24.263 5.4566 41.672 20.396 48.642 41.74 2.4966 7.6459 3.3343 13.37 3.3192 22.684-0.0195 12.18-1.9257 21.054-6.5826 30.646-3.2263 6.6451-6.8978 11.715-12.087 16.692-9.4524 9.0649-21.028 14.57-35.094 16.69-5.0152 0.75605-15.466 0.76786-20.28 0.0229-19.682-3.0453-40.556-13.026-62.374-29.827-6.5738-5.0617-14.874-12.226-18.739-16.173-0.90324-0.92249-1.7459-1.6773-1.8727-1.6773-0.12678 0-3.4439 3.2241-7.3714 7.1646-10.516 10.55-18.323 17.025-28.774 23.863-20.357 13.32-38.621 18.692-57.838 17.013zm204.61-19.205c11.636-1.2143 22.213-7.5823 28.537-17.181 4.1451-6.292 6.2692-14.735 5.4515-21.667-1.4931-12.661-10.974-25.469-26.422-35.696-17.277-11.438-37.71-16.513-53.04-13.174-4.0839 0.88938-7.1098 1.9538-11.463 4.0323-8.4303 4.0256-16.03 9.7501-23.766 17.901-2.787 2.9364-5.8288 6.6077-5.8288 7.035 0 1.1846 20.675 22.205 29.038 29.524 20.358 17.815 37.727 27.852 50.554 29.213 3.252 0.3451 3.7543 0.34609 6.9388 0.0138zm-165.93-3.8507c12.79-2.8874 25.74-9.987 39.65-21.737 3.9591-3.3444 9.4096-8.674 9.4096-9.2001 0-0.62418-12.902-13.437-17.427-17.304-22.527-19.261-42.427-29.784-61.443-32.49-4.0364-0.57433-12.197-0.55748-16.436 0.034-6.2925 0.87766-13.132 2.9447-18.188 5.4972-5.7371 2.896-11.606 8.2276-14.28 12.971-4.5558 8.0834-4.9296 18.286-1.0103 27.579 7.6179 18.062 30.762 31.729 59.379 35.064 5.3546 0.62397 16.779 0.39175 20.346-0.41357z" fill="#ffffff" stroke-width=".30046"/>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="512"
viewBox="0 0 512 512"
width="512"
version="1.1"
id="svg24"
sodipodi:docname="question.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata30">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs28" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1021"
id="namedview26"
showgrid="false"
inkscape:zoom="0.32593203"
inkscape:cx="-9.2198689"
inkscape:cy="205.67656"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg24" />
<text
x="729.64"
y="231.36"
id="text4" />
<text
x="1310.91"
y="151.36"
id="text6" />
<text
x="239.33"
y="-29.9"
id="text8" />
<text
x="1337.38"
y="-246.37"
id="text10" />
<text
x="1918.65"
y="-326.37"
id="text12" />
<text
x="1529.53"
y="-798.77"
id="text14" />
<text
x="2110.79"
y="-878.78"
id="text16" />
<text
x="277.99"
y="535.94"
id="text18" />
<g
transform="matrix(0.0395501,0,0,-0.0395501,2.5222797,497.16698)"
id="g6"
style="fill:#f69300;fill-opacity:1;stroke:none">
<path
inkscape:connector-curvature="0"
d="m 4265,12096 c -115,-37 -252,-142 -296,-227 -57,-112 -30,-207 142,-495 154,-259 214,-408 228,-562 14,-158 -6,-275 -99,-582 -59,-198 -74,-285 -66,-405 10,-140 32,-280 68,-420 41,-163 41,-249 2,-312 -16,-25 -46,-60 -67,-77 -36,-28 -45,-31 -110,-31 -62,0 -80,5 -134,34 -134,72 -293,237 -434,450 -135,204 -172,348 -279,1081 -94,646 -106,691 -216,846 -124,175 -299,256 -456,210 -70,-20 -155,-83 -210,-156 -46,-62 -114,-199 -135,-275 -21,-73 -31,-343 -22,-545 10,-205 30,-298 111,-501 143,-363 351,-599 690,-783 275,-149 565,-484 698,-806 77,-186 78,-302 4,-389 -61,-71 -245,-148 -324,-135 -67,11 -233,66 -329,108 -91,40 -169,83 -411,225 -163,95 -225,116 -345,116 -64,0 -113,-5 -135,-14 -131,-55 -190,-158 -170,-299 11,-82 43,-143 113,-219 81,-86 133,-109 267,-118 129,-7 581,-52 669,-66 105,-16 201,-80 242,-160 39,-77 11,-175 -65,-231 -86,-64 -300,-146 -674,-257 C 2106,6976 1930,6947 1390,6910 927,6878 727,6851 603,6805 309,6694 74,6474 23,6261 2,6171 -4,5929 13,5835 c 43,-232 215,-494 383,-583 101,-53 176,-66 369,-66 158,0 176,2 251,27 44,15 109,45 145,68 144,93 219,174 476,519 291,390 446,537 587,556 211,29 306,-265 176,-545 -111,-237 -278,-360 -763,-562 -346,-144 -529,-252 -665,-393 -79,-81 -92,-112 -92,-219 0,-90 29,-173 92,-265 189,-272 398,-284 666,-39 176,163 469,524 657,812 118,181 221,257 346,256 101,0 171,-32 245,-113 86,-93 144,-229 144,-336 0,-37 -16,-150 -35,-251 -45,-236 -46,-283 -2,-347 46,-69 116,-118 214,-150 72,-23 94,-26 166,-22 85,6 161,31 200,66 22,20 68,109 87,167 67,211 224,305 335,201 27,-25 35,-41 35,-67 0,-63 -226,-866 -352,-1249 C 3458,2629 3282,2266 2696,1267 2470,882 2432,783 2423,560 c -8,-193 23,-336 96,-452 22,-34 44,-53 88,-74 52,-26 68,-29 153,-29 116,1 194,20 315,80 163,80 275,191 359,355 92,180 126,332 221,1000 99,699 145,963 226,1312 202,877 490,1538 669,1538 73,0 193,-111 252,-232 49,-99 62,-170 62,-328 -1,-178 -25,-306 -113,-585 -100,-318 -122,-422 -122,-572 0,-199 73,-358 190,-417 71,-36 143,-47 311,-47 284,0 431,63 471,201 19,61 19,429 1,525 -18,93 -83,246 -187,434 -129,234 -130,238 -129,416 1,130 4,161 26,232 66,216 219,351 390,341 64,-3 70,-6 112,-47 81,-79 228,-396 341,-736 160,-479 246,-935 290,-1535 35,-483 59,-653 115,-822 71,-211 211,-428 311,-479 57,-29 131,-25 205,10 156,74 219,197 216,426 -2,183 -35,281 -257,745 -225,470 -269,575 -391,930 -171,495 -217,687 -218,915 -1,130 2,163 24,244 48,182 112,267 220,290 81,18 131,14 188,-15 83,-41 125,-112 197,-334 119,-363 239,-599 383,-752 73,-77 129,-108 194,-108 84,0 217,60 280,127 45,49 52,90 42,263 -5,85 -9,227 -9,315 0,155 1,162 27,212 96,183 436,230 691,96 127,-67 263,-214 326,-355 71,-156 116,-402 161,-873 11,-115 25,-232 31,-260 37,-166 197,-275 405,-275 85,0 179,26 276,77 173,90 220,184 198,398 -35,338 -142,549 -597,1183 -185,258 -222,318 -264,427 -57,146 -48,323 23,459 44,82 184,223 260,260 48,24 69,28 136,27 133,-1 326,-59 537,-161 279,-135 423,-267 534,-488 55,-110 91,-218 151,-463 97,-390 176,-586 333,-824 76,-115 240,-278 322,-321 100,-53 158,-67 246,-62 102,6 182,45 260,125 111,114 162,220 189,393 18,115 25,604 11,761 -14,153 -27,220 -77,374 -78,241 -181,415 -343,576 -159,160 -366,289 -546,341 -70,20 -102,23 -255,23 -156,0 -190,-3 -315,-30 -121,-25 -161,-29 -290,-29 -134,0 -160,3 -240,28 -149,45 -321,135 -404,212 -98,91 -146,185 -145,288 0,131 71,231 271,384 131,99 201,169 232,229 50,99 46,267 -9,380 -36,74 -101,135 -263,251 -133,95 -190,153 -224,230 -21,49 -24,68 -21,142 8,201 108,301 515,512 598,310 1047,438 1542,438 172,0 315,-13 561,-51 232,-36 341,-41 387,-16 65,35 131,140 184,298 30,86 33,104 33,219 0,100 -5,136 -21,182 -63,180 -204,304 -398,352 -350,87 -902,12 -1276,-174 -235,-117 -714,-452 -1214,-850 -374,-298 -501,-365 -739,-389 -207,-21 -402,31 -515,137 -139,131 -134,319 12,447 90,79 192,124 497,220 173,55 344,168 455,302 64,77 138,222 154,301 19,91 13,181 -19,307 -48,191 -77,233 -187,276 -84,32 -171,30 -245,-5 -92,-44 -163,-103 -349,-293 -96,-98 -202,-202 -236,-230 -80,-66 -175,-113 -245,-120 -201,-21 -467,178 -524,389 -20,76 -17,223 6,337 28,140 86,313 221,668 159,417 164,436 163,598 0,112 -3,138 -24,190 -64,167 -184,271 -370,321 -89,24 -319,25 -408,1 -226,-61 -344,-205 -475,-583 -56,-161 -77,-259 -77,-359 0,-106 23,-195 96,-377 35,-86 73,-194 85,-239 19,-73 20,-89 9,-137 -41,-182 -292,-363 -505,-362 -78,1 -118,20 -230,110 -49,40 -108,81 -130,91 -52,23 -203,43 -276,36 -148,-13 -283,-128 -464,-392 -159,-232 -176,-246 -315,-253 -158,-8 -273,39 -318,130 -18,37 -26,75 -34,180 -24,312 -78,537 -174,723 -34,66 -89,173 -123,239 -57,111 -70,145 -94,241 -5,22 -12,294 -16,605 -7,625 -5,610 -71,642 -41,21 -98,22 -155,4 z"
id="path4"
style="fill:#f69300;fill-opacity:1" />
</g>
<path
d="m 242.81877,128.84792 c -24.58476,0 -45.67681,16.66861 -45.67681,38.74703 0,6.12258 1.67651,11.69408 4.83093,15.96812 3.15378,4.27209 8.06168,7.23637 13.58274,7.23637 8.37537,0 15.56193,-6.67495 15.56193,-15.07879 0,-3.86978 -1.50056,-7.69817 -4.08322,-11.17729 -0.0434,-0.0614 -0.0382,-0.0407 -0.0808,-0.10094 -1.94685,-2.74888 -2.97527,-4.32707 -3.25339,-4.91178 -0.28524,-0.59763 -0.24254,-0.31499 -0.24254,-1.73858 0,-2.6674 1.24573,-5.03339 3.84067,-7.05397 2.59366,-2.02059 6.53977,-3.45649 11.21806,-3.45649 5.82764,0 9.74723,1.9598 12.73414,5.74034 2.98821,3.78051 4.95188,9.80544 4.95188,17.92855 0,5.14657 -0.26518,8.14706 -1.79875,12.8551 -1.53356,4.70803 -4.47001,11.14301 -9.82355,21.84945 a 5.2719134,5.2719134 0 0 0 -0.0202,0.0202 c -8.97108,18.18147 -10.81639,26.43848 -11.29891,50.30787 a 5.2719134,5.2719134 0 0 0 5.25523,5.3765 h 4.46678 a 5.2719134,5.2719134 0 0 0 4.08291,-1.09145 5.2719134,5.2719134 0 0 0 0.14148,-0.10106 5.2719134,5.2719134 0 0 0 0.1415,-0.14149 5.2719134,5.2719134 0 0 0 0.24255,-0.22234 5.2719134,5.2719134 0 0 0 0.28296,-0.3234 5.2719134,5.2719134 0 0 0 0.0607,-0.0607 5.2719134,5.2719134 0 0 0 1.15207,-3.94145 5.2719134,5.2719134 0 0 0 0,-0.0405 c 0.32986,-13.53811 3.59101,-22.53246 11.94569,-32.86569 14.24894,-15.6525 14.91514,-16.46035 18.69631,-22.1334 0.006,-0.008 0.0149,-0.0123 0.0201,-0.0201 6.46797,-9.581 9.72136,-19.82756 9.72136,-30.43827 0,-11.94052 -4.97192,-22.50466 -13.36024,-29.79147 -8.38831,-7.28876 -20.02483,-11.339 -33.29064,-11.339 m 0.3234,145.49053 c -10.1586,0 -18.09027,7.9252 -18.09027,17.76686 0,9.84167 7.9252,17.78693 17.76687,17.78693 9.84167,0 17.78693,-7.94526 17.78693,-17.78693 0,-9.52408 -7.93945,-17.76686 -17.46353,-17.76686"
id="path20"
inkscape:connector-curvature="0"
style="fill:#ffffff;stroke-width:0.64679706" />
</svg>

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -0,0 +1,813 @@
#!/usr/bin/env python3
# =================================================================
# = Authors: Brad Heffernan & Erik Dubois =
# =================================================================
import gi
import os
import GUI
import conflicts
# import wnck
import subprocess
import threading
import webbrowser
import shutil
import socket
from time import sleep
from queue import Queue
gi.require_version("Gtk", "3.0")
gi.require_version("Wnck", "3.0")
from gi.repository import Gtk, GdkPixbuf, GLib, Wnck # noqa
REMOTE_SERVER = "www.google.com"
class Main(Gtk.Window):
def __init__(self):
super(Main, self).__init__(title="Snigdha Welcome")
self.set_border_width(10)
self.set_default_size(860, 250)
self.set_icon_from_file(os.path.join(GUI.base_dir, "images/snigdha-purple.png"))
self.set_position(Gtk.WindowPosition.CENTER)
self.results = ""
if not os.path.exists(GUI.home + "/.config/snigdha-welcome/"):
os.mkdir(GUI.home + "/.config/snigdha-welcome/")
with open(GUI.Settings, "w") as f:
f.write("autostart=True")
f.close()
# a queue to store package install progress
self.pkg_queue = Queue()
# default pacman lockfile
self.pacman_lockfile = "/var/lib/pacman/db.lck"
# get the username of the user running the welcome app
self.sudo_username = os.getlogin()
GUI.GUI(self, Gtk, GdkPixbuf)
if GUI.username == GUI.user:
threading.Thread(
target=self.internet_notifier, args=(), daemon=True
).start()
def on_mirror_clicked(self, widget):
threading.Thread(target=self.mirror_update, daemon=True).start()
def on_update_clicked(self, widget):
print("Clicked")
def on_grub_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
bootloader_file = "/etc/calamares/modules/bootloader-grub.conf"
app_cmd = [
"sudo",
"cp",
bootloader_file,
"/etc/calamares/modules/bootloader.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
def on_systemboot_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
bootloader_file = "/etc/calamares/modules/bootloader-systemd.conf"
app_cmd = [
"sudo",
"cp",
bootloader_file,
"/etc/calamares/modules/bootloader.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
def on_ai_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
settings_beginner_file = "/etc/calamares/settings-beginner.conf"
packages_no_sys_update_file = (
"/etc/calamares/modules/packages-no-system-update.conf"
)
clamares_polkit = "/usr/bin/calamares_polkit"
app_cmd = [
"sudo",
"cp",
settings_beginner_file,
"/etc/calamares/settings.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
app_cmd = [
"sudo",
"cp",
packages_no_sys_update_file,
"/etc/calamares/modules/packages.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
subprocess.Popen([clamares_polkit, "-d"], shell=False)
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
def on_aica_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
settings_adv_file = "/etc/calamares/settings-advanced.conf"
system_update_file = "/etc/calamares/modules/packages-system-update.conf"
clamares_polkit = "/usr/bin/calamares_polkit"
app_cmd = [
"sudo",
"cp",
"/etc/calamares/settings-advanced.conf",
"/etc/calamares/settings.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
app_cmd = [
"sudo",
"cp",
system_update_file,
"/etc/calamares/modules/packages.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
subprocess.Popen([clamares_polkit, "-d"], shell=False)
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
def on_gp_clicked(self, widget):
app_cmd = ["/usr/bin/gparted"]
pacman_cmd = [
"sudo",
"pacman",
"-Sy",
"gparted",
"--noconfirm",
"--needed",
]
if not self.check_package_installed("gparted"):
if not os.path.exists(self.pacman_lockfile):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.NONE,
text="%s was not found" % "gparted",
title="Warning",
)
md.add_buttons("Yes", 1)
md.add_buttons("No", 0)
md.format_secondary_markup("Let Snigdha Welcome to install it ?")
response = md.run()
md.destroy()
if response == 1:
threading.Thread(
target=self.check_package_queue, daemon=True
).start()
threading.Thread(
target=self.install_package,
args=(
app_cmd,
pacman_cmd,
"gparted",
),
daemon=True,
).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
else:
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
def on_buttonatt_clicked(self, widget):
app_cmd = [
"sudo",
"-u",
self.sudo_username,
"/usr/bin/archlinux-tweak-tool",
]
pacman_cmd = [
"sudo",
"pacman",
"-Sy",
"archlinux-tweak-tool-git",
"--noconfirm",
"--needed",
]
dev_package = "archlinux-tweak-tool-dev-git"
if self.check_package_installed(dev_package):
print("[WARN]: %s package found ..removing it" % dev_package)
self.remove_dev_package(
["sudo", "pacman", "-Rs", dev_package, "--noconfirm"], dev_package
)
if not self.check_package_installed("archlinux-tweak-tool-git"):
if not os.path.exists(self.pacman_lockfile):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.NONE,
text="%s was not found" % "Arch Linux Tweak Tool",
title="Warning",
)
md.add_buttons("Yes", 1)
md.add_buttons("No", 0)
md.format_secondary_markup("Would you like to install it ?")
response = md.run()
md.destroy()
if response == 1:
threading.Thread(
target=self.check_package_queue, daemon=True
).start()
threading.Thread(
target=self.install_package,
args=(
app_cmd,
pacman_cmd,
"archlinux-tweak-tool-git",
),
daemon=True,
).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
else:
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
def check_package_installed(self, package):
pacman_cmd = ["pacman", "-Qi", package]
try:
process = subprocess.run(
pacman_cmd,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
)
if process.returncode == 0:
# package is installed
return True
else:
return False
except subprocess.CalledProcessError as e:
# package is not installed
return False
def on_buttonarandr_clicked(self, widget):
app_cmd = ["/usr/bin/arandr"]
pacman_cmd = [
"sudo",
"pacman",
"-Sy",
"arandr",
"--noconfirm",
"--needed",
]
if not self.check_package_installed("arandr"):
if not os.path.exists(self.pacman_lockfile):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.NONE,
text="%s was not found\n" % "arandr",
title="Warning",
)
md.add_buttons("Yes", 1)
md.add_buttons("No", 0)
md.format_secondary_markup("Would you like to install it ?")
response = md.run()
md.destroy()
if response == 1:
threading.Thread(
target=self.check_package_queue, daemon=True
).start()
threading.Thread(
target=self.install_package,
args=(
app_cmd,
pacman_cmd,
"arandr",
),
daemon=True,
).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
else:
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
def on_button_sofi_clicked(self, widget):
app_cmd = ["sudo", "-u", self.sudo_username, "/usr/bin/sofirem"]
pacman_cmd = [
"sudo",
"pacman",
"-Sy",
"sofirem-git",
"--noconfirm",
"--needed",
]
dev_package = "sofirem-dev-git"
if self.check_package_installed(dev_package):
print("[WARN]: %s package found ..removing it" % dev_package)
self.remove_dev_package(
["sudo", "pacman", "-Rs", dev_package, "--noconfirm"], dev_package
)
if not self.check_package_installed("sofirem-git"):
if not os.path.exists(self.pacman_lockfile):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.NONE,
text="%s Is in development!" % "Snigdha App Installer",
title="Snigdha OS Warning",
)
# md.add_buttons("Yes", 1)
md.add_buttons("Okay", 0)
md.format_secondary_markup("Thank You For Your Interest!\nEshan will apply it on next update!")
response = md.run()
md.destroy()
if response == 1:
threading.Thread(
target=self.check_package_queue, daemon=True
).start()
threading.Thread(
target=self.install_package,
args=(
app_cmd,
pacman_cmd,
"sofirem-git",
),
daemon=True,
).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
else:
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
def check_package_queue(self):
while True:
items = self.pkg_queue.get()
if items is not None:
status, app_cmd, package = items
try:
if status == 0:
print("[INFO]: Launching application")
self.run_app(app_cmd)
if status == 1:
print("[ERROR]: Package %s install failed" % package)
break
sleep(0.2)
except Exception as e:
print("[ERROR]: Exception in check_package_queue(): %s" % e)
finally:
self.pkg_queue.task_done()
def remove_dev_package(self, pacman_cmd, package):
try:
with subprocess.Popen(
pacman_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
bufsize=1,
universal_newlines=True,
) as process:
while True:
if process.poll() is not None:
break
for line in process.stdout:
print(line.strip())
if not self.check_package_installed(package):
print("[INFO]: Pacman %s uninstall completed" % package)
else:
print("[ERROR]: Pacman %s uninstall failed" % package)
except Exception as e:
print("[ERROR]: Exception in remove_dev_package(): %s" % e)
def install_package(self, app_cmd, pacman_cmd, package):
try:
with subprocess.Popen(
pacman_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
bufsize=1,
universal_newlines=True,
) as process:
while True:
if process.poll() is not None:
break
for line in process.stdout:
print(line.strip())
if self.check_package_installed(package):
self.pkg_queue.put((0, app_cmd, package))
print("[INFO]: Pacman package install completed")
else:
self.pkg_queue.put((1, app_cmd, package))
print("[ERROR]: Pacman package install failed")
except Exception as e:
print("[ERROR]: Exception in install_package(): %s" % e)
finally:
self.pkg_queue.put(None)
def run_app(self, app_cmd):
process = subprocess.run(
app_cmd,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
)
# for debugging print stdout to console
if GUI.DEBUG is True:
print(process.stdout)
def statup_toggle(self, widget):
if widget.get_active() is True:
if os.path.isfile(GUI.dot_desktop):
shutil.copy(GUI.dot_desktop, GUI.autostart)
else:
if os.path.isfile(GUI.autostart):
os.unlink(GUI.autostart)
self.save_settings(widget.get_active())
def save_settings(self, state):
with open(GUI.Settings, "w") as f:
f.write("autostart=" + str(state))
f.close()
def load_settings(self):
line = "True"
if os.path.isfile(GUI.Settings):
with open(GUI.Settings, "r") as f:
lines = f.readlines()
for i in range(len(lines)):
if "autostart" in lines[i]:
line = lines[i].split("=")[1].strip().capitalize()
f.close()
return line
def on_link_clicked(self, widget, link):
t = threading.Thread(target=self.weblink, args=(link,))
t.daemon = True
t.start()
def on_social_clicked(self, widget, event, link):
t = threading.Thread(target=self.weblink, args=(link,))
t.daemon = True
t.start()
def on_info_clicked(self, widget, event):
window_list = Wnck.Screen.get_default().get_windows()
state = False
for win in window_list:
if "Information" in win.get_name():
state = True
if not state:
w = conflicts.Conflicts()
w.show_all()
def weblink(self, link):
webbrowser.open_new_tab(link)
def is_connected(self):
try:
host = socket.gethostbyname(REMOTE_SERVER)
s = socket.create_connection((host, 80), 2)
s.close()
return True
except: # noqa
pass
return False
def tooltip_callback(self, widget, x, y, keyboard_mode, tooltip, text):
tooltip.set_text(text)
return True
def on_launch_clicked(self, widget, event, link):
if os.path.isfile("/usr/bin/archlinux-tweak-tool"):
self.app_cmd = "/usr/bin/archlinux-tweak-tool"
threading.Thread(target=self.run_app, daemon=True).start()
else:
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.INFO,
buttons=Gtk.ButtonsType.YES_NO,
text="Not Found!",
)
md.format_secondary_markup(
"<b>ArcoLinux Tweak Tool</b> was not found on your system\n\
Do you want to install it?"
)
result = md.run()
md.destroy()
if result in (Gtk.ResponseType.OK, Gtk.ResponseType.YES):
t1 = threading.Thread(target=self.installATT, args=())
t1.daemon = True
t1.start()
def internet_notifier(self):
bb = 0
dis = 0
while True:
if not self.is_connected():
dis = 1
GLib.idle_add(self.button8.set_sensitive, False)
GLib.idle_add(
self.cc.set_markup,
"<span foreground='red'><b>No Internet! 😐</b> \nInstaller will <b>not</b> install additional application! ♨️</span>",
) # noqa
else:
if bb == 0 and dis == 1:
GLib.idle_add(self.button8.set_sensitive, True)
GLib.idle_add(self.cc.set_text, "")
bb = 1
sleep(3)
# def mirror_reload(self):
# md = Gtk.MessageDialog(parent=self,
# flags=0,
# message_type=Gtk.MessageType.INFO,
# buttons=Gtk.ButtonsType.YES_NO,
# text="You are now connected")
# md.format_secondary_markup("Would you like to update the <b>Arch Linux</b> mirrorlist?")
# response = md.run()
# if response == Gtk.ResponseType.YES:
# GLib.idle_add(self.cc.set_markup, "<span foreground='orange'><b><i>Updating your mirrorlist</i></b> \nThis may take some time, please wait...</span>") # noqa
# t = threading.Thread(target=self.mirror_update)
# t.daemon = True
# t.start()
# md.destroy()
def mirror_update(self):
# GLib.idle_add(
# self.cc.set_markup,
# "<span foreground='orange'><b><i>Updating your mirrorlist</i></b> \nThis may take some time, please wait...</span>",
# ) # noqa
# GLib.idle_add(self.button8.set_sensitive, False)
# subprocess.run(
# [
# "pkexec",
# "/usr/bin/reflector",
# "--age",
# "6",
# "--latest",
# "21",
# "--fastest",
# "21",
# "--threads",
# "21",
# "--sort",
# "rate",
# "--protocol",
# "https",
# "--save",
# "/etc/pacman.d/mirrorlist",
# ],
# shell=False,
# )
GLib.idle_add(self.cc.set_markup, "<span foreground='cyan'><b>Updating Arch Linux Mirrorlist Via Rate-Mirrors</b> \nThis will take time, please wait...</span>")
subprocess.run(["pkexec", "/usr/bin/rate-mirrors", "--concurrency", "40", "--disable-comments", "--allow-root", "--save", "/etc/pacman.d/mirrorlist", "arch"], shell=False)
GLib.idle_add(self.cc.set_markup, "<span foreground='cyan'><b>Updating Chaotic AUR mirrorlist</b> \nThis may take some time, please wait...</span>") # noqa
subprocess.run(["pkexec", "/usr/bin/rate-mirrors", "--concurrency", "40", "--disable-comments", "--allow-root", "--save", "/etc/pacman.d/chaotic-mirrorlist", "chaotic-aur"], shell=False)
print("FINISHED!!!")
GLib.idle_add(self.cc.set_markup, "<b>Update Completed! 🔥</b>")
GLib.idle_add(self.button8.set_sensitive, True)
# def btrfs_update(self):
# if GUI.DEBUG:
# path = "/home/bheffernan/Repos/GITS/XFCE/hefftor-calamares-oem-config/calamares/modules/partition.conf"
# else:
# path = "/etc/calamares/modules/partition.conf"
# with open(path, "r") as f:
# lines = f.readlines()
# f.close()
# data = [x for x in lines if "defaultFileSystemType" in x]
# pos = lines.index(data[0])
# lines[pos] = "defaultFileSystemType: \"ext4\"\n"
# with open(path, "w") as f:
# f.writelines(lines)
# f.close()
# GLib.idle_add(self.MessageBox,"Success", "Your filesystem has been changed.")
# def finished_mirrors(self):
# md = Gtk.MessageDialog(parent=self,
# flags=0,
# message_type=Gtk.MessageType.INFO,
# buttons=Gtk.ButtonsType.OK,
# text="Finished")
# md.format_secondary_markup("Mirrorlist has been updated!")
# md.run()
# md.destroy()
# GLib.idle_add(self.cc.set_markup, "")
# GLib.idle_add(self.button8.set_sensitive, True)
def MessageBox(self, title, message):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.INFO,
buttons=Gtk.ButtonsType.OK,
text=title,
)
md.format_secondary_markup(message)
md.run()
md.destroy()
def installATT(self):
subprocess.call(
[
"pkexec",
"/usr/bin/pacman",
"-S",
"archlinux-tweak-tool-git",
"--noconfirm",
],
shell=False,
)
GLib.idle_add(
self.MessageBox,
"Success!",
"<b>ArcoLinux Tweak Tool</b> has been installed successfully",
) # noqa
# def get_message(self, title, message):
# t = threading.Thread(target=self.fetch_notice,
# args=(title, message,))
# t.daemon = True
# t.start()
# t.join()
# def fetch_notice(self, title, message):
# try:
# url = 'https://bradheff.github.io/notice/notice'
# req = requests.get(url, verify=True, timeout=1)
# if req.status_code == requests.codes.ok:
# if not len(req.text) <= 1:
# title.set_markup(
# "<big><b><u>Notice</u></b></big>")
# message.set_markup(req.text)
# self.results = True
# else:
# self.results = False
# else:
# self.results = False
# except:
# self.results = False
if __name__ == "__main__":
w = Main()
w.connect("delete-event", Gtk.main_quit)
w.show_all()
Gtk.main()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,711 +0,0 @@
# Author: Erik Dubois [Arcolinux]
# Adopted for Snigdha OS
#!/usr/bin/env python3
import gi
import os
import conflicts
# import sys
# import wnck
import subprocess
import threading
import shutil
import socket
from time import sleep
from queue import Queue
import ui.GUI as GUI
from ui.MessageDialog import MessageDialogBootloader
from ui.MessageDialog import MessageDialog
gi.require_version("Gtk", "3.0")
# gi.require_version("Wnck", "3.0")
from gi.repository import Gtk, GdkPixbuf, GLib, Gdk # Wnck
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__)))
REMOTE_SERVER = "www.google.com"
css = """
box#stack_box{
padding: 10px 10px 10px 10px;
}
button#button_grub_boot_enabled{
font-weight: bold;
background-color: @theme_base_color_button;
}
button#button_systemd_boot_enabled{
font-weight: bold;
background-color: @theme_base_color_button;
}
button#button_easy_install_enabled{
font-weight: bold;
background-color: @theme_base_color_button;
}
button#button_adv_install_enabled{
font-weight: bold;
background-color: @theme_base_color_button;
}
label#label_style {
background-color: @theme_base_color;
border-top: 1px solid @borders;
border-bottom: 1px solid @borders;
border-left: 1px solid @borders;
border-right: 1px solid @borders;
padding: 10px 10px 10px 10px;
border-radius: 0px;
font-size: 16px;
font-weight: bold;
color: pink;
}
label#label_style_eshan {
background-color: @theme_base_color;
border-top: 1px solid @borders;
border-bottom: 1px solid @borders;
border-left: 1px solid @borders;
border-right: 1px solid @borders;
padding: 10px 10px 10px 10px;
border-radius: 0px;
font-size: 16px;
font-weight: normal;
color: #F8C8DC;
}
"""
class Main(Gtk.Window):
def __init__(self):
super(Main, self).__init__(title="Snigdha OS Welcome")
self.set_border_width(10)
self.set_default_size(860, 450)
self.set_icon_from_file(os.path.join(base_dir, "images/snigdhaos-welcome.png"))
self.set_position(Gtk.WindowPosition.CENTER)
self.results = ""
if not os.path.exists(GUI.home + "/.config/snigdhaos-welcome/"):
os.mkdir(GUI.home + "/.config/snigdhaos-welcome/")
with open(GUI.Settings, "w") as f:
f.write("autostart=True")
f.close()
self.style_provider = Gtk.CssProvider()
self.style_provider.load_from_data(css, len(css))
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
self.style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION,
)
# a queue to store package install progress
self.pkg_queue = Queue()
# default pacman lockfile
self.pacman_lockfile = "/var/lib/pacman/db.lck"
# get the username of the user running the welcome app
self.sudo_username = os.getlogin()
self.calamares_polkit = "/usr/bin/calamares_polkit"
self.session = None
self.get_session()
GUI.GUI(self, Gtk, GdkPixbuf)
if GUI.username == GUI.user:
threading.Thread(target=self.internet_notifier, args=(), daemon=True).start()
# returns the login session
def get_session(self):
try:
self.session = os.environ.get("XDG_SESSION_TYPE")
except Exception as e:
print("Exception in get_session(): %s" % e)
def on_settings_clicked(self, widget):
self.toggle_popover()
def toggle_popover(self):
if self.popover.get_visible():
self.popover.hide()
else:
self.popover.show_all()
# check if path exists
# used to check if /sys/firmware/efi/fw_platform_size exists
# if yes then display systemd-boot bootloader install option
def file_check(self, path):
if os.path.isfile(path):
return True
return False
def on_mirror_clicked(self, widget):
threading.Thread(target=self.mirror_update, daemon=True).start()
def on_update_clicked(self, widget):
print("Clicked")
def convert_to_hex(self, rgba_color):
red = int(rgba_color.red * 255)
green = int(rgba_color.green * 255)
blue = int(rgba_color.blue * 255)
return "#{r:02x}{g:02x}{b:02x}".format(r=red, g=green, b=blue)
# offline install option
def on_easy_install_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
widget.set_name("button_easy_install_enabled")
widget.get_child().set_markup(
"<span size='large'>Offline Installation</span>"
)
# DEPRECATED NOTICE: get_style_context deprecated in gtk 4.10 and will be removed in gtk 5.0
selected_bg_color = widget.get_style_context().lookup_color(
"theme_selected_bg_color"
)
if selected_bg_color[0] is True:
theme_bg_hex_color = self.convert_to_hex(selected_bg_color[1])
custom_css = css.replace("@theme_base_color_button", theme_bg_hex_color)
self.style_provider.load_from_data(custom_css, len(custom_css))
self.button_adv_install.set_name("button_adv_install")
settings_beginner_file = "/etc/calamares/settings-beginner.conf"
packages_no_sys_update_file = (
"/etc/calamares/modules/packages-no-system-update.conf"
)
app_cmd = [
"sudo",
"cp",
settings_beginner_file,
"/etc/calamares/settings.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
app_cmd = [
"sudo",
"cp",
packages_no_sys_update_file,
"/etc/calamares/modules/packages.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
efi_file_check = self.file_check("/sys/firmware/efi/fw_platform_size")
if efi_file_check is True:
md = MessageDialogBootloader(
title="Choose Bootloader",
install_method="Offline Installation",
pacman_lockfile=self.pacman_lockfile,
run_app=self.run_app,
calamares_polkit=self.calamares_polkit,
)
md.show_all()
else:
subprocess.Popen([self.calamares_polkit, "-d"], shell=False)
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
# online install option
def on_adv_install_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
widget.set_name("button_adv_install_enabled")
widget.get_child().set_markup(
"<span size='large'>Online Installation</span>"
)
# DEPRECATED NOTICE: get_style_context deprecated in gtk 4.10 and will be removed in gtk 5.0
selected_bg_color = widget.get_style_context().lookup_color(
"theme_selected_bg_color"
)
if selected_bg_color[0] is True:
theme_bg_hex_color = self.convert_to_hex(selected_bg_color[1])
custom_css = css.replace("@theme_base_color_button", theme_bg_hex_color)
self.style_provider.load_from_data(custom_css, len(custom_css))
self.button_easy_install.set_name("button_easy_install")
settings_adv_file = "/etc/calamares/settings-advanced.conf"
system_update_file = "/etc/calamares/modules/packages-system-update.conf"
app_cmd = [
"sudo",
"cp",
settings_adv_file,
"/etc/calamares/settings.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
app_cmd = [
"sudo",
"cp",
system_update_file,
"/etc/calamares/modules/packages.conf",
]
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
efi_file_check = self.file_check("/sys/firmware/efi/fw_platform_size")
if efi_file_check is True:
md = MessageDialogBootloader(
title="Choose Bootloader",
install_method="Online Installation",
pacman_lockfile=self.pacman_lockfile,
run_app=self.run_app,
calamares_polkit=self.calamares_polkit,
)
md.show_all()
else:
subprocess.Popen([self.calamares_polkit, "-d"], shell=False)
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
def on_gp_clicked(self, widget):
app_cmd = ["/usr/bin/gparted"]
pacman_cmd = [
"pkexec",
"pacman",
"-Sy",
"gparted",
"--noconfirm",
"--needed",
]
if not self.check_package_installed("gparted"):
if not os.path.exists(self.pacman_lockfile):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.NONE,
text="%s was not found 😐" % "GParted",
title="Package Not Found ❌",
)
md.add_buttons("Yes", 1)
md.add_buttons("No", 0)
md.format_secondary_markup("Do you want to install the package now❔")
response = md.run()
md.destroy()
if response == 1:
threading.Thread(
target=self.check_package_queue, daemon=True
).start()
threading.Thread(
target=self.install_package,
args=(
app_cmd,
pacman_cmd,
"gparted",
),
daemon=True,
).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
else:
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
def on_buttonarandr_clicked(self, widget):
app_cmd = ["/usr/bin/arandr"]
pacman_cmd = [
"pkexec",
"pacman",
"-Sy",
"arandr",
"--noconfirm",
"--needed",
]
if not self.check_package_installed("arandr"):
if not os.path.exists(self.pacman_lockfile):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.NONE,
text="%s was not found 😐\n" % "Arandr",
title="Package Not Found ❌",
)
md.add_buttons("Yes", 1)
md.add_buttons("No", 0)
md.format_secondary_markup("Do you want to install the package now ❔")
response = md.run()
md.destroy()
if response == 1:
threading.Thread(
target=self.check_package_queue, daemon=True
).start()
threading.Thread(
target=self.install_package,
args=(
app_cmd,
pacman_cmd,
"arandr",
),
daemon=True,
).start()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.WARNING,
buttons=Gtk.ButtonsType.OK,
text="Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile,
title="Warning",
)
md.run()
md.destroy()
else:
threading.Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
def remove_dev_package(self, pacman_cmd, package):
try:
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.show,
)
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='orange'><b>Removing dev package %s</b></span>"
% package,
)
GLib.idle_add(
self.label_notify.hide,
)
with subprocess.Popen(
pacman_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
bufsize=1,
universal_newlines=True,
) as process:
while True:
if process.poll() is not None:
break
for line in process.stdout:
print(line.strip())
if not self.check_package_installed(package):
print("[INFO]: Pacman %s uninstall completed" % package)
GLib.idle_add(
self.label_notify.show,
)
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='orange'><b>Dev package %s removed</b></span>"
% package,
)
GLib.idle_add(
self.label_notify.hide,
)
else:
print("[ERROR]: Pacman %s uninstall failed" % package)
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.show,
)
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='red'><b>Failed to remove dev package %s</b></span>"
% package,
)
except Exception as e:
print("[ERROR]: Exception in remove_dev_package(): %s" % e)
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.show,
)
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='red'><b>Failed to remove dev package %s</b></span>"
% package,
)
def install_package(self, app_cmd, pacman_cmd, package):
try:
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='cyan'><b>Installing %s</b></span>" % package,
)
with subprocess.Popen(
pacman_cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
bufsize=1,
universal_newlines=True,
) as process:
while True:
if process.poll() is not None:
break
for line in process.stdout:
print(line.strip())
if self.check_package_installed(package):
self.pkg_queue.put((0, app_cmd, package))
print("[INFO]: Pacman package install completed")
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.show,
)
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='purple'><b>Package %s installed</b></span>"
% package,
)
GLib.idle_add(
self.label_notify.hide,
)
else:
self.pkg_queue.put((1, app_cmd, package))
print("[ERROR]: Pacman package install failed")
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.show,
)
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='orange'><b>Package %s install failed</b></span>"
% package,
)
except Exception as e:
print("[ERROR]: Exception in install_package(): %s" % e)
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.show,
)
GLib.idle_add(
self.label_notify.set_markup,
"<span foreground='red'><b>Package install failed</b></span>",
)
finally:
self.pkg_queue.put(None)
def run_app(self, app_cmd):
process = subprocess.run(
app_cmd,
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
)
# for debugging print stdout to console
if GUI.debug is True:
print(process.stdout)
def startup_toggle(self, widget):
if widget.get_active() is True:
if os.path.isfile(GUI.dot_desktop):
shutil.copy(GUI.dot_desktop, GUI.autostart)
else:
if os.path.isfile(GUI.autostart):
os.unlink(GUI.autostart)
self.save_settings(widget.get_active())
def save_settings(self, state):
with open(GUI.Settings, "w") as f:
f.write("autostart=" + str(state))
f.close()
def load_settings(self):
line = "True"
if os.path.isfile(GUI.Settings):
with open(GUI.Settings, "r") as f:
lines = f.readlines()
for i in range(len(lines)):
if "autostart" in lines[i]:
line = lines[i].split("=")[1].strip().capitalize()
f.close()
return line
def on_link_clicked(self, widget, link):
t = threading.Thread(target=self.weblink, args=(link,))
t.daemon = True
t.start()
def on_social_clicked(self, widget, event, link):
t = threading.Thread(target=self.weblink, args=(link,))
t.daemon = True
t.start()
def _on_info_clicked(self, widget, event):
window_list = Wnck.Screen.get_default().get_windows()
state = False
for win in window_list:
if "Information" in win.get_name():
state = True
if not state:
w = conflicts.Conflicts()
w.show_all()
def weblink(self, link):
# webbrowser.open_new_tab(link)
try:
# use xdg-open to use the default browser to open the weblink
subprocess.Popen(
["xdg-open", link],
shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
except Exception as e:
print("Exception in opening weblink(): %s" % e)
def is_connected(self):
try:
host = socket.gethostbyname(REMOTE_SERVER)
s = socket.create_connection((host, 80), 2)
s.close()
return True
except: # noqa
pass
return False
def tooltip_callback(self, widget, x, y, keyboard_mode, tooltip, text):
tooltip.set_text(text)
return True
def internet_notifier(self):
bb = 0
dis = 0
while True:
if not self.is_connected():
dis = 1
GLib.idle_add(self.button_mirrors.set_sensitive, False)
self.label_notify.set_name("label_style")
GLib.idle_add(
self.label_notify.set_markup,
f"<span foreground='yellow'><b>No internet!</b>\n"
f"Snigdha OS will <b>not</b> install any additional packages!</span>",
) # noqa
else:
self.label_notify.set_name("")
if bb == 0 and dis == 1:
GLib.idle_add(self.button_mirrors.set_sensitive, True)
GLib.idle_add(self.label_notify.set_text, "")
bb = 1
sleep(3)
def check_package_installed(self, package):
try:
subprocess.check_output("pacman -Qi " + package, shell=True, stderr=subprocess.STDOUT)
return True
except subprocess.CalledProcessError:
return False
def mirror_update(self):
GLib.idle_add(
self.label_notify.set_markup,
f"<span foreground='#F8C8DC'>Updating Arch Mirrorlist\n"
f"This may take some time, please wait...</span>",
) # noqa
GLib.idle_add(self.button_mirrors.set_sensitive, False)
subprocess.run(
[
"pkexec",
"/usr/bin/rate-mirrors",
"--concurrency",
"40",
"--disable-comments",
"--allow-root",
"--save",
"/etc/pacman.d/mirrorlist",
"arch",
],
shell=False,
)
print("Update mirrors completed")
GLib.idle_add(
self.label_notify.set_markup,
f"<span foreground='#F8C8DC'>Updating Chaotic Aur Mirrorlist\n"
f"This may take some time, please wait...</span>",
) # noqa
GLib.idle_add(self.button_mirrors.set_sensitive, False)
subprocess.run(
[
"pkexec",
"/usr/bin/rate-mirrors",
"--concurrency",
"40",
"--disable-comments",
"--allow-root",
"--save",
"/etc/pacman.d/chaotic-mirrorlist",
"chaotic-aur",
],
shell=False,
)
print("Update mirrors completed")
# GLib.idle_add(self.label_notify.set_markup, "<b>Mirrorlist updated</b>")
GLib.idle_add(self.label_notify.set_markup, "<span foreground='#C3D7DB'><b>Mirrorlist Updated </b></span>")
GLib.idle_add(self.button_mirrors.set_sensitive, True)
def MessageBox(self, title, message):
md = Gtk.MessageDialog(
parent=self,
flags=0,
message_type=Gtk.MessageType.INFO,
buttons=Gtk.ButtonsType.OK,
text=title,
)
md.format_secondary_markup(message)
md.run()
md.destroy()
if __name__ == "__main__":
w = Main()
w.connect("delete-event", Gtk.main_quit)
w.show_all()
Gtk.main()

View File

@@ -1 +0,0 @@
snigdhaos-welcome.png

View File

@@ -1,504 +0,0 @@
# Author: Erik Dubois [Arcolinux]
# Adopted for Snigdha OS
import os
import getpass
from os.path import expanduser
from ui.Stack import Stack
from ui.StackSwitcher import StackSwitcher
debug = False
# debug = True
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
home = expanduser("~")
username = getpass.getuser()
app_discord = "#"
app_website = "https://snigdhaos.org/"
app_forums = "https://forum.snigdhaos.org/"
app_facebook = "https://facebook.com/snigdhalinux/"
app_twitter = "https://twitter.com/snigdhaos/"
if debug:
user = username
else:
user = "eshan"
Settings = home + "/.config/snigdhaos-welcome/settings.conf"
Skel_Settings = "/etc/skel/.config/snigdhaos-welcome/settings.conf"
dot_desktop = "/usr/share/applications/snigdhaos-welcome.desktop"
autostart = home + "/.config/autostart/snigdhaos-welcome.desktop"
def GUI(self, Gtk, GdkPixbuf):
# initialize main vbox
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
self.vbox.set_halign(Gtk.Align.CENTER)
self.add(self.vbox)
headerbar = Gtk.HeaderBar()
headerbar.set_title("Snigdha OS Welcome")
headerbar.set_show_close_button(True)
self.set_titlebar(headerbar)
# x11 shows icon inside headerbar twice, only set icon when on wayland
if self.session is not None:
if self.session == "wayland":
headerbar.pack_start(
Gtk.Image().new_from_pixbuf(
GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/snigdhaos-welcome.png"), 16, 16
)
)
)
# initialize the stack
stack = Stack(transition_type="CROSSFADE")
# initialize the stack-switcher
stack_switcher = StackSwitcher(stack)
vbox_stack_sidebar = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=25)
vbox_stack_sidebar.set_name("stack_box")
vbox_stack_sidebar.add(stack_switcher)
vbox_stack_sidebar.add(stack)
self.vbox.add(vbox_stack_sidebar)
# vbox to contain all the installation controls
vbox_install_stack = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
vbox_install_stack.set_halign(Gtk.Align.CENTER)
hbox_install_buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox_install_buttons.set_halign(Gtk.Align.CENTER)
vbox_quit = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
vbox_quit.set_halign(Gtk.Align.CENTER)
hbox_util_buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox_util_buttons.set_halign(Gtk.Align.CENTER)
vbox_welcome_title = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20)
vbox_welcome_title.set_halign(Gtk.Align.CENTER)
vbox_welcome_message = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
vbox_welcome_message.set_halign(Gtk.Align.CENTER)
vbox_install_stack.pack_start(vbox_welcome_title, False, False, 0)
vbox_install_stack.pack_start(vbox_welcome_message, False, False, 0)
vbox_install_stack.pack_start(hbox_install_buttons, False, False, 0)
# vbox_install_stack.pack_start(hbox_second_row_buttons, False, False, 0)
vbox_install_stack.pack_start(hbox_util_buttons, False, False, 0)
vbox_install_stack.pack_start(vbox_quit, False, False, 0)
# vbox to contain all the information text
vbox_info_stack = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=15)
vbox_info_stack.set_halign(Gtk.Align.CENTER)
vbox_info = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=15)
vbox_info_stack.pack_start(vbox_info, False, False, 0)
# vbox to contain credits text
vbox_credits_stack = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=15)
vbox_credits_stack.set_halign(Gtk.Align.CENTER)
vbox_credits = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=15)
vbox_credits_stack.pack_start(vbox_credits, False, False, 0)
hbox_social_links = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=15)
hbox_social_links.set_halign(Gtk.Align.CENTER)
# social links with images
hbox_social_img = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=25)
hbox_social_img.set_halign(Gtk.Align.CENTER)
label_discord = Gtk.Label(xalign=0, yalign=0)
label_discord.set_markup(
"<a href='%s' title='%s'>%s</a>" % (app_discord, app_discord, "Discord")
)
label_telegram = Gtk.Label(xalign=0, yalign=0)
label_telegram.set_markup(
"<a href='%s' title='%s'>%s</a>" % (app_facebook, app_facebook, "Facebook")
)
label_youtube = Gtk.Label(xalign=0, yalign=0)
label_youtube.set_markup(
"<a href='%s' title='%s'>%s</a>" % (app_twitter, app_twitter, "Twitter")
)
label_forums = Gtk.Label(xalign=0, yalign=0)
label_forums.set_markup(
"<a href='%s' title='%s'>%s</a>" % (app_forums, app_forums, "Forums")
)
# ======================================================================
# SOCIAL LINKS
# ======================================================================
# facebook
fb_event = Gtk.EventBox()
pbfb = GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/facebook.png"), 64, 64
)
fbimage = Gtk.Image().new_from_pixbuf(pbfb)
fb_event.add(fbimage)
fb_event.connect(
"button_press_event",
self.on_social_clicked,
"https://www.facebook.com/snigdhalinux/",
)
# twitter
tw_event = Gtk.EventBox()
pbtw = GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/twitter.png"), 64, 64
)
twimage = Gtk.Image().new_from_pixbuf(pbtw)
tw_event.add(twimage)
tw_event.connect(
"button_press_event",
self.on_social_clicked,
"https://twitter.com/snigdhaos",
)
# mewe
mew_event = Gtk.EventBox()
pbmew = GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/github.png"), 64, 64
)
mewimage = Gtk.Image().new_from_pixbuf(pbmew)
mew_event.add(mewimage)
mew_event.connect(
"button_press_event",
self.on_social_clicked,
"https://github.com/snigdhalinux",
)
label_social_padding = Gtk.Label(xalign=0, yalign=0)
label_social_padding.set_text(" ")
# tooltips
fb_event.set_property("has-tooltip", True)
tw_event.set_property("has-tooltip", True)
mew_event.set_property("has-tooltip", True)
fb_event.connect("query-tooltip", self.tooltip_callback, "Facebook")
tw_event.connect("query-tooltip", self.tooltip_callback, "Twitter")
mew_event.connect("query-tooltip", self.tooltip_callback, "Github")
hbox_social_img.add(fb_event)
hbox_social_img.add(tw_event)
hbox_social_img.add(mew_event)
label_info_header1 = Gtk.Label(xalign=0, yalign=0)
label_info_header1.set_name("label_style")
label_info_header1.set_justify(Gtk.Justification.CENTER)
label_info_header1.set_halign(Gtk.Align.CENTER)
label_info_header2 = Gtk.Label(xalign=0.5, yalign=0.5)
label_info_header2.set_name("label_style")
label_info_header2.set_justify(Gtk.Justification.CENTER)
label_info_header2.set_halign(Gtk.Align.CENTER)
label_info_header2.set_markup("<b>You have the freedom of choice</b>")
label_info2 = Gtk.Label(xalign=0.5, yalign=0.5)
label_info2.set_justify(Gtk.Justification.CENTER)
if debug is True:
label_info_header1.set_markup("<b>Snigdha OS - Arctic Installer</b>")
desc = (
f"Clean You Computer With GParted before installing Snigdha OS.\n"
f"During the <b>Online Installation</b> many options will be open to you.\n\n"
f"<b>Offline Installation</b> does not require internet connection.\n"
f"<b>Online installation</b> (Recommended) requires a working internet connection"
)
desc2 = (
f"Welcome to A Blazing Fast and Optimized Operating System.\n"
f"Snigdha OS\n"
f"Follow our facebook Page to get update about latest news and upcoming features.\n"
f"Also you can follow us on github and suggest more features.\n"
f"Get Registered for beta testing[Beta Image may be unstable.]\n\n"
)
label_info2.set_markup(desc2)
else:
label_info_header1.set_markup("<b>Welcome to Snigdha OS - Arctic</b>")
desc = (
f"Welcome to A Blazing Fast and Optimized Operating System.\n"
f"Snigdha OS\n"
f"Follow our facebook Page to get update about latest news and upcoming features.\n"
f"Also you can follow us on github and suggest more features.\n"
f"Get Registered for beta testing[Beta Image may be unstable.]\n\n"
)
label_info = Gtk.Label(xalign=0, yalign=0)
label_info.set_markup(desc)
label_info.set_justify(Gtk.Justification.CENTER)
# ======================================================================
# PACK THE INFO BOX
# ======================================================================
vbox_info.pack_start(label_info_header1, False, False, 0)
vbox_info.pack_start(label_info, False, False, 0)
if len(label_info2.get_text()) > 0:
vbox_info.pack_start(label_info_header2, False, False, 0)
vbox_info.pack_start(label_info2, False, False, 0)
vbox_info.pack_start(hbox_social_links, False, False, 0)
vbox_info.pack_start(hbox_social_img, False, False, 0)
# ======================================================================
# ADD PAGES TO STACK
# ======================================================================
if debug is True:
stack.add_titled(vbox_install_stack, "Installation", "Installation")
else:
stack.add_titled(vbox_install_stack, "Welcome", "Welcome")
# stack.add_titled(vbox_info_stack, "Information", "Information")
# stack.add_titled(vbox_credits_stack, "Developers", "Developers")
autostart = eval(self.load_settings())
hbox_notify = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox_notify.set_halign(Gtk.Align.CENTER)
hbox_footer_buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
# ======================================================================
# NOTIFY LABEL
# ======================================================================
self.label_notify = Gtk.Label(xalign=0.5, yalign=0.5)
self.label_notify.set_justify(Gtk.Justification.CENTER)
hbox_notify.pack_end(self.label_notify, False, False, 0)
# ======================================================================
# WELCOME LABEL
# ======================================================================
# label_welcome = Gtk.Label(xalign=0.5, yalign=0.5)
# label_welcome.set_markup("<big>Welcome to <b>ArcoLinux</b></big>")
# ======================================================================
# ARCO IMAGE
# ======================================================================
pixbuf = GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/snigdhaos-welcome.png"), 300, 300
)
image = Gtk.Image().new_from_pixbuf(pixbuf)
# ======================================================================
# WELCOME LABEL
# ======================================================================
label_welcome_message = Gtk.Label(xalign=0, yalign=0)
label_welcome_message.set_name("label_style_eshan")
if username == user:
label_welcome_message.set_text(
"Use Offline Installation in case Online Installation fails!"
)
else:
label_welcome_message.set_text(
"The options below will help you get started on Snigdha OS\nIf You are having any problem, just raise your issue in our forum!\n"
)
vbox_welcome_title.pack_start(image, True, False, 0)
vbox_welcome_message.pack_start(label_welcome_message, True, False, 0)
# ======================================================================
# MAIN BUTTONS
# ======================================================================
# ======================================================================
# BUTTON - GPARTED
# ======================================================================
button_gparted = Gtk.Button(label="")
button_gparted_label = button_gparted.get_child()
button_gparted_label.set_markup("Run GParted")
button_gparted.connect("clicked", self.on_gp_clicked)
button_gparted.set_size_request(100, 50)
button_gparted.set_property("has-tooltip", True)
button_gparted.connect("query-tooltip", self.tooltip_callback, "Launch GParted")
# ======================================================================
# BUTTON - EASY INSTALL
# ======================================================================
self.button_easy_install = Gtk.Button(label="")
button_easy_install_label = self.button_easy_install.get_child()
button_easy_install_label.set_markup(
"<span size='large'>Offline Installation</span>"
)
self.button_easy_install.connect("clicked", self.on_easy_install_clicked)
self.button_easy_install.set_size_request(300, 60)
self.button_easy_install.set_property("has-tooltip", True)
self.button_easy_install.connect(
"query-tooltip", self.tooltip_callback, "No internet connection required"
)
# ======================================================================
# BUTTON - ADV INSTALL
# ======================================================================
self.button_adv_install = Gtk.Button(label="")
button_adv_label = self.button_adv_install.get_child()
button_adv_label.set_markup(
"<span size='large'>Online Installation</span>"
)
self.button_adv_install.connect("clicked", self.on_adv_install_clicked)
self.button_adv_install.set_size_request(300, 60)
self.button_adv_install.set_property("has-tooltip", True)
self.button_adv_install.connect(
"query-tooltip", self.tooltip_callback, "Internet connection required!"
)
# ======================================================================
# BUTTON - MIRRORS
# ======================================================================
self.button_mirrors = Gtk.Button(label="")
button_mirrors_label = self.button_mirrors.get_child()
button_mirrors_label.set_markup("Update Mirrors")
self.button_mirrors.connect("clicked", self.on_mirror_clicked)
self.button_mirrors.set_size_request(100, 50)
self.button_mirrors.set_property("has-tooltip", True)
self.button_mirrors.connect(
"query-tooltip", self.tooltip_callback, "Update Mirrorlist"
)
# ======================================================================
# BUTTON - ARANDR
# ======================================================================
button_resolution = Gtk.Button(label="Fix Screen Resolution")
button_resolution.set_size_request(100, 50)
button_resolution.set_property("has-tooltip", True)
button_resolution.connect("query-tooltip", self.tooltip_callback, "Launch Arandr")
button_resolution.connect("clicked", self.on_buttonarandr_clicked)
if username == user:
hbox_util_buttons.pack_start(self.button_mirrors, False, True, 0)
hbox_util_buttons.pack_start(button_gparted, False, True, 0)
if self.session == "x11":
hbox_util_buttons.pack_start(button_resolution, False, True, 0)
hbox_install_buttons.pack_start(self.button_easy_install, True, True, 0)
hbox_install_buttons.pack_end(self.button_adv_install, True, True, 0)
else:
self.button_mirrors.get_child().set_markup("Update Mirrors")
button_resolution.get_child().set_markup("<b>Screen Resolution</b>")
hbox_install_buttons.pack_start(self.button_mirrors, False, True, 0)
if self.session == "x11":
hbox_install_buttons.pack_start(button_resolution, False, True, 0)
# ======================================================================
# USER INFO
# ======================================================================
label_creds = Gtk.Label(xalign=0)
label_creds.set_markup("User: liveuser | Pass: No Password")
label_creds.set_name("label_style")
hbox_user = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10)
hbox_user.pack_start(label_creds, False, False, 0)
# ======================================================================
# CREDITS
# ======================================================================
label_credits_title = Gtk.Label(xalign=0.5, yalign=0.5)
label_credits_title.set_name("label_style")
label_credits_title.set_markup("<b>Meet The Developers</b>")
label_credits_title.set_halign(Gtk.Align.CENTER)
label_credits_title.set_justify(Gtk.Justification.CENTER)
label_credits_support = Gtk.Label(xalign=0.5, yalign=0.5)
label_credits_support.set_name("label_style")
label_credits_support.set_markup(
f"For support or to report any issues use <b><a href='{app_forums}' title='{app_forums}'>Snigdha OS Forum</a></b>"
)
label_credits_support.set_halign(Gtk.Align.CENTER)
label_credits_support.set_justify(Gtk.Justification.CENTER)
label_credits = Gtk.Label(xalign=0, yalign=0)
label_credits.set_markup(
f"Eshanized\n"
f"Iconized\n"
f"Snigdha\n"
# f"Eshanized\n"
# f"For support, or to report any issues use <b><a href='{app_discord}' title='{app_discord}'>Discord</a></b>"
)
# label_credits.set_markup(
# f"Eshanized\n"
# )
label_credits.set_justify(Gtk.Justification.CENTER)
label_credits.set_line_wrap(True)
label_credits.set_halign(Gtk.Align.CENTER)
vbox_credits.pack_start(label_credits_title, False, False, 0)
vbox_credits.pack_start(label_credits, False, False, 0)
vbox_credits.pack_start(label_credits_support, False, False, 0)
# ======================================================================
# QUIT BUTTON
# ======================================================================
button_quit = Gtk.Button(label="")
button_quit.get_child().set_markup("EXIT")
button_quit.set_size_request(100, 40)
button_quit.connect("clicked", Gtk.main_quit)
vbox_quit.pack_start(button_quit, False, False, 0)
# ======================================================================
# Add to startup
# ======================================================================
check = Gtk.CheckButton(label="Autostart")
check.set_property("has-tooltip", True)
check.connect(
"query-tooltip",
self.tooltip_callback,
"Untick if you do not want Snigdha OS Welcome to run @startup!",
)
check.connect("toggled", self.startup_toggle)
check.set_active(autostart)
hbox_footer_buttons.set_halign(Gtk.Align.CENTER)
if username == user:
hbox_footer_buttons.pack_start(hbox_user, True, False, 0)
vbox_auto_start = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=15)
vbox_auto_start.set_halign(Gtk.Align.CENTER)
vbox_auto_start.pack_end(check, True, False, 0)
self.vbox.pack_end(vbox_auto_start, True, False, 0)
else:
hbox_footer_buttons.pack_end(check, False, False, 0)
# ======================================================================
# PACK TO WINDOW
# ======================================================================
self.vbox.pack_start(hbox_notify, False, False, 5) # notify label
self.vbox.pack_end(hbox_footer_buttons, False, False, 0) # Footer

View File

@@ -1,266 +0,0 @@
# This class is only for constructing a Message Dialog
import os
import gi
import subprocess
import threading
from threading import Thread
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GdkPixbuf
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
# generic Message Dialog with yes/no buttons
class MessageDialog(Gtk.Dialog):
def __init__(self, title, message):
Gtk.Dialog.__init__(self)
self.set_border_width(10)
self.set_title(title)
self.set_modal(True)
self.set_resizable(False)
self.response = False
headerbar = Gtk.HeaderBar()
headerbar.set_title(title)
headerbar.set_show_close_button(True)
headerbar.pack_start(
Gtk.Image().new_from_pixbuf(
GdkPixbuf.Pixbuf().new_from_file_at_size(os.path.join(base_dir, "images/snigdhaos-icon.png"), 24, 24)
)
)
self.set_titlebar(headerbar)
btn_yes = Gtk.Button(label="Yes")
btn_yes.set_size_request(100, 30)
btn_yes.connect("clicked", self.on_md_yes_clicked)
btn_yes.set_halign(Gtk.Align.END)
btn_no = Gtk.Button(label="No")
btn_no.set_size_request(100, 30)
btn_no.connect("clicked", self.on_md_no_clicked)
btn_no.set_halign(Gtk.Align.END)
label_message = Gtk.Label(xalign=0.5, yalign=0.5)
label_message.set_markup(message)
hbox_buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
hbox_buttons.pack_start(btn_yes, False, False, 0)
hbox_buttons.pack_start(btn_no, False, False, 0)
hbox_buttons.set_halign(Gtk.Align.CENTER)
self.vbox.set_spacing(5)
self.vbox.add(label_message)
self.vbox.add(hbox_buttons)
def on_md_yes_clicked(self, widget):
self.response = True
self.destroy()
def on_md_no_clicked(self, widget):
self.response = False
self.destroy()
class MessageDialogBootloader(Gtk.Dialog):
def __init__(
self,
title,
install_method,
pacman_lockfile,
run_app,
calamares_polkit,
):
Gtk.Dialog.__init__(self)
self.set_border_width(20)
self.set_title(title)
self.set_modal(True)
# self.set_default_size(600, 100)
self.set_resizable(False)
self.pacman_lockfile = pacman_lockfile
self.run_app = run_app
self.calamares_polkit = calamares_polkit
self.label_message = Gtk.Label(xalign=0, yalign=0)
self.label_message.set_halign(Gtk.Align.CENTER)
headerbar = Gtk.HeaderBar()
headerbar.set_title(title)
headerbar.set_show_close_button(True)
headerbar.pack_start(
Gtk.Image().new_from_pixbuf(
GdkPixbuf.Pixbuf().new_from_file_at_size(
os.path.join(base_dir, "images/snigdhaos-icon.png"), 24, 24
)
)
)
self.set_titlebar(headerbar)
btn_cancel = Gtk.Button(label="Cancel")
btn_cancel.set_size_request(100, 50)
btn_cancel.connect("clicked", self.on_md_cancel_clicked)
btn_cancel.set_halign(Gtk.Align.END)
title_message = "You have chosen the %s option" % install_method
title_second_message = (
"Would you like to install <b>Grub (Recommended)</b> or <b>Systemd-boot</b> ?"
)
btn_bootloader_grub = Gtk.Button(label="Install Grub")
btn_bootloader_grub.set_size_request(100, 50)
btn_bootloader_grub.connect("clicked", self.on_bootloader_grub_clicked)
btn_bootloader_systemd_boot = Gtk.Button(label="Install Systemd-boot")
btn_bootloader_systemd_boot.set_size_request(100, 50)
btn_bootloader_systemd_boot.connect(
"clicked", self.on_bootloader_systemd_boot_clicked
)
label_title_message = Gtk.Label(xalign=0.5, yalign=0.5)
label_title_message.set_markup("<b>%s</b>" % title_message)
label_title_message.set_halign(Gtk.Align.CENTER)
label_title_second_message = Gtk.Label(xalign=0.5, yalign=0.5)
label_title_second_message.set_markup("%s" % title_second_message)
label_title_second_message.set_halign(Gtk.Align.CENTER)
lbl_padding1 = Gtk.Label(xalign=0, yalign=0)
lbl_padding1.set_text(" ")
lbl_padding2 = Gtk.Label(xalign=0, yalign=0)
lbl_padding2.set_text(" ")
hbox_buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
hbox_buttons.pack_start(btn_bootloader_grub, False, False, 1)
hbox_buttons.pack_start(btn_bootloader_systemd_boot, False, False, 1)
hbox_buttons.set_halign(Gtk.Align.CENTER)
vbox_cancel = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5)
vbox_cancel.pack_end(btn_cancel, False, False, 0)
self.vbox.set_spacing(20)
self.vbox.add(label_title_message)
self.vbox.add(label_title_second_message)
self.vbox.add(hbox_buttons)
def on_md_cancel_clicked(self, widget):
self.destroy()
# select GRUB
def on_bootloader_grub_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
bootloader_file = "/etc/calamares/modules/bootloader-grub.conf"
if os.path.exists(bootloader_file):
app_cmd = [
"sudo",
"cp",
bootloader_file,
"/etc/calamares/modules/bootloader.conf",
]
Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
subprocess.Popen([self.calamares_polkit, "-d"], shell=False)
else:
print(
"[ERROR]: %s not found, Make sure you are on a Live ISO?"
% bootloader_file
)
if self.label_message is not None:
self.label_message.destroy()
self.label_message.set_markup(
"<span foreground='red'><b>%s not found\nMake sure you are on a Live ISO?</b></span>"
% bootloader_file
)
self.vbox.add(self.label_message)
self.show_all()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
if self.label_message is not None:
self.label_message.destroy()
self.label_message.set_markup(
"<span foreground='red'><b Pacman lockfile found %s, is another pacman process running ?</b></span>"
% self.pacman_lockfile
)
self.vbox.add(self.label_message)
self.show_all()
self.destroy()
# select systemd-boot
def on_bootloader_systemd_boot_clicked(self, widget):
if not os.path.exists(self.pacman_lockfile):
bootloader_file = "/etc/calamares/modules/bootloader-systemd.conf"
if os.path.exists(bootloader_file):
app_cmd = [
"sudo",
"cp",
bootloader_file,
"/etc/calamares/modules/bootloader.conf",
]
Thread(target=self.run_app, args=(app_cmd,), daemon=True).start()
subprocess.Popen([self.calamares_polkit, "-d"], shell=False)
else:
print("[ERROR]: %s not found, Make sure you are on a Live ISO?" % bootloader_file)
if self.label_message is not None:
self.label_message.destroy()
self.label_message.set_markup(
"<span foreground='red'><b>%s not found\nMake sure you are on a Live ISO?</b></span>"
% bootloader_file
)
self.vbox.add(self.label_message)
self.show_all()
else:
print(
"[ERROR]: Pacman lockfile found %s, is another pacman process running ?"
% self.pacman_lockfile
)
if self.label_message is not None:
self.label_message.destroy()
self.label_message.set_markup(
"<span foreground='red'><b Pacman lockfile found %s, is another pacman process running ?</b></span>"
% self.pacman_lockfile
)
self.vbox.add(self.label_message)
self.show_all()
self.destroy()

View File

@@ -1,22 +0,0 @@
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
class Stack(Gtk.Stack):
def __init__(self, transition_type):
super(Stack, self).__init__()
# self.set_transition_type(Gtk.StackTransitionType.ROTATE_LEFT)
if transition_type == "ROTATE_LEFT":
transition_type = Gtk.StackTransitionType.ROTATE_LEFT
if transition_type == "CROSSFADE":
transition_type = Gtk.StackTransitionType.CROSSFADE
self.set_transition_type(transition_type)
self.set_hexpand(True)
self.set_vexpand(True)
self.set_transition_duration(500)
self.set_hhomogeneous(False)
self.set_vhomogeneous(False)

View File

@@ -1,12 +0,0 @@
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
class StackSwitcher(Gtk.StackSwitcher):
def __init__(self, stack):
super(StackSwitcher, self).__init__()
self.set_orientation(Gtk.Orientation.HORIZONTAL)
self.set_stack(stack)
self.set_halign(Gtk.Align.CENTER)