def main(): logging.basicConfig( level='DEBUG', stream=sys.stdout, format='%(asctime)s %(levelname)-8s %(name)-15s %(message)s') try: import faulthandler faulthandler.enable() except ImportError: pass with enaml.imports(): from view import Main app = QtApplication() profiler = cProfile.Profile() view = Main() view.show() # Start the application event loop profiler.enable() app.start() profiler.disable() profiler.print_stats('tottime')
def build(self): with enaml.imports(): from view import Main view = Main() view.show() return super(EnamlKvApp, self).build()
def build(self): self._kvapp.theme_cls = ThemeManager() with enaml.imports(): from view import Main view = Main() view.show() return super(EnamlKvApp, self).build()
def __init__(self): self.gui = Main() self.state = State(self.gui.ip, self.gui.is_simulation) self.gui.slide.set_value(self.brightness) self.gui.set_connection_state(self.state.connected) self.__set_slots() if self.state.connected: self.__set_function_slots() else: self.__disable_function_slots()
def main(): with enaml.imports(): from view import Main app = QtApplication() view = Main() view.show() # Start the application event loop app.start()
""" Takes in a r widget, and positions the window to center of screen :param r: Takes the root window widget as an argument """ width = 1280 height = 600 screen_width = r.winfo_screenwidth() screen_height = r.winfo_screenheight() x = (screen_width - width) / 2 y = (screen_height - height) / 2 r.geometry('%dx%d+%d+%d' % (width, height, x, y)) if __name__ == '__main__': """ Main run method """ logging.basicConfig(filename='debug.log', level=logging.DEBUG) logging.debug('Starting program at %s' % datetime.datetime.utcnow().strftime('%H:%M:%S')) root = Tk() center_window(root) app = Main(root) root.mainloop()