def main(): root = t.Tk() root.wm_title("GraphMaker") try: app = App(root, c_width=800, c_height=800) except IOError as e: print("Stop application: " + str(e)) else: app.pack(fill='both', expand='yes') root.protocol("WM_DELETE_WINDOW", lambda: (app.on_exit(), root.destroy())) root.mainloop()
def __init__(self): QDialog.__init__(self) self.app = App.instance() self.settings = self.app.settings() self.initUi() self.updatePorts() self.loadSettings()
def app(): driver = webdriver.Chrome() url_app = 'https://rololand.github.io/app-for-tests' app = App(driver=driver, url=url_app) app.go() yield app app.quit()
def do_GET( self ): # Take care about URL # Separate query string from path path, separator, query = self.path.partition( "?" ) # Decode url path unquoted_path = urllib.unquote_plus( path ) if query: # Parse and decode query string to dictionary, second parameter # tell to parse blank strings query = urlparse.parse_qs( query, True ) # Check if client request is on file # We don't allow to list directory only to list files like # .js .css .font .. if os.path.isfile( self.DOCUMENT_ROOT + path ): # File exist, guess his type # Initialize mimetypes, read system default if not mimetypes.inited: mimetypes.init() # Guess type for requested file by url path mime_type, encoding = mimetypes.guess_type( path ) if not mime_type: # Default mime for files mime_type = "text/plain" try: f = open( self.DOCUMENT_ROOT + path, "r" ) content = f.read() self.send_response( 200 ) self.send_header( "Content-Type", mime_type ) self.send_header( "Content-Length", len( content ) ) self.end_headers() self.wfile.write( content ) except: self.send_error( 404 ) finally: f.close() return # It is not a file => run application application = App( unquoted_path, query ) # Route request to apropriate controller application.route() # If not good response send error if not application.get_code() == 200: self.send_error( application.get_code() ) return # Response code is 200 response = application.get_response() self.send_response( 200 ) self.send_header( "Content-Type", response[1] ) self.send_header( "Content-Length", len( response[0] ) ) self.end_headers() self.wfile.write( response[0] )
from app.App import App if __name__ == "__main__": app = App() app.run()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from app.App import App #--- lin # DB_PATH = "/home/nia/Development/_Python/_DCat/Export10/Video.bm.gz" DB_PATH = "/home/nia/Development/_Python/_DCat/Export10/app2/oxygen_16x16.hmap.gz" DB_PATH = "/home/nia/Development/_Python/_DCat/Export10/app2/Apps.hmap.gz" # DB_PATH = "/home/nia/Development/_Python/_DCat/Export10/Apps.bm.gz" #--- win # DB_PATH = """E:\\_Wrk\\_Python\\_DCat\\Bin10Test\\files\\P50.hmap.gz""" if __name__ == "__main__": if len(sys.argv) > 1: path = sys.argv[1] else: path = DB_PATH app = App(db_path=path) app.start()
import asyncio from app.App import App if __name__ == '__main__': loop = asyncio.get_event_loop() app = App(loop) try: loop.run_forever() except (KeyboardInterrupt, SystemExit): print('') except Exception as e: print(f'Error: {e}') app.close()
import logging import logging.config logging.config.fileConfig( 'config/logging.conf' ) logger = logging.getLogger( 'root' ) # Panda3d imports from panda3d.core import loadPrcFile # Import app logic from app.App import App from app.Camera import CameraHandler # ------------------------ Panda3D Config ------------------------ loadPrcFile("./config/config.prc") # ------------------------ Main ------------------------ # Create app instance app = App( ) # Create the camera camera = CameraHandler( ) # Set background colour base.setBackgroundColor( 0, 0, 0 ) # Set the app to run app.run( )
from app.App import App from config.Config import Config config = Config() app = App(config)
#! /usr/bin/python3 from app.App import App from app.Model import Model # APP GLOBALS # INIT Model.init() App.init() # MAIN App.start()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse from app.App import App app = App() app.start() # # # def main(): # #--- парсер командной строки # parser = argparse.ArgumentParser() # parser.add_argument("-c", "--command", help="команда", choices=["get_project", "project_editor"]) # parser.add_argument("-s", "--server", help="сервер") # parser.add_argument("-p", "--port", help="порт") # args = parser.parse_args() # # # if args.command == "get_project": # return get_project_json(HTTP_PROJECT_GET, FILE_PROJECT) # # if args.command == "project_editor": # return start_project_editor() # # from app.config import config # # if args.server: # config.set("main", "server_host", args.server) # # if args.port: # config.set("main", "server_port", args.port)
import app.popen # Popen monkey patch # noqa F401 from app.App import App if __name__ == '__main__': app = App() app.MainLoop()
def main(src, command, dst_dir, source_regular_reread, source_reread_interval): if not isdir("mobilenet"): fetch_mobilenet() app = App(dst_dir) if command == "crop_peoples": app.init_tfmodel() if source_regular_reread: while True: app.start_filter_image_with_people(src, dst_dir) time.sleep(int(source_reread_interval)) app.start_filter_image_with_people(src, dst_dir) return if command == "recognition_persons": app.init_tfmodel() app.init_face_recognition(dst_dir) if source_regular_reread: while True: app.start_distribution_by_persons(src, dst_dir) time.sleep(int(source_reread_interval)) app.start_distribution_by_persons(src, dst_dir) return raise NameError("Unknown command " + command)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from app.App import App from app.rc import DIR_PROJECT app = App() app.start(DIR_PROJECT)
def __init__(self): QtGui.QMainWindow.__init__(self) self.app = App.instance() self.ui = uic.loadUi('ui/resources/main_window.ui', self) self.ui.setWindowTitle(self.app.applicationName()) self.ui.treeWidget.header().setStretchLastSection(False) self.ui.treeWidget.header().setResizeMode(QtGui.QHeaderView.ResizeToContents) self.ui.treeWidget.expandAll() test_data = [ ['Base', [ ['RPM', ''], ['Load', 'mg'], ['A/F Ratio', ''], ]], ['Injection', [ ['Pulse width', 'ms'], ['Target A/F Ratio', ''], ['Timing', '°'], ]], ['Ignition', [ ['Timing Advance', '°BTDC'], ['Dwell Time', 'ms'], ]], ['Idle', [ ['Target RPM', ''], ['Delta RPM', ''], ['Timing Advance', '°BTDC'], ['Timing Offset', '°'], ['PWM Duty', '%'], ]], ] column_count = 0 for i in range(len(test_data)): column_count += 1 + len(test_data[i][1]) self.ui.paramsTableWidget.setColumnCount(3) self.ui.paramsTableWidget.setRowCount(column_count) self.ui.paramsTableWidget.horizontalHeader().resizeSection(0, 123) self.ui.paramsTableWidget.horizontalHeader().resizeSection(1, 50) self.ui.paramsTableWidget.horizontalHeader().resizeSection(2, 55) row_index = 0 for group in test_data: self.ui.paramsTableWidget.setSpan(row_index, 0, 1, 3) self.ui.paramsTableWidget.setItem(row_index, 0, QtGui.QTableWidgetItem(group[0])) self.ui.paramsTableWidget.item(row_index, 0).setBackground(QtCore.Qt.darkGray) self.ui.paramsTableWidget.item(row_index, 0).setForeground(QtCore.Qt.white) row_index += 1 for param in group[1]: self.ui.paramsTableWidget.setItem(row_index, 0, QtGui.QTableWidgetItem(param[0])) self.ui.paramsTableWidget.setItem(row_index, 2, QtGui.QTableWidgetItem(param[1])) row_index += 1 self.ui.actionExit.triggered.connect(QtCore.QCoreApplication.instance().quit) self.ui.actionSettings.triggered.connect(self.settings_dialog) self.ui.actionAbout.triggered.connect(self.about_dialog) self.ui.actionAbout_Qt.triggered.connect(QtGui.QApplication.aboutQt) self.ui.tableViewButton.clicked.connect(self.table_view_dialog) self.ui.connectButton.clicked.connect(self.connect)