コード例 #1
0
ファイル: hotot.py プロジェクト: fma16/Hotot
 def create_memenu(self):
     # Memssage Menu indicator
     self.mm = indicate.indicate_server_ref_default()
     self.mm.set_type('message.hotot')
     self.mm.set_desktop_file(utils.get_ui_object('hotot.desktop'))
     self.mm.connect('server-display', self.on_mm_server_activate)
     self.mm.show()
コード例 #2
0
  def __init__(self):
    self.server = indicate.indicate_server_ref_default()
    self.server.set_type("message.im")
#   this is kinda ugly, or?
    self.server.set_desktop_file("/usr/share/applications/skype.desktop")
    self.server.show()
    pass
コード例 #3
0
 def __init__(self):
     self.server = indicate.indicate_server_ref_default()
     self.server.set_type("message.im")
     self.server.set_desktop_file("/usr/share/applications/skype-wrapper.desktop")
     self.server.show()
     self.indicators = {}
     pass
コード例 #4
0
    def activate(self):
        """
        Displays gajim in the Messaging Menu.
        """
        if not HAS_INDICATE:
            raise GajimPluginException("python-indicate is missing!")
        if not HAS_PYXDG:
            raise GajimPluginException("python-xdg is missing!")

        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.im")
        self.server.connect("server-display", self.on_server_activate)
        dfile = ""
        for file in load_data_paths("applications/gajim.desktop"):
            dfile = file
            break
        if not dfile:
            raise GajimPluginException("Can't locate gajim.desktop!")
        self.server.set_desktop_file(dfile)
        self.server.show()

        # {(account, jid): (indicator, [event, ...]), ...}
        self.events = {}

        gajim.events.event_added_subscribe(self.on_event_added)
        gajim.events.event_removed_subscribe(self.on_event_removed)
コード例 #5
0
    def __init__ (self, handler, main_window=None):
        '''constructor'''
        NAME = 'Messaging Menu'
        DESCRIPTION = 'The Ayatana Messaging Menu extension'
        AUTHOR = 'Cando, Tom Cowell'
        WEBSITE = 'www.emesene.org'
        self.handler = handler
        self.main_window = main_window
        self.conversations = None
        self.signals_have_been_connected = False
        # if system-wide desktop file is not present
        # fallback to a custom .desktop file to be placed in /mesinyer/
        self.desktop_file = os.path.join("/usr/share/applications/",
                                         "emesene.desktop")
        if not utils.file_readable(self.desktop_file):
            self.desktop_file = os.path.join(os.getcwd(), "emesene.desktop")
            
        self.indicator_dict = {}
        self.r_indicator_dict = {}

        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.emesene")
        self.server.set_desktop_file(self.desktop_file)
        self.sid = self.server.connect("server-display", self._server_display)
        self.server.show()
コード例 #6
0
	def __init__(self, username, password):
		""" entry in indicator applet """ 
		self.timeout = 30
		self.server = indicate.indicate_server_ref_default()
		self.server.set_type('message.mail')
		self.server.set_desktop_file('/usr/share/applications/gmailnotify.desktop')
		self.server.connect('server-display', self.click)
		
		self.request = urllib2.Request('https://mail.google.com/mail/feed/atom/')
		self.indicators = []
		self.firstRequest = False
		
		if not username == None and not password == None: 		
			self.request.add_header('Authorization', 'Basic %s'%(base64.encodestring('%s:%s'%(username, password))[:-1]))
		
			indicator = GMailIndicator('Receiving data ...',  GmailNotifyName, time.time())
			self.indicators.append(indicator)
			self.indicators[-1].unstress()
			self.indicators[-1].show()
			self.checkMails()
		else:
			indicator = GMailIndicator('Setting up ' + GmailNotifyName, GmailNotifyName, None, None, True)
			self.indicators.append(indicator)
			self.indicators[-1].show()
			pynotify.Notification(GmailNotifyName, 'You have to set up ' + GmailNotifyName, GmailIcon).show()
コード例 #7
0
  def __init__(self):
    self.server = indicate.indicate_server_ref_default()
    self.server.set_type("message.im")
#   this is kinda ugly, or?
    self.server.set_desktop_file("/usr/share/applications/skype-wrapper.desktop")
    self.server.show()
    self.indicators = {}
    pass
コード例 #8
0
ファイル: indicator.py プロジェクト: Pi03k/py3specto
 def __init__(self, specto):
     self.specto = specto
     self.indicate_srv = indicate.indicate_server_ref_default()
     self.indicate_srv.set_type("message.%s" % PROGRAM_NAME)
     self.indicate_srv.set_desktop_file(self.get_desktop_file())
     self.indicate_srv.connect("server-display", self.specto.toggle_notifier)
     self.indicate_srv.show()
     self.indicate_db = {}
コード例 #9
0
 def create_server(self):
     """ Create a new Skype notification server """
     # Create a notification server
     self.server = indicate.indicate_server_ref_default()
     self.server.set_type("message.im")
     self.server.set_desktop_file("/usr/share/applications/skype.desktop")
     self.server.connect("server-display", self.server_display)
     self.server.show()
