Ejemplo n.º 1
0
    def __init__(self, args, optionsDict={}):
        QtGui.QApplication.__init__(self, args)
        NotificationDispatcher.__init__(self)
        # There are lots of issues with how the notifications are used
        # Although create_notification() exists, it doesn't seem to be used in
        # every case before register_notification() is called
        warnings.simplefilter('ignore', NotificationDispatcher.UsageWarning)

        VistrailsApplicationInterface.__init__(self)
        self.builderWindow = None
        self._vt_sheet = None
        set_vistrails_application(self)

        vistrails.gui.theme.initializeCurrentTheme()

        VistrailsApplicationInterface.init(self,
                                           options_dict=optionsDict,
                                           args=args)
        from vistrails.gui.vistrails_window import QVistrailsWindow
        self.builderWindow = QVistrailsWindow(ui_hooks=vt_hooks.hooks)
        self.builderWindow.closeEvent = lambda e: None

        self.startup.set_package_to_enabled('spreadsheet')
        self.package_manager.initialize_packages()

        self.builderWindow.link_registry()

        # Create a first controller
        view = self.builderWindow.create_first_vistrail()
        controller = view.get_controller()
        assert controller is not None

        # Set our own spreadsheet cell container class
        from dat.gui.cellcontainer import DATCellContainer
        spreadsheetController.setCellContainerClass(DATCellContainer)

        # Discover the plots and variable loaders from packages and register to
        # notifications for packages loaded/unloaded in the future
        GlobalManager.init()

        # Register the VistrailManager with the 'controller_changed'
        # notification
        VistrailManager.init()
        VistrailManager.set_controller(controller, register=True)

        # Create the main window
        mw = MainWindow()
        mw.setVisible(True)

        # Create the spreadsheet for the first project
        self._controller_changed(controller, new=True)

        # Create a spreadsheet and execute the visualizations when a new
        # controller is selected
        self.register_notification('dat_controller_changed',
                                   self._controller_changed)

        # Change the current controller when another sheet is selected
        self.register_notification('spreadsheet_sheet_changed',
                                   self._sheet_changed)
Ejemplo n.º 2
0
Archivo: window.py Proyecto: rbax/DAT
 def openFile(self):
     builderWindow = get_vistrails_application().builderWindow
     with VistrailManager.defer_controller_change():
         view = builderWindow.open_vistrail_default()
         if view is not None:
             VistrailManager.set_controller(view.get_controller(),
                                            register=True)
Ejemplo n.º 3
0
 def openFile(self):
     builderWindow = get_vistrails_application().builderWindow
     with VistrailManager.defer_controller_change():
         view = builderWindow.open_vistrail_default()
         if view is not None:
             VistrailManager.set_controller(
                 view.get_controller(),
                 register=True)
Ejemplo n.º 4
0
    def __init__(self, args, optionsDict={}):
        QtGui.QApplication.__init__(self, args)
        NotificationDispatcher.__init__(self)
        # There are lots of issues with how the notifications are used
        # Although create_notification() exists, it doesn't seem to be used in
        # every case before register_notification() is called
        warnings.simplefilter('ignore', NotificationDispatcher.UsageWarning)

        VistrailsApplicationInterface.__init__(self)
        self.builderWindow = None
        self._vt_sheet = None
        set_vistrails_application(self)

        vistrails.gui.theme.initializeCurrentTheme()

        VistrailsApplicationInterface.init(self,
                                           options_dict=optionsDict,
                                           args=args)
        from vistrails.gui.vistrails_window import QVistrailsWindow
        self.builderWindow = QVistrailsWindow(ui_hooks=vt_hooks.hooks)
        self.builderWindow.closeEvent = lambda e: None

        self.startup.set_package_to_enabled('spreadsheet')
        self.package_manager.initialize_packages()

        self.builderWindow.link_registry()

        # Create a first controller
        view = self.builderWindow.create_first_vistrail()
        controller = view.get_controller()
        assert controller is not None

        # Set our own spreadsheet cell container class
        from dat.gui.cellcontainer import DATCellContainer
        spreadsheetController.setCellContainerClass(DATCellContainer)

        # Discover the plots and variable loaders from packages and register to
        # notifications for packages loaded/unloaded in the future
        GlobalManager.init()

        # Register the VistrailManager with the 'controller_changed'
        # notification
        VistrailManager.init()
        VistrailManager.set_controller(
            controller,
            register=True)

        # Create the main window
        mw = MainWindow()
        mw.setVisible(True)

        # Create the spreadsheet for the first project
        self._controller_changed(controller, new=True)

        # Create a spreadsheet and execute the visualizations when a new
        # controller is selected
        self.register_notification(
            'dat_controller_changed',
            self._controller_changed)

        # Change the current controller when another sheet is selected
        self.register_notification(
            'spreadsheet_sheet_changed',
            self._sheet_changed)
Ejemplo n.º 5
0
 def vt_controller():
     app = get_vistrails_application()
     view = app.builderWindow.new_vistrail()
     controller = view.get_controller()
     VistrailManager.set_controller(controller, register=True)
     return controller