Exemple #1
0
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, self.AUTHOR)
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        # calculate the sidebar links, adding a few of our own
        self.__d = {'rootdir': rootdir}
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # it is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up
        p.sidebar.append(('%(rootdir)s', '''
<center>
    <img alt="" border="0"
         src="%(rootdir)s/pics/PythonPoweredSmall.gif"></center>
''' % self.__d))
        self.__linkfixer.massage(p.sidebar, self.__d)
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of our web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
        Banner.__init__(self, sitelinks)
        # calculate the random corner
        # XXX Should really do a list of the pics directory...
        NBANNERS = 64
        i = whrandom.randint(0, NBANNERS - 1)
        s = "PyBanner%03d.gif" % i
        self.__d['banner'] = s
        self.__whichbanner = i
 def __init__(self, file, rootdir, relthis):
     root, ext = os.path.splitext(file)
     html = root + '.html'
     p = self.__parser = HTParser(file, self.AUTHOR, self.EMAIL)
     f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
     self.__body = None
     self.__cont = None
     # Calculate the sidebar links, adding a few of our own.
     self.__d = {'rootdir': rootdir}
     dir = os.path.split(file)[0]
     p.process_sidebar()
     p.sidebar.append(BLANKCELL)
     # It is important not to have newlines between the img tag and the end
     # end center tags, otherwise layout gets messed up.
     self.__linkfixer.massage(p.sidebar, self.__d)
     Sidebar.__init__(self, p.sidebar)
     p.sidebar.append(BLANKCELL)
     # Fix up our site links, no relthis because the site links are
     # relative to the root of our web pages.
     sitelinks=get_sitelinks(file, rootdir, relthis)
     sitelink_fixer = LinkFixer(f.myurl(), rootdir)
     sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
     Banner.__init__(self, sitelinks)
     # kludge!
     for i in range(len(p.sidebar)-1, -1, -1):
         if p.sidebar[i] == 'Email Us':
             p.sidebar[i] = 'Email me'
             break
     p.sidebar.append((None, ''))
    def __init__(self, file, rootdir, relthis):
        self.__body = None
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, 'Barry A. Warsaw', '*****@*****.**')
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # massage our links
        self.__d = {'rootdir': rootdir}
        self.__linkfixer.massage(p.sidebar, self.__d)
        # tweak
        p.sidebar.append(('http://www.python.org/', '''
<center>
    <img border="0"
         src="%(rootdir)s/images/PythonPoweredSmall.gif"></center>'''
                           % self.__d))
        p.sidebar.append(BLANKCELL)
        copyright = self.__parser.get('copyright', '1996-%d' %
                                      time.localtime()[0])
        p.sidebar.append((None, '&copy; ' + copyright))
        p.sidebar.append((None, 'Barry A. Warsaw'))
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of my web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
        Banner.__init__(self, sitelinks, cols=2)
        # kludge!
        for i in range(len(p.sidebar)-1, -1, -1):
            if p.sidebar[i] == 'Email Us':
                p.sidebar[i] = 'Email me'
                break
Exemple #4
0
 def __init__(self, ip="127.0.0.1", port=1313, queue=Queue()):
     self.IP = ip
     self.PORT = port
     self.banner = Banner()
     self.ReadImageStreamTask = None
     self.picture = queue
     self.cap_Socket = None
Exemple #5
0
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, '*****@*****.**')
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        # calculate the sidebar links, adding a few of our own
        self._d = {'rootdir': rootdir}
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # it is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up
        p.sidebar.append(('http://www.python.org/', '''
<center>
    <img border=0 src="%(rootdir)s/images/PythonPoweredSmall.gif"></center>
''' % self._d))
        self.__linkfixer.massage(p.sidebar, self._d)
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of our web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self._d, aboves=1)
        Banner.__init__(self, sitelinks, cols=2)
