Beispiel #1
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()
Beispiel #2
0
    def set_image(self, path):
        '''set the image from path'''
        if utils.file_readable(path):
            self.image.set_from_file(path)
            self.image.show()
            return True

        return False
Beispiel #3
0
    def set_image(self, path):
        '''set the image from path'''
        if utils.file_readable(path):
            self.image.set_from_file(path)
            self.image.show()
            return True

        return False
    def __init__(self, session):
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_default_size(500, 300)
        self.set_title(_('Plugins'))
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.session = session

        if utils.file_readable(gui.theme.logo):
            self.set_icon(
                utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())

        self.main_vbox = PluginMainVBox(session)

        self.add(self.main_vbox)
        self.show_all()
Beispiel #5
0
    def __init__(self, session):
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_default_size(500, 300)
        self.set_title('Plugins')
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.session = session

        if utils.file_readable(gui.theme.logo):
            self.set_icon(
                utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())

        self.main_vbox = PluginMainVBox(session)

        self.add(self.main_vbox)
        self.show_all()
Beispiel #6
0
    def __init__(self, session):
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        self.set_default_size(500, 300)
        self.set_title('Plugins')
        self.set_position(gtk.WIN_POS_CENTER_ALWAYS)

        self.session = session

        if utils.file_readable(gui.theme.logo):
            self.set_icon(
                utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())

        main_vbox = gtk.VBox()
        main_vbox.set_border_width(2)

        self.plugin_list_store = PluginListStore()
        self.plugin_list_store.update_list()
        self.plugin_list_view = PluginListView(self.plugin_list_store)

        scroll = gtk.ScrolledWindow()
        scroll.add(self.plugin_list_view)
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.set_border_width(1)

        button_hbox = gtk.HButtonBox()
        button_hbox.set_layout(gtk.BUTTONBOX_END)
        button_hbox.set_border_width(2)

        button_start = gtk.Button(stock=gtk.STOCK_EXECUTE)
        button_start.connect('clicked', self.on_start)

        button_stop = gtk.Button(stock=gtk.STOCK_STOP)
        button_stop.connect('clicked', self.on_stop)

        button_config = gtk.Button(stock=gtk.STOCK_PREFERENCES)
        button_config.connect('clicked', self.on_config)

        main_vbox.pack_start(scroll)
        button_hbox.pack_start(button_config, fill=False)
        button_hbox.pack_start(button_start, fill=False)
        button_hbox.pack_start(button_stop, fill=False)
        main_vbox.pack_start(button_hbox, False)

        self.add(main_vbox)
        self.show_all()
Beispiel #7
0
    def __init__(self, session):
        """constructor
        """
        gtk.Window.__init__(self)
        self.set_title("Preferences")
        self.session = session

        self.set_default_size(320, 260)
        self.set_role("preferences")
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        if utils.file_readable(gui.theme.logo):
            self.set_icon(
                utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())

        self.box = gtk.VBox()
        self.box.set_border_width(4)
        self.tabs = gtk.Notebook()

        self.interface = Interface(session)
        self.sound = Sound(session)
        self.notification = Notification(session)
        self.theme = Theme(session)
        self.extension = Extension(session)

        self.buttons = gtk.HButtonBox()
        self.buttons.set_border_width(2)
        self.buttons.set_layout(gtk.BUTTONBOX_END)
        self.close = gtk.Button(stock=gtk.STOCK_CLOSE)
        self.close.connect('clicked', lambda *args: self.hide())
        self.buttons.pack_start(self.close)

        self.tabs.append_page(self.interface, gtk.Label('Interface'))
        self.tabs.append_page(self.sound, gtk.Label('Sounds'))
        self.tabs.append_page(self.notification, gtk.Label('Notifications'))
        self.tabs.append_page(self.theme, gtk.Label('Themes'))
        self.tabs.append_page(self.extension, gtk.Label('Extensions'))

        self.box.pack_start(self.tabs, True, True)
        self.box.pack_start(self.buttons, False)

        self.add(self.box)
        self.box.show_all()
