Exemplo n.º 1
0
 def set_download_path(self):
     """设置下载路径"""
     dl_path = QFileDialog.getExistingDirectory()
     dl_path = os.path.normpath(dl_path)  # windows backslash
     if dl_path == self.configs["settings"]["dl_path"] or dl_path == ".":
         return
     if dl_path == "":
         dl_path = os.path.dirname(os.path.abspath(__file__)) + os.sep + "downloads"
         up_info = {"dl_path": dl_path}
     else:
         up_info = {"dl_path": dl_path}
     update_settings(self._config_file, up_info, is_settings=True)
     self.load_settings()
     self.line_dl_path.setText(self.configs["settings"]["dl_path"])
Exemplo n.º 2
0
 def set_download_path(self):
     """设置下载路径"""
     dl_path = QFileDialog.getExistingDirectory()
     if dl_path == self.settings["path"]:
         return
     if dl_path == "":
         dl_path = os.path.dirname(
             os.path.abspath(__file__)) + os.sep + "downloads"
         up_info = {"path": dl_path}
     else:
         up_info = {"path": dl_path}
     update_settings(self._config, up_info)
     self.load_settings()
     self.line_dl_path.setText(self.settings["path"])
Exemplo n.º 3
0
 def load_settings(self, ref_ui=False):
     """加载用户设置"""
     try:
         with open(self._config_file, "rb") as _file:
             self.configs = load(_file)
     except Exception:
         self.configs = {"user": "", "pwd": "", "cookie": "", "settings": self._default_settings}
         with open(self._config_file, "wb") as _file:
             dump(self.configs, _file)
     # 兼容以前的平配置文件
     if "settings" not in self.configs or not self.configs["settings"]:
         self.configs.update({"settings": self._default_settings})
         update_settings(self._config_file, {"settings": self._default_settings})
     self.update_lanzoucloud_settings()
     if ref_ui and self.tabWidget.currentIndex() == 1:  # 更新文件界面的时间
         self.show_file_and_folder_lists()
Exemplo n.º 4
0
 def call_update_cookie(self, cookie):
     """更新cookie至config文件"""
     up_info = {"cookie": cookie}
     update_settings(self._config_file, up_info)