예제 #1
0
 def _setPanelVisState(self, state, saveSettings=True):
     state = min(constants.PANEL_VIS_STATE_BOTH_ON, max(0, int(state)))
     self._panelVisBtn.setIcon(self._panelStateIconSet[state])
     self._leftWidget.setVisible(
         state != constants.PANEL_VIS_STATE_RIGHT_ON)
     self._rightWidget.setVisible(
         state != constants.PANEL_VIS_STATE_LEFT_ON)
     if saveSettings:
         appsettings.get().saveSimpleConfig(
             constants.CONFIG_KEY_PANEL_VIS_STATE, state)
예제 #2
0
    def _onDeleteCurrentDirSettings(self):
        config = appsettings.get().testDirSettings()
        removeNames = []
        startDir = self._testManager.startDirOrModule()
        for name, pair in config.items():
            _, root = pair
            if root == startDir:
                removeNames.append(name)
        if not removeNames:
            logger.warning("Current dir settings was not saved before.")
            return

        msg = "Are you sure to delete these dir settings: %s" % removeNames
        answer = QtWidgets.QMessageBox.question(self,
                                                "Remove Current Dir Setting",
                                                msg)
        if answer != QtWidgets.QMessageBox.Yes:
            return

        with appsettings.SettingsGroupContext(
                constants.CONFIG_KEY_SAVED_TEST_DIR) as settings:
            for n in removeNames:
                settings.removeConfig(n)
                logger.info("Remove the dir setting: %s", n)

        self._deferredRegenerateMenu()
예제 #3
0
 def _configNameFromStartAndTopDir(self, startDir, topDir):
     config = appsettings.get().testDirSettings()
     for name in config:
         _topDir, _startDirOrModule = config[name]
         if _topDir == topDir and _startDirOrModule == startDir:
             return name
     return startDir
예제 #4
0
    def _setInitialTestMode(self):
        initRunnerMode = appsettings.get().simpleConfigIntValue(
            constants.CONFIG_KEY_LAST_RUNNER_MODE, -1)
        if initRunnerMode < 0:
            initRunnerMode = self._testManager.getFeasibleRunnerMode()

        self._testManager.setRunnerMode(initRunnerMode)
        return self._testManager.getRunner()
예제 #5
0
 def _saveLastTestDir(self, startDir, topDir):
     settings = appsettings.get()
     settings.saveSimpleConfig(constants.CONFIG_KEY_LAST_TEST_ROOT_DIR,
                               startDir,
                               sync=False)
     settings.saveSimpleConfig(constants.CONFIG_KEY_LAST_TOP_DIR,
                               topDir,
                               sync=True)
     logger.info("Save the last test root: %s", startDir)
예제 #6
0
    def _onTestRunnerSwitched(self):
        act = self.sender()
        if not act:
            return

        runnerMode = variantToPyValue(act.data())
        self._testManager.setRunnerMode(runnerMode)
        runner = self._testManager.getRunner()
        self._updateConfigButton(runner)

        self._uiStream.write(
            ">> Switch to unittest runner <b>{}</b>.<br>".format(
                runner.name()))

        self._onReloadUiButtonClicked()
        appsettings.get().saveSimpleConfig(
            constants.CONFIG_KEY_LAST_RUNNER_MODE, runnerMode)
        for act in self._testRunnerActions:
            self._updateLabelOfTestRunnerAct(act, runnerMode)
예제 #7
0
 def _addToggleConfigAction(self, lbl, icon, tooltip, configKey, slot):
     # Cannot use self._configMenu.addAction() directly here since over-zealous garbage collection in some DCC apps:
     act = QtWidgets.QAction(lbl, self)
     act.setIcon(icon)
     act.setCheckable(True)
     act.setToolTip(tooltip)
     act.toggled.connect(slot)
     value = appsettings.get().simpleConfigBoolValue(configKey)
     act.setChecked(value)
     self._configMenu.addAction(act)
     return (act, value)
예제 #8
0
    def _loadLastDirsFromSettings(self):
        settings = appsettings.get()
        startDirOrModule = settings.simpleConfigStrValue(
            constants.CONFIG_KEY_LAST_TEST_ROOT_DIR)
        if not startDirOrModule:
            return

        topDir = settings.simpleConfigStrValue(
            constants.CONFIG_KEY_LAST_TOP_DIR)

        self._testManager.setDirs(startDirOrModule, topDir)
        self._updateDirUI()
        self._updateWindowTitle(
            self._configNameFromStartAndTopDir(startDirOrModule, topDir))
예제 #9
0
    def regenerateBrowseMenu(self):
        self._browseMenu.clear()

        act = self._browseMenu.addAction("Pick Test Root Dir ...")
        act.triggered.connect(self._onBrowseTestsRootDir)
        act = self._browseMenu.addAction("Pick Top Root Dir ...")
        act.triggered.connect(self._onBrowseTopDir)
        self._browseMenu.addSeparator()
        act = self._browseMenu.addAction("Save Current Path Settings ...")
        act.triggered.connect(self.saveCurrentDirSettings)
        act = self._browseMenu.addAction("Delete Current Settings ...")
        act.triggered.connect(self.deleteCurrentDirSettings)
        self._browseMenu.addSeparator()

        # Read settings:
        config = appsettings.get().testDirSettings()
        for key, pair in config.items():
            act = self._browseMenu.addAction(key)
            act.triggered.connect(self._loadSavedDirPair)
            act.setToolTip("\n".join(pair))
        self._browseMenu.addSeparator()
예제 #10
0
파일: gotocode.py 프로젝트: mgland/iutest
 def initEditorSetting(cls):
     cls._editorSetting = appsettings.get().simpleConfigStrValue(
         constants.CONFIG_KEY_CODE_EDITOR,
         constants.CONFIG_KEY_CODE_EDITOR_DEFAULT)
예제 #11
0
 def _onCodeEditorEditFinished(self):
     txt = str(self._codeEditorLE.text()).strip()
     appsettings.get().saveSimpleConfig(constants.CONFIG_KEY_CODE_EDITOR,
                                        txt)
     gotocode.CodeLineVisitor.initEditorSetting()
예제 #12
0
 def _restorePanelVisState(self):
     state = appsettings.get().simpleConfigIntValue(
         constants.CONFIG_KEY_PANEL_VIS_STATE,
         constants.PANEL_VIS_STATE_BOTH_ON)
     self._setPanelVisState(state, saveSettings=False)
예제 #13
0
 def _onStopOnErrorActionToggled(self, stop):
     self._testManager.setStopOnError(stop)
     appsettings.get().saveSimpleConfig(constants.CONFIG_KEY_STOP_ON_ERROR,
                                        stop)
예제 #14
0
 def _onAutoClearLogActionToggled(self, state):
     appsettings.get().saveSimpleConfig(
         constants.CONFIG_KEY_AUTO_CLEAR_LOG_STATE, state)
예제 #15
0
 def _onAutoFilterActionToggled(self, state):
     appsettings.get().saveSimpleConfig(
         constants.CONFIG_KEY_AUTO_FILTERING_STATE, state)