# Path: FabLabKasse/shopping/payment_methods.py
# PAYMENT_METHODS = [FAUCardPayment, AutoCashPayment, ManualCashPayment, ClientPayment]


from PyQt4 import Qt, QtGui, QtCore
from .uic_generated.PaymentMethodDialog import Ui_PaymentMethodDialog
from ..shopping.payment_methods import PAYMENT_METHODS
import functools
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not,
# see <http://www.gnu.org/licenses/>.



class PaymentMethodDialog(QtGui.QDialog, Ui_PaymentMethodDialog):

    def __init__(self, parent, cfg, amount):
        QtGui.QDialog.__init__(self, parent)
        self.setupUi(self)
        self.cfg = cfg

        self.method = None

        # Clear all method buttons
        for i in range(self.layout_methods.count()):
            self.layout_methods.itemAt(i).widget().setVisible(False)
            self.layout_methods.itemAt(i).widget().deleteLater()

        # select available methods (according to config file)
        first_button = True

# Path: FabLabKasse/shopping/payment_methods.py
# PAYMENT_METHODS = [FAUCardPayment, AutoCashPayment, ManualCashPayment, ClientPayment]


# Path: FabLabKasse/UI/PaymentMethodDialogCode.py
from PyQt4 import Qt, QtGui, QtCore
from .uic_generated.PaymentMethodDialog import Ui_PaymentMethodDialog
from ..shopping.payment_methods import PAYMENT_METHODS
import functools

#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with this program. If not,
# see <http://www.gnu.org/licenses/>.



class PaymentMethodDialog(QtGui.QDialog, Ui_PaymentMethodDialog):

    def __init__(self, parent, cfg, amount):
        QtGui.QDialog.__init__(self, parent)
        self.setupUi(self)
        self.cfg = cfg

        self.method = None

        # Clear all method buttons
        for i in range(self.layout_methods.count()):
            self.layout_methods.itemAt(i).widget().setVisible(False)
            self.layout_methods.itemAt(i).widget().deleteLater()

        # select available methods (according to config file)
        first_button = True

        for method in PAYMENT_METHODS: