Esempio n. 1
0
    def __init__(self, viewer=None, width=600, height=600):
        super(GingaScrolledViewerWidget, self).__init__()

        if viewer is None:
            viewer = CanvasView(logger)
        self.logger = viewer.logger

        self.viewer = viewer
        self.widget = ScrolledView(viewer)
Esempio n. 2
0
class GingaScrolledViewerWidget(Widgets.WidgetBase):
    def __init__(self, viewer=None, width=600, height=600):
        super(GingaScrolledViewerWidget, self).__init__()

        if viewer is None:
            viewer = CanvasView()
        self.logger = viewer.logger

        self.viewer = viewer
        self.widget = ScrolledView(viewer)

    def scroll_bars(self, horizontal='on', vertical='on'):
        self.widget.scroll_bars(horizontal=horizontal, vertical=vertical)
Esempio n. 3
0
    def __init__(self, logger):
        super(FitsViewer, self).__init__()
        self.logger = logger

        # create the ginga viewer and configure it
        fi = ImageViewCanvas(self.logger, render='widget')
        fi.enable_autocuts('on')
        fi.set_autocut_params('zscale')
        fi.enable_autozoom('on')
        fi.set_callback('drag-drop', self.drop_file)
        fi.set_bg(0.2, 0.2, 0.2)
        fi.ui_setActive(True)
        fi.enable_draw(False)
        self.fitsimage = fi

        # enable some user interaction
        bd = fi.get_bindings()
        bd.enable_all(True)

        w = fi.get_widget()
        w.resize(512, 512)

        # add scrollbar interface around this viewer
        si = ScrolledView(fi)

        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(QtCore.QMargins(2, 2, 2, 2))
        vbox.setSpacing(1)
        vbox.addWidget(si, stretch=1)

        hbox = QtGui.QHBoxLayout()
        hbox.setContentsMargins(QtCore.QMargins(4, 2, 4, 2))

        wopen = QtGui.QPushButton("Open File")
        wopen.clicked.connect(self.open_file)
        wquit = QtGui.QPushButton("Quit")
        wquit.clicked.connect(self.quit)

        hbox.addStretch(1)
        for w in (wopen, wquit):
            hbox.addWidget(w, stretch=0)

        hw = QtGui.QWidget()
        hw.setLayout(hbox)
        vbox.addWidget(hw, stretch=0)

        vw = QtGui.QWidget()
        self.setCentralWidget(vw)
        vw.setLayout(vbox)
Esempio n. 4
0
    def __init__(self, logger):
        super(FitsViewer, self).__init__()
        self.logger = logger

        self.cachedFiles = None
        self.scanning = False
        #KTL stuff
        #Cache KTL keywords
        self.trickxpos = ktl.cache('ao', 'TRKRO1XP')
        self.trickypos = ktl.cache('ao', 'TRKRO1YP')
        self.trickxsize = ktl.cache('ao', 'TRKRO1XS')
        self.trickysize = ktl.cache('ao', 'TRKRO1YS')

        self.rawfile = ''

        self.threadpool = QtCore.QThreadPool()

        self.iqcalc = iqcalc.IQCalc(self.logger)

        # create the ginga viewer and configure it
        fi = CanvasView(self.logger, render='widget')
        fi.enable_autocuts('on')
        fi.set_autocut_params('zscale')
        fi.enable_autozoom('on')
        # fi.set_callback('drag-drop', self.drop_file)
        fi.set_bg(0.2, 0.2, 0.2)
        fi.ui_set_active(True)
        self.fitsimage = fi

        # enable some user interaction
        self.bd = fi.get_bindings()
        self.bd.enable_all(True)

        w = fi.get_widget()
        w.resize(512, 512)

        # add scrollbar interface around this viewer
        si = ScrolledView(fi)

        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(QtCore.QMargins(2, 2, 2, 2))
        vbox.setSpacing(1)
        vbox.addWidget(si, stretch=1)

        hbox = QtGui.QHBoxLayout()
        hbox.setContentsMargins(QtCore.QMargins(4, 2, 4, 2))

        self.readout = QtGui.QLabel("")

        hbox.addStretch(1)
        hbox.addWidget(self.readout, stretch=0)

        self.box_readout = QtGui.QLabel("")

        hbox.addStretch(1)
        hbox.addWidget(self.box_readout, stretch=0)

        hw = QtGui.QWidget()
        hw.setLayout(hbox)
        vbox.addWidget(hw, stretch=0)

        hbox2 = QtGui.QHBoxLayout()
        hbox2.setContentsMargins(QtCore.QMargins(4, 2, 4, 2))
        self.wstartscan = QtGui.QPushButton("Start Scan")
        self.wstartscan.clicked.connect(self.start_scan)
        self.wstartscan.setEnabled(True)
        self.wstopscan = QtGui.QPushButton("Stop Scan")
        self.wstopscan.clicked.connect(self.stop_scan)
        self.wstopscan.setEnabled(False)
        self.wcut = QtGui.QComboBox()
        for name in fi.get_autocut_methods():
            self.wcut.addItem(name)
        self.wcut.currentIndexChanged.connect(self.cut_change)
        self.wcolor = QtGui.QComboBox()
        for name in fi.get_color_algorithms():
            self.wcolor.addItem(name)
        self.wcolor.currentIndexChanged.connect(self.color_change)
        wopen = QtGui.QPushButton("Open File")
        wopen.clicked.connect(self.open_file)
        self.wsky = QtGui.QPushButton("Load Sky")
        self.wsky.clicked.connect(self.load_sky)
        self.wsky.setEnabled(False)
        wquit = QtGui.QPushButton("Quit")
        wquit.clicked.connect(self.quit)
        fi.set_callback('cursor-changed', self.motion_cb)
        fi.add_callback('cursor-down', self.btndown)
        hbox2.addStretch(1)
        for w in (self.wstartscan, self.wstopscan, self.wcut, self.wcolor,
                  wopen, self.wsky, wquit):
            hbox2.addWidget(w, stretch=0)

        hw2 = QtGui.QWidget()
        hw2.setLayout(hbox2)
        vbox.addWidget(hw2, stretch=0)

        vw = QtGui.QWidget()
        self.setCentralWidget(vw)
        vw.setLayout(vbox)
        self.recdc, self.compdc = self.add_canvas()
        self.boxtag = "roi-box"
        self.picktag = "pick-box"
