Example #1
0
if __name__ == "__main__":
    from src.controller import Controller

    app = Controller()
    app.mainloop()
Example #2
0
'''
Created on Feb 22, 2017

@author: Razvan
'''
from src.repo import FileRepository
from src.Sentence import SentenceValidator
from src.controller import Controller
from src.console import Console

if __name__ == '__main__':

    sentenceRepo = FileRepository(SentenceValidator, "input.txt")
    scrambleController = Controller(sentenceRepo)

    console = Console(scrambleController)

    try:
        console.run()
    except Exception as ex:
        print(ex)

    print("Bye")
Example #3
0
 def setup_controller(self):
     self.controller = Controller(self)
     self.controller.stopped.connect(self.handle_stopped)
 def setUp(self) -> None:
     self.controller = Controller()
Example #5
0
                                      image=self.background_image)
        self.background_label.place(x=0, y=0, relwidth=1, relheight=1)

        # This adds another button below saying Facebook, just if they didn't click on the image
        # This still needs a command
        self.aButton = Button(self,
                              text='A',
                              font=('Verdana', 15),
                              command=self.on_button_click).pack(side=TOP)
        self.bButton = Button(self,
                              text='B',
                              font=('Verdana', 15),
                              command=self.on_button_click).pack(side=TOP)
        self.cbButton = Button(self,
                               text='C',
                               font=('Verdana', 15),
                               command=self.on_button_click).pack(side=TOP)

    def on_button_click(self):
        # This switches to SecondFrame
        self.controller.switch_frame('chat3')


if __name__ == "__main__":
    from src.controller import Controller

    # Any testing specific to this class should be done here
    window = Tk()
    app = Controller(window, Phishing)
    app.start()
    window.mainloop()
Example #6
0
from flask import Flask, request, redirect
from os.path import join, dirname
from dotenv import load_dotenv
from src.utility.logger import logger

# Create .env file path
dotenv_path = join(dirname(__file__), '.env')
# load file from the path
load_dotenv(dotenv_path)
logger = logger()


def initialize_app():
    app = Flask(__name__)
    logger.info('Flask application started')
    return app


app = initialize_app()


@app.route('/home')
def home():
    return 'homepage'


from src.controller import Controller
Controller()
Example #7
0
def main() -> None:
    controller = Controller()
    controller.start_main_loop()
Example #8
0
import pygame as pg
from src.controller import Controller

if __name__ == '__main__':
  controller = Controller('Space Invaders', './assets/icon.png', (500, 750))
  controller.run()
Example #9
0
 def setUp(self):
     self.controller = Controller()
 def __init__(self, thread_id, name):
     Thread.__init__(self)
     self.threadID = thread_id
     self.name = name
     self.controller = Controller()
Example #11
0
                np.random.poisson(Globals.mean_arrive_time * 10)) / 10
            time = start_time
            # start_time = float(np.random.exponential(Globals.mean_arrive_time))
            # duration = -Globals.mean_serve_time * np.log(float(np.random.randint(1, 11) / 10))
            duration = float(np.random.exponential(Globals.mean_serve_time))
            customers.append(Request(arrive_time=start_time,
                                     duration=duration))

        if Globals.debug:
            print("准备工作完毕")
            print("已经创建%d个窗口" % len(windows))
            print("已经创建%d个顾客" % len(customers))
            for i in customers:
                print(" %d-客户:到达时间%f:服务时间%f" %
                      (i.get_id(), i.get_arrive_time(), i.get_duration()))

        # 创建控制器
        controller = Controller(outdoors=customers, windows=windows)
        controller.run()
        a = Statistics.wait_time / Globals.max_cus
        b = Statistics.wait_area / Globals.window_number / Globals.cur_time
        c = Statistics.usage_time * 100 / Globals.cur_time / Globals.window_number
        print("%f-第%d遍模拟完成\n" % (Globals.cur_time, k))
        sumA += a
        sumB += b
        sumC += c

    print("平均等待时间=%f,队列平均顾客数=%f,服务器利用率=%d%%" %
          (sumA / times, sumB / times, sumC / times))
