示例#1
0
文件: pogo.py 项目: 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()
示例#2
0
文件: pogo.py 项目: johanson/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))

    # 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()
            # Fill the current instance with the given tracks, if any
            if len(optArgs) != 0:
                dbus.Interface(dbusSession.get_object(consts.dbusService, '/TrackList'), consts.dbusInterface).SetTracks(optArgs, True)
    except:
        pass

    if dbusSession is not None:
        dbusSession.close()

    if shouldStop:
        sys.exit(1)


log.logger.info('Started')
prefs.setCmdLine((optOptions, optArgs))


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


# 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),
# --== Entry point ==--


log.logger.info('Started')

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

# Command line
parser = optparse.OptionParser(usage='Usage: %prog [options] [FILE(s)]')
parser.add_option('-p', '--playbin2', action='store_true', default=False, help='use the playbin2 GStreamer component (unstable)')
prefs.setCmdLine(parser.parse_args())

# 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.glade')
paned  = wTree.get_widget('pan-main')
window = wTree.get_widget('win-main')
prefs.setWidgetsTree(wTree)