Beispiel #1
0
 def detect(self):
     pf = platform.system()
     if pf == 'Windows':
         self.mosesPath = self.findRegistryPath()
         if self.mosesPath:
             return self.checkMosesInstall()
         else:
             if not doQuestion(
                     'Cannot find Moses installation, click "Yes" to '
                     'manually set the Moses path, click "No" to exit.'):
                 return False
         # If not found, use a dialog.
         startdir = 'C:\\'
         if "ProgramFiles(x86)" in os.environ:
             startdir = os.environ["ProgramFiles(x86)"]
         elif "ProgramFiles" in os.environ:
             startdir = os.environ["ProgramFiles"]
         else:
             pass
         dialog = QFileDialog(None, directory=startdir)
         dialog.setFileMode(QFileDialog.Directory)
         dialog.setViewMode(QFileDialog.Detail)
         dialog.setOptions(QFileDialog.ShowDirsOnly)
         if dialog.exec_():
             self.mosesPath = str(dialog.selectedFiles()[0])
             return self.checkMosesInstall()
         else:
             doAlert("Failed to find Moses Installation path, exit.")
             return False
     else:
         doAlert("Platform %s not supported yet" % pf)
         return False
Beispiel #2
0
 def detect(self):
     pf = platform.system()
     if pf == 'Windows':
         self.mosesPath = self.findRegistryPath()
         if self.mosesPath:
             return self.checkMosesInstall()
         else:
             if not doQuestion(
                 'Cannot find Moses installation, click "Yes" to '
                 'manually set the Moses path, click "No" to exit.'):
                 return False
         # If not found, use a dialog.
         startdir = 'C:\\'
         if "ProgramFiles(x86)" in os.environ:
             startdir = os.environ["ProgramFiles(x86)"]
         elif "ProgramFiles" in os.environ:
             startdir = os.environ["ProgramFiles"]
         else:
             pass
         dialog = QFileDialog(None, directory=startdir)
         dialog.setFileMode(QFileDialog.Directory)
         dialog.setViewMode(QFileDialog.Detail)
         dialog.setOptions(QFileDialog.ShowDirsOnly)
         if dialog.exec_():
             self.mosesPath = str(dialog.selectedFiles()[0])
             return self.checkMosesInstall()
         else:
             doAlert("Failed to find Moses Installation path, exit.")
             return False
     else:
         doAlert("Platform %s not supported yet" % pf)
         return False
 def detect(self):
     doQuestion('Cannot find Moses installation, click "Yes" to '
                'manually set the Moses path, click "No" to exit.')
     # If not found, use a dialog.
     startdir = 'C:\\'
     if "ProgramFiles(x86)" in os.environ:
         startdir = os.environ["ProgramFiles(x86)"]
     elif "ProgramFiles" in os.environ:
         startdir = os.environ["ProgramFiles"]
     else:
         pass
     dialog = QFileDialog(None, directory=startdir)
     dialog.setFileMode(QFileDialog.Directory)
     dialog.setViewMode(QFileDialog.Detail)
     dialog.setOptions(QFileDialog.ShowDirsOnly)
     if dialog.exec_():
         self.mosesPath = str(dialog.selectedFiles()[0])
         return self.mosesPath
     else:
         doAlert("Failed to find Moses Installation path, exit.")
         return "Failed to find Moses Installation path, exit."
 def destroy(self):
     bExit = False
     for i in self.installThreads:
         t, flag = self.installThreads[i]
         if t.isAlive() and flag:
             if not bExit:
                 if not doQuestion(
                         "Installing process is running in the background, "
                         "do you want to terminate them and exit?"):
                     return False
                 else:
                     bExit = True
             self.installThreads[i][1] = False
             t.join()
     if self.db:
         self.db.close()
         self.db = None
     return True
Beispiel #5
0
 def destroy(self):
     bExit = False
     for i in self.installThreads:
         t,  flag = self.installThreads[i]
         if t.isAlive() and flag:
             if not bExit:
                 if not doQuestion(
                     "Installing process is running in the background, "
                     "do you want to terminate them and exit?"):
                     return False
                 else:
                     bExit = True
             self.installThreads[i][1] = False
             t.join()
     if self.db:
         self.db.close()
         self.db = None
     return True