mirror of
https://github.com/Snigdha-OS/snigdhaos-blackbox.git
synced 2025-09-21 12:05:02 +02:00
⏳ @eshanized updated the repository!!!
This commit is contained in:
@@ -397,69 +397,6 @@ def do_pulse(data, prog):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def set_hblock(self, toggle, state):
|
|
||||||
GLib.idle_add(toggle.set_sensitive, False)
|
|
||||||
GLib.idle_add(self.label7.set_text, "Run..")
|
|
||||||
GLib.idle_add(self.progress.set_fraction, 0.2)
|
|
||||||
|
|
||||||
timeout_id = None
|
|
||||||
timeout_id = GLib.timeout_add(100, do_pulse, None, self.progress)
|
|
||||||
|
|
||||||
try:
|
|
||||||
|
|
||||||
install = "pacman -S arcolinux-hblock-git --needed --noconfirm"
|
|
||||||
enable = "/usr/local/bin/hblock"
|
|
||||||
|
|
||||||
if state:
|
|
||||||
if os.path.exists("/usr/local/bin/hblock"):
|
|
||||||
GLib.idle_add(self.label7.set_text, "Database update...")
|
|
||||||
subprocess.call(
|
|
||||||
[enable],
|
|
||||||
shell=False,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
GLib.idle_add(self.label7.set_text, "Install Hblock......")
|
|
||||||
subprocess.call(
|
|
||||||
install.split(" "),
|
|
||||||
shell=False,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
)
|
|
||||||
GLib.idle_add(self.label7.set_text, "Database update...")
|
|
||||||
subprocess.call(
|
|
||||||
[enable],
|
|
||||||
shell=False,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
|
||||||
GLib.idle_add(self.label7.set_text, "Remove update...")
|
|
||||||
subprocess.run(
|
|
||||||
["sh", "-c", "HBLOCK_SOURCES='' /usr/local/bin/hblock"],
|
|
||||||
shell=False,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
)
|
|
||||||
|
|
||||||
GLib.idle_add(self.label7.set_text, "Complete")
|
|
||||||
GLib.source_remove(timeout_id)
|
|
||||||
timeout_id = None
|
|
||||||
GLib.idle_add(self.progress.set_fraction, 0)
|
|
||||||
|
|
||||||
GLib.idle_add(toggle.set_sensitive, True)
|
|
||||||
if state:
|
|
||||||
GLib.idle_add(self.label7.set_text, "HBlock Active")
|
|
||||||
else:
|
|
||||||
GLib.idle_add(self.label7.set_text, "HBlock Inactive")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
MessageBox(self, "ERROR!!", str(e))
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
|
|
||||||
# =====================================================
|
# =====================================================
|
||||||
# UBLOCK ORIGIN
|
# UBLOCK ORIGIN
|
||||||
# =====================================================
|
# =====================================================
|
||||||
@@ -538,107 +475,6 @@ def install_alacritty(self):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# =====================================================
|
|
||||||
# ARCOLINUX-DESKTOP-TRASHER
|
|
||||||
# =====================================================
|
|
||||||
|
|
||||||
|
|
||||||
def install_adt(self):
|
|
||||||
install = "pacman -S arcolinux-desktop-trasher-git --noconfirm"
|
|
||||||
|
|
||||||
if os.path.exists("/usr/local/bin/arcolinux-desktop-trasher"):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
subprocess.call(
|
|
||||||
install.split(" "),
|
|
||||||
shell=False,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# =====================================================
|
|
||||||
# GRUB CONF
|
|
||||||
# =====================================================
|
|
||||||
|
|
||||||
|
|
||||||
def get_grub_wallpapers():
|
|
||||||
if os.path.isdir("/boot/grub/themes/Vimix"):
|
|
||||||
lists = os.listdir("/boot/grub/themes/Vimix")
|
|
||||||
|
|
||||||
rems = [
|
|
||||||
"select_e.png",
|
|
||||||
"terminal_box_se.png",
|
|
||||||
"select_c.png",
|
|
||||||
"terminal_box_c.png",
|
|
||||||
"terminal_box_s.png",
|
|
||||||
"select_w.png",
|
|
||||||
"terminal_box_nw.png",
|
|
||||||
"terminal_box_w.png",
|
|
||||||
"terminal_box_ne.png",
|
|
||||||
"terminal_box_sw.png",
|
|
||||||
"terminal_box_n.png",
|
|
||||||
"terminal_box_e.png",
|
|
||||||
]
|
|
||||||
|
|
||||||
ext = [".png", ".jpeg", ".jpg"]
|
|
||||||
|
|
||||||
new_list = [x for x in lists if x not in rems for y in ext if y in x]
|
|
||||||
|
|
||||||
new_list.sort()
|
|
||||||
return new_list
|
|
||||||
|
|
||||||
|
|
||||||
def set_grub_wallpaper(self, image):
|
|
||||||
if os.path.isfile(grub_theme_conf):
|
|
||||||
if not os.path.isfile(grub_theme_conf + ".bak"):
|
|
||||||
shutil.copy(grub_theme_conf, grub_theme_conf + ".bak")
|
|
||||||
try:
|
|
||||||
with open(grub_theme_conf, "r") as f:
|
|
||||||
lists = f.readlines()
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
val = _get_position(lists, "desktop-image: ")
|
|
||||||
lists[val] = 'desktop-image: "' + os.path.basename(image) + '"' + "\n"
|
|
||||||
|
|
||||||
with open(grub_theme_conf, "w") as f:
|
|
||||||
f.writelines(lists)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
show_in_app_notification(self, "Settings Saved Successfully")
|
|
||||||
# MessageBox(self, "Success!!", "Settings Saved Successfully")
|
|
||||||
except: # noqa
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# =====================================================
|
|
||||||
# NEOFETCH CONF
|
|
||||||
# =====================================================
|
|
||||||
|
|
||||||
|
|
||||||
def neofetch_set_value(lists, pos, text, state):
|
|
||||||
if state:
|
|
||||||
if text in lists[pos]:
|
|
||||||
if "#" in lists[pos]:
|
|
||||||
lists[pos] = lists[pos].replace("#", "")
|
|
||||||
else:
|
|
||||||
if text in lists[pos]:
|
|
||||||
if "#" not in lists[pos]:
|
|
||||||
lists[pos] = "#" + lists[pos]
|
|
||||||
|
|
||||||
return lists
|
|
||||||
|
|
||||||
|
|
||||||
def neofetch_set_backend_value(lists, pos, text, value):
|
|
||||||
if text in lists[pos] and "#" not in lists[pos]:
|
|
||||||
lists[pos] = text + value + '"\n'
|
|
||||||
|
|
||||||
|
|
||||||
# ====================================================================
|
|
||||||
# CUSTOM FUNCTION
|
|
||||||
# ====================================================================
|
|
||||||
|
|
||||||
|
|
||||||
def get_desktop(self):
|
def get_desktop(self):
|
||||||
base_dir = os.path.dirname(os.path.realpath(__file__))
|
base_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user