示例#1
0
    def setupUi(self, *args):
        # called in MainWindowBase.__init__()
        # put the log widget at the bottom
        self.addDockWidget(Qt.BottomDockWidgetArea, self._setupLogWidget())
        # file widget at the top
        self.toolbox = ToolBox(self)
        self._addToolboxItem(self._setupFileWidget())
        self._addToolboxItem(self._setupDataWidget())
        self._addToolboxItem(self._setupOptimWidget())
        self._addToolboxItem(self._setupModelWidget())
        self._addToolboxItem(self._setupStatsWidget())

        # set up central widget of the main window
        self.centralLayout = QVBoxLayout()
        # put buttons in central widget
        self.centralLayout.addWidget(self.toolbox)
        self.centralLayout.addWidget(self._setupStartButton())
        centralWidget = QWidget(self)
        centralWidget.setLayout(self.centralLayout)
        centralWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
        self.setCentralWidget(centralWidget)
        self.onStartupSignal.connect(self.initUi)
        # set program icon, same for Win+Lin
        icopath = "resources/icon/mcsas.ico"
        if isMac():
            icopath = "resources/icon/mcsas.icns"
        icopath = QFileInfo(makeAbsolutePath(icopath)).absoluteFilePath()
        self.setWindowIcon(QIcon(icopath))
示例#2
0
 def _createEntries(self):
     entryWidget = QWidget(self)
     entryLayout = QHBoxLayout(entryWidget)
     inputWidgets = (self._createParamBox(), self._createAutoRange(),
                     self._createLower(), self._createUpper(),
                     self._createBins(), self._createXScale(),
                     self._createYWeight())
     self._labels = dict()
     # assumes same ordering of entryWidgets above and Histogram.displayData
     for col, inputWidget in zip(Histogram.displayData, inputWidgets):
         fieldWidget = QWidget(self)  # combines label + input
         fieldLayout = QVBoxLayout(fieldWidget)
         fieldLayout.setContentsMargins(QMargins())
         # create label, text is set in _selectParam()
         self._labels[col] = QLabel(self)
         self._labels[col].setAlignment(Qt.AlignHCenter)
         # stack label + input
         fieldLayout.addWidget(self._labels[col])
         fieldLayout.addWidget(inputWidget)
         fieldWidget.setLayout(fieldLayout)
         # add field to row of inputs
         entryLayout.addWidget(fieldWidget)
     entryWidget.setLayout(entryLayout)
     self.pbox.setCurrentIndex(0)
     self.lentry.selectAll()  # select the first input by default
     return entryWidget
示例#3
0
 def _setupUi(self, withBtn):
     self.setObjectName("DataList")
     self.setAcceptDrops(True)
     self.verticalLayout = QVBoxLayout(self)
     self.verticalLayout.setObjectName("verticalLayout")
     if withBtn:
         self.loadBtn = QPushButton(self)
         self.loadBtn.setText(tr("load"))
         self.loadBtn.setObjectName("loadBtn")
         self.loadBtn.released.connect(self.loadData)
         self.verticalLayout.addWidget(self.loadBtn)
     self.listWidget = QTreeWidget(self)
     self.listWidget.setHeaderHidden(True)
     self.listWidget.setContextMenuPolicy(Qt.ActionsContextMenu)
     self.listWidget.setEditTriggers(QAbstractItemView.NoEditTriggers)
     self.listWidget.setDragEnabled(True)
     self.listWidget.setDragDropMode(QAbstractItemView.InternalMove)
     self.listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
     self.listWidget.setObjectName("listWidget")
     self.listWidget.itemSelectionChanged.connect(self.selectionChanged)
     self.listWidget.itemClicked.connect(self._itemClicked)
     self.listWidget.itemChanged.connect(self._itemChanged)
     self.listWidget.itemDoubleClicked.connect(self.itemDoubleClicked)
     self.listWidget.itemExpanded.connect(self.fitColumnsToContents)
     self.listWidget.itemCollapsed.connect(self.fitColumnsToContents)
     self.verticalLayout.addWidget(self.listWidget)
     self.sigReceivedUrls.connect(self.loadData)
     self.clearSelection = self.listWidget.clearSelection
示例#4
0
    def __init__(self, parent, calculator, *args):
        super(ModelWidget, self).__init__(parent, None, *args)
        self._calculator = calculator
        self.title = TitleHandler.setup(self, "Model")
        # get all loadable ScatteringModels from model directory
        self._models = FindModels()

        layout = QVBoxLayout(self)
        layout.setObjectName("modelLayout")
        self.setLayout(layout)

        self.modelBox = QComboBox(self)
        self.modelBox.setFixedWidth(FIXEDWIDTH)
        layout.addWidget(self.modelBox)
        self.modelWidget = QWidget(self)
        paramLayout = QVBoxLayout(self.modelWidget)
        self.modelWidget.setLayout(paramLayout)
        layout.addWidget(self.modelWidget)
示例#5
0
 def __init__(self, parent, appSettings):
     super(DataWidget, self).__init__(parent)
     self.title = TitleHandler.setup(self, "Data Settings")
     self.appSettings = appSettings  # forwarded to SettingsGridWidget below
     self._widgets = []
     self._restored = set()
     # basic row oriented layout
     hlayout = QVBoxLayout(self)
     hlayout.setObjectName("baseLayout")
     hlayout.setContentsMargins(0, 0, 0, 0)
示例#6
0
 def __init__(self, parent=None, model=None):
     QDialog.__init__(self, parent)
     assert isinstance(model, ScatteringModel)
     self._model = model
     self.setObjectName("AddRangeDialog")
     self.setWindowTitle("Add Range")
     self.setWindowModality(Qt.WindowModal)
     vlayout = QVBoxLayout(self)
     vlayout.setObjectName("vlayout")
     vlayout.addWidget(self._createEntries())
     vlayout.addWidget(self._createButtons())
     self.setLayout(vlayout)