Ejemplo n.º 1
0
    def __init__(self, name, size):
        Dock.__init__(self, name, size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        widget = QtGui.QWidget()
        layout = QtGui.QVBoxLayout()

        self.scrollArea = QtGui.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QtGui.QWidget(self.scrollArea)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        layout.addWidget(self.scrollArea)
        self.verticalLayoutScroll = QtGui.QGridLayout(
            self.scrollAreaWidgetContents)

        widget.setLayout(layout)
        self.addWidget(widget)

        text = QtGui.QLabel()
        text.setWordWrap(True)
        self.verticalLayoutScroll.addWidget(text)

        text.setText('\
<ul><li>Filtering options for logbook</li>\
<li>Unsaved entries counter for logbook</li>\
<li>Make planning widget</li>\
<li>Make checklist widget</li>\
<li>Overlaying of graphs and peak fitting</li>\
<li>Version history of logbook</li>\
<li>Compile changes into new .exe</li></lu>')
Ejemplo n.º 2
0
    def __init__(self,name,size):
        Dock.__init__(self,name,size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        widget = QtGui.QWidget()
        layout = QtGui.QVBoxLayout()

        self.scrollArea = QtGui.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QtGui.QWidget(self.scrollArea)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        layout.addWidget(self.scrollArea)
        self.verticalLayoutScroll = QtGui.QGridLayout(self.scrollAreaWidgetContents)

        widget.setLayout(layout)
        self.addWidget(widget)


        text=QtGui.QLabel()
        text.setWordWrap(True)
        self.verticalLayoutScroll.addWidget(text)

        text.setText('\
<ul><li>Filtering options for logbook</li>\
<li>Unsaved entries counter for logbook</li>\
<li>Make planning widget</li>\
<li>Make checklist widget</li>\
<li>Overlaying of graphs and peak fitting</li>\
<li>Version history of logbook</li>\
<li>Compile changes into new .exe</li></lu>')
Ejemplo n.º 3
0
    def __init__(self, name, size):
        Dock.__init__(self, name, size)

        self.setMinimumWidth(500)
        self.setMaximumWidth(500)
        self.setMinimumHeight(650)

        self.orientation = 'horizontal'
        self.autoOrient = False

        scanWidget = QtGui.QWidget()
        grid = QtGui.QGridLayout(scanWidget)
        self.controlButton = QtGui.QPushButton('New')
        self.controlButton.setMinimumHeight(140)
        self.controlButton.setMaximumHeight(140)
        self.controlButton.setMinimumWidth(140)
        self.controlButton.setMaximumWidth(140)
        grid.addWidget(self.controlButton, 0, 0)

        self.newGraphButton = QtGui.QPushButton('New Graph')
        grid.addWidget(self.newGraphButton, 1, 0)

        self.settingsWidget = SessionSettingsWidget(init=SessionSettings())
        self.settingsWidget.setStatus(False)
        grid.addWidget(self.settingsWidget, 0, 1, 1, 2)

        self.layout.setRowStretch(2, 1)

        self.scanRegionCreator = ScanRegionCreator()

        self.addWidget(scanWidget)
        self.addWidget(self.scanRegionCreator)
Ejemplo n.º 4
0
    def __init__(self, title, size, globalSession):
        Dock.__init__(self, title, size, autoOrientation=False, closable=True)

        self.globalSession = globalSession

        self.title = title

        self.graph = MyGraph(self.title, self.globalSession)
        self.addWidget(self.graph)
Ejemplo n.º 5
0
    def __init__(self, name, size, globalSession):
        Dock.__init__(self, name, size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        self.settingsWidget = SettingsWidget(globalSession)
        print globalSession.settings.laser

        self.addWidget(self.settingsWidget)
Ejemplo n.º 6
0
    def __init__(self, globalSession,name,size):
        Dock.__init__(self,name,size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        self.viewer = LogViewer(globalSession)
        self.viewer.filterWidget.analyseThis.connect(self.emitAnalyseThis)
        self.viewer.filterWidget.newLogFiltered.connect(self.viewer.newLog)

        self.layout.addWidget(self.viewer,1,0)
Ejemplo n.º 7
0
    def __init__(self, name, size, globalSession):
        Dock.__init__(self, name, size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        self.globalSession = globalSession

        self.analysisWidget = NewAnalysisWidget(globalSession)

        self.addWidget(self.analysisWidget)
Ejemplo n.º 8
0
    def __init__(self,name,size, globalSession):
        Dock.__init__(self,name,size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        self.globalSession = globalSession

        self.analysisWidget = NewAnalysisWidget(globalSession)

        self.addWidget(self.analysisWidget)
Ejemplo n.º 9
0
    def __init__(self, globalSession, name, size):
        Dock.__init__(self, name, size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        self.viewer = LogViewer(globalSession)
        self.viewer.filterWidget.analyseThis.connect(self.emitAnalyseThis)
        self.viewer.filterWidget.newLogFiltered.connect(self.viewer.newLog)

        self.layout.addWidget(self.viewer, 1, 0)
Ejemplo n.º 10
0
    def __init__(self, name, size, globalSession):
        Dock.__init__(self, name, size, autoOrientation=False)

        self.globalSession = globalSession

        self.title = name

        self.orientation = 'horizontal'
        self.autoOrient = False

        self.graph = DataStreamGraph(self.title, self.globalSession)
        self.addWidget(self.graph)
Ejemplo n.º 11
0
    def __init__(self,name,size,globalSession):
        Dock.__init__(self,name,size, autoOrientation=False)

        self.globalSession = globalSession

        self.title = name

        self.orientation = 'horizontal'
        self.autoOrient = False

        self.graph = DataStreamGraph(self.title, self.globalSession)
        self.addWidget(self.graph)
Ejemplo n.º 12
0
 def __init__(self,  **kwargs):
     super().__init__(**kwargs)
     for x in range(0, 32):
         dock = Dock()
         self.add_widget(dock)
         self.survivors.append(dock)
     self.center_x = Window.width/4
Ejemplo n.º 13
0
    def __init__(self):
        super().__init__()

        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_title("Diffusion Dock")
        self.connect("delete-event", Gtk.main_quit)

        self.set_app_paintable(True)

        self.connect("screen-changed", self.screen_changed)
        self.connect("draw", self.expose_draw)

        self.set_decorated(False)
        self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)

        self.set_type_hint(Gdk.WindowTypeHint.DOCK)

        dock = Dock(None, app_cache=app_cache, window_tracker=window_tracker)
        self.add(dock)

        style_provider = Gtk.CssProvider()
        style_provider.load_from_file(Gio.File.new_for_path("style.css"))

        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(), style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

        def aaa(_, a):
            print("aaa")
            #self.resize(
            #    max(dock.get_size_request().width, 1), max(dock.get_size_request().height, 1))
            # self.set_size_request(100, 100)
            # self.resize(100, 100)
            print(dock.get_size_request())

        # dock.connect("draw", lambda dock, _: self.resize(
        #  max(dock.get_size_request().width, 1), max(dock.get_size_request().height, 1)))
        dock.connect("draw", aaa)

        self.screen_changed(self, None, None)

        self.show_all()
        self.resize(100, 100)
        Gtk.main()
Ejemplo n.º 14
0
    def __init__(self, name, size):
        Dock.__init__(self, name, size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        ## build an initial namespace for console commands to be executed in (this is optional;
        ## the user can always import these modules manually)
        namespace = {'pg': pg, 'np': np}

        ## initial text to display in the console
        text = """
        Numpy and pyqtgraph have already been imported 
        as 'np' and 'pg'. 
        """
        console = pyqtgraph.console.ConsoleWidget(namespace=namespace,
                                                  text=text)
        console.setWindowTitle('Python Console')

        self.addWidget(console)
Ejemplo n.º 15
0
    def __init__(self, parent=None):
        super(MainWin, self).__init__(parent)
        self._dock = d = QtGui.QDockWidget("header", self)
        d.setAllowedAreas(reduce(lambda x, y: x | y, L_SPOTS, 0))
        self._transformation_form = form = Dock()
        form.setupUi(d)
        self.addDockWidget(L_SPOTS[0], d)
        d.dockLocationChanged.connect(functools.partial(update_layout, form))

        scene = QtGui.QGraphicsScene()
        scene.setSceneRect(0, 0, 800, 600)
        scene.setItemIndexMethod(QtGui.QGraphicsScene.BspTreeIndex)
        dast = RectanglesDAST(scene)

        view = MyGraphicsView(dast, self.transformation_builder)
        view.setRenderHint(QtGui.QPainter.Antialiasing)
        view.setCacheMode(QtGui.QGraphicsView.CacheBackground)
        view.setViewportUpdateMode(
            QtGui.QGraphicsView.BoundingRectViewportUpdate)
        view.setDragMode(QtGui.QGraphicsView.NoDrag)

        self.setWindowTitle("Transformations")
        self.setCentralWidget(view)
Ejemplo n.º 16
0
chicken_data = {
    "can_be_eaten": True,
    "eaten": False,
    "side": "left",
    "name": "chicken"
}
chicken = Item(**chicken_data)

feed_data = {
    "can_be_eaten": True,
    "eaten": False,
    "side": "left",
    "name": "feed"
}
feed = Item(**feed_data)

left_dock = Dock(side="left", items=[fox, chicken, feed])
right_dock = Dock(side="right", items=[])


def move():
    """
    Takes in a list of items.
    puts them on other side.
    """
    items = [fox, chicken, feed]
    if not left_dock.valid_state():
        right_dock.add(items[0])
        left_dock.remove(items[0])
    print right_dock.items, left_dock.items
Ejemplo n.º 17
0
    def __init__(self,name,size):
        Dock.__init__(self,name,size)

        self.setMinimumWidth(500)
        # self.setMaximumWidth(500)
        self.setMinimumHeight(300)
        # self.setMaximumHeight(325)


        self.orientation = 'horizontal'
        self.autoOrient = False

        widget = QtGui.QWidget()
        grid = QtGui.QGridLayout()

        self.graphDockControlWidget = GraphDockControlWidget()
        grid.addWidget(self.graphDockControlWidget)

        self.createButton = QtGui.QPushButton('Create New Graph')
        self.createButton.setMinimumHeight(140)
        self.createButton.setMaximumHeight(140)


        grid.setRowStretch(0,1)
        grid.addWidget(self.createButton,1,0,1,2)

        label1 = QtGui.QLabel(self, text="Title")
        label1.setStyleSheet("border: 0px;")
        label1.setMaximumWidth(70)
        label1.setMinimumWidth(70)
        label2 = QtGui.QLabel(self, text="Variables")
        label2.setStyleSheet("border: 0px;")
        label2.setMaximumWidth(70)
        label2.setMinimumWidth(70)
        label3 = QtGui.QLabel(self, text="x:")
        label3.setStyleSheet("border: 0px;")
        label3.setAlignment(QtCore.Qt.AlignLeft)
        label4 = QtGui.QLabel(self, text="y:")
        label4.setStyleSheet("border: 0px;")
        label4.setAlignment(QtCore.Qt.AlignLeft)
        label5 = QtGui.QLabel(self, text="Live updating")
        label5.setStyleSheet("border: 0px;")
        label5.setMaximumWidth(70)
        label5.setMinimumWidth(70)

        self.vars = ['time','volt', 'ion', 'ai1','ai2']

        grid.addWidget(label1, 2,0)
        grid.addWidget(label2, 3,0)
        grid.addWidget(label3, 4,0)
        grid.addWidget(label4, 5,0)
        grid.addWidget(label5, 6,0)

        # text boxes
        self.title = QtGui.QLineEdit(self)
        self.title.setMaximumWidth(95)
        self.title.setMinimumWidth(95)
        self.title.setText('New Graph')
        self.varx = QtGui.QComboBox(self)
        self.varx.setMaximumWidth(70)
        self.varx.setMinimumWidth(70)
        self.varx.addItems(self.vars)
        self.vary = QtGui.QComboBox(self)
        self.vary.setMaximumWidth(70)
        self.vary.setMinimumWidth(70)
        self.vary.addItems(self.vars)
        self.checkBox = QtGui.QCheckBox(self)

        grid.addWidget(self.title, 2,1)
        grid.addWidget(self.varx, 4,1)
        grid.addWidget(self.vary, 5,1)
        grid.addWidget(self.checkBox, 6,1)
        grid.setRowStretch(7,1)

        widget.setLayout(grid)

        splitter = MySplitter('Settings', widget, 
            self.graphDockControlWidget)
        splitter.toggleSizes()
        self.addWidget(splitter)
Ejemplo n.º 18
0
    def __init__(self,name,size):
        Dock.__init__(self,name,size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        widget = QtGui.QWidget()
        layout = QtGui.QVBoxLayout()

        self.scrollArea = QtGui.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QtGui.QWidget(self.scrollArea)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        layout.addWidget(self.scrollArea)
        self.verticalLayoutScroll = QtGui.QGridLayout(self.scrollAreaWidgetContents)

        widget.setLayout(layout)
        self.addWidget(widget)


        text=QtGui.QLabel()
        text.setWordWrap(True)
        self.verticalLayoutScroll.addWidget(text)

        text.setText(
"Welcome to CRISTAL - the Code for Realtime Interactive Simultaneous laser Tuning, \
Acquisition and logging! This panel is meant to help you take your first CRISTAL \
steps.<br>\
CRISTAL aims to have a sleek, clutterless interface. All the UI \
elements you see can be moved around to a location of your choosing by clicking\
on the blue titlebar and dragging it to another spot. You can also drag a UI \
widget on top of another one; it will then be added as a Tab. They can also be \
resized, most of them can be made arbitrarily large or small. You can use this\
to hide a Ui element. By double-clicking on the blue titlebar, the UI element is \
popped out and will make it's own window. You can of course drag it back to \
somewhere else. Almost all of the UI elements have a settings panel on \
the right, which can be revealed by clicking on the vertically printed word \
\'settings\' and dragging it to the left. If settings are greyed out, it means \
CRISTAL does not want you to change them a this time; usually, thisis because a \
measurement is running at that time.<br>The standard user interface CRISTAL \
generates on start-up contains the following panels:\
<ul><li>A DAQ Control unit, which is used to start \
and stop new measurements, and changing the scan settings for these measurements.<br></li>\
<li>A set of graphs, displaying whatever you have them display using the dropdown boxes.\
 Graphs can be live. Live graphs only display data that is currently\
 being collected. The use of the non-live graphs will be explained down below.<br></li>\
<li>A Python interactive console, with Numpy and PyQtGraph imported. If you know \
some basic python, you can use this to do some quick calculations, plot some \
graphs, etc. Have fun.<br></li>\
<li> The logbook \
can contain entries, which can be shown or collapsed by clicking on the arrow in \
the top-left. Every time a new measurement is started, \
an entry is made. This entry will have a green color. Clicking and dragging the \
label which has the name and timestamp of the entry onto one of the graphs will \
plot the relevant data for that entry. You can only drag-n-drop onto non-live   \
graphs. A new entry can also be made at any point by clicking on the \'new entry\'\
button at the bottom. If you feel there is a very important parameter that should \
always be logged, you can \'Add an Entry Property\', it will always be asked for \
new entries after that point. The log \
can be filtered using the filtering widget in the Settings-panel on the right. \
Use this if you for example only want to see the green Capture logs, select only \
a certain isotope, filter out the scans you were present, etc. <br><br> \
Always try to keep the logbook up-to-date by filling in the details asked \
by the entry!<br></li></ul>\
The best way to learn how to use CRISTAL is by doing! Don't worry, you can't break\
anything. And if you do, shoot me an email!<br><br> --RPdG")
Ejemplo n.º 19
0
    def __init__(self, name, size):
        Dock.__init__(self, name, size)

        self.orientation = 'horizontal'
        self.autoOrient = False

        widget = QtGui.QWidget()
        layout = QtGui.QVBoxLayout()

        self.scrollArea = QtGui.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QtGui.QWidget(self.scrollArea)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)

        layout.addWidget(self.scrollArea)
        self.verticalLayoutScroll = QtGui.QGridLayout(
            self.scrollAreaWidgetContents)

        widget.setLayout(layout)
        self.addWidget(widget)

        text = QtGui.QLabel()
        text.setWordWrap(True)
        self.verticalLayoutScroll.addWidget(text)

        text.setText(
            "Welcome to CRISTAL - the Code for Realtime Interactive Simultaneous laser Tuning, \
Acquisition and logging! This panel is meant to help you take your first CRISTAL \
steps.<br>\
CRISTAL aims to have a sleek, clutterless interface. All the UI \
elements you see can be moved around to a location of your choosing by clicking\
on the blue titlebar and dragging it to another spot. You can also drag a UI \
widget on top of another one; it will then be added as a Tab. They can also be \
resized, most of them can be made arbitrarily large or small. You can use this\
to hide a Ui element. By double-clicking on the blue titlebar, the UI element is \
popped out and will make it's own window. You can of course drag it back to \
somewhere else. Almost all of the UI elements have a settings panel on \
the right, which can be revealed by clicking on the vertically printed word \
\'settings\' and dragging it to the left. If settings are greyed out, it means \
CRISTAL does not want you to change them a this time; usually, thisis because a \
measurement is running at that time.<br>The standard user interface CRISTAL \
generates on start-up contains the following panels:\
<ul><li>A DAQ Control unit, which is used to start \
and stop new measurements, and changing the scan settings for these measurements.<br></li>\
<li>A set of graphs, displaying whatever you have them display using the dropdown boxes.\
 Graphs can be live. Live graphs only display data that is currently\
 being collected. The use of the non-live graphs will be explained down below.<br></li>\
<li>A Python interactive console, with Numpy and PyQtGraph imported. If you know \
some basic python, you can use this to do some quick calculations, plot some \
graphs, etc. Have fun.<br></li>\
<li> The logbook \
can contain entries, which can be shown or collapsed by clicking on the arrow in \
the top-left. Every time a new measurement is started, \
an entry is made. This entry will have a green color. Clicking and dragging the \
label which has the name and timestamp of the entry onto one of the graphs will \
plot the relevant data for that entry. You can only drag-n-drop onto non-live   \
graphs. A new entry can also be made at any point by clicking on the \'new entry\'\
button at the bottom. If you feel there is a very important parameter that should \
always be logged, you can \'Add an Entry Property\', it will always be asked for \
new entries after that point. The log \
can be filtered using the filtering widget in the Settings-panel on the right. \
Use this if you for example only want to see the green Capture logs, select only \
a certain isotope, filter out the scans you were present, etc. <br><br> \
Always try to keep the logbook up-to-date by filling in the details asked \
by the entry!<br></li></ul>\
The best way to learn how to use CRISTAL is by doing! Don't worry, you can't break\
anything. And if you do, shoot me an email!<br><br> --RPdG")
Ejemplo n.º 20
0
 def create_docks(self, nbr_docks):
     for i in range(0, nbr_docks):
         temp_dock = Dock("Dock{}".format(i))
         self.docks.append(temp_dock)