Example #1
0
File: hotot.py Project: fma16/Hotot
def main():
    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hotot', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)
        
    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                            'hotot',
                                            appindicator.CATEGORY_COMMUNICATIONS)
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon(utils.get_ui_object('image/ic24_hotot_mono_light.svg'))
        indicator.set_attention_icon(utils.get_ui_object('image/ic24_hotot_mono_dark.svg'))
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator

    from dbus.mainloop.glib import DBusGMainLoop
    DBusGMainLoop(set_as_default=True)
    HDService = HototDbusService(app)

    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
Example #2
0
File: hotot.py Project: sarim/Hotot
 def create_trayicon(self):
     """
     Create status icon and connect signals
     """
     self.trayicon = Gtk.StatusIcon()
     self.trayicon.connect('activate', self.on_trayicon_activate)
     self.trayicon.connect('popup-menu', self.on_trayicon_popup_menu)
     self.trayicon.set_tooltip_text(_("Hotot: Click to Active."))
     self.trayicon_pixbuf[0] = GdkPixbuf.Pixbuf.new_from_file(
         utils.get_ui_object('image/ic24_hotot_mono_light.svg'))
     self.trayicon_pixbuf[1] = GdkPixbuf.Pixbuf.new_from_file(
         utils.get_ui_object('image/ic24_hotot_mono_light_blink.svg'))
     self.trayicon.set_from_pixbuf(self.trayicon_pixbuf[0])
     self.trayicon.set_visible(True)
Example #3
0
 def create_trayicon(self):
     """
     Create status icon and connect signals
     """
     self.trayicon = Gtk.StatusIcon()
     self.trayicon.connect('activate', self.on_trayicon_activate)
     self.trayicon.connect('popup-menu', self.on_trayicon_popup_menu)
     self.trayicon.set_tooltip_text(_("Hermelin: Click to Active."))
     self.trayicon_pixbuf[0] = GdkPixbuf.Pixbuf.new_from_file(
         utils.get_ui_object('image/ic24_hermelin_mono_light.svg'))
     self.trayicon_pixbuf[1] = GdkPixbuf.Pixbuf.new_from_file(
         utils.get_ui_object('image/ic24_hermelin_mono_light_blink.svg'))
     self.trayicon.set_from_pixbuf(self.trayicon_pixbuf[0])
     self.trayicon.set_visible(True)
Example #4
0
 def do_notify(self, summary, body, icon_file = None):
     if (icon_file == None or not os.path.isfile(icon_file)):
         icon_file = utils.get_ui_object(os.path.join('image','ic64_hotot.png'));
     icon_file = 'file://' + icon_file
     title = _("Hotot Notification")
     text = summary + '\n' + body
     gobject.idle_add(gtknotification.gtknotification, title, text, icon_file)
Example #5
0
File: agent.py Project: fma16/Hotot
 def do_notify(self, summary, body, icon_file = None):
     if (icon_file == None or not os.path.isfile(icon_file)):
         icon_file = utils.get_ui_object(os.path.join('image','ic64_hotot.png'));
     icon_file = 'file://' + icon_file
     title = _("Hotot Notification")
     text = summary + '\n' + body
     gobject.idle_add(gtknotification.gtknotification, title, text, icon_file)
Example #6
0
 def do_notify(self, summary, body, icon_file=None):
     if icon_file == None or not os.path.isfile(icon_file):
         icon_file = utils.get_ui_object(os.path.join("image", "ic64_hotot.png"))
     icon_file = "file://" + icon_file
     title = _("Hotot Notification")
     text = summary + "\n" + body
     gobject.idle_add(gtknotification.gtknotification, title, text, icon_file)
Example #7
0
File: agent.py Project: fma16/Hotot
def init_notify():
    if USE_GTKNOTIFICATION_IN_NATIVE_PLATFORM:
        return
    notify.set_icon_from_pixbuf(
        gtk.gdk.pixbuf_new_from_file(
            utils.get_ui_object(os.path.join('image','ic64_hotot.png'))))
    notify.set_timeout(5000)
Example #8
0
File: hotot.py Project: 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()
Example #9
0
def main():
    DBusGMainLoop(set_as_default=True)

    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hermelin', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hermelin', 0, 0, 0)

    agent.init_notify()
    app = Hermelin()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hermelin',
                                            'hermelin',
                                            appindicator.CATEGORY_COMMUNICATIONS,
                                            utils.get_ui_object('image'))
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon('ic24_hermelin_mono_light')
        indicator.set_attention_icon('ic24_hermelin_mono_light_blink')
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator


    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
