def on_click(self): pwd1 = self.pwd1.text() add = self.address.text() pwd = self.pwd.text() user = self.a if (add == '' or pwd == '' or pwd1 == ''): QMessageBox.about(self, 'Update', 'Some fields are still incomplete!') else: if (pwd != pwd1): QMessageBox.about(self, "Password", "Password Doesn't Match") else: mycu.execute('SELECT password FROM reg WHERE username= "******"') res = mycu.fetchone() if (res == pwd): QMessageBox.about(self, 'Update', 'Enter the new Password!', QMessageBox.Yes) else: mycu.execute('UPDATE reg SET address = "' + add + '", password = "******" WHERE username= "******"') conn.commit() print('Updated Successfully') self.Reply = QMessageBox.question(self, "Update", " Update successfull", QMessageBox.Yes) if self.Reply == QMessageBox.Yes: from main import App self.m = App(self.a) self.m.show() self.close()
def open_app(self): """打开应用程序""" self.quit() self.win_success.destroy() self.win_success.quit() App()
def on_click(self): username = self.username.text() passw = self.pwd.text() mycu.execute('SELECT * FROM reg WHERE username = "******" AND password = "******"') res = mycu.fetchone() if (not res): QMessageBox.about(self, 'Login', 'Invalid Details!!') self.resetform() else: print('Logged in Successfully') self.Reply = QMessageBox.question(self, 'Login', "Logged in successfull", QMessageBox.Yes) if self.Reply == QMessageBox.Yes: print('Yes clicked.') from main import App self.m = App(username) self.m.show() self.close() mycu.execute('SELECT * FROM reg where username = "******"') res = mycu.fetchall() for x in res: global currentuser currentuser = x[0] global currentname currentname = x[3] self.m.l1.setText("<h2>Welcome %s</h2>" % currentuser)
def start_server(self): if self._is_daemon_running(): return if not self.debug: # Disable daemon if debug is on daemon_context = self._get_daemon_context() daemon_context.open() App(logfile=self.logfile).run() # This is the main function of the daemon
def setUp(self): """Set up app redirecting output to a pipe.""" self.tempdir = tempfile.mkdtemp() self.log = os.path.join(self.tempdir(), "log.csv") with open(self.log, "w") as f: f.write(logfile) self.out = os.path.join(self.tempdir(), "out") self.app = App(self.log, 2, self.out)
def test_app(self, App=None): """ test case to validate app instantiation :param App: :return: """ print("------------validating instantiation of App------------------") App.return_value = 'app test' assert App() == 'app test'
def start_server(self): if self._is_daemon_running(): print "Daemon running, not starting" return if not self.debug: # Disable daemon if debug is on daemon_context = self._get_daemon_context() with daemon_context: App(logfile=self.logfile, loglevel=self.loglevel).run() # This is the main function of the daemon
def test_run(self, run=None): """ test case to validate run function :param run: :return: """ print("------------validating run function------------------") run.return_value = 'test run' t = App() assert t.run() == 'test run'
def test_join_df(self, join_df=None): """ test case to validate join dataframe property :param join_df: :return: """ print("------------validating join dataframe property------------------") join_df.return_value = 'mock join dataframe' t = App() assert t.join_df == 'mock join dataframe'
def test_live_works_df(self, live_works_df=None): """ test case to validate live works data frame property :param live_works_df: :return: """ print("------------validating live works dataframe property------------------") live_works_df.return_value = 'mock live works dataframe' t = App() assert t.live_works_df == 'mock live works dataframe'
def test_cogo_labs_df(self, cogo_labs_df=None): """ test case to validate cogo_labs data frame property :param cogo_labs_df: :return: """ print("------------validating Cogo labs dataframe property------------------") cogo_labs_df.return_value = 'mock cogo labs dataframe' t = App() assert t.cogo_labs_df == 'mock cogo labs dataframe'
def on_click3(self): #database connection conn = mysql.connector.connect(host="localhost", user="******", passwd="", database="mini") mycu = conn.cursor() mycu.execute("TRUNCATE "+self.a+"") QMessageBox.question(self, 'Food', 'Foods Booked') from main import App self.m=App(self.a) self.m.show() self.close()
def test_persist(self, persist=None): """ test case to validate persist function :param persist: :return: """ print("------------validating persist function------------------") persist.return_value = 'test persist' t = App() assert t.persist() == 'test persist'
async def make_project_style(self): sys.path.append(self.source_path) from main import App app = App() css_tag_list = app.generate_css(current_tree=[])[-1] return generate_css_from_list(tag_list=css_tag_list)
def app_factory(config, app_name, blueprints=None): from main import App, PROJECT_PATH # you can use Empty directly if you wish app = App(app_name, root_path=PROJECT_PATH) config = config_str_to_obj(config) #print dir(config) app.configure(config) if blueprints: app.add_blueprint_list(blueprints) app.setup() return app
async def make_project(self): source = os.path.join(self.source_path, self.source_filename) if not os.path.exists(source): raise RuntimeError( handler_message( message="O caminho pra o projeto esta incorreto!", type="WARNING")) sys.path.append(self.source_path) from main import App app = App() return await self.join_project_source(source=app.generate_html())
def setUpModule(): global serverthread, cherryserver if os.path.isfile(CharryTestInfo.DB_FILE): os.remove(CharryTestInfo.DB_FILE) cherryserver = App() def begin(): cherryserver.start() serverthread = threading.Thread(target=begin) serverthread.start() time.sleep(1) print("Complete setup...............")
def ingresar(): user = usuario.get() clave = password.get() with open('usuarios.txt','r') as file: match = False for cadena in file.readlines(): nombre,rol,contrasenia,codigo1,codigo2,codigo3 = cadena.split(',') if nombre == user and clave == contrasenia: match = True break else: pass if match: login.destroy() App(usuario=nombre,rol=rol,codigo1=int(codigo1),codigo2=int(codigo2),codigo3=int(codigo3)) else: messagebox.showwarning('Advertencia','Usuario o contraseña incorrectos')
def __init__(self): self.game_finished = False # The App self.app = App(self) # the Printer self.printer = self.app.init_printer(10) # the Player self.player = Player(self.printer) # the Ship the_window = Window(self.printer) self.ship = Ship(the_window, self.printer) # Planets and initialisation self.citadel = Citadel("Citadel", self.ship, self.printer, self) self.fireplanet = Fireplanet("Paxak", self.ship, self.printer, self) self.planets = [self.citadel, self.fireplanet] # Initial Values of Important Fields self.current_planet = self.citadel self.current_location = self.citadel.current_location #self.game_finished = False # Final initialisation now that enough exists the_window.initialise(self) self.citadel.land() # the Parser and helpers self.parser = Parser() self.directions = [ "left", "right", "forwards", "forward", "ship", "spaceship", "out", "outside", "in", "inside", "back", "backwards", "citadel" ] noun_list = [] for object in self.current_location.objects: noun_list.extend(object.noun_names) self.parser.nouns = noun_list + self.directions # the StateHolder self.stateholder = StateHolder(self) self.start_game()
def on_click2(self): from setting import App self.m=App(self.a) self.m.show() self.close()
def on_click1(self): from main import App self.m=App(self.a) self.m.show() self.close()
def on_click1(self): from main import App self.m=App(self.a) self.m.show() self.close() def on_click2(self): from setting import App self.m=App(self.a) self.m.show() self.close() def on_click3(self): #database connection conn = mysql.connector.connect(host="localhost", user="******", passwd="", database="mini") mycu = conn.cursor() mycu.execute("TRUNCATE "+self.a+"") QMessageBox.question(self, 'Food', 'Foods Booked') from main import App self.m=App(self.a) self.m.show() self.close() if __name__ == '__main__': app = QApplication(sys.argv) ex = App() sys.exit(app.exec_())
def backclick(self): from main import App self.m = App(self.a) self.m.show() self.close()
# print("Next State received!") self.callback_triggered = False break time.sleep(0.0001) return self.next_state, self.reward, self.game_over # Setup our output dir if not os.path.exists(output_dir): os.makedirs(output_dir) # Create a game environment handler = Handler() game = App(training_mode=True, ml_step_callback=handler.callback) thread = Thread(target=game.on_execute) thread.start() # Create the agent agent = DqnAgent(state_size, action_size, force_continue=True ) # Set true to continue with low epsilon and loaded model # Create a data logger logger = DataLogger(n_episodes, save_period, batch_size, state_size, action_size) # Let the game start up time.sleep(5) # Track some times
def open_app(self): self.quit() self.win_success.destroy() self.win_success.quit() App()
from main import App App()
from main import App from src.args import args import multiprocessing import gunicorn.app.base from gunicorn.six import iteritems class StandaloneApplication(gunicorn.app.base.BaseApplication): def __init__(self, app, options=None): self.options = options or {} self.application = app super(StandaloneApplication, self).__init__() def load_config(self): config = dict([(key, value) for key, value in iteritems(self.options) if key in self.cfg.settings and value is not None]) for key, value in iteritems(config): self.cfg.set(key.lower(), value) def load(self): return self.application if __name__ == '__main__': options = { 'bind': '%s:%s' % (args.host, args.port), 'workers': args.workers, } StandaloneApplication(App().app, options).run()
def start1(): while True: app = QApplication(sys.argv) ex = App() sys.exit(app.exec_())
#!/usr/bin/env python from os import getenv import json import logging import random import math import numpy as np from tensorforce.agents import Agent from main import App app = App() app.init_screen() app.render() config = json.load(open(getenv('CONFIG', 'ppo.json'))) max_episodes = config.pop('max_episodes', None) max_timesteps = config.pop('max_timesteps', None) max_episode_timesteps = config.pop('max_episode_timesteps') network_spec = config.pop('network') agent = Agent.from_spec(spec=config, kwargs=dict( states=dict(type='float', shape=(len(app.get_state()), )), actions={ 'accel': dict(type='int', num_actions=3), 'turn': dict(type='int', num_actions=3),
def on_click1(self): print('clicked Regsiter.') from register import App self.m = App() self.m.show() self.close()