Exemple #6
0
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, self.AUTHOR)
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        # calculate the sidebar links, adding a few of our own
        self.__d = {'rootdir': rootdir}
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # it is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up
        p.sidebar.append(('%(rootdir)s', '''
<center>
    <img alt="" border=0
         src="%(rootdir)s/pics/PythonPoweredSmall.gif"></center>
''' % self.__d))
        self.__linkfixer.massage(p.sidebar, self.__d)
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of our web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
        Banner.__init__(self, sitelinks)
        # calculate the random corner
        # XXX Should really do a list of the pics directory...
        NBANNERS = 64
        i = whrandom.randint(0, NBANNERS-1)
        s = "PyBanner%03d.gif" % i
        self.__d['banner'] = s
        self.__whichbanner = i
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, self.AUTHOR)
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        # calculate the sidebar links, adding a few of our own
        self.__d = {'rootdir': rootdir}
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # it is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up
        p.sidebar.append(('http://sourceforge.net/projects/spambayes', '''
<div align="right">
    <img alt="" border="0"
         src="http://sourceforge.net/sflogo.php?group_id=61702&type=1"></div>
'''))
        self.__linkfixer.massage(p.sidebar, self.__d)
        SpamBayesSidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of our web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
        Banner.__init__(self, sitelinks)
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, '*****@*****.**')
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        # calculate the sidebar links, adding a few of our own
        self._d = {'rootdir': rootdir}
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # it is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up
        p.sidebar.append(('http://www.python.org/', '''
<center>
    <img border="0" src="%(rootdir)s/images/PythonPoweredSmall.gif"></center>
''' % self._d))
        self.__linkfixer.massage(p.sidebar, self._d)
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of our web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self._d, aboves=1)
        Banner.__init__(self, sitelinks, cols=2)
class PrintBanner(Print):
    def __init__(self, strings):
        self.banner = Banner(strings)

    def printWeak(self):
        self.banner.showWithParen()

    def printStrong(self):
        self.banner.showWithAster()
class PrintBanner(Banner):
    def __init__(self, string):
        super().__init__(string)
        self.__banner = Banner(string)

    def printWeak(self):
        self.__banner.showWithParen()

    def printStrong(self):
        self.__banner.showWithAster()
Exemple #11
0
class PrintBanner2(Print):
    def __init__(self, string):
        super(PrintBanner2, self).__init__()
        self.banner = Banner(string)

    def printWeak(self):
        self.banner.showWithParen()
        print "PrintBanner2"

    def printStrng(self):
        self.banner.showWithAster()
        print "PrintBanner2"
Exemple #12
0
class PrintBanner(Print):
    """
    Adapterとなるクラス
    Bannerクラスに委譲する
    """
    def __init__(self, string):
        self.banner = Banner(string)

    def print_weak(self):
        self.banner.show_with_aster()

    def print_strong(self):
        self.banner.show_with_aster()
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, 'x@y')
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None

        # calculate the sidebar links, adding a few of our own
        self._d = {'rootdir': rootdir}
        p.process_sidebar()

        # remove "Email us" and use replacement
        del p.sidebar[-2:]

        p.sidebar.append('Contact')
        p.sidebar.append(
            ('http://lists.sourceforge.net/lists/listinfo/jython-users',
             'Questions on Jython?<br>jython-users'))

        p.sidebar.append(BLANKCELL)
        # it is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up
        p.sidebar.append(('http://www.python.org/', '''
<center>
    <img border="0" src="%(rootdir)s/images/PythonPoweredSmall.gif"></center>
''' % self._d))
        p.sidebar.append(BLANKCELL)
        p.sidebar.append(('http://sourceforge.net/', '''
<center>
 <img src="http://sourceforge.net/sflogo.php?group_id=12867" width="88" height="31" border="0" alt="SourceForge Logo"></center>
''' % self._d))

        if self.webmaster:
            # webmaster -> jython-dev

            p.sidebar.append(BLANKCELL)
            p.sidebar.append(BLANKCELL)

            p.sidebar.append(('mailto:[email protected]', 'webmaster'))

        self.__linkfixer.massage(p.sidebar, self._d)
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of our web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(self.sitelinks, self._d, aboves=1)
        Banner.__init__(self, self.sitelinks, cols=2)
