def run(): done = 1 frame = 0 t = time.time() import testopt opts = testopt.parseCommandLine(800, 600, "dx") pyui.init(*opts) # w = pyui.widgets.ViewWindow(10, 10, 400, 300) # w.pack() terrainDetails = CreateTestTerrainDetails() terrain = PyUnseen.createTerrainRegion(terrainDetails) # will take dictionary of stuff rootWorld = PyUnseen.getRootWorld() PyUnseen.addToWorld(rootWorld, terrain) # just like any other object cameraPos = (-10, 6, -10) cameraDir = (45, -45, 0) view1 = PyUnseen.createView(rootWorld) # will also take zMin, zMax? PyUnseen.setCameraParameters(view1, cameraPos, cameraDir) rootView = PyUnseen.getRootView() PyUnseen.setCameraParameters(rootView, cameraPos, cameraDir) while done: pyui.draw() done = pyui.update() print "done" pyui.quit()
def run(): done = 1 frame = 0 t = time.time() import testopt opts = testopt.parseCommandLine(640, 480) pyui.init(*opts) g = app() while done: pyui.draw() now = int(time.time()) if now != t: print frame frame = 0 t = now frame = frame + 1 done = pyui.update() print "done X" g.cleanup() pyui.quit() print "quit."
def run(): opts = testopt.parseCommandLine(800, 600) done = 1 frame = 0 t = time.time() pyui.init(*opts) pyui.desktop.getRenderer().setMouseCursor("cursor.png", 11,7) w = pyui.widgets.Frame(50, 50, 600, 450, "clipme") g = pyui.grid.GridPanel(6,10) for i in range(0,10): g.putCellAt( pyui.widgets.Button("button #%d" % i, None), random.randrange(0,4), random.randrange(0,5) ) g.putCellAt( pyui.widgets.Label("label #%d" % i), random.randrange(0,4), random.randrange(5,10) ) g.putCellAt( pyui.widgets.Edit("label #%d" % i, 12, None), random.randrange(0,4), random.randrange(10,15) ) g.putCellAt( pyui.widgets.SliderBar(onbutton, 50, 30), random.randrange(0,4), random.randrange(15,20) ) w.replacePanel(g) w.pack() pyui.run() print "done" pyui.quit()
def run(width, height, window, psyco, sound, server='http://localhost:8000', galaxy='', empire='', password=''): # Import Psyco if available if psyco: try: import psyco psyco.full() except ImportError: pass pyui.init( width, height, 'p3d', window, 'Armada Net Wars - version: %s' % anwp.func.globals.currentVersion) # read ini file for connection to server try: fileName = '%s/connect.ini' % os.getcwd() input = open(fileName, 'r') inputLines = [L.rstrip() for L in input] input.close() except: inputLines = ['http://localhost:8888'] app = anwp.client.app.Application(width, height, inputLines, sound, server, galaxy, empire, password) app.run() pyui.quit()
def run(): width = 400 height = 300 pyui.init(width, height) app = Application(width, height) app.run() pyui.quit()
def main(): """Run gui for testing""" import run import anwp.func.storedata width = 1024 height = 768 myGalaxy = anwp.func.storedata.loadFromFile('../../../Database/ANW1.anw') myShip = myGalaxy.ships['1'] pyui.init(width, height, 'p3d', 0, 'Testing Quad Info Panel') app = run.TestApplication(width, height) i = 0 top = 70 width = (width / 4) - 20 height = height / 3 dimensions = [(0, height, width, height), (width + 10, top, width, height), (width * 2 + 20, height, width, height), (width + 10, top + height + 150, width, height)] for position in ['aft', 'fore', 'port', 'star']: (x, y, w, h) = dimensions[i] myQuad = myShip.quads[position] frame = QuadInfoFrame(None, app, myQuad, x, y, w, h) app.addGui(frame) i += 1 app.run() pyui.quit()
def _guiUpdate(reactor, delay): pyui.draw() if pyui.update() == 0: pyui.quit() reactor.stop() else: reactor.callLater(delay, _guiUpdate, reactor, delay)
def run(): width = 800 height = 600 pyui.init(width, height, "p3d", 0) app = Application(width, height) app.run() pyui.quit()
def run(): width = 800 height = 600 pyui.init(width, height) app = Application(width, height) app.run() app = None pyui.quit()
def exitGame(self): """Exit the game""" try: # Logout of game self.setEmpireDefaults(self.game.authKey) self.setLogout(self.game.authKey) pyui.quit() except: pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing Industry Panel') app = run.TestApplication(width, height) frame = AddIndustryFrame(None, app, 'Add Industry to System', '1') app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1280 height = 1024 pyui.init(width, height, 'p3d', 0, 'Testing SimMenu Panel') app = run.TestApplication(width, height) frame = SimMenu(None, app) app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0) app = run.TestApplication(width, height) frame = MessageBox(None, app, 'Test MessageBox', 'Test of a Message Box') app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing MainMenuTech Panel') app = run.TestApplication(width, height) frame = MainMenuTech(None, app) app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing Armada Info Panel') app = run.TestApplication(width, height) frame = ArmadaInfoFrame(None, app) frame.panel.populate(None, None) app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 dTrade = {'AL': 100.0, 'EC': 100.0, 'IA': 100.0} pyui.init(width, height, 'p3d', 0, 'Testing Trade Panel') app = run.TestApplication(width, height) frame = ViewTrade(None, app, 100, 100, dTrade) app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing Grid Panel') app = run.TestApplication(width, height) ##frame = GetGridFrame(None, app, 5, 20, 'Select Grid Quadrant for Fleet') frame = GetGridFrame(None, app, 3, 6, 'Select Map Quadrant for Fleet') app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 empireDict = {'id':'1', 'name':'Test Empire'} pyui.init(width, height, 'p3d', 0, 'Testing EmpireDip Panel') app = run.TestApplication(width, height) frame = EmpireDipFrame(None, app, empireDict, 10, 10) app.addGui(frame) app.run() pyui.quit()
def run(): """The main game loop.""" done = 1 global sx, sy pyui.init(sx, sy, "p3d") #pyui.core.setTheme(pyui.theme.uglyTheme()) g = game() while done: pyui.draw() done = pyui.update() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing Send Mail Info Panel') app = run.TestApplication(width, height) empireDict = {'id': '1', 'name': 'Test Empire'} frame = SendMailInfoFrame(None, app, empireDict) app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing City Panel') app = run.TestApplication(width, height) ##frame = AddCityFrame(None, app, 'Add City', '0', '1', 'Colin') frame = AddCityFrame(None, app, 'Change City Resource', [11, 20, 14, 25, 18], '1', 'Colin') app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 myTech = {'name': 'Intelligent Shipyards', 'currentPoints': 0, 'imageFile': 'tech_red', 'y': 1800, 'id': '216', 'preTechs': ['216'], 'complete': 0, 'requiredPoints': 400, 'x': 300, 'preTechNum': 1, 'techAge': 3, 'description': 'Intelligent Shipyards'} pyui.init(width, height, 'p3d', 0, 'Testing Tech Info Panel') app = run.TestApplication(width, height) frame = TechInfoFrame(None, app) frame.panel.populate(myTech) app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing Mail Info Panel') app = run.TestApplication(width, height) frame = MailInfoFrame(None, app) app.addGui(frame) frame2 = MailBodyFrame(None, app, '1') app.addGui(frame) app.run() pyui.quit()
def run(): import testopt opts = testopt.parseCommandLine(800, 600) pyui.init(*opts) cubeSetup() pyui.desktop.getRenderer().setBackMethod(drawCube) createControl() con = pyui.dialogs.Console(0,500,780,80) pyui.run() print "done X" pyui.quit() print "quit."
def run(): import testopt opts = testopt.parseCommandLine(800, 600) pyui.init(*opts) # pyui.core.setTheme(pyui.greenTheme.greenTheme(pyui.core.gRenderer, 640, 480)) g = app() pyui.run() print "done X" g.cleanup() pyui.quit() print "quit."
def run(self): self.running = 1 not_done = 1 pyui.init(800, 600, fullscreen=1) for wrapper in wrappers: wrapper.prod() while not_done: pyui.draw() not_done = pyui.update() pyui.quit()
def main(): """Run gui for testing""" import anwp.gui.run import anwp.client.game import anwp.modes.mode width = 1024 height = 768 pyui.init(width, height, 'p3d', 0, 'Testing Footer Panel') app = anwp.gui.run.TestApplication(width, height) game = anwp.client.game.TestGame(app, width, height) mode = anwp.modes.mode.TestMode(game) window = Footer(mode, app) app.addGui(window) app.run() pyui.quit()
def main(): """Run gui for testing""" import run import anwp.func.storedata width = 1024 height = 768 myGalaxy = anwp.func.storedata.loadFromFile('../../../Database/ANW.anw') myShip = myGalaxy.ships['1'] pyui.init(width, height, 'p3d', 0, 'Testing Ship Info Panel') app = run.TestApplication(width, height) frame = ShipInfoFrame(None, app, myShip) frame.panel.populate() app.addGui(frame) app.run() pyui.quit()
def main(): """Run gui for testing""" import run width = 1024 height = 768 myEmpire = {'imageFile':'testempire', 'name': 'Kurita', 'ip': '', 'AL': 0, 'EC': 0, 'color1': 'red', 'simulationsLeft': 0, 'color1': 'black', 'emailAddress': '', 'key': '', 'designsLeft': 0, 'IA': 0, 'CR': 0, 'cities': 10} dIndustry = {'1':'Factory-1', '3':'Research Center-1', '2':'Marine Academy-2'} dShips = {'1':'5 Scouts', '2':'10 Destroyers', '3':'3 Super Dreadnoughts'} dMarines = {'1':'10 Flamers', '2':'10 Strikers', '3':'5 Gunners'} myIntelReport = {'round':99, 'industryReport':dIndustry, 'shipReport':dShips, 'marineReport':dMarines} mySystem = {'intelReport':myIntelReport, 'AL':12032, 'EC':455, 'IA':54, 'name': 'Hannah', 'imageFile': 'sys_8_yellow_black', 'id': '1001', 'connectedSystems': [], 'y': 300, 'x': 200, 'cities': 10, 'citiesUsed':4, 'myEmpireID': '2'} systemID = '1000' pyui.init(width, height, 'p3d', 0, 'Testing System Info Panel') app = run.TestApplication(width, height) frame = SystemInfoFrame(None, app) frame.panel.populate(myEmpire, mySystem) app.addGui(frame) app.run() pyui.quit()
def run(): done = 1 frame = 0 t = time.time() import testopt opts = testopt.parseCommandLine(800, 600) pyui.init(*opts) w = pyui.widgets.WorldWindow(50, 50, 400, 400) w.pack() while done: pyui.draw() done = pyui.update() print "done" pyui.quit()
def tick(self): try: pyui.core.update() pyui.core.draw() except: #TODO: handle exceptions properly! print "Exception in pyui" raise main.addTimeout(self.tick, 0.001) if not getDesktop().running: main.shutDown() pyui.quit() now = time.time() if now - self.last > 1: print "FPS:", self.frames self.frames = 0 self.last = now self.frames = self.frames + 1
def run(): opts = testopt.parseCommandLine(800, 600) done = 1 frame = 0 t = time.time() pyui.init(*opts) pyui.desktop.getRenderer().setMouseCursor("cursor.png", 11, 7) for i in range(0, 1): w = pyui.widgets.Frame(50 + i * 20, 50 + i * 20, 400, 400, "spreadsheet") w.setLayout(pyui.layouts.GridLayoutManager(1, 1, 0)) b = pyui.sheet.Sheet(onChanged, onInserted) b.setColumnTitle(3, "A very Long one") b.setColumnTitle(2, "Table name") b.setColumnTitle(1, "Something goes here....") w.addChild(b) w.pack() pyui.run() print "done" pyui.quit()
def run(): opts = testopt.parseCommandLine(1024, 768) done = 1 frame = 0 t = time.time() pyui.init(*opts) w = pyui.widgets.Frame(0,0,800,600, "HTML!") h = pyui.html.HTMLPanel() w.replacePanel(h) w.pack() #f = open('C:/ninja/Projects/pyui/website/index.html') #text = f.read() #f.close() h.feed(text) #h.feed(testText) w.resize(800,600) pyui.run() print "done" pyui.quit()
# make sure we can be shut down on windows. main.addTimeout(tick, 0.5) # create the boat frame w = pyui.boat.BoatReflectorFrame(reflector, 0,0,790, 570) # run the main loop last = 0 frame = 0 try: while pyui.update(): pyui.draw() main.iterate() frame += 1 now = time.time() if now - last > 2: print "FPS: ", int(frame/2) frame=0 last=now except: print "ERROR:" traceback.print_exc() # done. quit now. pyui.quit() reactor.stop() main.iterate() main.iterate() main.shutDown() print "done Twisted shutdown"
def quit(): pyui.quit()