Ejemplo n.º 1
0
 def _initializeWeatherReport(self,filename):
     """
     Read the Station Information from file.
     Parameters
     -----------
     filename: string, the location of the weather station csv file.
     
     Returns
     -----------
     No return. Will initialize the weather station list.
     """
     weatherReportList = []
     field = []
     with open(filename,'rU') as csvfile:
         reader = csv.reader(csvfile,delimiter = ',')
         counter = 0;
         for row in reader:
             counter= counter+1
             if(counter == 1):
                 field = row[:]
             else:
                 #pass
                 weatherReportList.append([row[field.index('wban_code')],row[field.index('datetime')],
                                           row[field.index('wind_speed')],row[field.index('sky_condition')],
                                           row[field.index('visibility')],row[field.index('relative_humidity')],
                                           row[field.index('hourly_precip')],row[field.index('drybulb_fahrenheit')],
                                           row[field.index('wetbulb_fahrenheit')],row[field.index('dewpoint_fahrenheit')],
                                           row[field.index('station_pressure')],row[field.index('weather_types')]])
     
     allWeatherReports = []
     for weatherReport in weatherReportList:
         allWeatherReports.append(Weather(weatherReport))
     self._weatherReportList = allWeatherReports
Ejemplo n.º 2
0
 def __init__(self, token, ids):
     self.ids = ids
     self.bot = telepot.Bot(token)
     self.bot.message_loop(self.handle)
     self.running = True
     self.weather = Weather(data.city, data.pid)
     self.weather.update()
Ejemplo n.º 3
0
def Success():
    if request.method == 'POST':
        City = request.form['City']
        App = Weather(str(City))
        Data = App.Find_Data()
        return render_template('Success.html', Data=Data)
    return render_template('Index.html')
Ejemplo n.º 4
0
    def setUp(self):
        self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Single_model.xml'))

        # Get the first surface to check:
        spaces = self.gbxml.get_spaces()
        self.shadow_record = self.gbxml.shadow_record
        self.shade_surf_list = self.gbxml.get_shades()
        self.surfaces_dict = self.gbxml.surfaces_dict
        self.ns = ( len(self.shade_surf_list) + len(self.shadow_record) )
        #space_boundaries = list()
        #space_boundaries = spaces[0].surfaces
        surfaces = spaces[0].surfaces
        self.surface1 = surfaces[0]

        self.shade = Shadow()

        # Create a fake weather
        self.weather = Weather('Washington', datetime(year=1997, month=1, day=1, hour=3), datetime(year=1997, month=1, day=1, hour=4))

        # And a timestep
        self.tstep2 = datetime(year=1997,month=1,day=1,hour=4)
        # get the weather at the tstep
        self.wtstep2 = self.weather.get_weather_step(self.tstep2)

        # And another timestep
        self.tstep = datetime(year=1997,month=1,day=1,hour=3)
        # get the weather at the tstep
        self.wtstep = self.weather.get_weather_step(self.tstep)
Ejemplo n.º 5
0
class AirMetBot(threading.Thread):
    __w = Weather()
    __t = Tweeter()

    def __init__(self):
        threading.Thread.__init__(self)

    def run(self):
        while (True):
            results = self.__t.getResults()

            for r in results:
                msg = username = "******" + r.user + "\n"

                weatherResults = []

                for c in r.hashtags:
                    weather = self.__w.getMetar(c['text'])
                    if (weather):
                        weatherResults.append(weather)

                while (len(weatherResults) > 0):
                    if (len(msg) + len(weatherResults[0]) > 240):
                        self.__t.sendTweet(msg)
                        msg = username
                    msg += weatherResults.pop() + "\n"

                self.__t.sendTweet(msg, r.id)

            time.sleep(30)

            print("looping", file=sys.stderr)