コード例 #10
0
  def __init__(self, loop, autorefresh=True):
    self.bus = dbus.SessionBus()
    bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
    dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

    self.db = sqlite3.connect(SQLITE_DB_FILENAME)

    self.accounts = storage.AccountManager(self.db)
    self.searches = storage.SearchManager(self.db)
    self.streams = storage.StreamManager(self.db)
    self.messages = storage.MessageManager(self.db)
    self.collector = OperationCollector(self)
 
    # Monitor the connection
    self.connection_monitor = util.getbus("Connection")
    self.connection_monitor.connect_to_signal("ConnectionOnline", self.on_connection_online)
    self.connection_monitor.connect_to_signal("ConnectionOffline", self.on_connection_offline)

    self.indicate = None 

    if indicate and util.resources.get_desktop_file():
      self.indicate = indicate.indicate_server_ref_default()
      self.indicate.set_type("message.gwibber")
      self.indicate.set_desktop_file(util.resources.get_desktop_file())
      self.indicate.connect("server-display", self.on_indicator_server_activate)
      self.indicate.connect("interest-added", self.on_indicator_interest_added)
      self.indicate.connect("interest-removed", self.on_indicator_interest_removed)
      self.indicate.show()
    self.indicator_items = {}
    self.notified_items = []
    self.notified_errors = {}
    self.messages_indicator = None
    self.replies_indicator = None
    self.private_indicator = None
    self.unseen_counts = {}
    for s in "messages", "replies", "private":
      self.unseen_counts[s] = 0

    self.refresh_count = 0
    self.mainloop = loop
    self.workerpool = multiprocessing.Pool()

    self.refresh_timer_id = None

    self.maintDone = False
    self.maintRunning = False
    self.refreshRunning = False

    if autorefresh:
      if self.refresh_timer_id:
        gobject.source_remove(self.refresh_timer_id)
      # wait a few seconds before alerting the world we are online
      self.refresh_timer_id = gobject.timeout_add_seconds(int(10), self.refresh)

    self.accounts_service = util.getbus("Accounts")
    self.accounts_service.connect_to_signal("Updated", self.on_account_updated)
    self.accounts_service.connect_to_signal("Deleted", self.on_account_deleted)
    self.accounts_service.connect_to_signal("Created", self.on_account_created)
コード例 #11
0
ファイル: messaging.py プロジェクト: Alberto-Beralix/Beralix
 def __init__(self, server_callback=_server_callback):
     if USE_INDICATE:
         self.indicators = []
         self.server = indicate.indicate_server_ref_default()
         self.server.connect("server-display", server_callback)
         self.server.set_type("message.u1")
         self.server.set_desktop_file(
             "/usr/share/applications/ubuntuone-control-panel-gtk.desktop")
         self.server.show()
コード例 #12
0
def init_indicate():
    ## for Maverick registration
    try:
        server = indicate.indicate_server_ref_default()
        server.set_type('music.exaile')
        server.set_desktop_file('/usr/share/applications/exaile.desktop')
        server.show()
    except:
        pass
コード例 #13
0
def init_indicate():
    ## for Maverick registration
    try:
        SERVER_INDICATOR = indicate.indicate_server_ref_default()
        SERVER_INDICATOR.set_type('music.dmusic')
        SERVER_INDICATOR.set_desktop_file('/usr/share/applications/deepin-music-player.desktop')
        SERVER_INDICATOR.show()
    except:
        pass
コード例 #14
0
 def __init__(self, specto):
     self.specto = specto
     self.indicate_srv = indicate.indicate_server_ref_default()
     self.indicate_srv.set_type("message.%s" % PROGRAM_NAME)
     self.indicate_srv.set_desktop_file(self.get_desktop_file())
     self.indicate_srv.connect("server-display",
                               self.specto.toggle_notifier)
     self.indicate_srv.show()
     self.indicate_db = {}
コード例 #15
0
 def __init__(self, path, check):
     self.accounts = []
     self.check = check
     # Indicator
     self.server = indicate.indicate_server_ref_default()
     self.server.set_type("message.mail")
     self.server.set_desktop_file(os.path.join(path, 'multi-gmail-notifier.desktop'))
     self.server.connect("server-display", self.clicked)
     self.server.show()
コード例 #16
0
def init_indicate():
    ## for Maverick registration
    try:
        SERVER_INDICATOR = indicate.indicate_server_ref_default()
        SERVER_INDICATOR.set_type('music.dmusic')
        SERVER_INDICATOR.set_desktop_file(
            '/usr/share/applications/deepin-music-player.desktop')
        SERVER_INDICATOR.show()
    except:
        pass
コード例 #17
0
def setup_indicate():
    """
    Sets up Messaging menu
    """
    global indicators
    server = indicate.indicate_server_ref_default()
    server.set_type("message.mail")
    server.set_desktop_file(local_path("notifo.desktop"))
    server.connect("server-display", on_server_click)
    server.show()
    indicators = {}
コード例 #18
0
 def set_active(self, active):
     if active:
         self.server = indicate.indicate_server_ref_default()
         self.server.set_type("message.im")
         self.server.connect("server-display", self.on_server_display_cb)
         self.server.set_desktop_file(config.add_apps_prefix("cloudsn.desktop"))
         self.server.show()
         logger.debug("Indicator server created")
     else:
         #TODO Disable the indicators
         logger.debug("deactivate Not implemented")
