def __init__(self, parent=None): """ Constructor Keywords arguments: parent -- the parent QWidget """ self.main_window = parent QtGui.QWidget.__init__(self) # Set the header, with the icon, label and script button self.header_widget = general_header_widget(self.main_window.experiment) button_help = QtGui.QPushButton(self.main_window.experiment.icon( \ "help"), "") button_help.setIconSize(QtCore.QSize(16, 16)) button_help.clicked.connect(self.open_help_tab) button_help.setToolTip("Tell me more about OpenSesame!") header_hbox = QtGui.QHBoxLayout() header_hbox.addWidget(self.main_window.experiment.label_image( \ "experiment")) header_hbox.addWidget(self.header_widget) header_hbox.addStretch() header_hbox.addWidget(button_help) header_hbox.setContentsMargins(0, 0, 0, 16) header_widget = QtGui.QWidget() header_widget.setLayout(header_hbox) # The rest of the controls from the UI file w = QtGui.QWidget() self.ui = general_widget_ui.Ui_Form() self.ui.setupUi(w) self.main_window.theme.apply_theme(self) # The foeground and background widgets get a special treatment self.ui.edit_foreground = color_edit.color_edit( \ self.main_window.experiment) self.ui.edit_background = color_edit.color_edit( \ self.main_window.experiment) self.ui.edit_foreground.setSizePolicy(QtGui.QSizePolicy.Fixed, \ QtGui.QSizePolicy.Fixed) self.ui.edit_background.setSizePolicy(QtGui.QSizePolicy.Fixed, \ QtGui.QSizePolicy.Fixed) self.ui.layout_general_properties.addWidget(self.ui.edit_foreground, \ 4, 3) self.ui.layout_general_properties.addWidget(self.ui.edit_background, \ 5, 3) QtCore.QObject.connect(self.ui.edit_foreground, QtCore.SIGNAL( \ "set_color"), self.apply_changes) QtCore.QObject.connect(self.ui.edit_background, QtCore.SIGNAL( \ "set_color"), self.apply_changes) # Connect the rest self.ui.combobox_start.currentIndexChanged.connect(self.apply_changes) self.ui.spinbox_width.editingFinished.connect(self.apply_changes) self.ui.spinbox_height.editingFinished.connect(self.apply_changes) self.ui.group_script.toggled.connect(self.toggle_script_editor) self.ui.group_backend_settings.toggled.connect( \ self.toggle_backend_settings) self.ui.label_opensesame.setText(unicode( \ self.ui.label_opensesame.text()).replace("[version]", \ misc.version).replace("[codename]", misc.codename)) self.ui.label_website.mousePressEvent = self.open_website self.ui.label_facebook.mousePressEvent = self.open_facebook self.ui.label_twitter.mousePressEvent = self.open_twitter # Set the backend combobox for backend in openexp.backend_info.backend_list: desc = openexp.backend_info.backend_list[backend]["description"] icon = openexp.backend_info.backend_list[backend]["icon"] self.ui.combobox_backend.addItem(self.main_window.theme.qicon( \ icon), self.backend_format % (backend, desc)) self.ui.combobox_backend.currentIndexChanged.connect(self.apply_changes) # Script editor self.edit_script = inline_editor.inline_editor( \ self.main_window.experiment, syntax="opensesame") self.edit_script.apply.clicked.connect(self.apply_script) self.ui.layout_script.addWidget(self.edit_script) vbox = QtGui.QVBoxLayout() vbox.addWidget(header_widget) vbox.addWidget(w) self.setLayout(vbox) self.general_tab = True self.toggle_script_editor() self.toggle_backend_settings()
def __init__(self, parent=None): """ Constructor. Keywords arguments: parent -- The parent QWidget. (default=None) """ self.main_window = parent QtGui.QWidget.__init__(self) # Set the header, with the icon, label and script button self.header_widget = general_header_widget(self, \ self.main_window.experiment) button_help = QtGui.QPushButton(self.main_window.experiment.icon( \ u"help"), u"") button_help.setIconSize(QtCore.QSize(16, 16)) button_help.clicked.connect( \ self.main_window.ui.tabwidget.open_general_help) button_help.setToolTip(_(u"Tell me more about OpenSesame!")) header_hbox = QtGui.QHBoxLayout() header_hbox.addWidget(self.main_window.experiment.label_image( \ u"experiment")) header_hbox.addWidget(self.header_widget) header_hbox.addStretch() header_hbox.addWidget(button_help) header_hbox.setContentsMargins(0, 0, 0, 0) header_widget = QtGui.QWidget() header_widget.setLayout(header_hbox) # The rest of the controls from the UI file w = QtGui.QWidget() self.ui = general_widget_ui.Ui_general_widget() self.ui.setupUi(w) self.main_window.theme.apply_theme(self) # Initialize the color and font widgets self.ui.edit_foreground.initialize(self.main_window.experiment) self.ui.edit_background.initialize(self.main_window.experiment) QtCore.QObject.connect(self.ui.edit_foreground, QtCore.SIGNAL( \ u"set_color"), self.apply_changes) QtCore.QObject.connect(self.ui.edit_background, QtCore.SIGNAL( \ u"set_color"), self.apply_changes) self.ui.widget_font.initialize(self.main_window.experiment) QtCore.QObject.connect(self.ui.widget_font, QtCore.SIGNAL( \ u"font_changed"), self.apply_changes) # Connect the rest self.ui.spinbox_width.editingFinished.connect(self.apply_changes) self.ui.spinbox_height.editingFinished.connect(self.apply_changes) self.ui.button_script_editor.clicked.connect( \ self.main_window.ui.tabwidget.open_general_script) self.ui.button_backend_settings.clicked.connect( \ self.main_window.ui.tabwidget.open_backend_settings) # Set the backend combobox for backend in openexp.backend_info.backend_list: desc = openexp.backend_info.backend_list[backend][u"description"] icon = openexp.backend_info.backend_list[backend][u"icon"] self.ui.combobox_backend.addItem(self.main_window.theme.qicon( \ icon), self.backend_format % (backend, desc)) self.ui.combobox_backend.currentIndexChanged.connect( self.apply_changes) # Variable transparency self.ui.checkbox_transparent_variables.stateChanged.connect( \ self.apply_changes) # Bi-directional-text support self.ui.checkbox_bidi.stateChanged.connect(self.apply_changes) vbox = QtGui.QVBoxLayout() vbox.addWidget(header_widget) vbox.addWidget(w) self.setLayout(vbox) self.tab_name = u'__general_properties__' self.on_activate = self.refresh
def __init__(self, parent=None): """ Constructor Keywords arguments: parent -- the parent QWidget """ self.main_window = parent QtGui.QWidget.__init__(self) # Set the header, with the icon, label and script button self.header_widget = general_header_widget(self, \ self.main_window.experiment) button_help = QtGui.QPushButton(self.main_window.experiment.icon( \ "help"), "") button_help.setIconSize(QtCore.QSize(16, 16)) button_help.clicked.connect( \ self.main_window.ui.tabwidget.open_general_help) button_help.setToolTip(_("Tell me more about OpenSesame!")) header_hbox = QtGui.QHBoxLayout() header_hbox.addWidget(self.main_window.experiment.label_image( \ "experiment")) header_hbox.addWidget(self.header_widget) header_hbox.addStretch() header_hbox.addWidget(button_help) header_hbox.setContentsMargins(0, 0, 0, 0) header_widget = QtGui.QWidget() header_widget.setLayout(header_hbox) # The rest of the controls from the UI file w = QtGui.QWidget() self.ui = general_widget_ui.Ui_general_widget() self.ui.setupUi(w) self.main_window.theme.apply_theme(self) # Initialize the color and font widgets self.ui.edit_foreground.initialize(self.main_window.experiment) self.ui.edit_background.initialize(self.main_window.experiment) QtCore.QObject.connect(self.ui.edit_foreground, QtCore.SIGNAL( \ "set_color"), self.apply_changes) QtCore.QObject.connect(self.ui.edit_background, QtCore.SIGNAL( \ "set_color"), self.apply_changes) self.ui.widget_font.initialize(self.main_window.experiment) QtCore.QObject.connect(self.ui.widget_font, QtCore.SIGNAL( \ "font_changed"), self.apply_changes) # Connect the rest self.ui.spinbox_width.editingFinished.connect(self.apply_changes) self.ui.spinbox_height.editingFinished.connect(self.apply_changes) self.ui.button_script_editor.clicked.connect( \ self.main_window.ui.tabwidget.open_general_script) self.ui.button_backend_settings.clicked.connect( \ self.main_window.ui.tabwidget.open_backend_settings) # Set the backend combobox for backend in openexp.backend_info.backend_list: desc = openexp.backend_info.backend_list[backend]["description"] icon = openexp.backend_info.backend_list[backend]["icon"] self.ui.combobox_backend.addItem(self.main_window.theme.qicon( \ icon), self.backend_format % (backend, desc)) self.ui.combobox_backend.currentIndexChanged.connect(self.apply_changes) vbox = QtGui.QVBoxLayout() vbox.addWidget(header_widget) vbox.addWidget(w) self.setLayout(vbox) self.tab_name = '__general_properties__' self.on_activate = self.refresh