1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-21 21:38:06 +01:00

Made wicd-curses.py spit out an error if a dbus access denied error appears on startup.

This commit is contained in:
Andrew Psaltis
2009-06-19 17:29:25 -04:00
parent 8de0e98010
commit fa626d2ac4

View File

@@ -38,7 +38,6 @@ at least get a network connection. Or those who don't like using X. ;-)
import warnings
warnings.filterwarnings("ignore","The popen2 module is deprecated. Use the subprocess module.")
# UI stuff
# This library is the only reason why I wrote this program.
import urwid
# DBus communication stuff
@@ -64,6 +63,7 @@ import netentry_curses
from netentry_curses import WirelessSettingsDialog, WiredSettingsDialog,AdvancedSettingsDialog
from optparse import OptionParser
from os import system
# Stuff about getting the script configurer running
#from grp import getgrgid
@@ -72,7 +72,7 @@ from optparse import OptionParser
#import logging
#import logging.handler
CURSES_REVNO=wpath.curses_revision
CURSES_REV=wpath.curses_revision
# Fix strings in wicd-curses
from wicd.translations import language
@@ -1047,7 +1047,17 @@ setup_dbus()
##### MAIN ENTRY POINT
########################################
if __name__ == '__main__':
parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REVNO,daemon.Hello()))
try:
parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello()))
except Exception as ex:
if "Rejected send message" in ex.args[0]:
print ""
system("\
echo ERROR: wicd-curses was denied access to the wicd daemon, make sure that \
your user is in the group \\'$(tput bold)$(tput setaf 4)"+ wpath.wicd_group+"$(tput sgr0)\\'.")
sys.exit(1)
else:
raise
parser.set_defaults(screen='raw',debug=False)
parser.add_option("-r", "--raw-screen",action="store_const",const='raw'
,dest='screen',help="use urwid's raw screen controller (default)")