本文整理汇总了Python中configuration.Configuration.write_config方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.write_config方法的具体用法?Python Configuration.write_config怎么用?Python Configuration.write_config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.write_config方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: closeEvent
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import write_config [as 别名]
def closeEvent(self, event):
if not self.trayIcon.isVisible() and Configuration.icon:
self.trayIcon.show()
self.hide()
event.ignore()
else:
termine = True
# On vérifie que tous les téléchargements soient finis
for download in self.downloads.instance.downloads:
if download.state == 3:
termine = False
# Si il y a un download en cours on affiche la fenêtre
if not termine and not Configuration.close_window:
# Un petit messageBox avec bouton clickable :)
msgBox = QMessageBox(QMessageBox.Question, u"Voulez-vous vraiment quitter?", u"Un ou plusieurs téléchargements sont en cours, et pyRex ne gère pas encore la reprise des téléchargements. Si vous quittez maintenant, toute progression sera perdue!")
checkBox = QCheckBox(u"Ne plus afficher ce message", msgBox)
checkBox.blockSignals(True)
msgBox.addButton(checkBox, QMessageBox.ActionRole)
msgBox.addButton("Annuler", QMessageBox.NoRole)
yesButton = msgBox.addButton("Valider", QMessageBox.YesRole)
msgBox.exec_()
if msgBox.clickedButton() == yesButton:
# On save l'état du bouton à cliquer
if checkBox.checkState() == Qt.Checked:
Configuration.close_window = True
Configuration.write_config()
event.accept()
else:
event.ignore()
else:
event.accept()
示例2: saveConfig
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import write_config [as 别名]
def saveConfig(self):
# Configuration Générale
self.nickname = str(self.pseudo_edit.text())
try:
self.save_dir = str(self.dir_button.text())
except UnicodeEncodeError:
self.save_dir = unicode(self.dir_button.text())
self.max_simultaneous_downloads = int(self.spin_max_dwl.value())
self.max_results = int(self.spin_nb_res_page.value())
self.clean_dl_list = self.check_clean_dl_list.isChecked()
self.icon = self.check_icon.isChecked()
# Configuration Partages
self.ftp_enabled = self.checkBox_FTP.isChecked()
self.ftp_port = int(self.spin_port.value())
self.ftp_maxlogins = int(self.spin_connex_sim.value())
self.share_downloads = self.check_share_myFiles.isChecked()
self.display_mine = self.check_aff_maListe.isChecked()
# Configuration Avancée
self.ip_daemon = str(self.edit_IP_daemon.text())
self.log_in_file = int(self.combo_logs.currentIndex())
self.nb_ips_scan_lan = int(self.spin_nb_ip_scan.value())
self.time_between_scan = int(self.spin_tps_scan.value())
self.ip_range = str(self.edit_plage_ip.text())
self.ips_remote_control = str(self.edit_ip_conf_daemon.text())
self.ftp_show_downloads = int(self.combo_aff_myShares.currentIndex())
self.adv_mode = self.check_expert_mode.isChecked()
# On ecrit la config du gui dans un fichier (config.ini)
# Debug
print "On écrit la nouvelle config du gui"
Configuration.save_dir = self.save_dir
Configuration.max_simultaneous_downloads = self.max_simultaneous_downloads
Configuration.max_results = self.max_results
Configuration.clean_dl_list = self.clean_dl_list
Configuration.icon = self.icon
Configuration.share_downloads = self.share_downloads
Configuration.display_mine = self.display_mine
Configuration.ip_daemon = self.ip_daemon
Configuration.log_in_file = self.log_in_file
Configuration.adv_mode = self.adv_mode
Configuration.write_config()
# On envoie la config du daemon au daemon
# Debug
print "On envoie la nouvelle config au daemon"
daemon = ConfDaemon(self.varsDaemonToCheck.emit, self.nickname, self.time_between_scan, self.nb_ips_scan_lan, self.ip_range, self.ips_remote_control, self.ftp_enabled, self.ftp_port, self.ftp_maxlogins, self.ftp_show_downloads)
daemon.set_conf()