Esempio n. 5
0
    def __init__(self, logger):
        super(FitsViewer, self).__init__()
        self.logger = logger
        self.drawcolors = colors.get_colors()
        self.dc = get_canvas_types()

        self.set_medfilt(0)
        self.set_c2c(0)

        # create the ginga viewer and configure it
        fi = CanvasView(self.logger, render='widget')
        fi.enable_autocuts('on')
        fi.set_autocut_params('zscale')
        fi.enable_autozoom('on')
        fi.set_callback('drag-drop', self.drop_file)
        fi.add_callback('cursor-changed', self.cursor_cb)
        fi.add_callback('cursor-down', self.click_cb)
        fi.set_bg(0.2, 0.2, 0.2)
        fi.ui_set_active(True)
        self.fitsimage = fi

        # enable some user interaction
        bd = fi.get_bindings()
        bd.enable_all(True)

        # canvas that we will draw on
        canvas = self.dc.DrawingCanvas()
        #         canvas.enable_draw(True)
        #         canvas.enable_edit(True)
        #         canvas.set_drawtype('circle', color='lightblue')
        canvas.set_surface(fi)
        self.canvas = canvas
        # add canvas to view
        #fi.add(canvas)
        private_canvas = fi.get_canvas()
        private_canvas.add(canvas)
        #         canvas.register_for_cursor_drawing(fi)
        #         canvas.add_callback('draw-event', self.draw_cb)
        #         canvas.set_draw_mode('draw')
        canvas.ui_set_active(True)

        self.drawtypes = canvas.get_drawtypes()
        self.drawtypes.sort()

        w = fi.get_widget()
        w.resize(1000, 1000)

        # ---------------------------------------------------------------------
        # add scrollbar interface around this viewer
        si = ScrolledView(fi)

        vbox = QtGui.QVBoxLayout()
        vbox.setContentsMargins(QtCore.QMargins(2, 2, 2, 2))
        vbox.setSpacing(1)
        vbox.addWidget(si, stretch=1)

        # ---------------------------------------------------------------------
        # add live cursor readout
        self.readout = QtGui.QLabel("")
        vbox.addWidget(self.readout,
                       stretch=0,
                       alignment=QtCore.Qt.AlignCenter)

        # ---------------------------------------------------------------------
        # add row of interface widgets
        hbox = QtGui.QHBoxLayout()
        hbox.setContentsMargins(QtCore.QMargins(4, 2, 4, 2))

        wzoomfit = QtGui.QPushButton("Z0")
        wzoomfit.clicked.connect(self.zoom_fit)

        wzoomin = QtGui.QPushButton("Z+")
        wzoomin.clicked.connect(self.zoom_in)

        wzoomout = QtGui.QPushButton("Z-")
        wzoomout.clicked.connect(self.zoom_out)

        wc2c = QtGui.QCheckBox("Click to Center")
        wc2c.stateChanged.connect(self.set_c2c)
        self.wc2c = wc2c

        wsolve = QtGui.QPushButton("Solve")
        wsolve.clicked.connect(self.solve_astrometry)

        woverlay = QtGui.QPushButton("Overlay Catalog")
        woverlay.clicked.connect(self.overlay_catalog)

        wclear = QtGui.QPushButton("Clear Overlays")
        wclear.clicked.connect(self.clear_overlays)

        wmedfilt = QtGui.QCheckBox("Median Filter")
        wmedfilt.stateChanged.connect(self.set_medfilt)
        self.wmedfilt = wmedfilt

        wopen = QtGui.QPushButton("Open File")
        wopen.clicked.connect(self.open_file)

        wquit = QtGui.QPushButton("Quit")
        wquit.clicked.connect(self.quit)

        hbox.addStretch(1)

        hbox.addWidget(wzoomfit, stretch=0)
        hbox.addWidget(wzoomin, stretch=0)
        hbox.addWidget(wzoomout, stretch=0)
        hbox.addWidget(wc2c, stretch=0)
        #         hbox.addWidget(wsolve, stretch=0)
        hbox.addWidget(woverlay, stretch=0)
        hbox.addWidget(wclear, stretch=0)
        hbox.addWidget(wmedfilt, stretch=0)
        #         hbox.addWidget(wopen, stretch=0)
        hbox.addWidget(wquit, stretch=0)

        # ---------------------------------------------------------------------
        hw = QtGui.QWidget()
        hw.setLayout(hbox)
        vbox.addWidget(hw, stretch=0)

        vw = QtGui.QWidget()
        self.setCentralWidget(vw)
        vw.setLayout(vbox)