Skip to content
Snippets Groups Projects

Playground

Merged Vitor Lopes requested to merge (removed):playground into master
@@ -9,12 +9,22 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
import gi
import gi, subprocess, os, platform
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject
import os
# os.popen() has been deprecated since Python 2.6.
# You should now use the subprocess module instead: http://docs.python.org/2/library/subprocess.html#subprocess.Popen
from gi.repository.GdkPixbuf import Pixbuf
import platform
def check_if_app_is_installed(app_name):
# making code reusable
process = subprocess.run(['pacman', '-Q', f'{app_name}'], stdout=subprocess.PIPE, encoding='utf-8')
if app_name in process.stdout:
return True
else:
return False
class MyWindow(Gtk.Window):
@@ -70,7 +80,7 @@ class MyWindow(Gtk.Window):
self.chromebox.pack_start(self.chromelabel, True, True, 0)
self.page1.pack_start(self.chromebox, True, True, 0)
self.chromeimage = Gtk.Image()
self.chromeimage.set_from_file(icon_path + 'chromium.svg')
self.chromeimage.set_from_file(f'{icon_path}chromium.svg')
self.chromebox.pack_start(self.chromeimage, True, True, 0)
self.chromedesc = Gtk.Label("Open Source\nVersion of\nGoogle's\nChrome Browser")
self.chromebox.pack_start(self.chromedesc, True, True, 0)
@@ -79,10 +89,11 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel1 = Gtk.Label("Installed")
chromium = os.popen("pacman -Q chromium | awk '{print $1}'").read()
if chromium == 'chromium\n':
self.chromebox.pack_end(self.installedlabel1, False, False, 0)
# this is a better way of doing it, not tested
# reuse code blocks to avoid repetition
if check_if_app_is_installed("chromium"):
self.chromebox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.chromebox.pack_end(self.chromebutton, False, False, 0)
@@ -95,7 +106,7 @@ class MyWindow(Gtk.Window):
self.firebox.pack_start(self.firelabel, True, True, 0)
self.page1.pack_start(self.firebox, True, True, 0)
self.fireimage = Gtk.Image()
self.fireimage.set_from_file(icon_path + 'firefox.svg')
self.fireimage.set_from_file(f'{icon_path}firefox.svg')
self.firebox.pack_start(self.fireimage, True, True, 0)
self.firedesc = Gtk.Label("Popular\nMozilla Firefox\nWeb Browser")
self.firebox.pack_start(self.firedesc, True, True, 0)
@@ -105,10 +116,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel2 = Gtk.Label("Installed")
firefox = os.popen("pacman -Q firefox | awk '{print $1}'").read()
if firefox == 'firefox\n':
self.firebox.pack_end(self.installedlabel2, False, False, 0)
if check_if_app_is_installed("firefox"):
self.firebox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.firebox.pack_end(self.firebutton, False, False, 0)
@@ -120,7 +129,7 @@ class MyWindow(Gtk.Window):
self.midoribox.pack_start(self.midorilabel, True, True, 0)
self.page1.pack_start(self.midoribox, True, True, 0)
self.midoriimage = Gtk.Image()
self.midoriimage.set_from_file(icon_path + 'midori.svg')
self.midoriimage.set_from_file(f'{icon_path}midori.svg')
self.midoribox.pack_start(self.midoriimage, True, True, 0)
self.midoridesc = Gtk.Label("Popular Open\nSource Browser")
self.midoribox.pack_start(self.midoridesc, True, True, 0)
@@ -130,10 +139,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel3 = Gtk.Label("Installed")
midori = os.popen("pacman -Q midori | awk '{print $1}'").read()
if midori == 'midori\n':
self.midoribox.pack_end(self.installedlabel3, False, False, 0)
if check_if_app_is_installed("midori"):
self.midoribox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.midoribox.pack_end(self.midoributton, False, False, 0)
@@ -145,7 +152,7 @@ class MyWindow(Gtk.Window):
self.falkbox.pack_start(self.falklabel, True, True, 0)
self.page1.pack_start(self.falkbox, True, True, 0)
self.falkimage = Gtk.Image()
self.falkimage.set_from_file(qicon_path + 'falkon.svg')
self.falkimage.set_from_file(f'{qicon_path}falkon.svg')
self.falkbox.pack_start(self.falkimage, True, True, 0)
self.falkdesc = Gtk.Label("Popular Open\nSource Browser\nBased on QT")
self.falkbox.pack_start(self.falkdesc, True, True, 0)
@@ -155,10 +162,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel4 = Gtk.Label("Installed")
falkon = os.popen("pacman -Q falkon | awk '{print $1}'").read()
if falkon == 'falkon\n':
self.falkbox.pack_end(self.installedlabel4, False, False, 0)
if check_if_app_is_installed("falkon"):
self.falkbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.falkbox.pack_end(self.falkbutton, False, False, 0)
@@ -170,7 +175,7 @@ class MyWindow(Gtk.Window):
self.netbox.pack_start(self.netlabel, True, True, 0)
self.page1.pack_start(self.netbox, True, True, 0)
self.netimage = Gtk.Image()
self.netimage.set_from_file(icon_path + 'browser.svg')
self.netimage.set_from_file(f'{icon_path}browser.svg')
self.netbox.pack_start(self.netimage, True, True, 0)
self.netdesc = Gtk.Label("Lightweight Open\nSource Browser")
self.netbox.pack_start(self.netdesc, True, True, 0)
@@ -180,10 +185,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel5 = Gtk.Label("Installed")
netsurf = os.popen("pacman -Q netsurf | awk '{print $1}'").read()
if netsurf == 'netsurf\n':
self.netbox.pack_end(self.installedlabel5, False, False, 0)
if check_if_app_is_installed("netsurf"):
self.netbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.netbox.pack_end(self.netbutton, False, False, 0)
@@ -195,7 +198,7 @@ class MyWindow(Gtk.Window):
self.filbox.pack_start(self.fillabel, True, True, 0)
self.page1.pack_start(self.filbox, True, True, 0)
self.filimage = Gtk.Image()
self.filimage.set_from_file(icon_path + 'filezilla.svg')
self.filimage.set_from_file(f'{icon_path}filezilla.svg')
self.filbox.pack_start(self.filimage, True, True, 0)
self.fildesc = Gtk.Label("Graphical SSH Tool")
self.filbox.pack_start(self.fildesc, True, True, 0)
@@ -205,10 +208,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel6 = Gtk.Label("Installed")
filezilla = os.popen("pacman -Q filezilla | awk '{print $1}'").read()
if filezilla == 'filezilla\n':
self.filbox.pack_end(self.installedlabel6, False, False, 0)
if check_if_app_is_installed("filezilla"):
self.filbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.filbox.pack_end(self.filbutton, False, False, 0)
@@ -220,7 +221,7 @@ class MyWindow(Gtk.Window):
self.opebox.pack_start(self.opelabel, True, True, 0)
self.page1.pack_start(self.opebox, True, True, 0)
self.opeimage = Gtk.Image()
self.opeimage.set_from_file(icon_path + 'opera.svg')
self.opeimage.set_from_file(f'{icon_path}opera.svg')
self.opebox.pack_start(self.opeimage, True, True, 0)
self.opedesc = Gtk.Label("Popular Opera\nOpen Source\nBrowser")
self.opebox.pack_start(self.opedesc, True, True, 0)
@@ -230,10 +231,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel7 = Gtk.Label("Installed")
opera = os.popen("pacman -Q opera | awk '{print $1}'").read()
if opera == 'opera\n':
self.opebox.pack_end(self.installedlabel7, False, False, 0)
if check_if_app_is_installed("opera"):
self.opebox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.opebox.pack_end(self.opebutton, False, False, 0)
@@ -245,7 +244,7 @@ class MyWindow(Gtk.Window):
self.geabox.pack_start(self.gealabel, True, True, 0)
self.page1.pack_start(self.geabox, True, True, 0)
self.geaimage = Gtk.Image()
self.geaimage.set_from_file(icon_path + 'browser.svg')
self.geaimage.set_from_file(f'{icon_path}browser.svg')
self.geabox.pack_start(self.geaimage, True, True, 0)
self.geadesc = Gtk.Label("Open Source\nGTK Email\nClient")
self.geabox.pack_start(self.geadesc, True, True, 0)
@@ -255,10 +254,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel8 = Gtk.Label("Installed")
geary = os.popen("pacman -Q geary | awk '{print $1}'").read()
if geary == 'geary\n':
self.geabox.pack_end(self.installedlabel8, False, False, 0)
if check_if_app_is_installed("geary"):
self.geabox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.geabox.pack_end(self.geabutton, False, False, 0)
@@ -270,7 +267,7 @@ class MyWindow(Gtk.Window):
self.evobox.pack_start(self.evolabel, True, True, 0)
self.page1.pack_start(self.evobox, True, True, 0)
self.evoimage = Gtk.Image()
self.evoimage.set_from_file(icon_path + 'evolution.svg')
self.evoimage.set_from_file(f'{icon_path}evolution.svg')
self.evobox.pack_start(self.evoimage, True, True, 0)
self.evodesc = Gtk.Label("Open Source\nEmail client")
self.evobox.pack_start(self.evodesc, True, True, 0)
@@ -280,10 +277,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel9 = Gtk.Label("Installed")
evolution = os.popen("pacman -Q evolution | awk '{print $1}'").read()
if evolution == 'evolution\n':
self.evobox.pack_end(self.installedlabel9, False, False, 0)
if check_if_app_is_installed("evolution"):
self.evobox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.evobox.pack_end(self.evobutton, False, False, 0)
@@ -295,7 +290,7 @@ class MyWindow(Gtk.Window):
self.thubox.pack_start(self.thulabel, True, True, 0)
self.page1.pack_start(self.thubox, True, True, 0)
self.thuimage = Gtk.Image()
self.thuimage.set_from_file(icon_path + 'thunderbird.svg')
self.thuimage.set_from_file(f'{icon_path}thunderbird.svg')
self.thubox.pack_start(self.thuimage, True, True, 0)
self.thudesc = Gtk.Label("Mozilla's\nOpen Source\nEmail Client'")
self.thubox.pack_start(self.thudesc, True, True, 0)
@@ -305,10 +300,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel10 = Gtk.Label("Installed")
thunderbird = os.popen("pacman -Q thunderbird | awk '{print $1}'").read()
if thunderbird == 'thunderbird\n':
self.thubox.pack_end(self.installedlabel10, False, False, 0)
if check_if_app_is_installed("thunderbird"):
self.thubox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.thubox.pack_end(self.thubutton, False, False, 0)
@@ -320,7 +313,7 @@ class MyWindow(Gtk.Window):
self.trabox.pack_start(self.tralabel, True, True, 0)
self.page1.pack_start(self.trabox, True, True, 0)
self.traimage = Gtk.Image()
self.traimage.set_from_file(icon_path + 'transmission.svg')
self.traimage.set_from_file(f'{icon_path}transmission.svg')
self.trabox.pack_start(self.traimage, True, True, 0)
self.tradesc = Gtk.Label("Popular GTK\nTorrent\nDownload Tool")
self.trabox.pack_start(self.tradesc, True, True, 0)
@@ -330,10 +323,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel11 = Gtk.Label("Installed")
transmission = os.popen("pacman -Q transmission-gtk | awk '{print $1}'").read()
if transmission == 'transmission-gtk\n':
self.trabox.pack_end(self.installedlabel11, False, False, 0)
if check_if_app_is_installed("transmission"):
self.trabox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.trabox.pack_end(self.trabutton, False, False, 0)
@@ -345,7 +336,7 @@ class MyWindow(Gtk.Window):
self.qbibox.pack_start(self.qbilabel, True, True, 0)
self.page1.pack_start(self.qbibox, True, True, 0)
self.qbiimage = Gtk.Image()
self.qbiimage.set_from_file(qicon_path + 'qbittorrent.svg')
self.qbiimage.set_from_file(f'{qicon_path}qbittorrent.svg')
self.qbibox.pack_start(self.qbiimage, True, True, 0)
self.qbidesc = Gtk.Label("QT Based\nBit Torrent\nClient")
self.qbibox.pack_start(self.qbidesc, True, True, 0)
@@ -355,10 +346,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabe12 = Gtk.Label("Installed")
qbittorrent = os.popen("pacman -Q qbittorrent | awk '{print $1}'").read()
if qbittorrent == 'qbittorrent\n':
self.qbibox.pack_end(self.installedlabe12, False, False, 0)
if check_if_app_is_installed("qbittorrent"):
self.qbibox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.qbibox.pack_end(self.qbibutton, False, False, 0)
@@ -370,7 +359,7 @@ class MyWindow(Gtk.Window):
self.hexbox.pack_start(self.hexlabel, True, True, 0)
self.page1.pack_start(self.hexbox, True, True, 0)
self.heximage = Gtk.Image()
self.heximage.set_from_file(icon_path + 'deluge.svg')
self.heximage.set_from_file(f'{icon_path}deluge.svg')
self.hexbox.pack_start(self.heximage, True, True, 0)
self.hexdesc = Gtk.Label("Popular\nMulti-Platform\nChat Client")
self.hexbox.pack_start(self.hexdesc, True, True, 0)
@@ -380,10 +369,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel13 = Gtk.Label("Installed")
hexchat = os.popen("pacman -Q hexchat | awk '{print $1}'").read()
if hexchat == 'hexchat\n':
self.hexbox.pack_end(self.installedlabel13, False, False, 0)
if check_if_app_is_installed("hexchat"):
self.hexbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.hexbox.pack_end(self.hexbutton, False, False, 0)
@@ -402,7 +389,7 @@ class MyWindow(Gtk.Window):
self.gimpbox.pack_start(self.gimplabel, True, True, 0)
self.page2.pack_start(self.gimpbox, True, True, 0)
self.gimpimage = Gtk.Image()
self.gimpimage.set_from_file(icon_path + 'gimp.svg')
self.gimpimage.set_from_file(f'{icon_path}gimp.svg')
self.gimpbox.pack_start(self.gimpimage, True, True, 0)
self.gimpdesc = Gtk.Label("Powerful\nOpen Source\nImage Manipulation\nProgram")
self.gimpbox.pack_start(self.gimpdesc, True, True, 0)
@@ -412,10 +399,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel14 = Gtk.Label("Installed")
gimp = os.popen("pacman -Q gimp | awk '{print $1}'").read()
if gimp == 'gimp\n':
self.gimpbox.pack_end(self.installedlabel14, False, False, 0)
if check_if_app_is_installed("gimp"):
self.gimpbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.gimpbox.pack_end(self.gimpbutton, False, False, 0)
@@ -427,7 +412,7 @@ class MyWindow(Gtk.Window):
self.vlcbox.pack_start(self.vlclabel, True, True, 0)
self.page2.pack_start(self.vlcbox, True, True, 0)
self.vlcimage = Gtk.Image()
self.vlcimage.set_from_file(qicon_path + 'vlc.svg')
self.vlcimage.set_from_file(f'{qicon_path}vlc.svg')
self.vlcbox.pack_start(self.vlcimage, True, True, 0)
self.vlcdesc = Gtk.Label("Popular\nOpen Source\nMultimedia Player")
self.vlcbox.pack_start(self.vlcdesc, True, True, 0)
@@ -437,10 +422,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel15 = Gtk.Label("Installed")
vlc = os.popen("pacman -Q vlc | awk '{print $1}'").read()
if vlc == 'vlc\n':
self.vlcbox.pack_end(self.installedlabel15, False, False, 0)
if check_if_app_is_installed("vlc"):
self.vlcbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.vlcbox.pack_end(self.vlcbutton, False, False, 0)
@@ -452,7 +435,7 @@ class MyWindow(Gtk.Window):
self.totembox.pack_start(self.totemlabel, True, True, 0)
self.page2.pack_start(self.totembox, True, True, 0)
self.totemimage = Gtk.Image()
self.totemimage.set_from_file(icon_path + 'totem.svg')
self.totemimage.set_from_file(f'{icon_path}totem.svg')
self.totembox.pack_start(self.totemimage, True, True, 0)
self.totemdesc = Gtk.Label("Popular\nOpen Source\nMedia Player")
self.totembox.pack_start(self.totemdesc, True, True, 0)
@@ -462,10 +445,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel16 = Gtk.Label("Installed")
totem = os.popen("pacman -Q totem | awk '{print $1}'").read()
if totem == 'totem\n':
self.totembox.pack_end(self.installedlabel16, False, False, 0)
if check_if_app_is_installed("totem"):
self.totembox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.totembox.pack_end(self.totembutton, False, False, 0)
@@ -477,7 +458,7 @@ class MyWindow(Gtk.Window):
self.parbox.pack_start(self.parlabel, True, True, 0)
self.page2.pack_start(self.parbox, True, True, 0)
self.parimage = Gtk.Image()
self.parimage.set_from_file(icon_path + 'parole.svg')
self.parimage.set_from_file(f'{icon_path}parole.svg')
self.parbox.pack_start(self.parimage, True, True, 0)
self.pardesc = Gtk.Label("Popular\nOpen Source\nMedia Player")
self.parbox.pack_start(self.pardesc, True, True, 0)
@@ -487,10 +468,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel17 = Gtk.Label("Installed")
parole = os.popen("pacman -Q parole | awk '{print $1}'").read()
if parole == 'parole\n':
self.parbox.pack_end(self.installedlabel17, False, False, 0)
if check_if_app_is_installed("parole"):
self.parbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.parbox.pack_end(self.parbutton, False, False, 0)
@@ -501,7 +480,7 @@ class MyWindow(Gtk.Window):
self.audbox.pack_start(self.audlabel, True, True, 0)
self.page2.pack_start(self.audbox, True, True, 0)
self.audimage = Gtk.Image()
self.audimage.set_from_file(icon_path + 'audacious.svg')
self.audimage.set_from_file(f'{icon_path}audacious.svg')
self.audbox.pack_start(self.audimage, True, True, 0)
self.auddesc = Gtk.Label("Popular\nMusic Player\nand Utility")
self.audbox.pack_start(self.auddesc, True, True, 0)
@@ -511,10 +490,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel19 = Gtk.Label("Installed")
audacious = os.popen("pacman -Q audacious | awk '{print $1}'").read()
if audacious == 'audacious\n':
self.audbox.pack_end(self.installedlabel19, False, False, 0)
if check_if_app_is_installed("audacious"):
self.audbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.audbox.pack_end(self.audbutton, False, False, 0)
@@ -526,7 +503,7 @@ class MyWindow(Gtk.Window):
self.clebox.pack_start(self.clelabel, True, True, 0)
self.page2.pack_start(self.clebox, True, True, 0)
self.cleimage = Gtk.Image()
self.cleimage.set_from_file(icon_path + 'clementine.svg')
self.cleimage.set_from_file(f'{icon_path}clementine.svg')
self.clebox.pack_start(self.cleimage, True, True, 0)
self.cledesc = Gtk.Label("Popular GTK\nMusic Player\nAnd Music\nUtility")
self.clebox.pack_start(self.cledesc, True, True, 0)
@@ -536,10 +513,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel20 = Gtk.Label("Installed")
clementine = os.popen("pacman -Q clementine | awk '{print $1}'").read()
if clementine == 'clementine\n':
self.clebox.pack_end(self.installedlabel20, False, False, 0)
if check_if_app_is_installed("clementine"):
self.clebox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.clebox.pack_end(self.clebutton, False, False, 0)
@@ -551,7 +526,7 @@ class MyWindow(Gtk.Window):
self.gthbox.pack_start(self.gthlabel, True, True, 0)
self.page2.pack_start(self.gthbox, True, True, 0)
self.gthimage = Gtk.Image()
self.gthimage.set_from_file(icon_path + 'gthumb.svg')
self.gthimage.set_from_file(f'{icon_path}gthumb.svg')
self.gthbox.pack_start(self.gthimage, True, True, 0)
self.gthdesc = Gtk.Label("Popular GTK\nImage Viewer\nAnd Image\nUtility")
self.gthbox.pack_start(self.gthdesc, True, True, 0)
@@ -561,10 +536,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel21 = Gtk.Label("Installed")
gthumb = os.popen("pacman -Q gthumb | awk '{print $1}'").read()
if gthumb == 'gthumb\n':
self.gthbox.pack_end(self.installedlabel21, False, False, 0)
if check_if_app_is_installed("gthumb"):
self.gthbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.gthbox.pack_end(self.gthbutton, False, False, 0)
@@ -576,7 +549,7 @@ class MyWindow(Gtk.Window):
self.shobox.pack_start(self.sholabel, True, True, 0)
self.page2.pack_start(self.shobox, True, True, 0)
self.shoimage = Gtk.Image()
self.shoimage.set_from_file(icon_path + 'shotwell.svg')
self.shoimage.set_from_file(f'{icon_path}shotwell.svg')
self.shobox.pack_start(self.shoimage, True, True, 0)
self.shodesc = Gtk.Label("Image Utility\nand Viewer")
self.shobox.pack_start(self.shodesc, True, True, 0)
@@ -586,10 +559,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel22 = Gtk.Label("Installed")
shotwell = os.popen("pacman -Q shotwell | awk '{print $1}'").read()
if shotwell == 'shotwell\n':
self.shobox.pack_end(self.installedlabel22, False, False, 0)
if check_if_app_is_installed("shotwell"):
self.shobox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.shobox.pack_end(self.shobutton, False, False, 0)
@@ -601,7 +572,7 @@ class MyWindow(Gtk.Window):
self.risbox.pack_start(self.rislabel, True, True, 0)
self.page2.pack_start(self.risbox, True, True, 0)
self.risimage = Gtk.Image()
self.risimage.set_from_file(icon_path + 'ristretto.svg')
self.risimage.set_from_file(f'{icon_path}ristretto.svg')
self.risbox.pack_start(self.risimage, True, True, 0)
self.risdesc = Gtk.Label("Music Utility\nand Player")
self.risbox.pack_start(self.risdesc, True, True, 0)
@@ -611,10 +582,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel23 = Gtk.Label("Installed")
ristretto = os.popen("pacman -Q ristretto | awk '{print $1}'").read()
if ristretto == 'ristretto\n':
self.risbox.pack_end(self.installedlabel23, False, False, 0)
if check_if_app_is_installed("ristretto"):
self.risbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.risbox.pack_end(self.risbutton, False, False, 0)
@@ -626,7 +595,7 @@ class MyWindow(Gtk.Window):
self.gpibox.pack_start(self.gpilabel, True, True, 0)
self.page2.pack_start(self.gpibox, True, True, 0)
self.gpiimage = Gtk.Image()
self.gpiimage.set_from_file(icon_path + 'gpicview.svg')
self.gpiimage.set_from_file(f'{icon_path}gpicview.svg')
self.gpibox.pack_start(self.gpiimage, True, True, 0)
self.gpidesc = Gtk.Label("GTK Photo\nManager and\nViewer")
self.gpibox.pack_start(self.gpidesc, True, True, 0)
@@ -636,10 +605,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel24 = Gtk.Label("Installed")
gpicview = os.popen("pacman -Q gpicview | awk '{print $1}'").read()
if gpicview == 'gpicview\n':
self.gpibox.pack_end(self.installedlabel24, False, False, 0)
if check_if_app_is_installed("gpicview"):
self.gpibox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.gpibox.pack_end(self.gpibutton, False, False, 0)
@@ -651,7 +618,7 @@ class MyWindow(Gtk.Window):
self.adybox.pack_start(self.adylabel, True, True, 0)
self.page2.pack_start(self.adybox, True, True, 0)
self.adyimage = Gtk.Image()
self.adyimage.set_from_file(icon_path + 'audacity.svg')
self.adyimage.set_from_file(f'{icon_path}audacity.svg')
self.adybox.pack_start(self.adyimage, True, True, 0)
self.adydesc = Gtk.Label("Music File\nConfiguration")
self.adybox.pack_start(self.adydesc, True, True, 0)
@@ -661,10 +628,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel25 = Gtk.Label("Installed")
audicity = os.popen("pacman -Q audacity | awk '{print $1}'").read()
if audicity == 'audacity\n':
self.adybox.pack_end(self.installedlabel25, False, False, 0)
if check_if_app_is_installed("audicity"):
self.adybox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.adybox.pack_end(self.adybutton, False, False, 0)
@@ -676,7 +641,7 @@ class MyWindow(Gtk.Window):
self.ssrbox.pack_start(self.ssrlabel, True, True, 0)
self.page2.pack_start(self.ssrbox, True, True, 0)
self.ssrimage = Gtk.Image()
self.ssrimage.set_from_file(icon_path + 'simple-ccsm.svg')
self.ssrimage.set_from_file(f'{icon_path}simple-ccsm.svg')
self.ssrbox.pack_start(self.ssrimage, True, True, 0)
self.ssrdesc = Gtk.Label("Excellent Screen\nCapturing App")
self.ssrbox.pack_start(self.ssrdesc, True, True, 0)
@@ -686,10 +651,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel26 = Gtk.Label("Installed")
ssr = os.popen("pacman -Q simplescreenrecorder | awk '{print $1}'").read()
if ssr == 'simplescreenrecorder\n':
self.ssrbox.pack_end(self.installedlabel26, False, False, 0)
if check_if_app_is_installed("ssr"):
self.ssrbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.ssrbox.pack_end(self.ssrbutton, False, False, 0)
@@ -701,7 +664,7 @@ class MyWindow(Gtk.Window):
self.kdebox.pack_start(self.kdelabel, True, True, 0)
self.page2.pack_start(self.kdebox, True, True, 0)
self.kdeimage = Gtk.Image()
self.kdeimage.set_from_file(qicon_path + 'kdenlive.svg')
self.kdeimage.set_from_file(f'{qicon_path}kdenlive.svg')
self.kdebox.pack_start(self.kdeimage, True, True, 0)
self.kdedesc = Gtk.Label("Excellent Video\nEditing App")
self.kdebox.pack_start(self.kdedesc, True, True, 0)
@@ -711,10 +674,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel27 = Gtk.Label("Installed")
kdenlive = os.popen("pacman -Q kdenlive | awk '{print $1}'").read()
if kdenlive == 'kdenlive\n':
self.kdebox.pack_end(self.installedlabel27, False, False, 0)
if check_if_app_is_installed("kdenlive"):
self.kdebox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.kdebox.pack_end(self.kdebutton, False, False, 0)
@@ -736,10 +697,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel28 = Gtk.Label("Installed")
obs = os.popen("pacman -Q obs-studio | awk '{print $1}'").read()
if obs == 'obs-studio\n':
self.obsbox.pack_end(self.installedlabel28, False, False, 0)
if check_if_app_is_installed("obs"):
self.obsbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.obsbox.pack_end(self.obsbutton, False, False, 0)
@@ -750,7 +709,7 @@ class MyWindow(Gtk.Window):
self.kodbox.pack_start(self.kodlabel, True, True, 0)
self.page2.pack_start(self.kodbox, True, True, 0)
self.kodimage = Gtk.Image()
self.kodimage.set_from_file(icon_path + 'kmplayer.svg')
self.kodimage.set_from_file(f'{icon_path}kmplayer.svg')
self.kodbox.pack_start(self.kodimage, True, True, 0)
self.koddesc = Gtk.Label("Kodi Media Suite")
self.kodbox.pack_start(self.koddesc, True, True, 0)
@@ -759,10 +718,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel40 = Gtk.Label("Installed")
kodi = os.popen("pacman -Q kodi | awk '{print $1}'").read()
if kodi == 'kodi\n':
self.kodbox.pack_end(self.installedlabel40, False, False, 0)
if check_if_app_is_installed("kodi"):
self.kodbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.kodbox.pack_end(self.kodbutton, False, False, 0)
@@ -781,7 +738,7 @@ class MyWindow(Gtk.Window):
self.libpbox.pack_start(self.libplabel, True, True, 0)
self.page3.pack_start(self.libpbox, False, False, 0)
self.libpimage = Gtk.Image()
self.libpimage.set_from_file(icon_path + 'libreoffice-base.svg')
self.libpimage.set_from_file(f'{icon_path}libreoffice-base.svg')
self.libpbox.pack_start(self.libpimage, True, True, 0)
self.libpdesc = Gtk.Label("Powerful Open Source Office Suite")
self.libpbox.pack_start(self.libpdesc, True, True, 0)
@@ -791,10 +748,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel29 = Gtk.Label("Installed")
libre = os.popen("pacman -Q libreoffice-fresh | awk '{print $1}'").read()
if libre == 'libreoffice-fresh\n':
self.libpbox.pack_end(self.installedlabel29, False, False, 0)
if check_if_app_is_installed("libreoffice-fresh"):
self.libpbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.libpbox.pack_end(self.libpbutton, False, False, 0)
@@ -805,7 +760,7 @@ class MyWindow(Gtk.Window):
self.libspbox.pack_start(self.libsplabel, True, True, 0)
self.page3.pack_start(self.libspbox, False, False, 0)
self.libspimage = Gtk.Image()
self.libspimage.set_from_file(icon_path + 'libreoffice-base.svg')
self.libspimage.set_from_file(f'{icon_path}libreoffice-base.svg')
self.libspbox.pack_start(self.libspimage, True, True, 0)
self.libspdesc = Gtk.Label("Powerful Open Source Office Suite (Still)")
self.libspbox.pack_start(self.libspdesc, True, True, 0)
@@ -815,10 +770,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel29 = Gtk.Label("Installed")
libsre = os.popen("pacman -Q libreoffice-still | awk '{print $1}'").read()
if libsre == 'libreoffice-still\n':
self.libspbox.pack_end(self.installedlabel29, False, False, 0)
if check_if_app_is_installed("libreoffice-still"):
self.libspbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.libspbox.pack_end(self.libspbutton, False, False, 0)
@@ -830,7 +783,7 @@ class MyWindow(Gtk.Window):
self.calbox.pack_start(self.callabel, True, True, 0)
self.page3.pack_start(self.calbox, False, False, 0)
self.calimage = Gtk.Image()
self.calimage.set_from_file(qicon_path + 'calligrawords.svg')
self.calimage.set_from_file(f'{qicon_path}calligrawords.svg')
self.calbox.pack_start(self.calimage, True, True, 0)
self.caldesc = Gtk.Label("QT Based Office Suite")
self.calbox.pack_start(self.caldesc, True, True, 0)
@@ -840,10 +793,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel30 = Gtk.Label("Installed")
calligra = os.popen("pacman -Q calligra | awk '{print $1}'").read()
if calligra == 'calligra\n':
self.calbox.pack_end(self.installedlabel30, False, False, 0)
if check_if_app_is_installed("calligra"):
self.calbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.calbox.pack_end(self.calbutton, False, False, 0)
@@ -855,7 +806,7 @@ class MyWindow(Gtk.Window):
self.abibox.pack_start(self.abilabel, True, True, 0)
self.page3.pack_start(self.abibox, False, False, 0)
self.abiimage = Gtk.Image()
self.abiimage.set_from_file(icon_path + 'abiword.svg')
self.abiimage.set_from_file(f'{icon_path}abiword.svg')
self.abibox.pack_start(self.abiimage, True, True, 0)
self.abidesc = Gtk.Label("Lightweight Word Processor")
self.abibox.pack_start(self.abidesc, True, True, 0)
@@ -865,10 +816,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel31 = Gtk.Label("Installed")
abiword = os.popen("pacman -Q abiword | awk '{print $1}'").read()
if abiword == 'abiword\n':
self.abibox.pack_end(self.installedlabel31, False, False, 0)
if check_if_app_is_installed("abiword"):
self.abibox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.abibox.pack_end(self.abibutton, False, False, 0)
@@ -880,7 +829,8 @@ class MyWindow(Gtk.Window):
self.gnubox.pack_start(self.gnulabel, True, True, 0)
self.page3.pack_start(self.gnubox, False, False, 0)
self.gnuimage = Gtk.Image()
self.gnuimage.set_from_file(icon_path + 'gnumeric.svg')
# avoid using (+ concatenation) as is slow and has to create a extra object in memory. use String Interpolation instead ( f'hello {world}' )
self.gnuimage.set_from_file(f'{icon_path}gnumeric.svg')
self.gnubox.pack_start(self.gnuimage, True, True, 0)
self.gnudesc = Gtk.Label("Lightweight Spreadsheet Program")
self.gnubox.pack_start(self.gnudesc, True, True, 0)
@@ -890,10 +840,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel32 = Gtk.Label("Installed")
gnumeric = os.popen("pacman -Q gnumeric | awk '{print $1}'").read()
if gnumeric == 'gnumeric\n':
self.gnubox.pack_end(self.installedlabel32, False, False, 0)
if check_if_app_is_installed("gnumeric"):
self.gnubox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.gnubox.pack_end(self.gnubutton, False, False, 0)
@@ -905,7 +853,7 @@ class MyWindow(Gtk.Window):
self.pdfbox.pack_start(self.pdflabel, True, True, 0)
self.page3.pack_start(self.pdfbox, False, False, 0)
self.pdfimage = Gtk.Image()
self.pdfimage.set_from_file(icon_path + 'leafpad.svg')
self.pdfimage.set_from_file(f'{icon_path}leafpad.svg')
self.pdfbox.pack_start(self.pdfimage, True, True, 0)
self.pdfdesc = Gtk.Label("Powerful PDF Managment Software")
self.pdfbox.pack_start(self.pdfdesc, True, True, 0)
@@ -915,10 +863,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel33 = Gtk.Label("Installed")
pdfmod = os.popen("pacman -Q pdfmod | awk '{print $1}'").read()
if pdfmod == 'pdfmod\n':
self.pdfbox.pack_end(self.installedlabel33, False, False, 0)
if check_if_app_is_installed("pdfmod"):
self.pdfbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.pdfbox.pack_end(self.pdfbutton, False, False, 0)
@@ -930,7 +876,7 @@ class MyWindow(Gtk.Window):
self.evibox.pack_start(self.evilabel, True, True, 0)
self.page3.pack_start(self.evibox, False, False, 0)
self.eviimage = Gtk.Image()
self.eviimage.set_from_file(icon_path + 'evince.svg')
self.eviimage.set_from_file(f'{icon_path}evince.svg')
self.evibox.pack_start(self.eviimage, True, True, 0)
self.evidesc = Gtk.Label("Simple PDF Viewer")
self.evibox.pack_start(self.evidesc, True, True, 0)
@@ -940,10 +886,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel34 = Gtk.Label("Installed")
evince = os.popen("pacman -Q evince | awk '{print $1}'").read()
if evince == 'evince\n':
self.evibox.pack_end(self.installedlabel34, False, False, 0)
if check_if_app_is_installed("evince"):
self.evibox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.evibox.pack_end(self.evibutton, False, False, 0)
@@ -955,7 +899,7 @@ class MyWindow(Gtk.Window):
self.calbox.pack_start(self.callabel, True, True, 0)
self.page3.pack_start(self.calbox, False, False, 0)
self.calimage = Gtk.Image()
self.calimage.set_from_file(qicon_path + 'calibre-viewer.svg')
self.calimage.set_from_file(f'{qicon_path}calibre-viewer.svg')
self.calbox.pack_start(self.calimage, True, True, 0)
self.caldesc = Gtk.Label("Popular E-Book Reader for the Desktop\nQT Based")
self.calbox.pack_start(self.caldesc, True, True, 0)
@@ -965,10 +909,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel35 = Gtk.Label("Installed")
calibre = os.popen("pacman -Q calibre | awk '{print $1}'").read()
if calibre == 'calibre\n':
self.calbox.pack_end(self.installedlabel35, False, False, 0)
if check_if_app_is_installed("calibre"):
self.calbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.calbox.pack_end(self.calbutton, False, False, 0)
@@ -980,7 +922,7 @@ class MyWindow(Gtk.Window):
self.fbrbox.pack_start(self.fbrlabel, True, True, 0)
self.page3.pack_start(self.fbrbox, False, False, 0)
self.fbrimage = Gtk.Image()
self.fbrimage.set_from_file(icon_path + 'office-address-book.svg')
self.fbrimage.set_from_file(f'{icon_path}office-address-book.svg')
self.fbrbox.pack_start(self.fbrimage, True, True, 0)
self.fbrdesc = Gtk.Label("Popular E-Book Reader for the Desktop\nGTK Based")
self.fbrbox.pack_start(self.fbrdesc, True, True, 0)
@@ -990,10 +932,8 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel36 = Gtk.Label("Installed")
fbreader = os.popen("pacman -Q fbreader | awk '{print $1}'").read()
if fbreader == 'fbreader\n':
self.fbrbox.pack_end(self.installedlabel36, False, False, 0)
if check_if_app_is_installed("fbreader"):
self.fbrbox.pack_end(Gtk.Label("Installed"), False, False, 0)
else:
self.fbrbox.pack_end(self.fbrbutton, False, False, 0)
@@ -1007,7 +947,10 @@ class MyWindow(Gtk.Window):
state = "on"
else:
state = "off"
if state is 'on':
# == operator compares the values of both the operands and checks for value equality.
# is operator checks whether both the operands refer to the same object or not.
# in this use case == is the right choice.
if state == 'on':
self.packages.append('chromium')
else:
self.packages.remove('chromium')
Loading