def __init__(self, parent=None): QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint) self._cfg = Config.get() self._nodes = Nodes.instance() self._db = Database.instance() self._notification_callback.connect(self._cb_notification_callback) self._notifications_sent = {} self.setupUi(self) self.dbFileButton.setVisible(False) self.dbLabel.setVisible(False) self.acceptButton.clicked.connect(self._cb_accept_button_clicked) self.applyButton.clicked.connect(self._cb_apply_button_clicked) self.cancelButton.clicked.connect(self._cb_cancel_button_clicked) self.popupsCheck.clicked.connect(self._cb_popups_check_toggled) self.dbFileButton.clicked.connect(self._cb_file_db_clicked) if QtGui.QIcon.hasThemeIcon("emblem-default") == False: self.applyButton.setIcon(self.style().standardIcon( getattr(QtWidgets.QStyle, "SP_DialogApplyButton"))) self.cancelButton.setIcon(self.style().standardIcon( getattr(QtWidgets.QStyle, "SP_DialogCloseButton"))) self.acceptButton.setIcon(self.style().standardIcon( getattr(QtWidgets.QStyle, "SP_DialogSaveButton"))) self.dbFileButton.setIcon(self.style().standardIcon( getattr(QtWidgets.QStyle, "SP_DirOpenIcon")))
def __init__(self, parent=None): QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint) # Other interesting flags: QtCore.Qt.Tool | QtCore.Qt.BypassWindowManagerHint self._cfg = Config.get() self.setupUi(self) self._width = self.width() self._height = self.height() dialog_geometry = self._cfg.getSettings("promptDialog/geometry") if dialog_geometry == QtCore.QByteArray: self.restoreGeometry(dialog_geometry) self.setWindowTitle("OpenSnitch v%s" % version) self._lock = threading.Lock() self._con = None self._rule = None self._local = True self._peer = None self._prompt_trigger.connect(self.on_connection_prompt_triggered) self._timeout_trigger.connect(self.on_timeout_triggered) self._tick_trigger.connect(self.on_tick_triggered) self._tick = int(self._cfg.getSettings( self._cfg.DEFAULT_TIMEOUT_KEY)) if self._cfg.hasKey( self._cfg.DEFAULT_TIMEOUT_KEY) else self.DEFAULT_TIMEOUT self._tick_thread = None self._done = threading.Event() self._timeout_text = "" self._timeout_triggered = False self._apps_parser = LinuxDesktopParser() self.denyButton.clicked.connect(self._on_deny_clicked) # also accept button self.applyButton.clicked.connect(self._on_apply_clicked) self._apply_text = QC.translate("popups", "Allow") self._deny_text = QC.translate("popups", "Deny") self._default_action = self._cfg.getInt(self._cfg.DEFAULT_ACTION_KEY) self.whatIPCombo.setVisible(False) self.checkDstIP.setVisible(False) self.checkDstPort.setVisible(False) self.checkUserID.setVisible(False) self.appDescriptionLabel.setVisible(False) self._ischeckAdvanceded = False self.checkAdvanced.toggled.connect(self._check_advanced_toggled) if QtGui.QIcon.hasThemeIcon("emblem-default") == False: self.applyButton.setIcon(self.style().standardIcon( getattr(QtWidgets.QStyle, "SP_DialogApplyButton"))) self.denyButton.setIcon(self.style().standardIcon( getattr(QtWidgets.QStyle, "SP_DialogCancelButton")))
def __init__(self, parent=None, appicon=None): QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint) self._themes = Themes.instance() self._saved_theme = "" self._cfg = Config.get() self._nodes = Nodes.instance() self._db = Database.instance() self._notification_callback.connect(self._cb_notification_callback) self._notifications_sent = {} self._desktop_notifications = DesktopNotifications() self.setupUi(self) self.setWindowIcon(appicon) self.dbFileButton.setVisible(False) self.dbLabel.setVisible(False) self.dbType = None self.acceptButton.clicked.connect(self._cb_accept_button_clicked) self.applyButton.clicked.connect(self._cb_apply_button_clicked) self.cancelButton.clicked.connect(self._cb_cancel_button_clicked) self.helpButton.clicked.connect(self._cb_help_button_clicked) self.popupsCheck.clicked.connect(self._cb_popups_check_toggled) self.dbFileButton.clicked.connect(self._cb_file_db_clicked) self.checkUIRules.toggled.connect(self._cb_check_ui_rules_toggled) self.cmdTimeoutUp.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinUITimeout, self.SUM)) self.cmdTimeoutDown.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinUITimeout, self.REST)) self.cmdDBMaxDaysUp.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBMaxDays, self.SUM)) self.cmdDBMaxDaysDown.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBMaxDays, self.REST)) self.cmdDBPurgesUp.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBPurgeInterval, self.SUM)) self.cmdDBPurgesDown.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBPurgeInterval, self.REST)) self.cmdTestNotifs.clicked.connect(self._cb_test_notifs_clicked) self.radioSysNotifs.clicked.connect(self._cb_radio_system_notifications) self.helpButton.setToolTipDuration(30 * 1000) if QtGui.QIcon.hasThemeIcon("emblem-default") == False: self.applyButton.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_DialogApplyButton"))) self.cancelButton.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_DialogCloseButton"))) self.acceptButton.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_DialogSaveButton"))) self.dbFileButton.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_DirOpenIcon"))) if QtGui.QIcon.hasThemeIcon("list-add") == False: self.cmdTimeoutUp.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_ArrowUp"))) self.cmdTimeoutDown.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_ArrowDown"))) self.cmdDBMaxDaysUp.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_ArrowUp"))) self.cmdDBMaxDaysDown.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_ArrowDown"))) self.cmdDBPurgesUp.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_ArrowUp"))) self.cmdDBPurgesDown.setIcon(self.style().standardIcon(getattr(QtWidgets.QStyle, "SP_ArrowDown")))
def __init__(self, parent=None, appicon=None, node=None): QtWidgets.QDialog.__init__(self, parent) self.setupUi(self) self.setWindowIcon(appicon) self.appicon = appicon # TODO: profiles are ready to be used. They need to be tested, and # create some default profiles (home, office, public, ...) self.comboProfile.setVisible(False) self.lblProfile.setVisible(False) self.secHighIcon = Icons.new("security-high") self.secMediumIcon = Icons.new("security-medium") self.secLowIcon = Icons.new("security-low") self.lblStatusIcon.setPixmap(self.secHighIcon.pixmap(96, 96)) self._fwrule_dialog = FwRuleDialog(appicon=self.appicon) self._cfg = Config.get() self._fw = Fw.Firewall.instance() self._nodes = Nodes.instance() self._fw_profiles = {} self._notification_callback.connect(self._cb_notification_callback) self._notifications_sent = {} self._nodes.nodesUpdated.connect(self._cb_nodes_updated) self.cmdNewRule.clicked.connect(self._cb_new_rule_clicked) self.cmdExcludeService.clicked.connect( self._cb_exclude_service_clicked) self.comboInput.currentIndexChanged.connect( lambda: self._cb_combo_policy_changed(self.COMBO_IN)) self.comboOutput.currentIndexChanged.connect( lambda: self._cb_combo_policy_changed(self.COMBO_OUT)) self.comboProfile.currentIndexChanged.connect( self._cb_combo_profile_changed) self.sliderFwEnable.valueChanged.connect(self._cb_enable_fw_changed) self.cmdClose.clicked.connect(self._cb_close_clicked) if QtGui.QIcon.hasThemeIcon("document-new"): return closeIcon = Icons.new("window-close") excludeIcon = Icons.new("go-jump") newIcon = Icons.new("document-new") self.cmdClose.setIcon(closeIcon) self.cmdExcludeService.setIcon(excludeIcon) self.cmdNewRule.setIcon(newIcon)
def __init__(self, parent=None, appicon=None): QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint) # Other interesting flags: QtCore.Qt.Tool | QtCore.Qt.BypassWindowManagerHint self._cfg = Config.get() self.setupUi(self) self.setWindowIcon(appicon) self._width = None self._height = None dialog_geometry = self._cfg.getSettings("promptDialog/geometry") if dialog_geometry == QtCore.QByteArray: self.restoreGeometry(dialog_geometry) self.setWindowTitle("OpenSnitch v%s" % version) self._lock = threading.Lock() self._con = None self._rule = None self._local = True self._peer = None self._prompt_trigger.connect(self.on_connection_prompt_triggered) self._timeout_trigger.connect(self.on_timeout_triggered) self._tick_trigger.connect(self.on_tick_triggered) self._tick = int(self._cfg.getSettings( self._cfg.DEFAULT_TIMEOUT_KEY)) if self._cfg.hasKey( self._cfg.DEFAULT_TIMEOUT_KEY) else self.DEFAULT_TIMEOUT self._tick_thread = None self._done = threading.Event() self._timeout_text = "" self._timeout_triggered = False self._apps_parser = LinuxDesktopParser() self.whatIPCombo.setVisible(False) self.checkDstIP.setVisible(False) self.checkDstPort.setVisible(False) self.checkUserID.setVisible(False) self.appDescriptionLabel.setVisible(False) self._ischeckAdvanceded = False self.checkAdvanced.toggled.connect(self._check_advanced_toggled) self.checkAdvanced.clicked.connect(self._button_clicked) self.durationCombo.activated.connect(self._button_clicked) self.whatCombo.activated.connect(self._button_clicked) self.whatIPCombo.activated.connect(self._button_clicked) self.checkDstIP.clicked.connect(self._button_clicked) self.checkDstPort.clicked.connect(self._button_clicked) self.checkUserID.clicked.connect(self._button_clicked) self.allowIcon = Icons.new("emblem-default") denyIcon = Icons.new("emblem-important") rejectIcon = Icons.new("window-close") self._default_action = self._cfg.getInt(self._cfg.DEFAULT_ACTION_KEY) self.allowButton.clicked.connect( lambda: self._on_action_clicked(Config.ACTION_ALLOW_IDX)) self.allowButton.setIcon(self.allowIcon) self._allow_text = QC.translate("popups", "Allow") self._action_text = [ QC.translate("popups", "Deny"), QC.translate("popups", "Allow"), QC.translate("popups", "Reject") ] self._action_icon = [denyIcon, self.allowIcon, rejectIcon] m = QtWidgets.QMenu() m.addAction( denyIcon, self._action_text[Config.ACTION_DENY_IDX]).triggered.connect( lambda: self._on_action_clicked(Config.ACTION_DENY_IDX)) m.addAction( self.allowIcon, self._action_text[Config.ACTION_ALLOW_IDX]).triggered.connect( lambda: self._on_action_clicked(Config.ACTION_ALLOW_IDX)) m.addAction( rejectIcon, self._action_text[Config.ACTION_REJECT_IDX]).triggered.connect( lambda: self._on_action_clicked(Config.ACTION_REJECT_IDX)) self.actionButton.setMenu(m) self.actionButton.setText(self._action_text[Config.ACTION_DENY_IDX]) self.actionButton.setIcon(self._action_icon[Config.ACTION_DENY_IDX]) if self._default_action != Config.ACTION_ALLOW_IDX: self.actionButton.setText(self._action_text[self._default_action]) self.actionButton.setIcon(self._action_icon[self._default_action]) self.actionButton.clicked.connect(self._on_deny_btn_clicked)
def __init__(self, parent=None, appicon=None): QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowStaysOnTopHint) self._themes = Themes.instance() self._saved_theme = "" self._cfg = Config.get() self._nodes = Nodes.instance() self._db = Database.instance() self._notification_callback.connect(self._cb_notification_callback) self._notifications_sent = {} self._desktop_notifications = DesktopNotifications() self.setupUi(self) self.setWindowIcon(appicon) self.dbFileButton.setVisible(False) self.dbLabel.setVisible(False) self.dbType = None self.acceptButton.clicked.connect(self._cb_accept_button_clicked) self.applyButton.clicked.connect(self._cb_apply_button_clicked) self.cancelButton.clicked.connect(self._cb_cancel_button_clicked) self.helpButton.clicked.connect(self._cb_help_button_clicked) self.popupsCheck.clicked.connect(self._cb_popups_check_toggled) self.dbFileButton.clicked.connect(self._cb_file_db_clicked) self.checkUIRules.toggled.connect(self._cb_check_ui_rules_toggled) self.cmdTimeoutUp.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinUITimeout, self.SUM)) self.cmdTimeoutDown.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinUITimeout, self.REST)) self.cmdDBMaxDaysUp.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBMaxDays, self.SUM)) self.cmdDBMaxDaysDown.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBMaxDays, self.REST)) self.cmdDBPurgesUp.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBPurgeInterval, self.SUM)) self.cmdDBPurgesDown.clicked.connect(lambda: self._cb_cmd_spin_clicked(self.spinDBPurgeInterval, self.REST)) self.cmdTestNotifs.clicked.connect(self._cb_test_notifs_clicked) self.radioSysNotifs.clicked.connect(self._cb_radio_system_notifications) self.helpButton.setToolTipDuration(30 * 1000) if QtGui.QIcon.hasThemeIcon("emblem-default"): return saveIcon = Icons.new("document-save") applyIcon = Icons.new("emblem-default") delIcon = Icons.new("edit-delete") closeIcon = Icons.new("window-close") openIcon = Icons.new("document-open") helpIcon = Icons.new("help-browser") addIcon = Icons.new("list-add") delIcon = Icons.new("list-remove") self.applyButton.setIcon(applyIcon) self.cancelButton.setIcon(closeIcon) self.acceptButton.setIcon(saveIcon) self.helpButton.setIcon(helpIcon) self.dbFileButton.setIcon(openIcon) self.cmdTimeoutUp.setIcon(addIcon) self.cmdTimeoutDown.setIcon(delIcon) self.cmdDBMaxDaysUp.setIcon(addIcon) self.cmdDBMaxDaysDown.setIcon(delIcon) self.cmdDBPurgesUp.setIcon(addIcon) self.cmdDBPurgesDown.setIcon(delIcon)
def __init__(self): self._cfg = Config.get() theme = self._cfg.getInt(self._cfg.DEFAULT_THEME, 0)