unicode(sys.executable, sys.getfilesystemencoding()))) if sys.executable.endswith("portable.exe") or \ sys.executable.endswith("portable_debug.exe"): os.environ['APPDATA'] = path return path this_module_path = os.path.dirname( unicode(__file__, sys.getfilesystemencoding())) return os.path.abspath(this_module_path) os.chdir(os.path.abspath(project_path())) from Language import get_language_manager language_management = get_language_manager() language_management.install_default_translation() import extension if not 'USE_GTK2' in os.environ: try: import pygicompat except ImportError: print "error: pygi compat not found" pass import glib import shutil import signal import time import datetime
path = os.path.abspath(os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding()))) if sys.executable.endswith("portable.exe") or \ sys.executable.endswith("portable_debug.exe"): os.environ['APPDATA'] = path return path this_module_path = os.path.dirname(unicode(__file__, sys.getfilesystemencoding())) return os.path.abspath(this_module_path) os.chdir(os.path.abspath(project_path())) from Language import get_language_manager language_management = get_language_manager() language_management.install_default_translation() import extension if 'USE_GI' in os.environ: try: import pygicompat except ImportError: print "error: pygi compat not found" pass import glib import shutil import signal import Info try:
def __init__(self, session): """constructor """ BaseTable.__init__(self, 4, 2) self.session = session self.append_markup('<b>'+tr('Logger')+'</b>') self.append_check(tr('Enable logger'), 'session.config.b_log_enabled') # language settings self.append_markup('<b>'+tr('Language')+'</b>') # languages combobox self._language_management = get_language_manager() self.session.config.subscribe(self._on_language_changed, 'language_config') self.add_text(tr("Select language:"), 0, 3, True) default = 0 index = 1 self.language_combo = QtGui.QComboBox() self.language_combo.addItem(tr('Automatic detection'), None) lang_dict = self._language_management.LANGUAGES_DICT for lang_key in sorted(lang_dict.keys()): self.language_combo.addItem(unicode(lang_dict[lang_key]), lang_key) if lang_key == self.session.config.language_config: default = index index += 1 #in case we have some new language and it's not already on the DICT for lang_key in self._language_management.get_available_languages(): if lang_key not in self._language_management.LANGUAGES_DICT.keys(): self.language_combo.addItem(unicode(lang_key), lang_key) if lang_key == self.session.config.language_config: default = index index += 1 self.language_combo.currentIndexChanged.connect( lambda text: self.on_language_combo_changed(self.language_combo, 'session.config.language_config')) self.attach(self.language_combo, 2, 5, 3, 1) #language option self.session.config.get_or_set("spell_lang", "en") self.lang_menu = self.create_combo(self.get_spell_langs, 'session.config.spell_lang') #FIXME: implement this setting cb_check_spelling = self.create_check( tr('Enable spell check if available \n(requires %s)') % 'python-gtkspell', 'session.config.b_enable_spell_check') self.append_row(cb_check_spelling) self.attach(self.lang_menu, 2, 5, 4, 1) self.session.config.subscribe(self._on_spell_change, 'b_enable_spell_check') #update spell lang combo sensitivity self._on_spell_change(self.session.config.get_or_set('b_enable_spell_check', False)) self.append_markup('<b>'+tr('File transfers')+'</b>') self.append_check(tr('Sort received files by sender'), 'session.config.b_download_folder_per_account') self.append_markup(tr('Save files to:')) def on_path_button_clicked(): ''' updates the download dir config value ''' new_path = unicode(QtGui.QFileDialog.getExistingDirectory( directory = self.session.config.download_folder)) set_new_path(new_path) path_edit.setText(new_path) def set_new_path(new_path): if new_path != self.session.config.download_folder: self.session.config.download_folder = new_path path_edit = QtGui.QLineEdit( self.session.config.get_or_set("download_folder", e3.common.locations.downloads())) path = QtGui.QWidget() path_button = QtGui.QPushButton( QtGui.QIcon.fromTheme('folder'), '') path_lay = QtGui.QHBoxLayout() path_lay.addWidget(path_edit) path_lay.addWidget(path_button) path.setLayout(path_lay) self.attach(path, 5, 3, 7, 1) path_button.clicked.connect(on_path_button_clicked) path_edit.textChanged.connect( lambda new_path: set_new_path(unicode(new_path))) # mail settings self.append_markup('<b>'+_('Mail')+'</b>') self.append_check(_('Open mail in default desktop client'), 'session.config.b_open_mail_in_desktop') self.append_markup('<b>'+_('Updates')+'</b>') self.append_check(_('Weekly check for plugins/themes updates on startup'), 'session.config.b_check_for_updates') self.show_all()