def main(): init_somebar() while True: ip = get_ip() if external_ip == ip: AnyBar(port=any_bar_port).change('green') else: AnyBar(port=any_bar_port).change('exclamation') time.sleep(delay)
def __init__(self, anybar_port=None): """Create ButtonInidicator Args: ----- anybar_port : Optional port to use for AnyBar """ if anybar_port: self.anybar = AnyBar(anybar_port) else: self.anybar = AnyBar() self.entered = False
def connect(self, host='localhost', port='1738'): if self.anybar: self.anybar.change('green') self.anybar = AnyBar(port=int(port), address=host) print('Connect to {host}:{port}'.format(host=host, port=int(port)))
def black(self): AnyBar().change('black', text='Mood = Despair') reply = QtGui.QMessageBox.information( self, "", "Stop what you are doing, have a relaxing tea and watch some cat videos" )
def purple(self): AnyBar().change('purple', text='Mood = Nostalgic') reply = QtGui.QMessageBox.information( self, "", "Why don't you try listening to Darwin?")
def blue(self): AnyBar().change('blue', text='Mood = Happy')
def cyan(self): AnyBar().change('cyan', text='Mood = Hopeful')
def green(self): AnyBar().change('green', text='Mood = Calm')
def yellow(self): AnyBar().change('yellow', text='Mood = Anxious') reply = QtGui.QMessageBox.information( self, "", "Why don't you try some breathing exercises?")
def orange(self): AnyBar().change('orange', text='Mood = Nervous')
def red(self): AnyBar().change('red', text='Mood = Sad') date = datetime.now() print(date)
conn = HTTPConnection(host='google.com', port=HTTP_PORT, timeout=1) conn.request("HEAD", "/") response = conn.getresponse() conn.close() if response.status != 301: raise tm = (time() - cur) * 1000 # to ms except: pass return tm id = 0 while True: status[id] = ping() success = 0 sum = 0 for tm in status: if tm: success += 1 sum += tm if not success: AnyBar(port=ANYBAR_PORT).change('red') elif success < QUERIES or (sum / success) > 100: AnyBar(port=ANYBAR_PORT).change('yellow') else: AnyBar(port=ANYBAR_PORT).change('green') sleep(1) id = (id + 1) % QUERIES
g.tight_layout() g.savefig("diagnostics/single_page_spectra/"+str(int(i_cube))+ "_cube_"+str(cube_id)+"_spectra.pdf") plt.close("all") singular_plot() # removing data which doesn't have an O[II] doublet for us to compare to sigma_doublet_vals = data[:][:,0][:,1] sigma_doublet_zeros = np.where(sigma_doublet_vals == 0)[0] data = np.delete(data, sigma_doublet_zeros, 0) print(data) np.save("data/ppxf_fitter_data", data) # tells system to play a sound to alert that work has been finished os.system('afplay /System/Library/Sounds/Glass.aiff') personal_scripts.notifications("ppxf_fitter", "Script has finished!") if __name__ == '__main__': AnyBar().change('red') ppxf_cube_auto() #usable_cubes() #ppxf_plots.sigma_sn() #region_graphs_with_data() AnyBar().change('green')
#!/usr/bin/env python from time import sleep from anybar import AnyBar ab = AnyBar() def change(color): ab.change(color) sleep(.5) change('white') change('red') change('orange') change('yellow') change('green') change('cyan') change('blue') change('purple') change('black') change('question') change('exclamation') try: change('fdafsd') except ValueError: pass
def tea(): AnyBar().change('red', text="Tea ready!")
def coffee(): AnyBar().change('purple', text="Coffee ready!")