Beispiel #8
0
    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()
Beispiel #9
0
    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()
Beispiel #10
0
 def set_icon(self, icon):
     '''set the icon of the window'''
     if utils.file_readable(icon):
         gtk.Window.set_icon(self,
                             utils.safe_gtk_image_load(icon).get_pixbuf())
Beispiel #11
0
 def set_icon(self, icon):
     '''set the icon of the window'''
     if utils.file_readable(icon):
         gtk.Window.set_icon(self,
                             utils.safe_gtk_image_load(icon).get_pixbuf())
Beispiel #12
0
    def __init__(self, session):
        """constructor
        """
        gtk.Window.__init__(self)
        self.set_border_width(2)
        self.set_title("Preferences")
        self.session = session

        self.set_default_size(600, 400)
        self.set_role("New preferences Window")
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        if utils.file_readable(gui.theme.logo):
            self.set_icon(
                utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())

        ''' TREE VIEW STUFF '''
        # Create the list store model for the treeview.
        listStore = gtk.ListStore(gtk.gdk.Pixbuf, str)

        for i in LIST:
            # we should use always the same icon size,
            # we can remove that field in LIST
            listStore.append([self.render_icon(i['stock_id'],
                             gtk.ICON_SIZE_LARGE_TOOLBAR), i['text']])

        # Create the TreeView
        treeView = gtk.TreeView(listStore)

        # Create the renders
        cellText = gtk.CellRendererText()
        cellPix = gtk.CellRendererPixbuf()

        # Create the single Tree Column
        treeViewColumn = gtk.TreeViewColumn('Categories')

        treeViewColumn.pack_start(cellPix, expand=False)
        treeViewColumn.add_attribute(cellPix, 'pixbuf',0)
        treeViewColumn.pack_start(cellText, expand=True)
        treeViewColumn.set_attributes(cellText, text=1)

        treeView.append_column(treeViewColumn)
        treeView.set_headers_visible(False)
        treeView.connect('cursor-changed', self._on_row_activated)
        self.treeview = treeView

        self.notebook = gtk.Notebook()
        self.notebook.set_show_tabs(False)
        self.notebook.set_resize_mode(gtk.RESIZE_QUEUE)
        self.notebook.set_scrollable(True)

        ''' PACK TREEVIEW, FRAME AND HBOX '''
        vbox = gtk.VBox()

        vbox.set_spacing(4)
        hbox = gtk.HBox(homogeneous=False, spacing=5)
        hbox.pack_start(treeView, True,True) # False, True
        hbox.pack_start(self.notebook, True, True)
        vbox.pack_start(hbox, True,True) # hbox, True, True

        self.interface = Interface(session)
        self.sound = Sound(session)
        self.notification = Notification(session)
        self.theme = Theme(session)
        self.extension = Extension(session)
        self.plugins = PluginWindow.PluginMainVBox(session)

        self.buttons = gtk.HButtonBox()
        self.buttons.set_border_width(2)
        self.buttons.set_layout(gtk.BUTTONBOX_END)
        self.close = gtk.Button(stock=gtk.STOCK_CLOSE)
        self.close.connect('clicked', lambda *args: self.hide())
        self.buttons.pack_start(self.close)

        # Create a dict that stores each page
        self.page_dict = []

        # Keep local copies of the objects
        self.interface_page = self.interface
        self.sound_page = self.sound
        self.notifications_page = self.notification
        self.theme_page = self.theme
        self.extensions_page = self.extension
        self.plugins_page = self.plugins

        # Whack the pages into a dict for future reference

        self.page_dict.append(self.interface_page)
        self.page_dict.append(self.sound_page)
        self.page_dict.append(self.notifications_page)
        self.page_dict.append(self.theme_page)
        self.page_dict.append(self.extensions_page)
        self.page_dict.append(self.plugins_page)

        for i in range(len(self.page_dict)):
           self.notebook.append_page(self.page_dict[i])

        self.add(vbox)
        vbox.show_all()
