예제 #1
0
    def __init__(self, width, height, owner):

        ScreenGUI.__init__(self, width, height, owner)

        self.border = Border(width, height)

        ##
        ## Fixed position objects
        ##
        self.path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # script directory
        self.objects = {
                'titleimage' : LCARSImage(pygame.Rect(width/2, height*3/5, 0, 0), self.path + LOGO_PATH, True),
                }

        ##
        ## Import standard objects

        self.objects.update(self.border.get_border())

        ##
        ## Position-dependant objects
        ##

        self.set_intro_text("Searching for remote database...", Colours.FG)
        self.set_intro_text_2("Don't have a card? Seeing error messages?", Colours.FG)
        self.set_intro_text_3("Pop money in the pot instead!", Colours.FG)
예제 #2
0
    def __init__(self, width, height, owner):

        ScreenGUI.__init__(self, width, height, owner)

        self.border = Border(width, height)

        ##
        ## Fixed position objects
        ##
        self.path = os.path.dirname(
            os.path.abspath(inspect.getfile(
                inspect.currentframe())))  # script directory
        self.objects = {
            'titleimage':
            LCARSImage(pygame.Rect(width / 2, height * 3 / 5, 0, 0),
                       self.path + LOGO_PATH, True),
        }

        ##
        ## Import standard objects

        self.objects.update(self.border.get_border())

        ##
        ## Position-dependant objects
        ##

        self.set_intro_text("Searching for remote database...", Colours.FG)
        self.set_intro_text_2("Don't have a card? Seeing error messages?",
                              Colours.FG)
        self.set_intro_text_3("Pop money in the pot instead!", Colours.FG)
