Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions | Variables
quote Namespace Reference

Functions

def quote
def main

Variables

string TITLE = "Text quoting"
string QUOTE_START = u""
string QUOTE_END = u""

Function Documentation

def quote.main ( )

Definition at line 52 of file quote.py.

00052 
00053 def main():
00054     changed = 0
00055     sel_count = selectionCount()
00056     if sel_count:
00057         for i in range(sel_count):
00058             changed += quote(getSelectedObject(i))
00059     else:
00060         for page in range(pageCount()):
00061             gotoPage(page)
00062             for obj in getAllObjects():
00063                 changed += quote(obj)
00064     messageBox(TITLE, "%s quotations changed" % changed,
00065                ICON_INFORMATION, BUTTON_OK)

def quote.quote (   textobj)

Definition at line 23 of file quote.py.

00023 
00024 def quote(textobj):
00025     quoted_re = re.compile('"[^"]*"')
00026     try:
00027         text = getText(textobj)
00028     except WrongFrameTypeError:
00029         messageBox("quote.py", "Cannot quote text in a non-text frame", ICON_INFORMATION);
00030         sys.exit(1)
00031     if len(text) == 0:
00032         return 0    # We can't very well change anything in an empty frame
00033     count = 0
00034     i = 0
00035     selectText(0, 0, textobj)
00036     while i < len(text):
00037         match = quoted_re.match(text[i:])
00038         if match:
00039             end = match.end()
00040             selectText(i, 1, textobj)
00041             deleteText(textobj)
00042             insertText(QUOTE_START, i, textobj)
00043             selectText(i + end - 1, 1, textobj)
00044             deleteText(textobj)
00045             insertText(QUOTE_END, i + end - 1, textobj)
00046             count += 1
00047             i = i + end
00048         else:
00049             i = i + 1
00050     return count
00051 


Variable Documentation

string quote.QUOTE_END = u""

Definition at line 21 of file quote.py.

string quote.QUOTE_START = u""

Definition at line 20 of file quote.py.

string quote.TITLE = "Text quoting"

Definition at line 16 of file quote.py.