mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui: control autostart feature exceptions
Display a warning if it fails.
This commit is contained in:
parent
138b8d0c33
commit
6d65eb6f53
2 changed files with 9 additions and 9 deletions
|
@ -200,7 +200,13 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject):
|
|||
self._menu.aboutToShow.connect(self._on_show_menu)
|
||||
|
||||
def _on_switch_autostart(self):
|
||||
self._autostart.enable(self._menu_autostart.isChecked())
|
||||
try:
|
||||
self._autostart.enable(self._menu_autostart.isChecked())
|
||||
except Exception as e:
|
||||
self._desktop_notifications.show(
|
||||
QC.translate("stats", "Warning"),
|
||||
QC.translate("stats", str(e))
|
||||
)
|
||||
|
||||
def _on_show_menu(self):
|
||||
self._menu_autostart.setChecked(self._autostart.isEnabled())
|
||||
|
|
|
@ -88,16 +88,10 @@ class Autostart():
|
|||
if os.path.isfile(self.systemAutostart) and os.path.isfile(self.userAutostart):
|
||||
os.remove(self.userAutostart)
|
||||
elif os.path.isfile(self.systemDesktop):
|
||||
try:
|
||||
shutil.copyfile(self.systemDesktop, self.userAutostart)
|
||||
except shutil.SameFileError:
|
||||
pass
|
||||
shutil.copyfile(self.systemDesktop, self.userAutostart)
|
||||
else:
|
||||
if os.path.isfile(self.systemAutostart):
|
||||
try:
|
||||
shutil.copyfile(self.systemAutostart, self.userAutostart)
|
||||
except shutil.SameFileError:
|
||||
pass
|
||||
shutil.copyfile(self.systemAutostart, self.userAutostart)
|
||||
with open(self.userAutostart, 'a') as f:
|
||||
f.write('Hidden=true\n')
|
||||
elif os.path.isfile(self.userAutostart):
|
||||
|
|
Loading…
Add table
Reference in a new issue