Пример #1
0
    def footer(left, right):
        data_cept = bytearray()
        data_cept.extend(Cept.set_cursor(23, 1))
        data_cept.extend(Cept.set_palette(0))
        data_cept.extend(Cept.set_line_bg_color_simple(4))
        data_cept.extend(Cept.from_str(left))

        if right:
            data_cept.extend(Cept.set_cursor(23, 41 - len(right)))
            data_cept.extend(Cept.from_str(right))

        return data_cept
Пример #2
0
 def create_title2(title):
     data_cept = bytearray(Cept.set_cursor(2, 1))
     data_cept.extend(Cept.set_palette(1))
     data_cept.extend(Cept.set_screen_bg_color_simple(4))
     data_cept.extend(b'\x1b\x28\x40'  # load G0 into G0
                      b'\x0f'  # G0 into left charset
                      )
     data_cept.extend(Cept.parallel_mode())
     data_cept.extend(Cept.set_palette(0))
     data_cept.extend(Cept.code_9e())
     data_cept.extend(Cept.set_line_bg_color_simple(4))
     data_cept.extend(b'\n')
     data_cept.extend(Cept.set_line_bg_color_simple(4))
     data_cept.extend(Cept.set_palette(1))
     data_cept.extend(Cept.double_height())
     data_cept.extend(b'\r')
     data_cept.extend(Cept.from_str(title))
     data_cept.extend(b'\n\r')
     data_cept.extend(Cept.set_palette(0))
     data_cept.extend(Cept.normal_size())
     data_cept.extend(Cept.code_9e())
     data_cept.extend(Cept.set_fg_color_simple(7))
     return data_cept
Пример #3
0
def headerfooter(pageid, publisher_name, publisher_color):
	hide_header_footer = len(publisher_name) == 0
	hide_price = False
	# Early screenshots had a two-line publisher name with
	# the BTX logo in it for BTX-internal pages. Some .meta
	# files still reference this, but we should remove this.
	if publisher_name == "!BTX":
#		publisher_name = (
#			b'\x1b\x22\x41'                 # parallel mode
#			b'\x9b\x30\x40'                 # select palette #0
#			b'\x9e'                         # ???
#			b'\x87'                         # set fg color to #7
#			b'\x1b\x28\x20\x40'             # load DRCs into G0
#			b'\x0f'                         # G0 into left charset
#			b'\x21\x22\x23'                 # "!"#"
#			b'\n'
#			b'\r'
#			b'\x24\x25\x26'                 # "$%&"
#			b'\x0b'                         # cursor up
#			b'\x09'                         # cursor right
#			b'\x1b\x28\x40'                 # load G0 into G0
#			b'\x0f'                         # G0 into left charset
#			b'\n'
#			b'\x8d'                         # double height
#			# TODO: this does not draw!! :(
#			b'Bildschirmtext'
#		)
		publisher_name = "Bildschirmtext"
		hide_price = True
	else:
		publisher_name = publisher_name[:30]

	hf = bytearray(Cept.set_res_40_24())
	hf.extend(Cept.set_cursor(23, 1))
	hf.extend(Cept.unprotect_line())
	hf.extend(Cept.set_line_fg_color_simple(12))
	hf.extend(Cept.parallel_limited_mode())
	hf.extend(Cept.set_cursor(24, 1))
	hf.extend(Cept.unprotect_line())
	hf.extend(b' \b')
	hf.extend(Cept.clear_line())
	hf.extend(Cept.cursor_home())
	hf.extend(Cept.unprotect_line())
	hf.extend(b' \b')
	hf.extend(Cept.clear_line())
	hf.extend(Cept.serial_limited_mode())
	hf.extend(Cept.set_cursor(24, 1))
	hf.extend(Cept.set_fg_color(8))
	hf.extend(b'\b')
	hf.extend(Cept.code_9d())
	hf.extend(b'\b')

	if publisher_color < 8:
		color_string = Cept.set_fg_color(publisher_color)
	else:
		color_string = Cept.set_fg_color_simple(publisher_color - 8)

	hf.extend(color_string)

	hf.extend(Cept.set_cursor(24, 19))

	if not hide_header_footer:
		hf.extend(Cept.from_str(pageid).rjust(22))

	hf.extend(Cept.cursor_home())
	hf.extend(Cept.set_palette(1))
	hf.extend(Cept.set_fg_color(8))
	hf.extend(b'\b')
	hf.extend(Cept.code_9d())
	hf.extend(b'\b')
	
	hf.extend(color_string)

	hf.extend(b'\r')

	hf.extend(Cept.from_str(publisher_name))

	# TODO: price
	if not hide_header_footer and not hide_price:
		hf.extend(Cept.set_cursor(1, 31))
		hf.extend(b'  ')
		hf.extend(Cept.from_str(Util.format_currency(0)))

	hf.extend(Cept.cursor_home())
	hf.extend(Cept.set_palette(0))
	hf.extend(Cept.protect_line())
	hf.extend(b'\n')
	return hf
