Пример #1
0
# names = ['Димочка', 'Ромс', 'Гандон', 'Сука', 'Пидор']
# names = ['Димочка', 'Ромс', 'Гандон', 'Сука']
# names = ['Миша', 'Леша', 'Яков', 'Саша']
# names = ['Димончик', 'Сука', 'Яков', 'Саша']
# names = ['Димочка', 'Ромс', 'Гандон']
names = ['Димочка', 'Ромс']

WIDTH, HEIGHT, FPS = 0, 0, 60
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)
# WIDTH, HEIGHT, FPS = 800, 600, 60
# screen = pygame.display.set_mode((WIDTH, HEIGHT))

pygame.init()
clock = pygame.time.Clock()

controller = Controller(names, screen)

# import json
# a = {"a": 1, "list": {}}
# output = open("file.txt", "w")
# output.write(json.dumps(a))
# output.close()
# input = open("file.txt", "r")
# b = json.loads(input.readline())
# print(b["list"])
# input.close()
# print(b)
# print(a)

run = True
zooming = False
window.set_title('TestDrawCartograph')


#Canvas Figure display on networkx
fig = Figure(tight_layout=True)
ax = fig.add_subplot(111)

canvas=FigureCanvas(fig)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
window.add(box)
box.pack_start(canvas,True,True,0)


#Init controller
model = md.Model()
controller=CT.Controller(model)

FdessinCarto=D.DrawCartoMap(ax,controller)

#Create a New graph
FdessinCarto.controller.create_new_graph("GraphChronomap")

nodeA=FdessinCarto.controller.create_evenement("outdated research material", "01-01-2016 00:00:00", "01-02-2016 00:00:00", 1, "BLAH BLAH BLAH", "http://")
nodeB= FdessinCarto.controller.create_evenement("Projected tsunami frequency too low", "08-08-2016 00:00:00", "09-10-2016 00:00:00", 1, "OK", "http://")
nodeC=FdessinCarto.controller.create_evenement("EV C", "08-07-2016 00:00:00", "09-08-2016 00:00:00", 1, "HOOOOO", "http://")
nodeD=FdessinCarto.controller.create_evenement("Accident", "08-10-2016 00:00:00", "09-11-2016 00:00:00", 1, "HOOOOO", "http://")


FdessinCarto.controller.create_edge(nodeA,nodeB, "LeLien", "Une mega explosion", "[]")
FdessinCarto.controller.create_edge(nodeB,nodeA, "InverseLien", "Une giga explosion", "[]")
FdessinCarto.controller.create_edge(nodeC,nodeD, "LienTest", "Ceci est un lien test", "[]")
def ControllerTest():
    c = Controller()
    c.play()
#!/usr/local/bin/python3

# The game & controller part of the Tetris AI project
# Followed Tetris game tutorial to do the game: https://www.jianshu.com/p/48f18db71f81

import pygame
import random
import os
import Controller

pygame.init()
controller = Controller.Controller()
CubeWidth = 40  # the width of a square
CubeNumX = 10  # the number of square horizontally
CubeNumY = 20  # the number of square vertically
BoardWidth = CubeWidth * CubeNumX
BoardHeight = CubeWidth * CubeNumY
AdditionalWidth = 200  # the width of infomation (score, level, next shape ...) part
WindowWidth = BoardWidth + AdditionalWidth  # the completed window width, height keep same

# set game window
screen = pygame.display.set_mode((WindowWidth, BoardHeight))  # set the screen
pygame.display.set_caption("Tetris")  # set window name

# set the file root directory to  be current folder
base_folder = os.path.dirname(__file__)

live_cube = None
next_cube = None

# set the format of the text (for score
import Drone
import Controller
import sys
import time
from signal import pause

#here you should interact with the drone
print("booting")

drone1 = Drone.Drone('127.0.0.1', 9000)
controller1 = Controller.Controller(drone1)

while (True):
    time.sleep(0.5)
    if (not controller1.landed):
        controller1.check_roll()
        controller1.check_pitch()

#Diagnostics

#drone1.printinfo()

#drone1.connect()

#drone1.battery()

#Action
Пример #6
0
import Controller, Model, View
from PySide.QtGui import *
from PySide import QtGui

import sys

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    c = Controller.Controller()
    c.show()
    sys.exit(app.exec_())
Пример #7
0
 def post(self):
     post_data = dict(urlparse.parse_qsl(self.request.body))
     c = Controller.Controller()
     self.write(
         c.test_lab(post_data['lab_id'], post_data['lab_src_url'],
                    post_data.get('version', None)))
Пример #8
0
# File: main.py
# Purpose: driver program for the bouncing ball example

import viz

# get access to controller class
from Controller import *

# set size (in pixels) and title of application window
viz.window.setSize(500, 500)
viz.window.setName("Bouncing Ball")

# get graphics window
window = viz.MainWindow
# setup viewing rectangle
window.ortho(-100, 100, -100, 100, -1, 1)
# set background color of window to black
viz.MainWindow.clearcolor(viz.BLACK)
# turn off mouse navigation
viz.mouse(viz.ON)
# center viewpoint
viz.eyeheight(0)

# create a controller object
Controller()

# render the scene in the window
viz.go()
Пример #9
0
        self.assertEqual(my_comp.name, 'Jet-A1')
        self.assertEqual(len(my_comp.structure), 1)
        self.assertEqual(round(my_comp.r_spec, SignificantDigits),
                         round(48.878894767783656, SignificantDigits))
        self.assertEqual(my_comp.mol_wgt, 0.1701)
        self.assertEqual(my_comp.FAR, 1)
        self.assertEqual(my_comp.WGR, 0)


#class TestAddComposition(unittest.TestCase):

#def test_air(self):
#    root = ctr.tk.Tk()
#    root.withdraw()
#    app=ctr.Controller(root)
#    app.view._widgets['fluid_tab']._radio_var.set(1)
#    app.add_composition()
#   self.assertEqual(app.view._widgets['table_composition'].item('end'), 'Air')

#class TestIndependent(unittest.TestCase):

#   def test_empty(self):
#      X = []
#     e = [1, 0]
#    self.assertTrue(is_independent_of(e, X))
#   self.assertTrue(e in X)

if __name__ == '__main__':
    app = ctr.Controller()
    unittest.main()
Пример #10
0
from Controller import *
control = Controller()
control.update()
Пример #11
0
import easygui
from Controller import *
from utils import *
from Engine import *
from View import *
import os

mode = easygui.buttonbox('Choose your mode', 'N Body Simulator',
                         ('Live', 'PreCalc', 'Quick Simul'))
if mode == 'Quick Simul':
    engine = Engine(read_params("default"))
    controller = Controller(engine)
    view = View(controller)
    controller.set_view(view)
    controller.run()

if mode is None:
    exit()
if mode == 'Live':
    nbr_bodies = easygui.integerbox("Choose bodies amount",
                                    lowerbound=1,
                                    upperbound=10000)
    theta = easygui.integerbox("Choose 10 theta", lowerbound=0,
                               upperbound=10) / 10.0
    write_to_file = easygui.ynbox('Do You want to save simulation ?',
                                  'N Body Simulator', ('Yes', 'No'))
    if write_to_file:
        loop = True
        while loop:
            file_name = "simulation/" + easygui.enterbox("Choose file name")
            if file_name[11:] in os.listdir('simulation/'):