コード例 #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)
コード例 #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)
コード例 #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')
コード例 #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)
コード例 #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
コード例 #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)
コード例 #7
0
ファイル: main.py プロジェクト: samrs/calculadora-de-monedas
 def __init__(self):
     self.__master = MainView(convert_handler=self.__convert)
     self.__currency = CurrencyManager.get_currency("USD")
コード例 #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))
コード例 #9
0
 def __init__(self):
     self.__master = MainView(convert_handler=self.__convert)
     self.__currency = CurrencyManager.get_currency(
         self.__master.Constants.default_from_currency)
コード例 #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)
コード例 #11
0
 def __init__(self):
     self.__master = MainView(convert_handler=self.__convert)
     self.__currency = CurrencyManager.get_currency(
         self.__master.Constants.exchange_rate)
コード例 #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)
コード例 #13
0
 def __get_currency(self, value):
     self.__currency = CurrencyManager.get_currency(value)
     self.__currencies = self.__currency.rates
コード例 #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)