Exemple #1
0
 def findQmlNames(self, dir, shortDir):
     resultList = []
     d = QDir("")
     d.cd(dir)
     l = d.entryList()
     for file in l:
         anotherFile = shortDir + file
         resultList.append(anotherFile)
     resultList.pop(0)
     resultList.pop(0)
     return resultList
Exemple #2
0
    def CallADB(self, Message):
        self.LastScreen = ""

        DossierActuel = QDir(QDir.currentPath())
        DossierActuel.cd("platform-tools")
        PathExecutable = ""
        if platform.system() == "Windows":
            PathExecutable = DossierActuel.absoluteFilePath("adb.exe")
        else:
            PathExecutable = DossierActuel.absoluteFilePath("adb")
        result = subprocess.run(PathExecutable+" "+Message, env={**os.environ, 'ANDROID_SERIAL': self.SerialNumber}, capture_output=True)
        return result
Exemple #3
0
    def __init__(self):
        DossierActuel = QDir(QDir.currentPath())
        if not DossierActuel.cd("platform-tools"):
            url = None
            if platform.system() == "Windows":
                url = 'https://dl.google.com/android/repository/platform-tools-latest-windows.zip'
            elif platform.system() == "Darwin":  #MacOS
                url = 'https://dl.google.com/android/repository/platform-tools-latest-darwin.zip'
            elif platform.system() == "Linux":
                url = 'https://dl.google.com/android/repository/platform-tools-latest-linux.zip'
            reply = requests.get(url)
            zip_ref = zipfile.ZipFile(io.BytesIO(reply.content))
            zip_ref.extractall(DossierActuel.absolutePath())
            zip_ref.close()
        super(MainWindow, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.Manager = ManagerDevice(self)
        self.Manager.start()

        self.ui.SelectScript.clicked.connect(self.LoadScripts)
        self.ui.SelectData.clicked.connect(self.LoadData)
        self.ui.ButtonAllGo.clicked.connect(self.ButtonAllGo)

        self.ui.tableWidget.itemActivated.connect(self.ClickDevice)
Exemple #4
0
 def LoadScripts(self):
     Result = QFileDialog.getExistingDirectory(self)
     DirScript = QDir(Result)
     if DirScript.cd("Script"):
         if not self.ui.PathData.text().strip() != "":  ####UnloadScripts
             ListScript = DirScript.entryInfoList(["*.py"])
             for mod in ListScript:
                 # removes module from the system
                 mod_name = mod.baseName()
                 if mod_name in sys.modules:
                     #ListFunction = dir(mod_name)
                     del sys.modules[mod_name]
                     Helper.DeviceHelper.FunctionCallDict = {}
         self.ui.PathScript.setText(Result)
         #self.ui.LogTerminal.setText(DirScript.absolutePath())
         sys.path.append(DirScript.absolutePath())
         DirScript.entryInfoList(["*.py"])
         for Script in ListScript:
             __import__(Script.baseName())
             ListFunction = Helper.DeviceHelper.FunctionCallDict.values()
             for item in ListFunction:
                 self.ui.ListScript.addItem(item)
             #for function in ListFunction:
             #    Helper.DeviceHelper.function = types.MethodType(function,Helper.DeviceHelper)
             #setattr(Helper.DeviceHelper, ScriptModule.__dict__[function], function)
             #Helper.DeviceHelper.__dict__[function] = function
         ListVar = []
         f = open(QDir(Result).absoluteFilePath("Var.txt"), 'r')
         for ligne in f.readlines():
             ListVar.append(ligne)
         f.close()
         Helper.add_variable_Masterisation(ListVar)
         self.Manager.ReloadTerminaux()
     else:
         #Error
         print("Error")
Exemple #5
0
 def InstallApk(self, Name = "", ListoptionADB = ""):#Locate APK in ressources dir
     DossierProject = QDir(self.PathProject)
     DossierProject.cd('Ressource')
     PathAPK = DossierProject.absoluteFilePath(Name)
     print(self.CallADB("install "+ListoptionADB+" "+PathAPK))