Ejemplo n.º 1
0
    def present(self, entryterms=EMPTYCHAR, dates=EMPTYCHAR):

        notelist = DisplayList(displayobject=self.displayobject)
        if entryterms:
            if UNDERLINE in entryterms:
                entryterms = entryterms.split(UNDERLINE)
                if len(entryterms) == 2:
                    entry1, entry2, entry3 = entryterms[0], entryterms[
                        1], EMPTYCHAR
                else:
                    entry1, entry2, entry3 = entryterms[0], entryterms[
                        1], entryterms[2]
            else:
                entry1, entry2, entry3 = entryterms, EMPTYCHAR, EMPTYCHAR
        else:
            entry1, entry2, entry3 = EMPTYCHAR, EMPTYCHAR, EMPTYCHAR
        if dates:
            if UNDERLINE in dates:
                dates = dates.split(UNDERLINE)
                d_aft, d_bef = dates[0], dates[1]
            else:
                d_aft, d_aft = EMPTYCHAR, EMPTYCHAR
        else:
            d_aft, d_bef = EMPTYCHAR, EMPTYCHAR
        nformat.columns(EOL.join(
            self.convert(
                self.fetchall(entry1=entry1,
                              entry2=entry2,
                              entry3=entry3,
                              d_bef=d_bef,
                              d_aft=d_aft))),
                        listobject=notelist,
                        columnwidth=(10, 30, 40, 60))
        notelist.present()
Ejemplo n.º 2
0
    def show_kd(self, returntext=False):
        """ show keys with definitions"""

        show_keys = DisplayList(displayobject=self.displayobject)

        if not returntext:
            show_keys = DisplayList(displayobject=self.displayobject)
        else:
            show_keys = []

        spacer = ' ' * (not returntext)

        for counter, k_temp in enumerate(
                sorted(list(self.query(term1='kd', action='get')),
                       key=lambda x_temp: x_temp.lower())):

            if not returntext:
                countermark = str(counter + 1)
            else:
                countermark = EMPTYCHAR
            key_temp = nformat.format_keys(self.get_definition(k_temp))
            if returntext:
                key_temp = key_temp.replace(COMMA + BLANK,
                                            COMMA).replace(BLANK, UNDERLINE)
            show_keys.append(countermark + spacer + k_temp + COLON + spacer +
                             key_temp)
        if returntext:
            return EOL.join(show_keys)

        show_keys.show(header='KEYWORDS : DEFINITIONS', centered=True)
Ejemplo n.º 3
0
    def console(self):

        """ opens up console for adding and deleting """

        go_on = True
        while go_on:
            console = DisplayList([self.headings.ADD_MENU,
                                   self.headings.DELETE_MENU,
                                   self.headings.SHOW_MENU,
                                   self.headings.CLEAR_MENU,
                                   self.headings.QUIT_MENU,
                                   'N)otebook'*self.using_database],
                                   displayobject=self.displayobject)
            i = input()
            if i in self.ADDTERMS:

                self.add(input(self.headings.FROM_THIS), input(self.headings.TO_THIS))
            elif i in self.DELETETERMS:

                while True:
                    self.show()
                    to_delete = input (self.headings.DELETE)
                    if to_delete == EMPTYCHAR:
                        break
                    if to_delete.isnumeric() and int(to_delete) > 0 and int(to_delete) < len(self.query(term1='db',action='get'))+1:
                        from_temp = sorted(self.query(term1='db',action='get'))[int(to_delete)-1]
                        to_temp = self.query(term1='db',term2=from_temp,action='delete')
                        self.delete(from_temp,to_temp)
            elif i in self.SHOWTERMS:
                self.show()

            elif i in ['n','N'] and self.using_database:
                self.db_cursor.execute('SELECT notebook FROM notebooks')
                notebooks = [x[0] for x in self.db_cursor.fetchall()]
                self.displayobject.noteprint(('NOTEBOOKS','\n'.join(notebooks)))
                action = input('NAME OF EXISTING OR NEW NOTEBOOK?').strip()
                if action in notebooks:
                    self.notebookname = action

            elif i in self.CLEARTERMS:
                if input(self.headings.ARE_YOU_SURE) in YESTERMS:
                    if input(self.headings.ARE_YOU_SURE) in YESTERMS:
                        self.query(term1='ab',action='delete')
                        self.query(term1='db',action='delete')
            elif i in self.QUITTERMS:
                go_on = False
