jtoolkit-cvs Mailing List for jToolkit (Page 2)
Brought to you by:
davidfraser,
friedelwolff
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(15) |
Oct
(12) |
Nov
|
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
(100) |
Mar
(27) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dav...@us...> - 2004-03-08 17:08:29
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25297 Modified Files: PyADO.py Log Message: tried to fix problem with NumericScale attribute... Index: PyADO.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/PyADO.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PyADO.py 10 Feb 2004 08:59:24 -0000 1.9 --- PyADO.py 8 Mar 2004 16:44:04 -0000 1.10 *************** *** 276,280 **** display_size = internal_size precision = field.Precision ! scale = field.NumericScale null_ok = field.Attributes & adFldMayBeNull # add this column to the description list --- 276,284 ---- display_size = internal_size precision = field.Precision ! try: ! scale = field.NumericScale ! except: ! # guess if error... ! scale = 0 null_ok = field.Attributes & adFldMayBeNull # add this column to the description list |
From: <dav...@us...> - 2004-03-08 17:05:50
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24617 Modified Files: chart.py Log Message: improved error handling slightly (and added a TODO to do so more) - using jToolkit.errors made failure to import matplotlib get handled more gracefully (and added a TODO...) Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** chart.py 10 Feb 2004 09:23:17 -0000 1.23 --- chart.py 8 Mar 2004 16:41:21 -0000 1.24 *************** *** 3,12 **** # per object. - from matplotlib.matlab import * import cStringIO, tempfile, os, math from jToolkit.widgets import widgets from jToolkit.data import dates import random, os ! import traceback #We need this lock for gdchart, as it's not thread-safe --- 3,20 ---- # per object. import cStringIO, tempfile, os, math from jToolkit.widgets import widgets from jToolkit.data import dates + from jToolkit import errors import random, os ! ! # TODO: improve error handling here... ! try: ! # TODO: change to from matplotlib import matlab... ! from matplotlib.matlab import * ! except: ! # not importing these functions will cause charts to fail... ! print "error importing matplotlib. jToolkit.widgets.chart functions will fail later." ! print errors.ConsoleErrorHandler().traceback_str() #We need this lock for gdchart, as it's not thread-safe *************** *** 78,84 **** self.drawimage() except: ! (etype, evalue, trace) = sys.exc_info() ! print "Unexpected Error:",etype,evalue ! traceback.print_tb(trace) # gdchartLock.release() return None --- 86,91 ---- self.drawimage() except: ! print "Unexpected Error:" ! print errors.ConsoleErrorHandler().traceback_str() # gdchartLock.release() return None *************** *** 224,226 **** self.im_height = 8 #This should take tagname length into account ! \ No newline at end of file --- 231,233 ---- self.im_height = 8 #This should take tagname length into account ! |
From: <dav...@us...> - 2004-02-16 09:52:57
|
Update of /cvsroot/jtoolkit/jToolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27978 Added Files: __version__.py Log Message: added version file for jToolkit --- NEW FILE: __version__.py --- #!/usr/bin/python2.2 """this file contains the version of jToolkit""" ver = "0.2" |
From: <dav...@us...> - 2004-02-10 09:26:30
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29055 Modified Files: chart.py Log Message: Updated a few exception handling parts Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** chart.py 10 Feb 2004 09:22:51 -0000 1.22 --- chart.py 10 Feb 2004 09:23:17 -0000 1.23 *************** *** 8,11 **** --- 8,12 ---- from jToolkit.data import dates import random, os + import traceback #We need this lock for gdchart, as it's not thread-safe *************** *** 69,73 **** except: (etype, evalue, trace) = sys.exc_info() ! print "Temp file error:",etype,evalue return img --- 70,74 ---- except: (etype, evalue, trace) = sys.exc_info() ! # print "Temp file error:",etype,evalue return img *************** *** 76,86 **** try: self.drawimage() - img = self.getimagefromtempfile() except: (etype, evalue, trace) = sys.exc_info() print "Unexpected Error:",etype,evalue # gdchartLock.release() return None # gdchartLock.release() return img --- 77,88 ---- try: self.drawimage() except: (etype, evalue, trace) = sys.exc_info() print "Unexpected Error:",etype,evalue + traceback.print_tb(trace) # gdchartLock.release() return None # gdchartLock.release() + img = self.getimagefromtempfile() return img *************** *** 142,146 **** if xDataLen % testnum == 0: numLabels = testnum+1 ! #Otherwise go for max if not numLabels: numLabels = 10 --- 144,148 ---- if xDataLen % testnum == 0: numLabels = testnum+1 ! #Otherwise go for max if not numLabels: numLabels = 10 *************** *** 165,169 **** #Draw a legend self.figure.get_current_axis().legend(self.legendlabels,2) - class CurrentValueLegendChart(Chart): --- 167,170 ---- |
From: <dav...@us...> - 2004-02-10 09:26:05
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28915 Modified Files: chart.py Log Message: Removed old lock. Added exception handling with error output. Improved the method of retrieving an image Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** chart.py 10 Feb 2004 09:22:20 -0000 1.21 --- chart.py 10 Feb 2004 09:22:51 -0000 1.22 *************** *** 7,15 **** from jToolkit.widgets import widgets from jToolkit.data import dates ! #We need this lock for gdchart, as it's not thread-safe ! from threading import Lock ! gdchartLock = Lock() #Graph type constants --- 7,15 ---- from jToolkit.widgets import widgets from jToolkit.data import dates ! import random, os #We need this lock for gdchart, as it's not thread-safe ! #from threading import Lock ! #gdchartLock = Lock() #Graph type constants *************** *** 55,77 **** #Save temporary file # tempfilename = os.path.join(tempfile.gettempdir(),'temp.png') ! tempfilename = 'temp.png' ! self.figure.figure.print_figure(tempfilename,self.dpi) ! #Read and report ! f = open(tempfilename,'rb') ! img = f.read() ! f.close() return img def gethtml(self): ! gdchartLock.acquire() try: self.drawimage() img = self.getimagefromtempfile() except: ! print "Unexpected Error:",sys.exc_info()[2] ! gdchartLock.release() return None ! gdchartLock.release() return img --- 55,86 ---- #Save temporary file # tempfilename = os.path.join(tempfile.gettempdir(),'temp.png') ! retrieved = 0 ! while not retrieved: ! try: ! tempfilename = str(random.randint(100000,999999)) + '.png' ! self.figure.figure.print_figure(tempfilename,self.dpi) ! #Read and report ! f = open(tempfilename,'rb') ! img = f.read() ! f.close() ! retrieved = 1 ! os.remove(tempfilename) ! except: ! (etype, evalue, trace) = sys.exc_info() ! print "Temp file error:",etype,evalue return img def gethtml(self): ! # gdchartLock.acquire() try: self.drawimage() img = self.getimagefromtempfile() except: ! (etype, evalue, trace) = sys.exc_info() ! print "Unexpected Error:",etype,evalue ! # gdchartLock.release() return None ! # gdchartLock.release() return img |
From: <dav...@us...> - 2004-02-10 09:25:38
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28797 Modified Files: chart.py Log Message: Added exception catch to make sure the chart picture lock is released Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** chart.py 10 Feb 2004 09:18:01 -0000 1.20 --- chart.py 10 Feb 2004 09:22:20 -0000 1.21 *************** *** 66,71 **** def gethtml(self): gdchartLock.acquire() ! self.drawimage() ! img = self.getimagefromtempfile() gdchartLock.release() return img --- 66,76 ---- def gethtml(self): gdchartLock.acquire() ! try: ! self.drawimage() ! img = self.getimagefromtempfile() ! except: ! print "Unexpected Error:",sys.exc_info()[2] ! gdchartLock.release() ! return None gdchartLock.release() return img |
From: <dav...@us...> - 2004-02-10 09:24:43
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28647 Modified Files: widgets.py Log Message: Reversed multiple scripts patch - it works the way it was Index: widgets.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/widgets.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** widgets.py 10 Feb 2004 09:20:20 -0000 1.20 --- widgets.py 10 Feb 2004 09:21:30 -0000 1.21 *************** *** 232,239 **** self.title = title self.headerwidgets = headerwidgets ! if type(script) in (list, tuple): ! self.script = [PlainContents(scriptinst) for scriptinst in script] ! else: ! self.script = [PlainContents(script)] ContentWidget.__init__(self, None, contents, newattribs) --- 232,236 ---- self.title = title self.headerwidgets = headerwidgets ! self.script = PlainContents(script) ContentWidget.__init__(self, None, contents, newattribs) *************** *** 285,290 **** for widget in self.headerwidgets: result += widget.gethtml() ! for script in self.script: ! result += script.gethtml() # finished the head result += """ --- 282,286 ---- for widget in self.headerwidgets: result += widget.gethtml() ! result += self.script.gethtml() # finished the head result += """ |
From: <dav...@us...> - 2004-02-10 09:23:46
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28383 Modified Files: widgets.py Log Message: Added ability to have multiple independent scripts in the header of a widgets.Page Index: widgets.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/widgets.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** widgets.py 10 Feb 2004 08:39:22 -0000 1.19 --- widgets.py 10 Feb 2004 09:20:20 -0000 1.20 *************** *** 232,236 **** self.title = title self.headerwidgets = headerwidgets ! self.script = PlainContents(script) ContentWidget.__init__(self, None, contents, newattribs) --- 232,239 ---- self.title = title self.headerwidgets = headerwidgets ! if type(script) in (list, tuple): ! self.script = [PlainContents(scriptinst) for scriptinst in script] ! else: ! self.script = [PlainContents(script)] ContentWidget.__init__(self, None, contents, newattribs) *************** *** 282,286 **** for widget in self.headerwidgets: result += widget.gethtml() ! result += self.script.gethtml() # finished the head result += """ --- 285,290 ---- for widget in self.headerwidgets: result += widget.gethtml() ! for script in self.script: ! result += script.gethtml() # finished the head result += """ |
From: <dav...@us...> - 2004-02-10 09:22:55
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28217 Modified Files: grid.py Log Message: Added a variable which records whether the grid has reached the end of the table or not Index: grid.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/grid.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** grid.py 10 Feb 2004 09:19:03 -0000 1.13 --- grid.py 10 Feb 2004 09:19:43 -0000 1.14 *************** *** 330,336 **** --- 330,341 ---- if minrow != None and maxrow != None: self.tablerows = self.gridtable.getsometablerows(minrow,maxrow,self.filter) + if len(self.tablerows) < maxrow-minrow: #End of table + self.tableEnded = 1 + else: + self.tableEnded = 0 else: self.tablerows = self.gridtable.gettablerows(self.filter) + class NumberGridCategory(SimpleGridCategory): """A grid category that handles numbers""" |
From: <dav...@us...> - 2004-02-10 09:22:16
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28042 Modified Files: grid.py Log Message: Added paging to SimpleGrid. It still defaults to no paging Index: grid.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/grid.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** grid.py 10 Feb 2004 09:16:45 -0000 1.12 --- grid.py 10 Feb 2004 09:19:03 -0000 1.13 *************** *** 233,237 **** """a grid with common methods for config pages""" def __init__(self, gridtable, columnlist, hrefbase=None, hreftarget='', colordefs={}, colordeps={}, \ ! headingcolumns=(), hidecolumns=(), filter=None, gridcategory=SimpleGridCategory): self.hrefbase = hrefbase self.hreftarget = hreftarget --- 233,237 ---- """a grid with common methods for config pages""" def __init__(self, gridtable, columnlist, hrefbase=None, hreftarget='', colordefs={}, colordeps={}, \ ! headingcolumns=(), hidecolumns=(), filter=None, gridcategory=SimpleGridCategory,newattribs={}): self.hrefbase = hrefbase self.hreftarget = hreftarget *************** *** 245,248 **** --- 245,249 ---- self.gridcategory = gridcategory Grid.__init__(self, self.getcolumns()) + self.overrideattribs(newattribs) self.makegrid() *************** *** 274,278 **** """makes up the grid - retrieves rows, adds them, and adjusts the grid""" self.addtitlerow() - self.tablerows = self.gridtable.gettablerows(self.filter) self.addrows() self.shrinkrange() --- 275,278 ---- *************** *** 284,287 **** --- 284,289 ---- def addrows(self): + self.getrows() + for row in self.tablerows: self.addrow(row) *************** *** 304,307 **** --- 306,336 ---- self.addcell(rownum, category, widgetcell) + def handlepageargs(self): + """handle arguments that select the current page""" + page = self.attribs.get('page', 0) + try: + page = int(page) + except: + if page.lower() == 'all': + page = 0 + else: + page = 1 + self.page = page + self.numrowsinpage = self.attribs.get('numrowsinpage',20) + + def getrows(self): + """retrieves the appropriate rows from the database""" + self.handlepageargs() + if self.page == 0: + minrow, maxrow = None, None + else: + minrow, maxrow = (self.page-1)*self.numrowsinpage, self.page*self.numrowsinpage + if minrow < 0: minrow = 0 + # if maxrow > len(alllogrows): maxrow = len(alllogrows) + if minrow != None and maxrow != None: + self.tablerows = self.gridtable.getsometablerows(minrow,maxrow,self.filter) + else: + self.tablerows = self.gridtable.gettablerows(self.filter) + class NumberGridCategory(SimpleGridCategory): """A grid category that handles numbers""" |
From: <dav...@us...> - 2004-02-10 09:21:48
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27946 Modified Files: dbtable.py Log Message: Added a function to dbtable which will return a subset of the rows rather than all Index: dbtable.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/dbtable.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dbtable.py 10 Feb 2004 08:07:04 -0000 1.11 --- dbtable.py 10 Feb 2004 09:18:35 -0000 1.12 *************** *** 119,122 **** --- 119,127 ---- return self.db.allrowdicts(sql, self.db.lower) + def getsometablerows(self, minRow = None, maxRow = None, filter = None): + """retrieves all the rows in the table""" + sql = "select %s from %s %s %s" % (self.getsqlcolumns(), self.tablename, self.getfilterclause(filter), self.orderbyclause()) + return self.db.somerowdicts(sql, self.db.lower,minrow=minRow,maxrow=maxRow) + def addrow(self, argdict): """add the row to the table""" |
From: <dav...@us...> - 2004-02-10 09:21:14
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27650 Modified Files: chart.py Log Message: Changed chart width slightly. Added mapping from None for the graph Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** chart.py 10 Feb 2004 09:14:01 -0000 1.19 --- chart.py 10 Feb 2004 09:18:01 -0000 1.20 *************** *** 45,49 **** def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 18 self.im_height = 9 --- 45,49 ---- def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 17.5 self.im_height = 9 *************** *** 80,83 **** --- 80,89 ---- Chart.__init__(self, charttable, filter) + def mapfromNone(self, value): + if value == None: + return 0 + else: + return value + def getdata(self): chartdata = self.charttable.gettablerows(self.filter) *************** *** 91,95 **** else: self.xdata = [str(row[self.xcolumn]) for row in chartdata] ! self.ydata = [[row[ycolumn] for row in chartdata] for ycolumn in self.ycolumns] self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] --- 97,101 ---- else: self.xdata = [str(row[self.xcolumn]) for row in chartdata] ! self.ydata = [[self.mapfromNone(row[ycolumn]) for row in chartdata] for ycolumn in self.ycolumns] self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] *************** *** 107,111 **** for dataset in self.ydata: for value in dataset: ! if value < ymin: ymin = value if value > ymax: --- 113,117 ---- for dataset in self.ydata: for value in dataset: ! if value < ymin and value != None: ymin = value if value > ymax: |
From: <dav...@us...> - 2004-02-10 09:20:02
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27358 Modified Files: grid.py Log Message: Number grid handles nulls Index: grid.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/grid.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** grid.py 10 Feb 2004 09:14:44 -0000 1.11 --- grid.py 10 Feb 2004 09:16:45 -0000 1.12 *************** *** 307,311 **** """A grid category that handles numbers""" def valuetostring(self, value): ! if self.storageformat in ['DECIMAL', 'DOUBLE']: return "%.3f" % value else: --- 307,311 ---- """A grid category that handles numbers""" def valuetostring(self, value): ! if self.storageformat in ['DECIMAL', 'DOUBLE'] and value is not None: return "%.3f" % value else: |
From: <dav...@us...> - 2004-02-10 09:17:57
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26952 Modified Files: grid.py Log Message: Made links in graph cells optional Index: grid.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/grid.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** grid.py 10 Feb 2004 09:11:21 -0000 1.10 --- grid.py 10 Feb 2004 09:14:44 -0000 1.11 *************** *** 290,294 **** """adds all the cells for a row to the grid""" rowid = self.gridtable.getrowid(row) ! href = "" if self.hrefbase is not None: href = self.hrefbase --- 290,294 ---- """adds all the cells for a row to the grid""" rowid = self.gridtable.getrowid(row) ! href = None if self.hrefbase is not None: href = self.hrefbase |
From: <dav...@us...> - 2004-02-10 09:17:13
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26755 Modified Files: chart.py Log Message: Widened graph. Fixed bug in automatic x-axis label spacing. Changed legend position to top left Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** chart.py 10 Feb 2004 09:12:31 -0000 1.18 --- chart.py 10 Feb 2004 09:14:01 -0000 1.19 *************** *** 45,49 **** def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 12 self.im_height = 9 --- 45,49 ---- def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 18 self.im_height = 9 *************** *** 134,141 **** currentxdata.append(self.xdata[currentxpos]) currentxpos += sliceNum ! if currentxpos != xDataLen+sliceNum-1: ! currentxdata.extend(self.xdata[-1:]) #Set the x labels ! self.figure.get_current_axis().set_xticks(arange(xDataLen,step=sliceNum)) self.figure.get_current_axis().set_xticklabels(currentxdata,rotation='vertical') --- 134,140 ---- currentxdata.append(self.xdata[currentxpos]) currentxpos += sliceNum ! currentxdata.extend(self.xdata[-1:]) #Set the x labels ! self.figure.get_current_axis().set_xticks(arange(xDataLen+1,step=sliceNum)) self.figure.get_current_axis().set_xticklabels(currentxdata,rotation='vertical') *************** *** 145,149 **** #Draw a legend ! self.figure.get_current_axis().legend(self.legendlabels,3) --- 144,148 ---- #Draw a legend ! self.figure.get_current_axis().legend(self.legendlabels,2) |
From: <dav...@us...> - 2004-02-10 09:15:43
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26525 Modified Files: chart.py Log Message: Removed accidental debug string print-out commit Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** chart.py 10 Feb 2004 09:09:01 -0000 1.17 --- chart.py 10 Feb 2004 09:12:31 -0000 1.18 *************** *** 129,134 **** if not sliceNum: sliceNum = 1 - print xDataLen, numLabels, sliceNum - currentxdata = self.xdata[:1] currentxpos = sliceNum --- 129,132 ---- |
From: <dav...@us...> - 2004-02-10 09:14:33
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26300 Modified Files: grid.py Log Message: Adde dthe start of specific number handling for grids. At the moment, it just restricts floating points to 3 decimal places Index: grid.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/grid.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** grid.py 9 Feb 2004 14:41:25 -0000 1.9 --- grid.py 10 Feb 2004 09:11:21 -0000 1.10 *************** *** 232,236 **** class SimpleGrid(Grid): """a grid with common methods for config pages""" ! def __init__(self, gridtable, columnlist, hrefbase=None, hreftarget='', colordefs={}, colordeps={}, headingcolumns=(), hidecolumns=(), filter=None): self.hrefbase = hrefbase self.hreftarget = hreftarget --- 232,237 ---- class SimpleGrid(Grid): """a grid with common methods for config pages""" ! def __init__(self, gridtable, columnlist, hrefbase=None, hreftarget='', colordefs={}, colordeps={}, \ ! headingcolumns=(), hidecolumns=(), filter=None, gridcategory=SimpleGridCategory): self.hrefbase = hrefbase self.hreftarget = hreftarget *************** *** 242,245 **** --- 243,247 ---- self.hidecolumns = hidecolumns self.filter = filter + self.gridcategory = gridcategory Grid.__init__(self, self.getcolumns()) self.makegrid() *************** *** 259,263 **** display = name not in self.hidecolumns storageformat = self.gridtable.columntypes.get(name, 'TEXT').upper() ! column = SimpleGridCategory(name, title, tooltip, colnum, colordict, isheading, display, storageformat) columns.append(column) columndict[name] = column --- 261,265 ---- display = name not in self.hidecolumns storageformat = self.gridtable.columntypes.get(name, 'TEXT').upper() ! column = self.gridcategory(name, title, tooltip, colnum, colordict, isheading, display, storageformat) columns.append(column) columndict[name] = column *************** *** 302,303 **** --- 304,313 ---- self.addcell(rownum, category, widgetcell) + class NumberGridCategory(SimpleGridCategory): + """A grid category that handles numbers""" + def valuetostring(self, value): + if self.storageformat in ['DECIMAL', 'DOUBLE']: + return "%.3f" % value + else: + return SimpleGridCategory.valuetostring(self, value) + |
From: <dav...@us...> - 2004-02-10 09:12:13
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25878 Modified Files: chart.py Log Message: There are now a minimum of 6 and a maximum of 10 times on each chart (chosen by how well the number of times splits itself for each option, defaulting to 10) Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** chart.py 10 Feb 2004 09:08:21 -0000 1.16 --- chart.py 10 Feb 2004 09:09:01 -0000 1.17 *************** *** 115,132 **** self.figure.get_current_axis().set_ylim([math.floor(ymin),math.ceil(ymax)]) ! #Calculate number of x labels to use - 1 per self.im_width ! numLabels = self.im_width-2 ! sliceNum = len(self.xdata)/numLabels if not sliceNum: sliceNum = 1 currentxdata = self.xdata[:1] currentxpos = sliceNum ! while currentxpos < len(self.xdata): currentxdata.append(self.xdata[currentxpos]) currentxpos += sliceNum ! if currentxpos != len(self.xdata)+sliceNum-1: currentxdata.extend(self.xdata[-1:]) #Set the x labels ! self.figure.get_current_axis().set_xticks(arange(len(self.xdata),step=sliceNum)) self.figure.get_current_axis().set_xticklabels(currentxdata,rotation='vertical') --- 115,143 ---- self.figure.get_current_axis().set_ylim([math.floor(ymin),math.ceil(ymax)]) ! #Calculate number of x labels to use - between 6 and 10 ! #First see if anything divides nicely ! xDataLen = len(self.xdata) ! numLabels = None ! for testnum in range(5,10): ! if xDataLen % testnum == 0: ! numLabels = testnum+1 ! ! #Otherwise go for max ! if not numLabels: numLabels = 10 ! ! sliceNum = xDataLen / (numLabels-1) if not sliceNum: sliceNum = 1 + + print xDataLen, numLabels, sliceNum currentxdata = self.xdata[:1] currentxpos = sliceNum ! while currentxpos < xDataLen: currentxdata.append(self.xdata[currentxpos]) currentxpos += sliceNum ! if currentxpos != xDataLen+sliceNum-1: currentxdata.extend(self.xdata[-1:]) #Set the x labels ! self.figure.get_current_axis().set_xticks(arange(xDataLen,step=sliceNum)) self.figure.get_current_axis().set_xticklabels(currentxdata,rotation='vertical') |
From: <dav...@us...> - 2004-02-10 09:11:37
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25817 Modified Files: chart.py Log Message: Added argument to main chart for formatting middle x values differently to end points. Added legend on bottom left. Made the bar chart a constant size Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** chart.py 10 Feb 2004 09:05:21 -0000 1.15 --- chart.py 10 Feb 2004 09:08:21 -0000 1.16 *************** *** 72,80 **** class LineChart(Chart): ! def __init__(self, charttable, xcolumn, ycolumns, xstorageformat='TEXT', xdisplay='', filter=None): self.xcolumn = xcolumn self.ycolumns = ycolumns self.xstorageformat = xstorageformat self.xdisplay = xdisplay Chart.__init__(self, charttable, filter) --- 72,81 ---- class LineChart(Chart): ! def __init__(self, charttable, xcolumn, ycolumns, xstorageformat='TEXT', xdisplay='', filter=None,xdisplay2=None): self.xcolumn = xcolumn self.ycolumns = ycolumns self.xstorageformat = xstorageformat self.xdisplay = xdisplay + self.xdisplay2 = xdisplay2 Chart.__init__(self, charttable, filter) *************** *** 82,89 **** chartdata = self.charttable.gettablerows(self.filter) if self.xstorageformat == 'DATETIME': ! self.xdata = [dates.formatdate(row[self.xcolumn],self.xdisplay) for row in chartdata] else: self.xdata = [str(row[self.xcolumn]) for row in chartdata] self.ydata = [[row[ycolumn] for row in chartdata] for ycolumn in self.ycolumns] def drawimage(self): --- 83,96 ---- chartdata = self.charttable.gettablerows(self.filter) if self.xstorageformat == 'DATETIME': ! if self.xdisplay2: ! self.xdata = [dates.formatdate(chartdata[0][self.xcolumn], self.xdisplay)] ! self.xdata += [dates.formatdate(row[self.xcolumn],self.xdisplay2) for row in chartdata[1:-1]] ! self.xdata += [dates.formatdate(chartdata[-1][self.xcolumn], self.xdisplay)] ! else: ! self.xdata = [dates.formatdate(row[self.xcolumn],self.xdisplay) for row in chartdata] else: self.xdata = [str(row[self.xcolumn]) for row in chartdata] self.ydata = [[row[ycolumn] for row in chartdata] for ycolumn in self.ycolumns] + self.legendlabels = [str(ycolumn) for ycolumn in self.ycolumns] def drawimage(self): *************** *** 127,130 **** --- 134,140 ---- for dataset in self.ydata: self.figure.get_current_axis().plot(dataset) + + #Draw a legend + self.figure.get_current_axis().legend(self.legendlabels,3) *************** *** 182,186 **** def sizeimage(self): ! self.im_width = len(self.xdata)*2 + 2 self.im_height = 8 #This should take tagname length into account --- 192,196 ---- def sizeimage(self): ! self.im_width = 6 self.im_height = 8 #This should take tagname length into account |
From: <dav...@us...> - 2004-02-10 09:08:39
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25174 Modified Files: chart.py Log Message: Fixed infinite recursion bug for low number of values Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** chart.py 10 Feb 2004 09:02:19 -0000 1.14 --- chart.py 10 Feb 2004 09:05:21 -0000 1.15 *************** *** 111,114 **** --- 111,115 ---- numLabels = self.im_width-2 sliceNum = len(self.xdata)/numLabels + if not sliceNum: sliceNum = 1 currentxdata = self.xdata[:1] |
From: <dav...@us...> - 2004-02-10 09:05:30
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24661 Modified Files: chart.py Log Message: Set the origin properly in legend chart Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** chart.py 10 Feb 2004 09:01:49 -0000 1.13 --- chart.py 10 Feb 2004 09:02:19 -0000 1.14 *************** *** 175,179 **** self.figure.get_current_axis().set_xticklabels(self.xdata,rotation='vertical') ! self.figure.get_current_axis().bar(arange(len(self.xdata)),self.ydata[0],0.5,color=self.colours) def sizeimage(self): --- 175,182 ---- self.figure.get_current_axis().set_xticklabels(self.xdata,rotation='vertical') ! originY = None ! if ymin < 0 and ymax > 0: ! originY = 0 ! self.figure.get_current_axis().bar(arange(len(self.xdata)),self.ydata[0],0.5,color=self.colours,originY=originY) def sizeimage(self): |
From: <dav...@us...> - 2004-02-10 09:05:01
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24559 Modified Files: chart.py Log Message: Removed useless function 'draw'. Added in custom figure size settings to take care of long tag names Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** chart.py 10 Feb 2004 09:00:14 -0000 1.12 --- chart.py 10 Feb 2004 09:01:49 -0000 1.13 *************** *** 52,61 **** self.options.update(args) - def draw(self): - # Put options into effect. Derived class implementations of draw() - # should call this method before calling gdchart.chart(). - for key in self.options.keys(): - set(self.figure.get_current_axis(),key,self.options[key]) - def getimagefromtempfile(self): #Save temporary file --- 52,55 ---- *************** *** 72,76 **** def gethtml(self): gdchartLock.acquire() - self.draw() self.drawimage() img = self.getimagefromtempfile() --- 66,69 ---- *************** *** 98,101 **** --- 91,98 ---- #TODO: x axis spacing should be according to time + #Set the size of the subplot big enough to handle times + #[left, bottom, width, height] out of 1 + self.figure.add_axes([.08,.25,.9,.7],'w') + #Set the min/max of each axis ymin = sys.maxint *************** *** 150,153 **** --- 147,164 ---- def drawimage(self): + #Find the longest text on the x axis + maxtextlen = 0 + for text in self.xdata: + if len(text) > maxtextlen: + maxtextlen = len(text) + + #Convert it to a proportion of the image + bottomProportion = .1 + maxtextlen*.013 + heightProportion = .99 - bottomProportion + + #Set the size of the subplot big enough to handle times + #[left, bottom, width, height] out of 1 + self.figure.add_axes([.125,bottomProportion,.825,heightProportion],'w') + #Set the min/max of each axis ymin = sys.maxint |
From: <dav...@us...> - 2004-02-10 09:04:47
|
Update of /cvsroot/jtoolkit/jToolkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24511 Added Files: mailer.py Log Message: added simple email wrapper, mailer.py --- NEW FILE: mailer.py --- #!/usr/bin/python2.2 """provides a simple wrapper for composing and sending emails""" # Copyright 2002, 2003 St James Software # # This file is part of jToolkit. # # jToolkit is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # jToolkit is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with jToolkit; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import smtplib import socket # some constants for messages contentheader = \ """Content-Type: %s; charset = "%s" """ mimeversion = "MIME-Version: 1.0\n" contenttransferencoding = "Content-Transfer-Encoding: 8bit\n" def makemessage(messagedict): message = contentheader % (messagedict.get('contenttype', 'text/plain'), messagedict.get('charset', 'iso-8859-1')) if 'from' in messagedict: message += "From: %s\n" % messagedict['from'] if 'organization' in messagedict: message += "Organization: %s\n" % messagedict['organization'] if 'to' in messagedict: message += "To: %s\n" % ", ".join(messagedict['to']) if 'subject' in messagedict: message += "Subject: %s\n" % messagedict['subject'] message += mimeversion message += contenttransferencoding message += "\n" if 'body' in messagedict: message += messagedict['body'] return message def dosendmessage(fromemail,recipientemails,message,smtpserver='',errorhandler=None): smtp = smtplib.SMTP() errmsg = "" try: smtp.connect(smtpserver) refused = smtp.sendmail(fromemail,recipientemails,message) errmsg += ", ".join(refused.keys()) if errmsg != "": errmsg = "Recipients " + errmsg + " refused" except smtplib.SMTPRecipientsRefused: errmsg += "All recipients refused" except smtplib.SMTPHeloError: errmsg += "Server didn't respond properly to HELO" except smtplib.SMTPSenderRefused: errmsg += "Sender refused" except smtplib.SMTPDataError: errmsg += "Unexpected error code" except socket.error, msg: if errorhandler is not None: errmsg += "Socket Error: %r" % errorhandler.exception_str() if smtp.sock: smtp.quit() if errmsg != "" and errorhandler is not None: errorhandler.logerror(errmsg) return errmsg |
From: <dav...@us...> - 2004-02-10 09:03:36
|
Update of /cvsroot/jtoolkit/jToolkit/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24296 Modified Files: chart.py Log Message: Fixed display of time on first graph Index: chart.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/widgets/chart.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** chart.py 10 Feb 2004 08:57:44 -0000 1.11 --- chart.py 10 Feb 2004 09:00:14 -0000 1.12 *************** *** 45,50 **** def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 8 ! self.im_height = 6 def option(self, **args): --- 45,50 ---- def sizeimage(self): """Subclasses of this should implement this uniquely""" ! self.im_width = 12 ! self.im_height = 9 def option(self, **args): *************** *** 89,95 **** chartdata = self.charttable.gettablerows(self.filter) if self.xstorageformat == 'DATETIME': ! self.xdata = array([dates.formatdate(row[self.xcolumn],self.xdisplay) for row in chartdata]) else: ! self.xdata = array([str(row[self.xcolumn]) for row in chartdata]) self.ydata = [[row[ycolumn] for row in chartdata] for ycolumn in self.ycolumns] --- 89,95 ---- chartdata = self.charttable.gettablerows(self.filter) if self.xstorageformat == 'DATETIME': ! self.xdata = [dates.formatdate(row[self.xcolumn],self.xdisplay) for row in chartdata] else: ! self.xdata = [str(row[self.xcolumn]) for row in chartdata] self.ydata = [[row[ycolumn] for row in chartdata] for ycolumn in self.ycolumns] *************** *** 115,121 **** sliceNum = len(self.xdata)/numLabels #Set the x labels self.figure.get_current_axis().set_xticks(arange(len(self.xdata),step=sliceNum)) ! self.figure.get_current_axis().set_xticklabels(self.xdata[:1]+self.xdata[::sliceNum]+self.xdata[-1:],rotation='vertical') #Plot each dataset --- 115,128 ---- sliceNum = len(self.xdata)/numLabels + currentxdata = self.xdata[:1] + currentxpos = sliceNum + while currentxpos < len(self.xdata): + currentxdata.append(self.xdata[currentxpos]) + currentxpos += sliceNum + if currentxpos != len(self.xdata)+sliceNum-1: + currentxdata.extend(self.xdata[-1:]) #Set the x labels self.figure.get_current_axis().set_xticks(arange(len(self.xdata),step=sliceNum)) ! self.figure.get_current_axis().set_xticklabels(currentxdata,rotation='vertical') #Plot each dataset |
From: <dav...@us...> - 2004-02-10 09:02:36
|
Update of /cvsroot/jtoolkit/jToolkit/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24137 Modified Files: PyADO.py Log Message: Made sure only one thread can execute at a time, working around a threading problem in JSuiteDB Index: PyADO.py =================================================================== RCS file: /cvsroot/jtoolkit/jToolkit/data/PyADO.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyADO.py 9 Feb 2004 14:18:50 -0000 1.8 --- PyADO.py 10 Feb 2004 08:59:24 -0000 1.9 *************** *** 25,28 **** --- 25,31 ---- import _PyADO + from threading import Lock + executeLock = Lock() + # TODO: # -------------------------------------------------------------------- *************** *** 230,234 **** --- 233,239 ---- else: Query = operation % parameters + executeLock.acquire() self.rs.Open(operation, ActiveConnection = self.PassConn) + executeLock.release() # cache the fields. this must be done before describefields rsFields = self.rs.Fields *************** *** 343,347 **** --- 348,354 ---- rs = _PyADO.Recordset() Query = operation % parameters[rownumber] + executeLock.acquire() rs.Open(Query, ActiveConnection = self.PassConn) + executeLock.release() self.rsList.append(rs) self.rs = self.rsList[0] *************** *** 372,378 **** # if called before Execute, will fail if self.rs.State == 0: self.rs.Open() ! return self.rs.RecordCount self.rs.Close() if self.rs.State != 0: return self.rs.RecordCount --- 379,388 ---- # if called before Execute, will fail if self.rs.State == 0: + executeLock.acquire() self.rs.Open() ! executeLock.release() ! ret = self.rs.RecordCount self.rs.Close() + return ret if self.rs.State != 0: return self.rs.RecordCount |