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

@ -223,15 +223,16 @@ class GuiAutoImport (threading.Thread):
def startClicked(self, widget, data): def startClicked(self, widget, data):
"""runs when user clicks start on auto import tab""" """runs when user clicks start on auto import tab"""
# Check to see if we have an open file handle to the HUD and open one if we do not. # Check to see if we have an open file handle to the HUD and open one if we do not.
# bufsize = 1 means unbuffered # bufsize = 1 means unbuffered
# We need to close this file handle sometime. # We need to close this file handle sometime.
# TODO: Allow for importing from multiple dirs - REB 29AUG2008
# As presently written this function does nothing if there is already a pipe open.
# 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.
# TODO: Allow for importing from multiple dirs - REB 29AUG2008
# As presently written this function does nothing if there is already a pipe open.
# 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()): if data == "autostart" or (widget == self.startButton and self.startButton.get_active()):
self.startButton.set_active(True) self.startButton.set_active(True)
# - Does the lock acquisition need to be more sophisticated for multiple dirs? # - Does the lock acquisition need to be more sophisticated for multiple dirs?

View File

@ -80,12 +80,23 @@ class HUD_main(object):
self.hud_dict = {} self.hud_dict = {}
self.hud_params = self.config.get_hud_ui_parameters() self.hud_params = self.config.get_hud_ui_parameters()
# a thread to read stdin # a thread to read stdin
gobject.threads_init() # this is required gobject.threads_init() # this is required
thread.start_new_thread(self.read_stdin, ()) # starts the thread thread.start_new_thread(self.read_stdin, ()) # starts the thread
# a main window # a main window
self.main_window = gtk.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: if options.minimized:
self.main_window.iconify() self.main_window.iconify()
if options.hidden: if options.hidden: