summaryrefslogtreecommitdiff
path: root/frontend/gui/sisyphus-gui.py
blob: 1cc4fb6b6044c1130e6c8583a27785b2fde5e120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/python3
import sys, subprocess
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

class Sisyphus(QtWidgets.QMainWindow):
    def __init__(self):
        super(Sisyphus, self).__init__()
        uic.loadUi('ui/sisyphus-gui.ui', self)
        self.centerOnScreen()
        self.show()

        self.package_search.clicked.connect(self.search_package)
        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):
        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()
        subprocess.Popen(['xterm', '-e', 'sisyphus', 'auto-install'] + pkgname.split())

    def uninstall_package(self):
        pkgname = self.input.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()

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = Sisyphus()
    sys.exit(app.exec_())