Browse Source

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

master
Steffen Schaumburg 13 years ago
parent
commit
b75dc46979
  1. 19
      pyfpdb/GuiAutoImport.py
  2. 15
      pyfpdb/HUD_main.pyw

19
pyfpdb/GuiAutoImport.py

@ -223,15 +223,16 @@ class GuiAutoImport (threading.Thread):
def startClicked(self, widget, data):
"""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.
# bufsize = 1 means unbuffered
# 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.
# Check to see if we have an open file handle to the HUD and open one if we do not.
# bufsize = 1 means unbuffered
# 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.
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?

15
pyfpdb/HUD_main.pyw

@ -80,12 +80,23 @@ class HUD_main(object):
self.hud_dict = {}
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
thread.start_new_thread(self.read_stdin, ()) # starts the thread
# a main window
# 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:

Loading…
Cancel
Save