コード例 #19
0
  def __init__(self, subtype, desktop):
    self.indicators = {}
    self.actions = {}
    self.user_cb = None
    self.server_cb = None
    self.desktop = desktop

    self.srv = indicate.indicate_server_ref_default()
    type = "message.%s" % subtype
    self.srv.set_type(type)
    self.srv.set_desktop_file(desktop)
    self.srv.show()
コード例 #20
0
 def set_active(self, active):
     if active:
         self.server = indicate.indicate_server_ref_default()
         self.server.set_type("message.im")
         self.server.connect("server-display", self.on_server_display_cb)
         self.server.set_desktop_file(
             config.add_apps_prefix("cloudsn.desktop"))
         self.server.show()
         logger.debug("Indicator server created")
     else:
         #TODO Disable the indicators
         logger.debug("deactivate Not implemented")
コード例 #21
0
ファイル: ind.py プロジェクト: rygwdn/NNTP-Checker
    def __init__(self, desktop, actions_top=True):
        self.groups = {}
        self.actions = {}
        self.user_cb = None
        self.server_cb = None
        self.desktop = desktop
        self.actions_top = actions_top

        self.srv = indicate.indicate_server_ref_default()
        self.srv.set_type("message.news")
        self.srv.set_desktop_file(desktop)
        self.srv.connect('server-display', self.server_display)
        self.srv.show()
コード例 #22
0
    def __init__(self):
        self.services = {}
        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.mail")
        self.server.set_desktop_file(
            "/usr/share/applications/itunes-remote-applet.desktop")
        self.named_pipe_controller = named_pipe_controller(
            "/tmp/itunes-controller")
        self.named_pipe_controller.start()

        helper = gtk.Button()
        self.unpaired_service_ico = gtk.gdk.pixbuf_new_from_file(
            RESOURCES + "emblem-generic.png")
コード例 #23
0
 def __init__(self, skype):
     """ Initialize indicator server"""
     self.skype_handler = skype
     
     self.server = indicate.indicate_server_ref_default()
     self.server.set_type("message.im")
     # TODO: path to desktop file shouldn't be hardcoded
     self.server.set_desktop_file("/usr/share/applications/skype.desktop")
     self.server.connect("server-display", skype.focus)
     self.server.show()
     
     self._indicators = dict()
     self._messages = dict()
     self._lock = threading.Lock()
コード例 #24
0
	def __init__(self):
		print "init:"

		#get skype control
		self.skype= Skype4Py.Skype()
		self.loadSkype()

		#create notification icon
		self.server = indicate.indicate_server_ref_default()
		self.server.set_type("message.im")
		self.server.set_desktop_file("/usr/share/applications/skype.desktop")
		self.server.connect("server-display", self.server_display)
		self.server.show()

		self.create_indicators()
コード例 #25
0
ファイル: mpris.py プロジェクト: SimonLarsen/quodlibet
    def enabled(self):
        self.__sig = app.window.connect("delete-event", self.__window_delete)

        self.objects = []
        for service in [MPRIS1Root, MPRIS1DummyTracklist, MPRIS1Player, MPRIS2]:
            try:
                self.objects.append(service())
            except dbus.DBusException:
                pass

        # Needed for sound menu support in some older Ubuntu versions
        if indicate:
            self.__indicate_server = s = indicate.indicate_server_ref_default()
            s.set_type("music.quodlibet")
            s.set_desktop_file("/usr/share/applications/quodlibet.desktop")
            s.show()
コード例 #26
0
ファイル: run.py プロジェクト: kyheo/multi-gmail-notifier
    def __init__(self, user, passwd, uri, labels=['inbox'], timeout=5):
        self.user = user
        self.passwd = passwd
        self.uri = uri
        self.labels = [Label(self.user, self.passwd, l) for l in labels]
        self.timeout = timeout * 60

        self.desktop_file = '/tmp/gmc_%s' % (self.user,) 

        self._create_desktop_file()

        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.mail")
        self.server.set_desktop_file(self.desktop_file)
        self.server.connect("server-display", self.click)
        self.server.show()
コード例 #27
0
ファイル: indicator.py プロジェクト: MorrisJobke/MailNotify
	def __init__(self, confFile, pluginDir):
		self.desktopFile 	= os.path.join(
			sys.path[0],
			'data',
			'mailnotify.desktop'
		)
		self.confFile = confFile
		self.pluginDir = pluginDir
		self.server	= indicate.indicate_server_ref_default()
		self.server.set_type('message.mail')
		self.server.set_desktop_file(self.desktopFile)
		self.server.connect('server-display', self.click)
		self.server.show()
		
		self.to = 0
		
		self.start(True)