Exemple #14
0
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file,'x@y')
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        
        # calculate the sidebar links, adding a few of our own
        self._d = {'rootdir': rootdir}
        p.process_sidebar()

        # remove "Email us" and use replacement
        del p.sidebar[-2:]

        p.sidebar.append('Contact')
        p.sidebar.append(('http://lists.sourceforge.net/lists/listinfo/jython-users','Questions on Jython?<br>jython-users'))
        
        p.sidebar.append(BLANKCELL)
        # it is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up
        p.sidebar.append(('http://www.python.org/', '''
<center>
    <img border="0" src="%(rootdir)s/images/PythonPoweredSmall.gif"></center>
''' % self._d))
        p.sidebar.append(BLANKCELL)
        p.sidebar.append(('http://sourceforge.net/', '''
<center>
 <img src="http://sourceforge.net/sflogo.php?group_id=12867" width="88" height="31" border="0" alt="SourceForge Logo"></center>
''' % self._d))

        if self.webmaster:
            # webmaster -> jython-dev

            p.sidebar.append(BLANKCELL)
            p.sidebar.append(BLANKCELL)

            p.sidebar.append(('mailto:[email protected]','webmaster'))

        self.__linkfixer.massage(p.sidebar, self._d)
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of our web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(self.sitelinks, self._d, aboves=1)
        Banner.__init__(self, self.sitelinks, cols=2)
Exemple #15
0
def init():
    global pluginNumber
    global modules
    plugins = Loader.plugins(modulesPath)
    plugins.crawler()
    plugins.load()
    pluginNumber = len(plugins.pluginTree)
    modules = plugins.modules
    Banner(VERSION, pluginNumber)
