예제 #1
0
파일: __init__.py 프로젝트: ess-dmsc/nicos
    def __init__(self, parent):
        QWidget.__init__(self, parent)

        self._arrays = None
        self._plotcount = 1
        # self._axesrange = (1, 1)  # y, x (rows, cols)
        self._axesrange = {'x': (0, 1, 2), 'y': (0, 1, 2)}
        self._fixedsize = False
        self._axesratio = 1.0
        self._logscale = False
        self._rois = {}
        self._saveName = None

        layout = QHBoxLayout()
        self.gr = GRWidget(self)
        layout.addWidget(self.gr)
        self.setLayout(layout)

        self.plot = Plot(self, viewport=(0.1, 0.95, 0.1, 0.95))
        self.axes = Axes(self,
                         viewport=self.plot.viewport,
                         xdual=True,
                         ydual=True)
        self.plot.addAxes(self.axes)
        self.gr.addPlot(self.plot)
예제 #2
0
 def __init__(self,
              parent,
              keys,
              types,
              curvalue,
              client,
              allow_enter=False):
     QWidget.__init__(self, parent)
     layout = self._layout = QFormLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self.keys = keys
     self._widgets = []
     for (key, typ, val) in zip(keys, types, curvalue.values()):
         widget = create(self,
                         typ,
                         val,
                         client=client,
                         allow_enter=allow_enter)
         self._widgets.append(widget)
         widget.valueModified.connect(self.valueModified)
         if allow_enter:
             widget.valueChosen.connect(
                 lambda val: self.valueChosen.emit(self.getValue()))
         layout.addRow(key, widget)
     self.setLayout(layout)
예제 #3
0
파일: tas.py 프로젝트: umithardal/nicos
    def __init__(self, parent, designMode=False):
        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)

        # default values (used when no such devices are configured)
        self.values = {
            'mth': -45,
            'mtt': -90,
            'sth': 30,
            'stt': 60,
            'ath': -45,
            'att': -90,
            'Lms': 1000,
            'Lsa': 580,
            'Lad': 400,
        }
        self.targets = self.values.copy()
        self.status = {
            'mth': OK,
            'mtt': OK,
            'sth': OK,
            'stt': OK,
            'ath': OK,
            'att': OK,
        }
        self._keymap = {}
        self._statuskeymap = {}
        self._targetkeymap = {}
예제 #4
0
    def __init__(self, parent, designMode=False):
        self._curval = [0, 0, 0, 0]
        self._curstatus = OK
        self._opmode = 'offcentered'

        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)
예제 #5
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     uic.loadUi(
         path.join(path.dirname(path.abspath(__file__)), 'ui',
                   'devicewidget.ui'), self)
     self.parameters = {}
     self.pushButtonAdd.clicked.connect(self.addParameter)
예제 #6
0
    def __init__(self, parent, designMode=False):
        self._curstr = ''
        self._curstatus = OK
        self._fixed = ''

        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)
예제 #7
0
 def __init__(self,
              parent,
              types,
              curvalue,
              client,
              allow_enter=False,
              valinfo=None):
     QWidget.__init__(self, parent)
     layout = self._layout = QGridLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self._widgets = []
     if valinfo is not None:
         for i, info in enumerate(valinfo):
             layout.addWidget(QLabel(info.name), 0, i)
     for i, (typ, val) in enumerate(zip(types, curvalue)):
         widget = create(self,
                         typ,
                         val,
                         client=client,
                         allow_enter=allow_enter)
         self._widgets.append(widget)
         widget.valueModified.connect(self.valueModified)
         if allow_enter:
             widget.valueChosen.connect(
                 lambda val: self.valueChosen.emit(self.getValue()))
         layout.addWidget(widget, 1, i)
     self.setLayout(layout)
예제 #8
0
    def __init__(self, parent, designMode=False):
        # coll_in, coll_out, ap_20, ap_14, ap_8, ap_4, ap_2, pol_in, pol_out
        self._curval = [0, 0, (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), 0, 0]
        self._curstr = ['', '', '', '', '', '', '', '', '']
        self._curstatus = [OK, OK, OK, OK, OK, OK, OK, OK, OK]

        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)
