added requirements check in main application

This commit is contained in:
Daniel Pavel 2012-11-07 14:59:43 +02:00
parent 6e939e9485
commit 7e44ec5ebf
1 changed files with 21 additions and 0 deletions

View File

@ -37,9 +37,30 @@ def _parse_arguments():
return args
def _check_requirements():
try:
import pyudev
except ImportError:
return 'python-pyudev'
try:
import gi.repository
except ImportError:
return 'python-gi'
try:
from gi.repository import Gtk
except ImportError:
return 'gir1.2-gtk-3.0'
if __name__ == '__main__':
args = _parse_arguments()
req_fail = _check_requirements()
if req_fail:
raise ImportError('missing required package: %s' % req_fail)
import ui
# check if the notifications are available and enabled