def InstallDriver(cls): while True: with cls.installThreadLock: if cls.installQueue.empty(): cls.installThread = None return self = cls.installQueue.get() if wx.YES != eg.CallWait( wx.MessageBox, Text.installMsg % self.plugin.name, caption=Text.dialogCaption % self.plugin.name, style=wx.YES_NO | wx.ICON_QUESTION | wx.STAY_ON_TOP, parent=eg.document.frame): continue if not self.CheckAddOnFiles(): continue self.CreateInf() result = -1 cmdLine = '"%s" /f /lm' % join(INSTALLATION_ROOT, "dpinst.exe") try: result = ExecAs( "subprocess", eg.WindowsVersion >= 'Vista' or not IsAdmin(), "call", cmdLine.encode('mbcs'), ) except WindowsError, exc: #only silence "User abort" if exc.winerror != 1223: raise if result == 1: eg.actionThread.Call(self.plugin.info.Start)
def CheckAddOnFiles(self): neededFiles = self.GetNeededFiles() if len(neededFiles) == 0: return True if not eg.CallWait(self.ShowDownloadMessage): return False stopEvent = threading.Event() wx.CallAfter(eg.TransferDialog, None, neededFiles, stopEvent) stopEvent.wait() neededFiles = self.GetNeededFiles() if neededFiles: eg.CallWait(wx.MessageBox, Text.downloadFailedMsg, caption=Text.dialogCaption % self.plugin.name, style=wx.OK | wx.ICON_EXCLAMATION | wx.STAY_ON_TOP, parent=eg.document.frame) return False return True
def WaitForInputProcessed(self): if self.procHandle: WaitForInputIdle(self.procHandle, 100) def DoIt(): SetTimer(self.dummyHwnd, 1, 0, None) self.msg.message = 0 while self.msg.message != WM_TIMER: GetMessage(byref(self.msg), self.dummyHwnd, 0, 0) eg.CallWait(DoIt)
def Restart(self, asAdmin=False): def Do(): from eg.WinApi.PipedProcess import RunAs args = self.GetArguments() args.append("-restart") RunAs(sys.executable, asAdmin, *args) return True if threading.currentThread() == eg.mainThread: return Do() else: return eg.CallWait(Do)
def Restart(self): def Do(): from eg.WinApi.PipedProcess import RunAs args = [] if sys.argv[0] != sys.executable: args.append(sys.argv[0]) args.append("-restart") if eg.debugLevel: args.append("-debug") args.append(str(eg.debugLevel)) if eg.startupArguments.configDir: args.append("-configdir") args.append(eg.startupArguments.configDir) if self.Exit(): RunAs(sys.executable, False, *args) return True else: return False if threading.currentThread() == eg.mainThread: return Do() else: return eg.CallWait(Do)