Ejemplo n.º 6
0
    def get_weather(self, event=None):
        for widget in self.info_city.winfo_children():
            widget.destroy()

        city_name = self.entry.get()
        if len(city_name) != 0:
            weather = Weather(city_name)
            informations = weather.extract_component(city_name + ".txt")

            name_label = tk.Label(self.info_city,
                                  text="Météo actuelle à " + city_name,
                                  font=self.fontStyle)
            name_label.grid(padx=20, pady=15)

            cloud_label = tk.Label(self.info_city,
                                   text="Temps: " + informations[0],
                                   font=self.fontStyle)
            cloud_label.grid(padx=10, pady=10)
            temp_label = tk.Label(self.info_city,
                                  text="Température: " + str(informations[1]),
                                  font=self.fontStyle)
            temp_label.grid(padx=10, pady=10)
            preassure_label = tk.Label(self.info_city,
                                       text="Pression: " +
                                       str(informations[2]) + "hPa",
                                       font=self.fontStyle)
            preassure_label.grid(padx=10, pady=10)
            humidity_label = tk.Label(self.info_city,
                                      text="Humidité: " +
                                      str(informations[3]) + "%",
                                      font=self.fontStyle)
            humidity_label.grid(padx=10, pady=10)

        else:
            messagebox.showerror("Erreur", "Le nom de la ville est vide.")
Ejemplo n.º 7
0
def read_data_of_a_month(name):
    days = []

    if os.path.exists('weatherdata/' + name + '.txt'):
        print(name + " is processing ...")
        for line in open('weatherdata/' + name + '.txt', 'r'):
            line_in_list_form = line.split(',')
            date_string = line_in_list_form[0]
            date_in_list_form = date_string.split('-')

            if date_in_list_form[0] not in (
                    'PKT', 'PKST', '\n', '<!'
            ):  # because 1st two lines and last line of file are not valid
                date_obj = date(year=int(date_in_list_form[0]),
                                month=int(date_in_list_form[1]),
                                day=int(date_in_list_form[2]))
                max_t = line_in_list_form[1]
                mean_t = line_in_list_form[2]
                min_t = line_in_list_form[3]
                dew_point = line_in_list_form[4]
                mean_dew = line_in_list_form[5]
                min_dew = line_in_list_form[6]
                max_humadity = line_in_list_form[7]
                mean_humadity = line_in_list_form[8]
                min_humadity = line_in_list_form[9]

                weather = Weather(date_obj, max_t, mean_t, min_t, dew_point,
                                  mean_dew, min_dew, max_humadity,
                                  mean_humadity, min_humadity)
                days.append(weather)

    return days
Ejemplo n.º 8
0
    def __init__(self):
        """ 
            On initialisation the MonitorAndNotify class reads the current data and inserts into the datbase every minute 
            and only sends a notification once a day
        
        """

        # Scheduler = Schedule()
        # Instantiate all relevant classes
        data = DataLogger()
        dataManager = DatabaseManager(data)
        monitor = Monitor()
        weather = Weather(data, dataManager, monitor)
        sense = VirtualSenseHat.getSenseHat()

        # Scheduler.createSchedule()

        # verify if the temperature is within the range
        weather.verifyTemperature()
        # verify if the humidity is within the range
        weather.verifyHumidity()

        # close the connection to the database
        dataManager.closeDBConnection()

        # clear anything displayed on the sense hat
        sense.clear()
    def setUp(self):
        self.gbxml = gbXML(
            os.path.join(os.path.dirname(__file__), 'input/Single_model.xml'))

        # Get the first surface to check:
        spaces = self.gbxml.get_spaces()
        #space_boundaries = list()
        #space_boundaries = spaces[0].surfaces
        surfaces = spaces[0].surfaces
        self.surface1 = surfaces[0]

        self.solar = TransmittedSolar()

        area = Area()
        #print "test"
        self.areaWinDict = area.getWinDictionary

        # Create a fake weather
        self.weather = Weather('Washington',
                               datetime(year=1997, month=1, day=1, hour=3),
                               datetime(year=1997, month=1, day=1, hour=4))

        # And a timestep
        self.tstep2 = datetime(year=1997, month=1, day=1, hour=4)
        # get the weather at the tstep
        self.wtstep2 = self.weather.get_weather_step(self.tstep2)

        # And another timestep
        self.tstep = datetime(year=1997, month=1, day=1, hour=3)
        # get the weather at the tstep
        self.wtstep = self.weather.get_weather_step(self.tstep)
Ejemplo n.º 10
0
 def loadWeather(self):
     weather = Weather()
     weather.loadData()
     for elem in weather.weatherTab:
         city = URIRef("http://example.org/station/" + elem[0])
         weather = URIRef("http://example.org/weather/")
         self.g.add((city, weather, Literal(elem[1])))