예제 #3
0
    def __init__(self, width, height, owner):

        ScreenGUI.__init__(self, width, height, owner)

        border = Border(width, height)

        self.buttons = Enum("BARCODE", "DESCRIPTION", "PRICE", "DONE",
                            "CANCEL")

        # #
        # # Fixed position objects
        # #

        minx = border.inner_x() + 4 * Widths.BORDER
        maxx = width - Widths.BORDER
        miny = border.inner_y() + 4 * Widths.BORDER
        maxy = height - Widths.BORDER

        buttonh = 50
        buttonw = 100

        fullwidth = maxx - minx

        self.default_text = {
            self.buttons.BARCODE: "1. Scan an item",
            self.buttons.DESCRIPTION: "2. Type a description",
            self.buttons.PRICE: "3. Set a price",
        }

        self.objects = {
            self.buttons.BARCODE:
            LCARSCappedBar(pygame.Rect(minx, miny, fullwidth, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "1. Scan an item", Colours.ENTRY, Colours.BG, True),
            self.buttons.DESCRIPTION:
            LCARSCappedBar(
                pygame.Rect(minx, miny + (2 * buttonh), fullwidth, buttonh),
                CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                "2. Type a description", Colours.ERR, Colours.BG, True),
            self.buttons.PRICE:
            LCARSCappedBar(
                pygame.Rect(minx, miny + (4 * buttonh), fullwidth, buttonh),
                CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "3. Set a price",
                Colours.ERR, Colours.BG, True),
            self.buttons.DONE:
            LCARSCappedBar(pygame.Rect(minx, maxy - buttonh, buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "Done", Colours.FG, Colours.BG, True),
            self.buttons.CANCEL:
            LCARSCappedBar(
                pygame.Rect(maxx - buttonw, maxy - buttonh, buttonw, buttonh),
                CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Cancel",
                Colours.FG, Colours.BG, True),
        }

        # #
        # # Import standard objects
        # #
        self.objects.update(border.get_border())
예제 #4
0
    def get_object_id(self, pos):
        """ Returns the ID of the object at the given position """
        object_id = ScreenGUI.get_object_id(self, pos)

        if object_id == -1:
            # Try searching remove buttons
            if self.product_displays.collide_on_remove(pos) is not None:
                object_id = self.ids.REMOVE
            
        return object_id
예제 #5
0
    def __init__(self, width, height, owner):
        
        ScreenGUI.__init__(self, width, height, owner)
        self.border = Border(width, height)

        # Object constant definitions
        # Reverse draw order - 0 drawn last
        self.ids = Enum("DONE", "CANCEL", "PAY", "TOPBAR", "AMOUNT", "UP", "DOWN", "PRODUCT", "REMOVE")
        
        self.limits = Const()
        self.limits.screen_products = 5
        self.limits.objects_per_product_row = 3

        self.logger = logging.getLogger("MainScreen.GUI")
        
        self.product_displays = ProductDisplayCollection(self.limits.screen_products)
        
        # #
        # # Fixed position objects
        # #
        self.layout = MainScreenLayout(width, height, self.border)

        self.objects = {
            self.ids.DONE: LCARSCappedBar(
                self.layout.get_done_rect(), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Done", Colours.FG, Colours.BG, False),
            self.ids.PAY:LCARSCappedBar(
                self.layout.get_pay_rect(), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Pay debt", Colours.FG, Colours.BG, False),
            self.ids.CANCEL:LCARSCappedBar(
                self.layout.get_cancel_rect(), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Cancel", Colours.FG, Colours.BG, True),
            self.ids.TOPBAR:LCARSCappedBar(
                self.layout.get_top_bar_rect(), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "User: <No user scanned>", Colours.FG, Colours.BG, True),
            self.ids.UP: LCARSCappedBar(
                self.layout.get_up_scroll_rect(), CapLocation.CAP_TOP, "UP", Colours.FG, Colours.BG, False),
            self.ids.DOWN: LCARSCappedBar(
                self.layout.get_down_scroll_rect(), CapLocation.CAP_BOTTOM, "DN", Colours.FG, Colours.BG, False),
            self.ids.AMOUNT:LCARSCappedBar(
                self.layout.get_amount_rect(), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Total Spend: \xA30.00", Colours.FG, Colours.BG, True)
        }

        # #
        # # Import standard objects
        # #
        self.objects.update(self.border.get_border())
예제 #6
0
    def get_object_id(self, pos):
        """ Returns the ID of the object at the given position """
        object_id = ScreenGUI.get_object_id(self, pos)

        if object_id == -1:
            # Try searching remove buttons
            if self.product_displays.collide_on_remove(pos) is not None:
                object_id = self.ids.REMOVE

        return object_id
예제 #7
0
    def __init__(self, width, height, owner):

        ScreenGUI.__init__(self, width, height, owner)

        border = Border(width, height)

        self.buttons = Enum("BARCODE", "DESCRIPTION", "PRICE", "DONE", "CANCEL")

        # #
        # # Fixed position objects
        # #

        minx = border.inner_x() + 4 * Widths.BORDER
        maxx = width - Widths.BORDER
        miny = border.inner_y() + 4 * Widths.BORDER
        maxy = height - Widths.BORDER

        buttonh = 50
        buttonw = 100

        fullwidth = maxx - minx

        self.default_text = {
                        self.buttons.BARCODE : "1. Scan an item",
                        self.buttons.DESCRIPTION : "2. Type a description",
                        self.buttons.PRICE : "3. Set a price",
                        }

        self.objects = {
            self.buttons.BARCODE        : LCARSCappedBar(pygame.Rect(minx, miny, fullwidth, buttonh), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "1. Scan an item", Colours.ENTRY, Colours.BG, True),
            self.buttons.DESCRIPTION    : LCARSCappedBar(pygame.Rect(minx, miny + (2 * buttonh), fullwidth, buttonh), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "2. Type a description", Colours.ERR, Colours.BG, True),
            self.buttons.PRICE          : LCARSCappedBar(pygame.Rect(minx, miny + (4 * buttonh), fullwidth, buttonh), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "3. Set a price", Colours.ERR, Colours.BG, True),
            self.buttons.DONE           : LCARSCappedBar(pygame.Rect(minx, maxy - buttonh, buttonw, buttonh), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Done", Colours.FG, Colours.BG, True),
            self.buttons.CANCEL         : LCARSCappedBar(pygame.Rect(maxx - buttonw, maxy - buttonh, buttonw, buttonh), CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Cancel", Colours.FG, Colours.BG, True),
        }

        # #
        # # Import standard objects
        # #
        self.objects.update(border.get_border())
예제 #8
0
    def __init__(self, width, height, owner):

        ScreenGUI.__init__(self, width, height, owner)

        border = Border(width, height)

        ##
        ## Fixed position objects
        ##

        buttonw = 100
        largebuttonw = buttonw * 2
        amountentryw = (buttonw * 4) + (Widths.BORDER * 4)

        ## Column and row x, y locations
        cx = [0, 0, 0, 0]  #pylint: disable=C0103
        cx[0] = 200
        cx[1] = cx[0] + buttonw + Widths.BORDER
        cx[2] = cx[1] + buttonw + Widths.BORDER
        cx[3] = cx[2] + buttonw + Widths.BORDER + Widths.BORDER
        buttonh = 50
        amountentryh = buttonh * 1.5

        ry = [0, 0, 0, 0]  #pylint: disable=C0103
        ry[0] = 125
        ry[1] = ry[0] + amountentryh + Widths.BORDER
        ry[2] = ry[1] + buttonh + Widths.BORDER
        ry[3] = ry[2] + buttonh + Widths.BORDER
        r5y = ry[3] + buttonh + Widths.BORDER
        r6y = r5y + buttonh + Widths.BORDER

        cancelbuttonx = cx[
            3] + buttonw - largebuttonw  #Right align the "cancel" button

        self.keys = Enum("KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5",
                         "KEY6", "KEY7", "KEY8", "KEY9", "FIVEPOUNDS",
                         "TENPOUNDS", "TWENTYPOUNDS", "DONE", "CANCEL",
                         "AMOUNT")

        self.objects = {
            self.keys.AMOUNT:
            LCARSCappedBar(
                pygame.Rect(cx[0], ry[0], amountentryw, amountentryh),
                CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "\xA30.00",
                Colours.FG, Colours.BG, True),
            self.keys.KEY0:
            LCARSCappedBar(pygame.Rect(cx[0], r5y, buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "0",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY1:
            LCARSCappedBar(pygame.Rect(cx[0], ry[3], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "1",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY2:
            LCARSCappedBar(pygame.Rect(cx[1], ry[3], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "2",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY3:
            LCARSCappedBar(pygame.Rect(cx[2], ry[3], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "3",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY4:
            LCARSCappedBar(pygame.Rect(cx[0], ry[2], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "4",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY5:
            LCARSCappedBar(pygame.Rect(cx[1], ry[2], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "5",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY6:
            LCARSCappedBar(pygame.Rect(cx[2], ry[2], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "6",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY7:
            LCARSCappedBar(pygame.Rect(cx[0], ry[1], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "7",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY8:
            LCARSCappedBar(pygame.Rect(cx[1], ry[1], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "8",
                           Colours.FG, Colours.BG, True),
            self.keys.KEY9:
            LCARSCappedBar(pygame.Rect(cx[2], ry[1], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "9",
                           Colours.FG, Colours.BG, True),
            self.keys.FIVEPOUNDS:
            LCARSCappedBar(pygame.Rect(cx[3], ry[1], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           u"\xA35", Colours.FG, Colours.BG, True),
            self.keys.TENPOUNDS:
            LCARSCappedBar(pygame.Rect(cx[3], ry[2], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           u"\xA310", Colours.FG, Colours.BG, True),
            self.keys.TWENTYPOUNDS:
            LCARSCappedBar(pygame.Rect(cx[3], ry[3], buttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           u"\xA320", Colours.FG, Colours.BG, True),
            self.keys.DONE:
            LCARSCappedBar(pygame.Rect(cx[0], r6y, largebuttonw, buttonh),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "Done", Colours.FG, Colours.BG, True),
            self.keys.CANCEL:
            LCARSCappedBar(
                pygame.Rect(cancelbuttonx, r6y, largebuttonw, buttonh),
                CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT, "Cancel",
                Colours.FG, Colours.BG, True),
        }

        ##
        ## Import standard objects

        self.objects.update(border.get_border())
예제 #9
0
    def __init__(self, width, height, owner):

        ScreenGUI.__init__(self, width, height, owner)
        self.border = Border(width, height)

        # Object constant definitions
        # Reverse draw order - 0 drawn last
        self.ids = Enum("DONE", "CANCEL", "PAY", "TOPBAR", "AMOUNT", "UP",
                        "DOWN", "PRODUCT", "REMOVE")

        self.limits = Const()
        self.limits.screen_products = 5
        self.limits.objects_per_product_row = 3

        self.logger = logging.getLogger("MainScreen.GUI")

        self.product_displays = ProductDisplayCollection(
            self.limits.screen_products)

        # #
        # # Fixed position objects
        # #
        self.layout = MainScreenLayout(width, height, self.border)

        self.objects = {
            self.ids.DONE:
            LCARSCappedBar(self.layout.get_done_rect(),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "Done", Colours.FG, Colours.BG, False),
            self.ids.PAY:
            LCARSCappedBar(self.layout.get_pay_rect(),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "Pay debt", Colours.FG, Colours.BG, False),
            self.ids.CANCEL:
            LCARSCappedBar(self.layout.get_cancel_rect(),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "Cancel", Colours.FG, Colours.BG, True),
            self.ids.TOPBAR:
            LCARSCappedBar(self.layout.get_top_bar_rect(),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "User: <No user scanned>", Colours.FG, Colours.BG,
                           True),
            self.ids.UP:
            LCARSCappedBar(self.layout.get_up_scroll_rect(),
                           CapLocation.CAP_TOP, "UP", Colours.FG, Colours.BG,
                           False),
            self.ids.DOWN:
            LCARSCappedBar(self.layout.get_down_scroll_rect(),
                           CapLocation.CAP_BOTTOM, "DN", Colours.FG,
                           Colours.BG, False),
            self.ids.AMOUNT:
            LCARSCappedBar(self.layout.get_amount_rect(),
                           CapLocation.CAP_LEFT + CapLocation.CAP_RIGHT,
                           "Total Spend: \xA30.00", Colours.FG, Colours.BG,
                           True)
        }

        # #
        # # Import standard objects
        # #
        self.objects.update(self.border.get_border())