File: gnome-blog-poster

package info (click to toggle)
gnome-blog 0.9.1-8
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,116 kB
  • ctags: 178
  • sloc: python: 1,341; sh: 632; makefile: 136; xml: 8
file content (53 lines) | stat: -rwxr-xr-x 1,571 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')

import gtk
import gnome
import gnome.ui
import gconf
import gettext
_ = gettext.gettext

from gnomeblog import blog_poster
from gnomeblog import blogger_prefs
from gnomeblog import gnome_blog_globals

#FIXME: need to get this path from auto*
gettext.bindtextdomain('gnome-blog', gnome_blog_globals.localedir)
gettext.textdomain('gnome-blog')
    
icon_theme = gtk.icon_theme_get_default()
icon_info = icon_theme.lookup_icon('gnome-blog', -1, 0)
gtk.window_set_default_icon_from_file(icon_info.get_filename())
        
class BloggerApp:
    def __init__(self):
        self.prefs_key = "/apps/gnome-blog"

        client = gconf.client_get_default()
        value = client.get_bool(self.prefs_key + "/initialized")

        accel_group = gtk.AccelGroup()

        poster = blog_poster.BlogPoster(prefs_key=self.prefs_key,
                                        accel_group=accel_group,
                                        on_entry_posted=self._onEntryPosted)

        if (value == None or value == False):
            poster._showPrefDialog()
            client.set_bool(self.prefs_key + "/initialized", True)
        
        poster_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        poster_window.set_title(_("Post Blog Entry"))
        poster_window.connect('destroy', lambda w: gtk.main_quit())
        poster_window.add_accel_group(accel_group)

        poster_window.add(poster)
        poster_window.show_all()

    def _onEntryPosted(self):
        gtk.main_quit()
        
app = BloggerApp()
gtk.main()