예제 #1
0
def view():
    """
    Print Phonebook
    :return: None
    """
    View.view_phonebook(list_with_dict)
    press_any_key()
예제 #2
0
def find():
    """
    Search in Phonebook
    :return: None
    """
    # ввод критериев поиска
    number, fio, street, house = View.what_to_find()
    View.view_phonebook(Business_logic.find(list_with_dict, number, fio, street, house))
    press_any_key()
예제 #3
0
def main(args) :

	app = QApplication(args)
	
	view = View()
	model = Model(view)
	
	view.show()
	
	app.exec_()
예제 #4
0
파일: Controller.py 프로젝트: domin4815/BO
def parseFileAndRun(controller):
    file = controller.file
    print("Parsing input data...")
    pattern = re.compile(r'([0-9]+)')
    solutionsTable = []
    try: # nie umiem pythona
        #plik z instancjami zawiera 10 roznych zestawow danych wejsciowych
        while(file.readline()[0]=='n'): #number of jobs, number of machines, initial seed, upper bound and lower bound :
            str = file.readline()
            out2 = pattern.findall(str)
            controller.jobs_num = int(out2[0])
            controller.machines_num = int(out2[1])
            if controller.iterations == 0:
                controller.iterations = 400
            if controller.step_len == 0:
                controller.step_len = 3
            if controller.cockroaches_num == 0:
                controller.cockroaches_num = 30
            initialSpeed = int(out2[2])
            controller.upperbound = int(out2[3])
            controller.lowerbound = int(out2[4])
            jobsTab = []
            for i in range(controller.jobs_num):
                jobsTab.append([])
            file.readline() #processing times :
            for machineN in range(controller.machines_num):
                str = file.readline()
                jobsTimesOnMachine = pattern.findall(str)
                for jobN in range(controller.jobs_num):
                    jobsTab[jobN].append(int(jobsTimesOnMachine[jobN]))
            controller.jobs = jobsTab
            print("flowshop startuje z parametrami:")
            print("iteracje: ", controller.iterations)
            print("step: ", controller.step_len)
            print("karaluchy: ", controller.cockroaches_num)
            r = flowshop.startFromGUI(controller)
            #robie nowy tylko do podawania ezultatu obliczen
            solutionKeeperControler = ProgramController(controller.iterations,controller.step_len,
                                                        controller.cockroaches_num,controller.jobs_num,
                                                        controller.machines_num,jobsTab)
            solutionKeeperControler.isNehEnabled = controller.isNehEnabled
            solutionKeeperControler.minMakespan = r[0][0]
            solutionKeeperControler.makespanTable = r[0][2]
            solutionKeeperControler.time = r[1]
            solutionKeeperControler.order = r[0][1]
            solutionKeeperControler.best_iteration = \
                solutionKeeperControler.makespanTable.index(solutionKeeperControler.minMakespan)

            solutionsTable.append(solutionKeeperControler)

    except IndexError:
        pass
    for i in xrange(len(solutionsTable)):
        View.presentSolutionsFrame(solutionsTable[i], controller)
        pass
예제 #5
0
def main(args) :

	app = QApplication(args)
	
	view = View()
	model = Model()
	control = Control(view,model)
	
	view.show()
	
	app.exec_()
예제 #6
0
def closeday():
        #Close the program and aggregate values in the list. Call get functions from model to do this
		ReportCall1()
		CRM()
		printCloseSales()
		custID = view.inputCustID()
		model.setCustID(CustID)
		model.setCustomerNAME(custID,name)
		model.setSKU(custID, view.inputSKU())
		model.setCC(custID,view.inputCC())
		model.setSales(custID, view.inputSales())
예제 #7
0
def moveToCam():
    for key in groups:
        if key != "spawners" and key != "HUD":
            for entity in groups[key].sprites():
                v = vars(entity)
                if "posx" in v and "posy" in v:
                    entity.rect.x = int(entity.posx - View.getx())
                    entity.rect.y = int(entity.posy - View.gety())
                else:
                    entity.posx = entity.rect.x
                    entity.posy = entity.rect.y
                    entity.rect.x = int(entity.posx - View.getx())
                    entity.rect.y = int(entity.posy - View.gety())
예제 #8
0
def edit():
    """
    Edit record
    :return: None
    """
    # выбор строчки для редактирования
    key = View.edit_choice()
    # ввод новых значений
    number, fio, street, house = View.new_values()

    if Business_logic.change(list_with_dict, key, number, fio, street, house):
        print("Successfull!")
    else:
        print("Not found!")
    press_any_key()
예제 #9
0
 def __init__(self):
     self.serverCommunication = ServerCommunication(self)
     self.model = Model(self)
     self.view = View(self)
     self.setUpClient()
     self.view.initFrames()
     self.view.root.mainloop()
예제 #10
0
def main(argc,argv):
    # inicializar subsistemas
    # son las cosas minimas necesarias para crear la ventana
    c = Controller()
    v = View((WIDTH,HEIGHT),(90.0, 0.1, 100.0))
    # m = Model(Triangle((5,5,-15),(-5,-5,-15),(5,-5,-15)))
    m = Model(Cube((-5,-5,-5),(5,5,5)))

    # configurar la ventana
    v.init_GL((0.0, 0.5, 0.5, 1.0))
    # Creamos el Shader
    shader_program = Shader("basic_shader")
    shader_program.compile()

    # Configuramos las ubicaciones de los uniformes
    shader_program.uniform_location = {
        "lightPos": glGetUniformLocation(shader_program.program, "lightPos"),
        "lightCol": glGetUniformLocation(shader_program.program, "lightCol")
    }
    # Configuramos las ubicaciones de los atributos
    shader_program.bindAttributeLocation({
        "position": 0,
        "color": 1,
        "normal": 2
    })

    # Le entregamos los shaders a la vista para que los use
    v.useShader(shader_program)

    # Le entregamos el modelo a la vista
    v.model = m

    run = True
    while run:
        # actualizar subsistemas
        dt = c.update()
        m.update(dt)
        v.update(dt)

        run = c.check_close()

    shader_program.delete()

    # cerrar subsistemas
    c.close()
    m.close()
    v.close()
예제 #11
0
class Controller:

    _model = None

    # the view part of the MVC
    _view = None

    def __init__(self, title):

        self._model = Model()
        self._view = View(None, title, controller = self)
        # show it!
        self._view.Show()

        # subscribe to all messages from the Model
        self._subscribeToMessages()


    # uses Publisher to add callback to messages
    def _subscribeToMessages(self):
        pub.subscribe(self.messageSpreadListener, "MESSAGE SPREAD")



    # this function is triggered by a click on the button in the view.
    # It asks the Model to trigger a process, then when this process is done
    # the Model will use a Publisher to reach the view and say "it's done"
    def spreadMessage(self, event):
        self._model.processSomething()



    # when the Model sends a message "MESSAGE SPREAD", this function is called
    def messageSpreadListener(self, message, arg2=None, arg3=None):


        t = "the Model sent this message through a Publisher :\n"
        t = t + message + "\t"

        if(arg2):
             t = t + str(arg2) + "\t"

        if(arg3):
            t = t + str(arg3) + "\t"

        self._view.setText(t)
