def set_controls(self): """Updates the controls.""" if self.lock: return self.lock = True debug.msg() self.ui.checkbox_immediately_rename.setChecked( \ config.get_config(u'immediate_rename')) self.ui.checkbox_autoresponse.setChecked( \ self.main_window.experiment.auto_response) self.ui.checkbox_toolbar_text.setChecked( \ self.main_window.ui.toolbar_main.toolButtonStyle() == \ QtCore.Qt.ToolButtonTextUnderIcon) self.ui.checkbox_small_toolbar.setChecked( \ config.get_config(u"toolbar_size") == 16) self.ui.checkbox_enable_autosave.setChecked( \ config.get_config(u'autosave_interval') > 0) self.ui.spinbox_autosave_interval.setValue( \ config.get_config(u'autosave_interval') / 60000) # Show in minutes self.ui.spinbox_autosave_max_age.setValue( \ config.get_config(u'autosave_max_age')) self.ui.checkbox_auto_update_check.setChecked(config.get_config( \ u'auto_update_check')) self.ui.combobox_runner.setCurrentIndex( \ self.ui.combobox_runner.findText(config.get_config(u'runner'), \ flags=QtCore.Qt.MatchContains)) # Disable some of the controls, if they depend on other controls if config.get_config(u'autosave_interval') <= 0: self.ui.spinbox_autosave_interval.setDisabled(True) # Set the style combobox i = 0 if config.get_config(u'style') == u'': self.ui.combobox_style.addItem(u"[Default]") self.ui.combobox_style.setCurrentIndex(i) i += 1 for style in QtGui.QStyleFactory.keys(): self.ui.combobox_style.addItem(style) if config.get_config(u'style') == unicode(style): self.ui.combobox_style.setCurrentIndex(i) i += 1 # Set the theme combobox i = 0 for _theme in theme.available_themes: self.ui.combobox_theme.addItem(_theme) if config.get_config(u'theme') == _theme: self.ui.combobox_theme.setCurrentIndex(i) i += 1 # Set the plugin status for plugin in plugins.list_plugins(filter_disabled=False): self.checkbox_plugins[plugin].setChecked(not \ plugins.plugin_disabled(plugin)) self.lock = False
def set_controls(self): """Update the controls""" if self.lock: return self.lock = True debug.msg() self.ui.checkbox_immediately_rename.setChecked(self.main_window.immediate_rename) self.ui.checkbox_autoresponse.setChecked(self.main_window.experiment.auto_response) self.ui.checkbox_show_random_tips.setChecked(self.main_window.show_startup_tip) self.ui.checkbox_toolbar_text.setChecked(self.main_window.ui.toolbar_main.toolButtonStyle() == QtCore.Qt.ToolButtonTextUnderIcon) self.ui.checkbox_small_toolbar.setChecked( \ config.get_config("toolbar_size") == 16) self.ui.checkbox_enable_autosave.setChecked(self.main_window.autosave_interval > 0) self.ui.spinbox_autosave_interval.setValue(self.main_window.autosave_interval / 60000) # Show in minutes, not milliseconds self.ui.spinbox_autosave_max_age.setValue(self.main_window.autosave_max_age) self.ui.checkbox_auto_update_check.setChecked(self.main_window.auto_check_update) self.ui.checkbox_opensesamerun.setChecked(self.main_window.opensesamerun) self.ui.checkbox_auto_opensesamerun_exec.setChecked(self.main_window.opensesamerun_exec == "") self.ui.edit_opensesamerun_exec.setText(self.main_window.opensesamerun_exec) self.ui.checkbox_new_experiment_dialog.setChecked(config.get_config("new_experiment_dialog")) self.ui.checkbox_scintilla_auto_indent.setChecked(config.get_config("scintilla_auto_indent")) self.ui.checkbox_scintilla_brace_match.setChecked(config.get_config("scintilla_brace_match")) self.ui.checkbox_scintilla_custom_font.setChecked(config.get_config("scintilla_custom_font")) self.ui.checkbox_scintilla_eol_visible.setChecked(config.get_config("scintilla_eol_visible")) self.ui.checkbox_scintilla_folding.setChecked(config.get_config("scintilla_folding")) self.ui.checkbox_scintilla_indentation_guides.setChecked(config.get_config("scintilla_indentation_guides")) self.ui.checkbox_scintilla_line_numbers.setChecked(config.get_config("scintilla_line_numbers")) self.ui.checkbox_scintilla_right_margin.setChecked(config.get_config("scintilla_right_margin")) self.ui.checkbox_scintilla_auto_indent.setChecked(config.get_config("scintilla_auto_indent")) self.ui.checkbox_scintilla_syntax_highlighting.setChecked(config.get_config("scintilla_syntax_highlighting")) self.ui.checkbox_scintilla_whitespace_visible.setChecked(config.get_config("scintilla_whitespace_visible")) self.ui.font_scintilla_font_family.setCurrentFont(QtGui.QFont(config.get_config("scintilla_font_family"))) self.ui.spinbox_scintilla_font_size.setValue(config.get_config("scintilla_font_size")) # Disable some of the controls, if they depend on other controls if self.main_window.autosave_interval <= 0: self.ui.spinbox_autosave_interval.setDisabled(True) if not self.main_window.opensesamerun: self.ui.checkbox_auto_opensesamerun_exec.setDisabled(True) self.ui.edit_opensesamerun_exec.setDisabled(True) self.ui.label_opensesamerun_exec.setDisabled(True) if self.main_window.opensesamerun_exec == "": self.ui.edit_opensesamerun_exec.setDisabled(True) self.ui.label_opensesamerun_exec.setDisabled(True) i = 0 if self.main_window.style == "": self.ui.combobox_style.addItem("[Default]") self.ui.combobox_style.setCurrentIndex(i) i += 1 for style in QtGui.QStyleFactory.keys(): self.ui.combobox_style.addItem(style) if self.main_window.style == str(style): self.ui.combobox_style.setCurrentIndex(i) i += 1 # Set the plugin status for plugin in plugins.list_plugins(filter_disabled=False): self.checkbox_plugins[plugin].setChecked(not plugins.plugin_disabled(plugin)) self.lock = False
def set_controls(self): """Update the controls""" if self.lock: return self.lock = True debug.msg() self.ui.checkbox_immediately_rename.setChecked( \ config.get_config('immediate_rename')) self.ui.checkbox_autoresponse.setChecked( \ self.main_window.experiment.auto_response) self.ui.checkbox_toolbar_text.setChecked( \ self.main_window.ui.toolbar_main.toolButtonStyle() == \ QtCore.Qt.ToolButtonTextUnderIcon) self.ui.checkbox_small_toolbar.setChecked( \ config.get_config("toolbar_size") == 16) self.ui.checkbox_enable_autosave.setChecked( \ config.get_config('autosave_interval') > 0) self.ui.spinbox_autosave_interval.setValue( \ config.get_config('autosave_interval') / 60000) # Show in minutes self.ui.spinbox_autosave_max_age.setValue( \ config.get_config('autosave_max_age')) self.ui.checkbox_auto_update_check.setChecked(config.get_config( \ 'auto_update_check')) self.ui.checkbox_opensesamerun.setChecked( \ config.get_config('opensesamerun')) self.ui.checkbox_auto_opensesamerun_exec.setChecked( \ config.get_config('opensesamerun_exec') == '') self.ui.edit_opensesamerun_exec.setText( \ config.get_config('opensesamerun_exec')) self.ui.checkbox_scintilla_auto_indent.setChecked(config.get_config( \ "scintilla_auto_indent")) self.ui.checkbox_scintilla_brace_match.setChecked(config.get_config( \ "scintilla_brace_match")) self.ui.checkbox_scintilla_custom_font.setChecked(config.get_config( \ "scintilla_custom_font")) self.ui.checkbox_scintilla_eol_visible.setChecked(config.get_config( \ "scintilla_eol_visible")) self.ui.checkbox_scintilla_folding.setChecked(config.get_config( \ "scintilla_folding")) self.ui.checkbox_scintilla_indentation_guides.setChecked( \ config.get_config("scintilla_indentation_guides")) self.ui.checkbox_scintilla_line_numbers.setChecked(config.get_config( \ "scintilla_line_numbers")) self.ui.checkbox_scintilla_right_margin.setChecked(config.get_config( \ "scintilla_right_margin")) self.ui.checkbox_scintilla_auto_indent.setChecked(config.get_config( \ "scintilla_auto_indent")) self.ui.checkbox_scintilla_syntax_highlighting.setChecked( \ config.get_config("scintilla_syntax_highlighting")) self.ui.checkbox_scintilla_whitespace_visible.setChecked( \ config.get_config("scintilla_whitespace_visible")) self.ui.font_scintilla_font_family.setCurrentFont(QtGui.QFont( \ config.get_config("scintilla_font_family"))) self.ui.spinbox_scintilla_font_size.setValue(config.get_config( \ "scintilla_font_size")) # Disable some of the controls, if they depend on other controls if config.get_config('autosave_interval') <= 0: self.ui.spinbox_autosave_interval.setDisabled(True) if not config.get_config('opensesamerun'): self.ui.checkbox_auto_opensesamerun_exec.setDisabled(True) self.ui.edit_opensesamerun_exec.setDisabled(True) self.ui.label_opensesamerun_exec.setDisabled(True) if config.get_config('opensesamerun_exec') == '': self.ui.edit_opensesamerun_exec.setDisabled(True) self.ui.label_opensesamerun_exec.setDisabled(True) # Set the style combobox i = 0 if config.get_config('style') == '': self.ui.combobox_style.addItem("[Default]") self.ui.combobox_style.setCurrentIndex(i) i += 1 for style in QtGui.QStyleFactory.keys(): self.ui.combobox_style.addItem(style) if config.get_config('style') == unicode(style): self.ui.combobox_style.setCurrentIndex(i) i += 1 # Set the theme combobox i = 0 for _theme in theme.available_themes: self.ui.combobox_theme.addItem(_theme) if config.get_config('theme') == _theme: self.ui.combobox_theme.setCurrentIndex(i) i += 1 # Set the plugin status for plugin in plugins.list_plugins(filter_disabled=False): self.checkbox_plugins[plugin].setChecked(not \ plugins.plugin_disabled(plugin)) self.lock = False