Example #1
0
File: pogo.py Project: csryan/pogo
def main():
    log.logger.info('Started')

    # Localization
    locale.setlocale(locale.LC_ALL, '')
    gettext.textdomain(consts.appNameShort)
    gettext.bindtextdomain(consts.appNameShort, consts.dirLocale)

    # Command line
    prefs.setCmdLine((optOptions, optArgs))

    # PyGTK initialization
    gobject.threads_init()
    gtk.window_set_default_icon_list(
                        gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon16),
                        gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon24),
                        gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon32),
                        gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon48),
                        gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon64),
                        gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon128))

    # Create the GUI
    wTree = loadGladeFile('MainWindow.ui')
    paned = wTree.get_object('pan-main')
    window = wTree.get_object('win-main')
    prefs.setWidgetsTree(wTree)

    # RGBA support
    try:
        colormap = window.get_screen().get_rgba_colormap()
        if colormap:
            gtk.widget_set_default_colormap(colormap)
    except:
        log.logger.info('No RGBA support (requires PyGTK 2.10+)')

    # Show all widgets and restore the window size BEFORE hiding some of them
    # when restoring the view mode
    # Resizing must be done before showing the window to make sure that the WM
    # correctly places the window
    if prefs.get(__name__, 'win-is-maximized', DEFAULT_MAXIMIZED_STATE):
        window.maximize()

    height = prefs.get(__name__, 'win-height', DEFAULT_WIN_HEIGHT)
    window.resize(prefs.get(__name__, 'win-width', DEFAULT_WIN_WIDTH), height)
    window.show_all()

    # Restore sizes once more
    #window.resize(prefs.get(__name__, 'win-width', DEFAULT_WIN_WIDTH), height)
    paned.set_position(prefs.get(__name__, 'paned-pos', DEFAULT_PANED_POS))

    # Initialization done, let's continue the show
    gobject.idle_add(realStartup, window, paned)
    gtk.main()
Example #2
0
def main():
    log.logger.info('Started')

    # Localization
    locale.setlocale(locale.LC_ALL, '')
    gettext.textdomain(consts.appNameShort)
    gettext.bindtextdomain(consts.appNameShort, consts.dirLocale)

    # Command line
    prefs.setCmdLine((optOptions, optArgs))

    # Create the GUI
    wTree = loadGladeFile('MainWindow.ui')
    paned = wTree.get_object('pan-main')
    window = wTree.get_object('win-main')
    prefs.setWidgetsTree(wTree)

    window.set_icon_list([
        GdkPixbuf.Pixbuf.new_from_file(consts.fileImgIcon16),
        GdkPixbuf.Pixbuf.new_from_file(consts.fileImgIcon24),
        GdkPixbuf.Pixbuf.new_from_file(consts.fileImgIcon32),
        GdkPixbuf.Pixbuf.new_from_file(consts.fileImgIcon48),
        GdkPixbuf.Pixbuf.new_from_file(consts.fileImgIcon64),
        GdkPixbuf.Pixbuf.new_from_file(consts.fileImgIcon128)])

    # RGBA support
    # TODO: Is this still needed?
    visual = window.get_screen().get_rgba_visual()
    window.set_visual(visual)

    # Show all widgets and restore the window size BEFORE hiding some of them
    # when restoring the view mode
    # Resizing must be done before showing the window to make sure that the WM
    # correctly places the window
    if prefs.get(__name__, 'win-is-maximized', DEFAULT_MAXIMIZED_STATE):
        window.maximize()

    height = prefs.get(__name__, 'win-height', DEFAULT_WIN_HEIGHT)
    window.resize(prefs.get(__name__, 'win-width', DEFAULT_WIN_WIDTH), height)
    window.show_all()

    # Restore sizes once more
    #window.resize(prefs.get(__name__, 'win-width', DEFAULT_WIN_WIDTH), height)
    paned.set_position(prefs.get(__name__, 'paned-pos', DEFAULT_PANED_POS))

    # Initialization done, let's continue the show
    GObject.idle_add(realStartup, window, paned)
    Gtk.main()
# PyGTK initialization
gobject.threads_init()
gtk.window_set_default_icon_list(gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon16),
                                 gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon24),
                                 gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon32),
                                 gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon48),
                                 gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon64),
                                 gtk.gdk.pixbuf_new_from_file(consts.fileImgIcon128))


# Create the GUI
wtree  = loadGladeFile('MainWindow.ui')
window = wtree.get_object('win-main')

prefs.setWidgetsTree(wtree)

# RGBA support
try:
    colormap = window.get_screen().get_rgba_colormap()
    if colormap:
        gtk.widget_set_default_colormap(colormap)
except:
    log.logger.info('No RGBA support (requires PyGTK 2.10+)')

# This object takes care of the window (mainly event handlers)
mainWindow.MainWindow(wtree, window)


def delayedStartup():
    """