#!/usr/bin/python3 # This file is part of Peppermint Web Browser Manager. # # Zorin Web Browser Manager is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Oeooermint Web Browser Manager is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Zorin Web Browser Manager. If not, see . #(c) PeppermintOS 2015-2019 #(c) AZorin 2010-2015 #(c) Zorink 2010 # # Easily install and uninstall web browsers in Peppermint. # This is free software made available under the GNU public license. from PyQt5 import QtGui, QtCore, QtWidgets import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QLabel, QMainWindow from PyQt5.QtCore import pyqtSlot from PyQt5.QtGui import QIcon, QPixmap import requests import os from os import path import sys os.chdir('/tmp/') applogo = "/usr/share/pixmaps/browser-manager.svg" class BrowserManager(QMainWindow): def __init__(self): super().__init__() self.setWindowIcon(QtGui.QIcon(applogo)) self.title = "Web Browser Manager" self.width = 650 self.height = 380 self.initUI() def initUI(self): self.setWindowTitle(self.title) self.setGeometry(10, 10, self.width, self.height) self.setFixedSize(self.width, self.height) ##################### # Adding the buttons# ##################### # global uninstfirefox # global uninstchrome # global uninstopera # global uninstweb # global uninstvivaldi # global uninstchromium # global instfirefox # global instchrome # global instopera # global instweb # global instvivaldi # global instchromium global imgfx global imgcr global imgvi global imgch global imgop global imgbr global imgfa self.uninstfirefox = QPushButton("Uninstall", self) self.uninstfirefox.clicked.connect(self.on_uninstfirefox) self.uninstfirefox.setFixedSize(87, 30) self.uninstfirefox.move(30, 130) self.uninstfirefox.setToolTip("Uninstall Firefox") self.instfirefox = QPushButton("Install", self) self.instfirefox.clicked.connect(self.on_instfirefox) self.instfirefox.setFixedSize(87, 30) self.instfirefox.move(30, 130) self.instfirefox.setToolTip("Install Firefox") self.uninstchrome = QPushButton("Uninstall", self) self.uninstchrome.clicked.connect(self.on_uninstchrome) self.uninstchrome.setFixedSize(87, 30) self.uninstchrome.move(195, 130) self.uninstchrome.setToolTip("Uninstall Google Chrome") self.instchrome = QPushButton("Install", self) is_64bits = sys.maxsize > 2**32 if is_64bits == False: self.instchrome.setEnabled(False) self.instchrome.clicked.connect(self.on_instchrome) self.instchrome.setFixedSize(87, 30) self.instchrome.move(195, 130) self.instchrome.setToolTip("Install Google Chrome") if is_64bits == False: self.instchrome.setToolTip("Not Available in 32 Bit Peppermint") self.uninstweb = QPushButton("Uninstall", self) self.uninstweb.clicked.connect(self.on_uninstweb) self.uninstweb.setFixedSize(87, 30) self.uninstweb.move(360, 130) self.uninstweb.setToolTip("Uninstall Epiphany") self.instweb = QPushButton("Install", self) self.instweb.clicked.connect(self.on_instweb) self.instweb.setFixedSize(87, 30) self.instweb.move(360, 130) self.instweb.setToolTip("Install Epiphany") self.uninstvivaldi = QPushButton("Uninstall", self) self.uninstvivaldi.clicked.connect(self.on_uninstvivaldi) self.uninstvivaldi.setFixedSize(87, 30) self.uninstvivaldi.move(525, 130) self.uninstvivaldi.setToolTip("Uninstall Vivaldi") self.instvivaldi = QPushButton("Install", self) self.instvivaldi.clicked.connect(self.on_instvivaldi) self.instvivaldi.setFixedSize(87, 30) self.instvivaldi.move(525, 130) self.instvivaldi.setToolTip("Install Vivaldi") is_64bits = sys.maxsize > 2**32 if is_64bits == False: self.instvivaldi.setEnabled(False) self.instvivaldi.setToolTip("Not Available in 32 Bit Peppermint") self.uninstchromium = QPushButton("Uninstall", self) self.uninstchromium.clicked.connect(self.on_uninstchromium) self.uninstchromium.setFixedSize(87, 30) self.uninstchromium.move(525, 315) self.uninstchromium.setToolTip("Uninstall Chromium") self.instchromium = QPushButton("Install", self) self.instchromium.clicked.connect(self.on_instchromium) self.instchromium.setFixedSize(87, 30) self.instchromium.move(525, 315) self.instchromium.setToolTip("Install Chromium") self.uninstopera = QPushButton("Uninstall", self) self.uninstopera.clicked.connect(self.on_uninstopera) self.uninstopera.setFixedSize(87, 30) self.uninstopera.move(30, 315) self.uninstopera.setToolTip("Uninstall Opera") self.instopera = QPushButton("Install", self) self.instopera.clicked.connect(self.on_instopera) self.instopera.setFixedSize(87, 30) self.instopera.move(30, 315) self.instopera.setToolTip("Install Opera") is_64bits = sys.maxsize > 2**32 if is_64bits == False: self.instopera.setEnabled(False) self.instopera.setToolTip("Not Available in 32 Bit Peppermint") self.uninstbrave = QPushButton("Uninstall", self) self.uninstbrave.clicked.connect(self.on_uninstbrave) self.uninstbrave.setFixedSize(87, 30) self.uninstbrave.move(195, 315) self.uninstbrave.setToolTip("Uninstall Brave") self.instbrave = QPushButton("Install", self) self.instbrave.clicked.connect(self.on_instbrave) self.instbrave.setFixedSize(87, 30) self.instbrave.move(195, 315) self.instbrave.setToolTip("Install Brave") is_64bits = sys.maxsize > 2**32 if is_64bits == False: self.instbrave.setEnabled(False) self.instbrave.setToolTip("Not Available in 32 Bit Peppermint") self.uninstfalkon = QPushButton("Uninstall", self) self.uninstfalkon.clicked.connect(self.on_uninstfalkon) self.uninstfalkon.setFixedSize(87, 30) self.uninstfalkon.move(360, 315) self.uninstfalkon.setToolTip("Uninstall Falkon") self.instfalkon = QPushButton("Install", self) self.instfalkon.clicked.connect(self.on_instfalkon) self.instfalkon.setFixedSize(87, 30) self.instfalkon.move(360, 315) self.instfalkon.setToolTip("Install Falkon") close = QPushButton("Close", self) close.clicked.connect(self.on_close) close.setFixedSize(85, 30) close.move(720, 400) ############################ # Adding the program titles# ############################ firefoxlabel = QLabel("", self) chromelabel = QLabel("", self) weblabel = QLabel("", self) vivaldilabel = QLabel("", self) chromiumlabel = QLabel("", self) operalabel = QLabel("", self) bravelabel = QLabel("", self) falkonlabel = QLabel("", self) boldFont=QtGui.QFont() boldFont.setBold(True) firefoxlabel.setText("Firefox") firefoxlabel.setFont(boldFont) chromelabel.setText("Chrome") chromelabel.setFont(boldFont) weblabel.setText("Web") weblabel.setFont(boldFont) vivaldilabel.setText("Vivaldi") vivaldilabel.setFont(boldFont) chromiumlabel.setText("Chromium") chromiumlabel.setFont(boldFont) operalabel.setText("Opera") operalabel.setFont(boldFont) bravelabel.setText("Brave") bravelabel.setFont(boldFont) falkonlabel.setText("Falkon") falkonlabel.setFont(boldFont) firefoxlabel.move(48, 5) chromelabel.move(210, 5) weblabel.move(388, 5) vivaldilabel.move(543, 5) chromiumlabel.move(531, 190) operalabel.move(52, 190) bravelabel.move(218, 190) falkonlabel.move(380, 190) ################### # Adding the logos# ################### imgfx = '/usr/share/browser-manager/firefox/firefox.png' imgcr = '/usr/share/browser-manager/chrome/chrome.png' imgwe = "/usr/share/browser-manager/web/web.png" imgvi = '/usr/share/browser-manager/vivaldi/vivaldi.png' imgch = '/usr/share/browser-manager/chromium/chromium.png' imgop = '/usr/share/browser-manager/opera/opera.png' imgbr = '/usr/share/browser-manager/brave/brave.png' imgfa = '/usr/share/browser-manager/falkon/falkon.png' self.aboutfirefox = QPushButton('', self) self.aboutfirefox.clicked.connect(self.on_aboutfirefox) self.aboutfirefox.setIcon(QtGui.QIcon(imgfx)) self.aboutfirefox.setIconSize(QtCore.QSize(65, 65)) self.aboutfirefox.setFixedSize(75, 75) self.aboutfirefox.move(35, 35) self.aboutfirefox.setToolTip("About Firefox") self.aboutchrome = QPushButton('', self) self.aboutchrome.setIcon(QtGui.QIcon(imgcr)) self.aboutchrome.setIconSize(QtCore.QSize(65,65)) self.aboutchrome.clicked.connect(self.on_aboutchrome) self.aboutchrome.setFixedSize(75, 75) self.aboutchrome.move(200, 35) self.aboutchrome.setToolTip("About Google Chrome") self.aboutweb = QPushButton('', self) self.aboutweb.setIcon(QtGui.QIcon(imgwe)) self.aboutweb.setIconSize(QtCore.QSize(65,65)) self.aboutweb.clicked.connect(self.on_aboutweb) self.aboutweb.setFixedSize(75, 75) self.aboutweb.move(365, 35) self.aboutweb.setToolTip("About Web") self.aboutvivaldi = QPushButton('', self) self.aboutvivaldi.setIcon(QtGui.QIcon(imgvi)) self.aboutvivaldi.setIconSize(QtCore.QSize(65,65)) self.aboutvivaldi.clicked.connect(self.on_aboutvivaldi) self.aboutvivaldi.setFixedSize(75, 75) self.aboutvivaldi.move(530, 35) self.aboutvivaldi.setToolTip("About Vivaldi") self.aboutchromium = QPushButton('', self) self.aboutchromium.setIcon(QtGui.QIcon(imgch)) self.aboutchromium.setIconSize(QtCore.QSize(65,65)) self.aboutchromium.clicked.connect(self.on_aboutchromium) self.aboutchromium.setFixedSize(75, 75) self.aboutchromium.move(530, 220) self.aboutchromium.setToolTip("About Chromium") self.aboutopera = QPushButton('', self) self.aboutopera.setIcon(QtGui.QIcon(imgop)) self.aboutopera.setIconSize(QtCore.QSize(65,65)) self.aboutopera.clicked.connect(self.on_aboutopera) self.aboutopera.setFixedSize(75, 75) self.aboutopera.move(35, 220) self.aboutopera.setToolTip("About Opera") self.aboutbrave = QPushButton('', self) self.aboutbrave.setIcon(QtGui.QIcon(imgbr)) self.aboutbrave.setIconSize(QtCore.QSize(65,65)) self.aboutbrave.clicked.connect(self.on_aboutbrave) self.aboutbrave.setFixedSize(75, 75) self.aboutbrave.move(200, 220) self.aboutbrave.setToolTip("About Brave") self.aboutfalkon = QPushButton('', self) self.aboutfalkon.setIcon(QtGui.QIcon(imgfa)) self.aboutfalkon.setIconSize(QtCore.QSize(65,65)) self.aboutfalkon.clicked.connect(self.on_aboutfalkon) self.aboutfalkon.setFixedSize(75, 75) self.aboutfalkon.move(365, 220) self.aboutfalkon.setToolTip("About Falkon") self.on_refresh() self.show() ############################## # Defining the button actions# ############################## def on_refresh(self): if os.path.isfile("/usr/bin/firefox"): self.instfirefox.setVisible(False) self.uninstfirefox.setVisible(True) else: self.uninstfirefox.setVisible(False) self.instfirefox.setVisible(True) if os.path.isfile("/usr/bin/google-chrome"): self.instchrome.setVisible(False) self.uninstchrome.setVisible(True) else: self.uninstchrome.setVisible(False) self.instchrome.setVisible(True) if os.path.isfile("/usr/bin/epiphany-browser"): self.instweb.setVisible(False) self.uninstweb.setVisible(True) else: self.uninstweb.setVisible(False) self.instweb.setVisible(True) if os.path.isfile("/usr/bin/vivaldi"): self.instvivaldi.setVisible(False) self.uninstvivaldi.setVisible(True) else: self.uninstvivaldi.setVisible(False) self.instvivaldi.setVisible(True) if os.path.isfile("/usr/bin/chromium-browser"): self.instchromium.setVisible(False) self.uninstchromium.setVisible(True) else: self.uninstchromium.setVisible(False) self.instchromium.setVisible(True) if os.path.isfile("/usr/bin/opera"): self.instopera.setVisible(False) self.uninstopera.setVisible(True) else: self.uninstopera.setVisible(False) self.instopera.setVisible(True) if os.path.isfile("/usr/bin/brave-browser"): self.instbrave.setVisible(False) self.uninstbrave.setVisible(True) else: self.uninstbrave.setVisible(False) self.instbrave.setVisible(True) if os.path.isfile("/usr/bin/falkon"): self.instfalkon.setVisible(False) self.uninstfalkon.setVisible(True) else: self.uninstfalkon.setVisible(False) self.instfalkon.setVisible(True) def on_instfirefox(self, widget): try: os.system("pkexec /usr/share/browser-manager/firefox/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_instchrome(self, widget): try: os.system("pkexec /usr/share/browser-manager/chrome/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_instopera(self, widget): try: os.system("pkexec /usr/share/browser-manager/opera/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_instweb(self, widget): try: os.system("pkexec /usr/share/browser-manager/web/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_instvivaldi(self, widget): try: os.system("pkexec /usr/share/browser-manager/vivaldi/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_instchromium(self, widget): try: os.system("pkexec /usr/share/browser-manager/chromium/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_instbrave(self, widget): try: os.system("pkexec /usr/share/browser-manager/brave/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_instfalkon(self, widget): try: os.system("pkexec /usr/share/browser-manager/falkon/install") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstfirefox(self, widget): try: os.system("pkexec /usr/share/browser-manager/firefox/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstchrome(self, widget): try: os.system("pkexec /usr/share/browser-manager/chrome/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstopera(self, widget): try: os.system("pkexec /usr/share/browser-manager/opera/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstweb(self, widget): try: os.system("pkexec /usr/share/browser-manager/web/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstvivaldi(self, widget): try: os.system("pkexec /usr/share/browser-manager/vivaldi/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstchromium(self, widget): try: os.system("pkexec /usr/share/browser-manager/chromium/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstbrave(self, widget): try: os.system("pkexec /usr/share/browser-manager/brave/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_uninstfalkon(self, widget): try: os.system("pkexec /usr/share/browser-manager/falkon/uninstall") except: QMessageBox.critical(self, " ", "An error has occured") self.on_refresh() def on_aboutfirefox(self, widget): QMessageBox.information(self, " ", "Firefox delivers safe\nand easy web browsing\nwith a familiar user\ninterface, thousands of\nplugins, and integrated\nsearch that lets you get\nthe most out of the web.") def on_aboutchrome(self, widget): QMessageBox.information(self, " ", "Google Chrome is an web\nbrowser project backed\nby Google that aims to\nbuild a safer, faster,\nand more stable way for\nall Internet users to\nexperience the web.") def on_aboutweb(self, widget): QMessageBox.information(self, " ", "Web is the WebKit based\nweb browser for GNOME.\nIt offers a simple, clean,\nbeautiful view of the Web.\nIts principles are simplicity\nand standards compliance.") pass def on_aboutvivaldi(self, widget): QMessageBox.information(self, " ", "Vivaldi is a freeware web browser developed by Vivaldi Technologies,\na company founded by former Opera Software cofounder and CEO Jon Stephenson von Tetzchner.\nThe browser is aimed at staunch technologists, heavy Internet users,\nand previous Opera web browser users disgruntled by Opera's transition from the Presto layout engine to the Blink layout engine,\nwhich removed many popular features in the process. Vivaldi aims to revive the old, popular features of Opera 12 and introduce new,\nmore innovative ones. The browser is updated weekly and has gained popularity since the launch of its first technical preview.") pass def on_aboutchromium(self, widget): QMessageBox.information(self, " ", "Chromium is the open source brother of Google Chrome, also being mainly made by Google.\nIt shares a lot of the GUI that Google Chrome has, but with an alternative logo and some other features missing such as codecs being pre-installed,\nand so on.") pass def on_aboutopera(self, widget): QMessageBox.information(self, " ", "Opera is another freeware browser, being developed by Opera. The browser is built on the Blink Engine, and is designed to be feature\nrich, having built-in features such as an Ad Blocker, VPN, Battery Saver, and so on, all included with the browser.") pass def on_aboutbrave(self, widget): QMessageBox.information(self, " ", "Brave is yet another freeware browser based on the Chromium codebase, and Blink Engine. Brave is open-source, and is designed to block Ads and Website Trackers by default, with a Donate to Support Your Favourite Websites mindset.") pass def on_aboutfalkon(self, widget): QMessageBox.information(self, " ", "Falkon is KDE's browser, which has a lot of Firefox's old design traits, a familiar look and feel, pre-built-in AdBlocker, and everything else you'd expect to see from a browser in the modern age. It's still a solid choice of browser, young as it may be.") pass def on_close(self, event): self.close() app = QApplication(sys.argv) ex = BrowserManager() sys.exit(app.exec_())