Example #10
0
def main():
    DBusGMainLoop(set_as_default=True)

    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hotot', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)

    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                            'hotot',
                                            appindicator.CATEGORY_COMMUNICATIONS,
                                            utils.get_ui_object('image'))
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon('ic24_hotot_mono_light')
        indicator.set_attention_icon('ic24_hotot_mono_light_blink')
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator


    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
Example #11
0
File: hotot.py Project: sarim/Hotot
    def __init__(self):
        self.is_sign_in = False
        self.active_profile = 'default'
        self.protocol = ''
        self.build_gui()
        self.trayicon_pixbuf = [None, None]
        self.state = {
            'unread_count': 0
        }

        self.inblinking = False

        import dbusservice
        self.dbus_service = dbusservice.DbusService(self)

        if os.environ.get('DESKTOP_SESSION') in ('gnome-2d', 'classic-gnome'):
            self.has_indicator = False
        else:
            try:
                from gi.repository import AppIndicator3 as AppIndicator
            except ImportError:
                self.has_indicator = False
            else:
                self.has_indicator = True

        if self.has_indicator:
            self.indicator = AppIndicator.Indicator.new('hotot', 'hotot', AppIndicator.IndicatorCategory.COMMUNICATIONS)
            self.indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE)
            self.indicator.set_icon_theme_path(utils.get_ui_object('image/'))
            self.indicator.set_icon_full('ic24_hotot_mono_light', 'hotot')
            self.indicator.set_attention_icon_full('ic24_hotot_mono_light_blink', 'hotot')
            self.indicator.set_menu(self.traymenu)
            self.indicatorStatus = AppIndicator.IndicatorStatus
        else:
            self.create_trayicon()
Example #12
0
def init_notify():
    if USE_GTKNOTIFICATION_IN_NATIVE_PLATFORM:
        return
    notify.set_icon_from_pixbuf(
        gtk.gdk.pixbuf_new_from_file(
            utils.get_ui_object(os.path.join('image', 'ic64_hermelin.png'))))
    notify.set_timeout(5000)
Example #13
0
 def show(self, summary, body, icon_file=None):
     if (icon_file == None or not os.path.isfile(icon_file)):
         icon_file = utils.get_ui_object(
             os.path.join('image', 'ic64_hotot.png'))
     n = self.notification.new(self.escape(summary), self.escape(body),
                               icon_file)
     n.set_timeout(5000)
     n.show()
Example #14
0
    def __init__(self, parentWidget):
        WebKit.WebView.__init__(self)
        self.load_finish_flag = False
        self.set_property('can-focus', True)
        self.set_property('can-default', True)
        self.set_full_content_zoom(1)
        self.parentWidget = parentWidget

        settings = self.get_settings()
        try:
            settings.set_property('enable-universal-access-from-file-uris',
                                  True)
            settings.set_property('javascript-can-access-clipboard', True)
            settings.set_property('enable-default-context-menu', True)
            settings.set_property('enable-page-cache', True)
            settings.set_property('tab-key-cycles-through-elements', True)
            settings.set_property('enable-file-access-from-file-uris', True)
            settings.set_property('enable-spell-checking', False)
            settings.set_property('enable-caret-browsing', False)
            settings.set_property('enable-developer-extras',
                                  config.ENABLE_INSPECTOR)
            try:
                # Since 1.7.5
                settings.set_property('enable-accelerated-compositing', True)
            except TypeError:
                pass
        except:
            print 'Error: settings property was not set.'

        WebKit.set_web_database_directory_path(config.get_path("db"))
        WebKit.set_default_web_database_quota(1024**3L)

        ## bind events
        self.connect('navigation-requested', self.on_navigation_requested)
        self.connect('new-window-policy-decision-requested',
                     self.on_new_window_requested)
        self.connect('script-alert', self.on_script_alert)
        self.connect('load-finished', self.on_load_finish)
        self.connect("hovering-over-link", self.on_over_link)
        #       self.connect('drag_data_received', self.on_drag_data_received)
        #       self.connect('drag_motion', self.on_drag_motion)
        #       self.connect('drag_drop', self.on_drag_drop)
        #       # @TODO DND for gir
        #       TARGET_TYPE_URI_LIST = 80
        #       dnd_list = [ ( 'text/uri-list', 0, TARGET_TYPE_URI_LIST ) ]
        #       te = Gtk.TargetEntry.new(
        #           'text/uri-list', 0, TARGET_TYPE_URI_LIST)
        #       self.drag_dest_set( Gtk.DestDefaults.ALL,
        #                 [te], Gdk.DragAction.COPY)

        if config.ENABLE_INSPECTOR:
            from inspector import HermelinInspector
            HermelinInspector(self.get_inspector())

        templatefile = utils.get_ui_object(config.TEMPLATE)
        template = open(templatefile, 'rb').read()
        self.load_string(template, 'text/html', 'UTF-8',
                         'file://' + templatefile)
