def installQBittorrent(): if checkAvailable("/usr/bin/qbittorrent-nox"): return else: try: runSh("add-apt-repository ppa:qbittorrent-team/qbittorrent-stable -y") runSh("apt-get install qbittorrent-nox -qq -y") except: print("Error installing qBittorrent.") exx()
def accessSettingFile(file="", setting={}): from json import load, dump if not isinstance(setting, dict): print("Only accept Dictionary object.") exx() fullPath = f"/usr/local/sessionSettings/{file}" try: if not len(setting): if not checkAvailable(fullPath): print(f"File unavailable: {fullPath}.") exx() with open(fullPath) as jsonObj: return load(jsonObj) else: with open(fullPath, "w+") as outfile: dump(setting, outfile) except: print(f"Error accessing the file: {fullPath}.")
def __bind_menu_exit(self, event): #метод, который уничтожает окно меню (срабатывает при нажатии клавиши ESCAPE) self.__master.destroy() exx()