def vp_start_gui(): '''Starting point when module is the main routine.''' global val, w, root root = tk.Tk() LauncherWindow_support.set_Tk_var() top = Toplevel1 (root) LauncherWindow_support.init(root, top) import Launcher as FFF FFF.link_with_gui(root, top) root.mainloop()
def process_file(file_hash): #print "process_file("+str(file_hash)+")" pc = PackageController() res = pc.getFile(file_hash) if res == None: return None sam_id = file_hash sample = Sample() sample.setID(sam_id) sample.setBinary(res) sample.setStorageVersion({}) lc = Launcher() lc.launchAnalysisByID(sample) return 0
def process_file(file_hash): #print "process_file("+str(file_hash)+")" pc=PackageController() res=pc.getFile(file_hash) if res==None:return None sam_id=file_hash sample=Sample() sample.setID(sam_id) sample.setBinary(res) sample.setStorageVersion({}) lc=Launcher() lc.launchAnalysisByID(sample) return 0
def load_to_mongo2(folder_path): pc=PackageController() ram = Ram() files=recursive_read(folder_path) count=0 reset=0 already_loaded=0 time_start = datetime.datetime.now() uploaded=0 in_mem=0 loaded_ram_counter=0 lc=Launcher() if(files is None): return "No files where found." while (uploaded < len(files)): loaded_ram_counter=0 data_vector=[] print "loading files to memory" while (in_mem < len(files)): f=files[in_mem] file_cursor=open(f,"r") data_vector.append(file_cursor.read()) in_mem=in_mem+1 loaded_ram_counter=loaded_ram_counter+1 if(loaded_ram_counter > 100): if(ram.free_percent() < 0.3): print "Ram full" break for data in data_vector: file_id=hashlib.sha1(data).hexdigest() print "loading to db: "+str(file_id) res=pc.searchFile(file_id) if(res==None): pc.append(file_id,data) sample=Sample() sample.setID(file_id) sample.setBinary(data) sample.setStorageVersion({}) count+=1 lc.launchAnalysisByID(sample) else: already_loaded+=1 uploaded=uploaded+1 result=str(already_loaded)+" were already loaded to mongo.\n" result+=thetime(time_start,datetime.datetime.now(),count) print result return result
def launchToQueue(funname, queue, name, outtag): launcher = Launcher.Launcher( script=os.path.dirname(os.path.abspath(__main__.__file__)) + '/' + __main__.__file__, env=queue, ID=name, output=outtag) # create the new script file: _file = open(launcher.script, 'r') for _l in _file.readlines(): if funname and 'name' and name in _l: raworder = _l break _file.close() order = '' for i, _e in enumerate(raworder.split(',')): if 'queue' in _e: order += _e.replace('True', 'False') else: order += _e if (i != len(raworder.split(',')) - 1): order += ',' launcher.addOrder(order) launcher.launch() time.sleep(1.0)
def process_file(file_hash, force=False): if file_hash is None: return None print "process_file(" + str(file_hash) + ")" pc = PackageController() res = pc.getFile(file_hash) if res == None: return None sam_id = file_hash sample = Sample() sample.setID(sam_id) sample.setBinary(res) if force: sample.setStorageVersion({}) lc = Launcher() lc.launchAnalysisByID(sample) log_event("process", str(file_hash)) return 0
def process_file(file_hash, force=False): if not is_sha1(file_hash): raise ValueError("process_file only accepts sha1") logging.debug("process_file(" + str(file_hash) + ")") pc = PackageController() res = pc.getFile(file_hash) if res is None: logging.warning("Error: process_file(" + str(file_hash) + "): pc.getFile returned None") return None sam_id = file_hash sample = Sample() sample.setID(sam_id) sample.setBinary(res) if force: sample.setStorageVersion({}) lc = Launcher() lc.launchAnalysisByID(sample) log_event("process", str(file_hash)) return 0
def process_file(file_hash, force=False): if not is_sha1(file_hash): raise ValueError("process_file only accepts sha1") logging.debug("process_file(" + str(file_hash) + ")") pc = PackageController() res = pc.getFile(file_hash) if res is None: logging.warning( "Error: process_file(" + str(file_hash) + "): pc.getFile returned None") return None sam_id = file_hash sample = Sample() sample.setID(sam_id) sample.setBinary(res) if force: sample.setStorageVersion({}) lc = Launcher() lc.launchAnalysisByID(sample) log_event("process", str(file_hash)) return 0
def launch_rom(romId): dbConnection = DbConnection.DbConnection() romDataDictionary = dbConnection.GetRomById(romId) dbConnection.CloseDb() emuDict = Config.config.GetEmulatorByName( romDataDictionary['emulatorName']) print "Launching rom " + str(romId) Launcher.LaunchRom(emuDict, romDataDictionary)
def findDemoDir(): global demoDir if not demoDir: # only searches on first call if os.path.exists(myTryDir): # use hardcoded dir, or search demoDir = myTryDir # save in global for next call else: print 'Searching for standard demos on your machine...' path = Launcher.guessLocation('hanoi.py') if path: demoDir = os.sep.join(path.split(os.sep)[:-2]) print 'Using demo dir: ', demoDir assert demoDIr, 'Where is your demo directory?' return demoDir
def showsource(): # tricky, but open try: source = open('PyMailGui.py').read() # in cwd or below it? except: # like web getfile.cgi try: # or use find.find(f)[0] import Launcher, os here = os.curdir source = open(Launcher.findFirst(here, 'PyMailGui.py')).read() except: source = 'Sorry - cannot find my source file' subject = 'Main script [see also: PyMailGuiHelp, pymail, mailconfig]' editmail('View Source Code', 'PyMailGui', 'User', subject, source)
def showsource(): # tricky, but open try: source = open("PyMailGui.py").read() # in cwd or below it? except: # like web getfile.cgi try: # or use find.find(f)[0] import Launcher, os here = os.curdir source = open(Launcher.findFirst(here, "PyMailGui.py")).read() except: source = "Sorry - cannot find my source file" subject = "Main script [see also: PyMailGuiHelp, pymail, mailconfig]" editmail("View Source Code", "PyMailGui", "User", subject, source)
#!/bin/env python ############################################### # PyGadgets + environment search/config first # run this if you haven't setup your paths yet # you still must install Python first, though ############################################### import Launcher Launcher.launchBookExamples(['PyGadgets.py'], 0)
def makeComparison(queue, lumi, tree, name, var1, var2, nbin, xmin, xmax, cuts1, cuts2, label1, label2, xlabel, title2, log=False, normed=False): if queue: # queue launcher launcher = Launcher.Launcher( script=os.path.dirname(os.path.abspath(__file__)) + '/' + __file__, env=queue, ID=name, output=outtag) order = "makeComparison(queue = False, lumi = {0}, tree = treeMC, name = '{1}', var1 = '{2}', var2 = '{3}', nbin = {4}, xmin = {5}, xmax = {6}, cuts1 = '{7}', cuts2 = '{8}', label1 = '{9}', label2 = '{10}', xlabel = '{11}', title2 = '{12}', log = {13}, normed = {14})".format( lumi, name, var1, var2, nbin, xmin, xmax, cuts1, cuts2, label1, label2, xlabel, title2, log, normed) launcher.addOrder(order) launcher.launch() time.sleep(1.0) else: # Get the two distributions: h1 = tree.getTH1F(lumi, "h1", var1, nbin, xmin, xmax, cuts1, "", xlabel) h2 = tree.getTH1F(lumi, "h2", var2, nbin, xmin, xmax, cuts2, "", xlabel) h1.SetMarkerStyle(34) h2.SetMarkerStyle(34) h1.SetMarkerSize(1) h2.SetMarkerSize(1) h1.SetLineWidth(2) h2.SetLineWidth(2) if normed: h1.Scale(1.0 / h1.Integral()) h2.Scale(1.0 / h2.Integral()) h1.GetYaxis().SetTitle('Event density') h2.GetYaxis().SetTitle('Event density') # Get maximum: max1 = h1.GetMaximum() max2 = h2.GetMaximum() maxVal = max(max1, max2) # Set maximum: if log: h1.SetMaximum(100.0 * maxVal) h2.SetMaximum(100.0 * maxVal) #if not normed: h1.SetMinimum(0.1) #if not normed: h2.SetMinimum(0.1) else: h1.SetMaximum(1.3 * maxVal) h2.SetMaximum(1.3 * maxVal) # Draw canvas with points plot = Canvas.Canvas('comp_' + name, 'png', 0.7, 0.78, 0.9, 0.87, 1) plot.addHisto(h1, 'P', label1, 'p', r.kBlue - 3, 1, 0) plot.addHisto(h2, 'P, SAME', label2, 'p', r.kMagenta + 1, 1, 0) plot.saveRatio(1, 0, log, lumi, h1, h2, label=title2, outputDir=WORKPATH + 'closurePlots_' + outtag + '/')
"""game_macgyver will launch the game""" import argparse import BoardPygame as bp import Board as bo import ObjPygame as op import Obj as ob import CharacterPygame as cp import Character as ch import LauncherPygame as lp import Launcher as lg def parse_arguments(): #create an option to decide wich version of the game to use parser = argparse.ArgumentParser() parser.add_argument("-e", "--extension", help="""launch text or pygame version""") return parser.parse_args() if __name__ == "__main__": args = parse_arguments() if args.extension == "text": A = lg.Launcher(bo.Board, ch.Character, ob.Obj) elif args.extension == "pygame": A = lp.Launcher(bp.Board, cp.Character, op.Obj)
import Launcher # Launcher.launch_shortcut("C:\\Users\\Jeremy\\Desktop\\Insomnia.lnk") Launcher.launch_web(browser="firefox", url="google.com")
textSurfaceObj = fontObj.render('Launcher 1.0', True, WHITE, BLACK) #white text, black highlight textRectObj = textSurfaceObj.get_rect() textRectObj.center = (250, 20) pygame.draw.rect(surf, SKY_COLOR, (0, 0, 500, 380)) #sky pygame.draw.rect(surf, (GRASS_COLOR), (0, 380, 500, 20)) #grass surf.blit(textSurfaceObj, textRectObj) #draw title text pygame.init() DISPLAYSURF = pygame.display.set_mode((500, 400)) #main window pygame.display.set_caption('Launcher') #s = serial.Serial("/dev/ttyACM0") #uncomment eventually FPS = 30 #frames/s fpsClock = pygame.time.Clock() Launcher1 = Launcher.launcher(0, 380) rock1 = rock.Rock(0, 380) while (True): for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_UP: #rotate up Launcher1.changeAngle(3) if event.key == pygame.K_DOWN: #rotate down Launcher1.changeAngle(-3) if event.key == pygame.K_LEFT: #decrease power Launcher1.changeMagnitude(-5) if event.key == pygame.K_RIGHT:
if str(event) == lifecycle_event['params']['name']: return lifecycle_event if time.time() - start >= timeout: raise TimeoutError def close(self): try: self.chrome.Target.closeTarget(targetId=self.target_id) self.chrome.close() except IOError: if self.chrome_process is not None: self.chrome_process.terminate() if __name__ == '__main__': if 'Darwin' == platform.system(): launcher = Launcher.Launcher( path= '/Users/kba977/Others/SoftWare/chrome-mac/Chromium.app/Contents/MacOS/Chromium' ) else: launcher = Launcher.Launcher(path='C:/app/chrome-win/chrome.exe') auto_chrome = launcher.launch() auto_chrome.navigate(url='https://persons.shgjj.com') auto_chrome.get_window_bounds() auto_chrome.set_window_bounds(100, 100, 800, 600) auto_chrome.set_window_state('minimized') # auto_chrome.wait_condition(condition=Conditions.wait_dom_ready, timeout=18) # result = auto_chrome.wait_event(event=Event.Events.PageFrameStoppedLoading, timeout=10) # auto_chrome.wait_lifecycle_event(event=Event.LifecycleEvents.firstMeaningfulPaint, timeout=15)
self.client.launcher.value_PtsFantomeOdM = int(_message_split[9]) #self.client.launch_game() def set_pseudo_liste_and_launch(self, _message): pseudos = _message.split()[1:] print('La liste des pseudos reçue est', pseudos) self.client.launcher.value_pseudos = pseudos self.client.launch_game() def run(self): while True: try: # en attente de réception message_recu = self.connexion.recv(4096) message_recu = message_recu.decode(encoding='UTF-8') print('the client recieved:', message_recu) if (message_recu != ""): self.receiver_manager(message_recu) if "FIN" in message_recu: self._client.CONNEXION = False except socket.error: pass if __name__ == "__main__": Lch.LauncherMineHantee()
def main(self): self.root_win = tk.Tk() self.root_win.withdraw() try: #Get the default user and configuration prefs = UserPrefs.UserPrefs() #show the dialog box if this is the first time logging_enabled = False consent_refused = False startup_cancelled = False view_order = 0 dwell_times = [] max_scroll_values = [] user_view_order = [] if not prefs.have_killswitch: if not prefs.have_consent: handler = FirstTimeHandler(Config.consent_filename, Config.info_logo_filename, Config.pictogram_filenames) (got_consent, user_closed_window, view_order, dwell_times, max_scroll_values, user_view_order) = handler.get_consent() if got_consent: prefs.set_have_consent() else: consent_refused = True if user_closed_window: startup_cancelled = True elif not prefs.shown_pictograms: picto_viewer = Pictoviewer(tk.Toplevel(), Config.info_logo_filename, Config.pictogram_filenames) picto_viewer.show() picto_viewer.destroy() dwell_times = picto_viewer.dwell_times max_scroll_values = picto_viewer.max_scroll_values user_view_order = picto_viewer.user_view_order if prefs.have_consent and not startup_cancelled: splash = SplashScreen.SplashScreen(tk.Toplevel(), prefs) (startup_cancelled, logging_enabled) = splash.show() if not startup_cancelled: if consent_refused: tkMessageBox.showwarning( "Logging disabled", "You did not give your consent. Your usage data will NOT be reported until consent is given." ) launcher = Launcher.Launcher(prefs, view_order, dwell_times, max_scroll_values, user_view_order, self._done_callback) launcher.spawn(logging_enabled) # Enter root window's mainloop to handle updates while the GIMP is running # If we don't do this, then things in Window can hang for a little while self.root_win.after(1000, self._done_check) self.root_win.mainloop() if self.result: # App launched and quit successfully if logging_enabled: print "Uploading collected data..." uploader = Uploader.Uploader(prefs) uploader.upload() print "Finished uploading." # Check for participation after quitting if not prefs.have_killswitch: participate = Participation.Participation( tk.Toplevel(), prefs) participate.check_for_participation() except Exception, e: tkMessageBox.showerror("ingimp Error", "ingimp Error: " + str(e))
def launch(self): Launcher.launch("1.12.2")