コード例 #28
0
    def enabled(self):
        self.__sig = app.window.connect('delete-event', self.__window_delete)

        self.objects = []
        for service in [MPRIS1Root, MPRIS1DummyTracklist,
                        MPRIS1Player, MPRIS2]:
            try:
                self.objects.append(service())
            except dbus.DBusException:
                pass

        # Needed for sound menu support in some older Ubuntu versions
        if indicate:
            self.__indicate_server = s = indicate.indicate_server_ref_default()
            s.set_type("music.quodlibet")
            s.set_desktop_file("/usr/share/applications/quodlibet.desktop")
            s.show()
コード例 #29
0
    def __init__(self, loop, autorefresh=True):
        self.bus = dbus.SessionBus()
        bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
        dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

        self.db = sqlite3.connect(SQLITE_DB_FILENAME)

        self.accounts = storage.AccountManager(self.db)
        self.searches = storage.SearchManager(self.db)
        self.streams = storage.StreamManager(self.db)
        self.messages = storage.MessageManager(self.db)
        self.collector = OperationCollector(self)

        if indicate and util.resources.get_desktop_file():
            self.indicate = indicate.indicate_server_ref_default()
            self.indicate.set_type("message.gwibber")
            self.indicate.set_desktop_file(util.resources.get_desktop_file())
            self.indicate.connect("server-display", self.on_indicator_activate)
            self.indicate.connect("interest-added",
                                  self.on_indicator_interest_added)
            self.indicate.connect("interest-removed",
                                  self.on_indicator_interest_removed)
            self.indicate.show()
        self.indicator_items = {}
        self.notified_items = []

        self.refresh_count = 0
        self.mainloop = loop
        self.workerpool = multiprocessing.Pool()

        self.refresh_timer_id = None

        if autorefresh:
            self.refresh()

        self.accounts_service = util.getbus("Accounts")
        self.accounts_service.connect_to_signal("Updated",
                                                self.on_account_updated)
        self.accounts_service.connect_to_signal("Deleted",
                                                self.on_account_deleted)
        self.accounts_service.connect_to_signal("Created",
                                                self.on_account_created)
コード例 #30
0
ファイル: MessagingMenu.py プロジェクト: estebanlex/emesene
    def __init__(self, handler, main_window=None):
        """constructor"""
        BaseTray.__init__(self)
        self.handler = handler
        self.main_window = main_window
        self.signals_have_been_connected = False
        # if system-wide desktop file is not present
        # fallback to a custom .desktop file to be placed in /mesinyer/
        self.desktop_file = os.path.join("/usr/share/applications/", "emesene.desktop")
        if not utils.file_readable(self.desktop_file):
            self.desktop_file = os.path.join(os.getcwd(), "data/share/applications/emesene.desktop")

        self.indicator_dict = {}
        self.r_indicator_dict = {}

        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.emesene")
        self.server.set_desktop_file(self.desktop_file)
        self.sid = self.server.connect("server-display", self._server_display)
        self.server.show()
コード例 #31
0
    def __init__(self, handler, main_window=None):
        '''constructor'''
        gui.BaseTray.__init__(self, handler)
        self.main_window = main_window
        self.signals_have_been_connected = False
        # if system-wide desktop file is not present
        # fallback to a custom .desktop file to be placed in /mesinyer/
        self.desktop_file = os.path.join("/usr/share/applications/",
                                         "emesene.desktop")
        if not utils.file_readable(self.desktop_file):
            self.desktop_file = os.path.join(
                os.getcwd(), "data/share/applications/emesene.desktop")

        self.indicator_dict = {}
        self.r_indicator_dict = {}

        self.server = indicate.indicate_server_ref_default()
        self.server.set_type("message.emesene")
        self.server.set_desktop_file(self.desktop_file)
        self.sid = self.server.connect("server-display", self._server_display)
        self.server.show()
コード例 #32
0
ファイル: indicator.py プロジェクト: Android9001/Turpial
 def __init__(self, disable=False):
     gobject.GObject.__init__(self)
     self.indicators = {}
     self.activate()
     self.disable = disable
     
     if not INDICATOR:
         log.debug('Module not available')
         self.disable = True
         return
     
     if disable:
         log.debug('Module disabled')
     
     desktop_file = os.path.join(os.getcwd(), "turpial.desktop")
     
     server = indicate.indicate_server_ref_default()
     server.set_type("message.micro")
     server.set_desktop_file(desktop_file)
     server.show()
     
     server.connect("server-display", self.__on_server_display)
コード例 #33
0
ファイル: Notifier.py プロジェクト: jimlawton/mail-indicator
    def __init__(self, conf, initial_check):
        self.conf = conf
        self._initial_check = initial_check
        self.server = indicate.indicate_server_ref_default()
        self.server.set_type('message.mail')
        desktop_file = get_desktop_file(self.DESKTOP_FILE_NAME)
        if not desktop_file:
            raise Exception('Could not find desktop file `{0}`'.format(self.DESKTOP_FILE_NAME))
        self.server.set_desktop_file(desktop_file)
        self.server.connect('server-display', self._clicked)
        self.server.show()
        self.first_check = True

        # Setup notifications
        pynotify.init('MailIndicator')
        self.notification = \
                pynotify.Notification('Unread mail', '', 'notification-message-email')
        self.error_notification = \
                pynotify.Notification('Unable to connect', '', 'notification-message-email')
        self.notification.connect('closed', self._clear_notification)

        self._setup_accounts()
