예제 #1
0
    def __init__(self, context, parent=None):
        super(DockWidget, self).__init__(parent)

        self.dockWidget = QtWidgets.QWidget()

        self.dock_view = DockView(self)

        self.context_example = ContextExampleWidget(context, parent=self)
        self.dock_view.addDock(self.context_example.widget, "Example context")

        self.btn = DummyWidget("moo", self)
        self.dock_view.addDock(self.btn.widget, "first")
        self.btn.setButtonConnection(self.handleButton)

        self.label = DummyLabelWidget(context, Tab2Text, self)
        self.dock_view.addDock(self.label.widget, "second")

        self.btn2 = DummyWidget("waaa", self)
        self.dock_view.addDock(self.btn2.widget, "third")
        self.btn2.setButtonConnection(self.handleButton)

        self.dock_view.makeTabs()
        self.dock_view.keepDocksOpen()

        QHbox = QtWidgets.QHBoxLayout()
        QHbox.addWidget(self.dock_view)

        self.dockWidget.setLayout(QHbox)
예제 #2
0
class MuonAnalysis2Gui(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(MuonAnalysis2Gui, self).__init__(parent)

        self._context = MuonContext()

        self.loadWidget = DummyLabelWidget(self._context, LoadText, self)
        self.dockWidget = DockWidget(self._context, self)

        self.helpWidget = DummyLabelWidget(self._context, HelpText, self)

        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter.addWidget(self.loadWidget.widget)
        splitter.addWidget(self.dockWidget.widget)
        splitter.addWidget(self.helpWidget.widget)

        self.setCentralWidget(splitter)
        self.setWindowTitle("Muon Analysis version 2")

        self.dockWidget.setUpdateContext(self.update)

    def update(self):
        # update load
        self.loadWidget.updateContext()
        self.dockWidget.updateContext()
        self.helpWidget.updateContext()

        self._context.printContext()
        self.dockWidget.loadFromContext(self._context)

    # cancel algs if window is closed
    def closeEvent(self, event):
        self.dockWidget.closeEvent(event)
        global muonGUI
        muonGUI = None
예제 #3
0
    def __init__(self, parent=None):
        super(MuonAnalysis2Gui, self).__init__(parent)

        loadWidget = DummyLabelWidget("Load dummy", self)
        self.dockWidget = DockWidget(self)

        helpWidget = DummyLabelWidget("Help dummy", self)

        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter.addWidget(loadWidget.widget)
        splitter.addWidget(self.dockWidget.widget)
        splitter.addWidget(helpWidget.widget)

        self.setCentralWidget(splitter)
        self.setWindowTitle("Muon Analysis version 2")
예제 #4
0
    def __init__(self, context, parent=None):
        super(DockWidget, self).__init__(parent)

        self.dockWidget = QtGui.QWidget()

        self.dock_view = DockView(self)

        self.context_example = ContextExampleWidget(context, parent=self)
        self.dock_view.addDock(self.context_example.widget, "Example context")

        self.btn = DummyWidget("moo", self)
        self.dock_view.addDock(self.btn.widget, "first")
        self.btn.setButtonConnection(self.handleButton)

        self.label = DummyLabelWidget(context, Tab2Text, self)
        self.dock_view.addDock(self.label.widget, "second")

        self.btn2 = DummyWidget("waaa", self)
        self.dock_view.addDock(self.btn2.widget, "third")
        self.btn2.setButtonConnection(self.handleButton)

        self.dock_view.makeTabs()
        self.dock_view.keepDocksOpen()

        QHbox = QtGui.QHBoxLayout()
        QHbox.addWidget(self.dock_view)

        self.dockWidget.setLayout(QHbox)
예제 #5
0
class DockWidget(QtGui.QWidget):
    """
    This is a special case of the widget class structure.
    Normally we would only store the presenter and would
    get the view via the presenter. However, the docks
    have no logic and therefore do not have a presenter.
    So this class simply wraps the dock (view) and
    populates it
    """
    def __init__(self, parent=None):
        super(DockWidget, self).__init__(parent)
        self.dockWidget = QtGui.QWidget()

        self.dock_view = DockView(self)

        self.btn = DummyWidget("moo", self)
        self.dock_view.addDock(self.btn.widget, "first")
        self.btn.setButtonConnection(self.handleButton)

        self.label = DummyLabelWidget("boo", self)
        self.dock_view.addDock(self.label.widget, "second")

        self.btn2 = DummyWidget("waaa", self)
        self.dock_view.addDock(self.btn2.widget, "third")
        self.btn2.setButtonConnection(self.handleButton)

        self.dock_view.makeTabs()
        self.dock_view.keepDocksOpen()

        QHbox = QtGui.QHBoxLayout()
        QHbox.addWidget(self.dock_view)

        self.dockWidget.setLayout(QHbox)

    def loadFromProject(self, project):
        self.label.updateLabel(project)

    def handleButton(self, message):
        self.label.updateLabel(message)

    @property
    def widget(self):
        return self.dockWidget

    def closeEvent(self, event):
        self.dock_view.closeEvent(event)
예제 #6
0
    def __init__(self, parent=None):
        super(MuonAnalysis2Gui, self).__init__(parent)

        self._context = MuonContext()

        self.loadWidget = DummyLabelWidget(self._context, LoadText, self)
        self.dockWidget = DockWidget(self._context, self)

        self.helpWidget = DummyLabelWidget(self._context, HelpText, self)

        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter.addWidget(self.loadWidget.widget)
        splitter.addWidget(self.dockWidget.widget)
        splitter.addWidget(self.helpWidget.widget)

        self.setCentralWidget(splitter)
        self.setWindowTitle("Muon Analysis version 2")

        self.dockWidget.setUpdateContext(self.update)
예제 #7
0
    def __init__(self, parent=None):
        super(MuonAnalysis2Gui, self).__init__(parent)

        self._context = MuonContext(Name)

        self.loadWidget = DummyLabelWidget(self._context, LoadText, self)
        self.dockWidget = DockWidget(self._context, self)

        self.helpWidget = DummyLabelWidget(self._context, HelpText, self)

        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter.addWidget(self.loadWidget.widget)
        splitter.addWidget(self.dockWidget.widget)
        splitter.addWidget(self.helpWidget.widget)

        self.setCentralWidget(splitter)
        self.setWindowTitle(Name)

        self.dockWidget.setUpdateContext(self.update)
예제 #8
0
class MuonAnalysis2Gui(QtGui.QMainWindow):

    def __init__(self, parent=None):
        super(MuonAnalysis2Gui, self).__init__(parent)

        self._context = MuonContext(Name)

        self.loadWidget = DummyLabelWidget(self._context, LoadText, self)
        self.dockWidget = DockWidget(self._context, self)

        self.helpWidget = DummyLabelWidget(self._context, HelpText, self)

        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter.addWidget(self.loadWidget.widget)
        splitter.addWidget(self.dockWidget.widget)
        splitter.addWidget(self.helpWidget.widget)

        self.setCentralWidget(splitter)
        self.setWindowTitle(Name)

        self.dockWidget.setUpdateContext(self.update)

    def saveToProject(self):
        return self._context.save()

    def update(self):
        # update load
        self.loadWidget.updateContext()
        self.dockWidget.updateContext()
        self.helpWidget.updateContext()

        self.dockWidget.loadFromContext()

    def loadFromContext(self, project):
        self._context.loadFromProject(project)
        self.loadWidget.loadFromContext()
        self.dockWidget.loadFromContext()
        self.helpWidget.loadFromContext()

    # cancel algs if window is closed
    def closeEvent(self, event):
        self.dockWidget.closeEvent(event)
        global muonGUI
        muonGUI.deleteLater()
        muonGUI = None
예제 #9
0
class DockWidget(QtWidgets.QWidget):

    """
    This is a special case of the widget class structure.
    Normally we would only store the presenter and would
    get the view via the presenter. However, the docks
    have no logic and therefore do not have a presenter.
    So this class simply wraps the dock (view) and
    populates it
    """

    def __init__(self, context, parent=None):
        super(DockWidget, self).__init__(parent)

        self.dockWidget = QtWidgets.QWidget()

        self.dock_view = DockView(self)

        self.context_example = ContextExampleWidget(context, parent=self)
        self.dock_view.addDock(self.context_example.widget, "Example context")

        self.btn = DummyWidget("moo", self)
        self.dock_view.addDock(self.btn.widget, "first")
        self.btn.setButtonConnection(self.handleButton)

        self.label = DummyLabelWidget(context, Tab2Text, self)
        self.dock_view.addDock(self.label.widget, "second")

        self.btn2 = DummyWidget("waaa", self)
        self.dock_view.addDock(self.btn2.widget, "third")
        self.btn2.setButtonConnection(self.handleButton)

        self.dock_view.makeTabs()
        self.dock_view.keepDocksOpen()

        QHbox = QtWidgets.QHBoxLayout()
        QHbox.addWidget(self.dock_view)

        self.dockWidget.setLayout(QHbox)

    # set signals and slots
    def setUpdateContext(self, slot):
        self.context_example.setUpdateContext(slot)
        # the buttons change the label value
        # so we want to update context
        self.btn.setButtonConnection(slot)
        self.btn2.setButtonConnection(slot)

    def loadFromProject(self, project):
        self.label.updateLabel(project)

    def handleButton(self, message):
        self.label.updateLabel(message)

    # interaction with context
    def updateContext(self):
        self.label.updateContext()
        self.context_example.updateContext()

    def loadFromContext(self):
        self.label.loadFromContext()
        self.context_example.loadFromContext()

    # needed for docking
    @property
    def widget(self):
        return self.dockWidget

    def closeEvent(self, event):
        self.dock_view.closeEvent(event)
예제 #10
0
class DockWidget(QtGui.QWidget):

    """
    This is a special case of the widget class structure.
    Normally we would only store the presenter and would
    get the view via the presenter. However, the docks
    have no logic and therefore do not have a presenter.
    So this class simply wraps the dock (view) and
    populates it
    """

    def __init__(self, context, parent=None):
        super(DockWidget, self).__init__(parent)

        self.dockWidget = QtGui.QWidget()

        self.dock_view = DockView(self)

        self.context_example = ContextExampleWidget(context, parent=self)
        self.dock_view.addDock(self.context_example.widget, "Example context")

        self.btn = DummyWidget("moo", self)
        self.dock_view.addDock(self.btn.widget, "first")
        self.btn.setButtonConnection(self.handleButton)

        self.label = DummyLabelWidget(context, Tab2Text, self)
        self.dock_view.addDock(self.label.widget, "second")

        self.btn2 = DummyWidget("waaa", self)
        self.dock_view.addDock(self.btn2.widget, "third")
        self.btn2.setButtonConnection(self.handleButton)

        self.dock_view.makeTabs()
        self.dock_view.keepDocksOpen()

        QHbox = QtGui.QHBoxLayout()
        QHbox.addWidget(self.dock_view)

        self.dockWidget.setLayout(QHbox)

    # set signals and slots
    def setUpdateContext(self, slot):
        self.context_example.setUpdateContext(slot)
        # the buttons change the label value
        # so we want to update context
        self.btn.setButtonConnection(slot)
        self.btn2.setButtonConnection(slot)

    def loadFromProject(self, project):
        self.label.updateLabel(project)

    def handleButton(self, message):
        self.label.updateLabel(message)

    # interaction with context
    def updateContext(self):
        self.label.updateContext()
        self.context_example.updateContext()

    def loadFromContext(self):
        self.label.loadFromContext()
        self.context_example.loadFromContext()

    # needed for docking
    @property
    def widget(self):
        return self.dockWidget

    def closeEvent(self, event):
        self.dock_view.closeEvent(event)