Ejemplo n.º 4
0
    def bore(self, listobject=None):
        """recite all knowledge"""
        listobject = DisplayList(displayobject=self.displayobject)

        if listobject is None:
            listobject = []

        for k in self.query(action='get'):
            l_temp = self.query(term1=k, action='get')
            if l_temp == set():
                listobject.append(self.headings.I_KNOW + k +
                                  self.headings.IS_WHAT_IT_IS)
            else:
                for m_temp in l_temp:
                    listobject.append(self.headings.I_KNOW + m_temp +
                                      self.headings.IS_AN + k)
        if isinstance(listobject, list):
            print(listobject)
        else:
            listobject.show()
Ejemplo n.º 5
0
    def console(self):
        """ opens up console for adding and deleting """

        go_on = True
        while go_on:
            console = DisplayList([
                self.headings.LEARN_MENU, self.headings.UNLEARN_MENU,
                self.headings.SHOW_MENU, self.headings.CLEAR_MENU,
                self.headings.QUIT_MENU, 'N)otebook' * self.using_database
            ],
                                  displayobject=self.displayobject)
            i = input()
            if i in self.LEARNTERMS:

                self.learn(input(self.headings.LEARN_THAT_THIS),
                           input(self.headings.IS_WHAT))
            elif i in self.UNLEARNTERMS:

                self.unlearn(input(self.headings.UNLEARN_THAT_THIS),
                             input(self.headings.IS_WHAT))
            elif i in self.SHOWTERMS:
                self.bore()
            elif i in ['n', 'N'] and self.using_database:
                self.db_cursor.execute('SELECT notebook FROM notebooks')
                notebooks = [x[0] for x in self.db_cursor.fetchall()]
                self.displayobject.noteprint(
                    ('NOTEBOOKS', '\n'.join(notebooks)))
                action = input('NAME OF EXISTING OR NEW NOTEBOOK?').strip()
                if action in notebooks:
                    self.notebookname = action

            elif i in self.CLEARTERMS:
                if input(self.headings.ARE_YOU_SURE) in self.YESTERMS:
                    self.query(action='delete')
                    self.db_cursor.execute(
                        "DELETE FROM things WHERE notebook=?;",
                        (self.notebookname, ))
                    self.db_connection.commit()

            elif i in self.QUITTERMS:
                go_on = False
Ejemplo n.º 6
0
    def show_dk(self):
        """show definitions with keys

        For reasons that I do not understand,
        I need to add this blank space to
        keep the formatting normal when
        displaying the note...
        """

        show_definitions = DisplayList(displayobject=self.displayobject)

        for counter, d_temp in enumerate(
                sorted(list(self.query(term1='dk', action='get')),
                       key=lambda x_temp: x_temp.lower())):

            show_definitions.append(
                str(counter + 1) + BLANK + d_temp + COLON + BLANK +
                nformat.format_keys(self.get_key(d_temp)) + BLANK * 3)
        show_definitions.show(header=self.headings.KEY_DEF, centered=True)
Ejemplo n.º 7
0
    def show(self,returntext=False):

        """show all the stored debreviations"""
        if not returntext:
            show_debreviations = DisplayList(displayobject=self.displayobject)
            spacer = BLANK
        else:
            show_debreviations = []
            spacer = EMPTYCHAR
        for counter, key in enumerate(sorted(self.query(term1='db',action='get'))):
            if not returntext:
                countermark = str(counter+1)
            else:
                countermark = EMPTYCHAR
            deb_temp = self.query(term1='db',term2=key,action='get')
            for x in deb_temp:
                if returntext:
                    x = x.replace(BLANK,TILDA)                                        
                show_debreviations.append(countermark+spacer+key+EQUAL+x)
        if returntext:
            return EOL.join(show_debreviations)
        show_debreviations.present()
