Exemple #1
0
class ImageOverlayWindow( OverlayWindowInterface ):
    """ This QT4 window is a essentially a frame to hold a colorbar
    representation of the image overlay's colormap, and the image
    overlay manager's UI control panel. It also creates some PyQt4
    signals which can be monitored by other UI elements.
    """

    tool_name = 'Image Overlay Controls'

    def __init__(self, loc_connections, image_connections,
                 image_props_connections, bbox,
                 functional_manager=None,
                 overlay=None, external_loc=None,
                 parent=None, main_ref=None):
        OverlayWindowInterface.__init__(self,
                                        loc_connections,
                                        image_connections,
                                        image_props_connections,
                                        bbox, # <-- TRY TO DECOUPLE THIS
                                        external_loc=external_loc,
                                        parent=parent,
                                        main_ref=main_ref,
                                        functional_manager=functional_manager)
        vbox = QtGui.QVBoxLayout(self)
        self.cbar = ColorbarPanel(parent=self, figsize=(6,2))

        vbox.addWidget(self.cbar)
        if functional_manager is None or \
               not isinstance(functional_manager, ImageOverlayManager):
            self.func_man = ImageOverlayManager(
                bbox, colorbar=self.cbar,
                loc_signal=self.loc_changed,
                image_signal=self.image_changed,
                props_signal=self.image_props_changed,
                overlay=overlay
                )
        self.func_man.connect_colorbar(self.cbar)
        # breaking independence
        if self.func_man.overlay is not None:
            print 'requesting new image signal'
            self.func_man.send_image_signal()
        
        vbox.addWidget(self.func_man.make_panel(parent=self))
        QtGui.QWidget.setSizePolicy(self,
                                    QtGui.QSizePolicy.Expanding,
                                    QtGui.QSizePolicy.Expanding)
        self.updateGeometry()
        r = self.geometry()
        self.cbar.figure.set_size_inches(r.width()/100., r.height()/200.)
        self.cbar.draw()
        
    def _strip_overlay(self):
        self.cbar.initialize()
Exemple #2
0
    def __init__(self, loc_connections, image_connections,
                 image_props_connections, bbox,
                 functional_manager=None,
                 overlay=None, external_loc=None,
                 parent=None, main_ref=None):
        OverlayWindowInterface.__init__(self,
                                        loc_connections,
                                        image_connections,
                                        image_props_connections,
                                        bbox, # <-- TRY TO DECOUPLE THIS
                                        external_loc=external_loc,
                                        parent=parent,
                                        main_ref=main_ref,
                                        functional_manager=functional_manager)
        vbox = QtGui.QVBoxLayout(self)
        self.cbar = ColorbarPanel(parent=self, figsize=(6,2))

        vbox.addWidget(self.cbar)
        if functional_manager is None or \
               not isinstance(functional_manager, ImageOverlayManager):
            self.func_man = ImageOverlayManager(
                bbox, colorbar=self.cbar,
                loc_signal=self.loc_changed,
                image_signal=self.image_changed,
                props_signal=self.image_props_changed,
                overlay=overlay
                )
        self.func_man.connect_colorbar(self.cbar)
        # breaking independence
        if self.func_man.overlay is not None:
            print 'requesting new image signal'
            self.func_man.send_image_signal()
        
        vbox.addWidget(self.func_man.make_panel(parent=self))
        QtGui.QWidget.setSizePolicy(self,
                                    QtGui.QSizePolicy.Expanding,
                                    QtGui.QSizePolicy.Expanding)
        self.updateGeometry()
        r = self.geometry()
        self.cbar.figure.set_size_inches(r.width()/100., r.height()/200.)
        self.cbar.draw()