interface.py
1.77 KB
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
#!/usr/bin/python3
import sys
import configuracion as config
from LIBs import archivos, tray
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from PyQt5.QtGui import QIcon
from PyQt5 import QtGui
class App(QWidget):
def __init__(self):
super().__init__()
self.title = 'PyQt5 button - pythonspot.com'
self.left = 10
self.top = 10
self.width = 120
self.height = 200
self.ordenV = 0
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.show()
self.GenerarBotones()
self.setWindowIcon(QtGui.QIcon('IMG/Browser.png'))
self.hide()
def GenerarBotones(self):
n = 0
for conf in config.nabegadores:
self.constructor(conf["nombre"], n)
n += 1
def button_pushed(self, id):
nab = config.nabegadores[id]
try:
comando = "bash Proxy.sh {} {} {} {} {}".format(nab["SSHpass"],
nab["SSHuser"], nab["SSHport"], nab["SSHprox"], nab["SSHdom"])
except:
comando = "google-chrome"
comando = "{} --user-data-dir={}".format(comando, nab["CARPETA"])
try:
comando = "{} {}".format(comando, nab["HOME"])
except:
pass
print(comando)
archivos.ejecutar(self, comando)
self.hide()
def constructor(self, name, id):
self.ordenV += 25
button1 = QPushButton(str(name), self)
button1.move(10, self.ordenV)
button1.clicked.connect(lambda x:self.button_pushed(id))
button1.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = App()
tray.iniciar(ex, ex, ex)
sys.exit(app.exec_())