예제 #1
0
파일: status.py 프로젝트: HughP/nostaples
 def register_view(self, view):
     """
     Registers this controller with a view.
     """
     Controller.register_view(self, view)
     
     self.log.debug('%s registered.', view.__class__.__name__)
예제 #2
0
파일: page.py 프로젝트: hpcgam/dicomimport
    def __init__(self, application):
        """
        Constructs the PageController.
        """
        self.application = application
        Controller.__init__(self, application.get_null_page_model())

        status_controller = application.get_status_controller()
        self.status_context = status_controller.get_context_id(self.__class__.__name__)

        application.get_preferences_model().register_observer(self)

        self.log = logging.getLogger(self.__class__.__name__)

        # The preview pixbuf is cached so it can be rerendered without
        # reapplying zoom transformations.
        self.preview_pixbuf = None

        # Non persistent settings that apply to all scanned pages
        self.preview_width = 0
        self.preview_height = 0
        self.preview_zoom = 1.0
        self.preview_is_best_fit = False

        self.preview_zoom_rect_color = gtk.gdk.colormap_get_system().alloc_color(
            gtk.gdk.Color(65535, 0, 0), False, True
        )

        # Reusable temp vars to hold the start point of a mouse drag action.
        self.zoom_drag_start_x = 0
        self.zoom_drag_start_y = 0
        self.move_drag_start_x = 0
        self.move_drag_start_y = 0

        self.log.debug("Created.")
예제 #3
0
파일: status.py 프로젝트: HughP/nostaples
    def __init__(self, application):
        """
        Constructs the StatusController.
        """
        self.application = application
        Controller.__init__(self, application.get_status_model())

        self.log = logging.getLogger(self.__class__.__name__)
        self.log.debug('Created.')
예제 #4
0
파일: save.py 프로젝트: HughP/nostaples
    def __init__(self, application):
        """
        Constructs the SaveController.
        """
        self.application = application
        Controller.__init__(self, application.get_save_model())
        
        status_controller = application.get_status_controller()
        self.status_context = \
            status_controller.get_context_id(self.__class__.__name__)

        self.log = logging.getLogger(self.__class__.__name__)
        self.log.debug('Created.')
예제 #5
0
파일: about.py 프로젝트: HughP/nostaples
    def __init__(self, application):
        """
        Constructs the AboutController.
        
        Note that About has no model, an empty model is
        passed to the super constructor to avoid assertion
        failures later on.
        """
        self.application = application
        Controller.__init__(self, Model())

        self.log = logging.getLogger(self.__class__.__name__)
        self.log.debug('Created.')
예제 #6
0
파일: main.py 프로젝트: HughP/nostaples
 def __init__(self, application):
     """
     Constructs the MainController, as well as necessary sub-controllers 
     and services.
     """
     self.application = application
     Controller.__init__(self, application.get_main_model())
     
     application.get_document_model().register_observer(self)
     application.get_preferences_model().register_observer(self)
     
     status_controller = application.get_status_controller()
     self.status_context = \
         status_controller.get_context_id(self.__class__.__name__)
     
     self.log = logging.getLogger(self.__class__.__name__)
     self.log.debug('Created.')
예제 #7
0
파일: save.py 프로젝트: HughP/nostaples
 def register_view(self, view):
     """
     Registers this controller with a view.
     """
     Controller.register_view(self, view)
     
     preferences_model = self.application.get_preferences_model()
     save_model = self.application.get_save_model()
     
     # Force refresh of keyword list
     keywords_liststore = view['keywords_entry'].get_liststore()
     keywords_liststore.clear()
     
     for keyword in preferences_model.saved_keywords:
         keywords_liststore.append([keyword])
     
     self.log.debug('%s registered.', view.__class__.__name__)
예제 #8
0
파일: document.py 프로젝트: HughP/nostaples
 def register_view(self, view):
     """
     Registers this controller with a view.
     """
     Controller.register_view(self, view)
     
     view['thumbnails_tree_view'].set_model(
         self.application.get_document_model())
     view['thumbnails_tree_view'].get_selection().connect(
         'changed', self.on_thumbnails_tree_view_selection_changed)
     view['thumbnails_tree_view'].connect(
         'button-press-event', self.on_thumbnails_tree_view_button_press_event)
     
     view['delete_menu_item'].connect(
         "activate", self.on_delete_menu_item_activated)
     
     self.log.debug('%s registered.', view.__class__.__name__)
예제 #9
0
 def __init__(self, application):
     """
     Constructs the PreferencesController.
     """
     self.application = application
     Controller.__init__(self, application.get_preferences_model())
     
     application.get_main_model().register_observer(self)
     
     # Setup GConf observer for system-wide toolbar settings
     self.gconf_client = gconf.client_get_default()
     self.gconf_client.add_dir(
         '/desktop/gnome/interface', gconf.CLIENT_PRELOAD_NONE)
     self.gconf_client.notify_add(
         '/desktop/gnome/interface/toolbar_style', 
         self.on_default_toolbar_style_changed)
     
     self.log = logging.getLogger(self.__class__.__name__)
     self.log.debug('Created.')
예제 #10
0
파일: document.py 프로젝트: HughP/nostaples
    def __init__(self, application):
        """
        Constructs the DocumentsController, as well as necessary
        sub-controllers.
        """
        self.application = application
        Controller.__init__(self, application.get_document_model())
        
        preferences_model = application.get_preferences_model()
        preferences_model.register_observer(self)
        
        status_controller = application.get_status_controller()
        self.status_context = \
            status_controller.get_context_id(self.__class__.__name__)
        
        application.get_document_model().connect(
          'row-changed', self.on_document_model_row_changed)

        self.log = logging.getLogger(self.__class__.__name__)
        self.log.debug('Created.')