예제 #9
0
    def __init__(self, parent, designMode=False):
        # z, x, y, small_x, small_y
        self._curval = [0, 0, 0, 0, 0]
        self._curstr = ['', '', '', '', '']
        self._curstatus = [OK, OK, OK, OK, OK]

        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)
예제 #10
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     loadUi(self, self.controlsui)
     for w in (self.foilLabel, self.foilBox, self.timeChannelLabel,
               self.timeChannelBox):
         w.setHidden(True)
     self.singleSlidesBox.setDisabled(True)
     self._foilsorder = list(range(self.foilsnumber))
예제 #11
0
    def __init__(self, parent, designMode=False):
        # lens_in, lens_out
        self._curval = [0, 0]
        self._curstr = ['', '']
        self._curstatus = [OK, OK]

        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)
예제 #12
0
 def __init__(self, parent, client, uifile):
     self.client = client
     QWidget.__init__(self, parent)
     loadUi(self, uifile)
     loadUi(self.buttons, 'cmdlets/buttons.ui')
     self.buttons.upBtn.clicked.connect(self.cmdletUp)
     self.buttons.downBtn.clicked.connect(self.cmdletDown)
     self.buttons.delBtn.clicked.connect(self.cmdletRemove)
예제 #13
0
    def __init__(self, parent, designMode=False):
        # det1pos, det1shift, det1tilt, det2pos
        self._curval = [0, 0, 0, 0]
        self._curstr = ['', '', '', '']
        self._curstatus = [OK, OK, OK, OK]

        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)
예제 #14
0
 def __init__(self, parent, designMode=False, **kwds):
     QWidget.__init__(self, parent, **kwds)
     NicosWidget.__init__(self)
     self._entries = []
     self._vlayout = QVBoxLayout()
     self._vlayout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(self._vlayout)
     self._add()
     self._designer = designMode
예제 #15
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.canvas = FigureCanvas(Figure(figsize=(20, 16)))
        self._static_ax = self.canvas.figure.subplots()

        layout = QVBoxLayout()
        layout.addWidget(self.canvas)
        self.setLayout(layout)
예제 #16
0
 def __init__(self, parent, designMode=False, **kwds):
     self._inner = None
     QWidget.__init__(self, parent, **kwds)
     NicosWidget.__init__(self)
     self._layout = QHBoxLayout()
     self._layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(self._layout)
     if designMode:
         self._layout.insertWidget(0, QLabel('(Value Editor)', self))
예제 #17
0
    def __init__(self, parent, client, devs):
        self.client = client
        self.devs = devs
        QWidget.__init__(self, parent)
        loadUi(self, findResource('nicos_mlz/kws1/gui/devices_one.ui'))

        self.table.setColumnCount(len(devs))
        self.table.setHorizontalHeaderLabels(devs)
        self._edit = None
        self._rows = []
예제 #18
0
 def __init__(self, parent, inner, annotation):
     QWidget.__init__(self, parent)
     layout = self._layout = QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self._inner = inner
     self._inner.valueModified.connect(self.valueModified)
     self._inner.valueChosen.connect(self.valueChosen)
     layout.addWidget(inner)
     layout.addWidget(QLabel(annotation, parent))
     self.setLayout(layout)
예제 #19
0
 def __init__(self, parent, values):
     QWidget.__init__(self, parent)
     layout = QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     self._values = {}
     for value in values:
         btn = QPushButton(str(value), self)
         self._values[btn] = value
         btn.clicked.connect(self.on_button_pressed)
         layout.addWidget(btn)
     self.setLayout(layout)
예제 #20
0
파일: editor.py 프로젝트: ess-dmsc/nicos
    def __init__(self, parent, panel, client):
        self.client = client
        QWidget.__init__(self, parent)
        loadUi(self, 'panels/simresult.ui')
        self.simOutStack.setCurrentIndex(0)
        hdr = self.simRanges.header()
        hdr.setSectionResizeMode(QHeaderView.ResizeToContents)

        self.panel = panel
        self.simuuid = None
        client.simmessage.connect(self.on_client_simmessage)
        client.simresult.connect(self.on_client_simresult)