Example #15
0
File: agent.py Project: fma16/Hotot
def do_notify(summary, body, icon_file = None):
    if USE_GTKNOTIFICATION_IN_NATIVE_PLATFORM:
        return notify.do_notify(summary, body, icon_file)
    n = pynotify.Notification(summary, body)
    if (icon_file == None or not os.path.isfile(icon_file)):
        icon_file = utils.get_ui_object(os.path.join('image','ic64_hotot.png'));
    n.set_icon_from_pixbuf(gtk.gdk.pixbuf_new_from_file(icon_file))    
    n.set_timeout(5000)
    n.show()
Example #16
0
def do_notify(summary, body, icon_file = None):
    if USE_GTKNOTIFICATION_IN_NATIVE_PLATFORM:
        return notify.do_notify(summary, body, icon_file)
    n = pynotify.Notification(summary, body)
    if (icon_file == None or not os.path.isfile(icon_file)):
        icon_file = utils.get_ui_object(os.path.join('image','ic64_hotot.png'));
    n.set_icon_from_pixbuf(gtk.gdk.pixbuf_new_from_file(icon_file))    
    n.set_timeout(5000)
    n.show()
Example #17
0
    def __init__(self, parentWidget):
        WebKit.WebView.__init__(self)
        self.load_finish_flag = False
        self.set_property('can-focus', True)
        self.set_property('can-default', True)
        self.set_full_content_zoom(1)
        self.parentWidget = parentWidget;

        settings = self.get_settings()
        try:
            settings.set_property('enable-universal-access-from-file-uris', True)
            settings.set_property('javascript-can-access-clipboard', True)
            settings.set_property('enable-default-context-menu', True)
            settings.set_property('enable-page-cache', True)
            settings.set_property('tab-key-cycles-through-elements', True)
            settings.set_property('enable-file-access-from-file-uris', True)
            settings.set_property('enable-spell-checking', False)
            settings.set_property('enable-caret-browsing', False)
            settings.set_property('enable-developer-extras', config.ENABLE_INSPECTOR)
            try:
                # Since 1.7.5
                settings.set_property('enable-accelerated-compositing', True)
            except TypeError:
                pass
        except:
            print 'Error: settings property was not set.'

        WebKit.set_web_database_directory_path(config.get_path("db"))
        WebKit.set_default_web_database_quota(1024**3L)
        
        ## bind events
        self.connect('navigation-requested', self.on_navigation_requested);
        self.connect('new-window-policy-decision-requested', self.on_new_window_requested);
        self.connect('script-alert', self.on_script_alert);
        self.connect('load-finished', self.on_load_finish);
        self.connect("hovering-over-link", self.on_over_link);
#       self.connect('drag_data_received', self.on_drag_data_received)
#       self.connect('drag_motion', self.on_drag_motion)
#       self.connect('drag_drop', self.on_drag_drop)
#       # @TODO DND for gir
#       TARGET_TYPE_URI_LIST = 80
#       dnd_list = [ ( 'text/uri-list', 0, TARGET_TYPE_URI_LIST ) ]
#       te = Gtk.TargetEntry.new(
#           'text/uri-list', 0, TARGET_TYPE_URI_LIST)
#       self.drag_dest_set( Gtk.DestDefaults.ALL,
#                 [te], Gdk.DragAction.COPY)

        if config.ENABLE_INSPECTOR:
            from inspector import HermelinInspector
            HermelinInspector(self.get_inspector())

        templatefile = utils.get_ui_object(config.TEMPLATE)
        template = open(templatefile, 'rb').read()
        self.load_string(template, 'text/html', 'UTF-8', 'file://' + templatefile)
