示例#1
0
文件: 100.py 项目: mscroggs/KLBFAX
 def generate_content(self):
     if NAME == "EMFFAX":
         self.add_block(emf_title, "YELLOW", bg="BLUE")
     elif NAME == "602FAX":
         self.add_block(six_title, "YELLOW", bg="BLUE")
     elif NAME == "WWWFAX":
         self.add_block(www_title, "YELLOW", bg="BLUE")
     elif NAME == "28JHFAX":
         if is_oxmas():
             self.add_block(ox_title, "YELLOW", bg="BLUE")
         else:
             self.add_block(te_title, "YELLOW", bg="BLUE")
     else:
         self.add_block(klb_title, "YELLOW", bg="BLUE")
     self.start_fg_color("GREEN")
     self.add_text("INDEX " * 14)
     self.add_newline()
     i = 0
     _items = Ceefax().page_manager.sorted_pages()
     for num, page in _items:
         if page.is_enabled and page.in_index:
             self.start_fg_color("MAGENTA")
             if page.index_num is None:
                 self.add_text(num)
             else:
                 self.add_text(page.index_num)
             self.end_fg_color()
             self.add_text(" " + page.title)
             if i == 0:
                 self.move_cursor(x=36)
                 i = 1
             else:
                 self.add_newline()
                 i = 0
示例#2
0
文件: 000.py 项目: mscroggs/KLBFAX
    def generate_content(self):
        from cupt.cupt import curses_colors
        self.add_rainbow_text(config.NAME + " v" + config.VERSION)
        self.add_newline()
        self.add_newline()
        self.add_rainbow_text("FOREGROUNDS")
        self.add_newline()
        for i, c in enumerate(curses_colors):
            if i % 6 == 0 and i > 0:
                self.add_newline()
            self.move_cursor(x=12 * (i % 6))
            self.start_fg_color(c)
            self.add_wrapped_text(c)
        self.end_fg_color()
        self.add_newline()
        self.add_newline()
        self.add_rainbow_text("BACKGROUNDS")
        self.add_newline()
        for i, c in enumerate(curses_colors):
            if i % 6 == 0 and i > 0:
                self.add_newline()
            self.move_cursor(x=12 * (i % 6))
            self.start_bg_color(c)
            self.add_wrapped_text(c)
        self.end_bg_color()
        self.add_newline()
        self.add_newline()

        import socket
        import fcntl
        import struct

        def get_ip_address(ifname):
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            return socket.inet_ntoa(
                fcntl.ioctl(
                    s.fileno(),
                    0x8915,  # SIOCGIFADDR
                    struct.pack('256s', ifname[:15]))[20:24])

        self.add_rainbow_text("IP ADDRESSES")
        self.add_newline()
        try:
            self.add_text("lo: " + get_ip_address(b'lo'))
        except IOError:
            self.add_text("lo: ERROR")
        self.add_newline()
        try:
            self.add_text("eth0: " + get_ip_address(b'eth0'))
        except IOError:
            self.add_text("eth0: ERROR")

        from ceefax import Ceefax

        self.add_newline()
        self.add_newline()

        self.add_text(config.NAME + " has been running since " +
                      Ceefax().start_time.strftime("%y-%m-%d %H:%M"))
示例#3
0
    def generate_content(self):
        self.print_image(config.title, 1)
        self.add_newline()
        self.add_text(" INDEX  " * 10, fg="GREEN")
        self.add_newline()
        self.add_newline()
        for i, page in enumerate(Ceefax().page_manager.index_pages()):
            self.add_text(page.index_num, fg="MAGENTA")
            if i % 2 == 0:
                self.move_cursor(x=9)
            else:
                self.move_cursor(x=45)
            self.add_text(page.title, fg="WHITE")

            if i % 2 == 0:
                self.move_cursor(x=36)
            else:
                self.add_newline()
示例#4
0
#!/usr/bin/env python3
from ceefax import config, Ceefax
import sys
import os
import config as _c

config.ceefax_path = os.path.dirname(os.path.realpath(__file__))
config.pages_dir = os.path.join(config.ceefax_path, "pages")
config.NAME = "HUSFAX"

for i, j in _c.__dict__.items():
    setattr(config, i, j)

test = None

for i, a in enumerate(sys.argv):
    if a in ["-t", "--test", "-T"] and i + 1 < len(sys.argv):
        test = sys.argv[i + 1]

c = Ceefax(test)
c.begin()
示例#5
0
#!/usr/bin/env python
import sys
sys.path.insert(0, '..')

import os
os.environ["WWW"] = "1"

from page import PageManager, Page
from ceefax import Ceefax
from cupt import DummyScreen

cee = Ceefax()

page_manager = PageManager(DummyScreen())
cee.page_manager = page_manager

page_manager.export_all_to_html()