示例#1
0
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)
示例#2
0
    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)))
示例#4
0
 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"
     )
示例#5
0
 def purple(self):
     AnyBar().change('purple', text='Mood = Nostalgic')
     reply = QtGui.QMessageBox.information(
         self, "", "Why don't you try listening to Darwin?")
示例#6
0
 def blue(self):
     AnyBar().change('blue', text='Mood = Happy')
示例#7
0
 def cyan(self):
     AnyBar().change('cyan', text='Mood = Hopeful')
示例#8
0
 def green(self):
     AnyBar().change('green', text='Mood = Calm')
示例#9
0
 def yellow(self):
     AnyBar().change('yellow', text='Mood = Anxious')
     reply = QtGui.QMessageBox.information(
         self, "", "Why don't you try some breathing exercises?")
示例#10
0
 def orange(self):
     AnyBar().change('orange', text='Mood = Nervous')
示例#11
0
 def red(self):
     AnyBar().change('red', text='Mood = Sad')
     date = datetime.now()
     print(date)
示例#12
0
        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
示例#13
0
            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')
示例#14
0
文件: test.py 项目: ichuan/pyAnyBar
#!/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
示例#15
0
文件: main.py 项目: euggrie/tea-timer
def tea():
    AnyBar().change('red', text="Tea ready!")
示例#16
0
文件: main.py 项目: euggrie/tea-timer
def coffee():
    AnyBar().change('purple', text="Coffee ready!")