Ejemplo n.º 11
0
    def setUp(self):
        gbxml = gbXML(
            os.path.join(os.path.dirname(__file__), 'input/Single_model.xml'))
        area = Area()
        area.createAreaDictionary()
        area.createWinAreaDictionary()
        self.areaWinDict = area.getWinDictionary()
        self.areaDict = area.getDictionary()

        spaces = gbxml.get_spaces()
        surfaces = spaces[0].surfaces
        self.surface = Surface()

        self.surface1 = surfaces[0]
        self.surface2 = surfaces[1]
        self.surface3 = surfaces[2]
        self.surface4 = surfaces[3]
        self.surface5 = surfaces[4]
        self.surface6 = surfaces[5]

        # Create a fake weather
        self.weather = Weather('Washington',
                               datetime(year=1997, month=1, day=1, hour=3),
                               datetime(year=1997, month=1, day=1, hour=4))

        # And a timestep
        self.tstep2 = datetime(year=1997, month=1, day=1, hour=4)
        # get the weather at the tstep
        self.wtstep2 = self.weather.get_weather_step(self.tstep2)

        # And another timestep
        self.tstep = datetime(year=1997, month=1, day=1, hour=3)
        # get the weather at the tstep
        self.wtstep = self.weather.get_weather_step(self.tstep)
Ejemplo n.º 12
0
 def testWeatherConstructor(self):
     w = Weather(1, 2, 3, 4, '2000-12-31 20:00:00', 'cloudy')
     self.assertEqual(w.getTemperature(), 1)
     self.assertEqual(w.getFeelsLike(), 2)
     self.assertEqual(w.getMinTemp(), 3)
     self.assertEqual(w.getMaxTemp(), 4)
     self.assertEqual(w.getDt(), '2000-12-31 20:00:00')
     self.assertEqual(w.getWeatherState(), 'cloudy')
Ejemplo n.º 13
0
 def __create_forecast(self, data, city):
     forecast = []
     for i in range(
             Forecast.LIST_SIZE
     ):  # i indicates the number of days from the current day
         d = calendar.day_name[
             (Forecast.CURRENT_DAY_NUMBER + i) % Forecast.
             WEEK_DAYS]  # Uses modulus because the numbers range from 0 -6 representing the days
         forecast.append(Weather(data, city, d, i))
     return forecast
Ejemplo n.º 14
0
    def __init__(self):
        super(PiPyDesktop, self).__init__()
        grid = QtGui.QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(Clock(), 1, 0)
        grid.addWidget(Weather(), 1, 1)
        self.setLayout(grid)
        self.setWindowTitle('PiPyDesktop')
        self.setStyleSheet("background-color:black;")
        self.setCursor(QtCore.Qt.BlankCursor)
Ejemplo n.º 15
0
    def setUp(self):
        self.gbxml = gbXML(
            os.path.join(os.path.dirname(__file__), 'input/Single_model.xml'))
        #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Four_Room_Two_Floors_Model.xml')) # To test middle interior floor
        area = Area()
        area.createAreaDictionary()
        area.createWinAreaDictionary()
        self.areaWinDict = area.getWinDictionary()
        self.areaDict = area.getDictionary()

        spaces = self.gbxml.get_spaces()
        surfaces = spaces[0].surfaces
        self.heat = HeatCalculation()
        self.temp_record = self.gbxml.temp_record
        self.spaces_dict = self.gbxml.spaces_dict
        self.shgc_dictionary = self.gbxml.shgc_dictionary
        self.shadow_record = self.gbxml.shadow_record
        self.shade_surf_list = self.gbxml.get_shades()
        self.surfaces_dict = self.gbxml.surfaces_dict

        self.space1 = spaces[0]
        #surfaces1 = spaces[0].surfaces
        #self.space2 = spaces[1]
        #surfaces2 = spaces[1].surfaces
        #self.surface6 = surfaces1[5]   # su-6
        #self.surface11 = surfaces2[5]  # su-11

        self.surface1 = surfaces[0]
        self.surface2 = surfaces[1]
        self.surface3 = surfaces[2]
        self.surface4 = surfaces[3]
        self.surface5 = surfaces[4]
        self.surface6 = surfaces[5]

        self.G_space_record = dict()
        self.G_space_record["sp-1-Room"] = 0

        # Create a fake weather
        self.weather = Weather('Washington',
                               datetime(year=1997, month=1, day=1, hour=3),
                               datetime(year=1997, month=1, day=1, hour=4))

        # And a timestep
        self.tstep2 = datetime(year=1997, month=1, day=1, hour=4)
        # get the weather at the tstep
        self.wtstep2 = self.weather.get_weather_step(self.tstep2)

        # And another timestep
        self.tstep = datetime(year=1997, month=1, day=1, hour=3)
        # get the weather at the tstep
        self.wtstep = self.weather.get_weather_step(self.tstep)
