def OnImportWretch(self, e): dialog = wx.FileDialog(self) result = dialog.ShowModal() dialog.Destroy() if result != wx.ID_OK: return file = dialog.GetFilename() dir = dialog.GetDirectory() filename = os.path.join(dir, file) wi = WretchImporter(filename) blogdata = wi.parse() self.setBlogData(blogdata)
def main(): long_opts = ["import-wretch=", "import-blogger="] opts, args = getopt.getopt(sys.argv[1:], "n", long_opts) no_window = False for o, a in opts: if o == "-n": no_window = True if o == "--import-wretch": blogdata = WretchImporter(a).parse() print "%d articles, %d comments" % (blogdata.article_count(), blogdata.comment_count()) if o == "--import-blogger": blogdata = BloggerImporter(a).parse() print "%d articles, %d comments" % (blogdata.article_count(), blogdata.comment_count()) if not no_window: app = wx.PySimpleApp() frame = MainWindow() app.MainLoop()