예제 #12
0
파일: main.py 프로젝트: segonzal/pyVoxel
def main():
	view = View()
	controller = Controller()
	controller.view = view

	chunk_shader = shaderFromFile("shaders/chunk.vert","shaders/chunk.frag")
	chunk_shader.compile()
	chunk_shader.use()
	chunk_shader.setAttribLocation(0,"position")
	chunk_shader.setAttribLocation(1,"color")
	chunk_shader.setAttribLocation(2,"normal")

	view.shader = chunk_shader

	view.reshape()

	chunk = SuperChunk()
	loadHGT(chunk)

	controller.model = view.model = chunk
	view.camera = Camera(25,15,25)

	while controller.running:
		controller.update()
		view.update()

	controller.close()
예제 #13
0
파일: main.py 프로젝트: macjapm/keepaway
class Game:

	def __init__(self, size, frame_rate=60):

		
		self.size=size
		self.frame_rate = frame_rate

		pygame.init()
		self.surface = pygame.display.set_mode(self.size)
		
		self.running = False

		self.clock = pygame.time.Clock()

		self.view = View(frame_rate=frame_rate)
		self.model = Model(view=self.view, size=self.size)
		self.controller = Controller(self.model)

		self.model.addAgent('AI')

	def play(self):
		self.running = True
		self.run()

	def pause(self):
		self.running = False

	def run(self):


		# TODO: modify play/pause/run interaction to easily 
		#    be able to play/pause the game

		while self.running:

			self.controller.getMouseInput()
			
			self.model.step()
			
			self.view.draw(self.surface, self.model)
			
			self.clock.tick(self.view.frame_rate)
			
			pygame.display.flip()
예제 #14
0
def main():
    # вывод приветствия
    print("PHONEBOOK v1.0.4")

    while 1:

        choise = menu()
        if choise == '0':
            break
        elif choise == '1':
            load()
        elif choise == '2':
            save()
        elif choise == '3':
            # вывод телефонной книги
            view()

        elif choise == '4':
            # добавление новой записи
            add()

        elif choise == '5':
            # удаление записи
            delete()

        elif choise == '6':
            # изменение записи
            edit()

        elif choise == '7':
            # поиск по телефонной книге
            find()

        elif choise == '8':
            edit_conf(edit_conf_menu())

        elif choise == '9':
            print(Configparcer.get_config())
            press_any_key()

        else:
            # некорректный выбор
            View.uncorrect()

    print("Thank you!")
예제 #15
0
    def __init__(self, title):

        self._model = Model()
        self._view = View(None, title, controller = self)
        # show it!
        self._view.Show()

        # subscribe to all messages from the Model
        self._subscribeToMessages()
예제 #16
0
def delete():
    """
    Delete record
    :return: None
    """
    # выбор что удалять
    if Business_logic.delete(list_with_dict, View.del_choice()):
        print("Successfull!")
    else:
        print("Not found!")
    press_any_key()
예제 #17
0
파일: mvc.py 프로젝트: Patch67/Graphics
 def __init__(self, name):
     self.root = Tk()
     self.model = Model()
     self.view = View(self, self.root)
     self.__name = name
     self.__filename = ""
     self.stateTools = True
     self.mode = "SELECT"
     self.step = 0  # Used to keep track of mouse presses, i.e. line, circle and rectangle need 2, pline > 1
     self.x = 0  # Previous click coords
     self.y = 0  # Previous click coords
예제 #18
0
def add():
    """
    Add new record
    :return: None
    """
    # ввод новой записи
    new_number, new_fio, new_street, new_house = View.read_new_contact()
    Business_logic.add(list_with_dict, new_number, new_fio, new_street, new_house)

    print("Successfull!")
    press_any_key()
예제 #19
0
    def __init__(self, imFolder, gtFolder):
        self.app = Tkinter.Tk()

        # self.app.style = ttk.Style()
        # self.app.style.theme_use('default')

        self.app.title('Video Annotation')

        self.model = Model(imFolder, gtFolder)

        # init flags
        self.brushSize = 3 #TODO

        self.view = View(self.app)
        self.setCommands()
예제 #20
0
파일: main.py 프로젝트: macjapm/keepaway
	def __init__(self, size, frame_rate=60):

		
		self.size=size
		self.frame_rate = frame_rate

		pygame.init()
		self.surface = pygame.display.set_mode(self.size)
		
		self.running = False

		self.clock = pygame.time.Clock()

		self.view = View(frame_rate=frame_rate)
		self.model = Model(view=self.view, size=self.size)
		self.controller = Controller(self.model)

		self.model.addAgent('AI')
예제 #21
0
 def changeSceneToTournamentFourPlayers(self):
     pygame.mixer.music.stop()
     multiplayerTournamentView = sv.View(self.multiplayerTournamentScene)
     self.changeViewMethod(multiplayerTournamentView)
예제 #22
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import Controller
import View
import Model
import gi
import locale
import os
import gettext
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Atk

if __name__ == '__main__':
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    locale.setlocale(locale.LC_ALL, '')

    LOCALE_DIR = os.path.join(os.path.dirname(__file__), "locale")
    locale.bindtextdomain('FlightBooker', LOCALE_DIR)
    gettext.bindtextdomain('FlightBooker', LOCALE_DIR)
    gettext.textdomain('FlightBooker')

    controller = Controller.Controller(View.View(), Model.Model())
    controller.run_application()
예제 #23
0
from View import *
from Controller import *
from Model import *

# Instantiating the MVC classes of the Dictionary
textInterface = View()	# Class responsible for printing the text interface and receiving inputs
cont = Controller()		# Middleware between View and Model
mod = Model()			# Stores and retrieves database informations

# Establishing the MVC connection between the objects so that they can communicate
textInterface.setControllerPointer(cont)
cont.setModelPointer(mod)
mod.setViewPointer(textInterface)

# Keeps the Home Screen loop until the user wishes to leave the program
mayIQuit = False

while(mayIQuit == False):
	mayIQuit = textInterface.homeScreen()
예제 #24
0
from View import *