Ejemplo n.º 16
0
def preview_zenith_tau(log, row_list, cl_params, feeds, windows, pols):

    foo = None

    # if using the weather database
    if cl_params.zenithtau is None:
        for feed in feeds:
            for window in windows:
                for pol in pols:
                    try:
                        foo = row_list.get(cl_params.mapscans[0], feed, window,
                                           pol)
                        break  # if we found a row move on, otherwise try another feed/win/pol
                    except KeyError:
                        continue
        if not foo:
            log.doMessage('ERR',
                          'Could not find scan for zenith opacity preview')
            return

        ff = fitsio.FITS(cl_params.infilename)
        extension = foo['EXTENSION']
        row = foo['ROW'][0]
        bar = ff[extension]['OBSFREQ', 'DATE-OBS'][row]
        dateobs = bar['DATE-OBS'][0]
        obsfreq = bar['OBSFREQ'][0]
        ff.close()

        weather = Weather()
        pu = Pipeutils()

        mjd = pu.dateToMjd(dateobs)
        zenithtau = weather.retrieve_zenith_opacity(mjd, obsfreq, log)
        if zenithtau:
            log.doMessage(
                'INFO', 'Approximate zenith opacity for map: {0:.3f}'.format(
                    zenithtau))
        else:
            log.doMessage(
                'ERR', 'Not able to retrieve integration '
                'zenith opacity for calibration to:', cl_params.units,
                '\n  Please supply a zenith opacity or calibrate to Ta.')
            sys.exit(9)

    # else if set at the command line
    else:

        log.doMessage(
            'INFO', 'Zenith opacity for '
            'map: {0:.3f}'.format(cl_params.zenithtau))
Ejemplo n.º 17
0
 def __init__(self):
     self.tk = Tk()
     self.tk.configure(background='black')
     self.topFrame = Frame(self.tk, background = 'black')
     self.bottomFrame = Frame(self.tk, background = 'black')
     self.topFrame.pack(side = TOP, fill=BOTH, expand = YES)
     self.bottomFrame.pack(side = BOTTOM, fill=BOTH, expand = YES)
     self.state = False
     self.tk.bind("<Return>", self.toggle_fullscreen)
     self.tk.bind("<Escape>", self.end_fullscreen)
      # weather
     self.weather = Weather(self.topFrame)
     self.weather.place(x=0, y=5, anchor=NW, width=700, height=400)
     # Date
     self.date = Date(self.topFrame)
     self.date.place(x=1015, y=10, anchor=NE, width=350, height=90)
     # Day
     self.day = Day(self.topFrame)
     self.day.place(x=860, y=10, anchor=NE, width=300, height=90)
     # clock
     self.clock = Clock(self.topFrame)
     self.clock.place(x=940, y=60, anchor=NE, width=250, height=90)
     #Seconds
     self.sec = Sec(self.topFrame)
     self.sec.place(x=1015, y=60, anchor=NE, width=80, height=85)
     # news
     self.news = News(self.bottomFrame)
     self.news.pack(side=LEFT, anchor=S, padx=0, pady=10)
     # Facial rec
     #self.FacialRecognition = News(self.bottomFrame)
     #self.FacialRecognition.pack(side=LEFT, anchor=N, padx=100, pady=60)
     # calender
     self.calender = Calendar(self.topFrame)
     self.calender.place(x=1015, y=150, width=250, anchor=NE)
     # calender Time
     self.calenderTime = CalendarTime(self.topFrame)
     self.calenderTime.place(x=850, y=172, width=250, anchor=NE)
     #Traffic
     self.traffic = Traffic(self.topFrame)
     #Launch
     self.launch = Launch(self.topFrame)
     #crypto name
     self.crypto = Crypto(self.topFrame)
     self.crypto.pack(side=TOP, anchor=NE)
     #Crypto Time
     self.cryptoPrice = CryptoPrice(self.topFrame)
     self.cryptoPrice.pack(side=TOP, anchor=NE)
     #camera
     s = FacialRec()