exit(0)
Example #12
0
 def setUp(self):
     self.controller = Controller("test")
Example #13
0
#!/usr/bin/env python3

from src.controller import Controller

Controller().run_loop()
Example #14
0
class HelloWorld(BaseGUI):
    def __init__(self, master_window, controller):
        #  calling parent constructor:
        super(HelloWorld, self).__init__(master_window, controller,
                                         "Hello World")

        self.label = Label(self, text="Hello There!")
        # It is important that .grid() is done on a different line as otherwise self.label = None
        self.label.grid(row=1, column=1)

        self.clickbutton = Button(self,
                                  text="CLICK ME",
                                  command=self.on_button_click)
        self.clickbutton.grid(row=2, column=1)

    def on_button_click(self):
        # This switches to SecondFrame
        self.controller.switch_frame("second")

    def update_label(self, new_text):
        self.label['text'] = new_text


if __name__ == "__main__":
    from src.controller import Controller
    # Any testing specific to this class should be done here
    window = Tk()
    app = Controller(window, HelloWorld)
    app.start()
Example #15
0
        self.background_label.place(x=0, y=0, relwidth=1, relheight=1)

        # This imports the photo, then resizes it to be three times as small
        self.photo = PhotoImage(file="facebook.png")
        self.smaller_photo = self.photo.subsample(3, 3)

        # This creates the facebook image as a button
        # This still needs a command
        self.button = Button(self,
                             text='Facebook',
                             image=self.smaller_photo,
                             command=self.on_button_click).pack(side=TOP)

        # This adds another button below saying Facebook, just if they didn't click on the image
        # This still needs a command
        self.fbButton = Button(self, text='Facebook',
                               font=('Verdana', 15)).pack(pady=10, side=TOP)

    def on_button_click(self):
        # This switches to SecondFrame
        self.controller.switch_frame("login2")


if __name__ == "__main__":
    from src.controller import Controller

    # Any testing specific to this class should be done here
    window = Tk()
    app = Controller(window, TkinterImage)
    app.start()
    window.mainloop()
Example #16
0
import json

from src.controller import Controller

if __name__ == "__main__":
    json_data = open("config.json").read()
    config = json.loads(json_data)

    Controller().main(config)
Example #17
0
from src.helloworld_gui import HelloWorld
from tkinter import *
from src.controller import Controller
from src.Tkinter_image import TkinterImage

if __name__ == "__main__":

    # # I've used HelloWorld as an example here, replace this with your own object / code
    # window1 = Tk()
    # HelloWorld(window1)
    # window1.mainloop()
    window = Tk()
    app = Controller(window, "chat")
    app.start()
    window.mainloop()
Example #18
0
 def setUp(self):
     self.controller = Controller('test')
Example #19
0
    def inicializacao(self) -> None:
        view = View()
        model = Model()
        controller = Controller()

        view.iniciar()
Example #20
0
def run_agent(layout: str):
    agent = QAgent(layout=layout, version='1')
    agent.load_q_table()
    controller = Controller(layout_name=layout, act_sound=True, act_state=False, ai_agent=agent)
    controller.load_menu()
Example #21
0
    # compute velocity error in x
    error_dy = 0  # actual_values.dy

    # Control Design (Simple PI Controller)
    #todo resolve get_velocity and get angle error

    picar = Picar()
    # Control Input Velocity
    velocity_output = Picar.get_velocity(
        picar, K_p["vel"] * error_distance +
        K_d["vel"] * error_velocity)  #input meters per seconds output 0-1

    # Control Input Steering Angle
    steering_angle_output = Picar.get_angle(
        picar, K_p["steer"] * error_y +
        K_d["steer"] * error_dy)  #input degree -output virtual degree

    errors = (error_distance, error_velocity, error_y, error_dy)

    return steering_angle_output, velocity_output, errors