Ejemplo n.º 8
0
def show_list(entrylist,
              label=EMPTYCHAR,
              from_here=0,
              to_here=40,
              select=False,
              func=dummy,
              sfunc=select_func,
              accumulate=False,
              present=False,
              columnwidth=None,
              compactwidth=None,
              display=None):
    """displays elements from_here to to-here of a list
    in a note with label. Select if a selection is to be
    made from the elements in the list
    """

    showlist = DisplayList(displayobject=display)
    text = EMPTYCHAR
    counter = 1

    for log in entrylist:

        funky = func(log)

        #This is in order to handle very long number of indexes
        if funky:
            if isinstance(funky, str):
                # func returns a simple string
                # if there are only a few indexes,
                # but otherwise it returns a list
                text += (str(counter) + COLON + BLANK + funky + EOL)
                # which is then carried over to the next line
                #+((3-len(str(counter)))*BLANK)
                #  +BLANK+BLANK

                counter += 1
            else:  #for a list of indexes
                text += str(counter) + COLON + BLANK + funky[0] + EOL

                counter += 1
                for f_temp in funky[1:]:
                    # for subsequent lines
                    text += f_temp + EOL
    ##                    showlist.append(f_temp+EOL)

    width = nformat.columns(
        text,  #formats as columns while appending to
        showlist,
        not_centered={0, 1, 2, 3, 4},
        columnwidth=columnwidth,
        compactwidth=compactwidth)

    if not present:
        showlist.show(from_here, to_here, nformat.center(label, width + 6))
        if select:

            return sfunc(entrylist)

    if present and not accumulate:
        showlist.present(header=label, centered=True)
    if present and accumulate:
        return showlist.present(header=label, centered=True, accumulate=True)

    return False
Ejemplo n.º 9
0
    def console(self):
        """ opens up console for adding and deleting """

        go_on = True
        while go_on:
            console = DisplayList([
                self.headings.ADD_MENU, self.headings.DELETE_MENU,
                self.headings.SHOW_MENU, self.headings.CLEAR_MENU,
                self.headings.QUIT_MENU, '(N)otebook' * self.using_database
            ],
                                  displayobject=self.displayobject)
            i = input()
            if i in self.ADDTERMS:

                self.add(input(self.headings.KEYMACRO), [
                    x_temp.strip()
                    for x_temp in input(self.headings.KEYS).split(',')
                ])
            elif i in self.DELETETERMS:

                while True:
                    self.show_kd()
                    to_delete = input(self.headings.DELETE)
                    if to_delete == EMPTYCHAR:
                        break
                    if to_delete.isnumeric(
                    ) and int(to_delete) > 0 and int(to_delete) < len(
                            self.query(term1='kd', action='get')) + 1:
                        from_temp = sorted(
                            list(self.query(term1='kd', action='get')),
                            key=lambda x_temp: x_temp.lower())[int(to_delete) -
                                                               1]
                        to_temp = self.query(term1='kd',
                                             term2=from_temp,
                                             action='get')

                        self.delete(from_temp, to_temp[0])

            elif i in self.SHOWTERMS:
                self.show_kd()
            elif i in self.CLEARTERMS:
                if input(self.headings.ARE_YOU_SURE) in YESTERMS:
                    self.query(term1='kd', action='delete')
            elif i in ['n', 'N'] and self.using_database:
                self.db_cursor.execute('SELECT notebook FROM notebooks')
                notebooks = [x[0] for x in self.db_cursor.fetchall()]
                self.displayobject.noteprint(
                    ('NOTEBOOKS', '\n'.join(notebooks)))
                action = input('NAME OF EXISTING OR NEW NOTEBOOK?').strip()
                if action in notebooks:
                    self.notebookname = action
                else:
                    if input('Do you want to creat a new notebook titled ' +
                             action) in YESTERMS:
                        self.notebookname = action
                        self.db_cursor.execute(
                            "INSERT OR REPLACE INTO notebooks (notebook) VALUES (?);",
                            (self.notebookname, ))

            elif i in self.QUITTERMS:
                go_on = False