Ejemplo n.º 18
0
    def getCurrentWeather(self, location):
        json = self.__apicall(location)
        weatherlist = {}
        objName = str(json['list'][0]['dt'])
        temperature = json['list'][0]['main']['temp']
        temp_min = json['list'][0]['main']['temp_min']
        temp_max = json['list'][0]['main']['temp_max']
        temp_feels_like = json['list'][0]['main']['feels_like']
        temp_dt = json['list'][0]['dt_txt']
        weatherstate = json['list'][0]['weather'][0]['description']

        weatherlist[objName] = Weather(temperature, temp_feels_like, temp_min,
                                       temp_max, temp_dt, weatherstate)

        return weatherlist[objName]
Ejemplo n.º 19
0
 def WeekTweet(self):
     tempTweet = ""
     for x in range(1, 6):
         self.weatherObj = Weather(GPSLOCATION, AIRPORT, x)
         self.rec = Recommendation.Recommendation(self.weatherObj)
         tempTweet += self.weatherObj.dayofWeek["short"] + "- " + str(
             self.rec.rating) + "/"
         tempTweet += self.weatherObj.weatherStatus + "/Morn " + str(
             math.ceil(self.weatherObj.mornTemp)) + "°F/Eve " + str(
                 math.ceil(self.weatherObj.eveTemp)) + "°F"
         if (self.rec.weatherEmoji):
             tempTweet += self.rec.weatherEmoji + "\n"
     self.tweetContents = "THIS WEEK'S CONDITIONS:\n" + tempTweet
     self.addHashTag()
     TweetPublisher(self.tweetContents)
def cozmo_program(robot: cozmo.robot.Robot):
    f = Face(robot)
    f.find_person()
    d = Drive(robot)
    weather = Weather(f.city)
    weather.set_outfit()
    welcome = Welcome(robot)
    welcome.hello(weather.w, weather.outfit, f.city, f.name)
    e = input()
    if e == "exit":
        robot.say_text("Goodbye")
    else:
        l = Lights()
        l.set_lights(d, weather.number)
        d.find(weather.number)
Ejemplo n.º 21
0
def Main():
    gameIntro = GameIntro()
    gameIntro.getIntro()
    player = Player()
    player.namePlayer()
    weather = Weather()
    weather.getWeather()
    print ("Today's weather forecast is %s." % (weather.weather))
    temperature = Temperature()
    temperature.getTemperature()
    print("Today's temperature will %s degrees." % (temperature.temperature))
    print("Let's get our supplies and make some lemonade.")
    price = Pricing()
    price.setprice()
    playerChoice.setPrice()
Ejemplo n.º 22
0
 def getFiveDaysForecast(self, location):
     json = self.__apicall(location)
     weatherlist = {}
     for i in range(json["cnt"]):
         if json['list'][i]['dt_txt'][-8:] == "12:00:00":
             objName = str(json['list'][i]['dt'])
             temperature = json['list'][i]['main']['temp']
             temp_min = json['list'][i]['main']['temp_min']
             temp_max = json['list'][i]['main']['temp_max']
             temp_feels_like = json['list'][i]['main']['feels_like']
             temp_dt = json['list'][i]['dt_txt']
             weatherstate = json['list'][i]['weather'][0]['description']
             weatherlist[objName] = Weather(temperature, temp_feels_like,
                                            temp_min, temp_max, temp_dt,
                                            weatherstate)
     return weatherlist
