Esempio n. 1
0
    def __init__(self, parent, wintype, config):
        from nicos.clients.gui.panels.utils import createWindowItem
        QMainWindow.__init__(self, parent)
        loadUi(self, 'auxwindow.ui')
        self.mainwindow = parent
        self.client = parent.client
        self.log = NicosLogger('AuxiliaryWindow')
        self.log.parent = self.mainwindow.log

        self.type = wintype
        self.panels = []
        self.splitters = []

        self.sgroup = SettingGroup(config.name)
        with self.sgroup as settings:
            loadUserStyle(self, settings)

        self.setWindowTitle(config.name)
        widget = createWindowItem(config.contents, self, self, self, self.log)
        if widget:
            self.centralLayout.addWidget(widget)
        self.centralLayout.setContentsMargins(6, 6, 6, 6)

        with self.sgroup as settings:
            loadBasicWindowSettings(self, settings)

        if len(self.splitstate) == len(self.splitters):
            for sp, st in zip(self.splitters, self.splitstate):
                sp.restoreState(st)

        setups = config[1].get('setups', '')
        self.setSetups(setups)
        self.client.register(self, 'session/mastersetup')

        SetupDepWindowMixin.__init__(self, self.client)
Esempio n. 2
0
    def __init__(self, item, window, menuwindow, parent):
        from nicos.clients.gui.panels.utils import createWindowItem
        QMainWindow.__init__(self, parent)
        self.user_color = window.user_color
        self.mainwindow = window.mainwindow
        self.log = NicosLogger('AuxiliarySubWindow')
        self.log.parent = self.mainwindow.log

        self.panels = []

        # we have to nest one step to get consistent layout spacing
        # around the central widget
        central = QWidget(self)
        layout = QVBoxLayout()
        # only keep margin at the top (below the tabs)
        layout.setContentsMargins(0, 6, 0, 0)
        if len(item) == 1:
            (subitem, setupSpec) = item + (None, )
        else:
            (subitem, setupSpec) = item
        it = createWindowItem(subitem, window, menuwindow, self, self.log)
        if it:
            if isinstance(it, (
                    Panel,
                    QSplitter,
            )):
                if isinstance(it, Panel):
                    it.hideTitle()
                # if tab has its own setups overwrite panels setups
                if setupSpec:
                    it.setSetups(setupSpec)
                it.setWidgetVisible.connect(parent.setWidgetVisibleSlot)
            layout.addWidget(it)
            central.setLayout(layout)
            self.setCentralWidget(central)
Esempio n. 3
0
 def __init__(self, item, window, menuwindow, topwindow, parent=None):
     from nicos.clients.gui.panels.utils import createWindowItem
     QSplitter.__init__(self, parent)
     window.splitters.append(self)
     self.log = NicosLogger('Splitter')
     self.log.parent = topwindow.log
     SetupDepPanelMixin.__init__(self, window.client, item.options)
     for subitem in item.children:
         sub = createWindowItem(subitem, window, menuwindow, topwindow,
                                self.log)
         if sub:
             self.addWidget(sub)
Esempio n. 4
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)
Esempio n. 5
0
 def __init__(self, parent, client, panelcfg, title, **options):
     from nicos.clients.gui.panels.utils import createWindowItem
     QDialog.__init__(self, parent)
     self.panels = []
     self.mainwindow = parent.mainwindow
     self.log = NicosLogger('PanelDialog')
     self.log.parent = self.mainwindow.log
     self.client = client
     self.user_color = self.palette().color(QPalette.Base)
     self.user_font = self.font()
     if isinstance(panelcfg, type) and issubclass(panelcfg, Panel):
         panelcfg = panel('%s.%s' % (panelcfg.__module__,
                                     panelcfg.__name__), **options)
     elif isinstance(panelcfg, str):
         panelcfg = panel(panelcfg, **options)
     hbox = QHBoxLayout()
     hbox.setContentsMargins(0, 0, 0, 0)
     pnl = createWindowItem(panelcfg, self, self, self.mainwindow, self.log)
     if pnl:
         hbox.addWidget(pnl)
     self.setLayout(hbox)
     self.setWindowTitle(title)
     SetupDepWindowMixin.__init__(self, self.client)
     self.setProperty('type', 'PanelDialog')