Beispiel #13
0
    def __init__(self, session):
        """constructor
        """
        gtk.Window.__init__(self)
        self.set_border_width(2)
        self.set_title("Preferences")
        self.session = session

        self.set_default_size(600, 400)
        self.set_role("New preferences Window")
        self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)

        if utils.file_readable(gui.theme.logo):
            self.set_icon(
                utils.safe_gtk_image_load(gui.theme.logo).get_pixbuf())
        ''' TREE VIEW STUFF '''
        # Create the list store model for the treeview.
        listStore = gtk.ListStore(gtk.gdk.Pixbuf, str)

        for i in LIST:
            # we should use always the same icon size,
            # we can remove that field in LIST
            listStore.append([
                self.render_icon(i['stock_id'], gtk.ICON_SIZE_LARGE_TOOLBAR),
                i['text']
            ])

        # Create the TreeView
        treeView = gtk.TreeView(listStore)

        # Create the renders
        cellText = gtk.CellRendererText()
        cellPix = gtk.CellRendererPixbuf()

        # Create the single Tree Column
        treeViewColumn = gtk.TreeViewColumn('Categories')

        treeViewColumn.pack_start(cellPix, expand=False)
        treeViewColumn.add_attribute(cellPix, 'pixbuf', 0)
        treeViewColumn.pack_start(cellText, expand=True)
        treeViewColumn.set_attributes(cellText, text=1)

        treeView.append_column(treeViewColumn)
        treeView.set_headers_visible(False)
        treeView.connect('cursor-changed', self._on_row_activated)
        self.treeview = treeView

        self.notebook = gtk.Notebook()
        self.notebook.set_show_tabs(False)
        self.notebook.set_resize_mode(gtk.RESIZE_QUEUE)
        self.notebook.set_scrollable(True)
        ''' PACK TREEVIEW, FRAME AND HBOX '''
        vbox = gtk.VBox()

        vbox.set_spacing(4)
        hbox = gtk.HBox(homogeneous=False, spacing=5)
        hbox.pack_start(treeView, True, True)  # False, True
        hbox.pack_start(self.notebook, True, True)
        vbox.pack_start(hbox, True, True)  # hbox, True, True

        self.interface = Interface(session)
        self.sound = Sound(session)
        self.notification = Notification(session)
        self.theme = Theme(session)
        self.extension = Extension(session)
        self.plugins = PluginWindow.PluginMainVBox(session)

        self.buttons = gtk.HButtonBox()
        self.buttons.set_border_width(2)
        self.buttons.set_layout(gtk.BUTTONBOX_END)
        self.close = gtk.Button(stock=gtk.STOCK_CLOSE)
        self.close.connect('clicked', lambda *args: self.hide())
        self.buttons.pack_start(self.close)

        # Create a dict that stores each page
        self.page_dict = []

        # Keep local copies of the objects
        self.interface_page = self.interface
        self.sound_page = self.sound
        self.notifications_page = self.notification
        self.theme_page = self.theme
        self.extensions_page = self.extension
        self.plugins_page = self.plugins

        # Whack the pages into a dict for future reference

        self.page_dict.append(self.interface_page)
        self.page_dict.append(self.sound_page)
        self.page_dict.append(self.notifications_page)
        self.page_dict.append(self.theme_page)
        self.page_dict.append(self.extensions_page)
        self.page_dict.append(self.plugins_page)

        for i in range(len(self.page_dict)):
            self.notebook.append_page(self.page_dict[i])

        self.add(vbox)
        vbox.show_all()