Пример #4
0
    def messaging_create_compose(user):
        meta = {
            "include": "a",
            "clear_screen": True,
            "links": {
                "0": "8"
            },
            "publisher_color": 7,
            "inputs": {
                "fields": [{
                    "name":
                    "user_id",
                    "type":
                    "user_id",
                    "line":
                    8,
                    "column":
                    20,
                    "height":
                    1,
                    "width":
                    16,
                    "bgcolor":
                    4,
                    "fgcolor":
                    3,
                    "validate":
                    "call:Messaging_UI.callback_validate_user_id"
                }, {
                    "name":
                    "ext",
                    "type":
                    "ext",
                    "line":
                    8,
                    "column":
                    37,
                    "height":
                    1,
                    "width":
                    1,
                    "bgcolor":
                    4,
                    "fgcolor":
                    3,
                    "default":
                    "1",
                    "validate":
                    "call:Messaging_UI.callback_validate_ext"
                }, {
                    "name": "body",
                    "line": 12,
                    "column": 1,
                    "height": 10,
                    "width": 40,
                    "bgcolor": 4,
                    "fgcolor": 3
                }],
                "action":
                "send_message",
                "price":
                30,
                "target":
                "page:8"
            }
        }

        current_date = datetime.datetime.now().strftime("%d.%m.%Y")
        current_time = datetime.datetime.now().strftime("%H:%M")

        data_cept = bytearray(Cept.set_cursor(2, 1))
        data_cept.extend(Cept.set_palette(1))
        data_cept.extend(Cept.set_screen_bg_color_simple(4))
        data_cept.extend(b'\x1b\x28\x40'  # load G0 into G0
                         )
        data_cept.extend(b'\x0f'  # G0 into left charset
                         )
        data_cept.extend(Cept.parallel_mode())
        data_cept.extend(Cept.set_palette(0))
        data_cept.extend(Cept.code_9e())
        data_cept.extend(b'\n\r')
        data_cept.extend(Cept.set_line_bg_color_simple(4))
        data_cept.extend(b'\n')
        data_cept.extend(Cept.set_line_bg_color_simple(4))
        data_cept.extend(Cept.set_palette(1))
        data_cept.extend(Cept.double_height())
        data_cept.extend(b'\r')
        data_cept.extend(Cept.from_str("Mitteilungsdienst"))
        data_cept.extend(b'\n\r')
        data_cept.extend(Cept.set_palette(0))
        data_cept.extend(Cept.normal_size())
        data_cept.extend(Cept.code_9e())
        data_cept.extend(Cept.set_fg_color_simple(7))
        data_cept.extend(Cept.from_str("Absender:"))
        data_cept.extend(Cept.from_str(user.user_id))
        data_cept.extend(Cept.set_cursor(5, 25))
        data_cept.extend(Cept.from_str(user.ext))
        data_cept.extend(Cept.set_cursor(6, 10))
        data_cept.extend(Cept.from_str(user.first_name))
        data_cept.extend(Cept.set_cursor(7, 10))
        data_cept.extend(Cept.from_str(user.last_name))
        data_cept.extend(Cept.set_cursor(5, 31))
        data_cept.extend(Cept.from_str(current_date))
        data_cept.extend(Cept.set_cursor(6, 31))
        data_cept.extend(Cept.from_str(current_time))
        data_cept.extend(b'\r\n\n')
        data_cept.extend(Cept.from_str("Tln.-Nr. Empfänger:"))
        data_cept.extend(Cept.set_cursor(8, 36))
        data_cept.extend(b'-' b'\r\n\n\n')
        data_cept.extend(b'Text:')
        data_cept.extend(b'\r\n\n\n\n\n\n\n\n\n\n\n\n')
        data_cept.extend(Cept.set_line_bg_color_simple(4))
        data_cept.extend(b'0')
        data_cept.extend(b'\x19'  # switch to G2 for one character
                         b'\x2b\xfe\x7f'  # "+."
                         )
        return (meta, data_cept)
Пример #5
0
	def create_start(user):
		links = { "#": "0" }
		
		if user.messaging.has_new_messages():
			links["8"] = "88"

		if user.user_id == "0":
			links["7"] = "77"

		meta = {
			"include": "a",
			"clear_screen": True,
			"links": links,
			"publisher_color": 7
		}

		t = datetime.datetime.now()
		current_date = t.strftime("%d.%m.%Y  %H:%M")
		if user.stats.last_login is not None:
			t = datetime.datetime.fromtimestamp(user.stats.last_login)
			last_date = t.strftime("%d.%m.%Y")
			last_time = t.strftime("%H:%M")
		else:
			last_date = "--.--.----"
			last_time = "--:--"

		user_name = ""
		if user.salutation:
			user_name += user.salutation + "\n"
		if user.first_name:
			user_name += user.first_name + "\n"
		if user.last_name:
			user_name += user.last_name + "\n"

		notifications = Login_UI.notifications(user)

		data_cept = bytearray()
		data_cept.extend(Cept.clear_screen())
		data_cept.extend(Cept.cursor_home())
		data_cept.extend(b'\n')
		data_cept.extend(Cept.set_palette(1))
		data_cept.extend(Cept.set_screen_bg_color_simple(4))
		data_cept.extend(Cept.load_g0_g0())
		data_cept.extend(Cept.set_left_g0())
		data_cept.extend(Cept.parallel_mode())
		data_cept.extend(Cept.set_palette(0))
		data_cept.extend(Cept.code_9e())
		data_cept.extend(Cept.set_fg_color_simple(7))
		data_cept.extend(Cept.load_g0_drcs())
		data_cept.extend(Cept.set_left_g0())
		data_cept.extend(b'!"#\r\n$%&')
		data_cept.extend(Cept.cursor_up())
		data_cept.extend(Cept.cursor_right())
		data_cept.extend(Cept.load_g0_g0())
		data_cept.extend(Cept.set_left_g0())
		data_cept.extend(b'\n')
		data_cept.extend(Cept.double_height())
		data_cept.extend(Cept.from_str("Bildschirmtext"))
		data_cept.extend(b'\r\n')
		data_cept.extend(Cept.set_line_bg_color_simple(4))
		data_cept.extend(b'\n')
		data_cept.extend(Cept.set_line_bg_color_simple(4))
		data_cept.extend(Cept.set_palette(1))
		data_cept.extend(Cept.double_height())
		data_cept.extend(b'\r')
		data_cept.extend(Cept.from_str("Deutsche Bundespost"))
		data_cept.extend(b'\n\r')
		data_cept.extend(Cept.set_palette(0))
		data_cept.extend(Cept.normal_size())
		data_cept.extend(Cept.code_9e())
		data_cept.extend(b'\r\n')
		data_cept.extend(Cept.set_fg_color_simple(3))
		data_cept.extend(Cept.from_str(current_date))
		data_cept.extend(Cept.set_fg_color_simple(7))
		data_cept.extend(b'\r\n\n')
		data_cept.extend(Cept.from_str("Guten Tag"))
		data_cept.extend(b'\r\n')
		data_cept.extend(Cept.from_str(user_name))
		data_cept.extend(b'\r\n')
		data_cept.extend(Cept.set_fg_color_simple(3))
		data_cept.extend(Cept.from_str(notifications))
		data_cept.extend(Cept.set_fg_color_simple(7))
		data_cept.extend(Cept.set_cursor(19, 1))
		data_cept.extend(Cept.from_str("Sie benutzten Bildschirmtext zuletzt"))
		data_cept.extend(b'\r\n')
		data_cept.extend(Cept.from_str("am "))
		data_cept.extend(Cept.set_fg_color_simple(3))
		data_cept.extend(Cept.from_str(last_date))
		data_cept.extend(Cept.set_fg_color_simple(7))
		data_cept.extend(Cept.from_str(" bis "))
		data_cept.extend(Cept.set_fg_color_simple(3))
		data_cept.extend(Cept.from_str(last_time))
		data_cept.extend(Cept.set_fg_color_simple(7))
		data_cept.extend(b'\r\n\r\n\r\n')
		data_cept.extend(Cept.set_line_bg_color_simple(4))
		data_cept.extend(Cept.from_str("Weiter mit #  oder  *Seitennummer#"))
		return (meta, data_cept)