def showDocWindow(self):
     """
     Shows documentation window (with help and licensing info)
     """
     self.docWindow = QWebView()
     self.docWindow.closeEvent = self.closeDocWindow
     self.docWindow.setWindowTitle("Documentation")
     self.docWindow.setWindowIcon(self.help_icon)
     self.docWindow.load(QtCore.QUrl(get_resource_loc("helpfile.html")))
     self.docWindow.show()
 def showDocWindow(self):
     """
     Shows documentation window (with help and licensing info)
     """
     self.docWindow = QWebView()
     self.docWindow.closeEvent = self.closeDocWindow
     self.docWindow.setWindowTitle("Documentation")
     self.docWindow.setWindowIcon(self.help_icon)
     self.docWindow.load(QtCore.QUrl(get_resource_loc("helpfile.html")))
     self.docWindow.show()
Пример #3
0
    def _initUI(self):

        if self.kind == 'mc':

            answers = 'No;Maybe;Yes'
            category = ['BIS;BAS','BIS']
            score =  ['0;1;2', '2;1;0' ]

        instruction = 'Please enter your answer'
        self.question_ui_path = get_resource_loc("questionnairecreator.ui")

#        question_ui_path = get_resource_loc("questionnairedialog_mc.ui")
        uic.loadUi(self.question_ui_path, self)
        self.addQuestionButton.clicked.connect(self.makeQuestionnaire)
        self.cancelButton.clicked.connect(self.reject)
        self.languageComboBox.addItems(self.lang)
        self.backendComboBox.addItems(self.backend)
        self.bgColorComboBox.addItems(self.bgcolor)
        self.fgColorComboBox.addItems(self.fgcolor)
        self.orderComboBox.addItems(self.order)
        self.questionPlainTextEdit.setPlainText('\n'.join(self.questions))
        self.idPlainTextEdit.setPlainText('\n'.join(self._id))
        self.resolutionHorizontalSpinBox.setValue(self.resolutionHorizontal)
        self.resolutionVerticalSpinBox.setValue(self.resolutionVertical)
        self.instructionPlainTextEdit.setPlainText(instruction)

        if self.kind == 'mc':
            self.infile = get_resource_loc('opensesame.script.mc')
            self.label.setText('Create MC Questionnaire')
            self.answerLineEdit.setText(answers)
            self.categoryPlainTextEdit.setPlainText('\n'.join(category))
            self.scorePlainTextEdit.setPlainText('\n'.join(score))
        elif self.kind == 'open':
            self.infile = get_resource_loc('opensesame.script.open')
            self.label.setText('Create Open Questionnaire')
            self.answerLineEdit.hide()
            self.categoryPlainTextEdit.hide()
            self.scorePlainTextEdit.hide()
            self.answerLabel.hide()
            self.categoryLabel.hide()
            self.scoreLabel.hide()
    def _initUI(self):
        """
        Initializes the UI and sets button actions
        """
        #        QtGui.QMainWindow.__init__(self)

        # Load resources
        ui_path = get_resource_loc("questionnairemanager.ui")
        ico_path = get_resource_loc("questionnairemanager.png")
        helpimg_path = get_resource_loc("help-about.png")
        aboutimg_path = get_resource_loc("help-contents.png")
        labelimg_path = get_resource_loc("questionnairemanager.png")

        # icons
        self.help_icon = QtGui.QIcon(helpimg_path)
        self.about_icon = QtGui.QIcon(aboutimg_path)

        self.command = getOpensesamerunCmd()
        self.defaultOpensesame = 'C:\Program Files\OpenSesame'

        # Load and setup UI
        uic.loadUi(ui_path, self)
        self.setWindowIcon(QtGui.QIcon(ico_path))
        self.setFixedSize(538, 819)
        self.center()
        self.setWindowTitle('OpenSesame Questionnaire Manager')
        self.docButton.setIcon(self.help_icon)
        self.aboutButton.setIcon(self.about_icon)
        self.srcCheckBox.setChecked(False)
        self.pythonLabel.hide()
        self.pythonLineEdit.hide()
        self.pythonButton.hide()
        self.statusBox.setReadOnly(True)
        self.statusBox.hide()
        pixmap = QtGui.QPixmap(labelimg_path)
        self.image.setPixmap(pixmap)

        # set parameters for listWidget
        #self.listWidget.setDragDropMode(QtGui.QAbstractItemView.InternalMove)
        #        self.listWidget.DropIndicatorPosition(QtGui.QAbstractItemView.AboveItem)
        if self.command == "":
            self.opensesamerunLabel.show()
            self.opensesamerunLineEdit.show()
            self.opensesamerunButton.show()
            self.opensesameNotFoundLabel.show()

        else:
            self.opensesamerunLabel.hide()
            self.opensesamerunLineEdit.hide()
            self.opensesamerunButton.hide()
            self.opensesameNotFoundLabel.hide()

        if debug:
            self.statusBox.show()

        # Set button actions
        self.inputFolderButton.clicked.connect(self.selectInputFolderLocation)
        self.logFolderButton.clicked.connect(self.selectLogFolderDestination)
        self.startButton.clicked.connect(self.startExperiment)
        self.docButton.clicked.connect(self.showDocWindow)
        self.aboutButton.clicked.connect(self.showAboutWindow)
        self.restoreGuiButton.clicked.connect(self.selectOpenGuiFile)
        self.saveGuiButton.clicked.connect(self.selectSaveGuiFile)
        self.opensesamerunButton.clicked.connect(self.selectOpensesamerunFile)
        self.pythonButton.clicked.connect(self.selectPythonFile)
        self.createOpenButton.clicked.connect(self.addOpenQuestion)
        self.createMCButton.clicked.connect(self.addMCQuestion)
        self.refreshButton.clicked.connect(self.refreshWidgets)

        self.srcCheckBox.stateChanged.connect(self.updaterunFromSource)

        # Redirect console output to textbox in UI, printing stdout in black
        # and stderr in red
        sys.stdout = OutLog(self.statusBox, sys.stdout, QtGui.QColor(0, 0, 0))
        if not hasattr(sys, 'frozen'):
            sys.stderr = OutLog(self.statusBox, sys.stderr,
                                QtGui.QColor(255, 0, 0))
        else:
            sys.stderr = OutLog(self.statusBox, None, QtGui.QColor(255, 0, 0))
        print("")

        # The folders to read data files from
        self.sourceFolder = get_data_loc()
        self.inputFolderLocation.setText(self.sourceFolder)
        print(self.sourceFolder)

        # the folder to write the output file to
        self.destinationFolder = ""
        self.locationopensesamerun = ""
        self.locationPython = ""
        self._lastSelectedDestDir = ""
        self._lastSelectedSourceDir = ""
        self.pythonCommand = ""
    def _initUI(self):
        """
        Initializes the UI and sets button actions
        """


        self.idKey                   = 'id'
        self.responseKey             = 'response'
        self.categoryKey             = 'category'
        self.answerOptionKey         = 'answer_options'
        self.answerScoreKey          = 'answer_options_scores'

        _id = ['1','2']
        category = ['BIS;BAS','BIS']
        answers = 'No;Maybe;Yes'
        score =  ['0;1;2', '2;1;0' ]

        # Load resources
        ui_path = get_resource_loc("questionnaireprocessor.ui")
        ico_path = get_resource_loc("questionnaireprocessor.png")
        helpimg_path = get_resource_loc("help-about.png")
        aboutimg_path = get_resource_loc("help-contents.png")
        labelimg_path = get_resource_loc("questionnaireprocessor.png")

        # icons
        self.help_icon = QtGui.QIcon(helpimg_path)
        self.about_icon = QtGui.QIcon(aboutimg_path)

        # Load and setup UI
        uic.loadUi(ui_path, self)
        self.setWindowIcon(QtGui.QIcon(ico_path))
        self.setFixedSize(606,889)
        self.center()
        self.setWindowTitle('OpenSesame Questionnaire Processor')
        self.docButton.setIcon(self.help_icon)
        self.aboutButton.setIcon(self.about_icon)
        self.idColumnLineEdit.setText(self.idKey)
        self.responseColumnLineEdit.setText(self.responseKey)
        self.categoryColumnLineEdit.setText(self.categoryKey)
        self.answerOptionColumnLineEdit.setText(self.answerOptionKey)
        self.answerScoreColumnLineEdit.setText(self.answerScoreKey)

        self.idCustomPlainTextEdit.setPlainText('\n'.join(_id))
        self.categoryCustomPlainTextEdit.setPlainText('\n'.join(category))
        self.answerCustomLineEdit.setText(answers)
        self.scoreCustomPlainTextEdit.setPlainText('\n'.join(score))
        self.statusBox.hide()
        self.statusBox.setReadOnly(True)

        pixmap = QtGui.QPixmap(labelimg_path)
        self.image.setPixmap(pixmap)

        if debug:
            self.statusBox.show()

        #self.rowCounter = -1
        #self.answerPlainTextEdit.setPlainText(u'No:0\nMaybe:1\nYes:2')
        #self.categoryPlainTextEdit.setPlainText(u'Extraversion:1,2,3\nNeuroticism:4,5,6')