Ejemplo n.º 10
0
    def noteprint(self,
                  textlist,
                  notenumber=0,
                  brackets=True,
                  param_width=60,
                  np_temp=False,
                  param_is_emb=False,
                  param_indent=0,
                  param_spacing=0,
                  leftmargin=0,
                  rectify=None,
                  override=False):
        """ prints the note.
        notenumber == index position of note.
        param_width = width of note
        np_temp = False if printing, True if not printing.
        param_indent --- indicates indentation of note
        param_spacing --- indicated spacing of note """
        def box_or_nothing(char):
            if char not in [BOX_CHAR['h'], BOX_CHAR['rm']]:
                return BLANK
            else:
                return char

        def_leftmargin = leftmargin

        npp_temp = np_temp
        np_temp = True

        if not rectify:
            rectify = self.rectify
        modified = False  ## to keep track of whether different widths introd.

        maximum = self.width_needed(textlist,
                                    p_width=param_width,
                                    leftmargin=0)
        param_width_def = param_width
        maximum_def = maximum
        #the maximum width of the lines in the note
        if len(textlist) == 1:
            returntext = textlist[0]
            if not np_temp:
                print(textlist[0])
        #if the note is embedded in another note
        elif BOX_CHAR['lu'] in textlist[1]:

            head = textlist[0]  #head are the keywords
            body = textlist[1].replace('[BREAK]', '/BREAK/').replace(
                '[NEW]', '/NEW/')  #to deal with different
            #coding from before
            #body is the text

            returntext = EMPTYCHAR

            returntext += self.lineprint('H',
                                         showsize=param_width,
                                         maxsize=maximum,
                                         printyes=not np_temp,
                                         p_indent=param_indent,
                                         leftmargin=leftmargin,
                                         bracket=brackets,
                                         override=override)
            # prints the top of the box
            if notenumber > 0:
                returntext += self.lineprint(POUND + str(notenumber),
                                             showsize=param_width,
                                             maxsize=maximum,
                                             printyes=not np_temp,
                                             p_indent=param_indent,
                                             leftmargin=leftmargin,
                                             bracket=brackets,
                                             override=override)
                #print the number of the note
            returntext += self.lineprint(head,
                                         showsize=param_width,
                                         maxsize=maximum,
                                         printyes=not np_temp,
                                         p_indent=param_indent,
                                         leftmargin=leftmargin,
                                         bracket=brackets,
                                         override=override)
            # print the keywords
            returntext += self.lineprint('M',
                                         showsize=param_width,
                                         maxsize=maximum,
                                         printyes=not np_temp,
                                         p_indent=param_indent,
                                         leftmargin=leftmargin,
                                         bracket=brackets,
                                         override=override)
            # print the divider between box heading and box body
            for line in body.split(EOL):
                #split the main body into lines

                if (param_spacing > 0 or line.strip() != EMPTYCHAR):

                    if not override and '/BREAK/' in line or '/NEW/' in line:
                        if '/BREAK/' in line:
                            breaker = ['M']
                        else:
                            breaker = ['F', 'H']

                        for temp_x in breaker:
                            returntext += self.lineprint(temp_x,
                                                         showsize=param_width,
                                                         maxsize=maximum,
                                                         printyes=not np_temp,
                                                         p_indent=param_indent,
                                                         leftmargin=leftmargin,
                                                         bracket=brackets,
                                                         override=override)
                    else:

                        returntext += self.lineprint(line,
                                                     showsize=param_width,
                                                     maxsize=maximum,
                                                     printyes=not np_temp,
                                                     p_indent=param_indent,
                                                     leftmargin=leftmargin,
                                                     bracket=brackets,
                                                     override=override)
                        #add a new line
            returntext += self.lineprint('F',
                                         showsize=param_width,
                                         maxsize=maximum,
                                         printyes=not np_temp,
                                         p_indent=param_indent,
                                         leftmargin=leftmargin,
                                         bracket=brackets,
                                         override=override)
            returntext += (EOL * param_spacing)

        else:  # For a non-embedded note
            head = textlist[0]
            body = textlist[1].replace('[BREAK]',
                                       '/BREAK/').replace('[NEW]', '/NEW/')
            if rectify and ('/COL/' in body or '/NEW/' in body or '/BREAK/'
                            in body or LEFTBRACKET + SLASH in body):
                np_temp = True
            if '/ENDCOL/' in body and '/COL/' not in body:
                body = body.replace('/ENDCOL/', EMPTYCHAR)
            returntext = EMPTYCHAR

            if head:

                # Print header
                returntext += self.lineprint('H',
                                             showsize=param_width,
                                             maxsize=maximum,
                                             printyes=not np_temp,
                                             is_embedded=param_is_emb,
                                             p_indent=param_indent,
                                             leftmargin=leftmargin,
                                             bracket=brackets,
                                             override=override)
                # Print note number
                if notenumber > 0:
                    returntext += self.lineprint(POUND + str(notenumber),
                                                 showsize=param_width,
                                                 maxsize=maximum,
                                                 printyes=not np_temp,
                                                 is_embedded=param_is_emb,
                                                 p_indent=param_indent,
                                                 leftmargin=leftmargin,
                                                 bracket=brackets,
                                                 override=override)
                # Keys
                returntext += self.lineprint(head,
                                             showsize=param_width,
                                             maxsize=maximum,
                                             printyes=not np_temp,
                                             is_embedded=param_is_emb,
                                             p_indent=param_indent,
                                             leftmargin=leftmargin,
                                             bracket=brackets,
                                             override=override)
                # divider between keys and main body
            else:
                returntext += self.lineprint('H',
                                             showsize=param_width,
                                             maxsize=maximum,
                                             printyes=not np_temp,
                                             is_embedded=param_is_emb,
                                             p_indent=param_indent,
                                             leftmargin=leftmargin,
                                             bracket=brackets,
                                             override=override)

            columnate = False
            columns_done = False
            columnlist = DisplayList()
            columntextlist = []
            splitting = False
            starting = True

            if not override and '/COL/' in body:
                if (len(body.split('/COL/')[0])) < 5:

                    body = '/COL/'.join(body.split('/COL/'))[1:]
            if not override and ('/DEF/' in body
                                 or LEFTBRACKET + SLASH in body):
                rectify = False

            if body.replace(BLANK, EMPTYCHAR).replace(EOL, EMPTYCHAR):

                for line in body.split(EOL):
                    if not override and '[#' in line and '#]' in line:
                        #to modify leftmargin
                        if '[#]' in line:

                            # to set margin to one
                            line = line.replace('[#]', EMPTYCHAR)
                            leftmargin = def_leftmargin + 1
                        elif '[##]' in line:
                            # to set margin to one
                            line = line.replace('[##]', EMPTYCHAR)
                            leftmargin = def_leftmargin + 2

                        elif '[#/#]' in line:
                            # to reset margin
                            line = line.replace('[#/#]', EMPTYCHAR)
                            leftmargin = def_leftmargin

                        else:
                            # to set to the number of pounds
                            pounds_between = (POUND + line.split('[#')[1]
                                              ).split('#]')[0] + POUND
                            print(pounds_between)
                            if not pounds_between.replace(POUND, EMPTYCHAR):
                                leftmargin = def_leftmargin + len(
                                    pounds_between)
                            elif len(pounds_between) > 2 and pounds_between[
                                    1:-1].isnumeric():
                                print(pounds_between)
                                leftmargin = int(pounds_between[1:-1])
                            elif len(
                                    pounds_between
                            ) > 2 and not pounds_between[1:-1].replace(
                                    '+', EMPTYCHAR):
                                leftmargin += len(pounds_between) - 2
                            elif len(
                                    pounds_between
                            ) > 2 and not pounds_between[1:-1].replace(
                                    '-', EMPTYCHAR):
                                leftmargin -= (len(pounds_between) - 2)
                                if leftmargin <= 0:
                                    leftmargin = 0
                            line = line.split('[#')[0] + line.split('#]')[1]

                    if columns_done:
                        columnate = False
                        columns_done = True

                    # Initiate columns.

                    if starting:
                        if '/COL/' not in line and head:
                            returntext += self.lineprint(
                                'M',
                                showsize=param_width,
                                maxsize=maximum,
                                printyes=not np_temp,
                                is_embedded=param_is_emb,
                                p_indent=param_indent,
                                leftmargin=leftmargin,
                                bracket=brackets,
                                override=override)
                        elif head:

                            returntext += self.lineprint(
                                'F',
                                showsize=param_width,
                                maxsize=maximum,
                                printyes=not np_temp,
                                is_embedded=param_is_emb,
                                p_indent=param_indent,
                                leftmargin=leftmargin,
                                bracket=brackets,
                                override=override)
                    starting = False

                    if not override and line.startswith(
                            '/COL/') and not splitting:
                        modified = True
                        ##                    returntext += self.lineprint('F',
                        ##                                                 showsize=param_width,
                        ##                                                 maxsize=maximum,
                        ##                                                 printyes=not np_temp,
                        ##                                                 is_embedded=param_is_emb,
                        ##                                                 p_indent=param_indent,
                        ##                                                 leftmargin=leftmargin)

                        first_line = True
                        line = line[5:]
                        columnate = True
                        if line:
                            columntextlist.append(line)

                    elif not override and splitting and '/M/' in line:
                        column_count += 1
                        line = line.split('/M/')
                        if line[0]:
                            columntextlist.append(line[0])
                        columntextlist.append('/M/')
                        if line[1]:
                            columntextlist.append(line[1])

                    elif (not override and line.startswith('/SPLIT/')
                          and not columnate):
                        modified = True
                        first_line = True
                        line = line[7:]
                        splitting = True
                        column_count = 1
                        if line:
                            columntextlist.append(line)

                    # For the middle of the columsn.
                    elif (not override
                          and ((columnate and '/ENDCOL/' not in line) or
                               (splitting and '/ENDSPLIT/' not in line))):
                        columntextlist.append(line)

                    # for the end of the columns
                    elif not override and (
                        (columnate and '/ENDCOL/' in line) or
                        (splitting and '/ENDSPLIT/' in line)):
                        line = line.replace('/ENDCOL/', EMPTYCHAR).replace(
                            '/ENDSPLIT/', EMPTYCHAR)
                        if line:
                            columntextlist.append(line)

                        if splitting:
                            splittextlist = BLANK.join(columntextlist).split(
                                '/M/')

                            splittext = side_note(splittextlist)

                            columns(splittext,
                                    columnlist,
                                    middle=UNDERLINE,
                                    encased=True,
                                    leftmargin=leftmargin)

                        else:

                            columns(EOL.join(columntextlist),
                                    columnlist,
                                    middle=UNDERLINE,
                                    encased=True,
                                    leftmargin=leftmargin)
                        c_temp = columnlist.show(returntext=True)
                        if not c_temp:
                            c_temp = EMPTYCHAR

                        #determine width of the columned note
                        param_width_def = param_width
                        maximum_def = maximum
                        param_width = max(
                            [len(x_temp) for x_temp in c_temp.split(EOL)]) - 1
                        maximum = param_width

                        c_temp = EOL.join([
                            x_temp[0:-1] +
                            (param_width - len(x_temp) + 1) * BLANK +
                            x_temp[-1] for x_temp in c_temp.split(EOL)
                            if x_temp
                        ])
                        ## add spaces at the end of the lines so then match.

                        # Print the top of the columned note
                        returntext += self.lineprint('H',
                                                     showsize=param_width,
                                                     maxsize=maximum,
                                                     printyes=not np_temp,
                                                     is_embedded=param_is_emb,
                                                     p_indent=param_indent,
                                                     leftmargin=leftmargin,
                                                     bracket=brackets,
                                                     override=override)

                        # Determine the body of the columned note.
                        returntext += c_temp + EOL
                        if not np_temp:
                            print(c_temp)

                        # print the bottom of the columned note
                        returntext += self.lineprint('F',
                                                     showsize=param_width,
                                                     maxsize=maximum,
                                                     printyes=not np_temp,
                                                     is_embedded=param_is_emb,
                                                     p_indent=param_indent,
                                                     leftmargin=leftmargin,
                                                     bracket=brackets,
                                                     override=override)

                        param_width = param_width_def
                        maximum = maximum_def

                        # print the head of non-columned note.

                        ##                    returntext += self.lineprint('H',
                        ##                             showsize=param_width,
                        ##                             maxsize=maximum,
                        ##                             printyes=not np_temp,
                        ##                             is_embedded=param_is_emb,
                        ##                             p_indent=param_indent,
                        ##                             leftmargin=leftmargin)

                        columns_done = True
                        columnlist.clear()
                        columntextlist = []
                        columnate = False
                        splitting = False

                    elif (LEFTBRACKET + SLASH in line
                          and SLASH + RIGHTBRACKET in line
                          and line.split(LEFTBRACKET + SLASH)[1].split(
                              SLASH + RIGHTBRACKET)[0].isnumeric()):
                        modified = True
                        param_width_def = param_width
                        maximum_def = maximum
                        param_width = int(
                            line.split(LEFTBRACKET +
                                       SLASH)[1].split(SLASH +
                                                       RIGHTBRACKET)[0])
                        maximum = param_width
                        returntext += self.lineprint('F',
                                                     showsize=param_width_def,
                                                     maxsize=maximum_def,
                                                     printyes=not np_temp,
                                                     is_embedded=param_is_emb,
                                                     p_indent=param_indent,
                                                     leftmargin=leftmargin,
                                                     bracket=brackets,
                                                     override=override)
                        returntext += self.lineprint('H',
                                                     showsize=param_width,
                                                     maxsize=maximum,
                                                     printyes=not np_temp,
                                                     is_embedded=param_is_emb,
                                                     p_indent=param_indent,
                                                     leftmargin=leftmargin,
                                                     bracket=brackets,
                                                     override=override)

                    elif not override and '/DEF/' in line:
                        returntext += self.lineprint('F',
                                                     showsize=param_width,
                                                     maxsize=maximum,
                                                     printyes=not np_temp,
                                                     is_embedded=param_is_emb,
                                                     p_indent=param_indent,
                                                     leftmargin=leftmargin,
                                                     bracket=brackets,
                                                     override=override)
                        param_width = param_width_def
                        maximum = maximum_def
                        returntext += self.lineprint('H',
                                                     showsize=param_width,
                                                     maxsize=maximum,
                                                     printyes=not np_temp,
                                                     is_embedded=param_is_emb,
                                                     p_indent=param_indent,
                                                     leftmargin=leftmargin,
                                                     bracket=brackets,
                                                     override=override)
                    elif not override and ('/BREAK/' in line
                                           or '/NEW/' in line):
                        if '/BREAK/' in line:
                            returntext += self.lineprint(
                                'M',
                                showsize=param_width,
                                maxsize=maximum,
                                printyes=not np_temp,
                                is_embedded=param_is_emb,
                                p_indent=param_indent,
                                leftmargin=leftmargin,
                                bracket=brackets,
                                override=override)
                        else:
                            returntext += self.lineprint(
                                'F',
                                showsize=param_width,
                                maxsize=maximum,
                                printyes=not np_temp,
                                is_embedded=param_is_emb,
                                p_indent=param_indent,
                                leftmargin=leftmargin,
                                bracket=brackets,
                                override=override)
                            returntext += self.lineprint(
                                'H',
                                showsize=param_width,
                                maxsize=maximum,
                                printyes=not np_temp,
                                is_embedded=param_is_emb,
                                p_indent=param_indent,
                                leftmargin=leftmargin,
                                bracket=brackets,
                                override=override)

                    else:

                        if not columns_done or not columns:

                            # adds ordinary line of columntext
                            returntext += self.lineprint(
                                line,
                                showsize=param_width,
                                maxsize=maximum,
                                printyes=not np_temp,
                                is_embedded=param_is_emb,
                                p_indent=param_indent,
                                leftmargin=leftmargin,
                                bracket=brackets,
                                override=override)

            if not columns_done or not columns:
                returntext += self.lineprint('F',
                                             showsize=param_width,
                                             maxsize=maximum,
                                             printyes=not np_temp,
                                             is_embedded=param_is_emb,
                                             p_indent=param_indent,
                                             leftmargin=leftmargin,
                                             bracket=brackets,
                                             override=override)
            returntext += (EOL * param_spacing)

        line_length_list = [len(l_temp) for l_temp in returntext.split(EOL)]
        max_len = max(line_length_list)
        min_len = min(line_length_list)
        leftstuff = (int(
            param_indent / 50)) * ']' + (param_indent % 50) * BLANK
        if min_len != max_len:
            returntext = EOL.join([
                leftstuff + l_temp[0:-1] + box_or_nothing(l_temp[-2]) *
                (max_len - len(l_temp)) + l_temp[-1]
                for l_temp in returntext.split(EOL) if l_temp
            ])
        else:
            returntext = EOL.join(
                [leftstuff + l_temp for l_temp in returntext.split(EOL)])
        if not npp_temp:
            print(returntext)

        if npp_temp:
            modified = True
            if modified:
                returnlist = returntext.split(EOL)
                maxwidth = 0
                new_returnlist = []
                for l_temp in returnlist:
                    maxwidth = max([maxwidth, len(l_temp)])

                for l_temp in returnlist:
                    if rectify:
                        if len(l_temp) > 1:
                            if l_temp[-2] != BOX_CHAR['h']:
                                l_temp = l_temp[0:-1] + (maxwidth - len(l_temp))\
                                         * BLANK + l_temp[-1]
                            else:
                                l_temp = l_temp[0:-1] + (maxwidth - len(l_temp))\
                                         * BOX_CHAR['h'] + l_temp[-1]

                        else:
                            l_temp += (maxwidth - len(l_temp)) * BLANK

                    else:
                        l_temp += (maxwidth - len(l_temp)) * BLANK
                    new_returnlist.append(l_temp)

                returntext = EOL.join(new_returnlist)

            return returntext

        if len(textlist) == 1:
            pass
        return returntext