def create_app(): application = Application() ioloop = tornado.ioloop.IOLoop.instance() application.db = ModelCRUD(options, ioloop) future = application.db.db.connect() ioloop.add_future(future, lambda f: ioloop.stop()) ioloop.start() future.result() return application, ioloop
def main(): """Entry point app.""" create = Create() create.create_user() create.create_db() insert = Insert() if insert.is_data_in_db(): # Check if the database contains at least 3000 entries. print(s.MSG_DB_READY) app = Application() app.run() else: print(s.MSG_DB_CREATION) pbar = ProgressBar(widgets=[Percentage(), Bar()], maxval=8).start() for page in range(1, 8): down_off = Downloader(page) extracted = down_off.extract_data() cleaner = OffCleaner() cleaned = cleaner.clean(extracted) construct = Insert() construct.insert_data(cleaned) time.sleep(0.01) pbar.update(page + 1) if page == 7: app = Application() app.run() pbar.finish()
def __init__(self, app_name, app_args, client_args, positional_args, name, **kwargs): super().__init__(log_name=name, **kwargs) self.app_name = app_name self.app_args = app_args self.positional_args = positional_args self.client_args = client_args app_map = {a.name(): a for a in Application.__subclasses__()} if app_name not in app_map: raise ArgumentTypeError( "Client task specified app name '{name}', but not found in registered subclasses ( {classes} )" .format(name=app_name, classes=", ".join(app_map.keys()))) self.application = app_map[app_name] parser = argparse.ArgumentParser() ClientRuntime.add_arguments(parser=parser) self.application.make_client_args(parser=parser) self.parser = parser self.logging_dir = kwargs["logging_directory"] self._name = name self._results = []
from multiprocessing import freeze_support from app.app import Application if __name__ == '__main__': freeze_support() app = Application() app.start()
def application(): return Application()
def get_app(self): if not hasattr(self, 'app'): self.app = Application() return self.app
import sys from PyQt5 import QtWidgets from app.app import Application qt_app = QtWidgets.QApplication(sys.argv) app = Application() app.show() sys.exit(qt_app.exec())
def app_start(): root = tkinter.Tk() root.geometry("1200x600+300+150") Application(root).pack(side=tkinter.TOP, fill=tkinter.BOTH, expand=True) root.mainloop()
"""Entry point.""" from app.app import Application if __name__ == "__main__": app = Application() app.run()