#        self.show()

        ## hide custom elements
        self.idColumnLabel.hide()
        self.idColumnLineEdit.hide()
        self.responseColumnLabel.hide()
        self.responseColumnLineEdit.hide()
        self.categoryColumnLabel.hide()
        self.categoryColumnLineEdit.hide()
        self.answerOptionColumnLabel.hide()
        self.answerOptionColumnLineEdit.hide()
        self.answerScoreColumnLabel.hide()
        self.answerScoreColumnLineEdit.hide()
        self.line_2.hide()

        self.idCustomLabel.hide()
        self.idCustomPlainTextEdit.hide()
        self.categoryCustomLabel.hide()
        self.categoryCustomPlainTextEdit.hide()
        self.answerCustomLabel.hide()
        self.answerCustomLineEdit.hide()
        self.scoreCustomLabel.hide()
        self.scoreCustomPlainTextEdit.hide()
        self.customExperimentCheckBox.hide()



        # Set button actions
        self.inputFolderButton.clicked.connect(self.selectInputFolderLocation)
        self.outputFolderButton.clicked.connect(self.selectOutputFolderDestination)
#        self.addItemButton.clicked.connect(self.addItemToTable)
#        self.removeItemButton.clicked.connect(self.removeItemFromTable)
        self.processButton.clicked.connect(self.startAnalyze)
        self.docButton.clicked.connect(self.showDocWindow)
        self.aboutButton.clicked.connect(self.showAboutWindow)

        self.customColumnCheckBox.stateChanged.connect(self.updateCustomColumnWidgets)
        self.customExperimentCheckBox.stateChanged.connect(self.updateCustomExperimentWidgets)


        # Redirect console output to textbox in UI, printing stdout in black
        # and stderr in red
        sys.stdout = OutLog(self.statusBox, sys.stdout, QtGui.QColor(0,0,0))
        if not hasattr(sys,'frozen'):
            sys.stderr = OutLog(self.statusBox, sys.stderr, QtGui.QColor(255,0,0))
        else:
            sys.stderr = OutLog(self.statusBox, None, QtGui.QColor(255,0,0))
        print("")

        # The folders to read data files from
        self.sourceFolder = ""
        # the folder to write the output file to
        self.destinationFolder = ""

        self._lastSelectedDestDir = ""
        self._lastSelectedSourceDir = ""
    def _initUI(self):
        """
        Initializes the UI and sets button actions
        """

        self.idKey = 'id'
        self.responseKey = 'response'
        self.categoryKey = 'category'
        self.answerOptionKey = 'answer_options'
        self.answerScoreKey = 'answer_options_scores'

        _id = ['1', '2']
        category = ['BIS;BAS', 'BIS']
        answers = 'No;Maybe;Yes'
        score = ['0;1;2', '2;1;0']

        # Load resources
        ui_path = get_resource_loc("questionnaireprocessor.ui")
        ico_path = get_resource_loc("questionnaireprocessor.png")
        helpimg_path = get_resource_loc("help-about.png")
        aboutimg_path = get_resource_loc("help-contents.png")
        labelimg_path = get_resource_loc("questionnaireprocessor.png")

        # icons
        self.help_icon = QtGui.QIcon(helpimg_path)
        self.about_icon = QtGui.QIcon(aboutimg_path)

        # Load and setup UI
        uic.loadUi(ui_path, self)
        self.setWindowIcon(QtGui.QIcon(ico_path))
        self.setFixedSize(606, 889)
        self.center()
        self.setWindowTitle('OpenSesame Questionnaire Processor')
        self.docButton.setIcon(self.help_icon)
        self.aboutButton.setIcon(self.about_icon)
        self.idColumnLineEdit.setText(self.idKey)
        self.responseColumnLineEdit.setText(self.responseKey)
        self.categoryColumnLineEdit.setText(self.categoryKey)
        self.answerOptionColumnLineEdit.setText(self.answerOptionKey)
        self.answerScoreColumnLineEdit.setText(self.answerScoreKey)

        self.idCustomPlainTextEdit.setPlainText('\n'.join(_id))
        self.categoryCustomPlainTextEdit.setPlainText('\n'.join(category))
        self.answerCustomLineEdit.setText(answers)
        self.scoreCustomPlainTextEdit.setPlainText('\n'.join(score))
        self.statusBox.hide()
        self.statusBox.setReadOnly(True)

        pixmap = QtGui.QPixmap(labelimg_path)
        self.image.setPixmap(pixmap)

        if debug:
            self.statusBox.show()

        #self.rowCounter = -1
        #self.answerPlainTextEdit.setPlainText(u'No:0\nMaybe:1\nYes:2')
        #self.categoryPlainTextEdit.setPlainText(u'Extraversion:1,2,3\nNeuroticism:4,5,6')