コード例 #34
0
ファイル: dispatcher.py プロジェクト: SMIDEC/gwibber-lc
  def __init__(self, loop, autorefresh=True):
    self.bus = dbus.SessionBus()
    bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
    dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

    self.db = sqlite3.connect(SQLITE_DB_FILENAME)

    self.accounts = storage.AccountManager(self.db)
    self.searches = storage.SearchManager(self.db)
    self.streams = storage.StreamManager(self.db)
    self.messages = storage.MessageManager(self.db)
    self.collector = OperationCollector(self)

    if indicate and util.resources.get_desktop_file():
      self.indicate = indicate.indicate_server_ref_default()
      self.indicate.set_type("message.gwibber")
      self.indicate.set_desktop_file(util.resources.get_desktop_file())
      self.indicate.connect("server-display", self.on_indicator_activate)
      self.indicate.connect("interest-added", self.on_indicator_interest_added)
      self.indicate.connect("interest-removed", self.on_indicator_interest_removed)
      self.indicate.show()
    self.indicator_items = {}
    self.notified_items = []

    self.refresh_count = 0
    self.mainloop = loop
    self.workerpool = multiprocessing.Pool()

    self.refresh_timer_id = None

    if autorefresh:
      self.refresh()

    self.accounts_service = util.getbus("Accounts")
    self.accounts_service.connect_to_signal("Updated", self.on_account_updated)
    self.accounts_service.connect_to_signal("Deleted", self.on_account_deleted)
    self.accounts_service.connect_to_signal("Created", self.on_account_created)
コード例 #35
0
    (options, args) = parser.parse_args()
    
    Debug = DebugMe(options.debug)
    print("Spotify-notify v0.6")
    
    if SPOTIFY_PROCESS_NAME:
        SpotifyNotify.spotifyPath = SPOTIFY_PROCESS_NAME
    else:
        print "Spotify is not running"
        sys.exit(0) 
    
    SN = SpotifyNotify(Debug)
    
    if options.action:
        action = options.action
        action = action[0:1].upper() + action[1:]
        SN.executeCommand(action)
    
    SpotifyNotify.preventDuplicate(Debug)
    
    try:
        indicateserver = indicate.indicate_server_ref_default()
        indicateserver.set_type("music.spotify")
        indicateserver.set_desktop_file("/usr/share/applications/spotify.desktop")
        indicateserver.show()
    except:
        pass
    SN.pollChange()
    print "Done"
    