Example #18
0
    def __init__(self):
        WebView.__init__(self)
        self.load_finish_flag = False
        self.set_property('can-focus', True)
        self.set_property('can-default', True)
        self.set_full_content_zoom(1)
        self.clipbord = gtk.Clipboard()

        settings = self.get_settings()
        try:
            settings.set_property('enable-universal-access-from-file-uris',
                                  True)
            settings.set_property('javascript-can-access-clipboard', True)
            settings.set_property('enable-default-context-menu', True)
            settings.set_property('enable-page-cache', True)
            settings.set_property('tab-key-cycles-through-elements', True)
            settings.set_property('enable-file-access-from-file-uris', True)
            settings.set_property('enable-spell-checking', False)
            settings.set_property('enable-caret-browsing', False)
            try:
                # Since 1.7.5
                settings.set_property('enable-accelerated-compositing', True)
            except TypeError:
                pass
        except:
            print 'Error: settings property was not set.'
        webkit.set_web_database_directory_path(config.DB_DIR)
        webkit.set_default_web_database_quota(1024**3L)
        ## bind events
        self.connect('navigation-requested', self.on_navigation_requested)
        self.connect('new-window-policy-decision-requested',
                     self.on_new_window_requested)
        self.connect('script-alert', self.on_script_alert)
        self.connect('load-finished', self.on_load_finish)
        self.connect("hovering-over-link", self.on_over_link)
        #        self.connect('drag_data_received', self.on_drag_data_received)
        #        self.connect('drag_motion', self.on_drag_motion)
        #        self.connect('drag_drop', self.on_drag_drop)
        #        self.drag_dest_set(gtk.DEST_DEFAULT_DROP,
        #                  dnd_list, gtk.gdk.ACTION_COPY)
        templatefile = utils.get_ui_object(config.TEMPLATE)
        template = open(templatefile, 'rb').read()
        self.load_html_string(template, 'file://' + templatefile)
Example #19
0
    def __init__(self):
        self.is_sign_in = False
        self.active_profile = 'default'
        self.protocol = ''
        self.build_gui()
        self.trayicon_pixbuf = [None, None]
        self.state = {
            'unread_count': 0
        }

        self.inblinking = False

        import dbusservice
        self.dbus_service = dbusservice.DbusService(self)

        if os.environ.get('DESKTOP_SESSION') in ('gnome-2d', 'classic-gnome'):
            self.has_indicator = False
        else:
            try:
                from gi.repository import AppIndicator3 as AppIndicator
            except ImportError:
                self.has_indicator = False
            else:
                self.has_indicator = True

        if self.has_indicator:
            self.indicator = AppIndicator.Indicator.new('hotot', 'hotot', AppIndicator.IndicatorCategory.COMMUNICATIONS)
            self.indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE)
            self.indicator.set_icon_theme_path(utils.get_ui_object('image/'))
            self.indicator.set_icon_full('ic24_hotot_mono_light', 'hotot')
            self.indicator.set_attention_icon_full('ic24_hotot_mono_light_blink', 'hotot')
            self.indicator.set_menu(self.traymenu)
            self.indicatorStatus = AppIndicator.IndicatorStatus
        else:
            self.create_trayicon()
            # workaround for icon display issue in some cases
            #  libgtk-3-0            => 3.4.0-0ubuntu5
            #  libgdk-pixbuf2.0-0    => 2.26.0-1
            #  trayer                => 1.1.1-1ubuntu1
            # ugly but whoever cares
            self.start_blinking()
            self.stop_blinking()
Example #20
0
def main():
    DBusGMainLoop(set_as_default=True)

    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import ctypes
        libc = ctypes.CDLL('libc.so.6')
        libc.prctl(15, 'hotot', 0, 0, 0)
    except:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)

    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                            'hotot',
                                            appindicator.CATEGORY_COMMUNICATIONS,
                                            utils.get_ui_object('image'))
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_icon('ic24_hotot_mono_light')
        indicator.set_attention_icon('ic24_hotot_mono_light_blink')
        indicator.set_menu(app.menu_tray)
        app.indicator = indicator

    # Set display functions (MeMenu)
    if HAS_MEMENU:
        global ind_server, indicator_unread
        ind_server.connect("server-display", app.on_mitem_resume_activate)
        indicator_unread.connect("user-display", app.on_mitem_resume_activate) 

    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
Example #21
0
def main():
    global HAS_INDICATOR
    gtk.gdk.threads_init()
    config.loads();
    try:
        import dl
        libc = dl.open('/lib/libc.so.6')
        libc.call('prctl', 15, 'hotot', 0, 0, 0)
    except:
        pass
    agent.init_notify()
    app = Hotot()
    agent.app = app
    if HAS_INDICATOR:
        indicator = appindicator.Indicator('hotot',
                                           'hotot',
                                           appindicator.CATEGORY_COMMUNICATIONS)
        indicator.set_status(appindicator.STATUS_ACTIVE)
        indicator.set_attention_icon(utils.get_ui_object('image/ic24_hotot_mono_light.svg'))
        indicator.set_menu(app.menu_tray)
    gtk.gdk.threads_enter()
    gtk.main()
    gtk.gdk.threads_leave()
