Exemplo n.º 1
0
 def __convert(self, from_currency, to_currency, ammount):
     self.__currency = CurrencyManager.get_currency(from_currency)
     if from_currency == to_currency:
         result = ammount
     else:
         result = str(self.__currency.get_convertion(to_currency, ammount))
     self.__master.update_result(result)
Exemplo n.º 2
0
 def __convert(self, from_currency, to_currency, ammount):
     self.initial_currency = from_currency
     self.initial_convertion = CurrencyManager.get_currency(
         self.initial_currency)
     result = str(
         self.initial_convertion.get_convertion(to_currency, ammount))
     self.__master.update_result(result)
Exemplo n.º 3
0
    def __convert(self, from_currency, to_currency, ammount):
        self.__currency = CurrencyManager.get_currency(from_currency)
        try:
            result = str(self.__currency.get_convertion(to_currency, ammount))
            self.__master.update_result(result)
        except Exception as NoneType:

            print('None Type error in Currency')
Exemplo n.º 4
0
 def menu(self):
     self.name_of_convertion.name = all_options
     option = StringVar()
     option.set(all_options)
     currency_menu = OptionMenu(self, option, *all_options)
     currency_menu.pack(side=left)
     self.__currency = CurrencyManager.get_currency(option)
     self.__master.__configure_UI(option)
Exemplo n.º 5
0
    def __convert(self, from_currency, to_currency, ammount):

        if from_currency == to_currency:
            return self.__master.update_result(ammount)
        try:
            if from_currency != self.__master.Constants.new_exchange_rate:
                self.__currency = CurrencyManager.get_currency(
                    self.__master.Constants.new_exchange_rate)
            result = str(self.__currency.get_convertion(to_currency, ammount))
            self.__master.update_result(result)
        except ValueError:
            return None
Exemplo n.º 6
0
 def __did_tap_convert(self, event):
     if self.__convert_handler is None:
         return
     try:
         ammount_to_convert = float(self.__currency_input.get())
     except ValueError:
         return
     else:
         self.__currency = CurrencyManager.get_currency(
             self.__original_currency.get())
         result = str(
             self.__currency.get_convertion(self.__currency_to_change.get(),
                                            ammount_to_convert))
         self.update_result(result)
Exemplo n.º 7
0
 def __init__(self):
     self.__master = MainView(convert_handler=self.__convert)
     self.__currency = CurrencyManager.get_currency("USD")
Exemplo n.º 8
0
 def __convert(self, from_currency, to_currency, ammount):
     self.__currency = CurrencyManager.get_currency(from_currency)
     result = str(self.__currency.get_convertion(to_currency, ammount))
Exemplo n.º 9
0
 def __init__(self):
     self.__master = MainView(convert_handler=self.__convert)
     self.__currency = CurrencyManager.get_currency(
         self.__master.Constants.default_from_currency)
Exemplo n.º 10
0
 def __convert(self, from_currency, to_currency, ammount):
     self.__currency = CurrencyManager.get_currency(
         self.__master.get_from_currency())
     result = str(self.__currency.get_convertion(to_currency, ammount))
     self.__master.update_result(result)
Exemplo n.º 11
0
 def __init__(self):
     self.__master = MainView(convert_handler=self.__convert)
     self.__currency = CurrencyManager.get_currency(
         self.__master.Constants.exchange_rate)
Exemplo n.º 12
0
 def __init__(self):
     self.__currency = CurrencyManager.get_currency("MXN")
     self.__menu = self.__currency.name
     self.__master = MainView(convert_handler=self.__convert,
                              menu=self.__menu)
Exemplo n.º 13
0
 def __get_currency(self, value):
     self.__currency = CurrencyManager.get_currency(value)
     self.__currencies = self.__currency.rates
Exemplo n.º 14
0
 def __init__(self):
     self.__currency = CurrencyManager.get_currency("USD")
     self.__options_menu = self.__currency.rates
     self.__master = MainView(convert_handler=self.__convert,
                              options_menu=self.__options_menu)