コード例 #36
0
    def __init__(self):

        self.dbus = gintegration.DBusManager(self)

        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_title(_("Gwibber"))
        self.set_default_size(330, 500)
        config.GCONF.add_dir(config.GCONF_PREFERENCES_DIR,
                             config.gconf.CLIENT_PRELOAD_NONE)
        self.preferences = config.Preferences()
        self.last_update = None
        self.last_focus_time = None
        self.last_clear = None
        self._reply_acct = None
        self.indicator_items = {}
        layout = gtk.VBox()

        gtk.rc_parse_string("""
    style "tab-close-button-style" {
      GtkWidget::focus-padding = 0
      GtkWidget::focus-line-width = 0
      xthickness = 0
      ythickness = 0
     }
     widget "*.tab-close-button" style "tab-close-button-style"
     """)

        self.accounts = configui.AccountManager()
        self.client = microblog.Client(self.accounts)
        self.client.handle_error = self.handle_error
        self.client.post_process_message = self.post_process_message

        self.notification_bubbles = {}
        self.message_target = None

        self.errors = table.generate(
            [["date", lambda t: t.time.strftime("%x")],
             ["time", lambda t: t.time.strftime("%X")], ["username"],
             ["protocol"],
             [
                 "message",
                 (gtk.CellRendererText(), {
                     "markup": lambda t: t.message
                 })
             ]])

        self.connect("delete-event", self.on_window_close)
        self.connect("focus-out-event", self.on_focus_out)
        self.connect("focus-in-event", self.on_focus)

        for key, value in list(DEFAULT_PREFERENCES.items()):
            if self.preferences[key] == None: self.preferences[key] = value

        self.preferences["version"] = VERSION_NUMBER

        self.timer = gobject.timeout_add(
            60000 * int(self.preferences["refresh_interval"]), self.update)
        self.preferences.notify("refresh_interval",
                                self.on_refresh_interval_changed)
        self.preferences.notify("theme", self.on_theme_change)

        gtk.icon_theme_add_builtin_icon(
            "gwibber", 22,
            gtk.gdk.pixbuf_new_from_file_at_size(
                resources.get_ui_asset("gwibber.svg"), 24, 24))

        self.set_icon_name("gwibber")
        self.tray_icon = gtk.status_icon_new_from_icon_name("gwibber")
        self.tray_icon.connect("activate", self.on_toggle_window_visibility)

        self.tabs = gtk.Notebook()
        self.tabs.set_property("homogeneous", False)
        self.tabs.set_scrollable(True)
        self.messages_view = self.add_msg_tab(self.client.receive,
                                              _("Messages"),
                                              show_icon="go-home")
        self.add_msg_tab(self.client.responses,
                         _("Replies"),
                         show_icon="mail-reply-all",
                         add_indicator=True)

        saved_position = config.GCONF.get_list(
            "%s/%s" % (config.GCONF_PREFERENCES_DIR, "saved_position"),
            config.gconf.VALUE_INT)
        if saved_position:
            self.move(*saved_position)

        saved_size = config.GCONF.get_list(
            "%s/%s" % (config.GCONF_PREFERENCES_DIR, "saved_size"),
            config.gconf.VALUE_INT)
        if saved_size:
            self.resize(*saved_size)

        saved_queries = config.GCONF.get_list(
            "%s/%s" % (config.GCONF_PREFERENCES_DIR, "saved_searches"),
            config.gconf.VALUE_STRING)

        if saved_queries:
            for query in saved_queries:
                # XXX: suggest refactor of below code to avoid duplication of on_search code
                if query.startswith("#"):
                    self.add_msg_tab(functools.partial(self.client.tag, query),
                                     query.replace("#", ""), True,
                                     gtk.STOCK_INFO, False, query)
                elif microblog.support.LINK_PARSE.match(query):
                    self.add_msg_tab(
                        functools.partial(self.client.search_url, query),
                        urlparse.urlparse(query)[1], True, gtk.STOCK_FIND,
                        True, query)
                elif len(query) > 0:
                    title = _("Search") + " '" + query[:12] + "...'"
                    self.add_msg_tab(
                        functools.partial(self.client.search, query), title,
                        True, gtk.STOCK_FIND, False, query)

        #self.add_map_tab(self.client.friend_positions, "Location")

        if gintegration.SPELLCHECK_ENABLED:
            self.input = gintegration.sexy.SpellEntry()
            self.input.set_checked(self.preferences["spellcheck_enabled"])
        else:
            self.input = gtk.Entry()
        self.input.connect("insert-text", self.on_add_text)
        self.input.connect("populate-popup", self.on_input_context_menu)
        self.input.connect("activate", self.on_input_activate)
        self.input.connect("changed", self.on_input_change)
        self.input.set_max_length(MAX_MESSAGE_LENGTH)

        self.cancel_button = gtk.Button(_("Cancel"))
        self.cancel_button.connect("clicked", self.on_cancel_reply)

        self.editor = gtk.HBox()
        self.editor.pack_start(self.input)
        self.editor.pack_start(self.cancel_button, False)

        vb = gtk.VBox(spacing=5)
        vb.pack_start(self.tabs, True, True)
        vb.pack_start(self.editor, False, False)
        vb.set_border_width(5)

        warning_icon = gtk.image_new_from_stock(gtk.STOCK_DIALOG_WARNING,
                                                gtk.ICON_SIZE_MENU)
        self.status_icon = gtk.EventBox()
        self.status_icon.add(warning_icon)
        self.status_icon.connect("button-press-event", self.on_errors_show)

        self.statusbar = gtk.Statusbar()
        self.statusbar.pack_start(self.status_icon, False, False)

        layout.pack_start(self.setup_menus(), False)
        layout.pack_start(vb, True, True)
        layout.pack_start(self.statusbar, False)
        self.add(layout)

        if gintegration.can_notify:
            # FIXME: Move this to DBusManager
            import dbus

            # http://galago-project.org/specs/notification/0.9/x408.html#signal-notification-closed
            def on_notify_close(nId, reason=1):
                if nId in self.notification_bubbles:
                    del self.notification_bubbles[nId]

            def on_notify_action(nId, action):
                if action == "reply":
                    self.reply(self.notification_bubbles[nId])
                    self.window.show()
                    self.present()

            bus = dbus.SessionBus()
            bus.add_signal_receiver(
                on_notify_close,
                dbus_interface="org.freedesktop.Notifications",
                signal_name="NotificationClosed")

            bus.add_signal_receiver(
                on_notify_action,
                dbus_interface="org.freedesktop.Notifications",
                signal_name="ActionInvoked")

        if indicate:
            self.indicate = indicate.indicate_server_ref_default()
            self.indicate.set_type("message.gwibber")
            self.indicate.set_desktop_file(resources.get_desktop_file())
            self.indicate.connect("server-display",
                                  self.on_toggle_window_visibility)
            self.indicate.show()

        for i in list(CONFIGURABLE_UI_ELEMENTS.keys()):
            config.GCONF.notify_add(
                config.GCONF_PREFERENCES_DIR + "/show_%s" % i,
                lambda *a: self.apply_ui_element_settings())

        config.GCONF.notify_add("/apps/gwibber/accounts",
                                self.on_account_change)

        self.preferences.notify("hide_taskbar_entry",
                                lambda *a: self.apply_ui_element_settings())

        self.preferences.notify("spellcheck_enabled",
                                lambda *a: self.apply_ui_element_settings())

        #for i in CONFIGURABLE_UI_SETTINGS:
        #  config.GCONF.notify_add(config.GCONF_PREFERENCES_DIR + "/%s" % i,
        #    lambda *a: self.apply_ui_drawing_settings())

        def on_key_press(w, e):
            if e.keyval == gtk.keysyms.F5:
                self.update()
                return True
            if e.keyval == gtk.keysyms.Tab and e.state & gtk.gdk.CONTROL_MASK:
                if len(self.tabs) == self.tabs.get_current_page() + 1:
                    self.tabs.set_current_page(0)
                else:
                    self.tabs.next_page()
                return True
            elif e.keyval in [ord(str(x)) for x in range(10)
                              ] and e.state & gtk.gdk.MOD1_MASK:
                self.tabs.set_current_page(
                    int(gtk.gdk.keyval_name(e.keyval)) - 1)
                return True
            elif e.keyval == gtk.keysyms.T and e.state & gtk.gdk.CONTROL_MASK:
                self.on_theme_change()
                return True
            else:
                return False

            #else:
            #  if not self.input.is_focus():
            #    self.input.grab_focus()
            #    self.input.set_position(-1)
            #  return False

        self.connect("key_press_event", on_key_press)

        self.show_all()
        self.apply_ui_element_settings()
        self.cancel_button.hide()
        self.status_icon.hide()

        if not self.preferences["inhibit_startup_refresh"]:
            self.update()