Example #22
0
    def __init__(self):
        self.is_sign_in = False
        self.active_profile = 'default'
        self.protocol = ''
        self.build_gui()
        self.trayicon_pixbuf = [None, None]
        self.state = {'unread_count': 0}

        self.inblinking = False

        import dbusservice
        self.dbus_service = dbusservice.DbusService(self)

        if os.environ.get('DESKTOP_SESSION') not in ('ubuntu', 'ubuntu-2d'):
            self.has_indicator = False
        else:
            try:
                from gi.repository import AppIndicator3 as AppIndicator
            except ImportError:
                self.has_indicator = False
            else:
                self.has_indicator = True

        if self.has_indicator:
            self.indicator = AppIndicator.Indicator.new(
                'hermelin', 'hermelin',
                AppIndicator.IndicatorCategory.COMMUNICATIONS)
            self.indicator.set_status(AppIndicator.IndicatorStatus.ACTIVE)
            self.indicator.set_icon_theme_path(utils.get_ui_object('image/'))
            self.indicator.set_icon_full('ic24_hermelin_mono_light',
                                         'hermelin')
            self.indicator.set_attention_icon_full(
                'ic24_hermelin_mono_light_blink', 'hermelin')
            self.indicator.set_menu(self.traymenu)
            self.indicatorStatus = AppIndicator.IndicatorStatus
        else:
            self.create_trayicon()
Example #23
0
    def build_gui(self):
        self.window = Gtk.Window()
        self.window.set_default_icon_from_file(
            utils.get_ui_object('image/ic128_hermelin.png'))
        self.window.set_icon_from_file(
            utils.get_ui_object('image/ic128_hermelin.png'))

        self.window.set_title(_("Hermelin"))
        self.window.set_position(Gtk.WindowPosition.CENTER)

        self.window.connect('delete-event', self.on_window_delete)
        # self.window.connect('size-allocate', self.on_window_size_allocate)
        self.window.connect('show', self.on_window_show_or_hide)
        self.window.connect('hide', self.on_window_show_or_hide)

        vbox = Gtk.VBox()
        scrollw = Gtk.ScrolledWindow()

        self.webv = view.MainView(scrollw)

        agent.view = self.webv

        scrollw.add(self.webv)
        vbox.pack_start(scrollw, True, True, 0)
        vbox.show_all()
        self.window.add(vbox)

        self.traymenu = Gtk.Menu()
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Show"))
        mitem_resume.connect('activate', self.on_mitem_show_activate)
        self.traymenu.append(mitem_resume)
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Hide"))
        mitem_resume.connect('activate', self.on_mitem_hide_activate)
        self.traymenu.append(mitem_resume)
        mitem_compose = Gtk.MenuItem.new_with_mnemonic(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose)
        self.traymenu.append(mitem_compose)
        if (config.ENABLE_INSPECTOR):
            mitem_inspector = Gtk.ImageMenuItem.new_with_mnemonic(
                _("_Inspector"))
            mitem_inspector.set_image(
                Gtk.Image.new_from_stock(Gtk.STOCK_FIND, Gtk.IconSize.MENU))
            mitem_inspector.connect('activate',
                                    self.on_mitem_inspector_activate)
            self.traymenu.append(mitem_inspector)
        mitem_prefs = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES,
                                                       None)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate)
        self.traymenu.append(mitem_prefs)
        mitem_about = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
        mitem_about.connect('activate', self.on_mitem_about_activate)
        self.traymenu.append(mitem_about)
        mitem_quit = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
        mitem_quit.connect('activate', self.on_mitem_quit_activate)
        self.traymenu.append(mitem_quit)

        self.traymenu.show_all()

        ## support for ubuntu unity indicator-appmenu
        self.menubar = Gtk.MenuBar()

        menuitem_file = Gtk.MenuItem.new_with_mnemonic(_("_File"))
        menuitem_file_menu = Gtk.Menu()
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Show"))
        mitem_resume.connect('activate', self.on_mitem_show_activate)
        menuitem_file_menu.append(mitem_resume)
        mitem_compose = Gtk.MenuItem.new_with_mnemonic(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose)
        menuitem_file_menu.append(mitem_compose)
        mitem_prefs = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES,
                                                       None)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate)
        menuitem_file_menu.append(mitem_prefs)
        if (config.ENABLE_INSPECTOR):
            mitem_inspector = Gtk.ImageMenuItem.new_with_mnemonic(
                _("_Inspector"))
            mitem_inspector.set_image(
                Gtk.Image.new_from_stock(Gtk.STOCK_FIND, 16))
            mitem_inspector.connect('activate',
                                    self.on_mitem_inspector_activate)
            menuitem_file_menu.append(mitem_inspector)
        menuitem_quit = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
        menuitem_quit.connect("activate", self.quit)
        menuitem_file_menu.append(menuitem_quit)
        menuitem_file.set_submenu(menuitem_file_menu)
        self.menubar.append(menuitem_file)

        menuitem_help = Gtk.MenuItem.new_with_mnemonic(_("_Help"))
        menuitem_help_menu = Gtk.Menu()
        menuitem_about = Gtk.ImageMenuItem.new_from_stock(
            Gtk.STOCK_ABOUT, None)
        menuitem_about.connect("activate", self.on_mitem_about_activate)
        menuitem_help_menu.append(menuitem_about)
        menuitem_help.set_submenu(menuitem_help_menu)
        self.menubar.append(menuitem_help)

        self.menubar.set_size_request(0, 0)
        self.menubar.show_all()
        self.menubar.hide()
        vport = Gtk.Viewport()
        vport.set_size_request(0, 0)
        vport.add(self.menubar)
        vbox.pack_start(vport, False, False, False)

        ##
        geometry = Gdk.Geometry()
        geometry.min_height = 400
        geometry.min_width = 460
        self.window.set_geometry_hints(self.window, geometry,
                                       Gdk.WindowHints.MIN_SIZE)
        self.window.show()