Ejemplo n.º 23
0
    def setUp(self):
        #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Single_model.xml'))
        self.gbxml = gbXML(
            os.path.join(os.path.dirname(__file__),
                         'input/Two_Room_One_Floor_Model.xml'))
        self.temp = Temperature()
        self.shgc_dictionary = self.gbxml.shgc_dictionary
        self.temp_record = self.gbxml.temp_record
        self.spaces_dict = self.gbxml.spaces_dict
        self.shadow_record = self.gbxml.shadow_record
        self.shade_surf_list = self.gbxml.get_shades()
        self.surfaces_dict = self.gbxml.surfaces_dict
        # Get the first surface to check:
        spaces = self.gbxml.get_spaces()

        # Space 1 info, surface "su-8" is [7] and is the interior shared wall here
        space1 = spaces[0]
        surfaces_inspace1 = spaces[0].surfaces
        self.surface1_in_space1 = surfaces_inspace1[0]
        self.surface5_in_space1 = surfaces_inspace1[4]
        self.surface6_in_space1 = surfaces_inspace1[5]

        self.surface8_in_space1 = surfaces_inspace1[7]

        # Space 2 info, surface "su-8" is [7] and is the interior shared wall here
        #space2 = spaces[1]
        #surfaces_inspace2 = spaces[1].surfaces
        #self.surface8_in_space2 = surfaces_inspace1[7]

        # Create a fake weather
        self.weather = Weather('Washington',
                               datetime(year=1997, month=1, day=1, hour=3),
                               datetime(year=1997, month=1, day=1, hour=4))

        area = Area()
        #print "test"
        self.areaWinDict = area.getWinDictionary

        # And a timestep
        self.tstep2 = datetime(year=1997, month=1, day=1, hour=4)
        # get the weather at the tstep
        self.wtstep2 = self.weather.get_weather_step(self.tstep2)

        # And another timestep
        self.tstep = datetime(year=1997, month=1, day=1, hour=3)
        # get the weather at the tstep
        self.wtstep = self.weather.get_weather_step(self.tstep)
Ejemplo n.º 24
0
def get_data(link):
    content = requests.get(link).text
    soup = bs(content, 'html.parser')

    all=soup.find('div',{'class':'locations-title ten-day-page-title'}).find('h1').text
    table=soup.find_all('table',{'class':'twc-table'})
    for items in table:
        for i in range(len(items.find_all('tr'))-1):

            day=items.find_all('span',{'class':'date-time'})[i].text
            date=items.find_all('span',{'class':'day-detail'})[i].text
            desc=items.find_all('td',{'class':'description'})[i].text 
            temp=items.find_all('td',{'class':'temp'})[i].text 
            precip=items.find_all('td',{'class':'precip'})[i].text.replace('%', '')
            wind=items.find_all('td',{'class':'wind'})[i].text  
            humidity=items.find_all('td',{'class':'humidity'})[i].text.replace('%', '') 
            w = Weather(day, date, desc, temp, precip, wind, humidity)
Ejemplo n.º 25
0
 def WeekendTweet(self):
     tempTweet = ""
     for x in range(1, 3):
         self.weatherObj = Weather(GPSLOCATION, AIRPORT, x)
         self.rec = Recommendation.Recommendation(self.weatherObj)
         tempTweet += self.weatherObj.dayofWeek["long"] + "- " + str(
             self.rec.rating) + "/"
         tempTweet += self.weatherObj.weatherStatus + "/Morn " + str(
             math.ceil(self.weatherObj.mornTemp)) + "°F/Eve " + str(
                 math.ceil(self.weatherObj.eveTemp)) + "°F"
         if ((self.weatherObj.rainText)
                 and (self.weatherObj.weatherStatus != "trace rain")):
             tempTweet += "/" + self.weatherObj.rainText
         if (self.rec.weatherEmoji):
             tempTweet += self.rec.weatherEmoji + "\n"
         #Get the emoji here
     self.tweetContents = "THIS WEEKEND: \n" + tempTweet
     self.addHashTag()
     TweetPublisher(self.tweetContents)