コード例 #37
0
ファイル: dispatcher.py プロジェクト: SMIDEC/gwibber-lc
  def __init__(self, loop, autorefresh=True):
    self.bus = dbus.SessionBus()
    bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
    dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

    self.db = sqlite3.connect(SQLITE_DB_FILENAME)

    self.accounts = storage.AccountManager(self.db)
    self.searches = storage.SearchManager(self.db)
    self.streams = storage.StreamManager(self.db)
    self.messages = storage.MessageManager(self.db)
    self.collector = OperationCollector(self)
 
    # Monitor the connection
    self.connection_monitor = util.getbus("Connection")
    self.connection_monitor.connect_to_signal("ConnectionOnline", self.on_connection_online)
    self.connection_monitor.connect_to_signal("ConnectionOffline", self.on_connection_offline)

    self.indicate = None 

    if indicate and util.resources.get_desktop_file():
      self.indicate = indicate.indicate_server_ref_default()
      self.indicate.set_type("message.gwibber")
      self.indicate.set_desktop_file(util.resources.get_desktop_file())
      self.indicate.connect("server-display", self.on_indicator_server_activate)
      self.indicate.connect("interest-added", self.on_indicator_interest_added)
      self.indicate.connect("interest-removed", self.on_indicator_interest_removed)
      self.indicate.show()
    self.indicator_items = {}
    self.notified_items = []
    self.notified_errors = {}
    self.messages_indicator = None
    self.replies_indicator = None
    self.private_indicator = None
    self.unseen_counts = {}
    for s in "messages", "replies", "private":
      self.unseen_counts[s] = 0

    if Unity and Dbusmenu:
      launcher = Unity.LauncherEntry.get_for_desktop_id ("gwibber.desktop")
      ql = Dbusmenu.Menuitem.new ()
      refresh_menu = Dbusmenu.Menuitem.new ()
      refresh_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Refresh"))
      refresh_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      refresh_menu.connect("item-activated", self.refresh)
      ql.child_append (refresh_menu)
      accounts_menu = Dbusmenu.Menuitem.new ()
      accounts_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Accounts"))
      accounts_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      accounts_menu.connect("item-activated", self.show_accounts)
      ql.child_append (accounts_menu)
      preferences_menu = Dbusmenu.Menuitem.new ()
      preferences_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Preferences"))
      preferences_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      preferences_menu.connect("item-activated", self.show_preferences)
      ql.child_append (preferences_menu)
      quit_menu = Dbusmenu.Menuitem.new ()
      quit_menu.property_set (Dbusmenu.MENUITEM_PROP_LABEL, _("Quit"))
      quit_menu.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
      quit_menu.connect("item-activated", self.shutdown)
      ql.child_append (quit_menu)
      launcher.set_property("quicklist", ql)

    self.refresh_count = 0
    self.mainloop = loop
    self.workerpool = multiprocessing.Pool()

    self.refresh_timer_id = None

    self.maintDone = False
    self.maintRunning = False
    self.refreshRunning = False

    if autorefresh:
      if self.refresh_timer_id:
        gobject.source_remove(self.refresh_timer_id)
      # wait a few seconds before alerting the world we are online
      self.refresh_timer_id = gobject.timeout_add_seconds(int(10), self.refresh)

    self.accounts_service = util.getbus("Accounts")
    self.accounts_service.connect_to_signal("Updated", self.on_account_updated)
    self.accounts_service.connect_to_signal("Deleted", self.on_account_deleted)
    self.accounts_service.connect_to_signal("Created", self.on_account_created)
コード例 #38
0
ファイル: spotify-notify.py プロジェクト: jkrueger/configs
    DBusGMainLoop(set_as_default=True)
    SN = SpotifyNotify(Debug)

    if options.action:
        action = options.action
        action = action[0:1].upper() + action[1:]
        SN.executeCommand(action)
        exit(0)

    SpotifyNotify.preventDuplicate(Debug)

    if not options.skipMediaKeys:
        MH = MediaKeyHandler(SN, Debug)

    try:
        indicateserver = indicate.indicate_server_ref_default()
        indicateserver.set_type("music.spotify")
        indicateserver.set_desktop_file(
            "/usr/share/applications/spotify.desktop")
        indicateserver.show()
    except:
        pass

    loop = gobject.MainLoop()

    if not options.skipSpotify:
        gobject.timeout_add(SPOTIFY_CLOSED_CHECK, SN.checkForClosedSpotify, SN,
                            Debug)
    if not options.skipNotify:
        gobject.timeout_add(500, SN.pollChange)
コード例 #39
0
ファイル: notclient.py プロジェクト: theterg/notserver
def configureIndicate():
    server = indicate.indicate_server_ref_default()
    server.set_type("message.mail")
    server.set_desktop_file("/usr/share/applications/notclient.desktop")
    server.connect("server-display", serverClick)
コード例 #40
0
ファイル: dispatcher.py プロジェクト: SMIDEC/gwibber-lc
    def __init__(self, loop, autorefresh=True):
        self.bus = dbus.SessionBus()
        bus_name = dbus.service.BusName("com.Gwibber.Service", bus=self.bus)
        dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)

        self.db = sqlite3.connect(SQLITE_DB_FILENAME)

        self.accounts = storage.AccountManager(self.db)
        self.searches = storage.SearchManager(self.db)
        self.streams = storage.StreamManager(self.db)
        self.messages = storage.MessageManager(self.db)
        self.collector = OperationCollector(self)

        # Monitor the connection
        self.connection_monitor = util.getbus("Connection")
        self.connection_monitor.connect_to_signal("ConnectionOnline",
                                                  self.on_connection_online)
        self.connection_monitor.connect_to_signal("ConnectionOffline",
                                                  self.on_connection_offline)

        self.indicate = None

        if indicate and util.resources.get_desktop_file():
            self.indicate = indicate.indicate_server_ref_default()
            self.indicate.set_type("message.gwibber")
            self.indicate.set_desktop_file(util.resources.get_desktop_file())
            self.indicate.connect("server-display",
                                  self.on_indicator_server_activate)
            self.indicate.connect("interest-added",
                                  self.on_indicator_interest_added)
            self.indicate.connect("interest-removed",
                                  self.on_indicator_interest_removed)
            self.indicate.show()
        self.indicator_items = {}
        self.notified_items = []
        self.notified_errors = {}
        self.messages_indicator = None
        self.replies_indicator = None
        self.private_indicator = None
        self.unseen_counts = {}
        for s in "messages", "replies", "private":
            self.unseen_counts[s] = 0

        if Unity and Dbusmenu:
            launcher = Unity.LauncherEntry.get_for_desktop_id(
                "gwibber.desktop")
            ql = Dbusmenu.Menuitem.new()
            refresh_menu = Dbusmenu.Menuitem.new()
            refresh_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
                                      _("Refresh"))
            refresh_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE,
                                           True)
            refresh_menu.connect("item-activated", self.refresh)
            ql.child_append(refresh_menu)
            accounts_menu = Dbusmenu.Menuitem.new()
            accounts_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
                                       _("Accounts"))
            accounts_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE,
                                            True)
            accounts_menu.connect("item-activated", self.show_accounts)
            ql.child_append(accounts_menu)
            preferences_menu = Dbusmenu.Menuitem.new()
            preferences_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL,
                                          _("Preferences"))
            preferences_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE,
                                               True)
            preferences_menu.connect("item-activated", self.show_preferences)
            ql.child_append(preferences_menu)
            quit_menu = Dbusmenu.Menuitem.new()
            quit_menu.property_set(Dbusmenu.MENUITEM_PROP_LABEL, _("Quit"))
            quit_menu.property_set_bool(Dbusmenu.MENUITEM_PROP_VISIBLE, True)
            quit_menu.connect("item-activated", self.shutdown)
            ql.child_append(quit_menu)
            launcher.set_property("quicklist", ql)

        self.refresh_count = 0
        self.mainloop = loop
        self.workerpool = multiprocessing.Pool()

        self.refresh_timer_id = None

        self.maintDone = False
        self.maintRunning = False
        self.refreshRunning = False

        if autorefresh:
            if self.refresh_timer_id:
                gobject.source_remove(self.refresh_timer_id)
            # wait a few seconds before alerting the world we are online
            self.refresh_timer_id = gobject.timeout_add_seconds(
                int(10), self.refresh)

        self.accounts_service = util.getbus("Accounts")
        self.accounts_service.connect_to_signal("Updated",
                                                self.on_account_updated)
        self.accounts_service.connect_to_signal("Deleted",
                                                self.on_account_deleted)
        self.accounts_service.connect_to_signal("Created",
                                                self.on_account_created)
コード例 #41
0
 def __init__(self, desktop_file):
   server = indicate.indicate_server_ref_default()
   server.set_type("message.micro")
   server.set_desktop_file(desktop_file)
   server.connect("server-display", self.clicked)
   server.show()
コード例 #42
0
 def __init__(self, desktop_file):
     server = indicate.indicate_server_ref_default()
     server.set_type("message.micro")
     server.set_desktop_file(desktop_file)
     server.connect("server-display", self.clicked)
     server.show()