summaryrefslogtreecommitdiff
path: root/src/frontend/gui/sisyphus-gui.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/gui/sisyphus-gui.py')
-rwxr-xr-xsrc/frontend/gui/sisyphus-gui.py123
1 files changed, 46 insertions, 77 deletions
diff --git a/src/frontend/gui/sisyphus-gui.py b/src/frontend/gui/sisyphus-gui.py
index 1cc4fb6..800dfad 100755
--- a/src/frontend/gui/sisyphus-gui.py
+++ b/src/frontend/gui/sisyphus-gui.py
@@ -1,104 +1,73 @@
#!/usr/bin/python3
-import sys, subprocess
+import sys, subprocess, sqlite3
from PyQt5 import QtCore, QtGui, QtWidgets, uic
-
-from accesories import Accesories
-from development import Development
-from games import Games
-from graphics import Graphics
-from internet import Internet
-from multimedia import Multimedia
-from office import Office
-from system import System
-from local import Local
-from everything import Everything
+from libsisyphus import *
class Sisyphus(QtWidgets.QMainWindow):
def __init__(self):
super(Sisyphus, self).__init__()
uic.loadUi('ui/sisyphus-gui.ui', self)
+ self.refresh_database()
self.centerOnScreen()
self.show()
-
- self.package_search.clicked.connect(self.search_package)
+ self.load_packages()
+
self.package_install.clicked.connect(self.install_package)
self.package_uninstall.clicked.connect(self.uninstall_package)
- self.system_upgrade.clicked.connect(self.upgrade_system)
self.orphans_remove.clicked.connect(self.remove_orphans)
-
- self.category_accesories.clicked.connect(self.accesories_category)
- self.category_development.clicked.connect(self.development_category)
- self.category_games.clicked.connect(self.games_category)
- self.category_graphics.clicked.connect(self.graphics_category)
- self.category_internet.clicked.connect(self.internet_category)
- self.category_multimedia.clicked.connect(self.multimedia_category)
- self.category_office.clicked.connect(self.office_category)
- self.category_system.clicked.connect(self.system_category)
- self.category_local.clicked.connect(self.local_category)
- self.category_everything.clicked.connect(self.everything_category)
-
- def centerOnScreen (self):
+ self.system_upgrade.clicked.connect(self.upgrade_system)
+ self.sisyphus_exit.clicked.connect(self.exit_sisyphus)
+
+ def centerOnScreen(self):
resolution = QtWidgets.QDesktopWidget().screenGeometry()
self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
(resolution.height() / 2) - (self.frameSize().height() / 2))
-
- def search_package(self):
- pkgname = self.input.text()
- subprocess.Popen(['xterm', '-hold', '-e', 'sisyphus', 'search'] + pkgname.split())
-
+
def install_package(self):
- pkgname = self.input.text()
+ pkgname = self.table_everything.item(self.table_everything.currentRow(), 1).text()
subprocess.Popen(['xterm', '-e', 'sisyphus', 'auto-install'] + pkgname.split())
def uninstall_package(self):
- pkgname = self.input.text()
+ pkgname = self.table_everything.item(self.table_everything.currentRow(), 1).text()
subprocess.Popen(['xterm', '-e', 'sisyphus', 'auto-uninstall'] + pkgname.split())
- def upgrade_system(self):
- subprocess.Popen(['xterm', '-e', 'sisyphus', 'autoupgrade'])
-
def remove_orphans(self):
subprocess.Popen(['xterm', '-e', 'sisyphus', 'remove-orphans'])
- def accesories_category(self):
- self.window = Accesories()
- self.window.show()
-
- def development_category(self):
- self.window = Development()
- self.window.show()
-
- def games_category(self):
- self.window = Games()
- self.window.show()
-
- def graphics_category(self):
- self.window = Graphics()
- self.window.show()
-
- def internet_category(self):
- self.window = Internet()
- self.window.show()
-
- def multimedia_category(self):
- self.window = Multimedia()
- self.window.show()
-
- def office_category(self):
- self.window = Office()
- self.window.show()
-
- def system_category(self):
- self.window = System()
- self.window.show()
-
- def local_category(self):
- self.window = Local()
- self.window.show()
-
- def everything_category(self):
- self.window = Everything()
- self.window.show()
+ def upgrade_system(self):
+ subprocess.Popen(['xterm', '-e', 'sisyphus', 'auto-upgrade'])
+
+ def refresh_database(self):
+ sisyphus_pkg_system_update()
+
+ def exit_sisyphus(self):
+ self.close()
+
+ def load_packages(self):
+ with sqlite3.connect('/var/lib/sisyphus/db/sisyphus.db') as db:
+ cursor=db.cursor()
+ cursor.execute('''SELECT
+ a.category AS cat,
+ a.name AS pn,
+ a.version AS av,
+ i.version AS iv,
+ a.description AS descr
+ FROM remote_packages AS a
+ LEFT JOIN local_packages AS i
+ ON a.category = i.category
+ AND a.name = i.name
+ AND a.slot = i.slot
+ ''')
+ rows = cursor.fetchall()
+
+ for row in rows:
+ inx = rows.index(row)
+ self.table_everything.insertRow(inx)
+ self.table_everything.setItem(inx, 0, QtWidgets.QTableWidgetItem(row[0]))
+ self.table_everything.setItem(inx, 1, QtWidgets.QTableWidgetItem(row[1]))
+ self.table_everything.setItem(inx, 2, QtWidgets.QTableWidgetItem(row[2]))
+ self.table_everything.setItem(inx, 3, QtWidgets.QTableWidgetItem(row[3]))
+ self.table_everything.setItem(inx, 4, QtWidgets.QTableWidgetItem(row[4]))
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)