Ejemplo n.º 26
0
 def __init__(self):
     self.tk = Tk()
     self.tk.configure(background='black')
     self.topFrame = Frame(self.tk, background='black')
     self.bottomFrame = Frame(self.tk, background='black')
     self.topFrame.pack(side=LEFT, fill=BOTH, expand=YES)
     self.bottomFrame.pack(side=RIGHT, fill=BOTH, expand=YES)
     self.state = False
     self.tk.bind("<Return>", self.toggle_fullscreen)
     self.tk.bind("<Escape>", self.end_fullscreen)
     # clock
     self.clock = Clock(self.topFrame)
     self.clock.pack(side=TOP, anchor=NW, padx=100, pady=60)
     # weather
     self.weather = Weather(self.topFrame, self.clock.day_of_week1)
     self.weather.pack(side=TOP, anchor=NW, padx=100, pady=(60, 0))
     # news
     self.news = News(self.bottomFrame)
     self.news.pack(side=RIGHT, anchor=N, padx=100, pady=(80, 0))
Ejemplo n.º 27
0
    def __init__(self):
        """ init the variables """
        # Greetings
        self.greeting = "Hey there Sifu Nam !"
        self.masterName = "Sifu Nam"

        # Datetime
        datetimeInfo = datetime.now()
        self.date = datetimeInfo.strftime("%A, %B %d %Y")
        self.time = datetimeInfo.strftime("%X")
        self.hour = int(datetimeInfo.hour)

        # Weather Info
        weatherController = Weather()
        self.weatherInfo = weatherController.get_weather_data()
        self.clothingInfo = weatherController.get_clothing_data()
        self.generalWeatherStatus = weatherController.get_weather_status()

        # Schedule Info
        self.scheduleController = Schedule()
        self.timeToLeave = self.scheduleController.hourBLH + " hours" + " and " + self.scheduleController.mBLH + " mins"
Ejemplo n.º 28
0
    def getTodayWeather(self, location):
        json = self.__apicall(location)
        weatherlist = {}
        tomorrow = datetime.date.today() + datetime.timedelta(days=1)
        unixtime = time.mktime(tomorrow.timetuple())

        i = 0
        while float(json['list'][i]['dt']) <= unixtime:
            objName = str(json['list'][i]['dt'])
            temperature = json['list'][i]['main']['temp']
            temp_min = json['list'][i]['main']['temp_min']
            temp_max = json['list'][i]['main']['temp_max']
            temp_feels_like = json['list'][i]['main']['feels_like']
            temp_dt = json['list'][i]['dt_txt']
            weatherstate = json['list'][i]['weather'][0]['description']
            weatherlist[objName] = Weather(temperature, temp_feels_like,
                                           temp_min, temp_max, temp_dt,
                                           weatherstate)
            i += 1

        return weatherlist
Ejemplo n.º 29
0
    def setUp(self):
        gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Single_model.xml'))
        spaces = gbxml.get_spaces()
        surfaces = spaces[0].surfaces
        self.surface = Surface()
        self.open = Opening()

        self.surface1 = surfaces[0]
        self.opening1 = surfaces[0].openings[0]

        # Create a fake weather
        self.weather = Weather('Washington', datetime(year=1997,month=1,day=1,hour=3), datetime(year=1997,month=1,day=1,hour=4))

        # And a timestep
        self.tstep2 = datetime(year=1997,month=1,day=1,hour=4)
        # get the weather at the tstep
        self.wtstep2 = self.weather.get_weather_step(self.tstep2)

        # And another timestep
        self.tstep = datetime(year=1997,month=1,day=1,hour=3)
        # get the weather at the tstep
        self.wtstep = self.weather.get_weather_step(self.tstep)
Ejemplo n.º 30
0
    def __init__(self):
        self.isFullscreen = True

        self.tk = Tk()
        self.tk.config(background='black')
        self.tk.attributes("-fullscreen", self.isFullscreen)

        self.topFrame = Frame(self.tk, background='black')
        self.bottomFrame = Frame(self.tk, background='black')
        self.topFrame.pack(side=TOP, fill=BOTH, expand=YES)
        self.bottomFrame.pack(side=BOTTOM, fill=BOTH, expand=YES)

        self.clock = Clock(self.topFrame)
        self.clock.pack(side=RIGHT, anchor=N, padx=100, pady=60)

        self.weather = Weather(self.topFrame)
        self.weather.pack(side=LEFT, anchor=N, padx=100, pady=60)

        self.googletext = GoogleTxt(self.bottomFrame)
        self.googletext.pack(side=RIGHT, anchor=S, padx=100, pady=30)

        self.tk.bind("<Return>", self.toggle_fullscreen)
        self.tk.bind("<Escape>", self.end_fullscreen)