def __init__(self):
        # Initialize a new AppIndicator
        self.indicator = appindicator.Indicator(
            "natural-scrolling-indicator",
            "natural-scrolling-status-not-activated",
            appindicator.CATEGORY_APPLICATION_STATUS)
        media_path = "%s/media/" % naturalscrollingconfig.get_data_path()
        self.indicator.set_icon_theme_path(media_path)
        self.indicator.set_attention_icon(
            "natural-scrolling-status-activated")

        menu = IndicatorMenu()
        self.indicator.set_menu(menu)

        # Initialize the UDev client
        udev_observator = UDevObservator()
        udev_observator.on_update_execute(menu.refresh)
        udev_observator.start()

        # Force the first refresh of the menu in order to populate it.
        menu.refresh(udev_observator.gather_devices())

        # When something change in GConf, push it to the Indicator menu
        # in order to update the status of the device as checked or unchecked
        GConfSettings().server().on_update_fire(menu.update_check_menu_item)

        # Initialize GConf in order to be up-to-date with existing devices
        GConfSettings().initialize(udev_observator.gather_devices())
Exemple #2
0
    def __init__(self):
        # Initialize a new AppIndicator
        self.indicator = appindicator.Indicator(
            "natural-scrolling-indicator",
            "natural-scrolling-status-not-activated",
            appindicator.CATEGORY_APPLICATION_STATUS)
        media_path = "%s/media/" % naturalscrollingconfig.get_data_path()
        self.indicator.set_icon_theme_path(media_path)
        self.indicator.set_attention_icon("natural-scrolling-status-activated")

        menu = IndicatorMenu()
        self.indicator.set_menu(menu)

        # Initialize the UDev client
        udev_observator = UDevObservator()
        udev_observator.on_update_execute(menu.refresh)
        udev_observator.start()

        # Force the first refresh of the menu in order to populate it.
        menu.refresh(udev_observator.gather_devices())

        # When something change in GConf, push it to the Indicator menu
        # in order to update the status of the device as checked or unchecked
        GConfSettings().server().on_update_fire(menu.update_check_menu_item)

        # Initialize GConf in order to be up-to-date with existing devices
        GConfSettings().initialize(udev_observator.gather_devices())
 def on_start_at_login_clicked(self, widget, data=None):
     """
     Fired method when user click on gtk.CheckMenuItem 'Start at login'
     """
     if not os.path.exists(naturalscrollingconfig.get_auto_start_path()):
         os.makedirs(naturalscrollingconfig.get_auto_start_path())
     
     auto_start_file_exists = os.path.isfile(naturalscrollingconfig.get_auto_start_file_path())
     if widget.get_active():
         if not auto_start_file_exists:
             source = open(naturalscrollingconfig.get_data_path() + "/" + naturalscrollingconfig.get_auto_start_file_name(), "r")
             destination = open(naturalscrollingconfig.get_auto_start_file_path(), "w")
             destination.write(source.read())
             destination.close() and source.close()
     else:
         if auto_start_file_exists:
             os.remove(naturalscrollingconfig.get_auto_start_file_path())
    def __init__(self):
        self.AboutDialog = AboutNaturalscrollingDialog
        self.mouseids = self.get_slave_pointers()
        self.pingfrequency = 1 # in seconds
        
        self.ind = appindicator.Indicator(
            "natural-scrolling-indicator",
            "natural-scrolling-status-not-activated",
            appindicator.CATEGORY_APPLICATION_STATUS
        )
        self.settings = GConfSettings()

        media_path = "%s/media/" % naturalscrollingconfig.get_data_path()
        self.ind.set_icon_theme_path(media_path)
        self.ind.set_attention_icon("natural-scrolling-status-activated")
        
        self.menu_setup()
        self.ind.set_menu(self.menu)