v = View()
예제 #25
0
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
#   this list of conditions and the following disclaimer.
# * Redistributions must reproduce the above copyright notice, this list of
#   conditions and the following disclaimer in the documentation and/or other
#   materials provided with the distribution.
# * Neither the name of Caltech nor its operating division, the Jet Propulsion
#   Laboratory, nor the names of its contributors may be used to endorse or
#   promote products derived from this software without specific prior written
#   permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import View

if __name__ == "__main__":
    View.main()
예제 #26
0
def dynamic_drawing(display_crw, display_div, display_acc, i, reward,
                    diversity, accuracy):
    View.dynamicView(display_crw, i, reward)
    View.dynamicView(display_div, i, diversity)
    # dynamicView(displayDivAcc,diversity,accuracy)
    View.dynamicView(display_acc, i, accuracy)
예제 #27
0
파일: mvc.py 프로젝트: Patch67/Graphics
class Controller():

    def __init__(self, name):
        self.root = Tk()
        self.model = Model()
        self.view = View(self, self.root)
        self.__name = name
        self.__filename = ""
        self.stateTools = True
        self.mode = "SELECT"
        self.step = 0  # Used to keep track of mouse presses, i.e. line, circle and rectangle need 2, pline > 1
        self.x = 0  # Previous click coords
        self.y = 0  # Previous click coords

    def get_name(self):
        return self.__name

    def set_name(self, name):
        self.__name = name

    def cmd_new(self):
        if self.model.get_dirty():
            self.cmd_save()
        self.model = Model()
        self.__filename = ""
        self.make_title()
            
    
    def cmd_open(self):
        if self.model.get_dirty():
            '''App has unsaved data so ask user to save it'''
            if self.view.question_box(self.__name, "Do you want to save your work?"):
                self.cmd_save()
        self.__filename = self.view.open_file_dialog()
        if self.__filename != "":
            self.make_title()

    def cmd_save(self):

        if self.__filename != "":  # if app already has a filename simply save else do save as
            tg = TextGroup(self.model.graph,sys.stdout)
            tg.show()
        else:
            self.cmd_save_as()

    def cmd_save_as(self):
        try:
            file = self.view.save_file_dialog(self.__filename)
        except IOError:
            self.view.warning_box(self.__name, "Can't open file %s" % self.__filename)
        else:
            if file:  # if valid file
                # self.model.save(filename)
                tg=TextGroup(self.model.graph, file)
                tg.show()
                self.__filename = file.name
                file.close()
                self.model.set_dirty(False)
                self.make_title()

    def cmd_dirty(self):
        self.cmd_set_dirty(True)

    def cmd_clean(self):
        self.cmd_set_dirty(False)

    def cmd_exit(self):
        if self.model.get_dirty():
            if self.view.question_box(self.__name, "Do you want to save your work?"):
                self.cmd_save()
        self.root.destroy()  # This is tkinter specific

    def cmd_toolbar(self):
        self.view.hide_toolbar()

    def cmd_left_click(self, x, y):
        if self.mode == "LINE":
            if self.step == 0:
                self.x = x
                self.y = y
                self.step += 1
            else:
                print("Line (%d,%d), (%d,%d)" % (self.x, self.y, x, y))
                self.model.add_line(self.x, self.y, x, y)
                self.x = x
                self.y = y
                self.step = 0
        elif self.mode == "CIRCLE":
            if self.step ==0:
                self.x = x
                self.y = y
                self.step += 1
            else:
                print("Circle (%d, %d), %d" % (self.x, self.y, x))
                self.x = x
                self.y = y
                self.step = 0
        elif self.mode == "RECTANGLE":
            if self.step == 0:
                self.x = x
                self.y = y
                self.step += 1
            else:
                print("Rectangle (%d,%d), (%d,%d)" % (self.x, self.y, x, y))
                self.model.add_rectangle(self.x, self.y, x, y)
                self.x = x
                self.y = y
                self.step = 0

    def cmd_right_click(self, x, y):
        # self.view.info_box("User pressed","x %d, y %d" % (x,y))
        self.view.show_context_menu(x, y)

    def cmd_null(self):
        self.view.info_box(self.__name, "Not yet implemented")

    def cmd_set_dirty(self, dirty):
        self.model.set_dirty(dirty)
        self.make_title()

    def cmd_tools(self):
        self.stateTools = not self.stateTools
        if self.stateTools:
            self.view.show_toolbar()
        else:
            self.view.hide_toolbar()

    # Drawing Commands
    def cmd_line(self):
        self.mode = "LINE"
        self.step = 0

    def cmd_circle(self):
        self.mode = "CIRCLE"
        self.step = 0
        
    def cmd_rectangle(self):
        self.mode = "RECTANGLE"
        self.step = 0

    def get_title(self):
        """Makes the title for the Window"""
        if self.model.get_dirty():
            title = "*"
        else:
            title = " "
        title += self.__name
        title += " - " + self.__filename
        return title
    
    def make_title(self):
        self.root.title(self.get_title())
        
    def run(self):
        self.make_title()
        self.root.mainloop()  # This is tkinter specific
예제 #28
0
def CRM():
        #Call the Get functions from model and use the view functions to print a CRM Report
		view.printCRM(model.sumSales())
예제 #29
0
def ReportCall1():
        #Call the Get functions from model and use the view functions to print a report
		view.printReport(model.CashCC())
예제 #30
0
def main():
	temp = 0
	while(temp!=1):
		userinput = input("Please Enter a command > ")
		#Parser starts here
		inputList = []
		inputList = userinput.split()
		#Checks if the user started by inputing the sale price
		if inputList[0] == 'Sale':
			#Checks if the user inputed two values
			#This is for commands like Sale SKU:numeric and Sale Numeric
			
			if len(inputList) == 2:
				#If second entry is numeric it's the sale price
				#Specifically for the Sale Numeric command
				# Example: Sale 100
				if inputList[1].isnumeric():
					model.setSales('Anon12345',float(inputList[1]))
					model.setCustID('Anon12345')
				#If second entry is alphanumeric it's the SKU
				#Specifically for the Sale SKU:numeric command
				# Example command: Sale SKU:12345
				elif inputList[1].isalnum():
					model.setSKU('Anon12345',float(inputList[1].split(':')[1]))
					model.setCustID('Anon12345')
				else:
					view.printError()
			#Checks if the user inputed three values
			#Works with commands like Sale CustID CC, Sale Numeric CustomerID
			#Example commands: Sale Anon12345 CC(this is in $) Separated concern since this stores differently.
			#Example commands: Sale 100 Anon12345
			elif len(inputList) == 3:
				#If third entry is CC adds it to the Credit Card count
				if inputList[2].isnumeric():
					model.setCC(inputList[1],inputList[2])
					#and second one to the Sales
					model.setSales(inputList[1],inputList[2])
					model.setCustID(inputList[1])
				#else dd the second one to the Sales
				elif inputList[2].isalnum():
					model.setSales(inputList[1])
					#and the third one as Customers Name
					model.setCustID(inputList[2])
				else:
					view.printError()
			else:
				view.printError()
		#Checks if the user started by inputing the customer name
		# Example command: customer Naresh Anon12341
		elif inputList[0].lower() == 'customer':
			#assings the third value as customer id
			model.setCustID(inputList[2])
			model.setCustomerName(inputList[2],inputList[1])
		#Checks if the user wants to close the sales for that day
		#Example command: close day
		elif inputList[0].lower() == 'close day':
			closeday()
		#Checks if the user wants to print the sales for that day with cash or CC breakdwon
		#Example command: report
		elif inputList[0].lower() == 'report':
			ReportCall1()
		#Checks if the user want to print the sale for that day by client
		#Example command: crm
		elif inputList[0].lower() == 'crm':
			CRM()
		#Example command: help
		elif inputList[0].lower() == 'help':
			view.printCommandList()
		else:
			view.printError()
예제 #31
0
파일: Controller.py 프로젝트: domin4815/BO
            solutionKeeperControler.best_iteration = \
                solutionKeeperControler.makespanTable.index(solutionKeeperControler.minMakespan)

            solutionsTable.append(solutionKeeperControler)

    except IndexError:
        pass
    for i in xrange(len(solutionsTable)):
        View.presentSolutionsFrame(solutionsTable[i], controller)
        pass


if __name__ == '__main__':
    controller = ProgramController(100,4,30,15,3,[])
                                # iterations, step, cs, jobs, mach, jobsTab):
    View.allInOneFrame(controller, solution=controller)
    # while(controller.launch_again):
    #     controller.launch_again = False
    #     View.inputChooserFrame(controller)
    #     if not controller.exit_now: #gdy ktos nie wprowadzil danych
    #         if(controller.file != None):
    #             parseFileAndRun(controller)
    #         else:
    #             print("flowshop startuje z parametrami:")
    #             print("iteracje: ", controller.iterations)
    #             print("step: ", controller.step_len)
    #             print("karaluchy: ", controller.cockroaches_num)
    #             r = flowshop.startFromGUI(controller)
    #             controller.makespanTable = r[0][2]
    #             controller.time = r[1]
    #             controller.order = r[0][1]
예제 #32
0
# Initialize the interface #
interface = Interface(640, 695, 100, 600, "F.I.R.E. -MAIN(0.1) TEST-", 100)
interface.build()
pygame.init()
############################
GPIO.setmode(GPIO.BOARD)  # BOARD!!!
############################
# Initialize the devices   #
motorController = MotorController(
    12, 29, 31, 33, 35, 26,
    100)  #ENA,IN1,IN2,IN3,IN4,ENB,Velocity(from 0 to 100)
ultrasoundSensorL = UltrasoundSensor(5, 3)  #TRIGG,ECHO
ultrasoundSensorF = UltrasoundSensor(11, 7)  #TRIGG,ECHO
ultrasoundSensorR = UltrasoundSensor(15, 13)  #TRIGG,ECHO
view = View(
    23, 21
)  #LRServo,UDServo     [servoLR = ServoMotor(23)YELLOW, servoUD = ServoMotor(21)YELLOW]
tempHumL = TempHumSensor(8)  #DATA
tempHumR = TempHumSensor(10)  #DATA
infraRedSen = IRSensor(19)  #DATA
cannon = Cannon(37)  #Transistor sign pin -> WE MUST DEFINE THIS CLASS!!!!
webcam = WebCam()
############################

#-#-#    MAIN  LOOP    #-#-#
textMov = 'MOVING: STOP'
textView = 'VIEW: CENTER'
textCannon = 'CANNON: STOPPED'
textTempL = '_'
textTempR = '_'
textDistL = '_'
예제 #33
0
def start():

  # disable logger warningss
  logger = avango.gua.nodes.Logger(EnableWarning = False)

  # get the server ip
  server_ip = str(sys.argv[1])

  # get the workspace config file #
  workspace_config_file = str(sys.argv[2])
  exec('from ' + workspace_config_file.replace("/", ".").replace(".py", "") + ' import displays', globals())

  # get the workspace id
  workspace_id = int(sys.argv[3])

  # get the display group id
  display_group_id = int(sys.argv[4])

  # get the screen id
  screen_id = int(sys.argv[5])

  # get the display name
  display_name = str(sys.argv[6])

  # get own hostname
  hostname = open('/etc/hostname', 'r').readline()
  hostname = hostname.strip(" \n")

  print("This client is running on", hostname, "and listens to server", server_ip)
  print("It is responsible for workspace", workspace_id, ", display group", display_group_id, "and screen", screen_id)

  # preload materials and shading models
  avango.gua.load_shading_models_from("data/materials")
  avango.gua.load_materials_from("data/materials")
  
  # create distribution node
  nettrans = avango.gua.nodes.NetTransform(
                Name = "net",
                # specify role, ip, and port
                Groupname = "AVCLIENT|{0}|7432".format(server_ip)
                )

  # create a dummy scenegraph to be extended by distribution
  graph = avango.gua.nodes.SceneGraph(Name = "scenegraph")

  graph.Root.value.Children.value = [nettrans]

  # create material updaters as this cannot be distributed
  avango.gua.load_shading_models_from("data/materials")
  avango.gua.load_materials_from("data/materials")
  
  timer = avango.nodes.TimeSensor()
  
  water_updater = ClientMaterialUpdaters.TimedMaterialUniformUpdate()
  water_updater.MaterialName.value = "data/materials/Water.gmd"
  water_updater.UniformName.value = "time"
  water_updater.TimeIn.connect_from(timer.Time)

  '''
  # PLOD Stuff
  _loader = avango.gua.nodes.PLODLoader()
  _loader.UploadBudget.value = 256
  _loader.RenderBudget.value = 4*1024
  _loader.OutOfCoreBudget.value = 24*1024

  
  # Valcamonica
  _path = "/mnt/pitoti/KDN_LOD/PITOTI_KDN_LOD/01_SFM-Befliegung_Seradina_PointCloud/" # opt path
  #_path = "/media/SSD_500GB/CONVERTED_Seradina_Parts/" # ssd path 

  _node = _loader.create_geometry_from_file("seradina1_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_01.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("seradina2_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_02.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("seradina3_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_03.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("seradina4_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_04.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)    
  _node = _loader.create_geometry_from_file("seradina5_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_05.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina6_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_06.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina7_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_07.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina8_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_08.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina9_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_09.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina10_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_10.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina11_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_11.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina12_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_12.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina13_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_13.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina14_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_14.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina15_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_15.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  _node = _loader.create_geometry_from_file("seradina16_", "/mnt/pitoti/Seradina_FULL_SCAN/Parts/sera_part_16.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)            
  
  # seradina rock
  _path = "/mnt/pitoti/XYZ_ALL/new_pitoti_sampling/" # opt path
  #_path = "/media/SSD_500GB/Pitoti_Resampled/" # ssd path
  _node = _loader.create_geometry_from_file("rock", _path + "TLS_Seradina_Rock-12C.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  
  # seradina pitoti
  _node = _loader.create_geometry_from_file("pitoti1", _path + "Area-1_Warrior-scene_P01-1.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti2", _path + "Area-1_Warrior-scene_P01-2.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti3", _path + "Area-1_Warrior-scene_P01-3.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti4", _path + "Area-1_Warrior-scene_P01-4.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti5", _path + "Area-1_Warrior-scene_P02-1.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti6", _path + "Area-1_Warrior-scene_P02-2.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti7", _path + "Area-1_Warrior-scene_P02-3.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti8", _path + "Area-1_Warrior-scene_P02-4.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti9", _path + "Area-1_Warrior-scene_P03-1.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti10", _path + "Area-1_Warrior-scene_P03-2.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti11", _path + "Area-1_Warrior-scene_P03-3.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti12", _path + "Area-1_Warrior-scene_P03-4.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)

  _node = _loader.create_geometry_from_file("pitoti13", _path + "Area-2_Plowing-scene_P01-1.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti14", _path + "Area-2_Plowing-scene_P01-2.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)  
  _node = _loader.create_geometry_from_file("pitoti15", _path + "Area-2_Plowing-scene_P01-3.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)  
  _node = _loader.create_geometry_from_file("pitoti16", _path + "Area-2_Plowing-scene_P01-4.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti17", _path + "Area-2_Plowing-scene_P02-1.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti18", _path + "Area-2_Plowing-scene_P02-2.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)  
  _node = _loader.create_geometry_from_file("pitoti19", _path + "Area-2_Plowing-scene_P02-3.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)  
  _node = _loader.create_geometry_from_file("pitoti20", _path + "Area-2_Plowing-scene_P02-4.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
    
  _node = _loader.create_geometry_from_file("pitoti21", _path + "Area-10_Hunting_Scene_P01.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti22", _path + "Area-10_Hunting_Scene_P02.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti23", _path + "Area-10_Hunting_Scene_P03.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)    

  _node = _loader.create_geometry_from_file("pitoti24", _path + "Area-6_house_P01.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti25", _path + "Area-6_house_P02.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)  

  _node = _loader.create_geometry_from_file("pitoti26", _path + "Area-3_Archers_P01.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)
  _node = _loader.create_geometry_from_file("pitoti27", _path + "Area-3_Archers_P02.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)    
  
  _node = _loader.create_geometry_from_file("pitoti28", _path + "Area_4_hunter_with_bow.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)

  _node = _loader.create_geometry_from_file("pitoti29", _path + "Area-5_hunter_with_speer_P01.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)              
  _node = _loader.create_geometry_from_file("pitoti30", _path + "Area-5_hunter_with_speer_P02.kdn", avango.gua.PLODLoaderFlags.DEFAULTS)      
  # END PLOD stuff
  '''

  # get the display instance
  for _display in displays:
    if _display.name == display_name:
      handled_display_instance = _display

  # create a viewer
  viewer = avango.gua.nodes.Viewer()

  # Create a view for each displaystring (= slot)
  _string_num = 0
  views = []

  for _displaystring in handled_display_instance.displaystrings:

    _view = View()
    _view.my_constructor(graph, 
                         viewer,
                         handled_display_instance, 
                         workspace_id,
                         display_group_id,
                         screen_id,
                         _string_num)
    views.append(_view)
    _string_num += 1

  viewer.SceneGraphs.value = [graph]

  # create client portal manager
  portal_manager = ClientPortalManager()
  portal_manager.my_constructor(graph, views)

  shell_client = GuaVE()
  shell_client.start(locals(), globals())

  # start rendering process
  viewer.run()
예제 #34
0
def execute(name_dataset=str(sys.argv[1]),
            name_algorithm=str(sys.argv[2]),
            horizon=int(sys.argv[3])):
    # seed = 0
    # random.seed(seed)
    # np.random.seed(seed)

    store_data = data_store(name_dataset)

    (dContexts, nbArms, arms, contexts, ratings, nbArms, nbContexts, nbPred,
     dArms) = store_data

    m1 = Model(name_algorithm, horizon, arms, contexts, ratings)

    View.displayDataInformations(nbArms, nbContexts, nbPred, dContexts,
                                 horizon)
    View.displayAlgorithmInformations(name_algorithm, m1.model)

    nb_instances = len(m1.model.contexts)

    # print(str(nb_instances))
    reward = 0
    acc = []
    rwd = []
    div = []
    trial = range(1, m1.model.horizon + 1)

    # for j in range (1,self.horizon+1):
    #    trial.append(int(j))

    if sys.argv[4] == "dynamic":
        set_dyn = set_dynamic_drawing(horizon,
                                      View.nameProcessing(name_algorithm),
                                      name_dataset)
        display_crw = set_dyn[0]
        display_div = set_dyn[1]
        display_acc = set_dyn[2]
    for i in range(m1.model.horizon):
        View.displayRound(i)
        data = run(m1, m1.model, nb_instances, reward, acc, i, trial, rwd,
                   store_data, div)
        acc = data[1]
        reward = data[3]
        rwd = data[4]
        div = data[5]
        diversity = data[6]
        accuracy = reward / (i + 1)
        if sys.argv[4] == "dynamic":
            dynamic_drawing(display_crw, display_div, display_acc, i, reward,
                            diversity, accuracy)

    d2 = "2D"
    d3 = "3D"
    null_tab = []
    # View accuracy evolution over rounds
    View.viewGraphic(data[0], trial, acc, null_tab, "Accuracy",
                     "Accuracy evolution over trials", d2)

    # View Cumulative Reward evolution over rounds
    View.viewGraphic(data[3], trial, rwd, null_tab, "Cumulative reward",
                     "Cumulative reward evolution over trials", d2)

    # View Diversity evolution over rounds
    View.viewGraphic(data[6], trial, div, null_tab, "Diversity",
                     "Diversity evolution over trials", d2)

    # viewGraphic(str(data[6])+"-"+str(data[0]),acc,div,"Accyracy-Diversity","Diversity evolution over trials")

    # View Accuracy-Diversity evolution over rounds
    View.viewGraphic(
        str(data[6]) + "-" + str(data[0]), trial, div, acc,
        "Diversity-Accuracy", "Diversity-Accuracy over trials", d3)
예제 #35
0
 def __init__(self, saldomaq):
     self.saldomaquina = saldomaq
     self.v = View()
     self.cartao = Cartao()
예제 #36
0
    def __init__(self, parent=None):
        """
        Konstrukotr der Klasse MyController
        """

        super().__init__(parent)
        self.myForm = View.Ui_MainWindow()
        self.dbcon = view_database.Ui_MainWindow()

        self.myForm.setupUi(self)
        self.model = QtGui.QStandardItemModel(self)

        self.centralwidget = QtGui.QWidget(self)
        self.centralwidget.setObjectName("centralwidget")
        self.tableView = QtGui.QTableView(self.centralwidget)
        self.tableView.setGeometry(QtCore.QRect(0, 0, 981, 581))
        self.tableView.setModel(self.model)
        self.tableView.setObjectName("tableView")
        self.setCentralWidget(self.centralwidget)

        self.undoStack = QUndoStack()

        self.copyAct = CopyAction("&Copy", self.tableView,
                               shortcut=QKeySequence.Copy,
                               undoStack=self.undoStack,
                               statusTip="Kopieren")
        self.pasteAct = PasteAction("&Paste", self.tableView,
                                 shortcut=QKeySequence.Paste,
                                 undoStack=self.undoStack,
                                 statusTip="Einfügen")
        self.cutAct = CutAction("&Cut", self.tableView,
                                 shortcut=QKeySequence.Cut,
                                 undoStack=self.undoStack,
                                 statusTip="Ausschneiden")
        self.rowAct = AddRowAction("&Add Row", self.tableView,
                                 shortcut='',
                                 undoStack=self.undoStack,
                                 statusTip="Zeile Einfügen")
        self.delAct = DeleteAction("&Delete Row", self.tableView,
                                 shortcut='',
                                 undoStack=self.undoStack,
                                 statusTip="Zeile Löschen")
        self.dupAct = DuplicateAction("&Duplicate Row", self.tableView,
                                 shortcut='',
                                 undoStack=self.undoStack,
                                 statusTip="Zeile Duplizieren")

        self.undoAction = self.undoStack.createUndoAction(self, self.tr("&Undo"))
        self.undoAction.setShortcuts(QKeySequence.Undo)
        self.undoAction.setStatusTip("undo the last action")
        self.redoAction = self.undoStack.createRedoAction(self, self.tr("&Redo"))
        self.redoAction.setShortcuts(QKeySequence.Redo)
        self.redoAction.setStatusTip("redo the last action")


        self.f = File(self,self.model)
        QtCore.QObject.connect(self.myForm.actionOpen, QtCore.SIGNAL("activated()"), self.f.openFile)
        QtCore.QObject.connect(self.myForm.actionSave, QtCore.SIGNAL("activated()"), self.f.safeFile)
        QtCore.QObject.connect(self.myForm.actionSave_As, QtCore.SIGNAL("activated()"), self.f.safeFileAs)
        QtCore.QObject.connect(self.myForm.actionNew, QtCore.SIGNAL("activated()"), self.f.newFile)
        QtCore.QObject.connect(self.myForm.actionConnect, QtCore.SIGNAL("activated()"),self.db)




        self.myForm.menuEdit.addAction(self.undoAction)
        self.myForm.menuEdit.addAction(self.redoAction)
        self.myForm.menuEdit.addSeparator()
        self.myForm.menuEdit.addAction(self.cutAct)
        self.myForm.menuEdit.addAction(self.copyAct)
        self.myForm.menuEdit.addAction(self.pasteAct)
        self.myForm.menuEdit.addSeparator()
        self.myForm.menuEdit.addAction(self.rowAct)
        self.myForm.menuEdit.addAction(self.delAct)
        self.myForm.menuEdit.addAction(self.dupAct)
예제 #37
0
import tkinter as tk
import View

# This is the starting point of the application

# Please run this file to start the project

window = tk.Tk()

interface = View.Interface(window)

window.mainloop()
예제 #38
0
def view():
    import View
    return View.View()
예제 #39
0
def start():

    # disable logger warningss
    logger = avango.gua.nodes.Logger(EnableWarning=False)

    # get the server ip
    server_ip = str(sys.argv[1])

    # get the workspace config file #
    workspace_config_file = str(sys.argv[2])
    exec("from " + workspace_config_file.replace("/", ".").replace(".py", "") + " import displays", globals())

    # get the workspace id
    workspace_id = int(sys.argv[3])

    # get the display group id
    display_group_id = int(sys.argv[4])

    # get the screen id
    screen_id = int(sys.argv[5])

    # get the display name
    display_name = str(sys.argv[6])

    # get own hostname
    hostname = open("/etc/hostname", "r").readline()
    hostname = hostname.strip(" \n")

    print("This client is running on", hostname, "and listens to server", server_ip)
    print("It is responsible for workspace", workspace_id, ", display group", display_group_id, "and screen", screen_id)

    # preload materials and shading models
    avango.gua.load_shading_models_from("data/materials")
    avango.gua.load_materials_from("data/materials")

    # create distribution node
    nettrans = avango.gua.nodes.NetTransform(
        Name="net",
        # specify role, ip, and port
        Groupname="AVCLIENT|{0}|7432".format(server_ip),
    )

    # create a dummy scenegraph to be extended by distribution
    graph = avango.gua.nodes.SceneGraph(Name="scenegraph")
    graph.Root.value.Children.value = [nettrans]

    # create material updaters as this cannot be distributed
    avango.gua.load_shading_models_from("data/materials")
    avango.gua.load_materials_from("data/materials")

    # prepare_volume()
    prepare_medieval()
    # prepare_pitoti()

    # get the display instance
    for _display in displays:
        if _display.name == display_name:
            handled_display_instance = _display

    # create a viewer
    viewer = avango.gua.nodes.Viewer()

    # Create a view for each displaystring (= slot)
    _string_num = 0
    views = []

    for _displaystring in handled_display_instance.displaystrings:

        _view = View()
        _view.my_constructor(
            graph, viewer, handled_display_instance, workspace_id, display_group_id, screen_id, _string_num
        )
        views.append(_view)
        _string_num += 1

    viewer.SceneGraphs.value = [graph]

    # create client portal manager
    portal_manager = ClientPortalManager()
    portal_manager.my_constructor(graph, views)

    shell_client = GuaVE()
    shell_client.start(locals(), globals())

    # start rendering process
    viewer.run()
예제 #40
0
class Maquina:
    def __init__(self, saldomaq):
        self.saldomaquina = saldomaq
        self.v = View()
        self.cartao = Cartao()

    def monitoracartao(self):
        self.cardId = self.cartao.cardIdentifier
        if self.cardId == None:
            self.v.mensagemCartao(True)
        else:
            self.v.mensagemCartao(False)
            pass

    def inputSenhaUser(self):
        self.senha = self.v.campoDeSenha()

    def login(self):
        self.loguser = Login(senha)
        self.loguser.verificaSenha()
        self.loguser.atualizaChances()
        self.loguser.validaCartao()

    def lancaMenuDeOpçoes(self):
        b = self.v.botaoSaldo()
        s = self.v.botaoSaque()
        c = self.v.botaoCancel()
        if b == True:
            self.opcaoSaldo()
        if s == True:
            self.opcaoSaque()
        if c == True:
            self.opcaoCancela()

    def opcaoSaldo(self):
        self.saldocartao = self.cartao.enviaSaldo()
        self.v.campoDeSaldo(self.saldocartao)

    def opcaoSaque(self):
        self.saldocartao = self.cartao.enviaSaldo()
        self.valorSaque = self.v.campoDeSaque()
        if self.saldocartao >= self.valorSaque:
            if self.saldomaquina >= self.valorSaque:
                self.ejetaValor()


    def ejetaValor(self):
        self.saldomaquina -= self.valorSaque
        self.saldocartao -= self.valorSaque
        self.cartao.atualizaSaldo(self.saldocartao)

    def opcaoCancela(self):
        self.monitoracartao()
예제 #41
0
import time
import RPi.GPIO as GPIO

# Initialize the interface #
interface = Interface(640,695,100,600,"F.I.R.E. -MAIN_AUTO(0.1) TEST-",100)
interface.build()
pygame.init()
############################
GPIO.setmode(GPIO.BOARD)   # BOARD!!!
############################
# Initialize the devices   #
motorController = MotorController(12,29,31,33,35,26,100) #ENA,IN1,IN2,IN3,IN4,ENB,Velocity(from 0 to 100) 
ultrasoundSensorL = UltrasoundSensor(5,3) #TRIGG,ECHO
ultrasoundSensorF = UltrasoundSensor(11,7) #TRIGG,ECHO
ultrasoundSensorR = UltrasoundSensor(15,13) #TRIGG,ECHO
view = View(23,21) #LRServo,UDServo     [servoLR = ServoMotor(23)YELLOW, servoUD = ServoMotor(21)YELLOW]   
tempHumL = TempHumSensor(8) #DATA
tempHumR = TempHumSensor(10) #DATA
irSensor = IRSensor(19) #DATA
cannon = Cannon(37)
webcam = WebCam()
############################

#-#-#    MAIN  LOOP    #-#-#
textMov = 'MOVING: STOP'
textView = 'VIEW: CENTER'
textCannon = 'CANNON: STOPPED'
textTempL = '_'
textTempR = '_'
textDistL = '_'
textDistF = '_'
 def backFromMultiplayer(self):
     startView = sv.View(self.startScene)
     self.changeViewMethod(startView)
예제 #43
0
            node_dict['drawing'] = {}
            node_dict['drawing']['x'] = node.d_posx
            node_dict['drawing']['y'] = node.d_posy
            node_dict['drawing']['color'] = node.d_color
            node_dict['drawing']['size'] = node.d_size
            node_dict['drawing']['border'] = node.d_border
            node_dict['drawing']['order'] = node.d_order
        return node_dict

    def get_closeness_centrality(self):
        return self.model.compute_closeness_centrality()

    def get_betweeness_centrality(self):
        return self.model.compute_betweeness_centrality()

    def clear_remote(self, node):
        del node.__ogm__.node.__remote__


if __name__ == '__main__':
    # Init Model
    MainModel = md.Model()

    # Init Controller
    MainController = Controller(MainModel)

    # Init View
    MainView = vw.View(MainController, V.ViewHandler)

    # Program Running.
예제 #44
0
파일: TAppClass.py 프로젝트: dmikam/python
 def __init__(this):
     Tk.__init__(this)
     this.geometry("750x500+300+300")
     this.layout = View.TLayout(this)
예제 #45
0
	def spinning_wheel(self, **args):
		v = View.View()
		spinnerFile = self.templateVars.get('spinnerFile')
		buffer = v.getSpinningWheel(spinnerFile)
		cherrypy.response.headers['Content-Type'] = 'image/gif'
		return buffer.getvalue()
예제 #46
0
파일: Controller.py 프로젝트: kburd/Ripple

def setup_logger(name, log_file, formatter, level=logging.INFO):
    """Function setup as many loggers as you want"""

    handler = logging.FileHandler(log_file)
    handler.setFormatter(formatter)
    logger = logging.getLogger(name)
    logger.setLevel(level)
    logger.addHandler(handler)

    return logger


# model = Model()
view = View()
path = os.path.dirname(__file__)
now = datetime.datetime.now()
serverFormat = logging.Formatter('%(levelname)s - %(message)s')
serverLog = setup_logger('server',
                         'log/server_{}.log'.format(now.strftime('%Y_%m_%d')),
                         serverFormat)
errorFormat = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
errorLog = setup_logger('error',
                        'log/error_{}.log'.format(now.strftime('%Y_%m_%d')),
                        errorFormat, logging.DEBUG)


#errorLog = logging.basicConfig(filename='log/error.txt',level=log.DEBUG)
#errorFormat = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
#errorLog.setFormatter(errorFormat)
예제 #47
0
 def changeSceneToMultiplayer(self):
     multiplayerView = sv.View(self.multiplayerScene)
     self.changeViewMethod(multiplayerView)
예제 #48
0
 def backFromMultiplayerPlayerMenu(self):
     multiplayerView = sv.View(self.multiplayerScene)
     self.changeViewMethod(multiplayerView)
예제 #49
0
'''
Created on Jul 13, 2014

@author: Jason Guo E-mail: [email protected]
'''
import View

if __name__ == '__main__':
    main = View.Main()
예제 #50
0
# Author: Rafael Stauffer [email protected]
# Version: 0.5.1

import os
from pathlib import Path
from sys import platform
import tkinter
import View

if platform == "linux":
    # linux
    DOM_DATA_DIRECTORY = str(Path.home()) + "/.dominions5/"
    DOM_EXE = str(Path.home()
                  ) + "/.local/share/Steam/steamapps/common/Dominions5/dom5.sh"
elif platform == "darwin":
    # OS X
    DOM_DATA_DIRECTORY = str(Path.home()) + "/.dominions5/"
    DOM_EXE = str(Path.home()
                  ) + "/.local/share/Steam/steamapps/common/Dominions5/dom5.sh"
elif platform == "win32":
    # Windows
    DOM_DATA_DIRECTORY = os.path.expandvars(r'%APPDATA%\\Dominions5\\')
    DOM_EXE = "\"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Dominions5\\Dominions5.exe\""

if __name__ == '__main__':
    window = tkinter.Tk()
    window.title("lomo de llama")
    window.geometry("500x500")
    View.ManagerFrame(window)
    window.mainloop()
예제 #51
0
	def viewFile(self, evt):
		if self.currentFile != None:
			if self.currentFile.hasData():
				view = View(self)
				view.giveData(self.currentFile.data)
예제 #52
0
 def __init__(self):
     self.model = Model.Model(self)
     self.view = View.View(self)
예제 #53
0
	def index(self):
		v = View.View()
		template = jinja2.Template(v.getHTML())
		return template.render( self.templateVars )
예제 #54
0
import Controller as C
import Model as M
import View as V

controller = C.Controller(M.Model(), V.View())
controller.start()
예제 #55
0
파일: Main.py 프로젝트: pamhrituc/AI
from Model import *
from Controller import *
from View import *
#print(readTemp("temperature.in"))

model = Model()
ctrl = Controller(model)
view = View(ctrl)
view.run()
예제 #56
0
 def __init__(self):
     self.V = View(520, 600)
     self.V.init()
예제 #57
0
from View import *

root = Tk()
main = View(root)

while True:
    root.update_idletasks()
    root.update()
    main.update()
    main.render()
    root.after(1)
예제 #58
0
	def __init__(self,templateVars=None, 
		title="", 
		inputs=[], 
		outputs=[], 
		controls=[], 
		tabs=None,
		spinnerFile=None,
		getJsonDataFunction=None, 
		getDataFunction=None, 
		getTableFunction=None, 
		getPlotFunction=None, 
		getImageFunction=None, 
		getD3Function=None, 
		getCustomCSSFunction=None, 
		getCustomJSFunction=None,
		getCustomHeadFunction=None, 
		getHTMLFunction=None,  
		getDownloadFunction=None, 
		noOutputFunction=None,
		storeUploadFunction=None,
		prefix='/'):

		# populate template dictionary for creating input,controler, and output HTML and javascript
		if templateVars is not None:
			self.templateVars = templateVars
		else:
			self.templateVars = {}
			self.templateVars['title'] = title
			if prefix[-1] == '/':
				self.templateVars['prefix'] = prefix[:-1]
			else:
				self.templateVars['prefix'] = prefix
			# necessary to ensure that spyre apps prior to version 0.2.0 still work
			for input in inputs:
				if 'input_type' in input:
					input['type'] = input['input_type']
				if 'variable_name' in input:
					input['key'] = input['variable_name']
				if 'linked_variable_name' in input:
					input['linked_key'] = input['linked_variable_name']
				if 'linked_variable_type' in input:
					input['linked_type'] = input['linked_variable_type']
			self.templateVars['inputs'] = inputs
			for control in controls:
				if 'control_type' in control:
					control['type'] = control['control_type']
				if 'control_id' in control:
					control['id'] = control['control_id']
			self.templateVars['controls'] = controls
			for output in outputs:
				if 'output_type' in output:
					output['type'] = output['output_type']
				if 'output_id' in output:
					output['id'] = output['output_id']
			self.templateVars['outputs'] = outputs
			if tabs is not None:
				self.templateVars['tabs'] = tabs
			if spinnerFile is not None:
				self.templateVars['spinnerFile'] = spinnerFile
		self.defaultTemplateVars = self.templateVars

		self.getJsonData = getJsonDataFunction
		self.getData = getDataFunction
		self.getTable = getTableFunction
		self.getPlot = getPlotFunction
		self.getImage = getImageFunction
		self.getD3 = getD3Function
		self.getCustomJS = getCustomJSFunction
		self.getCustomCSS = getCustomCSSFunction
		self.getCustomHead = getCustomHeadFunction
		self.getHTML = getHTMLFunction
		self.noOutput = noOutputFunction
		self.getDownload = getDownloadFunction
		self.storeUpload = storeUploadFunction
		d3 = self.getD3()
		custom_js = self.getCustomJS()
		custom_css = self.getCustomCSS()
		custom_head = self.getCustomHead()

		self.templateVars['d3js'] = d3['js']
		self.templateVars['d3css'] = d3['css']
		self.templateVars['custom_js'] = custom_js
		self.templateVars['custom_css'] = custom_css
		self.templateVars['custom_head'] = custom_head

		v = View.View()
		self.templateVars['document_ready_js'] = ""
		self.templateVars['js'] = v.getJS()
		self.templateVars['css'] = v.getCSS()

		self.upload_file = None
def start():

  # disable logger warningss
  logger = avango.gua.nodes.Logger(EnableWarning = False)

  # get the server ip
  server_ip = str(sys.argv[1])

  # get the platform id
  platform_id = int(sys.argv[2])

  # get the display name
  display_name = str(sys.argv[3])

  # get the screen number on platform
  screen_num = int(sys.argv[4])

  # get own hostname
  hostname = open('/etc/hostname', 'r').readline()
  hostname = hostname.strip(" \n")

  print "This client is running on", hostname, "and listens to server", server_ip
  print "It is responsible for platform", platform_id, "and display", display_name

  # create distribution node
  nettrans = avango.gua.nodes.NetTransform(
                Name = "net",
                # specify role, ip, and port
                Groupname = "AVCLIENT|{0}|7432".format(server_ip)
                )

  # create a dummy scenegraph to be extended by distribution
  graph = avango.gua.nodes.SceneGraph(Name = "scenegraph")
  graph.Root.value.Children.value = [nettrans]

  # create material updaters as this cannot be distributed
  avango.gua.load_shading_models_from("data/materials")
  avango.gua.load_materials_from("data/materials")

  timer = avango.nodes.TimeSensor()

  water_updater = ClientMaterialUpdaters.TimedMaterialUniformUpdate()
  water_updater.MaterialName.value = "data/materials/Water.gmd"
  water_updater.UniformName.value = "time"
  water_updater.TimeIn.connect_from(timer.Time)

  # get the display instance
  for _display in displays:
    if _display.name == display_name:
      handled_display_instance = _display

  # create a viewer
  viewer = avango.gua.nodes.Viewer()

  if handled_display_instance.shutter_timings == []:
    stereo = False
  else:
    stereo = True

  # Create a view for each displaystring (= slot)
  _string_num = 0
  views = []

  for _displaystring in handled_display_instance.displaystrings:
    _view = View()
    _view.my_constructor(graph, 
                         viewer,
                         platform_id, 
                         _string_num,
                         handled_display_instance, 
                         screen_num, 
                         stereo)
    views.append(_view)
    _string_num += 1

  viewer.SceneGraphs.value = [graph]

  # start rendering process
  viewer.run()