예제 #21
0
파일: display.py 프로젝트: ess-dmsc/nicos
 def __init__(self, parent=None, designMode=False, **kwds):
     QWidget.__init__(self, parent, **kwds)
     NicosWidget.__init__(self)
     self._last_mtime = None
     self.namelabel = QLabel(self)
     self.namelabel.setAlignment(Qt.AlignHCenter)
     self.piclabel = QLabel(self)
     self.piclabel.setScaledContents(True)
     layout = QVBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.addWidget(self.piclabel, 1)
     self.setLayout(layout)
예제 #22
0
 def __init__(self, item, window, menuwindow, topwindow, parent=None):
     from nicos.clients.gui.panels.utils import createWindowItem
     QWidget.__init__(self, parent)
     self.log = NicosLogger(self.logger_name)
     self.log.parent = topwindow.log
     layout = self.layout_type(parent)
     SetupDepPanelMixin.__init__(self, window.client, item.options)
     for subitem in item.children:
         sub = createWindowItem(subitem, window, menuwindow, topwindow,
                                self.log)
         if sub:
             layout.addWidget(sub)
     self.setLayout(layout)
예제 #23
0
    def __init__(self, name='unknown', parent=None, **kwds):
        QWidget.__init__(self, parent)
        loadUi(self,
               findResource('nicos_mlz/reseda/gui/mieze_display_foil.ui'))
        # set name
        self.name = name
        self.groupBox.setTitle(name)

        # insert plot widget + store reference
        self.plotwidget = MiniPlot(self)
        self.plotwidget.setSizePolicy(QSizePolicy.MinimumExpanding,
                                      QSizePolicy.MinimumExpanding)
        self.verticalLayout.insertWidget(0, self.plotwidget)
        self.do_update([(0, 0, 0, 0), (0, 0, 0, 0), [0] * 16] * 2)
예제 #24
0
파일: plots.py 프로젝트: umithardal/nicos
    def __init__(self, parent, designMode=False):
        self.ncurves = 0
        self.ctimers = {}
        self.keyindices = {}
        self.plotcurves = {}
        self.series = {}
        self.legendobj = None

        # X label settings, default values for default window of 3600s
        self._showdate = False
        self._showsecs = False

        QWidget.__init__(self, parent)
        NicosWidget.__init__(self)
예제 #25
0
 def __init__(self, title, xlabel, ylabel, name='unknown', parent=None,
              **kwds):
     QWidget.__init__(self, parent)
     self.name = name
     parent.setLayout(QVBoxLayout())
     self.plot = MiniPlot(xlabel, ylabel, self, color1=COLOR_BLACK,
                          color2=COLOR_RED)
     titleLabel = QLabel(title)
     titleLabel.setAlignment(Qt.AlignCenter)
     titleLabel.setStyleSheet('QLabel {font-weight: 600}')
     parent.layout().insertWidget(0, titleLabel)
     self.plot.setSizePolicy(QSizePolicy.MinimumExpanding,
                             QSizePolicy.MinimumExpanding)
     parent.layout().insertWidget(1, self.plot)
