コード例 #1
0
# Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
#   NScD Oak Ridge National Laboratory, European Spallation Source,
#   Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#  This file is part of the mantid workbench.
import functools

from qtpy.QtWidgets import QMenu, QMessageBox
from os.path import join, exists
from mantid import ConfigService
from mantidqt.utils.qt import create_action
from workbench.config import CONF

RECENT_SCRIPT_MAX_NUMBER = 10
CACHE_FILE_NAME = "recent_script_file"
MENU_CACHE_LOCATION = join(ConfigService.getAppDataDirectory(),
                           CACHE_FILE_NAME)
RECENT_SCRIPTS_KEY = "RecentScripts"


class RecentlyClosedScriptsMenu(QMenu):
    def __init__(self, mainwindow):
        super(RecentlyClosedScriptsMenu, self).__init__()
        self.setTitle("Open Recently Closed Scripts")
        self.aboutToShow.connect(self.repopulate_menu)
        self.mainwindow = mainwindow

    def repopulate_menu(self):
        self.clear()
        self.populate_menu()
コード例 #2
0
import mantidplottests
import os
import platform
import unittest
import mantidplot
from mantidplottests import runTests, threadsafe_call
from glob import glob
#from mantid.kernel import *
from mantid import AnalysisDataService, ConfigService
from mantid.simpleapi import CreateWorkspace
from PyQt4 import QtGui
import shutil
import _qti

path = os.path.join(ConfigService.getAppDataDirectory(), 'recovery',
                    platform.node())


def cleanUp():
    # Clean Up
    for cc in glob(os.path.join(path, "*", "")):
        shutil.rmtree(cc)
    AnalysisDataService.clear()


class MantidPlotProjectRecovery(unittest.TestCase):
    def test_exec(self):
        CreateWorkspace(OutputWorkspace="ws",
                        DataX=[1, 2, 3],
                        DataY=[1, 2, 3],
                        NSpec=1)