Exemplo n.º 1
0
 def __init__(self):
     super().__init__()
     lang = Language()
     self.header_label = ResizeableText(lang["exchange_rates"])
     self.rates = ExchangeRatesController("nbrb").current_rates([290, 145, 292])
     self.rate_rows = [[ResizeableText(rate.scale), ResizeableText(rate.currency_abbr),
                        ResizeableImage(f'{os.path.dirname(__file__)}\images\exchange_rates\\arrows.png'),
                        ResizeableText(rate.rate), ResizeableText(rate.main_currency_abbr)] for rate in self.rates]
     self.init_ui()
     self.init_threads()
Exemplo n.º 2
0
 def __init__(self):
     super().__init__()
     lang = Language()
     self.news = NewsController('tutby').current_news("top")
     self.header_label = ResizeableText(
         f'{lang["news"]} {"(" + self.news[0] + ")" if self.news[0] is not None else " "}',
         QtCore.Qt.AlignLeft)
     self.news_labels = [ResizeableText("", QtCore.Qt.AlignLeft) for i in range(0, 8)]
     for i in range(0, self.news[1].__len__()):
         self.news_labels[i].set_text(self.news[1][i].title)
     self.init_ui()
     self.init_threads()
Exemplo n.º 3
0
 def update(self):
     lang = Language()
     weather = WeatherController('yandex').current_weather('Минск')
     self.header_label.set_text(f'{lang["now"]} {lang["in"]} {weather.city}: {weather.condition}')
     self.cloud_widget.set_image(f'{os.path.dirname(__file__)}\images\weather\{weather.image}')
     self.temperature_widget.set_text(f'{weather.temperature}{lang["deg_m"]}')
     self.wind_label.set_text(lang['wind'])
     self.wind_widget.set_text(f'{weather.wind} {lang["wind_m"]}, {weather.wind_direction_abbr}')
     self.pressure_label.set_text(lang['pressure'])
     self.pressure_widget.set_text(f'{weather.pressure} {lang["pressure_m"]}')
     self.humidity_label.set_text(lang['humidity'])
     self.humidity_widget.set_text(f'{weather.humidity}{lang["humidity_m"]}')
Exemplo n.º 4
0
 def current_rates(self, currencies):
     selected_currencies = list(
         filter(lambda x: x["Cur_ID"] in currencies, self.rates))
     exchange_rates = []
     lang = Language()
     for selected_currency in selected_currencies:
         exchange_rates.append(
             ExchangeRate("BYN", lang["byn_r_p"],
                          selected_currency["Cur_Abbreviation"],
                          selected_currency["Cur_Name"],
                          selected_currency["Cur_Scale"],
                          selected_currency["Cur_OfficialRate"]))
     return exchange_rates
Exemplo n.º 5
0
 def __init__(self):
     super().__init__()
     lang = Language()
     weather = WeatherController('yandex').current_weather('Минск')
     self.header_label = ResizeableText(f'{lang["now"]} {lang["in"]} {weather.city}: {weather.condition}')
     self.cloud_widget = ResizeableImage(f'{os.path.dirname(__file__)}\images\weather\{weather.image}')
     self.temperature_widget = ResizeableText(f'{weather.temperature}{lang["deg_m"]}')
     self.wind_label = ResizeableText(lang['wind'])
     self.wind_widget = ResizeableText(f'{weather.wind} {lang["wind_m"]}, {weather.wind_direction_abbr}')
     self.pressure_label = ResizeableText(lang['pressure'])
     self.pressure_widget = ResizeableText(f'{weather.pressure} {lang["pressure_m"]}')
     self.humidity_label = ResizeableText(lang['humidity'])
     self.humidity_widget = ResizeableText(f'{weather.humidity}{lang["humidity_m"]}')
     self.init_ui()
     self.init_threads()
Exemplo n.º 6
0
 def __str__(self):
     lang = Language()
     return f'{lang["in"]} {self.city} {self.temperature}{lang["deg_m"]}, {self.condition}. ' \
            f'{lang["wind"]} {self.wind} {lang["wind_m"]}, {self.wind_direction}. ' \
            f'{lang["pressure"]} {self.pressure} {lang["pressure_m"]}. ' \
            f'{lang["humidity"]} {self.humidity} {lang["humidity_m"]}.'
Exemplo n.º 7
0
 def update(self):
     lang = Language()
     self.news = NewsController('tutby').current_news("top")
     self.header_label.set_text(f'{lang["news"]} {"(" + self.news[0] + ")" if self.news[0] is not None else " "}')
     for i in range(0, self.news[1].__len__()):
         self.news_labels[i].set_text(self.news[1][i].title)
Exemplo n.º 8
0
 def __str__(self):
     lang = Language()
     return f'{self.scale} {self.currency_name} {lang["to"]} {self.rate} {self.main_currency_name}'