Exemple #16
0
 def __init__(self, file, rootdir, relthis):
   root, ext = os.path.splitext(file)
   self.html = root + '.html'
   p = self.__parser = HTParser(file)
   f = self.__linkfixer = LinkFixer(self.html, rootdir, relthis)
   self.__body = None
   self.__cont = None
   # Calculate the sidebar links, adding a few of our own.
   self.__d = {'rootdir': rootdir}
   p.process_sidebar()
   p.sidebar = p.sidebar[:-2]
   self.make_assoc(p.sidebar)
   self.find_buttons(p.sidebar)
   self.test_buttons()
   self.collapse_links(p.sidebar, self.html)
   Sidebar.__init__(self, p.sidebar)
   Banner.__init__(self, ())
   # Rollover script
   self.rollover = '''<script>
 def __init__(self, file, rootdir, relthis):
     root, ext = os.path.splitext(file)
     self.html = root + '.html'
     p = self.__parser = HTParser(file)
     f = self.__linkfixer = LinkFixer(self.html, rootdir, relthis)
     self.__body = None
     self.__cont = None
     # Calculate the sidebar links, adding a few of our own.
     self.__d = {'rootdir': rootdir}
     p.process_sidebar()
     p.sidebar = p.sidebar[:-2]
     self.make_assoc(p.sidebar)
     self.find_buttons(p.sidebar)
     self.test_buttons()
     self.collapse_links(p.sidebar, self.html)
     Sidebar.__init__(self, p.sidebar)
     Banner.__init__(self, ())
     # Rollover script
     self.rollover = '''<script>
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, self.AUTHOR, self.EMAIL)
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        # Calculate the sidebar links, adding a few of our own.
        self.__d = {'rootdir': rootdir}
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # It is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up.
        p.sidebar.append(('http://www.python.org/', '''\
<img class="side" alt="[Python Powered]" border="0"
src="img/PythonPoweredSmall.png">''' % self.__d))
        self.__linkfixer.massage(p.sidebar, self.__d)
        Sidebar.__init__(self, p.sidebar)
        copyright = self.__parser.get('copyright', '1999-%d' %
                                      time.localtime()[0])
        p.sidebar.append((None, '&copy; ' + copyright))
        p.sidebar.append(('http://www.python.org/psf/',
                          'Python Software Foundation'))
        p.sidebar.append((None, '<hr>'))
        p.sidebar.append((None, '''<script type="text/javascript" \
        src="http://www.altervista.org/js_tags/contatore.js">
        </script>
        '''))
        p.sidebar.append((None, '''last update'''))
        p.sidebar.append((None, time.asctime()))
        
        # Fix up our site links, no relthis because the site links are
        # relative to the root of our web pages.
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
        Banner.__init__(self, sitelinks)
        # kludge!
        for i in range(len(p.sidebar)-1, -1, -1):
            if p.sidebar[i] == 'Email Us':
                p.sidebar[i] = 'Email me'
                break
    def __init__(self, file, rootdir, relthis):
        self.__body = None
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, '*****@*****.**')
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # massage our links
        self.__d = {'rootdir': rootdir}
        self.__linkfixer.massage(p.sidebar, self.__d)
        # tweak
        p.sidebar.append((None, """\
<center><a href="http://www.python.org/"><img border=0
    src="%(rootdir)s/images/PythonPoweredSmall.png"></a>&nbsp;<a
    href="http://sourceforge.net"><img
    src="http://sourceforge.net/sflogo.php?group_id=103"
    width="88" height="31" border="0"
    alt="SourceForge Logo"></a>
    """ % self.__d))
        p.sidebar.append(BLANKCELL)
        years = COMMA.join([str(x)
                            for x in range(1998, time.localtime()[0]+1)])
        copyright = self.__parser.get('copyright', years)
        p.sidebar.append((None, '&copy; ' + copyright + """\
<br>Free Software Foundation, Inc.<br>
Verbatim copying and distribution of this entire article is permitted in
any medium, provided this notice is preserved.<br>
Please send comments on these pages to <a href="mailto:[email protected]">
&lt;[email protected]&gt;</a>, other questions to <a
href="mailto:[email protected]">&lt;[email protected]&gt;</a>.
"""))
        Sidebar.__init__(self, p.sidebar)
        #
        # fix up our site links, no relthis because the site links are
        # relative to the root of my web pages
        #
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
        Banner.__init__(self, sitelinks, cols=3)
    def __init__(self, file, rootdir, relthis):
        root, ext = os.path.splitext(file)
        html = root + '.html'
        p = self.__parser = HTParser(file, self.AUTHOR, self.EMAIL)
        f = self.__linkfixer = LinkFixer(html, rootdir, relthis)
        self.__body = None
        self.__cont = None
        # Calculate the sidebar links, adding a few of our own.
        self.__d = {'rootdir': rootdir}
        p.process_sidebar()
        p.sidebar.append(BLANKCELL)
        # It is important not to have newlines between the img tag and the end
        # end center tags, otherwise layout gets messed up.
        p.sidebar.append(('http://www.python.org/', '''
<center>
    <img alt="[Python Powered]" border="0"
         src="PythonPoweredSmall.png"></center>
''' % self.__d))
        self.__linkfixer.massage(p.sidebar, self.__d)
        Sidebar.__init__(self, p.sidebar)
        p.sidebar.append(BLANKCELL)
        copyright = self.__parser.get('copyright', '1999-%d' %
                                      time.localtime()[0])
        p.sidebar.append((None, '&copy; ' + copyright))
        p.sidebar.append(('http://www.python.org/psf/',
                          'Python Software Foundation'))
        p.sidebar.append((None, '<hr>'))
        p.sidebar.append((file, '[page source]'))
        # Fix up our site links, no relthis because the site links are
        # relative to the root of our web pages.
        sitelink_fixer = LinkFixer(f.myurl(), rootdir)
        sitelink_fixer.massage(sitelinks, self.__d, aboves=1)
        Banner.__init__(self, sitelinks)
        # kludge!
        for i in range(len(p.sidebar)-1, -1, -1):
            if p.sidebar[i] == 'Email Us':
                p.sidebar[i] = 'Email me'
                break
