Exemplo n.º 1
0
	def create_logout():
		meta = {
			"clear_screen": False,
			"links": {
				"#": "00000"
			},
			"publisher_color": 7
		}

		data_cept = bytearray()
		data_cept.extend(Cept.parallel_mode())
		data_cept.extend(Cept.clear_screen())
		data_cept.extend(Cept.set_cursor(2, 1))
		data_cept.extend(Cept.set_screen_bg_color(12))
		data_cept.extend(Cept.set_fg_color(7))
		data_cept.extend(Login_UI.btx_logo())
		data_cept.extend(Cept.set_left_g3())
		data_cept.extend(Cept.set_fg_color(15))
		data_cept.extend(Cept.repeat("Q", 40))
		data_cept.extend(Cept.set_fg_color(7))
		data_cept.extend(Cept.set_left_g0())
		data_cept.extend(Cept.set_cursor(19, 8))
		data_cept.extend(Cept.from_str("Vielen Dank für Ihren Anruf!"))
		data_cept.extend(b'\r\n')
		data_cept.extend(b'\r\n')
		data_cept.extend(Cept.set_left_g3())
		data_cept.extend(Cept.set_fg_color(15))
		data_cept.extend(Cept.repeat("Q", 40))
		return (meta, data_cept)
Exemplo n.º 2
0
 def line():
     data_cept = bytearray()
     data_cept.extend(Cept.set_left_g3())
     data_cept.extend(Cept.set_fg_color(15))
     data_cept.extend(Cept.repeat("Q", 40))
     data_cept.extend(Cept.set_fg_color(7))
     data_cept.extend(Cept.set_left_g0())
     return data_cept
Exemplo n.º 3
0
    def draw(self):
        cept_data = bytearray(Cept.parallel_limited_mode())
        cept_data.extend(Cept.hide_cursor())
        cept_data.extend(Cept.set_cursor(self.line, self.column))
        fill_with_clear_line = self.clear_line and self.width == 40  # and self.height == 1
        fill_with_spaces = self.clear_line and not fill_with_clear_line
        for i in range(0, self.height):
            l = self.__data[i].rstrip()

            if self.type == "password":
                l = "*" * len(l)
            else:
                if l.startswith(chr(Cept.ini())):
                    l = "*" + l[1:]

            if l:
                cept_data.extend(self.set_color())

            if fill_with_clear_line:
                cept_data.extend(Cept.clear_line())
                if self.bgcolor:
                    cept_data.extend(Cept.set_line_bg_color(self.bgcolor))

            cept_data.extend(Cept.from_str(l))

            if fill_with_spaces and len(l) > self.width:
                cept_data.extend(Cept.repeat(" ", self.width - len(l)))

            if i != self.height - 1:
                if self.column == 1:
                    if self.width != 40 or fill_with_clear_line:
                        cept_data.extend(b'\n')
                else:
                    cept_data.extend(
                        Cept.set_cursor(self.line + i + 1, self.column))
        sys.stdout.buffer.write(cept_data)
        sys.stdout.flush()
Exemplo n.º 4
0
    def messaging_create_message_detail(user, index, is_read):
        messages = user.messaging.select(is_read, index, 1)
        if len(messages) == 0:
            return None

        message = messages[0]

        meta = {
            "publisher_name": "Bildschirmtext",
            "include": "11a",
            "palette": "11a",
            "clear_screen": True,
            "links": {
                "0": "89" if is_read else "88",
            },
            "publisher_color": 7
        }

        from_date = message.from_date()
        from_time = message.from_time()
        if message.from_user.personal_data:
            from_street = message.from_user.street
            from_zip = message.from_user.zip
            from_city = message.from_user.city
        else:
            from_street = ""
            from_zip = ""
            from_city = ""

        data_cept = bytearray(Cept.parallel_limited_mode())
        data_cept.extend(Cept.set_cursor(2, 1))
        data_cept.extend(Cept.set_fg_color(3))
        data_cept.extend(b'von ')
        data_cept.extend(
            Cept.from_str(message.from_user.user_id.ljust(12)) + b' ' +
            Cept.from_str(message.from_user.ext.rjust(5, '0')))
        data_cept.extend(Cept.set_cursor(2, 41 - len(from_date)))
        data_cept.extend(Cept.from_str(from_date))
        data_cept.extend(Cept.repeat(" ", 4))
        data_cept.extend(Cept.from_str(message.from_user.org_name))
        data_cept.extend(Cept.set_cursor(3, 41 - len(from_time)))
        data_cept.extend(Cept.from_str(from_time))
        data_cept.extend(Cept.repeat(" ", 4))
        data_cept.extend(Cept.set_fg_color_simple(0))
        data_cept.extend(
            Cept.from_str(message.from_user.first_name) + b' ' +
            Cept.from_str(message.from_user.last_name))
        data_cept.extend(b'\r\n')
        data_cept.extend(Cept.repeat(" ", 4))
        data_cept.extend(Cept.from_str(from_street))
        data_cept.extend(b'\r\n')
        data_cept.extend(Cept.repeat(" ", 4))
        data_cept.extend(Cept.from_str(from_zip))
        data_cept.extend(b' ')
        data_cept.extend(Cept.from_str(from_city))
        data_cept.extend(b'\r\n')
        data_cept.extend(b'an  ')
        data_cept.extend(
            Cept.from_str(user.user_id.ljust(12)) + b' ' +
            Cept.from_str(user.ext.rjust(5, '0')))
        data_cept.extend(b'\r\n')
        data_cept.extend(Cept.repeat(" ", 4))
        data_cept.extend(
            Cept.from_str(user.first_name) + b' ' +
            Cept.from_str(user.last_name))
        data_cept.extend(b'\r\n\n')
        data_cept.extend(Cept.from_str(message.body()))
        data_cept.extend(Cept.set_cursor(23, 1))
        data_cept.extend(b'0')
        data_cept.extend(b'\x1b\x29\x20\x40'  # load DRCs into G1
                         b'\x1b\x7e'  # G1 into right charset
                         )
        data_cept.extend(Cept.from_str(" Gesamtübersicht"))
        data_cept.extend(Cept.repeat(" ", 22))

        user.messaging.mark_as_read(message.index)

        return (meta, data_cept)
Exemplo n.º 5
0
    def create_add_user():
        meta = {
            "publisher_name": "!BTX",
            "include": "a",
            "clear_screen": True,
            "links": {
                "0": "0",
                "1": "88",
                "2": "89",
                "5": "810"
            },
            "inputs": {
                "fields": [
                    {
                        "name": "user_id",
                        "hint": "Gewünschte Nummer oder # eingeben",
                        "line": 6,
                        "column": 19,
                        "height": 1,
                        "width": 10,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "type": "number",
                        "validate": "call:User_UI.callback_validate_user_id"
                    },
                    {
                        "name": "salutation",
                        "hint": "Anrede oder # eingeben",
                        "line": 7,
                        "column": 9,
                        "height": 1,
                        "width": 20,
                        "bgcolor": 12,
                        "fgcolor": 3
                    },
                    {
                        "name": "last_name",
                        "hint": "Nachnamen oder # eingeben",
                        "line": 8,
                        "column": 7,
                        "height": 1,
                        "width": 20,
                        "bgcolor": 12,
                        "validate": "call:User_UI.callback_validate_last_name",
                        "fgcolor": 3
                    },
                    {
                        "name": "first_name",
                        "hint": "Vornamen oder # eingeben",
                        "line": 9,
                        "column": 10,
                        "height": 1,
                        "width": 20,
                        "bgcolor": 12,
                        "fgcolor": 3
                    },
                    {
                        "name": "street",
                        "hint": "Straße und Hausnummer oder # eingeben",
                        "line": 10,
                        "column": 9,
                        "height": 1,
                        "width": 20,
                        "bgcolor": 12,
                        "fgcolor": 3
                    },
                    {
                        "name": "zip",
                        "hint": "Postleitzahl oder # eingeben",
                        "line": 11,
                        "column": 6,
                        "height": 1,
                        "width": 5,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "type": "number"
                    },
                    {
                        "name": "city",
                        "hint": "Ort oder # eingeben",
                        "line": 11,
                        "column": 17,
                        "height": 1,
                        "width": 13,
                        "bgcolor": 12,
                        "fgcolor": 3
                    },
                    {
                        "name": "country",
                        "hint": "Land oder # eingeben",
                        "line": 11,
                        "column": 37,
                        "height": 1,
                        "width": 2,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "default": "de",
                        "type": "alpha",
                        "cursor_home": True,
                        "overwrite": True
                    },
                    {
                        "name": "block_payments",
                        "hint": "j/n oder # eingeben",
                        "line": 13,
                        "column": 25,
                        "height": 1,
                        "width": 1,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "default": "n",
                        "cursor_home": True,
                        "legal_values": ["j", "n"]
                    },
                    {
                        "name": "block_fees",
                        "hint": "j/n oder # eingeben",
                        "line": 14,
                        "column": 25,
                        "height": 1,
                        "width": 1,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "default": "n",
                        "cursor_home": True,
                        "legal_values": ["j", "n"]
                    },
                    {
                        "name": "pocket_money_major",
                        "hint": "0-9 oder # eingeben",
                        "line": 15,
                        "column": 34,
                        "height": 1,
                        "width": 1,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "default": "9",
                        "type": "number",
                        "cursor_home": True,
                        "overwrite": True
                    },
                    {
                        "name": "pocket_money_minor",
                        "hint": "00-99 oder # eingeben",
                        "line": 15,
                        "column": 36,
                        "height": 1,
                        "width": 2,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "default": "99",
                        "type": "number",
                        "cursor_home": True,
                        "overwrite": True
                    },
                    {
                        "name": "max_price_major",
                        "hint": "0-9 oder # eingeben",
                        "line": 16,
                        "column": 34,
                        "height": 1,
                        "width": 1,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "default": "9",
                        "type": "number",
                        "cursor_home": True,
                        "overwrite": True
                    },
                    {
                        "name": "max_price_minor",
                        "hint": "00-99 oder # eingeben",
                        "line": 16,
                        "column": 36,
                        "height": 1,
                        "width": 2,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "default": "99",
                        "type": "number",
                        "cursor_home": True,
                        "overwrite": True
                    },
                    {
                        "name": "password",
                        "hint": "Neues Kennwort",
                        "line": 19,
                        "column": 11,
                        "height": 1,
                        "width": 14,
                        "bgcolor": 12,
                        "fgcolor": 3,
                        "type": "password",
                        "validate": "call:User_UI.callback_validate_password",
                    },
                ],
                "confirm":
                False,
                "target":
                "call:User_UI.callback_add_user",
            },
            "publisher_color": 7
        }

        data_cept = bytearray()
        data_cept.extend(User_UI.create_title("Neuen Benutzer einrichten"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Teilnehmernummer:"))
        data_cept.extend(Cept.set_cursor(6, 29))
        data_cept.extend(Cept.from_str("-1"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Anrede:"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Name:"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Vorname:"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Straße:"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("PLZ:"))
        data_cept.extend(Cept.repeat(" ", 7))
        data_cept.extend(Cept.from_str("Ort:"))
        data_cept.extend(Cept.set_cursor(11, 31))
        data_cept.extend(Cept.from_str("Land:"))
        data_cept.extend(b"\r\n")
        data_cept.extend(User_UI.line())
        data_cept.extend(Cept.from_str("Vergütungssperre aktiv:"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Gebührensperre   aktiv:"))
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Taschengeldkonto      :"))
        data_cept.extend(Cept.set_cursor(15, 35))
        data_cept.extend(Cept.from_str(",   DM"))
        data_cept.extend(Cept.from_str("Max. Vergütung/Seite  :"))
        data_cept.extend(Cept.set_cursor(16, 35))
        data_cept.extend(Cept.from_str(",   DM"))
        data_cept.extend(User_UI.line())
        data_cept.extend(b"\r\n")
        data_cept.extend(Cept.from_str("Kennwort: "))
        data_cept.extend(b"\r\n\r\n")
        data_cept.extend(User_UI.line())
        return (meta, data_cept)
Exemplo n.º 6
0
    def create_article_page(sheet_number):
        is_first_page = sheet_number == 0

        if not RSS_UI.feed:
            RSS_UI.feed = feedparser.parse(
                "https://www.pagetable.com/?feed=rss2")

        entry = RSS_UI.feed["entries"][6]
        title = entry["title"]
        html = entry["content"][0]["value"]
        soup = BeautifulSoup(html, 'html.parser')

        page = Cept_page_from_HTML()
        page.soup = soup
        page.article_prefix = "XXX"
        page.insert_html_tags(soup.children)

        meta = {
            "clear_screen": True,
            "links": {
                "0": "0"
            },
            "publisher_color": 0
        }

        data_cept = bytearray()
        data_cept.extend(Cept.parallel_mode())

        if is_first_page:
            data_cept.extend(Cept.set_screen_bg_color(7))
            data_cept.extend(Cept.set_cursor(2, 1))
            data_cept.extend(Cept.set_line_bg_color(0))
            data_cept.extend(b'\n')
            data_cept.extend(Cept.set_line_bg_color(0))
            data_cept.extend(Cept.double_height())
            data_cept.extend(Cept.set_fg_color(7))
            data_cept.extend(Cept.from_str(title[:39]))
            data_cept.extend(b'\r\n')
            data_cept.extend(Cept.normal_size())
            data_cept.extend(b'\n')

        # print navigation
        # * on sheet 0, so we don't have to print it again on later sheets
        # * on the last sheet, because it doesn't show the "#" text
        # * on the second last sheet, because navigating back from the last one needs to show "#" again
        if sheet_number == 0 or sheet_number >= page.number_of_sheets() - 2:
            data_cept.extend(Cept.set_cursor(23, 1))
            data_cept.extend(Cept.set_line_bg_color(0))
            data_cept.extend(Cept.set_fg_color(7))
            data_cept.extend(Cept.from_str("0 < Back"))
            s = "# > Next"
            data_cept.extend(Cept.set_cursor(23, 41 - len(s)))
            if sheet_number == page.number_of_sheets() - 1:
                data_cept.extend(Cept.repeat(" ", len(s)))
            else:
                data_cept.extend(Cept.from_str(s))

        data_cept.extend(Cept.set_cursor(5, 1))

        # add text
        data_cept.extend(page.cept_for_sheet(sheet_number))

        return (meta, data_cept)
Exemplo n.º 7
0
	def create_login():
		meta = {
			"clear_screen": False,
			"links": {
			},
			"publisher_color": 7,
			"inputs": {
				"fields": [
					{
						"name": "user_id",
						"hint": "Teilnehmernummer oder # eingeben",
						"line": 18,
						"column": 26,
						"height": 1,
						"width": 10,
						"bgcolor": 12,
						"fgcolor": 3
					},
					{
						"name": "ext",
						"hint": "Mitbenutzer oder # eingeben",
						"line": 18,
						"column": 37,
						"height": 1,
						"width": 1,
						"bgcolor": 12,
						"fgcolor": 3,
						"type": "number",
						"cursor_home": True,
						"default": "1"
					},
					{
						"name": "password",
						"hint": "Nächstes Feld mit #; Leer für Gast",
						"line": 20,
						"column": 26,
						"height": 1,
						"width": 14,
						"bgcolor": 12,
						"fgcolor": 3,
						"type": "password",
						"validate": "call:Login_UI.callback_login"
					}
				],
				"confirm": False,
				"target": "page:000001a",
				"no_navigation": True
			}
		}

		data_cept = bytearray()
		data_cept.extend(Cept.parallel_mode())
		data_cept.extend(Cept.clear_screen())
		data_cept.extend(Cept.set_cursor(2, 1))
		data_cept.extend(Cept.set_screen_bg_color(12))
		data_cept.extend(Cept.set_fg_color(7))
		data_cept.extend(Login_UI.btx_logo())
		data_cept.extend(Cept.set_left_g3())
		data_cept.extend(Cept.set_fg_color(15))
		data_cept.extend(Cept.repeat("Q", 40))
		data_cept.extend(Cept.set_fg_color(7))
		data_cept.extend(Cept.set_left_g0())
		data_cept.extend(Cept.set_cursor(18, 8))
		data_cept.extend(Cept.from_str("Teilnehmer"))
		data_cept.extend(Cept.set_cursor(18, 25))
		data_cept.extend(b":")
		data_cept.extend(Cept.set_cursor(18, 36))
		data_cept.extend(Cept.set_fg_color(3))
		data_cept.extend(b'-')
		data_cept.extend(Cept.set_fg_color(7))
		data_cept.extend(Cept.set_cursor(20, 8))
		data_cept.extend(Cept.from_str("persönl. Kennwort:"))
		data_cept.extend(b'\r\n')
		data_cept.extend(Cept.set_left_g3())
		data_cept.extend(Cept.set_fg_color(15))
		data_cept.extend(Cept.repeat("Q", 40))
		return (meta, data_cept)