Beispiel #14
0
    def edit_profile(cls, handler, user_nick, user_message, last_avatar):

        windows = gtk.Window()
        windows.set_border_width(5)
        windows.set_title('Change profile')
        windows.set_position(gtk.WIN_POS_CENTER)
        windows.set_resizable(False)

        hbox = gtk.HBox(spacing=5)
        vbox = gtk.VBox()

        frame = gtk.Frame('Picture')

        avatar = gtk.Image()
        avatar.set_size_request(96, 96)
        frame.add(avatar)

        if utils.file_readable(last_avatar):
            pixbuf = gtk.gdk.pixbuf_new_from_file(last_avatar)
        else:
            pixbuf = gtk.gdk.pixbuf_new_from_file(gui.theme.logo)

        avatar.set_from_pixbuf(pixbuf)
        avatarEventBox = gtk.EventBox()
        avatarEventBox.add(frame)

        hbox.pack_start(avatarEventBox)
        hbox.pack_start(vbox)

        nick_label = gtk.Label('Nick:')
        nick_label.set_alignment(0.0,0.5)

        nick = gtk.Entry()
        nick.set_text(user_nick)

        pm_label = gtk.Label('PM:')
        pm_label.set_alignment(0.0,0.5)

        pm = gtk.Entry()
        pm.set_text(user_message)

        savebutt = gtk.Button(stock=gtk.STOCK_SAVE)

        def save_profile(widget, data=None):
            '''save the new profile'''
            new_nick = nick.get_text()
            new_pm = pm.get_text()
            handler.save_profile(new_nick, new_pm)
            windows.hide()

        savebutt.connect('clicked', save_profile)
        avatarEventBox.connect("button-press-event", handler.on_set_picture_selected)

        vbox0 = gtk.VBox()

        vbox0.pack_start(nick_label)
        vbox0.pack_start(nick)
        vbox0.pack_start(pm_label)
        vbox0.pack_start(pm)

        vbox.pack_start(vbox0)
        vbox.pack_start(savebutt)

        windows.add(hbox)
        windows.show_all()
Beispiel #15
0
    def edit_profile(cls, handler, user_nick, user_message, last_avatar):

        windows = gtk.Window()
        windows.set_border_width(5)
        windows.set_title('Change profile')
        windows.set_position(gtk.WIN_POS_CENTER)
        windows.set_resizable(False)

        hbox = gtk.HBox(spacing=5)
        vbox = gtk.VBox()

        frame = gtk.Frame('Picture')

        avatar = gtk.Image()
        avatar.set_size_request(96, 96)
        frame.add(avatar)

        if utils.file_readable(last_avatar):
            pixbuf = gtk.gdk.pixbuf_new_from_file(last_avatar)
        else:
            pixbuf = gtk.gdk.pixbuf_new_from_file(gui.theme.logo)

        avatar.set_from_pixbuf(pixbuf)
        avatarEventBox = gtk.EventBox()
        avatarEventBox.add(frame)

        hbox.pack_start(avatarEventBox)
        hbox.pack_start(vbox)

        nick_label = gtk.Label('Nick:')
        nick_label.set_alignment(0.0, 0.5)

        nick = gtk.Entry()
        nick.set_text(user_nick)

        pm_label = gtk.Label('PM:')
        pm_label.set_alignment(0.0, 0.5)

        pm = gtk.Entry()
        pm.set_text(user_message)

        savebutt = gtk.Button(stock=gtk.STOCK_SAVE)

        def save_profile(widget, data=None):
            '''save the new profile'''
            new_nick = nick.get_text()
            new_pm = pm.get_text()
            handler.save_profile(new_nick, new_pm)
            windows.hide()

        savebutt.connect('clicked', save_profile)
        avatarEventBox.connect("button-press-event",
                               handler.on_set_picture_selected)

        vbox0 = gtk.VBox()

        vbox0.pack_start(nick_label)
        vbox0.pack_start(nick)
        vbox0.pack_start(pm_label)
        vbox0.pack_start(pm)

        vbox.pack_start(vbox0)
        vbox.pack_start(savebutt)

        windows.add(hbox)
        windows.show_all()