display warning and dont load HUD if running without admin under vista/7

This commit is contained in:
Steffen Schaumburg 2011-03-18 00:11:47 +01:00
parent 96bf04ad5f
commit b75dc46979
2 changed files with 22 additions and 10 deletions

View File

@ -232,6 +232,7 @@ class GuiAutoImport (threading.Thread):
# That is not correct. It should open another dir for importing while piping the
# results to the same pipe. This means that self.path should be a a list of dirs
# to watch.
if data == "autostart" or (widget == self.startButton and self.startButton.get_active()):
self.startButton.set_active(True)
# - Does the lock acquisition need to be more sophisticated for multiple dirs?

View File

@ -86,6 +86,17 @@ class HUD_main(object):
# a main window
self.main_window = gtk.Window()
if os.name == 'nt': # Check for admin rights, don't start auto import if we don't have them
if (os.sys.getwindowsversion()[0] >= 6):
import ctypes
if not ctypes.windll.shell32.IsUserAnAdmin():
dia = gtk.MessageDialog(parent=self.main_window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_ERROR, buttons=(gtk.BUTTONS_OK), message_format=_("No admin rights for HUD"))
dia.format_secondary_text(_("Please right click fpdb.exe and HUD_main.exe, select properties, and set them both to run as admin.")+" "+_("You will need to restart fpdb afterwards."))
response = dia.run()
dia.destroy()
return
if options.minimized:
self.main_window.iconify()
if options.hidden: