Example #1
0
def mainMenu():
	menuPos = [0, 30]
	level = 1
	profiles = [Profiles.Profile(getConst("PROFILES")[0], 1), Profiles.Profile(getConst("PROFILES")[1], 2)]
	_done = False
	drawMainMenu(profiles, menuPos)
	while not _done:
		for ev in pygame.event.get():
			if ev.type == QUIT or (ev.type == KEYDOWN and ev.key == K_ESCAPE):
				_done = True
			elif ev.type == MOUSEBUTTONDOWN:
				for i in [0, 1]:
					if buttonHit(ev.pos, ([menuPos[0] + 50 + 175 * i, menuPos[1] + 60], [menuPos[0] + 175 + 175 * i, menuPos[1] + 60 + 30])):
						result = profileMenu(profiles[i])
						if result == "QUIT":
							_done = True
						drawMainMenu(profiles, menuPos)
				if buttonHit(ev.pos, ([menuPos[0] + 160, menuPos[1] + 20], [menuPos[0] + 240, menuPos[1] + 50])):
					if playGame(1, profiles) == "QUIT":
						_done = True
					drawMainMenu(profiles, menuPos)
				elif buttonHit(ev.pos, ([menuPos[0] + 180, menuPos[1] + 60], [menuPos[0] + 220, menuPos[1] + 90])):
					if playGame("VS", profiles) == "QUIT":
						_done = True
					drawMainMenu(profiles, menuPos)
				else:
					if menuPos[0] + 23 < ev.pos[0] <= menuPos[0] + 383 and menuPos[1] + 100 <= ev.pos[1] <= menuPos[1] + 100 + 36 * 3 \
					and (ev.pos[0] - 23 - menuPos[0]) % 36 - 30 < 0 and (ev.pos[1] - 100 - menuPos[1]) % 36 - 30 < 0:
						level = (ev.pos[0] - 23 - menuPos[0]) / 36 + 1 + ((ev.pos[1] - 100 - menuPos[1]) / 36) * 10
						if playGame(level, profiles) == "QUIT":
							_done = True
						drawMainMenu(profiles, menuPos)
def main():
	print_header()
	
	profiles = Profiles.get_profiles()
	
	if len(sys.argv) > 1:
		try:
			blas = [z for z in profiles if z.name == sys.argv[1]]
			blas[0].apply()
			
		except KeyError:
			print "Profile not found."
	else:
		print "Not enough arguments."
		print_help()
		print "The following profiles are available:"

		for prf in profiles:
			print prf.name
Example #3
0
    def __init__(
        self,
        master,
    ):
        master.wm_title("Archive")
        self.master = master
        master.maxsize(420, 470)
        master.minsize(420, 470)
        #master.geometry('420x470+750+305')
        self.master.geometry('420x470+750+305')
        geo = Functions.geo_center_screen(self, 420, 470)

        # Menus---------------------------------------------------------------------------------------------------------
        menubar = Menu(master)

        filemenu = Menu(menubar, tearoff=0)
        filemenu.add_command(
            label="Profiles",
            command=lambda: Profiles.profile_window(self, master))
        filemenu.add_command(label="Clear All",
                             command=lambda: Functions.clear_all(self))
        filemenu.add_command(label="Exit", command=master.quit)
        menubar.add_cascade(label="File", menu=filemenu)

        helpmenu = Menu(menubar, tearoff=0)
        helpmenu.add_command(label="About",
                             command=lambda: About.about_window(self))
        menubar.add_cascade(label="Help", menu=helpmenu)

        master.config(menu=menubar)

        # Paths---------------------------------------------------------------------------------------------------------
        paths = ttk.Frame(master)
        paths.grid(padx=5, pady=5, sticky=W, row=1, column=0)

        self.src_btn = ttk.Button(paths,
                                  text="Source",
                                  command=lambda: Functions.select_src(self))
        self.src_btn.grid(pady=5, row=0, column=0)
        self.src_label = ttk.Label(paths,
                                   text=Functions.srcdir,
                                   justify=LEFT,
                                   width=64)
        self.src_label.grid(padx=5,
                            pady=5,
                            sticky=SW,
                            row=0,
                            column=1,
                            columnspan=2)

        self.dst_btn = ttk.Button(paths,
                                  text="Destination",
                                  command=lambda: Functions.select_dst(self))
        self.dst_label = ttk.Label(paths,
                                   justify=LEFT,
                                   width=64,
                                   text=Functions.dstdir)
        self.dst_btn.grid(pady=5, row=1, column=0)
        self.dst_label.grid(padx=5,
                            pady=5,
                            sticky=SW,
                            row=1,
                            column=1,
                            columnspan=2)

        # Options-------------------------------------------------------------------------------------------------------
        options = ttk.Frame(master)
        options.grid(padx=5, pady=5, sticky=W, row=2, column=0)

        self.options_text = ttk.Label(options, text="Select archive option.")
        self.options_text.grid(pady=5, sticky=W, row=0, column=0, columnspan=3)

        self.mod_create_opt0 = ttk.Radiobutton(
            options,
            text="",
            variable=Functions.mod_or_create,
            value=0,
        )

        self.mod_create_opt1 = ttk.Radiobutton(
            options,
            text="MODIFIED since last archive performed.",
            variable=Functions.mod_or_create,
            value=1,
            command=lambda: Functions.options_set(self, option="m"))
        self.mod_create_opt1.grid(padx=2, sticky=W, row=1, column=0)

        self.mod_create_opt2 = ttk.Radiobutton(
            options,
            text="CREATED  since last archive performed.",
            variable=Functions.mod_or_create,
            value=2,
            command=lambda: Functions.options_set(self, option="c"))
        self.mod_create_opt2.grid(padx=2, sticky=W, row=2, column=0)

        # File info-----------------------------------------------------------------------------------------------------
        feedback = ttk.Frame(master)
        feedback.grid(padx=5, row=3, column=0, sticky=W)

        ttk.Label(feedback,
                  text="The following files will be copied").grid(row=0,
                                                                  column=0,
                                                                  sticky=W,
                                                                  pady=5)

        self.display_files = Text\
            (feedback, width=50, height=10, state='disabled')
        self.display_files.grid(pady=5, row=1, column=0, sticky=W)

        self.archive_btn = ttk.Button\
            (feedback, text="Archive Now", state=DISABLED, command=lambda: Functions.archive(self))
        self.archive_btn.grid(pady=5, row=2, column=0, sticky=W)

        # Misc. info----------------------------------------------------------------------------------------------------
        misc_info = ttk.Frame(master)
        misc_info.grid(padx=5, row=4, column=0, sticky=W)

        self.info_1 = ttk.Label(misc_info, )
        self.info_1.grid(pady=(3, 0), row=0, column=0, sticky=S + W)

        self.info_2 = ttk.Label(misc_info)
        self.info_2.grid(row=1, column=0, sticky=S + W)

        self.info_3 = ttk.Label(misc_info)
        self.info_3.grid(row=2, column=0, sticky=S + W)

        self.info_4 = ttk.Label(misc_info)
        self.info_4.grid(row=3, column=0, sticky=S + W)

        Functions.refresh(self)
Example #4
0
#!/usr/bin/env python

import sys

import Profiles


if (__name__ == "__main__"):
	if (len(sys.argv) > 1):
		ship = Profiles.generateShip(sys.argv[1])
	else:
		ship = Profiles.generateShip()
#####
##
	#do something with ship
##
#####
Example #5
0
 def load_profile(self, profile, pwd):
     profiles = Profiles.Profiles()
     res = profiles.get_profile(profile, pwd)
     self.set_headers(res[0], res[1], res[2], res[3])
Example #6
0
NumberOfCrossSections = 10
AirfoilFile = 'testProfile.txt'
Airfoil = 6512
AirfoilName = 'NACA_' + str(Airfoil) + '_' + SessionName
SummaryFile = './Summary/' + SessionName
XfoilPath = r'C:\Users\psakievich\Desktop\XFOIL6.99\xfoil.exe'
alphaMin = 0.5
alphaMax = 3.00
alphaInc = 0.25
'''
------------------------------------------------------------------------------
USER INPUT END
------------------------------------------------------------------------------
'''
#Setup profile
wing = Profiles.NacaGen(Airfoil, AirfoilName)
#wing=Profiles.AxialProfile()
#wing.Read(AirfoilFile)
#wing.name=AirfoilName
wing.Shift(-0.5)
stator = Profiles.Stator()
stator.chord = StatorChord
stator.thickness = StatorThickness
stator.nblades = NumberOfStatorVanes
stator.dHub = HubDiameter
profs = []
stats = []
#Setup turbogrid writer
writer = TG.Profile()  #fan
writer.fileName = './tgFiles/fan_' + SessionName
writer.SetPercentages(NumberOfCrossSections)
Example #7
0
					if buttonHit(ev.pos, ([menuPos[0] + 50 + 175 * i, menuPos[1] + 60], [menuPos[0] + 175 + 175 * i, menuPos[1] + 60 + 30])):
						result = profileMenu(profiles[i])
						if result == "QUIT":
							_done = True
						drawMainMenu(profiles, menuPos)
				if buttonHit(ev.pos, ([menuPos[0] + 160, menuPos[1] + 20], [menuPos[0] + 240, menuPos[1] + 50])):
					if playGame(1, profiles) == "QUIT":
						_done = True
					drawMainMenu(profiles, menuPos)
				elif buttonHit(ev.pos, ([menuPos[0] + 180, menuPos[1] + 60], [menuPos[0] + 220, menuPos[1] + 90])):
					if playGame("VS", profiles) == "QUIT":
						_done = True
					drawMainMenu(profiles, menuPos)
				else:
					if menuPos[0] + 23 < ev.pos[0] <= menuPos[0] + 383 and menuPos[1] + 100 <= ev.pos[1] <= menuPos[1] + 100 + 36 * 3 \
					and (ev.pos[0] - 23 - menuPos[0]) % 36 - 30 < 0 and (ev.pos[1] - 100 - menuPos[1]) % 36 - 30 < 0:
						level = (ev.pos[0] - 23 - menuPos[0]) / 36 + 1 + ((ev.pos[1] - 100 - menuPos[1]) / 36) * 10
						if playGame(level, profiles) == "QUIT":
							_done = True
						drawMainMenu(profiles, menuPos)

play = True
if len(sys.argv) >= 2 and isInt(sys.argv[1]):
	level = int(sys.argv[1])
	if playGame(level, [Profiles.Profile("Player1", 1), Profiles.Profile("Player2", 2)]) == "QUIT":
		play = False
	
if play:
	mainMenu()

#(surface, pos, size, text, drawBorder, bckClr = [0, 0, 0], txtClr = [255, 255, 255])