#        self.show()

## hide custom elements
        self.idColumnLabel.hide()
        self.idColumnLineEdit.hide()
        self.responseColumnLabel.hide()
        self.responseColumnLineEdit.hide()
        self.categoryColumnLabel.hide()
        self.categoryColumnLineEdit.hide()
        self.answerOptionColumnLabel.hide()
        self.answerOptionColumnLineEdit.hide()
        self.answerScoreColumnLabel.hide()
        self.answerScoreColumnLineEdit.hide()
        self.line_2.hide()

        self.idCustomLabel.hide()
        self.idCustomPlainTextEdit.hide()
        self.categoryCustomLabel.hide()
        self.categoryCustomPlainTextEdit.hide()
        self.answerCustomLabel.hide()
        self.answerCustomLineEdit.hide()
        self.scoreCustomLabel.hide()
        self.scoreCustomPlainTextEdit.hide()
        self.customExperimentCheckBox.hide()

        # Set button actions
        self.inputFolderButton.clicked.connect(self.selectInputFolderLocation)
        self.outputFolderButton.clicked.connect(
            self.selectOutputFolderDestination)
        #        self.addItemButton.clicked.connect(self.addItemToTable)
        #        self.removeItemButton.clicked.connect(self.removeItemFromTable)
        self.processButton.clicked.connect(self.startAnalyze)
        self.docButton.clicked.connect(self.showDocWindow)
        self.aboutButton.clicked.connect(self.showAboutWindow)

        self.customColumnCheckBox.stateChanged.connect(
            self.updateCustomColumnWidgets)
        self.customExperimentCheckBox.stateChanged.connect(
            self.updateCustomExperimentWidgets)

        # Redirect console output to textbox in UI, printing stdout in black
        # and stderr in red
        sys.stdout = OutLog(self.statusBox, sys.stdout, QtGui.QColor(0, 0, 0))
        if not hasattr(sys, 'frozen'):
            sys.stderr = OutLog(self.statusBox, sys.stderr,
                                QtGui.QColor(255, 0, 0))
        else:
            sys.stderr = OutLog(self.statusBox, None, QtGui.QColor(255, 0, 0))
        print("")

        # The folders to read data files from
        self.sourceFolder = ""
        # the folder to write the output file to
        self.destinationFolder = ""

        self._lastSelectedDestDir = ""
        self._lastSelectedSourceDir = ""