|
|
24f428 |
From 96937b7fdecb34597b06138d800f9a18100abbec Mon Sep 17 00:00:00 2001
|
|
|
24f428 |
From: Eric Garver <e@erig.me>
|
|
|
24f428 |
Date: Wed, 14 Nov 2018 12:59:57 -0500
|
|
|
24f428 |
Subject: [PATCH] fix qt4_applet patch
|
|
|
24f428 |
|
|
|
24f428 |
---
|
|
|
24f428 |
src/firewall-applet.in | 157 ++++++++++++++++++++---------------------
|
|
|
24f428 |
1 file changed, 78 insertions(+), 79 deletions(-)
|
|
|
24f428 |
|
|
|
24f428 |
diff --git a/src/firewall-applet.in b/src/firewall-applet.in
|
|
|
24f428 |
index 1d2cf7672174..05966ce1c80c 100755
|
|
|
24f428 |
--- a/src/firewall-applet.in
|
|
|
24f428 |
+++ b/src/firewall-applet.in
|
|
|
34791e |
@@ -21,14 +21,14 @@
|
|
|
34791e |
#
|
|
|
34791e |
|
|
|
34791e |
import sys
|
|
|
34791e |
-from PyQt5 import QtGui, QtCore, QtWidgets
|
|
|
34791e |
+from PyQt4 import QtGui, QtCore
|
|
|
34791e |
|
|
|
34791e |
import gi
|
|
|
34791e |
gi.require_version('Notify', '0.7')
|
|
|
34791e |
from gi.repository import Notify
|
|
|
34791e |
|
|
|
34791e |
import os
|
|
|
34791e |
-from dbus.mainloop.pyqt5 import DBusQtMainLoop
|
|
|
34791e |
+from dbus.mainloop.qt import DBusQtMainLoop
|
|
|
34791e |
import functools
|
|
|
34791e |
|
|
|
24f428 |
from firewall import config
|
|
|
24f428 |
@@ -78,20 +78,21 @@ def escape(text):
|
|
|
34791e |
return text
|
|
|
34791e |
|
|
|
34791e |
def fromUTF8(text):
|
|
|
34791e |
- if PY2 and QtCore.QT_VERSION < 0x050000:
|
|
|
34791e |
+ if PY2:
|
|
|
34791e |
return QtCore.QString.fromUtf8(text)
|
|
|
34791e |
- return text
|
|
|
34791e |
+ else:
|
|
|
34791e |
+ return text
|
|
|
34791e |
|
|
|
34791e |
# ZoneInterfaceEditor #########################################################
|
|
|
34791e |
|
|
|
34791e |
-class ZoneInterfaceEditor(QtWidgets.QDialog):
|
|
|
34791e |
+class ZoneInterfaceEditor(QtGui.QDialog):
|
|
|
34791e |
def __init__(self, fw, interface, zone):
|
|
|
34791e |
self.fw = fw
|
|
|
34791e |
self.interface = interface
|
|
|
34791e |
self.zone = None
|
|
|
34791e |
self.title = _("Select zone for interface '%s'") % self.interface
|
|
|
34791e |
|
|
|
34791e |
- QtWidgets.QDialog.__init__(self)
|
|
|
34791e |
+ QtGui.QDialog.__init__(self)
|
|
|
34791e |
self.create_ui(zone)
|
|
|
34791e |
|
|
|
34791e |
def create_ui(self, zone):
|
|
|
24f428 |
@@ -100,19 +101,19 @@ class ZoneInterfaceEditor(QtWidgets.QDialog):
|
|
|
34791e |
|
|
|
34791e |
self.resize(100, 50)
|
|
|
34791e |
|
|
|
34791e |
- vbox = QtWidgets.QVBoxLayout()
|
|
|
34791e |
+ vbox = QtGui.QVBoxLayout()
|
|
|
34791e |
vbox.setSpacing(6)
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel(fromUTF8(escape(self.title)))
|
|
|
34791e |
+ label = QtGui.QLabel(fromUTF8(escape(self.title)))
|
|
|
34791e |
vbox.addWidget(label)
|
|
|
34791e |
|
|
|
34791e |
- self.combo = QtWidgets.QComboBox()
|
|
|
34791e |
+ self.combo = QtGui.QComboBox()
|
|
|
34791e |
self.fill_zone_combo()
|
|
|
34791e |
vbox.addWidget(self.combo)
|
|
|
34791e |
|
|
|
34791e |
- buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok
|
|
|
34791e |
- | QtWidgets.QDialogButtonBox.Cancel)
|
|
|
34791e |
- self.ok_button = buttonBox.button(QtWidgets.QDialogButtonBox.Ok)
|
|
|
34791e |
+ buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok
|
|
|
34791e |
+ | QtGui.QDialogButtonBox.Cancel)
|
|
|
34791e |
+ self.ok_button = buttonBox.button(QtGui.QDialogButtonBox.Ok)
|
|
|
34791e |
buttonBox.accepted.connect(self.ok)
|
|
|
34791e |
buttonBox.rejected.connect(self.hide)
|
|
|
34791e |
vbox.addWidget(buttonBox)
|
|
|
24f428 |
@@ -165,7 +166,7 @@ class ZoneConnectionEditor(ZoneInterfaceEditor):
|
|
|
34791e |
self.zone = None
|
|
|
24f428 |
self.title = _("Select zone for connection '%s'") % self.connection_name
|
|
|
34791e |
|
|
|
34791e |
- QtWidgets.QDialog.__init__(self)
|
|
|
34791e |
+ QtGui.QDialog.__init__(self)
|
|
|
34791e |
self.create_ui(zone)
|
|
|
34791e |
|
|
|
34791e |
def ok(self):
|
|
|
24f428 |
@@ -174,7 +175,7 @@ class ZoneConnectionEditor(ZoneInterfaceEditor):
|
|
|
34791e |
nm_set_zone_of_connection(self.get_zone(), self.connection)
|
|
|
24f428 |
except Exception:
|
|
|
24f428 |
text = _("Failed to set zone {zone} for connection {connection_name}")
|
|
|
34791e |
- QtWidgets.QMessageBox.warning(None, fromUTF8(escape(self.title)),
|
|
|
34791e |
+ QtGui.QMessageBox.warning(None, fromUTF8(escape(self.title)),
|
|
|
34791e |
escape(text.format(
|
|
|
34791e |
zone=self.get_zone(),
|
|
|
24f428 |
connection_name=self.connection_name)))
|
|
|
24f428 |
@@ -189,7 +190,7 @@ class ZoneSourceEditor(ZoneInterfaceEditor):
|
|
|
34791e |
self.zone = None
|
|
|
34791e |
self.title = _("Select zone for source '%s'") % self.source
|
|
|
34791e |
|
|
|
34791e |
- QtWidgets.QDialog.__init__(self)
|
|
|
34791e |
+ QtGui.QDialog.__init__(self)
|
|
|
34791e |
self.create_ui(zone)
|
|
|
34791e |
|
|
|
34791e |
def ok(self):
|
|
|
24f428 |
@@ -198,7 +199,7 @@ class ZoneSourceEditor(ZoneInterfaceEditor):
|
|
|
34791e |
|
|
|
34791e |
# ShieldsEditor #########################################################
|
|
|
34791e |
|
|
|
34791e |
-class ShieldsEditor(QtWidgets.QDialog):
|
|
|
34791e |
+class ShieldsEditor(QtGui.QDialog):
|
|
|
34791e |
def __init__(self, fw, settings, shields_up, shields_down):
|
|
|
34791e |
self.fw = fw
|
|
|
34791e |
self.settings = settings
|
|
|
24f428 |
@@ -206,63 +207,63 @@ class ShieldsEditor(QtWidgets.QDialog):
|
|
|
34791e |
self.shields_down = shields_down
|
|
|
34791e |
self.title = _("Configure Shields Up/Down Zones")
|
|
|
34791e |
|
|
|
34791e |
- QtWidgets.QDialog.__init__(self)
|
|
|
34791e |
+ QtGui.QDialog.__init__(self)
|
|
|
34791e |
self.create_ui()
|
|
|
34791e |
|
|
|
34791e |
def create_ui(self):
|
|
|
34791e |
self.setWindowTitle(fromUTF8(escape(self.title)))
|
|
|
34791e |
self.rejected.connect(self.hide)
|
|
|
34791e |
|
|
|
34791e |
- vbox = QtWidgets.QVBoxLayout()
|
|
|
34791e |
+ vbox = QtGui.QVBoxLayout()
|
|
|
34791e |
vbox.setSpacing(6)
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel(fromUTF8(escape(
|
|
|
34791e |
+ label = QtGui.QLabel(fromUTF8(escape(
|
|
|
34791e |
_("Here you can select the zones used for Shields Up and "
|
|
|
34791e |
"Shields Down."))))
|
|
|
34791e |
label.setWordWrap(True)
|
|
|
34791e |
vbox.addWidget(label)
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel(fromUTF8(escape(
|
|
|
34791e |
+ label = QtGui.QLabel(fromUTF8(escape(
|
|
|
34791e |
_("This feature is useful for people using the default zones "
|
|
|
34791e |
"mostly. For users, that are changing zones of connections, it "
|
|
|
34791e |
"might be of limited use."))))
|
|
|
34791e |
label.setWordWrap(True)
|
|
|
34791e |
vbox.addWidget(label)
|
|
|
34791e |
|
|
|
34791e |
- grid = QtWidgets.QGridLayout()
|
|
|
34791e |
+ grid = QtGui.QGridLayout()
|
|
|
34791e |
grid.setSpacing(6)
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel(fromUTF8(escape(_("Shields Up Zone:"))))
|
|
|
34791e |
+ label = QtGui.QLabel(fromUTF8(escape(_("Shields Up Zone:"))))
|
|
|
34791e |
label.setWordWrap(True)
|
|
|
34791e |
grid.addWidget(label, 0, 0, 1, 1)
|
|
|
34791e |
|
|
|
34791e |
- self.shields_up_combo = QtWidgets.QComboBox()
|
|
|
34791e |
+ self.shields_up_combo = QtGui.QComboBox()
|
|
|
34791e |
#self.fill_combo(self.shields_up_combo)
|
|
|
34791e |
#self.set_shields_up(self.shields_up)
|
|
|
34791e |
grid.addWidget(self.shields_up_combo, 0, 1, 1, 1)
|
|
|
34791e |
|
|
|
34791e |
- button = QtWidgets.QPushButton(_("Reset To Default"))
|
|
|
34791e |
+ button = QtGui.QPushButton(_("Reset To Default"))
|
|
|
34791e |
button.clicked.connect(self.reset_shields_up)
|
|
|
34791e |
grid.addWidget(button, 0, 2, 1, 1)
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel(fromUTF8(escape(_("Shields Down Zone:"))))
|
|
|
34791e |
+ label = QtGui.QLabel(fromUTF8(escape(_("Shields Down Zone:"))))
|
|
|
34791e |
label.setWordWrap(True)
|
|
|
34791e |
grid.addWidget(label, 1, 0, 1, 1)
|
|
|
34791e |
|
|
|
34791e |
- self.shields_down_combo = QtWidgets.QComboBox()
|
|
|
34791e |
+ self.shields_down_combo = QtGui.QComboBox()
|
|
|
34791e |
#self.fill_combo(self.shields_down_combo)
|
|
|
34791e |
#self.set_shields_down(self.shields_down)
|
|
|
34791e |
grid.addWidget(self.shields_down_combo, 1, 1, 1, 1)
|
|
|
34791e |
|
|
|
34791e |
- button = QtWidgets.QPushButton(_("Reset To Default"))
|
|
|
34791e |
+ button = QtGui.QPushButton(_("Reset To Default"))
|
|
|
34791e |
button.clicked.connect(self.reset_shields_down)
|
|
|
34791e |
grid.addWidget(button, 1, 2, 1, 1)
|
|
|
34791e |
|
|
|
34791e |
vbox.addLayout(grid)
|
|
|
34791e |
|
|
|
34791e |
- buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok
|
|
|
34791e |
- | QtWidgets.QDialogButtonBox.Cancel)
|
|
|
34791e |
- self.ok_button = buttonBox.button(QtWidgets.QDialogButtonBox.Ok)
|
|
|
34791e |
+ buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok
|
|
|
34791e |
+ | QtGui.QDialogButtonBox.Cancel)
|
|
|
34791e |
+ self.ok_button = buttonBox.button(QtGui.QDialogButtonBox.Ok)
|
|
|
34791e |
buttonBox.accepted.connect(self.ok)
|
|
|
34791e |
buttonBox.rejected.connect(self.hide)
|
|
|
34791e |
vbox.addWidget(buttonBox)
|
|
|
24f428 |
@@ -333,56 +334,56 @@ class ShieldsEditor(QtWidgets.QDialog):
|
|
|
34791e |
|
|
|
34791e |
# AboutDialog #################################################################
|
|
|
34791e |
|
|
|
34791e |
-class AboutDialog(QtWidgets.QDialog):
|
|
|
34791e |
+class AboutDialog(QtGui.QDialog):
|
|
|
34791e |
def __init__(self, name, icon, version, url, copyright, authors, license):
|
|
|
34791e |
- QtWidgets.QDialog.__init__(self)
|
|
|
34791e |
+ QtGui.QDialog.__init__(self)
|
|
|
34791e |
self.setWindowIcon(icon)
|
|
|
34791e |
self.setWindowTitle(fromUTF8(escape(_("About %s" % name))))
|
|
|
34791e |
self.resize(500, 250)
|
|
|
34791e |
|
|
|
34791e |
- vbox = QtWidgets.QVBoxLayout()
|
|
|
34791e |
+ vbox = QtGui.QVBoxLayout()
|
|
|
34791e |
vbox.setSpacing(6)
|
|
|
34791e |
|
|
|
34791e |
- hbox = QtWidgets.QHBoxLayout()
|
|
|
34791e |
+ hbox = QtGui.QHBoxLayout()
|
|
|
34791e |
hbox.setSpacing(24)
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel()
|
|
|
34791e |
+ label = QtGui.QLabel()
|
|
|
34791e |
label.setPixmap(icon.pixmap(96))
|
|
|
34791e |
label.setMinimumSize(96, 96)
|
|
|
34791e |
label.setMaximumSize(96, 96)
|
|
|
34791e |
hbox.addWidget(label)
|
|
|
34791e |
|
|
|
34791e |
- vbox2 = QtWidgets.QVBoxLayout()
|
|
|
34791e |
+ vbox2 = QtGui.QVBoxLayout()
|
|
|
34791e |
vbox2.setSpacing(3)
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel(name)
|
|
|
34791e |
+ label = QtGui.QLabel(name)
|
|
|
34791e |
font = label.font()
|
|
|
34791e |
font.setPointSize(font.pointSize()*2)
|
|
|
34791e |
font.setBold(True)
|
|
|
34791e |
label.setFont(font)
|
|
|
34791e |
vbox2.addWidget(label)
|
|
|
34791e |
|
|
|
34791e |
- vbox2.addWidget(QtWidgets.QLabel(version))
|
|
|
34791e |
+ vbox2.addWidget(QtGui.QLabel(version))
|
|
|
34791e |
|
|
|
34791e |
- label = QtWidgets.QLabel("%s" % (url, url))
|
|
|
34791e |
+ label = QtGui.QLabel("%s" % (url, url))
|
|
|
34791e |
label.setTextFormat(QtCore.Qt.RichText)
|
|
|
34791e |
label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
|
|
|
34791e |
label.setOpenExternalLinks(True)
|
|
|
34791e |
|
|
|
34791e |
vbox2.addWidget(label)
|
|
|
34791e |
|
|
|
34791e |
- vbox2.addWidget(QtWidgets.QLabel(copyright))
|
|
|
34791e |
+ vbox2.addWidget(QtGui.QLabel(copyright))
|
|
|
34791e |
|
|
|
34791e |
hbox.addLayout(vbox2)
|
|
|
34791e |
|
|
|
34791e |
vbox.addLayout(hbox)
|
|
|
34791e |
|
|
|
34791e |
- tabs = QtWidgets.QTabWidget()
|
|
|
34791e |
+ tabs = QtGui.QTabWidget()
|
|
|
34791e |
tabs.setStyleSheet("QTabWidget::tab { padding: 1px 1px 1px 1px; }")
|
|
|
34791e |
|
|
|
34791e |
- tab = QtWidgets.QWidget()
|
|
|
34791e |
- vbox3 = QtWidgets.QVBoxLayout()
|
|
|
34791e |
- textedit = QtWidgets.QPlainTextEdit()
|
|
|
34791e |
+ tab = QtGui.QWidget()
|
|
|
34791e |
+ vbox3 = QtGui.QVBoxLayout()
|
|
|
34791e |
+ textedit = QtGui.QPlainTextEdit()
|
|
|
34791e |
#textedit.setStyleSheet("QPlainTextEdit { border: 0; padding: 0; }")
|
|
|
34791e |
textedit.setReadOnly(True)
|
|
|
34791e |
textedit.setPlainText(fromUTF8("\n".join(authors)))
|
|
|
24f428 |
@@ -390,9 +391,9 @@ class AboutDialog(QtWidgets.QDialog):
|
|
|
34791e |
tab.setLayout(vbox3)
|
|
|
34791e |
tabs.addTab(tab, fromUTF8(escape(_("Authors"))))
|
|
|
34791e |
|
|
|
34791e |
- tab = QtWidgets.QWidget()
|
|
|
34791e |
- vbox3 = QtWidgets.QVBoxLayout()
|
|
|
34791e |
- textedit = QtWidgets.QPlainTextEdit()
|
|
|
34791e |
+ tab = QtGui.QWidget()
|
|
|
34791e |
+ vbox3 = QtGui.QVBoxLayout()
|
|
|
34791e |
+ textedit = QtGui.QPlainTextEdit()
|
|
|
34791e |
#textedit.setStyleSheet("QPlainTextEdit { border: 0; padding: 0; }")
|
|
|
34791e |
textedit.setReadOnly(True)
|
|
|
34791e |
textedit.setPlainText(license)
|
|
|
24f428 |
@@ -402,7 +403,7 @@ class AboutDialog(QtWidgets.QDialog):
|
|
|
34791e |
|
|
|
34791e |
vbox.addWidget(tabs)
|
|
|
34791e |
|
|
|
34791e |
- buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Close)
|
|
|
34791e |
+ buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Close)
|
|
|
34791e |
buttonBox.rejected.connect(self.hide)
|
|
|
34791e |
vbox.addWidget(buttonBox)
|
|
|
34791e |
|
|
|
24f428 |
@@ -410,7 +411,7 @@ class AboutDialog(QtWidgets.QDialog):
|
|
|
34791e |
|
|
|
34791e |
# TrayApplet ##################################################################
|
|
|
34791e |
|
|
|
34791e |
-class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
34791e |
+class TrayApplet(QtGui.QSystemTrayIcon):
|
|
|
34791e |
def __init__(self):
|
|
|
34791e |
super(TrayApplet, self).__init__()
|
|
|
34791e |
self.name = _("Firewall Applet")
|
|
|
24f428 |
@@ -458,67 +459,67 @@ class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
34791e |
|
|
|
34791e |
# urgencies
|
|
|
34791e |
|
|
|
34791e |
- self.urgencies = { "noicon": QtWidgets.QSystemTrayIcon.NoIcon,
|
|
|
34791e |
- "information": QtWidgets.QSystemTrayIcon.Information,
|
|
|
34791e |
- "warning": QtWidgets.QSystemTrayIcon.Warning,
|
|
|
34791e |
- "critical": QtWidgets.QSystemTrayIcon.Critical }
|
|
|
34791e |
+ self.urgencies = { "noicon": QtGui.QSystemTrayIcon.NoIcon,
|
|
|
34791e |
+ "information": QtGui.QSystemTrayIcon.Information,
|
|
|
34791e |
+ "warning": QtGui.QSystemTrayIcon.Warning,
|
|
|
34791e |
+ "critical": QtGui.QSystemTrayIcon.Critical }
|
|
|
34791e |
|
|
|
34791e |
# actions
|
|
|
34791e |
|
|
|
34791e |
- self.shieldsupAction = QtWidgets.QAction(fromUTF8(escape(_("Shields Up"))),
|
|
|
34791e |
+ self.shieldsupAction = QtGui.QAction(fromUTF8(escape(_("Shields Up"))),
|
|
|
34791e |
self)
|
|
|
34791e |
self.shieldsupAction.setCheckable(True)
|
|
|
34791e |
self.shieldsupAction.setChecked(False)
|
|
|
34791e |
self.shieldsupAction.triggered.connect(self.shieldsup_changed_cb)
|
|
|
34791e |
|
|
|
34791e |
- self.notificationsAction = QtWidgets.QAction(
|
|
|
34791e |
+ self.notificationsAction = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(_("Enable Notifications"))), self)
|
|
|
34791e |
self.notificationsAction.setCheckable(True)
|
|
|
34791e |
self.notificationsAction.setChecked(False)
|
|
|
34791e |
self.notificationsAction.triggered.connect(self.notification_changed_cb)
|
|
|
34791e |
|
|
|
34791e |
- self.settingsAction = QtWidgets.QAction(
|
|
|
34791e |
+ self.settingsAction = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(_("Edit Firewall Settings..."))), self)
|
|
|
34791e |
self.settingsAction.triggered.connect(self.configure_cb)
|
|
|
34791e |
|
|
|
34791e |
- self.changeZonesAction = QtWidgets.QAction(
|
|
|
34791e |
+ self.changeZonesAction = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(_("Change Zones of Connections..."))), self)
|
|
|
34791e |
self.changeZonesAction.triggered.connect(self.nm_connection_editor)
|
|
|
34791e |
|
|
|
34791e |
- self.shieldsAction = QtWidgets.QAction(
|
|
|
34791e |
+ self.shieldsAction = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(_("Configure Shields UP/Down Zones..."))), self)
|
|
|
34791e |
self.shieldsAction.triggered.connect(self.configure_shields)
|
|
|
34791e |
|
|
|
34791e |
- self.panicAction = QtWidgets.QAction(
|
|
|
34791e |
+ self.panicAction = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(_("Block all network traffic"))), self)
|
|
|
34791e |
self.panicAction.setCheckable(True)
|
|
|
34791e |
self.panicAction.setChecked(False)
|
|
|
34791e |
self.panicAction.triggered.connect(self.panic_mode_cb)
|
|
|
34791e |
|
|
|
34791e |
- self.aboutAction = QtWidgets.QAction(fromUTF8(escape(_("About"))), self)
|
|
|
34791e |
+ self.aboutAction = QtGui.QAction(fromUTF8(escape(_("About"))), self)
|
|
|
34791e |
self.aboutAction.triggered.connect(self.about_dialog.exec_)
|
|
|
34791e |
|
|
|
34791e |
- #self.quitAction = QtWidgets.QAction(fromUTF8(escape(_("Quit"))), self,
|
|
|
34791e |
+ #self.quitAction = QtGui.QAction(fromUTF8(escape(_("Quit"))), self,
|
|
|
34791e |
# triggered=self.quit)
|
|
|
34791e |
|
|
|
34791e |
- self.connectionsAction = QtWidgets.QWidgetAction(self)
|
|
|
34791e |
- self.connectionsAction.setDefaultWidget(QtWidgets.QLabel(
|
|
|
34791e |
+ self.connectionsAction = QtGui.QWidgetAction(self)
|
|
|
34791e |
+ self.connectionsAction.setDefaultWidget(QtGui.QLabel(
|
|
|
34791e |
fromUTF8(""+escape(_("Connections"))+" ")))
|
|
|
34791e |
|
|
|
34791e |
- self.interfacesAction = QtWidgets.QWidgetAction(self)
|
|
|
34791e |
- self.interfacesAction.setDefaultWidget(QtWidgets.QLabel(
|
|
|
34791e |
+ self.interfacesAction = QtGui.QWidgetAction(self)
|
|
|
34791e |
+ self.interfacesAction.setDefaultWidget(QtGui.QLabel(
|
|
|
34791e |
fromUTF8(""+escape(_("Interfaces"))+" ")))
|
|
|
34791e |
|
|
|
34791e |
- self.sourcesAction = QtWidgets.QWidgetAction(self)
|
|
|
34791e |
- self.sourcesAction.setDefaultWidget(QtWidgets.QLabel(
|
|
|
34791e |
+ self.sourcesAction = QtGui.QWidgetAction(self)
|
|
|
34791e |
+ self.sourcesAction.setDefaultWidget(QtGui.QLabel(
|
|
|
34791e |
fromUTF8(""+escape(_("Sources"))+" ")))
|
|
|
34791e |
|
|
|
34791e |
# init
|
|
|
34791e |
|
|
|
34791e |
- self.left_menu = QtWidgets.QMenu()
|
|
|
34791e |
+ self.left_menu = QtGui.QMenu()
|
|
|
34791e |
self.left_menu.setStyleSheet('QMenu { margin: 5px; }')
|
|
|
34791e |
|
|
|
34791e |
- self.right_menu = QtWidgets.QMenu()
|
|
|
34791e |
+ self.right_menu = QtGui.QMenu()
|
|
|
34791e |
self.right_menu.addAction(self.shieldsupAction)
|
|
|
34791e |
self.right_menu.addAction(self.notificationsAction)
|
|
|
34791e |
self.right_menu.addSeparator()
|
|
|
24f428 |
@@ -637,7 +638,7 @@ class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
34791e |
self.setVisible(True)
|
|
|
34791e |
|
|
|
34791e |
def activated_cb(self, reason):
|
|
|
34791e |
- if reason == QtWidgets.QSystemTrayIcon.Trigger:
|
|
|
34791e |
+ if reason == QtGui.QSystemTrayIcon.Trigger:
|
|
|
34791e |
self.left_menu.popup(QtGui.QCursor.pos())
|
|
|
34791e |
|
|
|
34791e |
def update_active_zones(self):
|
|
|
24f428 |
@@ -686,12 +687,12 @@ class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
24f428 |
connection_name = connections[connection][1]
|
|
|
34791e |
if zone == "":
|
|
|
34791e |
_binding = _("{entry} (Default Zone: {default_zone})")
|
|
|
34791e |
- action = QtWidgets.QAction(
|
|
|
34791e |
+ action = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(
|
|
|
34791e |
_binding.format(default_zone=self.default_zone,
|
|
|
24f428 |
entry=connection_name))), self)
|
|
|
34791e |
else:
|
|
|
34791e |
- action = QtWidgets.QAction(
|
|
|
34791e |
+ action = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(binding.format(zone=zone,
|
|
|
24f428 |
entry=connection_name))), self)
|
|
|
34791e |
action.triggered.connect(functools.partial(
|
|
|
24f428 |
@@ -704,7 +705,7 @@ class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
34791e |
# add other interfaces
|
|
|
34791e |
for interface in sorted(interfaces):
|
|
|
34791e |
zone = interfaces[interface]
|
|
|
34791e |
- action = QtWidgets.QAction(
|
|
|
34791e |
+ action = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(binding.format(zone=zone, entry=interface))),
|
|
|
34791e |
self)
|
|
|
34791e |
action.triggered.connect(functools.partial(
|
|
|
24f428 |
@@ -716,7 +717,7 @@ class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
34791e |
|
|
|
34791e |
for source in sorted(sources):
|
|
|
34791e |
zone = sources[source]
|
|
|
34791e |
- action = QtWidgets.QAction(
|
|
|
34791e |
+ action = QtGui.QAction(
|
|
|
34791e |
fromUTF8(escape(binding.format(zone=zone, entry=source))),
|
|
|
34791e |
self)
|
|
|
34791e |
action.triggered.connect(functools.partial(
|
|
|
24f428 |
@@ -938,10 +939,10 @@ class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
34791e |
os.system("%s &" % NM_CONNECTION_EDITOR)
|
|
|
34791e |
|
|
|
34791e |
def warning(self, text):
|
|
|
34791e |
- QtWidgets.QMessageBox.warning(None, fromUTF8(escape(self.name)), text)
|
|
|
34791e |
+ QtGui.QMessageBox.warning(None, fromUTF8(escape(self.name)), text)
|
|
|
34791e |
|
|
|
34791e |
def error(self, text):
|
|
|
34791e |
- QtWidgets.QMessageBox.critical(None, fromUTF8(escape(self.name)), text)
|
|
|
34791e |
+ QtGui.QMessageBox.critical(None, fromUTF8(escape(self.name)), text)
|
|
|
34791e |
|
|
|
34791e |
def configure_cb(self, widget):
|
|
|
34791e |
os.system("firewall-config &")
|
|
|
24f428 |
@@ -977,8 +978,6 @@ class TrayApplet(QtWidgets.QSystemTrayIcon):
|
|
|
34791e |
def reloaded(self):
|
|
|
34791e |
if self.notificationsAction.isChecked():
|
|
|
34791e |
self.notify(escape(_("FirewallD has been reloaded.")))
|
|
|
34791e |
- self.update_active_zones()
|
|
|
34791e |
- self.update_tooltip()
|
|
|
34791e |
|
|
|
34791e |
def default_zone_changed(self, zone):
|
|
|
34791e |
self.default_zone = zone
|
|
|
24f428 |
@@ -1124,7 +1123,7 @@ Options:
|
|
|
34791e |
# reset SIGINT signal to default
|
|
|
34791e |
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
|
|
34791e |
|
|
|
34791e |
-app = QtWidgets.QApplication(sys.argv)
|
|
|
34791e |
+app = QtGui.QApplication(sys.argv)
|
|
|
34791e |
app.setQuitOnLastWindowClosed(False)
|
|
|
34791e |
|
|
|
34791e |
applet = TrayApplet()
|
|
|
24f428 |
--
|
|
|
24f428 |
2.18.0
|
|
|
24f428 |
|