Exemplo n.º 1
0
    def __init__(self,
                 reserved: Iterable[str] = None,
                 parent=None,
                 window_flags=Qt.WindowFlags()):
        super(MetadataDialog, self).__init__(parent, window_flags)

        self.reserved = set(reserved or [])

        self.parameter_tree = pt.ParameterTree(showHeader=False)
        self.parameter_tree.setParameters(self.parameter, showTop=False)

        calibrate_button = QPushButton("&Acquire")

        self.buttons = QDialogButtonBox(Qt.Horizontal)
        # Add calibration button that accepts the dialog (closes with 1 status)
        self.buttons.addButton(calibrate_button, QDialogButtonBox.AcceptRole)
        # Add a cancel button that will reject the dialog (closes with 0 status)
        self.buttons.addButton(QDialogButtonBox.Cancel)

        self.buttons.rejected.connect(self.reject)
        self.buttons.accepted.connect(self.accept)

        outer_layout = QVBoxLayout()
        outer_layout.addWidget(self.parameter_tree)
        outer_layout.addWidget(self.buttons)
        outer_layout.setSpacing(0)
        outer_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(outer_layout)
Exemplo n.º 2
0
# -----------------------------------------------------------------------------
# Public Constants
# -----------------------------------------------------------------------------
ORGANIZATION = 'mantidproject'
ORG_DOMAIN = 'mantidproject.org'
APPNAME = 'mantidworkbench'

DEFAULT_SCRIPT_CONTENT = ""
DEFAULT_SCRIPT_CONTENT += "# import mantid algorithms, numpy and matplotlib" + os.linesep + \
                          "from mantid.simpleapi import *" + os.linesep + \
                          "import matplotlib.pyplot as plt" + os.linesep + \
                          "import numpy as np" + os.linesep + os.linesep

# Flags defining a standard Window
WINDOW_STANDARD_FLAGS = Qt.WindowFlags(Qt.Window)

# Flags defining our meaning of keeping figure windows on top.
# On Windows the standard Qt.Window flags + setting a parent keeps the widget on top
# Other OSs use the Qt.Tool type with a close button
if sys.platform == 'win32':
    WINDOW_ONTOP_FLAGS = WINDOW_STANDARD_FLAGS
elif sys.platform == 'darwin':
    WINDOW_ONTOP_FLAGS = (Qt.Tool | Qt.CustomizeWindowHint | Qt.WindowCloseButtonHint
                          | Qt.WindowMinimizeButtonHint)
else:
    WINDOW_ONTOP_FLAGS = (Qt.Tool | Qt.CustomizeWindowHint | Qt.WindowCloseButtonHint
                          | Qt.WindowMinimizeButtonHint)

# Iterable containing defaults for each configurable section of the code
# General application settings are in the main section