Exemple #21
0
def generate():
    tekst = request.form["tekst"]
    image = request.form["image"]
    banner = Banner(files[image], tekst)
    banner.schrijf()
    imgByteArr = io.BytesIO()
    banner.get_image().save(imgByteArr, format='JPEG')
    imgByteArr = imgByteArr.getvalue()
    response = make_response(imgByteArr)
    response.headers.set('Content-Type', 'image/jpeg')
    response.headers.set('Content-Disposition', 'attachment', filename='banner.jpg')
    return response
Exemple #22
0
def generateBase64():
    tekst = request.form["tekst"]
    image = request.form["image"]
    banner = Banner(files[image], tekst)
    banner.schrijf()
    imgByteArr = io.BytesIO()
    banner.get_image().save(imgByteArr, format='JPEG')
    imgByteArr = imgByteArr.getvalue()
    data_uri = base64.b64encode(imgByteArr).decode('utf-8').replace('\n', '')
    img_tag = '<img src="data:image/jpeg;base64,{0}">'.format(data_uri)
    result = "Content-Type: text/html;charset=utf-8\n\n\n\n"
    result = img_tag
    return result
Exemple #23
0
class Stream(object):
    __instance = None
    __mutex = threading.Lock()

    def __init__(self, ip="127.0.0.1", port=1313, queue=Queue()):
        self.IP = ip
        self.PORT = port
        self.banner = Banner()
        self.ReadImageStreamTask = None
        self.picture = queue

    @staticmethod
    def getBuilder(ip, port, queue):
        """Return a single instance of TestBuilder object """
        if (Stream.__instance == None):
            Stream.__mutex.acquire()
            if (Stream.__instance == None):
                Stream.__instance = Stream(ip, port, queue)
            Stream.__mutex.release()
        return Stream.__instance

    def run(self):
        self.minicapSocket = socket.socket(
            socket.AF_INET, socket.SOCK_STREAM)  #定义socket类型,网络通信,TCP
        self.minicapSocket.connect((self.IP, self.PORT))
        self.ReadImageStreamTask = threading.Thread(
            target=self.ReadImageStream).start()

    def ReadImageStream(self):
        readBannerBytes = 0
        bannerLength = 2
        readFrameBytes = 0
        frameBodyLength = 0
        frameBody = b""
        while True:
            chunk = self.minicapSocket.recv(1024)
            chunk_len = len(chunk)
            if not chunk_len:
                continue
            cursor = 0
            while cursor < chunk_len:
                if readBannerBytes < bannerLength:
                    if readBannerBytes == 0:
                        self.banner.Version = chunk[cursor]
                    elif readBannerBytes == 1:
                        bannerLength = chunk[cursor]
                        print(bannerLength)
                        self.banner.Length = bannerLength
                    elif readBannerBytes in (2, 3, 4, 5):
                        self.banner.Pid += chunk[cursor] << (readBannerBytes -
                                                             2) * 8
                    elif readBannerBytes in (6, 7, 8, 9):
                        self.banner.RealWidth += chunk[cursor] << (
                            readBannerBytes - 6) * 8
                    elif readBannerBytes in (10, 11, 12, 13):
                        self.banner.RealHeight += chunk[cursor] << (
                            readBannerBytes - 10) * 8
                    elif readBannerBytes in (14, 15, 16, 17):
                        self.banner.VirtualWidth += chunk[cursor] << (
                            readBannerBytes - 14) * 8
                    elif readBannerBytes in (18, 19, 20, 21):
                        self.banner.VirtualHeight += chunk[cursor] << (
                            readBannerBytes - 18) * 8
                    elif readBannerBytes == 22:
                        self.banner.Orientation += chunk[cursor]
                    elif readBannerBytes == 23:
                        self.banner.Quirks = chunk[cursor]
                    cursor += 1
                    readBannerBytes += 1
                    if readBannerBytes == bannerLength:
                        print(self.banner.toString())
                elif readFrameBytes < 4:
                    frameBodyLength += chunk[cursor] << readFrameBytes * 8
                    cursor += 1
                    readFrameBytes += 1
                else:
                    if chunk_len - cursor >= frameBodyLength:
                        frameBody += chunk[cursor:cursor + frameBodyLength]
                        cursor += frameBodyLength
                        self.picture.put(frameBody)

                        frameBodyLength = readFrameBytes = 0
                        frameBody = b""

                    else:
                        frameBody += chunk[cursor:chunk_len]
                        frameBodyLength -= chunk_len - cursor
                        readFrameBytes += chunk_len - cursor
                        cursor = chunk_len


