Attachment 'ipodder_main.py.html'

Download

def main():
    # Initialise the logging module and configure it for our console logging.
    # I'll factor this out soon so it's less convoluted.
    # There's probably a better way of doing this with the Gui version, 
    # but we have to start somewhere. :) - gtk
    # logging.basicConfig()
    handler = logging.handlers.MemoryHandler(65536)
    #handler.formatter = conlogging.ConsoleFormatter("%(message)s", wrap=False)
    log.addHandler(handler)
    log.propagate = 0
    logging.addLevelName(SPAM, "SPAM")

    # Parse our configuration files.
    # I'll factor this out soon so it's less convoluted.
    parser = makeCommandLineParser()
    options, args = parser.parse_args()
    if options.debug:
        log.setLevel(logging.DEBUG)
    else:
        log.setLevel(logging.INFO)
    try:
        config = Configuration(options)
    except RunTwiceError, e:
        quiet = False
        config = e.value
        if "Win" in platform.system() and config["listen_port"]:
            #Try to raise the app.
            import xmlrpclib, win32gui
            try:
                s = xmlrpclib.Server("http://localhost:%d" % config["listen_port"])
                s.wake()
                h = s.getHwnd()
                win32gui.SetForegroundWindow(h)
                quiet = True
                if options.add_feed:
                    s.addFeed(options.add_feed)
                elif options.add_feed_from_rss:
                    s.addFeedFromRss(options.add_feed_from_rss)
            except:
                pass

        if not quiet:
            app = wx.App()
            app.MainLoop()

            currentlanguage = LanguageModule.ENGLISH
            #TODO: Safely read the screen language.  State is currently
            #being used by the other running process.
            stringtable = LanguageModule.StringTable(currentlanguage)
            alert = wx.MessageDialog(None, stringtable.GetText(currentlanguage, "str_other_copy_running"), style=wx.OK)
            response = alert.ShowModal()
            alert.Destroy()
        sys.exit(0)

    if options.debug: # just in case config file over-rode it
        log.setLevel(logging.DEBUG)
    else:
        log.setLevel(logging.INFO)

    # Open our state database.
    state = statemodule.open(config)

    ipodder = core.iPodder(config,state)

    try:
        myApp = iPodderGui(ipodder,options)
        listener = iPodderSubscribeListener(myApp,config)
        listener.start()
        myApp.MainLoop()
    finally:
        state.close()
        ipodder.history.close()

if __name__ == '__main__':
    main()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-10-04 09:16:04, 77.9 KB) [[attachment:ipodder.jpg]]
  • [get | view] (2009-10-04 09:16:04, 2.6 KB) [[attachment:ipodder_main.py]]
  • [get | view] (2009-10-04 09:16:04, 4.4 KB) [[attachment:ipodder_main.py.html]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.