diff --git a/README.md b/README.md index 86e4c4d..001906d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1 @@ -

SNIGDHA OS WELCOME

- -

project-image

- -

Snigdha OS Welcome App: It will help you to install Snigdha OS from a live environment.

- -

Project Screenshots:

- -project-screenshot - -project-screenshot +# snigdha-welcome \ No newline at end of file diff --git a/etc/skel/.config/autostart/snigdhaos-welcome.desktop b/etc/skel/.config/autostart/snigdhaos-welcome.desktop index 207a514..f4b35f2 100644 --- a/etc/skel/.config/autostart/snigdhaos-welcome.desktop +++ b/etc/skel/.config/autostart/snigdhaos-welcome.desktop @@ -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; diff --git a/usr/local/bin/snigdhaos-welcome b/usr/local/bin/snigdhaos-welcome index f1edf2a..8938650 100755 --- a/usr/local/bin/snigdhaos-welcome +++ b/usr/local/bin/snigdhaos-welcome @@ -1,3 +1,2 @@ #!/usr/bin/env bash - python3 /usr/share/snigdhaos-welcome/snigdhaos-welcome.py diff --git a/usr/share/applications/snigdhaos-welcome.desktop b/usr/share/applications/snigdha-welcome.desktop similarity index 57% rename from usr/share/applications/snigdhaos-welcome.desktop rename to usr/share/applications/snigdha-welcome.desktop index 4dae299..2983793 100644 --- a/usr/share/applications/snigdhaos-welcome.desktop +++ b/usr/share/applications/snigdha-welcome.desktop @@ -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; diff --git a/usr/share/icons/hicolor/scalable/apps/snigdha-hello.svg b/usr/share/icons/hicolor/scalable/apps/snigdha-hello.svg new file mode 100644 index 0000000..3741236 --- /dev/null +++ b/usr/share/icons/hicolor/scalable/apps/snigdha-hello.svg @@ -0,0 +1,18 @@ + + snigdhaos- + + + + + + + + + + + + + + \ No newline at end of file diff --git a/usr/share/icons/hicolor/scalable/apps/snigdhaos-icon.svg b/usr/share/icons/hicolor/scalable/apps/snigdhaos-icon.svg deleted file mode 100644 index 20d2bbd..0000000 --- a/usr/share/icons/hicolor/scalable/apps/snigdhaos-icon.svg +++ /dev/null @@ -1,9 +0,0 @@ - - wolf - - - - - - \ No newline at end of file diff --git a/usr/share/snigdha-welcome/GUI.py b/usr/share/snigdha-welcome/GUI.py new file mode 100644 index 0000000..aea95ef --- /dev/null +++ b/usr/share/snigdha-welcome/GUI.py @@ -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("Welcome to Snigdha OS") + 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 Gparted 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 + # + "Forum is for support\n" # noqa + + "We have a forum for the longer and more technical questions.\n" # noqa + ) + label_warning.set_markup( + "\nUse Basic Installation\n" + + "in case the Advanced Installation fails\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" + # + "Telegram is for chitchat - Discord is for assistance.\n" # noqa + + "We have a forum 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("Run GParted") + 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( + "Grub installation (Default)" + ) + 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( + "Systemd-boot installation" + ) + 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( + "Basic Installation (Offline)" + ) + 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( + "Advanced Installation (Online)" + ) + 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( + "Update Mirrorlists" + ) + 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( + # "Launch Arch Linux Tweak Tool" + # ) + # 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("Snigdha App Installer") + 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("No Password") + + 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("Donate") + # 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 diff --git a/usr/share/snigdha-welcome/__pycache__/GUI.cpython-311.pyc b/usr/share/snigdha-welcome/__pycache__/GUI.cpython-311.pyc new file mode 100644 index 0000000..76861f0 Binary files /dev/null and b/usr/share/snigdha-welcome/__pycache__/GUI.cpython-311.pyc differ diff --git a/usr/share/snigdhaos-welcome/__pycache__/conflicts.cpython-311.pyc b/usr/share/snigdha-welcome/__pycache__/conflicts.cpython-311.pyc similarity index 61% rename from usr/share/snigdhaos-welcome/__pycache__/conflicts.cpython-311.pyc rename to usr/share/snigdha-welcome/__pycache__/conflicts.cpython-311.pyc index 2c4d722..05c54b2 100644 Binary files a/usr/share/snigdhaos-welcome/__pycache__/conflicts.cpython-311.pyc and b/usr/share/snigdha-welcome/__pycache__/conflicts.cpython-311.pyc differ diff --git a/usr/share/snigdhaos-welcome/conflicts.py b/usr/share/snigdha-welcome/conflicts.py similarity index 96% rename from usr/share/snigdhaos-welcome/conflicts.py rename to usr/share/snigdha-welcome/conflicts.py index 91088c4..373e71d 100644 --- a/usr/share/snigdhaos-welcome/conflicts.py +++ b/usr/share/snigdha-welcome/conflicts.py @@ -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) diff --git a/usr/share/snigdha-welcome/images/archlinux-tweak-tool-new.svg b/usr/share/snigdha-welcome/images/archlinux-tweak-tool-new.svg new file mode 100644 index 0000000..6219aaa --- /dev/null +++ b/usr/share/snigdha-welcome/images/archlinux-tweak-tool-new.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + diff --git a/usr/share/snigdha-welcome/images/archlinux-tweak-tool.svg b/usr/share/snigdha-welcome/images/archlinux-tweak-tool.svg new file mode 100644 index 0000000..ac18485 --- /dev/null +++ b/usr/share/snigdha-welcome/images/archlinux-tweak-tool.svg @@ -0,0 +1,42 @@ + + + + + + + diff --git a/usr/share/snigdha-welcome/images/arcolinux-one-liner.png b/usr/share/snigdha-welcome/images/arcolinux-one-liner.png new file mode 100644 index 0000000..42f4cda Binary files /dev/null and b/usr/share/snigdha-welcome/images/arcolinux-one-liner.png differ diff --git a/usr/share/snigdha-welcome/images/arcolinux.png b/usr/share/snigdha-welcome/images/arcolinux.png new file mode 100644 index 0000000..f57c68f Binary files /dev/null and b/usr/share/snigdha-welcome/images/arcolinux.png differ diff --git a/usr/share/snigdha-welcome/images/discord.png b/usr/share/snigdha-welcome/images/discord.png new file mode 100644 index 0000000..7038076 Binary files /dev/null and b/usr/share/snigdha-welcome/images/discord.png differ diff --git a/usr/share/snigdha-welcome/images/element.png b/usr/share/snigdha-welcome/images/element.png new file mode 100644 index 0000000..0f695dc Binary files /dev/null and b/usr/share/snigdha-welcome/images/element.png differ diff --git a/usr/share/snigdha-welcome/images/facebook.png b/usr/share/snigdha-welcome/images/facebook.png new file mode 100644 index 0000000..5a7b164 Binary files /dev/null and b/usr/share/snigdha-welcome/images/facebook.png differ diff --git a/usr/share/snigdha-welcome/images/hefftor.svg b/usr/share/snigdha-welcome/images/hefftor.svg new file mode 100644 index 0000000..9651ba9 --- /dev/null +++ b/usr/share/snigdha-welcome/images/hefftor.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/usr/share/snigdha-welcome/images/insta.png b/usr/share/snigdha-welcome/images/insta.png new file mode 100644 index 0000000..4923bb9 Binary files /dev/null and b/usr/share/snigdha-welcome/images/insta.png differ diff --git a/usr/share/snigdha-welcome/images/linkedin.png b/usr/share/snigdha-welcome/images/linkedin.png new file mode 100644 index 0000000..2bc341c Binary files /dev/null and b/usr/share/snigdha-welcome/images/linkedin.png differ diff --git a/usr/share/snigdha-welcome/images/mewe.png b/usr/share/snigdha-welcome/images/mewe.png new file mode 100644 index 0000000..582da65 Binary files /dev/null and b/usr/share/snigdha-welcome/images/mewe.png differ diff --git a/usr/share/snigdha-welcome/images/patreon.png b/usr/share/snigdha-welcome/images/patreon.png new file mode 100644 index 0000000..bd24dd7 Binary files /dev/null and b/usr/share/snigdha-welcome/images/patreon.png differ diff --git a/usr/share/snigdha-welcome/images/question.png b/usr/share/snigdha-welcome/images/question.png new file mode 100644 index 0000000..65f4c74 Binary files /dev/null and b/usr/share/snigdha-welcome/images/question.png differ diff --git a/usr/share/snigdha-welcome/images/question.svg b/usr/share/snigdha-welcome/images/question.svg new file mode 100644 index 0000000..14df841 --- /dev/null +++ b/usr/share/snigdha-welcome/images/question.svg @@ -0,0 +1,98 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/usr/share/snigdhaos-welcome/images/logo.png b/usr/share/snigdha-welcome/images/snigdha-purple.png similarity index 90% rename from usr/share/snigdhaos-welcome/images/logo.png rename to usr/share/snigdha-welcome/images/snigdha-purple.png index 3f2fc6e..aeaf4b8 100644 Binary files a/usr/share/snigdhaos-welcome/images/logo.png and b/usr/share/snigdha-welcome/images/snigdha-purple.png differ diff --git a/usr/share/snigdha-welcome/images/tg.png b/usr/share/snigdha-welcome/images/tg.png new file mode 100644 index 0000000..8a575f9 Binary files /dev/null and b/usr/share/snigdha-welcome/images/tg.png differ diff --git a/usr/share/snigdha-welcome/images/twitter.png b/usr/share/snigdha-welcome/images/twitter.png new file mode 100644 index 0000000..8f6e8b4 Binary files /dev/null and b/usr/share/snigdha-welcome/images/twitter.png differ diff --git a/usr/share/snigdha-welcome/images/youtube.png b/usr/share/snigdha-welcome/images/youtube.png new file mode 100644 index 0000000..427e1e7 Binary files /dev/null and b/usr/share/snigdha-welcome/images/youtube.png differ diff --git a/usr/share/snigdha-welcome/snigdha-welcome.py b/usr/share/snigdha-welcome/snigdha-welcome.py new file mode 100644 index 0000000..89fc610 --- /dev/null +++ b/usr/share/snigdha-welcome/snigdha-welcome.py @@ -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( + "ArcoLinux Tweak Tool 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, + "No Internet! 😐 \nInstaller will not install additional application! ♨️", + ) # 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 Arch Linux mirrorlist?") + # response = md.run() + + # if response == Gtk.ResponseType.YES: + # GLib.idle_add(self.cc.set_markup, "Updating your mirrorlist \nThis may take some time, please wait...") # 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, + # "Updating your mirrorlist \nThis may take some time, please wait...", + # ) # 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, "Updating Arch Linux Mirrorlist Via Rate-Mirrors \nThis will take time, please wait...") + 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, "Updating Chaotic AUR mirrorlist \nThis may take some time, please wait...") # 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, "Update Completed! 🔥") + 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!", + "ArcoLinux Tweak Tool 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( +# "Notice") +# 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() diff --git a/usr/share/snigdhaos-welcome/images/facebook.png b/usr/share/snigdhaos-welcome/images/facebook.png deleted file mode 100644 index 6eedea2..0000000 Binary files a/usr/share/snigdhaos-welcome/images/facebook.png and /dev/null differ diff --git a/usr/share/snigdhaos-welcome/images/github.png b/usr/share/snigdhaos-welcome/images/github.png deleted file mode 100644 index 9275966..0000000 Binary files a/usr/share/snigdhaos-welcome/images/github.png and /dev/null differ diff --git a/usr/share/snigdhaos-welcome/images/snigdhaos-welcome.png b/usr/share/snigdhaos-welcome/images/snigdhaos-welcome.png deleted file mode 100644 index d818426..0000000 Binary files a/usr/share/snigdhaos-welcome/images/snigdhaos-welcome.png and /dev/null differ diff --git a/usr/share/snigdhaos-welcome/images/twitter.png b/usr/share/snigdhaos-welcome/images/twitter.png deleted file mode 100644 index 8daa1c3..0000000 Binary files a/usr/share/snigdhaos-welcome/images/twitter.png and /dev/null differ diff --git a/usr/share/snigdhaos-welcome/snigdhaos-welcome.py b/usr/share/snigdhaos-welcome/snigdhaos-welcome.py deleted file mode 100644 index 3532d66..0000000 --- a/usr/share/snigdhaos-welcome/snigdhaos-welcome.py +++ /dev/null @@ -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( - "Offline Installation" - ) - # 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( - "Online Installation" - ) - - # 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, - "Removing dev package %s" - % 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, - "Dev package %s removed" - % 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, - "Failed to remove dev package %s" - % 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, - "Failed to remove dev package %s" - % 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, - "Installing %s" % 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, - "Package %s installed" - % 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, - "Package %s install failed" - % 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, - "Package install failed", - ) - 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"No internet!\n" - f"Snigdha OS will not install any additional packages!", - ) # 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"Updating Arch Mirrorlist\n" - f"This may take some time, please wait...", - ) # 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"Updating Chaotic Aur Mirrorlist\n" - f"This may take some time, please wait...", - ) # 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, "Mirrorlist updated") - GLib.idle_add(self.label_notify.set_markup, "Mirrorlist Updated ") - 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() diff --git a/usr/share/snigdhaos-welcome/tempCodeRunnerFile.py b/usr/share/snigdhaos-welcome/tempCodeRunnerFile.py deleted file mode 100644 index 0b52ab9..0000000 --- a/usr/share/snigdhaos-welcome/tempCodeRunnerFile.py +++ /dev/null @@ -1 +0,0 @@ -snigdhaos-welcome.png \ No newline at end of file diff --git a/usr/share/snigdhaos-welcome/ui/GUI.py b/usr/share/snigdhaos-welcome/ui/GUI.py deleted file mode 100644 index 270f91d..0000000 --- a/usr/share/snigdhaos-welcome/ui/GUI.py +++ /dev/null @@ -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( - "%s" % (app_discord, app_discord, "Discord") - ) - - label_telegram = Gtk.Label(xalign=0, yalign=0) - label_telegram.set_markup( - "%s" % (app_facebook, app_facebook, "Facebook") - ) - - label_youtube = Gtk.Label(xalign=0, yalign=0) - label_youtube.set_markup( - "%s" % (app_twitter, app_twitter, "Twitter") - ) - - label_forums = Gtk.Label(xalign=0, yalign=0) - label_forums.set_markup( - "%s" % (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("You have the freedom of choice") - - 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("Snigdha OS - Arctic Installer") - - desc = ( - f"Clean You Computer With GParted before installing Snigdha OS.\n" - f"During the Online Installation many options will be open to you.\n\n" - f"Offline Installation does not require internet connection.\n" - f"Online installation (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("Welcome to Snigdha OS - Arctic") - 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("Welcome to ArcoLinux") - - # ====================================================================== - # 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( - "Offline Installation" - ) - 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( - "Online Installation" - ) - 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("Screen Resolution") - - 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("Meet The Developers") - 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 Snigdha OS Forum" - ) - 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 Discord" - ) - # 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 diff --git a/usr/share/snigdhaos-welcome/ui/MessageDialog.py b/usr/share/snigdhaos-welcome/ui/MessageDialog.py deleted file mode 100644 index eff935c..0000000 --- a/usr/share/snigdhaos-welcome/ui/MessageDialog.py +++ /dev/null @@ -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 Grub (Recommended) or Systemd-boot ?" - ) - - 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("%s" % 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( - "%s not found\nMake sure you are on a Live ISO?" - % 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( - "" - % 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( - "%s not found\nMake sure you are on a Live ISO?" - % 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( - "" - % self.pacman_lockfile - ) - - self.vbox.add(self.label_message) - self.show_all() - - self.destroy() diff --git a/usr/share/snigdhaos-welcome/ui/Stack.py b/usr/share/snigdhaos-welcome/ui/Stack.py deleted file mode 100644 index 3d4c53c..0000000 --- a/usr/share/snigdhaos-welcome/ui/Stack.py +++ /dev/null @@ -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) diff --git a/usr/share/snigdhaos-welcome/ui/StackSwitcher.py b/usr/share/snigdhaos-welcome/ui/StackSwitcher.py deleted file mode 100644 index 6410422..0000000 --- a/usr/share/snigdhaos-welcome/ui/StackSwitcher.py +++ /dev/null @@ -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) diff --git a/usr/share/snigdhaos-welcome/ui/__pycache__/GUI.cpython-311.pyc b/usr/share/snigdhaos-welcome/ui/__pycache__/GUI.cpython-311.pyc deleted file mode 100644 index 913d64c..0000000 Binary files a/usr/share/snigdhaos-welcome/ui/__pycache__/GUI.cpython-311.pyc and /dev/null differ diff --git a/usr/share/snigdhaos-welcome/ui/__pycache__/MessageDialog.cpython-311.pyc b/usr/share/snigdhaos-welcome/ui/__pycache__/MessageDialog.cpython-311.pyc deleted file mode 100644 index 293692d..0000000 Binary files a/usr/share/snigdhaos-welcome/ui/__pycache__/MessageDialog.cpython-311.pyc and /dev/null differ diff --git a/usr/share/snigdhaos-welcome/ui/__pycache__/Stack.cpython-311.pyc b/usr/share/snigdhaos-welcome/ui/__pycache__/Stack.cpython-311.pyc deleted file mode 100644 index 5a9ea06..0000000 Binary files a/usr/share/snigdhaos-welcome/ui/__pycache__/Stack.cpython-311.pyc and /dev/null differ diff --git a/usr/share/snigdhaos-welcome/ui/__pycache__/StackSwitcher.cpython-311.pyc b/usr/share/snigdhaos-welcome/ui/__pycache__/StackSwitcher.cpython-311.pyc deleted file mode 100644 index 44184ad..0000000 Binary files a/usr/share/snigdhaos-welcome/ui/__pycache__/StackSwitcher.cpython-311.pyc and /dev/null differ