Example #24
0
    def build_gui(self):
        self.window = gtk.Window()
        gtk.window_set_default_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))
        self.window.set_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))

        self.window.set_title(_("Hotot"))
        self.window.set_position(gtk.WIN_POS_CENTER)

        vbox = gtk.VBox()
        scrollw = gtk.ScrolledWindow()
        self.webv = view.MainView()

        agent.view = self.webv

        scrollw.add(self.webv)
        vbox.pack_start(scrollw)
        vbox.show_all()
        self.window.add(vbox)

        self.menu_tray = gtk.Menu()
        mitem_resume = gtk.MenuItem(_("_Resume/Hide"))
        mitem_resume.connect('activate', self.on_trayicon_activate);
        self.menu_tray.append(mitem_resume)
        mitem_compose = gtk.MenuItem(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose);
        self.menu_tray.append(mitem_compose)
        mitem_prefs = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate);
        self.menu_tray.append(mitem_prefs)
        mitem_about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        mitem_about.connect('activate', self.on_mitem_about_activate);
        self.menu_tray.append(mitem_about)
        mitem_quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        mitem_quit.connect('activate', self.on_mitem_quit_activate);
        self.menu_tray.append(mitem_quit)

        self.menu_tray.show_all()

        ## support for ubuntu unity indicator-appmenu
        menubar = gtk.MenuBar()
        menuitem_file = gtk.MenuItem(_("_File"))
        menuitem_file_menu = gtk.Menu()

        mitem_resume = gtk.MenuItem(_("_Resume/Hide"))
        mitem_resume.connect('activate', self.on_mitem_resume_activate)
        menuitem_file_menu.append(mitem_resume)
        mitem_compose = gtk.MenuItem(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose)
        menuitem_file_menu.append(mitem_compose)
        mitem_prefs = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate)
        menuitem_file_menu.append(mitem_prefs)

        menuitem_quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        menuitem_quit.connect("activate", self.quit)
        menuitem_file_menu.append(menuitem_quit)
        menuitem_file.set_submenu(menuitem_file_menu)
        menubar.append(menuitem_file)

        menuitem_help = gtk.MenuItem(_("_Help"))
        menuitem_help_menu = gtk.Menu()
        menuitem_about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        menuitem_about.connect("activate", self.on_mitem_about_activate)
        menuitem_help_menu.append(menuitem_about)
        menuitem_help.set_submenu(menuitem_help_menu)
        menubar.append(menuitem_help)

        menubar.set_size_request(0, 0)
        menubar.show_all()
        vbox.pack_start(menubar, expand=0, fill=0, padding=0)

        ##
        self.window.set_geometry_hints(min_height=380, min_width=460)
        self.window.show()
        self.window.connect('delete-event', self.on_window_delete)
