pythonreports-checkins Mailing List for PythonReports (Page 5)
Brought to you by:
a1s
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(45) |
Dec
(56) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
2009 |
Jan
|
Feb
|
Mar
(5) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(3) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
(10) |
Apr
|
May
(18) |
Jun
(6) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: alexander s. <a1...@us...> - 2006-12-12 10:42:07
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17734 Modified Files: drivers.py Log Message: fix misleading comment Index: drivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/drivers.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** drivers.py 6 Dec 2006 19:37:20 -0000 1.7 --- drivers.py 12 Dec 2006 10:42:02 -0000 1.8 *************** *** 6,9 **** --- 6,10 ---- """ """History (most recent first): + 12-dec-2006 [als] fix misleading comment 06-dec-2006 [als] more lint fixes 05-dec-2006 [als] sweep pylint warnings *************** *** 279,284 **** backend = None # backend name, must be set in child classes height = None # line height, in points ! leading = None # distance between baselines of two subsequent rows, ! # in points def __init__(self, font): --- 280,284 ---- backend = None # backend name, must be set in child classes height = None # line height, in points ! leading = None # distance between rows, in points def __init__(self, font): |
From: alexander s. <a1...@us...> - 2006-12-08 15:29:09
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17151 Modified Files: design.py Log Message: invalidate .current_node when new file is loaded; ditto, when selected node is being deleted; fix node deletion when parent node had a hidden child elements (e.g. box sub-element); when last child is deleted, remove open/close indicator; fix Insert key handler: obtain current insertion menu Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** design.py 7 Dec 2006 19:48:09 -0000 1.16 --- design.py 8 Dec 2006 15:29:07 -0000 1.17 *************** *** 5,8 **** --- 5,14 ---- """PythonReports Template Designer""" """History (most recent first): + 08-dec-2006 [als] invalidate .current_node when new file is loaded; + ditto, when selected node is being deleted; + fix node deletion when parent node had a hidden + child elements (e.g. box sub-element); + when last child is deleted, remove open/close indicator; + fix Insert key handler: obtain current insertion menu 07-dec-2006 [als] CodeSelection: always have an empty value in the list; edit data block contents *************** *** 477,483 **** def __init__(self, master=None, cnf={}, **kw): # pylint: disable-msg=W0102 PropertyEntry.__init__(self, master, cnf, **kw) - # XXX on windows, these checkbuttons get white background - self.widget["background"] = self.winfo_toplevel().color_panel # checkbuttons have no .select_range method --- 483,492 ---- def __init__(self, master=None, cnf={}, **kw): # pylint: disable-msg=W0102 + # When TreeNodeData instantiates PropertyEditors, + # it passes background color suitable for text entries. + # This does not look good with check boxes, so remove + # background color if it is set in the options. + kw.pop("background", None) PropertyEntry.__init__(self, master, cnf, **kw) # checkbuttons have no .select_range method *************** *** 569,574 **** Frame.__init__(self, master, cnf, **kw) _toplevel = self.winfo_toplevel() ! self["background"] = _toplevel.color_panel ! self._ = self.winfo_toplevel()._ self.data = data # layout --- 578,582 ---- Frame.__init__(self, master, cnf, **kw) _toplevel = self.winfo_toplevel() ! self._ = self.gettext = _toplevel.gettext self.data = data # layout *************** *** 604,608 **** if not self.isBinary(): # the text widget adds one line feed, ! # but i'd like to trim all trailing space self.data.contents = self.text.get("1.0", "end").rstrip() --- 612,616 ---- if not self.isBinary(): # the text widget adds one line feed, ! # but i want to trim all trailing space, even manually entered self.data.contents = self.text.get("1.0", "end").rstrip() *************** *** 616,620 **** else: _text.pack_configure(side=LEFT, fill=X) ! if self.data.contents != _text.get("1.0", "end"): _text.delete("1.0", "end") _text.insert("1.0", self.data.contents or "") --- 624,628 ---- else: _text.pack_configure(side=LEFT, fill=X) ! if self.data.contents != _text.get("1.0", "end").rstrip(): _text.delete("1.0", "end") _text.insert("1.0", self.data.contents or "") *************** *** 622,626 **** _text.mark_set("sel_first", "1.0") _text.mark_set("sel_last", "end") ! # disable save button if data is empty self.btn_save["state"] = ("disabled", "normal")[not _binary_data or bool(self.data.contents)] --- 630,634 ---- _text.mark_set("sel_first", "1.0") _text.mark_set("sel_last", "end") ! # disable save button if data is empty and cannot be entered (binary) self.btn_save["state"] = ("disabled", "normal")[not _binary_data or bool(self.data.contents)] *************** *** 778,782 **** # if this is data element, make a structure for contents editing if self.tag == "data": ! self.data = PropertyData(node=self, contents=Data.get_data(self.element), filename="", filepath="") --- 786,790 ---- # if this is data element, make a structure for contents editing if self.tag == "data": ! self.data = Structure(node=self, contents=Data.get_data(self.element), filename="", filepath="") *************** *** 872,876 **** if self.data: hlist.add("data") ! _win = DataBlockEditor(self.data, hlist, background=_window_color) hlist.item_create("data", 1, itemtype=WINDOW, window=_win, style=self.PROP_VALUE_STYLE) --- 880,884 ---- if self.data: hlist.add("data") ! _win = DataBlockEditor(self.data, hlist) hlist.item_create("data", 1, itemtype=WINDOW, window=_win, style=self.PROP_VALUE_STYLE) *************** *** 1401,1407 **** def OnTreeInsert(self, event): """Insert key pressed in the tree - pop up insert element menu""" ! _menu = self.insert_menus[self.getNodeData(self.current_node).tag] if _menu: ! _menu.tk_popup(*self._get_popup_position()) def OnPropListResize(self, event=0): --- 1409,1415 ---- def OnTreeInsert(self, event): """Insert key pressed in the tree - pop up insert element menu""" ! _menu = self.report_menu.entrycget(0, "menu") if _menu: ! self.nametowidget(_menu).tk_popup(*self._get_popup_position()) def OnPropListResize(self, event=0): *************** *** 1475,1480 **** --- 1483,1491 ---- # cannot delete return + if path == self.current_node: + self.current_node = None _parent = _data.parent _index = _parent.index(_data) + _element_index = _parent.element.getchildren().index(_data.element) _hlist = self.tree.hlist if _data.tag == "group": *************** *** 1491,1495 **** _replace.parent = _parent _parent[_index] = _replace ! _parent.element[_index] = _replace.element _hlist.delete_entry(path) _replace.addToTree(self.tree) --- 1502,1506 ---- _replace.parent = _parent _parent[_index] = _replace ! _parent.element[_element_index] = _replace.element _hlist.delete_entry(path) _replace.addToTree(self.tree) *************** *** 1498,1502 **** else: _hlist.delete_entry(path) ! del _parent[_index], _parent.element[_index] if _index < len(_parent): _select = _parent[_index] --- 1509,1513 ---- else: _hlist.delete_entry(path) ! del _parent[_index], _parent.element[_element_index] if _index < len(_parent): _select = _parent[_index] *************** *** 1505,1508 **** --- 1516,1521 ---- else: _select = _parent + # deleted last child - remove open/close indicator + self.tree.setmode(_parent.path, "none") self.select(_select.path) *************** *** 1628,1631 **** --- 1641,1645 ---- self.filename = None self.updateTitle() + self.current_node = None self.loadTreeContents() |
From: alexander s. <a1...@us...> - 2006-12-08 12:52:12
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24088 Modified Files: datatypes.py Log Message: fix: qp-encoded data was accumulating spaces at the end Index: datatypes.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/datatypes.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** datatypes.py 7 Dec 2006 19:29:26 -0000 1.4 --- datatypes.py 8 Dec 2006 12:52:06 -0000 1.5 *************** *** 1,4 **** --- 1,5 ---- """Data types and element primitives, common for templates and printouts""" """History: + 07-dec-2006 [als] fix: qp-encoded data was accumulating spaces at the end 07-dec-2006 [als] fix decoding of qp-encoded data 05-dec-2006 [als] sweep pylint warnings *************** *** 1182,1187 **** --- 1183,1193 ---- # W0613: Unused argument 'addindent' - API comes from Validator, # but there are no child elements in the data element + _text = element.text or "" if element.get("encoding"): _indent2 = indent + # we will be adding certain amount of space before the closing tag + # to make it certain amount indeed, make sure there aren't any + # spaces yet. + _text = _text.rstrip(" ") else: # must not add blank spaces to non-encoded values *************** *** 1190,1194 **** # (the text, if any, must be already encoded by .make_element) _text = u"%s<%s>%s%s</%s>%s" % (indent, self.starttag(element), ! element.text or "", _indent2, self.tag, newl) writer.write(_text.encode(encoding, "xmlcharrefreplace")) --- 1196,1200 ---- # (the text, if any, must be already encoded by .make_element) _text = u"%s<%s>%s%s</%s>%s" % (indent, self.starttag(element), ! _text, _indent2, self.tag, newl) writer.write(_text.encode(encoding, "xmlcharrefreplace")) |
From: alexander s. <a1...@us...> - 2006-12-07 19:48:18
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10838 Modified Files: design.py Log Message: CodeSelection: always have an empty value in the list; edit data block contents Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** design.py 7 Dec 2006 11:17:27 -0000 1.15 --- design.py 7 Dec 2006 19:48:09 -0000 1.16 *************** *** 5,8 **** --- 5,10 ---- """PythonReports Template Designer""" """History (most recent first): + 07-dec-2006 [als] CodeSelection: always have an empty value in the list; + edit data block contents 07-dec-2006 [als] write printouts 06-dec-2006 [als] rebuild insertion menu each time selected node tag changes: *************** *** 340,343 **** --- 342,349 ---- self.values = kw.pop("values", ()) ComboBox.__init__(self, master=master, cnf=cnf, **kw) + # we always allow empty value here. + # tree validation will check for mandatory attributes elsewhere + if "" not in self.values: + self.insert("end", "") for _val in self.values: self.insert("end", _val) *************** *** 538,541 **** --- 544,676 ---- return _rv + class DataBlockEditor(Frame): + + """PropertyEditor-alike editor for data block contents""" + + # Same As in PropertyEntry + if os.name == "nt": + LPAD = 3 + else: + LPAD = 7 + + def __init__(self, data, master=None, cnf={}, **kw): + """Create editor frame + + Parameters: + data: editor data object. must have following properties: + node: containing TreeNodeData object + contents: data block contents + filename: keeps the name of load/save file + across instantiations + filepath: ditto, for default file directory + + """ + # pylint: disable-msg=W0102 + Frame.__init__(self, master, cnf, **kw) + _toplevel = self.winfo_toplevel() + self["background"] = _toplevel.color_panel + self._ = self.winfo_toplevel()._ + self.data = data + # layout + Frame(self, width=self.LPAD).pack(side=LEFT) + _btn_frame = Frame(self) + _btn_frame.pack(side=TOP) + self.btn_load = Button(_btn_frame, text=self._("Load File..."), + command=self.loadFile) + self.btn_load.pack(side=LEFT, padx=2) + self.btn_save = Button(_btn_frame, text=self._("Save File..."), + command=self.saveFile) + self.btn_save.pack(side=LEFT, padx=2) + self.text = Text(self, background=_toplevel.color_window) + self.updateState() + self.bind("<FocusIn>", lambda event: self.updateState()) + self.bind("<FocusOut>", lambda event: self.textToContents()) + + def isBinary(self): + """Return True if data contents seem to be binary + + If the element has non-empty compression or encoding, + the data is not editable in the text window. + + WARNING: the caller must ensure that element attributes + are updated from peer property editors. + + """ + _element = self.data.node.element + return bool(_element.get("compress") or _element.get("encoding")) + + def textToContents(self): + """If data is textual, update data contents from the text window""" + if not self.isBinary(): + # the text widget adds one line feed, + # but i'd like to trim all trailing space + self.data.contents = self.text.get("1.0", "end").rstrip() + + def updateState(self): + """Set text contents and visibility, disable save if text is empty""" + self.data.node.updateAttributes() + _text = self.text + _binary_data = self.isBinary() + if _binary_data: + _text.pack_forget() + else: + _text.pack_configure(side=LEFT, fill=X) + if self.data.contents != _text.get("1.0", "end"): + _text.delete("1.0", "end") + _text.insert("1.0", self.data.contents or "") + _text.mark_set("insert", "1.0") + _text.mark_set("sel_first", "1.0") + _text.mark_set("sel_last", "end") + # disable save button if data is empty + self.btn_save["state"] = ("disabled", "normal")[not _binary_data + or bool(self.data.contents)] + + def loadFile(self): + """Load file contents into the variable""" + _filename = tkFileDialog.askopenfilename( + initialfile=self.data.filename, + initialdir=(self.data.filepath or os.getcwd()), + filetypes=[(self._("All Files"), "*")]) + if not _filename: + return + _binary_data = self.isBinary() + _file = open(_filename, ("rU", "rb")[_binary_data]) + _contents = _file.read() + _file.close() + if not _binary_data: + # FIXME: encoding should be designer property (probably changeable) + _contents = _contents.decode("utf-8") + self.data.contents = _contents + self.setFileName(_filename) + self.updateState() + + def saveFile(self): + """Save variable contents to disk file""" + _filename = tkFileDialog.asksaveasfilename( + initialfile=self.data.filename, + initialdir=(self.data.filepath or os.getcwd()), + filetypes=[(self._("All Files"), "*")]) + if not _filename: + return + if self.isBinary(): + _file_mode = "wb" + _contents = self.data.contents + else: + self.textToContents() + _file_mode = "wt" + # FIXME: encoding should be designer property (probably changeable) + _contents = unicode(self.data.contents).encode("utf-8") + # add terminating newline for conveninence + _contents += "\n" + _file = open(_filename, _file_mode) + _file.write(_contents) + _file.close() + self.setFileName(_filename) + + def setFileName(self, filename): + """Update default file path after successful load or save""" + self.data.filename = filename + self.data.filepath = os.path.dirname(filename) + # data objects *************** *** 640,654 **** element=_child, validator=_child_validators[_tag])) # attribute edit support _properties = [] ! for (_name, (_cls, _default)) in validator.attributes.iteritems(): _properties.append(PropertyData(name=_name, type=_cls, ! default=_default, element=element, box=False)) if self.is_printable or self.is_section: # we need a box element. if there's no box, add default one ! _box = element.find("box") _box_attrs = prt.Box.attributes if _box is None: ! _box = SubElement(element, "box", attrib=dict((_name, _default) ! for (_name, (_cls, _default)) in _box_attrs.iteritems())) if self.is_printable: for (_name, (_cls, _default)) in _box_attrs.iteritems(): --- 775,806 ---- element=_child, validator=_child_validators[_tag])) # attribute edit support + self.properties = self._build_properties() + # if this is data element, make a structure for contents editing + if self.tag == "data": + self.data = PropertyData(node=self, + contents=Data.get_data(self.element), + filename="", filepath="") + else: + self.data = None + + def _build_properties(self): + """Return a sorted tuple of PropertyData objects + + This is part of the TreeNodeData initialization. + + """ _properties = [] ! for (_name, (_cls, _default)) in self.validator.attributes.iteritems(): _properties.append(PropertyData(name=_name, type=_cls, ! default=_default, element=self.element, box=False)) if self.is_printable or self.is_section: # we need a box element. if there's no box, add default one ! _box = self.element.find("box") _box_attrs = prt.Box.attributes if _box is None: ! _box = SubElement(self.element, "box", ! attrib=dict((_name, _default) ! for (_name, (_cls, _default)) ! in _box_attrs.iteritems())) if self.is_printable: for (_name, (_cls, _default)) in _box_attrs.iteritems(): *************** *** 671,675 **** _val = unicode(_val) _prop.var.set(_val) ! # TODO: it is possible to add a write callback to the var # and update the element attribute as soon as the value # is changed in the editor. --- 823,827 ---- _val = unicode(_val) _prop.var.set(_val) ! # TODO? it is possible to add a write callback to the var # and update the element attribute as soon as the value # is changed in the editor. *************** *** 678,683 **** _properties.sort( key=lambda prop: (prop.box, not prop.mandatory, prop.name)) ! # XXX does the properties container need to be a dictionary? ! self.properties = tuple(_properties) def addToTree(self, tree, before=None): --- 830,834 ---- _properties.sort( key=lambda prop: (prop.box, not prop.mandatory, prop.name)) ! return tuple(_properties) def addToTree(self, tree, before=None): *************** *** 718,732 **** hlist.item_create(_prop.name, 1, itemtype=WINDOW, window=_win, style=self.PROP_VALUE_STYLE) # grow the first column if needed _col_width = max(_col_width, int(hlist.column_width(0))) hlist.column_width(0, _col_width) ! def updateProperties(self, recursive=False, errors="strict"): ! """Load property values from Tkinter variables Parameters: - recursive: if set, also update children errors: error handling scheme: "strict" or "ignore". """ _element = self.element --- 869,894 ---- hlist.item_create(_prop.name, 1, itemtype=WINDOW, window=_win, style=self.PROP_VALUE_STYLE) + # if this is a data element, add nonstandard controls + if self.data: + hlist.add("data") + _win = DataBlockEditor(self.data, hlist, background=_window_color) + hlist.item_create("data", 1, itemtype=WINDOW, window=_win, + style=self.PROP_VALUE_STYLE) # grow the first column if needed _col_width = max(_col_width, int(hlist.column_width(0))) hlist.column_width(0, _col_width) ! def updateAttributes(self, errors="ignore"): ! """Load element attributes from edit variables Parameters: errors: error handling scheme: "strict" or "ignore". + Unlike updateProperties method (defined below), + updateAttributes sets only attributes of current + node element and its' box. It does not touch + contents for data elements and never descends + down the tree. + """ _element = self.element *************** *** 740,747 **** raise AttributeConversionError(_prop.name, _val, _err, element=_element, path=self.path) ! if (_box is not None) and (_prop.name in Box.__slots__): _box.set(_prop.name, _val) else: _element.set(_prop.name, _val) if recursive: for _child in self: --- 902,926 ---- raise AttributeConversionError(_prop.name, _val, _err, element=_element, path=self.path) ! if _prop.box: ! # the box must be valid element - created in __init__ if needed _box.set(_prop.name, _val) else: _element.set(_prop.name, _val) + + def updateProperties(self, recursive=False, errors="strict"): + """Load property values from Tkinter variables + + Parameters: + recursive: if set, also update children + errors: error handling scheme: "strict" or "ignore". + + """ + self.updateAttributes() + if self.data: + _parent = self.parent.element + _new = Data.make_element(_parent, + self.element.attrib, self.data.contents) + _parent.remove(self.element) + self.element = _new if recursive: for _child in self: |
From: alexander s. <a1...@us...> - 2006-12-07 19:29:35
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3819 Modified Files: datatypes.py Log Message: fix decoding of qp-encoded data Index: datatypes.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/datatypes.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** datatypes.py 6 Dec 2006 16:22:48 -0000 1.3 --- datatypes.py 7 Dec 2006 19:29:26 -0000 1.4 *************** *** 1,4 **** --- 1,5 ---- """Data types and element primitives, common for templates and printouts""" """History: + 07-dec-2006 [als] fix decoding of qp-encoded data 05-dec-2006 [als] sweep pylint warnings 03-nov-2006 [als] ElementTree: string conversion returns full XML text *************** *** 1150,1154 **** _data = binascii.a2b_uu(_data) elif _encoding == "qp": ! _data = binascii.b2a_qp(_data, True, False) _compress = element.get("compress") if _compress == "zlib": --- 1151,1158 ---- _data = binascii.a2b_uu(_data) elif _encoding == "qp": ! # .write() adds blank space to encoded data. ! # it must be stripped here or it will be ! # escaped on repeated write ! _data = binascii.a2b_qp(_data.strip()) _compress = element.get("compress") if _compress == "zlib": |
From: alexander s. <a1...@us...> - 2006-12-07 13:36:34
|
Update of /cvsroot/pythonreports/PythonReports/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2867 Modified Files: sakila.prt Log Message: added a note about fill color separated from rectangle in the detail section - confusing trick if you look at it in the designer. Index: sakila.prt =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/test/sakila.prt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sakila.prt 1 Nov 2006 11:21:56 -0000 1.1 --- sakila.prt 7 Dec 2006 13:36:33 -0000 1.2 *************** *** 209,212 **** --- 209,221 ---- <style printwhen="PAGE_COUNT % 2" /> </rectangle> + <!-- + Note: color setting style and rectangle may be combined like this: + + <rectangle pen="0"> + <style bgcolor="#F3EDE7" printwhen="PAGE_COUNT % 2" /> + </rectangle> + + They are left separate to run through different branches of processing. + --> <field expr="film['title']" stretch="true"> <box height="10" width="35mm" /> |
From: alexander s. <a1...@us...> - 2006-12-07 13:35:01
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25772 Modified Files: builder.py Log Message: support rectangle opacity Index: builder.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/builder.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** builder.py 6 Dec 2006 16:13:37 -0000 1.4 --- builder.py 7 Dec 2006 13:11:06 -0000 1.5 *************** *** 2,5 **** --- 2,6 ---- # FIXME: column-based variables are not intelligible """History (most recent first): + 07-dec-2006 [als] support rectangle opacity 05-dec-2006 [als] fix errors and some warnings reported by pylint 04-nov-2006 [als] Builder: delay text_drivers initialization until run, *************** *** 834,838 **** elif _prp_tag == "rectangle": _attrib["pencolor"] = _element.style["color"] ! _attrib["color"] = _element.style["bgcolor"] elif _prp_tag == "barcode": _attrib["stripes"] = ",".join([str(_stripe) --- 835,840 ---- elif _prp_tag == "rectangle": _attrib["pencolor"] = _element.style["color"] ! if _template.get("opaque"): ! _attrib["color"] = _element.style["bgcolor"] elif _prp_tag == "barcode": _attrib["stripes"] = ",".join([str(_stripe) |
From: alexander s. <a1...@us...> - 2006-12-07 13:21:13
|
Update of /cvsroot/pythonreports/PythonReports/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29437 Modified Files: prt.txt Log Message: added "opaque" attribute to "rectangle" element Index: prt.txt =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/doc/prt.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** prt.txt 7 Dec 2006 12:38:22 -0000 1.3 --- prt.txt 7 Dec 2006 13:21:07 -0000 1.4 *************** *** 641,644 **** --- 641,646 ---- ``radius`` O dimension Corner radius for rounded rectangles. Default: 0 + ``opaque`` O boolean If set to False, the rectangle will be + drawn transparent. Default: True. ================= ===== ========= ====================================== |
From: alexander s. <a1...@us...> - 2006-12-07 13:08:44
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24819 Modified Files: template.py Log Message: added Rectangle.opaque Index: template.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/template.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** template.py 7 Dec 2006 12:50:44 -0000 1.3 --- template.py 7 Dec 2006 13:08:40 -0000 1.4 *************** *** 1,4 **** --- 1,5 ---- """PythonReports Template (PRT) structures""" """History: + 07-dec-2006 [als] added Rectangle.opaque 07-dec-2006 [als] removed "transparent" attribute of the "box" element 05-dec-2006 [als] style: imports come after version, date and exports; *************** *** 155,158 **** --- 156,160 ---- "pen": (PenType, REQUIRED), "radius": (Dimension, 0), + "opaque": (Boolean, True), }, children=( (Box, Validator.ZERO_OR_ONE), |
From: alexander s. <a1...@us...> - 2006-12-07 12:50:46
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18400 Modified Files: template.py Log Message: removed "transparent" attribute of the "box" element Index: template.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/template.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** template.py 6 Dec 2006 16:57:21 -0000 1.2 --- template.py 7 Dec 2006 12:50:44 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- """PythonReports Template (PRT) structures""" """History: + 07-dec-2006 [als] removed "transparent" attribute of the "box" element 05-dec-2006 [als] style: imports come after version, date and exports; sweep pylint warnings *************** *** 99,103 **** "halign": (AlignHorizontal, "left"), "valign": (AlignVertical, "bottom"), - "transparent": (Boolean, True), }, doc="Defines rectangular space occupied by report elements" ) --- 100,103 ---- |
From: alexander s. <a1...@us...> - 2006-12-07 12:38:25
|
Update of /cvsroot/pythonreports/PythonReports/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13967 Modified Files: prt.txt Log Message: removed "transparent" attribute of the "box" element: all boxes are transparent. if you need an opaque box, draw a filled rectangle. (box transparency was not supported anyway) Index: prt.txt =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/doc/prt.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** prt.txt 1 Nov 2006 12:03:51 -0000 1.2 --- prt.txt 7 Dec 2006 12:38:22 -0000 1.3 *************** *** 3,8 **** ======================= ! :Version: 0.1.0 ! :Date: 20-oct-2006 .. TODO: variables iterated at start of section; --- 3,8 ---- ======================= ! :Version: 0.3.0 ! :Date: 07-dec-2006 .. TODO: variables iterated at start of section; *************** *** 421,425 **** ``top``, ``bottom`` or ``center``. Default: ``bottom``. - ``transparent`` O boolean If set to False, the box is opaque. ================= ===== ========= ====================================== --- 421,424 ---- |
From: alexander s. <a1...@us...> - 2006-12-07 12:21:53
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7884 Modified Files: pdf.py Log Message: fix: diagonal lines were offset down by the box height Index: pdf.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/pdf.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pdf.py 6 Dec 2006 16:48:56 -0000 1.3 --- pdf.py 7 Dec 2006 12:21:50 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- """PDF output for PythonReports""" """History (most recent first): + 07-dec-2006 [als] fix: diagonal lines were offset down by the box height 05-dec-2006 [als] sweep pylint warnings; remove pdf autostart (can be easily done in command line) *************** *** 284,291 **** _x2 = _x1 + _width if line.get("backslant"): - _y2 = _y1 - _height - else: _y2 = _y1 ! _y1 = _y2 - _height # draw self.canvas.line(_x1, _y1, _x2, _y2) --- 285,292 ---- _x2 = _x1 + _width if line.get("backslant"): _y2 = _y1 ! _y1 = _y2 + _height ! else: ! _y2 = _y1 + _height # draw self.canvas.line(_x1, _y1, _x2, _y2) |
From: alexander s. <a1...@us...> - 2006-12-07 11:56:53
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31066 Modified Files: Tk.py Log Message: fix dashed lines: option is "dash", not "stipple" Index: Tk.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/Tk.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Tk.py 6 Dec 2006 17:02:22 -0000 1.3 --- Tk.py 7 Dec 2006 11:56:49 -0000 1.4 *************** *** 2,5 **** --- 2,6 ---- """Tk output for PythonReports""" """History (most recent first): + 05-dec-2006 [als] fix dashed lines: option is "dash", not "stipple" 05-dec-2006 [als] fix errors and some warnings reported by pylint 07-Nov-2006 [phd] Added shebang. *************** *** 138,148 **** _rv = {} if pen == "dot": ! _rv["stipple"] = "gray25" elif pen == "dash": ! # TODO: draw bitmap ! _rv["stipple"] = "gray25" elif pen == "dashdot": ! # TODO: draw bitmap ! _rv["stipple"] = "gray25" elif pen == 0: _rv["width"] = 0 --- 139,147 ---- _rv = {} if pen == "dot": ! _rv["dash"] = ". " elif pen == "dash": ! _rv["dash"] = "- " elif pen == "dashdot": ! _rv["dash"] = "- . " elif pen == 0: _rv["width"] = 0 |
From: alexander s. <a1...@us...> - 2006-12-07 11:17:30
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16794 Modified Files: design.py Log Message: write printouts Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** design.py 6 Dec 2006 19:26:57 -0000 1.14 --- design.py 7 Dec 2006 11:17:27 -0000 1.15 *************** *** 5,8 **** --- 5,9 ---- """PythonReports Template Designer""" """History (most recent first): + 07-dec-2006 [als] write printouts 06-dec-2006 [als] rebuild insertion menu each time selected node tag changes: prebuilt menu reuse didn't work reliably *************** *** 67,70 **** --- 68,75 ---- from PythonReports.datatypes import * from PythonReports.Tk import PreviewWindow + try: + from PythonReports import pdf + except ImportError: + pdf = None NEW_REPORT_TEMPLATE = """<report> *************** *** 949,952 **** --- 954,959 ---- _popup.add_separator() self._build_menu_item(_popup, ''"Print Pre_view", command=self.preview) + self._build_menu_item(_popup, ''"_Write Printout...", + command=self.printout) # Help menu _popup = self._build_menu_item(_menu, ''"_Help", item_type="cascade") *************** *** 1559,1566 **** validator(tree, _root, "/" + _root.tag) ! def _run_preview(self): ! """Build and show the report""" if not self.updateTree(): ! return # message boxes take focus away. remember currently focused widget # to regain the focus after message display. --- 1566,1577 ---- validator(tree, _root, "/" + _root.tag) ! def _get_report_data(self): ! """Return data sequence for report preview or output ! ! If the report cannot be run, return None ! ! """ if not self.updateTree(): ! return None # message boxes take focus away. remember currently focused widget # to regain the focus after message display. *************** *** 1582,1586 **** if _msg.show() != "ok": _focus.focus_set() ! return _data = () else: --- 1593,1597 ---- if _msg.show() != "ok": _focus.focus_set() ! return None _data = () else: *************** *** 1597,1603 **** )).show() _focus.focus_set() ! return _data = () _focus.focus_set() # build printout tree # Note: it is best to use same backend for both building and rendering. --- 1608,1621 ---- )).show() _focus.focus_set() ! return None _data = () _focus.focus_set() + return _data + + def _run_preview(self): + """Build and show the report""" + _data = self._get_report_data() + if _data is None: + return # build printout tree # Note: it is best to use same backend for both building and rendering. *************** *** 1635,1638 **** --- 1653,1685 ---- _focus.focus_set() + def printout(self): + """Build and save report printout""" + _data = self._get_report_data() + if _data is None: + return + if self.filename: + _filename = os.path.splitext(self.filename)[0] + else: + _filename = "" + _filetypes = [ + (self._("PythonReports Printouts"), ".prp"), + (self._("All Files"), "*"), + ] + if pdf: + _filetypes.insert(1, (self._("Adobe PDF Files"), ".pdf")) + _filename = tkFileDialog.asksaveasfilename( + initialfile=_filename, initialdir=(self.filedir or os.getcwd()), + filetypes=_filetypes, defaultextension=".prp") + if not _filename: + return + _printout = Builder(self.report).run(_data) + # printout must be validated before it can be saved + self._validate(_printout, prp.Printout) + # take output type from file extension + if pdf and _filename.lower().endswith(".pdf"): + pdf.write(_printout, _filename) + else: + _printout.write(_filename) + def run(argv=sys.argv): """Command line executable""" |
From: alexander s. <a1...@us...> - 2006-12-06 19:37:24
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1660 Modified Files: drivers.py Log Message: more lint fixes Index: drivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/drivers.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** drivers.py 6 Dec 2006 16:40:34 -0000 1.6 --- drivers.py 6 Dec 2006 19:37:20 -0000 1.7 *************** *** 6,9 **** --- 6,10 ---- """ """History (most recent first): + 06-dec-2006 [als] more lint fixes 05-dec-2006 [als] sweep pylint warnings 04-nov-2006 [als] added text driver backend "Tk"; *************** *** 312,317 **** """ ! (_w, _h) = self.getsize(text) ! if _w <= width: return text # split text to words. inter-word spaces go to previous word. --- 313,318 ---- """ ! _tw = self.getsize(text)[0] ! if _tw <= width: return text # split text to words. inter-word spaces go to previous word. *************** *** 323,328 **** while _ii > 1: _line = "".join(_words[:_ii]).rstrip() ! (_w, _h) = self.getsize(_line) ! if _w <= width: break _ii -= 1 --- 324,329 ---- while _ii > 1: _line = "".join(_words[:_ii]).rstrip() ! _tw = self.getsize(_line)[0] ! if _tw <= width: break _ii -= 1 |
From: alexander s. <a1...@us...> - 2006-12-06 19:27:03
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30189 Modified Files: design.py Log Message: rebuild insertion menu each time selected node tag changes: prebuilt menu reuse didn't work reliably Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** design.py 6 Dec 2006 18:24:52 -0000 1.13 --- design.py 6 Dec 2006 19:26:57 -0000 1.14 *************** *** 5,8 **** --- 5,10 ---- """PythonReports Template Designer""" """History (most recent first): + 06-dec-2006 [als] rebuild insertion menu each time selected node tag changes: + prebuilt menu reuse didn't work reliably 06-dec-2006 [als] fix: box attributes not updated 05-dec-2006 [als] fix errors and some warnings reported by pylint *************** *** 964,974 **** if _tag in self.insert_menus: return ! # return early if validator has no children (no insert menu) if not validator.children: - self.insert_menus[_tag] = None return # create submenu for "insert element" cascade - _menu = Menu(self.report_menu, tearoff=False) - self.insert_menus[_tag] = _menu _hotkeys = set() for (_child, _restrict) in validator.children: --- 966,974 ---- if _tag in self.insert_menus: return ! _menu = self.insert_menus[_tag] = [] ! # return early if validator has no children (insert menu empty/unused) if not validator.children: return # create submenu for "insert element" cascade _hotkeys = set() for (_child, _restrict) in validator.children: *************** *** 989,994 **** # if the loop is empty, the variable is initialized # in the else clause. ! self._build_menu_item(_menu, _child.tag, underline=_underline, ! command=lambda tag=_child.tag: self.insertNode(tag)) @staticmethod --- 989,994 ---- # if the loop is empty, the variable is initialized # in the else clause. ! _menu.append(dict(label=_child.tag, underline=_underline, ! command=lambda tag=_child.tag: self.insertNode(tag))) @staticmethod *************** *** 1148,1163 **** if (node == self.current_node) and not force: return # TODO? if self.current_node is not None, # update from the properties list _data = self.getNodeData(node) _data.loadPropertyList(self.pl.hlist) self.current_node = node - # replace insertion menu - _rmenu = self.report_menu - _imenu = self.insert_menus[_data.tag] - if _imenu is None: - _rmenu.entryconfigure(0, state=DISABLED) - else: - _rmenu.entryconfigure(0, state=NORMAL, menu=_imenu) # enable/disable other element commands _rmenu.entryconfigure(1, --- 1148,1174 ---- if (node == self.current_node) and not force: return + # spare some keystrokes and attribute lookups + _rmenu = self.report_menu # TODO? if self.current_node is not None, # update from the properties list _data = self.getNodeData(node) _data.loadPropertyList(self.pl.hlist) + if (not self.current_node) \ + or (_data.tag != self.getNodeData(self.current_node).tag): + # element type changed - replace insertion menu + # destroy current menu, if any + _imenu = _rmenu.entrycget(0, "menu") + if _imenu: + _imenu = _rmenu.nametowidget(_imenu) + _rmenu.entryconfigure(0, state=DISABLED, menu="") + _imenu.destroy() + # build new insertion menu, if any + _imenu_def = self.insert_menus[_data.tag] + if _imenu_def: + _imenu = Menu(_rmenu, tearoff=False) + for _args in _imenu_def: + self._build_menu_item(_imenu, **_args) + _rmenu.entryconfigure(0, state=NORMAL, menu=_imenu) self.current_node = node # enable/disable other element commands _rmenu.entryconfigure(1, |
From: alexander s. <a1...@us...> - 2006-12-06 18:38:18
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7177 Modified Files: design.py Log Message: fix: box attributes not updated Index: design.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/design.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** design.py 6 Dec 2006 16:35:20 -0000 1.12 --- design.py 6 Dec 2006 18:24:52 -0000 1.13 *************** *** 5,8 **** --- 5,9 ---- """PythonReports Template Designer""" """History (most recent first): + 06-dec-2006 [als] fix: box attributes not updated 05-dec-2006 [als] fix errors and some warnings reported by pylint 07-Nov-2006 [phd] Added shebang. *************** *** 723,726 **** --- 724,728 ---- """ _element = self.element + _box = _element.find("box") for _prop in self.properties: _val = _prop.var.get() *************** *** 731,735 **** raise AttributeConversionError(_prop.name, _val, _err, element=_element, path=self.path) ! _element.set(_prop.name, _val) if recursive: for _child in self: --- 733,740 ---- raise AttributeConversionError(_prop.name, _val, _err, element=_element, path=self.path) ! if (_box is not None) and (_prop.name in Box.__slots__): ! _box.set(_prop.name, _val) ! else: ! _element.set(_prop.name, _val) if recursive: for _child in self: |
From: alexander s. <a1...@us...> - 2006-12-06 17:12:51
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12937 Modified Files: wxPrint.py Log Message: sweep pylint warnings; remove WrapLines - all texts must be wrapped by builder Index: wxPrint.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/wxPrint.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wxPrint.py 7 Nov 2006 13:32:02 -0000 1.2 --- wxPrint.py 6 Dec 2006 17:12:47 -0000 1.3 *************** *** 7,10 **** --- 7,12 ---- """ """History (most recent first): + 05-dec-2006 [als] sweep pylint warnings; + remove WrapLines - all texts must be wrapped by builder 07-Nov-2006 [phd] Added shebang. 20-oct-2006 [als] Barcode X dimension attr renamed to "module" *************** *** 31,34 **** --- 33,41 ---- class Printout(wx.Printout): + """wxWidgets printout document""" + + # pylint: disable-msg=R0904 + # R0904: Too many public methods - most come from the base class + def __init__(self, report, title=None): """Initialize printout *************** *** 40,47 **** --- 47,58 ---- """ if isinstance(report, basestring): + # pylint: disable-msg=C0103 + # C0103: Invalid names "report", "title" if title is None: title = report report = prp.load(report) elif title is None: + # pylint: disable-msg=C0103 + # C0103: Invalid name "title" title = "Report Printout" super(Printout, self).__init__(title=title) *************** *** 50,58 **** # element handlers self.handlers = { ! "line": self.DrawLine, ! "rectangle": self.DrawRectangle, ! "image": self.DrawImage, ! "text": self.DrawText, ! "barcode": self.DrawBarcode, } _fonts = {} --- 61,69 ---- # element handlers self.handlers = { ! "line": self.drawLine, ! "rectangle": self.drawRectangle, ! "image": self.drawImage, ! "text": self.drawText, ! "barcode": self.drawBarcode, } _fonts = {} *************** *** 83,93 **** def GetPageInfo(self): _numpages = len(self.pages) return (1, _numpages, 1, _numpages) def HasPage(self, pageno): return (1 <= pageno <= len(self.pages)) ! def GetColor(self, color): """Return wx.Color object for color value of an element attribute""" if color: --- 94,107 ---- def GetPageInfo(self): + """Return available page ranges""" _numpages = len(self.pages) return (1, _numpages, 1, _numpages) def HasPage(self, pageno): + """Return True for existing page number""" return (1 <= pageno <= len(self.pages)) ! @staticmethod ! def getColor(color): """Return wx.Color object for color value of an element attribute""" if color: *************** *** 96,104 **** return wx.NullColour ! def SetPen(self, type, color): """Change the pen of the DC Parameters: ! type: value returned by PenType.fromValue() (PenType or Dimension instance) color: pen color (Color instance) --- 110,118 ---- return wx.NullColour ! def setPen(self, pen_type, color): """Change the pen of the DC Parameters: ! pen_type: value returned by PenType.fromValue() (PenType or Dimension instance) color: pen color (Color instance) *************** *** 106,120 **** """ _width = 1 ! if type == "dot": _style = wx.DOT ! elif type == "dash": _style = wx.SHORT_DASH ! elif type == "dashdot": _style = wx.DOT_DASH else: _style = wx.SOLID ! _width = int(type) if _width: ! _pen = wx.Pen(self.GetColor(color), _width, _style) else: _pen = wx.TRANSPARENT_PEN --- 120,134 ---- """ _width = 1 ! if pen_type == "dot": _style = wx.DOT ! elif pen_type == "dash": _style = wx.SHORT_DASH ! elif pen_type == "dashdot": _style = wx.DOT_DASH else: _style = wx.SOLID ! _width = int(pen_type) if _width: ! _pen = wx.Pen(self.getColor(color), _width, _style) else: _pen = wx.TRANSPARENT_PEN *************** *** 134,141 **** _brush = wx.Brush(wx.NullColour, wx.TRANSPARENT) else: ! _brush = wx.Brush(self.GetColor(color)) return _brush def OnPrintPage(self, pageno): try: _page = self.pages[pageno - 1] --- 148,156 ---- _brush = wx.Brush(wx.NullColour, wx.TRANSPARENT) else: ! _brush = wx.Brush(self.getColor(color)) return _brush def OnPrintPage(self, pageno): + """Draw selected page to the output device context""" try: _page = self.pages[pageno - 1] *************** *** 158,163 **** return True ! def DrawLine(self, line): ! self.SetPen(line.get("pen"), line.get("color")) _box = Box.from_element(line.find("box")) _dc = self.GetDC() --- 173,179 ---- return True ! def drawLine(self, line): ! """Draw a line""" ! self.setPen(line.get("pen"), line.get("color")) _box = Box.from_element(line.find("box")) _dc = self.GetDC() *************** *** 167,176 **** _dc.DrawLine(_box.left, _box.top, _box.right, _box.bottom) ! def DrawRectangle(self, rect): _box = Box.from_element(rect.find("box")) _radius = rect.get("radius") _dc = self.GetDC() _dc.SetBrush(self.GetBrush(rect.get("color"))) ! self.SetPen(rect.get("pen"), rect.get("pencolor")) if _radius: _dc.DrawRoundedRectangle(_box.x, _box.y, _box.width, _box.height, --- 183,193 ---- _dc.DrawLine(_box.left, _box.top, _box.right, _box.bottom) ! def drawRectangle(self, rect): ! """Draw a rectangle""" _box = Box.from_element(rect.find("box")) _radius = rect.get("radius") _dc = self.GetDC() _dc.SetBrush(self.GetBrush(rect.get("color"))) ! self.setPen(rect.get("pen"), rect.get("pencolor")) if _radius: _dc.DrawRoundedRectangle(_box.x, _box.y, _box.width, _box.height, *************** *** 179,183 **** _dc.DrawRectangle(_box.x, _box.y, _box.width, _box.height) ! def DrawImage(self, image): _file = image.get("file") if _file: --- 196,201 ---- _dc.DrawRectangle(_box.x, _box.y, _box.width, _box.height) ! def drawImage(self, image): ! """Draw an image""" _file = image.get("file") if _file: *************** *** 202,234 **** self.GetDC().DrawBitmap(wx.BitmapFromImage(_img), _box.x, _box.y) ! _word_re = re.compile("\s*\S+\s*") ! def WrapLines(self, text, width): ! # allow the text to be 1 point wider (round error?) ! width += 1 ! # if the text is not wider than required, return early ! _dc = self.GetDC() ! (_w, _h) = _dc.GetTextExtent(text) ! if _w <= width: ! return text ! # split text to words. inter-word spaces go to previous word. ! _lines = [] ! _words = self._word_re.findall(text) ! while _words: ! # scan backwards while the line is too wide ! _ii = len(_words) ! while _ii > 1: ! _line = "".join(_words[:_ii]).rstrip() ! (_w, _h) = _dc.GetTextExtent(_line) ! if _w <= width: ! break ! _ii -= 1 ! else: ! _line = _words[0].rstrip() ! # move found line from _words to _lines ! _lines.append(_line) ! _words = _words[_ii:] ! return "\n".join(_lines) ! ! def DrawText(self, text): _content = text.find("data").text if not _content: --- 220,225 ---- self.GetDC().DrawBitmap(wx.BitmapFromImage(_img), _box.x, _box.y) ! def drawText(self, text): ! """Draw a text block""" _content = text.find("data").text if not _content: *************** *** 236,240 **** _dc = self.GetDC() _dc.SetFont(self.fonts[text.get("font")]) ! _dc.SetTextForeground(self.GetColor(text.get("color"))) _align = text.get("align") if _align == "left": --- 227,231 ---- _dc = self.GetDC() _dc.SetFont(self.fonts[text.get("font")]) ! _dc.SetTextForeground(self.getColor(text.get("color"))) _align = text.get("align") if _align == "left": *************** *** 253,257 **** # _dc.DrawLine(_x, _re.y, _x, _re.y + _re.width - 1) ! def DrawBarcode(self, barcode): _stripes = [int(_stripe) for _stripe in barcode.get("stripes").split(",")] --- 244,249 ---- # _dc.DrawLine(_x, _re.y, _x, _re.y + _re.width - 1) ! def drawBarcode(self, barcode): ! """Draw Bar Code symbol""" _stripes = [int(_stripe) for _stripe in barcode.get("stripes").split(",")] *************** *** 287,290 **** --- 279,287 ---- class Preview(wx.PrintPreview): + """Print Preview manager""" + + # pylint: disable-msg=R0904 + # R0904: Too many public methods - same as in the base class + def __init__(self, report, title=None, print_data=None): """Initialize print preview *************** *** 302,321 **** class PrintApp(wx.App): ! def __init__(self, prp, *args, **kwargs): """Intialize the application Parameters: ! prp: name of the printout file remaining arguments are passed to the base class. """ ! self.prp = prp super(PrintApp, self).__init__(*args, **kwargs) def OnInit(self): _preview = Preview(self.prp) if not _preview.Ok(): raise RuntimeError, "Cannot initialize preview" ! return False _frame = wx.PreviewFrame(_preview, None, self.prp, size=(800, 600)) _frame.Initialize() --- 299,325 ---- class PrintApp(wx.App): ! """Simple application for preview and printing of a printout""" ! ! # pylint: disable-msg=R0901,R0904 ! # R0901: Too many ancestors - sorry, cannot help it ! # R0904: Too many public methods - same as in the base class ! ! def __init__(self, printout, *args, **kwargs): """Intialize the application Parameters: ! printout: name of the printout file remaining arguments are passed to the base class. """ ! self.prp = printout super(PrintApp, self).__init__(*args, **kwargs) def OnInit(self): + """Start the application: create main frame and open report preview""" _preview = Preview(self.prp) if not _preview.Ok(): raise RuntimeError, "Cannot initialize preview" ! # if raise is changed to MessageBox, return False here _frame = wx.PreviewFrame(_preview, None, self.prp, size=(800, 600)) _frame.Initialize() *************** *** 324,327 **** --- 328,332 ---- def run(argv=sys.argv): + """Command line executable""" if len(argv) != 2: print "Usage: %s <printout>" % argv[0] |
From: alexander s. <a1...@us...> - 2006-12-06 17:05:53
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10297 Modified Files: wxDrivers.py Log Message: sweep pylint warnings Index: wxDrivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/wxDrivers.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wxDrivers.py 1 Nov 2006 17:44:32 -0000 1.1 --- wxDrivers.py 6 Dec 2006 17:05:46 -0000 1.2 *************** *** 1,8 **** """Rendering utilities for wxPython backend""" - """History (most recent first): 01-nov-2006 [als] created """ - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 1,7 ---- """Rendering utilities for wxPython backend""" """History (most recent first): + 05-dec-2006 [als] sweep pylint warnings 01-nov-2006 [als] created """ __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] *************** *** 53,70 **** @classmethod ! def _get_type_flag(cls, type): """Return wxImage construction flag for given image type""" try: ! return cls.TYPE_FLAGS[type] except KeyError: ! raise ValueError("Unsupported image type: %r" % type) @classmethod ! def fromfile(cls, filepath, type): """Create an image source from existing file Parameters: filepath: full path to the image file ! type: image type, e.g. "jpeg" or "png" Return value: new image wrapper object. --- 52,69 ---- @classmethod ! def _get_type_flag(cls, img_type): """Return wxImage construction flag for given image type""" try: ! return cls.TYPE_FLAGS[img_type] except KeyError: ! raise ValueError("Unsupported image type: %r" % img_type) @classmethod ! def fromfile(cls, filepath, img_type): """Create an image source from existing file Parameters: filepath: full path to the image file ! img_type: image type, e.g. "jpeg" or "png" Return value: new image wrapper object. *************** *** 73,87 **** _rv = cls() _rv.filepath = filepath ! _rv.type = type ! _rv._image = wx.Image(filepath, cls._get_type_flag(type)) return _rv @classmethod ! def fromdata(cls, data, type, name=None): """Create an image source from data block Parameters: data: image data ! type: image type, e.g. "jpeg" or "png" name: optional name of a report block containing data --- 72,86 ---- _rv = cls() _rv.filepath = filepath ! _rv.img_type = img_type ! _rv._image = wx.Image(filepath, cls._get_type_flag(img_type)) return _rv @classmethod ! def fromdata(cls, data, img_type, name=None): """Create an image source from data block Parameters: data: image data ! img_type: image type, e.g. "jpeg" or "png" name: optional name of a report block containing data *************** *** 91,99 **** _rv = cls() _rv.name = name ! _rv.type = type #_rv._image = wx.ImageFromStream(wx.InputStream(StringIO(data)), ! # cls._get_type_flag(type)) _rv._image = wx.ImageFromStream(StringIO(data), ! cls._get_type_flag(type)) return _rv --- 90,98 ---- _rv = cls() _rv.name = name ! _rv.img_type = img_type #_rv._image = wx.ImageFromStream(wx.InputStream(StringIO(data)), ! # cls._get_type_flag(img_type)) _rv._image = wx.ImageFromStream(StringIO(data), ! cls._get_type_flag(img_type)) return _rv *************** *** 106,115 **** return (self._image.GetWidth(), self._image.GetHeight()) ! def _get_image_data(self, image, type=None): """Return image data as string Parameters: image: wx.Image object ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 105,114 ---- return (self._image.GetWidth(), self._image.GetHeight()) ! def _get_image_data(self, image, img_type=None): """Return image data as string Parameters: image: wx.Image object ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 117,125 **** """ ! if not type: ! type = self.preferred_type # XXX shoud use a MemoryFileSystem to avoid creating a temporary file. _filename = os.tempnam(None, "primg") ! image.SaveFile(_filename, self._get_type_flag(type)) _file = open(_filename, "rb") _rv = _file.read() --- 116,126 ---- """ ! if not img_type: ! # pylint: disable-msg=C0103 ! # C0103: Invalid name "img_type" ! img_type = self.preferred_type # XXX shoud use a MemoryFileSystem to avoid creating a temporary file. _filename = os.tempnam(None, "primg") ! image.SaveFile(_filename, self._get_type_flag(img_type)) _file = open(_filename, "rb") _rv = _file.read() *************** *** 128,136 **** return _rv ! def getdata(self, type=None): """Return image data as string Parameters: ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 129,137 ---- return _rv ! def getdata(self, img_type=None): """Return image data as string Parameters: ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 138,144 **** """ ! return self._get_image_data(self._image, type) ! def scale(self, width, height, type=None): """Return a scaled image --- 139,145 ---- """ ! return self._get_image_data(self._image, img_type) ! def scale(self, width, height, img_type=None): """Return a scaled image *************** *** 146,150 **** width: target image width height: target image height ! type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). --- 147,151 ---- width: target image width height: target image height ! img_type: optional image type, e.g. "jpeg" or "gif". Default: preferred output type (jpeg or png). *************** *** 152,158 **** """ ! return self._get_image_data(self._image.Scale(width, height), type) ! def _cut(self, width, height, type): """Return an image cut to dimensions --- 153,159 ---- """ ! return self._get_image_data(self._image.Scale(width, height), img_type) ! def _cut(self, width, height, img_type): """Return an image cut to dimensions *************** *** 160,164 **** width: target image width height: target image height ! type: image type, e.g. "jpeg" or "gif" Return value: image data as string. --- 161,165 ---- width: target image width height: target image height ! img_type: image type, e.g. "jpeg" or "gif" Return value: image data as string. *************** *** 171,175 **** """ _img = self._image.Size((width, height), (0, 0)) ! return self._get_image_data(_img, type) class TextDriver(drivers.TextDriver): --- 172,176 ---- """ _img = self._image.Size((width, height), (0, 0)) ! return self._get_image_data(_img, img_type) class TextDriver(drivers.TextDriver): |
From: alexander s. <a1...@us...> - 2006-12-06 17:04:08
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9671 Modified Files: version.py Log Message: typo in comment Index: version.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/version.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** version.py 9 Nov 2006 08:47:10 -0000 1.3 --- version.py 6 Dec 2006 17:04:06 -0000 1.4 *************** *** 1,9 **** """PythonReports package version declaration""" - """History: 03-nov-2006 [als] created """ ! # Note: __date__ is a string because all modules have __date_ as a string. # wouldn't datetime.date object be better? --- 1,8 ---- """PythonReports package version declaration""" """History: 03-nov-2006 [als] created """ ! # Note: __date__ is a string because all modules have __date__ as a string. # wouldn't datetime.date object be better? |
From: alexander s. <a1...@us...> - 2006-12-06 17:03:34
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9566 Modified Files: TkDrivers.py Log Message: sweep pylint warnings Index: TkDrivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/TkDrivers.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TkDrivers.py 4 Nov 2006 14:18:45 -0000 1.1 --- TkDrivers.py 6 Dec 2006 17:03:25 -0000 1.2 *************** *** 6,12 **** """ """History (most recent first): 04-nov-2006 [als] created """ - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 6,12 ---- """ """History (most recent first): + 05-dec-2006 [als] sweep pylint warnings 04-nov-2006 [als] created """ __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] *************** *** 37,40 **** --- 37,43 ---- """ + # pylint: disable-msg=W0212 + # W0212: Access to a protected member _root of a client class - + # any ideas how to get fpixels another way? super(TextDriver, self).__init__(font) self._font = self._get_font(font) |
From: alexander s. <a1...@us...> - 2006-12-06 17:02:29
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9200 Modified Files: Tk.py Log Message: fix errors and some warnings reported by pylint Index: Tk.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/Tk.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Tk.py 7 Nov 2006 13:32:02 -0000 1.2 --- Tk.py 6 Dec 2006 17:02:22 -0000 1.3 *************** *** 1,6 **** #! /usr/bin/env python """Tk output for PythonReports""" - """History (most recent first): 07-Nov-2006 [phd] Added shebang. 20-oct-2006 [als] Barcode X dimension attr renamed to "module" --- 1,6 ---- #! /usr/bin/env python """Tk output for PythonReports""" """History (most recent first): + 05-dec-2006 [als] fix errors and some warnings reported by pylint 07-Nov-2006 [phd] Added shebang. 20-oct-2006 [als] Barcode X dimension attr renamed to "module" *************** *** 39,53 **** """ - if isinstance(report, basestring): - report = prp.load(report) super(Painter, self).__init__() ! self.report = report ! self.pages = report.findall("page") # element handlers self.handlers = { ! "line": self.DrawLine, ! "rectangle": self.DrawRectangle, ! "text": self.DrawText, ! "barcode": self.DrawBarcode, } try: --- 39,54 ---- """ super(Painter, self).__init__() ! if isinstance(report, basestring): ! self.report = prp.load(report) ! else: ! self.report = report ! self.pages = self.report.findall("page") # element handlers self.handlers = { ! "line": self.drawLine, ! "rectangle": self.drawRectangle, ! "text": self.drawText, ! "barcode": self.drawBarcode, } try: *************** *** 58,65 **** else: # can process images ! self.handlers["image"] = self.DrawImage self.named_images = {} _fonts = {} ! for (_name, _font) in report.fonts.iteritems(): _modifiers = [] if _font.get("bold"): --- 59,66 ---- else: # can process images ! self.handlers["image"] = self.drawImage self.named_images = {} _fonts = {} ! for (_name, _font) in self.report.fonts.iteritems(): _modifiers = [] if _font.get("bold"): *************** *** 108,115 **** if scale < .1: # zoom to less than 10% is disallowed ! scale = .1 ! self.scale = scale self.scaled_fonts = dict([ ! (_name, (_face, max(1, int(round(_size * scale))), _options)) for (_name, (_face, _size, _options)) in self.fonts.iteritems()]) # draw elements --- 109,117 ---- if scale < .1: # zoom to less than 10% is disallowed ! self.scale = .1 ! else: ! self.scale = scale self.scaled_fonts = dict([ ! (_name, (_face, max(1, int(round(_size * self.scale))), _options)) for (_name, (_face, _size, _options)) in self.fonts.iteritems()]) # draw elements *************** *** 163,167 **** for _dim in (_box.left, _box.top, _box.right, _box.bottom)) ! def DrawLine(self, canvas, line): (_x0, _y0, _x1, _y1) = self.getDimensions(line) if not line.get("backslant"): --- 165,170 ---- for _dim in (_box.left, _box.top, _box.right, _box.bottom)) ! def drawLine(self, canvas, line): ! """Draw a line""" (_x0, _y0, _x1, _y1) = self.getDimensions(line) if not line.get("backslant"): *************** *** 170,174 **** **self._lineattrs(line.get("pen"))) ! def DrawRectangle(self, canvas, rect): _options = {"outline": str(rect.get("pencolor"))} _options.update(self._lineattrs(rect.get("pen"))) --- 173,178 ---- **self._lineattrs(line.get("pen"))) ! def drawRectangle(self, canvas, rect): ! """Draw a rectangle""" _options = {"outline": str(rect.get("pencolor"))} _options.update(self._lineattrs(rect.get("pen"))) *************** *** 178,185 **** canvas.create_rectangle(*self.getDimensions(rect), **_options) ! def _get_named_image(self, name, type): """Return an image loaded from a named data element""" try: ! return self.named_images[(name, type)] except KeyError: pass --- 182,194 ---- canvas.create_rectangle(*self.getDimensions(rect), **_options) ! def _get_named_image(self, name, img_type): """Return an image loaded from a named data element""" + # pylint: disable-msg=W0631,W0704 + # W0631: Using possibly undefined loop variable '_element' - + # if the loop didn't run, raise error before the variable is used + # W0704: Except doesn't do anything - if the image was + # not loaded yet, it will be handled after try/except block. try: ! return self.named_images[(name, img_type)] except KeyError: pass *************** *** 189,197 **** else: raise KeyError("data element with name=%r cannot be found" % name) ! _img = self.image_driver.fromdata(Data.get_data(_element), type) ! self.named_images[(name, type)] = _img return _img ! def DrawImage(self, canvas, image): _type = image.get("type") _img = image.get("file") --- 198,207 ---- else: raise KeyError("data element with name=%r cannot be found" % name) ! _img = self.image_driver.fromdata(Data.get_data(_element), img_type) ! self.named_images[(name, img_type)] = _img return _img ! def drawImage(self, canvas, image): ! """Draw an image""" _type = image.get("type") _img = image.get("file") *************** *** 211,215 **** dimension(_box.get("height") * self.scale)) # data for PhotoImage must be base64-encoded gif ! _data = _img.resize(_width, _height, image.get("scale"), type="gif") _img = PhotoImage(data=base64.b64encode(_data)) canvas.printout_images.append(_img) --- 221,226 ---- dimension(_box.get("height") * self.scale)) # data for PhotoImage must be base64-encoded gif ! _data = _img.resize(_width, _height, image.get("scale"), ! img_type="gif") _img = PhotoImage(data=base64.b64encode(_data)) canvas.printout_images.append(_img) *************** *** 217,221 **** *self.getDimensions(image)[:2]) ! def DrawText(self, canvas, text): _content = text.find("data").text if not _content: --- 228,233 ---- *self.getDimensions(image)[:2]) ! def drawText(self, canvas, text): ! """Draw a text block""" _content = text.find("data").text if not _content: *************** *** 227,230 **** --- 239,245 ---- } if "\n" in _content: + # pylint: disable-msg=W0704 + # W0704: Except doesn't do anything - if justify code is unknown, + # we just ignore it (resulting in left-justified text). # can use Tk text justify try: *************** *** 252,256 **** canvas.create_text(dimension(_x), dimension(_box.top), **_options) ! def DrawBarcode(self, canvas, barcode): _xdim = barcode.get("module") / 1000. * 72. _stripes = [int(_stripe) * _xdim * self.scale --- 267,272 ---- canvas.create_text(dimension(_x), dimension(_box.top), **_options) ! def drawBarcode(self, canvas, barcode): ! """Draw Bar Code symbol""" _xdim = barcode.get("module") / 1000. * 72. _stripes = [int(_stripe) * _xdim * self.scale *************** *** 282,285 **** --- 298,303 ---- """Printout display widget""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - from base class PAGE_PADDING = 10 # padding around the page on the preview canvas *************** *** 299,304 **** Frame.__init__(self, master, class_="PythonReportsWidget", **options) if isinstance(report, basestring): ! report = prp.load(report) ! self.painter = Painter(report) self.pageno = 1 self.pagevar = StringVar() --- 317,324 ---- Frame.__init__(self, master, class_="PythonReportsWidget", **options) if isinstance(report, basestring): ! self.report = prp.load(report) ! else: ! self.report = report ! self.painter = Painter(self.report) self.pageno = 1 self.pagevar = StringVar() *************** *** 386,397 **** # make sure pageno is in range _pagecount = self.painter.pagecount() ! if pageno < 0: ! pageno += _pagecount ! if pageno > _pagecount: ! pageno = _pagecount ! elif pageno < 1: ! pageno = 1 # enable/disable navigation buttons ! if pageno == 1: self.button_first["state"] = DISABLED self.button_prev["state"] = DISABLED --- 406,418 ---- # make sure pageno is in range _pagecount = self.painter.pagecount() ! _pageno = pageno # don't update argument to make pylint happy ! if _pageno < 0: ! _pageno += _pagecount ! if _pageno > _pagecount: ! _pageno = _pagecount ! elif _pageno < 1: ! _pageno = 1 # enable/disable navigation buttons ! if _pageno == 1: self.button_first["state"] = DISABLED self.button_prev["state"] = DISABLED *************** *** 400,404 **** self.button_first["state"] = NORMAL self.button_prev["state"] = NORMAL ! if pageno == _pagecount: self.button_next["state"] = DISABLED self.button_last["state"] = DISABLED --- 421,425 ---- self.button_first["state"] = NORMAL self.button_prev["state"] = NORMAL ! if _pageno == _pagecount: self.button_next["state"] = DISABLED self.button_last["state"] = DISABLED *************** *** 410,414 **** _canvas.delete("ALL") # update canvas dimensions ! (_width, _height) = self.painter.pagesize(pageno - 1) _width *= self.scale _height *= self.scale --- 431,435 ---- _canvas.delete("ALL") # update canvas dimensions ! (_width, _height) = self.painter.pagesize(_pageno - 1) _width *= self.scale _height *= self.scale *************** *** 419,441 **** _canvas.create_rectangle(0, 0, dimension(_width), dimension(_height), fill="white", width="1p") ! self.painter.paint(_canvas, pageno - 1, self.scale) _canvas.addtag_all("ALL") # update state ! self.pageno = pageno ! self.pagevar.set(str(pageno)) def OnButtonFirst(self): self.ShowPage(1) def OnButtonPrev(self): self.ShowPage(self.pageno - 1) def OnButtonNext(self): self.ShowPage(self.pageno + 1) def OnButtonLast(self): self.ShowPage(self.painter.pagecount()) def OnPageNumber(self, event): _value = self.pagevar.get() event.widget.select_range(0, len(_value)) --- 440,467 ---- _canvas.create_rectangle(0, 0, dimension(_width), dimension(_height), fill="white", width="1p") ! self.painter.paint(_canvas, _pageno - 1, self.scale) _canvas.addtag_all("ALL") # update state ! self.pageno = _pageno ! self.pagevar.set(str(_pageno)) def OnButtonFirst(self): + """Go to the first page""" self.ShowPage(1) def OnButtonPrev(self): + """Go to previous page""" self.ShowPage(self.pageno - 1) def OnButtonNext(self): + """Go to next page""" self.ShowPage(self.pageno + 1) def OnButtonLast(self): + """Go to the last page""" self.ShowPage(self.painter.pagecount()) def OnPageNumber(self, event): + """Go to the specified page number""" _value = self.pagevar.get() event.widget.select_range(0, len(_value)) *************** *** 443,453 **** --- 469,482 ---- def OnBeginDrag(self, event): + """Start dragging the image""" self.canvas["cursor"] = "fleur" self.canvas.scan_mark(event.x, event.y) def OnDrag(self, event): + """Drag the preview image""" self.canvas.scan_dragto(event.x, event.y) def OnEndDrag(self, event): + """End preview dragging""" self.canvas["cursor"] = "" *************** *** 458,466 **** """ _val = self.zoomvar.get().replace("%", "") try: return int(_val) except: ! return self.zoom def OnZoomSpin(self, direction): --- 487,498 ---- """ + # pylint: disable-msg=W0702 + # W0702: No exception's type specified + # i wonder what type of exception can occur here? _val = self.zoomvar.get().replace("%", "") try: return int(_val) except: ! return int(self.scale * 100) def OnZoomSpin(self, direction): *************** *** 474,477 **** --- 506,510 ---- def OnZoomEntry(self, event): + """Zoom to entered value""" self.Zoom(self._get_zoom_value()) *************** *** 484,487 **** --- 517,522 ---- """ if percentage < 10: + # pylint: disable-msg=C0103 + # C0103: Invalid name "percentage" percentage = 10 self.scale = percentage / 100. *************** *** 492,495 **** --- 527,532 ---- """Toplevel window displaying a printout""" + # pylint: disable-msg=R0904 + # R0904: Too many public methods - from base class def __init__(self, report, title=None, **options): *************** *** 503,510 **** --- 540,551 ---- """ if isinstance(report, basestring): + # pylint: disable-msg=C0103 + # C0103: Invalid names "report", "title" if title is None: title = report report = prp.load(report) elif title is None: + # pylint: disable-msg=C0103 + # C0103: Invalid name "title" title = "Report Printout" Toplevel.__init__(self, class_="PythonReportsWindow", **options) *************** *** 514,517 **** --- 555,559 ---- def run(argv=sys.argv): + """Command line executable""" if len(argv) != 2: print "Usage: %s <printout>" % argv[0] |
From: alexander s. <a1...@us...> - 2006-12-06 16:57:23
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7253 Modified Files: template.py Log Message: style: imports come after version, date and exports; sweep pylint warnings Index: template.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/template.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** template.py 1 Nov 2006 11:04:20 -0000 1.1 --- template.py 6 Dec 2006 16:57:21 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- """PythonReports Template (PRT) structures""" """History: + 05-dec-2006 [als] style: imports come after version, date and exports; + sweep pylint warnings 20-oct-2006 [als] Barcode X dimension attr renamed to "module" 22-sep-2006 [als] BarCode: X dimension is a number of mills *************** *** 17,23 **** 04-jul-2006 [als] created """ - - from PythonReports.datatypes import * - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 19,22 ---- *************** *** 31,34 **** --- 30,35 ---- ] + from PythonReports.datatypes import * + Parameter = Validator(tag="parameter", validate=Validator.Unique("parameters"), *************** *** 261,264 **** --- 262,267 ---- """ + # pylint: disable-msg=W0613 + # W0613: Unused argument 'tree' _group = element.find("group") _detail = element.find("detail") *************** *** 320,323 **** --- 323,329 ---- def Report(tree, element, path): """Prevalidator for "report" element: initialize template structures""" + # pylint: disable-msg=W0613 + # W0613: Unused arguments 'element', 'path' + # these collections may also be initialized by Unique constraints, # but we want them to be present always, even if there are no |
From: alexander s. <a1...@us...> - 2006-12-06 16:55:20
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6542 Modified Files: RLDrivers.py Log Message: fix style: remove empty line between history and __version__ Index: RLDrivers.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/RLDrivers.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RLDrivers.py 1 Nov 2006 17:39:00 -0000 1.2 --- RLDrivers.py 6 Dec 2006 16:55:16 -0000 1.3 *************** *** 9,13 **** 05-oct-2006 [als] created """ - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 9,12 ---- |
From: alexander s. <a1...@us...> - 2006-12-06 16:54:48
|
Update of /cvsroot/pythonreports/PythonReports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6171 Modified Files: printout.py Log Message: style: imports come after version, date and exports Index: printout.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/PythonReports/printout.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** printout.py 1 Nov 2006 11:04:43 -0000 1.1 --- printout.py 6 Dec 2006 16:54:39 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- """PythonReports Printout (PRP) structures""" """History: + 05-dec-2006 [als] style: imports come after version, date and exports 20-oct-2006 [als] Barcode X dimension attr renamed to "module" 26-sep-2006 [als] removed Text.bgcolor *************** *** 11,17 **** 10-jul-2006 [als] created """ - - from PythonReports.datatypes import * - __version__ = "$Revision$"[11:-2] __date__ = "$Date$"[7:-2] --- 12,15 ---- *************** *** 22,25 **** --- 20,25 ---- ] + from PythonReports.datatypes import * + Box = Validator(tag="box", attributes={ |