PD = Controller(3.0, 1.0, 1.0, 0.1)

(steering_angle, velocity, errors) = PD.get_control_output(desired_values,
                                                           actual_values,
                                                           last_values=None)

print(steering_angle)
print(velocity)
Example #22
0
def initiate_python_parser():
    controller = Controller()
    controller.run_console()
Example #23
0
from src.utils import Utils

from src.view import View
from src.model import Model
from src.controller import Controller

from tests import Tests

if __name__ == '__main__':
    if Utils.verificar_modo_teste():
        tests = Tests()
        tests.iniciar()
    else:
        controller = Controller()
        view = View(controller=controller)
        model = Model(controller=controller)

        controller.segundo_init(model=model, view=view)
        view.segundo_init()
        model.segundo_init()

        controller.iniciar()
Example #24
0
import re
import datetime
from time import sleep

import vk_api.exceptions

from src.resource import VK
from src.database import Database
from src.controller import Controller
from config_parser import Config

config = Config('configs.yaml')

vk = VK(config.vk)
database = Database(config.database)
controller = Controller(config.controller)


def get_data(file_path):
    with open(file_path) as f:
        rows = f.readlines()
        for row in rows:
            yield row.strip()


def handle_date(unixtime):
    value = datetime.datetime.fromtimestamp(unixtime)
    date = value.strftime('%Y-%m-%d %H:%M:%S')
    return date

Example #25
0
from src.controller import Controller

# todo: log

controller = Controller("Linux")
controller.settings.DEBUG = False
controller.theme_manager.add_keyword("Archlinux", 1)
controller.theme_manager.add_ranked_keywords(2, "Open source", "Manjaro",
                                             "Kernel", "Wallpaper")
controller.theme_manager.add_ranked_keywords(3, "Debian", "Gentoo",
                                             "Slackware")
controller.theme_manager.add_ranked_keywords(4, "Python", "Golang")
controller.theme_manager.search_options["face"] = False
controller.image_downloader.download_images(image_nbr=5)
controller.image_comparator.build_app()
controller.image_selector.get_x_pct_best_images(10)
controller.image_selector.delete_x_pct_worst_images(50)
controller.image_comparator.compare_loop()
Example #26
0




if __name__ == "__main__":
    from src.controller import Controller

    pizza_app = Controller()
    pizza_app.mainloop()
Example #27
0
    def __init__(self):
        self.controller = Controller()

        print('iai')
Example #28
0
    (options, args) = optParse.parse_args()

    if len(args) != 1:
        print >> sys.stderr, "only exactly one argument allowed (use option '--help' for info)"
        sys.exit(0)

    inFile = args[0]

    return (inFile, options.outFile, options.keyIndex)


if __name__ == "__main__":

    # create a logfile only when warnings or errors occur
    logging.basicConfig(level=logging.WARNING)
    handler = logging.FileHandler(filename="haw2iCalendar.log", delay=True)
    formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(message)s')
    handler.setFormatter(formatter)
    logging.getLogger("").addHandler(handler)  #add handler to the root logger

    inFile, outFile, keyIndex = parseArgsAndOpts()

    try:
        controller = Controller(inFile, outFile, tupleKeyIndex=keyIndex)
        CommandGui(controller)

    except Exception as e:
        logging.exception(e)
        raise e
Example #29
0
from PySide2.QtWidgets import QApplication
import sys
from src.controller import Controller
from src.view.dialog import CustomDialog

if __name__ == "__main__":
    app = QApplication(sys.argv)

    # creation de la CustomQDialog
    dialog = CustomDialog()
    if dialog.exec_():
        c = Controller(dialog.get_players(), dialog.get_start_money())

    sys.exit(app.exec_())
Example #30
0
 def __init__(self, address, socket):
     super().__init__()
     self.address = address
     self.socket = socket
     self.controller = Controller()