Use icons from theme and don't ask confirmation if the user refuses

Fixes icons after oxygen moved from kde to default system path.
This commit is contained in:
Silvan Calarco 2015-10-23 23:09:38 +02:00
parent 6a380bd20d
commit dbabd9408d

View File

@ -9,13 +9,13 @@ from PyQt4 import QtGui, QtCore #---: 2 -> percorso licenza sbagliato o n
# Decisione presa in run-time
desktop_session = QtCore.QString(os.getenv('DESKTOP_SESSION')) # Codice preso da mambatray
if (desktop_session == 'default') or (desktop_session.left(3) == 'kde'): # Scelgo le icone di kde
imgAccetto = "/opt/kde/share/icons/oxygen/32x32/actions/dialog-ok-apply.png"
imgRifiuto = "/opt/kde/share/icons/oxygen/32x32/actions/dialog-close.png"
imgForm = "/opt/kde/share/icons/oxygen/32x32/mimetypes/text-rtf.png"
imgAccetto = "dialog-ok-apply"
imgRifiuto = "dialog-close"
imgForm = "text-rtf"
else: # In alternativa quelle di gnome
imgAccetto = "/usr/share/icons/gnome/32x32/emblems/emblem-default.png"
imgRifiuto = "/usr/share/icons/gnome/32x32/actions/gtk-stop.png"
imgForm = "/usr/share/icons/gnome/32x32/mimetypes/document.png"
imgAccetto = "emblem-default"
imgRifiuto = "gtk-stop"
imgForm = "document"
def usage():
@ -67,16 +67,16 @@ class Form(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent)
self.setWindowTitle(_("Licenze"))
self.setWindowIcon(QtGui.QIcon(imgForm))
self.setWindowIcon(QtGui.QIcon.fromTheme(imgForm))
self.resize(500, 400)
center(self)
QtGui.QToolTip.setFont(QtGui.QFont('sans', 10))
btnAccetto = QtGui.QPushButton(QtGui.QIcon(imgAccetto), _("I agree"))
btnAccetto = QtGui.QPushButton(QtGui.QIcon.fromTheme(imgAccetto), _("I agree"))
btnAccetto.setToolTip(_("Click here if you want to accept the license"))
self.connect(btnAccetto, QtCore.SIGNAL('clicked()'), evtAccetto)
btnRifiuto = QtGui.QPushButton(QtGui.QIcon(imgRifiuto), _("I do not agree"))
btnRifiuto = QtGui.QPushButton(QtGui.QIcon.fromTheme(imgRifiuto), _("I do not agree"))
btnRifiuto.setToolTip(_("Click here if you do <b>not</b> want to accept the license"))
self.connect(btnRifiuto, QtCore.SIGNAL('clicked()'), evtRifiuto)
@ -84,8 +84,6 @@ class Form(QtGui.QWidget):
licenza.setReadOnly(True)
licenza.setPlainText(txt)
grid = QtGui.QGridLayout()
grid.setSpacing(10)
@ -108,9 +106,9 @@ def evtAccetto():
def evtRifiuto():
#mostra un messaggio:
msg = QtGui.QMessageBox.question(form, _("Message"), _("Are you sure to refuse?"), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)
if msg == QtGui.QMessageBox.Yes:
sys.exit(1)
#msg = QtGui.QMessageBox.question(form, _("Message"), _("Are you sure to refuse?"), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)
#if msg == QtGui.QMessageBox.Yes:
sys.exit(1)
#crea la finestra di dialogo
@ -118,4 +116,3 @@ app = QtGui.QApplication(sys.argv)
form = Form()
form.show()
sys.exit(app.exec_())