Deleted old config controller
This commit is contained in:
		| @@ -1,76 +0,0 @@ | ||||
| # -*- coding: utf-8 -*- | ||||
| from __future__ import unicode_literals | ||||
| import widgetUtils | ||||
| from wxUI.dialogs import configuration as configurationUI | ||||
|  | ||||
| class configuration(object): | ||||
|  | ||||
| 	def get_notification_type(self, value): | ||||
| 		if value == _("Native"): | ||||
| 			return "native" | ||||
| 		else: | ||||
| 			return "custom" | ||||
|  | ||||
| 	def get_notification_label(self, value): | ||||
| 		if value == "native": | ||||
| 			return _("Native") | ||||
| 		else: | ||||
| 			return _("Custom") | ||||
|  | ||||
| 	def get_update_channel_type(self, value): | ||||
| 		if value == _("Stable"): | ||||
| 			return "stable" | ||||
| 		elif value == _("Weekly"): | ||||
| 			return "weekly" | ||||
| 		else: | ||||
| 			return "alpha" | ||||
|  | ||||
| 	def get_update_channel_label(self, value): | ||||
| 		if value == "stable": | ||||
| 			return _("Stable") | ||||
| 		elif value == "weekly": | ||||
| 			return _("Weekly") | ||||
| 		else: | ||||
| 			return _("Alpha") | ||||
|  | ||||
| 	def __init__(self, session): | ||||
| 		self.session = session | ||||
| 		self.dialog = configurationUI.configurationDialog(_("Preferences")) | ||||
| 		self.create_config() | ||||
|  | ||||
| 	def create_config(self): | ||||
| 		self.dialog.create_general() | ||||
| 		self.dialog.set_value("general", "wall_buffer_count", self.session.settings["buffers"]["count_for_wall_buffers"]) | ||||
| 		self.dialog.set_value("general", "video_buffers_count", self.session.settings["buffers"]["count_for_video_buffers"]) | ||||
| 		self.dialog.set_value("general", "load_images", self.session.settings["general"]["load_images"]) | ||||
| 		self.dialog.set_value("general", "update_channel", self.get_update_channel_label(self.session.settings["general"]["update_channel"])) | ||||
| 		self.dialog.create_chat() | ||||
| 		self.dialog.set_value("chat", "notify_online", self.session.settings["chat"]["notify_online"]) | ||||
| 		self.dialog.set_value("chat", "notify_offline", self.session.settings["chat"]["notify_offline"]) | ||||
| 		self.dialog.set_value("chat", "open_unread_conversations", self.session.settings["chat"]["open_unread_conversations"]) | ||||
| 		self.dialog.set_value("chat", "automove_to_conversations", self.session.settings["chat"]["automove_to_conversations"]) | ||||
| 		self.dialog.set_value("chat", "notifications", self.get_notification_label(self.session.settings["chat"]["notifications"])) | ||||
| 		self.dialog.realize() | ||||
| 		self.response = self.dialog.get_response() | ||||
|  | ||||
| 	def save_configuration(self): | ||||
| 		self.session.settings["buffers"]["count_for_video_buffers"] = self.dialog.get_value("general", "video_buffers_count") | ||||
| 		self.session.settings["general"]["load_images"] = self.dialog.get_value("general", "load_images") | ||||
| 		update_channel = self.get_update_channel_type(self.dialog.get_value("general", "update_channel")) | ||||
| 		if update_channel != self.session.settings["general"]["update_channel"]: | ||||
| 			if update_channel == "stable": | ||||
| 				self.session.settings["general"]["update_channel"] = update_channel | ||||
| 			elif update_channel == "weekly": | ||||
| 				dialog = configurationUI.weekly_channel() | ||||
| 				if dialog == widgetUtils.YES: | ||||
| 					self.session.settings["general"]["update_channel"] = update_channel | ||||
| 			elif update_channel == "alpha": | ||||
| 				dialog = configurationUI.alpha_channel() | ||||
| 				if dialog == widgetUtils.YES: | ||||
| 					self.session.settings["general"]["update_channel"] = update_channel | ||||
| 		self.session.settings["chat"]["notify_online"] = self.dialog.get_value("chat", "notify_online") | ||||
| 		self.session.settings["chat"]["notify_offline"] = self.dialog.get_value("chat", "notify_offline") | ||||
| 		self.session.settings["chat"]["open_unread_conversations"] = self.dialog.get_value("chat", "open_unread_conversations") | ||||
| 		self.session.settings["chat"]["automove_to_conversations"] = self.dialog.get_value("chat", "automove_to_conversations") | ||||
| 		self.session.settings["chat"]["notifications"] = self.get_notification_type(self.dialog.get_value("chat", "notifications")) | ||||
| 		self.session.settings.write() | ||||
		Reference in New Issue
	
	Block a user