class general_script_editor(QtGui.QWidget): """The general script editor""" def __init__(self, main_window): """ Constructor Arguments: main_window -- the main window """ from QProgEdit import QTabManager self.main_window = main_window QtGui.QWidget.__init__(self, main_window) self.ui = Ui_widget_general_script_editor() self.ui.setupUi(self) self.ui.qprogedit = QTabManager(handler=self._apply, defaultLang= \ u'OpenSesame', handlerButtonText=u'Apply', callHandlerOnFocusOut= \ False, cfg=cfg) self.ui.qprogedit.addTab(u'General script') self.ui.layout_vbox.addWidget(self.ui.qprogedit) self.main_window.theme.apply_theme(self) self.tab_name = '__general_script__' def _apply(self): """Confirm and apply the script changes""" resp = QtGui.QMessageBox.question(self.main_window, _('Apply?'), \ _('Are you sure you want to apply the changes to the general script?'), \ QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if resp == QtGui.QMessageBox.No: return self.main_window.dispatch.event_regenerate.emit( \ self.ui.qprogedit.text()) def on_activate(self): """Refresh the tab when it is activated""" self.refresh() def refresh(self): """Refresh the contents of the general script""" self.ui.qprogedit.setText(self.main_window.experiment.to_string())
def __init__(self, main_window): """ Constructor Arguments: main_window -- the main window """ self.main_window = main_window QtGui.QWidget.__init__(self, main_window) self.ui = Ui_widget_general_script_editor() self.ui.setupUi(self) self.ui.edit = inline_editor(self.main_window.experiment) self.ui.edit.applied.connect(self._apply) self.ui.layout_vbox.addWidget(self.ui.edit) self.main_window.theme.apply_theme(self) self.tab_name = '__general_script__'
class general_script_editor(QtGui.QWidget): """The general script editor""" def __init__(self, main_window): """ Constructor Arguments: main_window -- the main window """ self.main_window = main_window QtGui.QWidget.__init__(self, main_window) self.ui = Ui_widget_general_script_editor() self.ui.setupUi(self) self.ui.edit = inline_editor(self.main_window.experiment) self.ui.edit.applied.connect(self._apply) self.ui.layout_vbox.addWidget(self.ui.edit) self.main_window.theme.apply_theme(self) self.tab_name = '__general_script__' def _apply(self): """Confirm and apply the script changes""" resp = QtGui.QMessageBox.question(self.main_window, _('Apply?'), \ _('Are you sure you want to apply the changes to the general script?'), \ QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if resp == QtGui.QMessageBox.No: return self.main_window.dispatch.event_regenerate.emit(self.ui.edit.getText()) def on_activate(self): """Refresh the tab when it is activated""" self.refresh() def refresh(self): """Refresh the contents of the general script""" self.ui.edit.setText(self.main_window.experiment.to_string())
class general_script_editor(QtGui.QWidget): """The general script editor""" def __init__(self, main_window): """ Constructor Arguments: main_window -- the main window """ from QProgEdit import QTabManager self.main_window = main_window QtGui.QWidget.__init__(self, main_window) self.ui = Ui_widget_general_script_editor() self.ui.setupUi(self) self.ui.qprogedit = QTabManager(handler=self._apply, defaultLang= \ u'OpenSesame', handlerButtonText=u'Apply', cfg=cfg) self.ui.qprogedit.addTab(u'General script') self.ui.layout_vbox.addWidget(self.ui.qprogedit) self.main_window.theme.apply_theme(self) self.tab_name = '__general_script__' def _apply(self): """Confirm and apply the script changes""" resp = QtGui.QMessageBox.question(self.main_window, _('Apply?'), \ _('Are you sure you want to apply the changes to the general script?'), \ QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if resp == QtGui.QMessageBox.No: return self.main_window.dispatch.event_regenerate.emit( \ self.ui.qprogedit.text()) def on_activate(self): """Refresh the tab when it is activated""" self.refresh() def refresh(self): """Refresh the contents of the general script""" self.ui.qprogedit.setText(self.main_window.experiment.to_string())
def __init__(self, main_window): """ Constructor Arguments: main_window -- the main window """ from QProgEdit import QTabManager self.main_window = main_window QtGui.QWidget.__init__(self, main_window) self.ui = Ui_widget_general_script_editor() self.ui.setupUi(self) self.ui.qprogedit = QTabManager(handler=self._apply, defaultLang= \ u'OpenSesame', handlerButtonText=u'Apply', cfg=cfg) self.ui.qprogedit.addTab(u'General script') self.ui.layout_vbox.addWidget(self.ui.qprogedit) self.main_window.theme.apply_theme(self) self.tab_name = '__general_script__'
def __init__(self, main_window): """ Constructor Arguments: main_window -- the main window """ from QProgEdit import QTabManager self.main_window = main_window QtGui.QWidget.__init__(self, main_window) self.ui = Ui_widget_general_script_editor() self.ui.setupUi(self) self.ui.qprogedit = QTabManager(handler=self._apply, defaultLang= \ u'OpenSesame', handlerButtonText=u'Apply', callHandlerOnFocusOut= \ False, cfg=cfg) self.ui.qprogedit.addTab(u'General script') self.ui.layout_vbox.addWidget(self.ui.qprogedit) self.main_window.theme.apply_theme(self) self.tab_name = '__general_script__'