#     print a.picture
 def get_banner(self):
     return Banner.get_banner(self)
 def __init__(self, string):
     super().__init__(string)
     self.__banner = Banner(string)
Exemple #26
0
 def banner(self, **kwds):
     from Banner import Banner
     banner = Banner(**kwds)
     self.contents.append(banner)
     return banner
 def get_banner(self):
     return Banner.get_banner(self)
Exemple #28
0
from Banner import Banner

regels = """test"""

for tekst in regels.splitlines():
    tekst = tekst.strip().replace("\t", " ")
    banner = Banner("img\\1.jpg", tekst)
    banner.schrijf()
    banner.save(uit=("uit/" + tekst.replace(" ", "_") + ".png"))
Exemple #29
0
# -*- coding: utf-8 -*-

import base64
import io

from Banner import Banner
import cgitb
import cgi

cgitb.enable()
form = cgi.FieldStorage()

try:
    tekst = form["tekst"].value
except KeyError:
    tekst = ""
try:
    image = form["image"].value
except KeyError:
    image = "1.jpg"

banner = Banner("img\\" + image, tekst)
banner.schrijf()
imgByteArr = io.BytesIO()
banner.get_image().save(imgByteArr, format='JPEG')
imgByteArr = imgByteArr.getvalue()
data_uri = base64.b64encode(imgByteArr).decode('utf-8').replace('\n', '')
img_tag = '<img src="data:image/jpeg;base64,{0}">'.format(data_uri)
print("Content-Type: text/html;charset=utf-8\n\n\n\n")
print(img_tag)
Exemple #30
0
    if(idx * pw < check * pw) {
        const int offset = idx * pw;
        int error = 0;
        int c;

        for(c=0; c<pw && !error; ++c) {
            error += machine(code, data, inIm + offset + c);
        }
    }
}
"""

###############################################################################
if __name__ == "__main__":
    Banner(arg=[
        argv[0] + ': main',
    ], bare=True)
    if len(argv) == 1:
        Banner(arg=[
            argv[0] + ': default code and data',
        ], bare=True)
        DATA = [0.0, 1.0]
        CODE = [
            'push',
            '#1',
            'sub',
            'noop',
            'call',
            'here',
            'quit',
            'here:ret',
Exemple #31
0
from PrintAdapter import PrintAdapter
from Banner import Banner

if __name__ == '__main__':
    printer = PrintAdapter(Banner("Hi Hoony's Blog"))
    printer.print_strong()
    printer.print_week()
Exemple #32
0
 def __init__(self, string):
     super(PrintBanner2, self).__init__()
     self.banner = Banner(string)
Exemple #33
0
 def __init__(self, string):
     self.banner = Banner(string)