Example #25
0
File: hotot.py Project: sarim/Hotot
    def build_gui(self):
        self.window = Gtk.Window()
        self.window.set_default_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))
        self.window.set_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))

        self.window.set_title(_("Hotot"))
        self.window.set_position(Gtk.WindowPosition.CENTER)

        self.window.connect('delete-event', self.on_window_delete)
        # self.window.connect('size-allocate', self.on_window_size_allocate)
        self.window.connect('show', self.on_window_show_or_hide)
        self.window.connect('hide', self.on_window_show_or_hide)

        vbox = Gtk.VBox()
        scrollw = Gtk.ScrolledWindow()

        self.webv = view.MainView(scrollw)

        agent.view = self.webv

        scrollw.add(self.webv)
        vbox.pack_start(scrollw, True, True, 0)
        vbox.show_all()
        self.window.add(vbox)

        self.traymenu = Gtk.Menu()
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Show"))
        mitem_resume.connect('activate', self.on_mitem_show_activate);
        self.traymenu.append(mitem_resume)
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Hide"))
        mitem_resume.connect('activate', self.on_mitem_hide_activate);
        self.traymenu.append(mitem_resume)
        mitem_compose = Gtk.MenuItem.new_with_mnemonic(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose);
        self.traymenu.append(mitem_compose)
        if (config.ENABLE_INSPECTOR):
            mitem_inspector = Gtk.ImageMenuItem.new_with_mnemonic(_("_Inspector"))
            mitem_inspector.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_FIND, Gtk.IconSize.MENU))
            mitem_inspector.connect('activate', self.on_mitem_inspector_activate)
            self.traymenu.append(mitem_inspector)
        mitem_prefs = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate);
        self.traymenu.append(mitem_prefs)
        mitem_about = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
        mitem_about.connect('activate', self.on_mitem_about_activate);
        self.traymenu.append(mitem_about)
        mitem_quit = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
        mitem_quit.connect('activate', self.on_mitem_quit_activate);
        self.traymenu.append(mitem_quit)

        self.traymenu.show_all()

        ## support for ubuntu unity indicator-appmenu
        self.menubar = Gtk.MenuBar()

        menuitem_file = Gtk.MenuItem.new_with_mnemonic(_("_File"))
        menuitem_file_menu = Gtk.Menu()
        mitem_resume = Gtk.MenuItem.new_with_mnemonic(_("_Show"))
        mitem_resume.connect('activate', self.on_mitem_show_activate)
        menuitem_file_menu.append(mitem_resume)
        mitem_compose = Gtk.MenuItem.new_with_mnemonic(_("_Compose"))
        mitem_compose.connect('activate', self.on_mitem_compose)
        menuitem_file_menu.append(mitem_compose)
        mitem_prefs = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate)
        menuitem_file_menu.append(mitem_prefs)
        if (config.ENABLE_INSPECTOR):
            mitem_inspector = Gtk.ImageMenuItem.new_with_mnemonic(_("_Inspector"))
            mitem_inspector.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_FIND, 16))
            mitem_inspector.connect('activate', self.on_mitem_inspector_activate)
            menuitem_file_menu.append(mitem_inspector)
        menuitem_quit = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
        menuitem_quit.connect("activate", self.quit)
        menuitem_file_menu.append(menuitem_quit)
        menuitem_file.set_submenu(menuitem_file_menu)
        self.menubar.append(menuitem_file)

        menuitem_help = Gtk.MenuItem.new_with_mnemonic(_("_Help"))
        menuitem_help_menu = Gtk.Menu()
        menuitem_about = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
        menuitem_about.connect("activate", self.on_mitem_about_activate)
        menuitem_help_menu.append(menuitem_about)
        menuitem_help.set_submenu(menuitem_help_menu)
        self.menubar.append(menuitem_help)

        self.menubar.set_size_request(0, 0)
        self.menubar.show_all()
        self.menubar.hide()
        vport = Gtk.Viewport()
        vport.set_size_request(0, 0)
        vport.add(self.menubar)
        vbox.pack_start(vport, False, False, False)

        ##
        geometry = Gdk.Geometry()
        geometry.min_height = 400
        geometry.min_width = 460
        self.window.set_geometry_hints(self.window, geometry, Gdk.WindowHints.MIN_SIZE)
        self.window.show()
Example #26
0
 def show(self, summary, body, icon_file = None):
     if icon_file == None or (not os.path.isfile(icon_file)) or os.path.getsize(icon_file) == 0:
         icon_file = utils.get_ui_object(os.path.join('image','ic64_hotot.png'))
     n = self.notification.new(self.escape(summary), self.escape(body), icon_file)
     n.set_timeout(5000)
     n.show()
Example #27
0
File: hotot.py Project: fma16/Hotot
    def build_gui(self):
        self.window = gtk.Window()
        gtk.window_set_default_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))
        self.window.set_icon_from_file(
            utils.get_ui_object('image/ic128_hotot.png'))

        self.window.set_title(_("Hotot"))
        self.window.set_position(gtk.WIN_POS_CENTER)
        #self.window.set_default_size(500, 550)

        vbox = gtk.VBox()
        scrollw = gtk.ScrolledWindow()
        self.webv = view.MainView()

        agent.view = self.webv

        scrollw.add(self.webv)
        vbox.pack_start(scrollw)
        vbox.show_all()
        self.window.add(vbox)

        self.menu_tray = gtk.Menu()
        mitem_resume = gtk.MenuItem(_("_Resume/Hide"))
        mitem_resume.connect('activate', self.on_trayicon_activate);
        self.menu_tray.append(mitem_resume)
        mitem_prefs = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate);
        self.menu_tray.append(mitem_prefs)
        mitem_about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        mitem_about.connect('activate', self.on_mitem_about_activate);
        self.menu_tray.append(mitem_about)
        mitem_quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        mitem_quit.connect('activate', self.on_mitem_quit_activate);
        self.menu_tray.append(mitem_quit)

        self.menu_tray.show_all()

        ## support for ubuntu unity indicator-appmenu
        menubar = gtk.MenuBar()
        menuitem_file = gtk.MenuItem(_("_File"))
        menuitem_file_menu = gtk.Menu()

        mitem_resume = gtk.MenuItem(_("_Resume/Hide"))
        mitem_resume.connect('activate', self.on_mitem_resume_activate)
        menuitem_file_menu.append(mitem_resume)
        mitem_prefs = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
        mitem_prefs.connect('activate', self.on_mitem_prefs_activate)
        menuitem_file_menu.append(mitem_prefs)

        menuitem_quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        menuitem_quit.connect("activate", self.quit)
        menuitem_file_menu.append(menuitem_quit)
        menuitem_file.set_submenu(menuitem_file_menu)
        menubar.append(menuitem_file)

        menuitem_help = gtk.MenuItem(_("_Help"))
        menuitem_help_menu = gtk.Menu()
        menuitem_about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        menuitem_about.connect("activate", self.on_mitem_about_activate)
        menuitem_help_menu.append(menuitem_about)
        menuitem_help.set_submenu(menuitem_help_menu)
        menubar.append(menuitem_help)

        menubar.set_size_request(0, 0)
        menubar.show_all()
        vbox.pack_start(menubar, expand=0, fill=0, padding=0)

        ##
        self.window.set_geometry_hints(min_height=380, min_width=460)
        self.window.show()
        self.window.connect('delete-event', gtk.Widget.hide_on_delete)
Example #28
-1
File: view.py Project: sdqali/Hotot
    def __init__(self):
        WebView.__init__(self)
        self.load_finish_flag = False
        self.set_property('can-focus', True)
        self.set_property('can-default', True)
        self.set_full_content_zoom(1)
        self.clipbord = gtk.Clipboard()

        settings = self.get_settings()
        try:
            settings.set_property('enable-universal-access-from-file-uris', True)
            settings.set_property('javascript-can-access-clipboard', True)
            settings.set_property('enable-default-context-menu', True)
            settings.set_property('enable-page-cache', True)
            settings.set_property('tab-key-cycles-through-elements', True)
            settings.set_property('enable-file-access-from-file-uris', True)
            settings.set_property('enable-spell-checking', True)
            settings.set_property('enable-caret-browsing', False)
        except:
            print 'Error: settings property was not set.'
        webkit.set_web_database_directory_path(config.DB_DIR)
        webkit.set_default_web_database_quota(1024**3L)
        ## bind events
        self.connect('navigation-requested', self.on_navigation_requested);
        self.connect('new-window-policy-decision-requested', self.on_new_window_requested);
        self.connect('script-alert', self.on_script_alert);
        self.connect('load-finished', self.on_load_finish);
        self.connect("hovering-over-link", self.on_over_link);
        templatefile = utils.get_ui_object(config.TEMPLATE)
        template = open(templatefile, 'rb').read()
        self.load_html_string(template, 'file://' + templatefile)