예제 #26
0
    def __init__(self, setup, availablesetups, parent=None):
        QWidget.__init__(self, parent)
        uic.loadUi(path.join(path.dirname(path.abspath(__file__)),
                             'ui', 'setupwidget.ui'), self)

        # keys taken from nicos_demo/skeleton/setups/system.py
        self.sysconfigKeys = ['cache',
                              'instrument',
                              'experiment',
                              'datasinks',
                              'notifiers']

        self.lineEditDescription.textEdited.connect(self.editedSetup.emit)
        self.treeWidgetSysconfig.editedSetup.connect(self.editedSetup.emit)
        self.comboBoxGroup.activated.connect(self.editedSetup.emit)

        self.lineEditDescription.setText(setup.description)
        self.comboBoxGroup.setCurrentIndex(
            self.comboBoxGroup.findText(setup.group))
        for includeItem in setup.includes:
            self.listWidgetIncludes.addItem(includeItem)
        for excludeItem in setup.excludes:
            self.listWidgetExcludes.addItem(excludeItem)
        for moduleItem in setup.modules:
            self.listWidgetModules.addItem(moduleItem)

        topLevelItems = []
        for key in self.sysconfigKeys:
            if key in setup.sysconfig:
                topLevelItems.append(QTreeWidgetItem([key]))
        self.treeWidgetSysconfig.addTopLevelItems(topLevelItems)

        for item in topLevelItems:
            if isinstance(setup.sysconfig[item.text(0)], list):
                for listItem in setup.sysconfig[item.text(0)]:
                    item.addChild(QTreeWidgetItem([listItem]))
            else:
                item.addChild(QTreeWidgetItem(
                    [setup.sysconfig[item.text(0)]]))

        if self.treeWidgetSysconfig.topLevelItemCount() == len(
                self.sysconfigKeys):  # can't add any unknown keys
            self.pushButtonAddSysconfig.setEnabled(False)
        else:
            self.pushButtonAddSysconfig.setEnabled(True)
        self.textEditStartupCode.blockSignals(True)
        self.textEditStartupCode.setPlainText(setup.startupcode[1:-1])
        self.textEditStartupCode.blockSignals(False)
        self.availablesetups = availablesetups
예제 #27
0
 def __init__(self, parent, client, options):
     QWidget.__init__(self, parent)
     self.log = NicosLogger(self.panelName)
     self.log.parent = parent.mainwindow.log
     SetupDepPanelMixin.__init__(self, client, options)
     DlgUtils.__init__(self, self.panelName)
     self.parentwindow = parent
     self.client = client
     self.mainwindow = parent.mainwindow
     self.actions = set()
     self.sgroup = SettingGroup(self.panelName)
     with self.sgroup as settings:
         self.loadSettings(settings)
     self.setProperty('type', 'Panel')
     self.setProperty('panel', self.__class__.__name__)
예제 #28
0
 def __init__(self, parent=None):
     QWidget.__init__(self, parent)
     self.setLayout(QHBoxLayout())
     self.layout().setContentsMargins(0.1, 0.1, 0.1, 0.1)
     self.layout().setSpacing(1)
     self.val = QLineEdit()
     self.val.setValidator(QDoubleValidator(0, 1000000, 2))
     self.layout().addWidget(self.val)
     self.unit = QComboBox()
     self.unit.insertItems(0, self.units)
     self.layout().addWidget(self.unit)
     self.setValue(1)
     self.val.returnPressed.connect(self.on_returnPressed)
     self.val.editingFinished.connect(self.on_returnPressed)
     self.unit.currentIndexChanged.connect(self.recalcValue)
예제 #29
0
 def __init__(self, parent, values, curvalue, client):
     QWidget.__init__(self, parent)
     layout = self._layout = QVBoxLayout()
     self.checkboxes = []
     self.values = []
     curvalue = curvalue or set()
     for value in values:
         checkbox = QCheckBox(str(value), self)
         if value in curvalue:
             checkbox.setCheckState(Qt.Checked)
         checkbox.stateChanged.connect(self.on_checkbox_stateChanged)
         layout.addWidget(checkbox)
         self.checkboxes.append(checkbox)
     layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(layout)
예제 #30
0
 def __init__(self, parent, client, uifile):
     QWidget.__init__(self, parent)
     new_layout = QHBoxLayout()
     self.subwidget = QWidget(self)
     if uifile:
         uic.loadUi(uifile, self.subwidget)
     self.button = QToolButton(self)
     self.setButton('+')
     self.button.clicked.connect(self.on_button_click)
     new_layout.addWidget(self.subwidget)
     new_layout.addSpacerItem(QSpacerItem(15, 1, QSizePolicy.Fixed))
     new_layout.addWidget(self.button)
     new_layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(new_layout)
     for ch in self.subwidget.findChildren(NicosWidget):
         ch.setClient(client)