pypersyst-cvs Mailing List for Pypersyst - Python Persistence System (Page 3)
Brought to you by:
pobrien
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(12) |
Apr
(11) |
May
(45) |
Jun
(97) |
Jul
(5) |
Aug
(73) |
Sep
(266) |
Oct
(222) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(81) |
Jun
(57) |
Jul
(279) |
Aug
(88) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Matthew R. S. <gld...@us...> - 2004-08-09 16:36:14
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/entity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2690/entity Modified Files: entity.py Log Message: Assign defaults to unassigned required fields. Index: entity.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/entity/entity.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** entity.py 16 Jul 2004 18:38:47 -0000 1.56 --- entity.py 9 Aug 2004 16:36:03 -0000 1.57 *************** *** 70,73 **** --- 70,75 ---- field = FieldClass(instance=self, attribute=name) value = attrs.pop(name, field.default) + if field.required and value is field.UNASSIGNED: + value = field.default field.set(value) fields[name] = field |
From: Matthew R. S. <gld...@us...> - 2004-08-09 16:00:30
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/test/schemaF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26802/test/schemaF Modified Files: domain.py root.py Added Files: field.py Log Message: A failing test to expose a deficiency in the current default-value handling for fields. Index: root.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/test/schemaF/root.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** root.py 7 Jul 2004 20:26:39 -0000 1.1 --- root.py 9 Aug 2004 16:00:20 -0000 1.2 *************** *** 5,11 **** from pypersyst.entity.entity import Entity from pypersyst.entity import root ! from pypersyst.field import field from pypersyst.schevo import state VERSION = 1 STATE = state.PRODUCTION --- 5,13 ---- from pypersyst.entity.entity import Entity from pypersyst.entity import root ! from pypersyst.field import field as pfield from pypersyst.schevo import state + from pypersyst.test.schemaF import field as tfield + VERSION = 1 STATE = state.PRODUCTION *************** *** 26,32 **** _fieldSpec = { ! 'realm': field.EntityInstance, ! 'user': field.EntityInstance, ! 'name': field.String, } --- 28,34 ---- _fieldSpec = { ! 'realm': pfield.EntityInstance, ! 'user': pfield.EntityInstance, ! 'name': pfield.String, } *************** *** 44,48 **** _fieldSpec = { ! 'name': field.String, } --- 46,67 ---- _fieldSpec = { ! 'name': pfield.String, ! } ! ! ! class Sprocket(Entity): ! """Sprocket class.""" ! ! _attrSpec = [ ! 'diameter', ! 'disposition', ! ] ! ! _altkeySpec = [ ! ] ! ! _fieldSpec = { ! 'diameter': pfield.Integer, ! 'disposition': tfield.Disposition, } *************** *** 61,66 **** _fieldSpec = { ! 'name': field.String, ! 'quantity': field.Integer, } --- 80,85 ---- _fieldSpec = { ! 'name': pfield.String, ! 'quantity': pfield.Integer, } *************** *** 78,82 **** _fieldSpec = { ! 'name': field.String, } --- 97,101 ---- _fieldSpec = { ! 'name': pfield.String, } *************** *** 95,100 **** _fieldSpec = { ! 'name': field.String, ! 'hashedPassword': field.String, } --- 114,119 ---- _fieldSpec = { ! 'name': pfield.String, ! 'hashedPassword': pfield.String, } *************** *** 106,109 **** --- 125,129 ---- Avatar, Realm, + Sprocket, Thing, ThingyThing, Index: domain.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/test/schemaF/domain.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** domain.py 16 Jul 2004 18:38:47 -0000 1.22 --- domain.py 9 Aug 2004 16:00:20 -0000 1.23 *************** *** 74,77 **** --- 74,85 ---- ], + 'Sprocket': [ + (self.ICollection), + (self.ICreate), + (self.IDelete), + (self.IDisplay), + (self.IUpdate), + ], + 'Thing': [ (self.ICollection, ThingCollection), --- NEW FILE: field.py --- __cvsid__ = "$Id: field.py,v 1.1 2004/08/09 16:00:20 gldnspud Exp $" __revision__ = "$Revision: 1.1 $"[11:-2] from pypersyst.field import field class Disposition(field.String): default = 'neutral' |
From: Matthew R. S. <gld...@us...> - 2004-08-09 16:00:29
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26802/test Modified Files: test_domain.py Log Message: A failing test to expose a deficiency in the current default-value handling for fields. Index: test_domain.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/test/test_domain.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test_domain.py 19 Jul 2004 22:58:43 -0000 1.28 --- test_domain.py 9 Aug 2004 16:00:20 -0000 1.29 *************** *** 137,140 **** --- 137,148 ---- self.assertEqual(display.data.name, realm.name) + def test_createWithDefaultField(self): + domain = self.domain + collection = domain['Sprocket'] + create = domain.ICreate(collection) + create.data.diameter = 5 + display = create.execute() + self.assertEqual(display.data.disposition, 'neutral') + def test_createWithReferences(self): collection = self.domain['Realm'] |
From: Matthew R. S. <gld...@us...> - 2004-08-09 16:00:29
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26802/domain Modified Files: supplier.py Log Message: A failing test to expose a deficiency in the current default-value handling for fields. Index: supplier.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/domain/supplier.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** supplier.py 4 Aug 2004 04:55:58 -0000 1.24 --- supplier.py 9 Aug 2004 16:00:20 -0000 1.25 *************** *** 40,44 **** def transaction(self): """Return transaction to be executed.""" ! return tx.Create(self._entityName, **self.data._attrs) interface.declareLabel(EntityCreate, 'Create') --- 40,45 ---- def transaction(self): """Return transaction to be executed.""" ! attrs = self.data.sys.changes ! return tx.Create(self._entityName, **attrs) interface.declareLabel(EntityCreate, 'Create') |
From: Matthew R. S. <gld...@us...> - 2004-08-07 07:11:08
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2546/ui/qt Modified Files: collection.py Log Message: Minor updates to collection list view. Fix for String fields -- they now disallow empty strings if allowEmpty is set to False. Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** collection.py 5 Aug 2004 21:21:59 -0000 1.27 --- collection.py 7 Aug 2004 07:10:59 -0000 1.28 *************** *** 802,809 **** self._setup() - def __getattr__(self, name): - """Allow ListViewWidget to act as a facade for underlying ListView.""" - return getattr(self.listView, name) - # -- Properties -- --- 802,805 ---- *************** *** 820,823 **** --- 816,827 ---- self._showContextMenu = b + # -- Convenience access to listView properties -- + + draggable = property(fget=lambda self: self.listView.draggable) + setDraggable = property(fget=lambda self: self.listView.setDraggable) + + droppable = property(fget=lambda self: self.listView.droppable) + setDroppable = property(fget=lambda self: self.listView.setDroppable) + # -- Setup -- |
From: Matthew R. S. <gld...@us...> - 2004-08-07 07:11:07
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/field In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2546/field Modified Files: field.py Log Message: Minor updates to collection list view. Fix for String fields -- they now disallow empty strings if allowEmpty is set to False. Index: field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/field/field.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** field.py 6 Aug 2004 21:03:42 -0000 1.18 --- field.py 7 Aug 2004 07:10:58 -0000 1.19 *************** *** 216,225 **** return str(value) ! # def validate(self, value): ! # """Validate the value, raising an error on failure.""" ! # Field.validate(self, value) ! # if value is not None and type(value) is not types.StringType: ! # raise TypeError('%s value must be a string, not %r %r' % ! # (self._attribute, type(value), value)) --- 216,223 ---- return str(value) ! def validate(self, value): ! Field.validate(self, value) ! if not self.allowEmpty and value == '': ! raise ValueError('%s value must not be empty.' % self._attribute) *************** *** 233,243 **** return unicode(value) - # def validate(self, value): - # """Validate the value, raising an error on failure.""" - # Field.validate(self, value) - # if value is not None and type(value) is not types.UnicodeType: - # raise TypeError('%s value must be a Unicode, not %r %r' % - # (self._attribute, type(value), value)) - class Integer(Field): --- 231,234 ---- *************** *** 256,263 **** """Validate the value, raising an error on failure.""" Field.validate(self, value) - # if value is not None and type(value) is not types.IntType: - # msg = ('%s value must be an integer, not %r %r' % - # (self._attribute, type(value), value)) - # raise TypeError(msg) if not self.minValue <= value <= self.maxValue: msg = ('%s value must be >= %r and <= %r' % --- 247,250 ---- *************** *** 275,286 **** return float(value) - # def validate(self, value): - # """Validate the value, raising an error on failure.""" - # Field.validate(self, value) - # if value is not None and type(value) is not types.FloatType: - # msg = ('%s value must be a floating point number, not %r %r' % - # (self._attribute, type(value), value)) - # raise TypeError(msg) - class Money(Field): --- 262,265 ---- *************** *** 305,316 **** return float(format % float(value)) - # def validate(self, value): - # """Validate the value, raising an error on failure.""" - # Field.validate(self, value) - # if value is not None and type(value) is not types.FloatType: - # msg = ('%s value must be a monetary value, not %r %r' % - # (self._attribute, type(value), value)) - # raise TypeError(msg) - class Date(Field): --- 284,287 ---- *************** *** 338,347 **** ) - # def validate(self, value): - # Field.validate(self, value) - # if value is not None and not isinstance(value, datetime.date): - # raise TypeError('%s value must be a datetime.date, not %r %r' % - # (self._attribute, type(value), value)) - class Datetime(Field): --- 309,312 ---- *************** *** 373,382 **** ) - # def validate(self, value): - # Field.validate(self, value) - # if value is not None and not isinstance(value, datetime.datetime): - # raise TypeError('%s value must be a datetime.datetime, not %r %r' % - # (self._attribute, type(value), value)) - class EntityInstance(Field): --- 338,341 ---- |
From: Matthew R. S. <gld...@us...> - 2004-08-07 07:11:07
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2546/test Modified Files: test_field.py Log Message: Minor updates to collection list view. Fix for String fields -- they now disallow empty strings if allowEmpty is set to False. Index: test_field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/test/test_field.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_field.py 6 Aug 2004 21:01:09 -0000 1.8 --- test_field.py 7 Aug 2004 07:10:59 -0000 1.9 *************** *** 43,46 **** --- 43,49 ---- tester. + badValuesDefault: A list of bad values that should cause an error + to occur. + convertValuesDefault: A list of tuples of (value, convertedValue). The test suite will convert value and test for equality between *************** *** 55,60 **** """ convertValuesDefault = [] ! fieldClass = None goodValuesDefault = [] --- 58,64 ---- """ + badValuesDefault = [] convertValuesDefault = [] ! fieldClass = None goodValuesDefault = [] *************** *** 103,106 **** --- 107,115 ---- f.verify(value) + def test_badValuesDefault(self): + for value in self.badValuesDefault: + f = self.emptyField() + self.failUnlessRaises(Exception, f.set, value) + class String(unittest.TestCase, Tests): *************** *** 115,118 **** --- 124,128 ---- fieldClass = field.String goodValuesDefault = ['abcdefg'] + badValuesDefault = [''] |
From: Matthew R. S. <gld...@us...> - 2004-08-07 00:56:32
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17913/pypersyst/ui/qt Modified Files: field.py Log Message: Make read-only line edit widgets have same background as window (i.e. 'transparent') to make their read-only state visibly obvious. Index: field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/field.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** field.py 6 Aug 2004 21:27:52 -0000 1.2 --- field.py 7 Aug 2004 00:56:23 -0000 1.3 *************** *** 136,139 **** --- 136,141 ---- field = self.field self.setReadOnly(field.readonly) + self.setBackgroundMode([self.PaletteBase, + self.PaletteBackground][field.readonly]) value = field.get() if value is not field.UNASSIGNED: *************** *** 213,216 **** --- 215,220 ---- field = self.field self.setReadOnly(field.readonly) + self.setBackgroundMode([self.PaletteBase, + self.PaletteBackground][field.readonly]) value = field.get() if value is not field.UNASSIGNED: *************** *** 504,507 **** --- 508,513 ---- value = field.get() self.setReadOnly(field.readonly) + self.setBackgroundMode([self.PaletteBase, + self.PaletteBackground][field.readonly]) if not field.wasChanged() or value is field.UNASSIGNED: self.setText('') *************** *** 547,558 **** value = field.get() if field.readonly: ! if value is not field.UNASSIGNED: self.setMaxValue(value) self.setMinValue(value) self.editor().setReadOnly(True) else: self.setMaxValue(field.maxValue) self.setMinValue(field.minValue) self.editor().setReadOnly(False) self.setValue(value) --- 553,566 ---- value = field.get() if field.readonly: ! if value not in [None, field.UNASSIGNED]: self.setMaxValue(value) self.setMinValue(value) self.editor().setReadOnly(True) + self.editor().setBackgroundMode(self.PaletteBackground) else: self.setMaxValue(field.maxValue) self.setMinValue(field.minValue) self.editor().setReadOnly(False) + self.editor().setBackgroundMode(self.PaletteBase) self.setValue(value) *************** *** 567,571 **** except: pass ! if value is not field.UNASSIGNED: qt.QSpinBox.setValue(self, value) else: --- 575,579 ---- except: pass ! if value not in [None, field.UNASSIGNED]: qt.QSpinBox.setValue(self, value) else: *************** *** 644,647 **** --- 652,657 ---- field = self.field self.setReadOnly(field.readonly) + self.setBackgroundMode([self.PaletteBase, + self.PaletteBackground][field.readonly]) format = '%0.' + str(field.fractDigits) + 'f' value = field.get() *************** *** 700,703 **** --- 710,715 ---- field = self.field self.setReadOnly(field.readonly) + self.setBackgroundMode([self.PaletteBase, + self.PaletteBackground][field.readonly]) value = field.get() if value is field.UNASSIGNED: |
From: Matthew R. S. <gld...@us...> - 2004-08-06 21:28:01
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18345/ui/qt Modified Files: field.py Log Message: Upon changes to the spinbox via the buttons, assign the value to the field for better interactivity with other widgets. Index: field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/field.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** field.py 28 Jul 2004 03:05:09 -0000 1.1 --- field.py 6 Aug 2004 21:27:52 -0000 1.2 *************** *** 517,523 **** def __init__(self, domain, field, parent, name, *args, **kwargs): self._domain = domain self.field = field ! qt.QSpinBox.__init__(self, parent, name, *args) self.reset() --- 517,525 ---- def __init__(self, domain, field, parent, name, *args, **kwargs): + qt.QSpinBox.__init__(self, parent, name, *args) self._domain = domain self.field = field ! self._setting = False ! self.connect(self, qt.SIGNAL('valueChanged(int)'), self.onValueChanged) self.reset() *************** *** 538,541 **** --- 540,546 ---- return field.get() + def onValueChanged(self, value): + self.setValue(value) + def reset(self): field = self.field *************** *** 553,565 **** def setValue(self, value): ! field = self.field try: ! field.assign(value) ! except: ! pass ! if value is not field.UNASSIGNED: ! qt.QSpinBox.setValue(self, value) ! else: ! self.editor().setText('') --- 558,576 ---- def setValue(self, value): ! if self._setting: ! return try: ! self._setting = True ! field = self.field ! try: ! field.assign(value) ! except: ! pass ! if value is not field.UNASSIGNED: ! qt.QSpinBox.setValue(self, value) ! else: ! self.editor().setText('') ! finally: ! self._setting = False |
From: Patrick K. O'B. <po...@us...> - 2004-08-06 21:03:52
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/field In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13943/pypersyst/field Modified Files: field.py Log Message: Handle the not required case better. Index: field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/field/field.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** field.py 6 Aug 2004 19:08:22 -0000 1.17 --- field.py 6 Aug 2004 21:03:42 -0000 1.18 *************** *** 397,403 **** """Validate the value, raising an error on failure.""" Field.validate(self, value) validInstances = getattr(self, 'validInstances', []) validClassNames = self.validClassNames ! if value is None and self.allowNone: return elif value is not None and not isinstance(value, Entity): --- 397,406 ---- """Validate the value, raising an error on failure.""" Field.validate(self, value) + # A value must be provided. validInstances = getattr(self, 'validInstances', []) validClassNames = self.validClassNames ! if value is UNASSIGNED and not self.required: ! return ! elif value is None and self.allowNone: return elif value is not None and not isinstance(value, Entity): |
From: Matthew R. S. <gld...@us...> - 2004-08-06 21:01:35
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13498 Modified Files: test_field.py Log Message: Add tests for required=False Index: test_field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/test/test_field.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_field.py 4 Aug 2004 17:05:58 -0000 1.7 --- test_field.py 6 Aug 2004 21:01:09 -0000 1.8 *************** *** 63,67 **** return self.fieldClass(instance=None, attribute=None) ! def test_allowNone(self): f = self.emptyField() f.allowNone = True --- 63,67 ---- return self.fieldClass(instance=None, attribute=None) ! def test_allowNoneIsTrue(self): f = self.emptyField() f.allowNone = True *************** *** 71,74 **** --- 71,82 ---- self.assertEqual(f.get(), None) + def test_requiredIsFalse(self): + f = self.emptyField() + f.required = False + f.assign(f.UNASSIGNED) + self.assertEqual(f.get(), f.UNASSIGNED) + f.set(f.UNASSIGNED) + self.assertEqual(f.get(), f.UNASSIGNED) + def test_convertValuesDefault(self): for value, convertedValue in self.convertValuesDefault: |
From: Patrick K. O'B. <po...@us...> - 2004-08-06 19:08:30
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/field In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28013/pypersyst/field Modified Files: field.py Log Message: Added docstring for "required" field attribute. Index: field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/field/field.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** field.py 4 Aug 2004 17:05:58 -0000 1.16 --- field.py 6 Aug 2004 19:08:22 -0000 1.17 *************** *** 52,55 **** --- 52,57 ---- True in non-persistence contexts to prevent unwanted assignments. + required: True if a value must be supplied. + writeonce: True if value can only be written once. """ |
From: Matthew R. S. <gld...@us...> - 2004-08-05 21:22:25
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25674/pypersyst/ui/qt Modified Files: collection.py Log Message: Widgets should be constructed with minimum effort, and properties should be set after the fact. Also changed ordering to be more consistent. Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** collection.py 5 Aug 2004 03:51:42 -0000 1.26 --- collection.py 5 Aug 2004 21:21:59 -0000 1.27 *************** *** 18,85 **** ! # XXX: These functions are getting unweidly. Maybe have properties ! # that can be set on the resulting widget? ! ! ! def listViewStack(domain, defaultAction=None, parent=None, *args): ! widget = ListViewStack( ! domain, ! defaultAction, [...1068 lines suppressed...] - event=e, - listView=self, - signal=signal.DomainObjectsDropped, - ) - self.emit(payload.signal, (payload,)) - - def setFilter(self, newFilter): - self._filter = newFilter - self.reset() - - def reset(self): - scroll = self.verticalScrollBar() - scrollValue = scroll.value() - self._setupItems() - scroll.setValue(scrollValue) - - # -------------------------------------------------------------------- # Default adapters. --- 943,946 ---- |
From: Matthew R. S. <gld...@us...> - 2004-08-05 21:22:25
|
Update of /cvsroot/pypersyst/pypersyst/tools/navigator/navigator/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25674/tools/navigator/navigator/ui Modified Files: mainwindow.py Log Message: Widgets should be constructed with minimum effort, and properties should be set after the fact. Also changed ordering to be more consistent. Index: mainwindow.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/tools/navigator/navigator/ui/mainwindow.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mainwindow.py 30 Jul 2004 18:19:02 -0000 1.9 --- mainwindow.py 5 Aug 2004 21:21:59 -0000 1.10 *************** *** 113,119 **** collectionStack = ui.qt.collection.listViewStack( domain=domain, - defaultAction=domain.IUpdate, parent=vsplit, ) # Supplier tabwidgets. tabStack = ui.qt.supplier.tabWidgetStack( --- 113,119 ---- collectionStack = ui.qt.collection.listViewStack( domain=domain, parent=vsplit, ) + collectionStack.setDefaultAction(domain.IUpdate) # Supplier tabwidgets. tabStack = ui.qt.supplier.tabWidgetStack( |
From: Matthew R. S. <gld...@us...> - 2004-08-05 03:51:51
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9325/pypersyst/ui/qt Modified Files: collection.py Log Message: Minor changes in case we want to do more with the supplierId of suppliers as we iterate through a collection to build a view. Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** collection.py 5 Aug 2004 03:18:17 -0000 1.25 --- collection.py 5 Aug 2004 03:51:42 -0000 1.26 *************** *** 287,291 **** parentItem = ParentListViewItem(domain, parentCollection, parentSupplier, self) ! if supplierId(parentSupplier) in prevItems: self.setSelected(parentItem, True) parentItem.setOpen(True) --- 287,292 ---- parentItem = ParentListViewItem(domain, parentCollection, parentSupplier, self) ! sid = supplierId(parentSupplier) ! if sid in prevItems: self.setSelected(parentItem, True) parentItem.setOpen(True) *************** *** 298,302 **** childItem = ListViewItem(domain, childCollection, childSupplier, parentItem) ! if supplierId(childSupplier) in prevItems: self.setSelected(childItem, True) if self._draggable: --- 299,304 ---- childItem = ListViewItem(domain, childCollection, childSupplier, parentItem) ! sid = supplierId(childSupplier) ! if sid in prevItems: self.setSelected(childItem, True) if self._draggable: *************** *** 829,833 **** for supplier in self._filter(): item = ListViewItem(self._domain, self._collection, supplier, self) ! if supplierId(supplier) in prevItems: self.setSelected(item, True) if self._draggable: --- 831,836 ---- for supplier in self._filter(): item = ListViewItem(self._domain, self._collection, supplier, self) ! sid = supplierId(supplier) ! if sid in prevItems: self.setSelected(item, True) if self._draggable: |
From: Matthew R. S. <gld...@us...> - 2004-08-05 03:18:28
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4906/pypersyst/ui/qt Modified Files: collection.py supplier.py tabwidget.py Log Message: * If multiple items are selected in a collection view, keep them selected when resetting the view. * Move the supplierId function from pypersyst.ui.qt.tabwidget to pypersyst.ui.qt.supplier where it makes more sense to be. Index: supplier.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/supplier.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** supplier.py 30 Jul 2004 18:18:28 -0000 1.7 --- supplier.py 5 Aug 2004 03:18:17 -0000 1.8 *************** *** 18,21 **** --- 18,38 ---- + # -------------------------------------------------------------------- + + + def supplierId(supplier): + """Return a semi-unique ID for a supplier.""" + try: + className = supplier.__class__.__name__ + dataName = supplier.data.__class__.__name__ + oid = supplier.data.sys.oid + return '%s-%s-%s' % (className, dataName, oid) + except: + return None + + + # -------------------------------------------------------------------- + + def currentSupplierWidget(domain, listenTo=None, parent=None, *args): widget = CurrentSupplierWidget(domain, listenTo, parent, *args) Index: tabwidget.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/tabwidget.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tabwidget.py 30 Jul 2004 17:00:11 -0000 1.3 --- tabwidget.py 5 Aug 2004 03:18:17 -0000 1.4 *************** *** 4,18 **** - def supplierId(supplier): - """Return a semi-unique ID for a supplier.""" - try: - className = supplier.__class__.__name__ - dataName = supplier.data.__class__.__name__ - oid = supplier.data.sys.oid - return '%s-%s-%s' % (className, dataName, oid) - except: - return None - - class TabWidget(qt.QTabWidget): """TabWidget with PyPerSyst Domain smarts. --- 4,7 ---- *************** *** 66,70 **** self._showTab(widget) ! def removeSimilar(self, related, relatedIdFn=supplierId): """Remove notebook pages containing similar related objects. --- 55,59 ---- self._showTab(widget) ! def removeSimilar(self, related, relatedIdFn=None): """Remove notebook pages containing similar related objects. *************** *** 86,89 **** --- 75,81 ---- prevent 'old' supplier tabs from hanging around. """ + if relatedIdFn is None: + from pypersyst.ui.qt.supplier import supplierId + relatedIdFn = supplierId thisId = relatedIdFn(related) if thisId is None: *************** *** 102,107 **** return self._relations[related] ! def findFirstSimilar(self, related, relatedIdFn=supplierId): """Return the first widget whose related is similar to this related.""" thisId = relatedIdFn(related) if thisId is None: --- 94,102 ---- return self._relations[related] ! def findFirstSimilar(self, related, relatedIdFn=None): """Return the first widget whose related is similar to this related.""" + if relatedIdFn is None: + from pypersyst.ui.qt.supplier import supplierId + relatedIdFn = supplierId thisId = relatedIdFn(related) if thisId is None: Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** collection.py 5 Aug 2004 01:43:41 -0000 1.24 --- collection.py 5 Aug 2004 03:18:17 -0000 1.25 *************** *** 15,18 **** --- 15,19 ---- from pypersyst.ui.qt import interface from pypersyst.ui.qt import signal + from pypersyst.ui.qt.supplier import supplierId *************** *** 228,232 **** self.setShowSortIndicator(True) self.setAllColumnsShowFocus(True) - self.setRootIsDecorated(True) self._setupColumns() self._setupItems() --- 229,232 ---- *************** *** 266,274 **** """Clear and re-create all list items.""" domain = self._domain ! # If there is a selected item, hold on to its oid so we can ! # re-select it. ! prevItem = self.selectedItem() ! if prevItem is not None: ! prevItem = (prevItem._collection, prevItem._oid) # Destory current list items. self.clear() --- 266,278 ---- """Clear and re-create all list items.""" domain = self._domain ! # If there are selected items, hold on to their ids so we can ! # re-select them. ! prevItems = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! prevItems.append(supplierId(item.supplier())) ! iterator += 1 # Destory current list items. self.clear() *************** *** 283,287 **** parentItem = ParentListViewItem(domain, parentCollection, parentSupplier, self) ! if (parentCollection, parentSupplier.data.sys.oid) == prevItem: self.setSelected(parentItem, True) parentItem.setOpen(True) --- 287,291 ---- parentItem = ParentListViewItem(domain, parentCollection, parentSupplier, self) ! if supplierId(parentSupplier) in prevItems: self.setSelected(parentItem, True) parentItem.setOpen(True) *************** *** 294,298 **** childItem = ListViewItem(domain, childCollection, childSupplier, parentItem) ! if (childCollection, childSupplier.data.sys.oid) == prevItem: self.setSelected(childItem, True) if self._draggable: --- 298,302 ---- childItem = ListViewItem(domain, childCollection, childSupplier, parentItem) ! if supplierId(childSupplier) in prevItems: self.setSelected(childItem, True) if self._draggable: *************** *** 810,818 **** def _setupItems(self): """Clear and re-create all list items.""" ! # If there is a selected item, hold on to its oid so we can ! # re-select it. ! prevItem = self.selectedItem() ! if prevItem is not None: ! prevItem = prevItem._oid # Destory current list items. self.clear() --- 814,826 ---- def _setupItems(self): """Clear and re-create all list items.""" ! # If there are selected items, hold on to their ids so we can ! # re-select them. ! prevItems = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! prevItems.append(supplierId(item.supplier())) ! iterator += 1 # Destory current list items. self.clear() *************** *** 821,825 **** for supplier in self._filter(): item = ListViewItem(self._domain, self._collection, supplier, self) ! if supplier.data.sys.oid == prevItem: self.setSelected(item, True) if self._draggable: --- 829,833 ---- for supplier in self._filter(): item = ListViewItem(self._domain, self._collection, supplier, self) ! if supplierId(supplier) in prevItems: self.setSelected(item, True) if self._draggable: |
From: Matthew R. S. <gld...@us...> - 2004-08-05 01:43:50
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25029/pypersyst/ui/qt Modified Files: collection.py dragdrop.py Log Message: Use QListView.viewport() to our advantage to calculate relative positions properly, and to enable auto-scrolling when dragging near an edge of a drop target. Index: dragdrop.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/dragdrop.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dragdrop.py 5 Aug 2004 01:13:59 -0000 1.3 --- dragdrop.py 5 Aug 2004 01:43:41 -0000 1.4 *************** *** 44,50 **** """Parse a drop event and return an appropriate payload.""" objects = decodeDrop(domain, event) ! pos = event.pos() ! pos.setY(pos.y() - listView.header().height()) ! item = listView.itemAt(pos) supplier = None if item is not None: --- 44,48 ---- """Parse a drop event and return an appropriate payload.""" objects = decodeDrop(domain, event) ! item = listView.itemAt(listView.contentsToViewport(event.pos())) supplier = None if item is not None: Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** collection.py 5 Aug 2004 01:13:59 -0000 1.23 --- collection.py 5 Aug 2004 01:43:41 -0000 1.24 *************** *** 236,240 **** # Set up drag and drop. if self._droppable: ! self.setAcceptDrops(True) if self._extendedSelection: self.setSelectionMode(self.Extended) --- 236,241 ---- # Set up drag and drop. if self._droppable: ! self.viewport().setAcceptDrops(True) ! self.setDragAutoScroll(True) if self._extendedSelection: self.setSelectionMode(self.Extended) *************** *** 287,292 **** if self._draggable: parentItem.setDragEnabled(True) - if self._droppable: - parentItem.setDropEnabled(True) # Create child list items. findArgs = {parentAttribute: domain.IEntity(parentSupplier.data)} --- 288,291 ---- *************** *** 299,306 **** if self._draggable: childItem.setDragEnabled(True) - if self._droppable: - childItem.setDropEnabled(True) ! def dragMoveEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( --- 298,303 ---- if self._draggable: childItem.setDragEnabled(True) ! def contentsDragMoveEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( *************** *** 351,355 **** return ui.qt.dragdrop.dragObject(domain, self, allChildren) ! def dropEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( --- 348,352 ---- return ui.qt.dragdrop.dragObject(domain, self, allChildren) ! def contentsDropEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( *************** *** 720,727 **** values.append(value) - def acceptDrop(self, mime): - print 'acceptDrop', mime, '--> True' - return True - def compare(self, item, col, ascending): """Compare self to item based on col. --- 717,720 ---- *************** *** 750,759 **** return retval - def dragEntered(self): - print 'entered' - - def dragLeft(self): - print 'left' - def paintCell(self, p, cg, column, width, align): value = self._values[column] --- 743,746 ---- *************** *** 798,802 **** # Set up drag and drop. if self._droppable: ! self.setAcceptDrops(True) if self._extendedSelection: self.setSelectionMode(self.Extended) --- 785,790 ---- # Set up drag and drop. if self._droppable: ! self.viewport().setAcceptDrops(True) ! self.setDragAutoScroll(True) if self._extendedSelection: self.setSelectionMode(self.Extended) *************** *** 837,844 **** if self._draggable: item.setDragEnabled(True) - if self._droppable: - item.setDropEnabled(True) ! def dragMoveEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( --- 825,830 ---- if self._draggable: item.setDragEnabled(True) ! def contentsDragMoveEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( *************** *** 866,870 **** return ui.qt.dragdrop.dragObject(domain, self, suppliers) ! def dropEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( --- 852,856 ---- return ui.qt.dragdrop.dragObject(domain, self, suppliers) ! def contentsDropEvent(self, e): if self._droppable: payload = ui.qt.dragdrop.parseListViewDropEvent( |
From: Matthew R. S. <gld...@us...> - 2004-08-05 01:14:08
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20524/pypersyst/ui/qt Modified Files: collection.py dragdrop.py signal.py Log Message: New signal: DomainObjectsDragged, similar to DomainObjectsDropped and emitted whenever the mouse is moved during a drag. A handler for this signal can set the payload's accepted attribute to True if the drag would be accepted if dropped. Index: signal.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/signal.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** signal.py 4 Aug 2004 06:05:17 -0000 1.5 --- signal.py 5 Aug 2004 01:13:59 -0000 1.6 *************** *** 76,79 **** --- 76,107 ---- + class DomainObjectsDragged(Payload): + """Zero or more domain objects are being dragged. + + When this signal is emitted, handlers may modify the accepted + attribute to indicate that the drop would be accepted if completed + at the current position. + + sender: The widget emitting the signal. + + source: The widget where the drag started. + + objects: List of domain objects being dragged. + + onto: Domain object that cursor is presently over, or None if over + an empty space. + + accepted: Whether or not a drop would be accepted. Defaults to + False. + """ + + def __init__(self, sender, source, objects, onto): + self.sender = sender + self.source = source + self.objects = objects + self.onto = onto + self.accepted = False + + class DomainObjectsDropped(Payload): """Zero or more domain objects were dragged and dropped. Index: dragdrop.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/dragdrop.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dragdrop.py 4 Aug 2004 06:05:17 -0000 1.2 --- dragdrop.py 5 Aug 2004 01:13:59 -0000 1.3 *************** *** 3,39 **** import qt ! ! SCHEME = 'pypersyst' ! ! ! def uri(domain, ob): ! """Return a URI for some PyPerSyst object ob, or None if no URI exists. ! ! The format of URIs is as follows: ! ! For collections, pypersyst://CollectionName ! ! For display suppliers, pypersyst://CollectionName/oid ! """ ! if domain.ICollection(ob, None) is not None: ! # ob is a collection ! return '%s://%s' % (SCHEME, domain.IName(collection)) ! elif domain.IDisplay(ob, None) is not None: ! # ob is a display supplier ! try: ! return '%s://%s/%i' % (SCHEME, domain.IName(ob.collection), ! ob.data.sys.oid) ! except: ! # Either ob didn't have a collection, or it didn't have an ! # OID, so there's no way to turn it into a URI. ! return None ! def dragObject(domain, sender, objects): ! """Return a drag object that 'represents' a list of objects.""" ! uris = [uri(domain, ob) for ob in objects] ! uris = [x for x in uris if x is not None] ! drag = qt.QUriDrag(uris, sender) ! return drag --- 3,10 ---- import qt ! from pypersyst.ui.qt import signal ! SCHEME = 'pypersyst' *************** *** 62,63 **** --- 33,83 ---- + def dragObject(domain, sender, objects): + """Return a drag object that 'represents' a list of objects.""" + uris = [uri(domain, ob) for ob in objects] + uris = [x for x in uris if x is not None] + drag = qt.QUriDrag(uris, sender) + return drag + + + def parseListViewDropEvent(domain, event, listView, signal): + """Parse a drop event and return an appropriate payload.""" + objects = decodeDrop(domain, event) + pos = event.pos() + pos.setY(pos.y() - listView.header().height()) + item = listView.itemAt(pos) + supplier = None + if item is not None: + supplier = item.supplier() + payload = signal( + sender=listView, + source=event.source(), + objects=objects, + onto=supplier, + ) + return payload + + + def uri(domain, ob): + """Return a URI for some PyPerSyst object ob, or None if no URI exists. + + The format of URIs is as follows: + + For collections, pypersyst://CollectionName + + For display suppliers, pypersyst://CollectionName/oid + """ + if domain.ICollection(ob, None) is not None: + # ob is a collection + return '%s://%s' % (SCHEME, domain.IName(collection)) + elif domain.IDisplay(ob, None) is not None: + # ob is a display supplier + try: + return '%s://%s/%i' % (SCHEME, domain.IName(ob.collection), + ob.data.sys.oid) + except: + # Either ob didn't have a collection, or it didn't have an + # OID, so there's no way to turn it into a URI. + return None + + Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** collection.py 4 Aug 2004 23:23:18 -0000 1.22 --- collection.py 5 Aug 2004 01:13:59 -0000 1.23 *************** *** 205,208 **** --- 205,209 ---- _emits = [ + signal.DomainObjectsDragged, signal.DomainObjectsDropped, ] *************** *** 301,312 **** childItem.setDropEnabled(True) ! def dragEnterEvent(self, e): ! # XXX: Be more specific here. if self._droppable: ! e.accept(True) def dragObject(self): if self._draggable: domain = self._domain # Determine selected items. items = [] --- 302,322 ---- childItem.setDropEnabled(True) ! def dragMoveEvent(self, e): if self._droppable: ! payload = ui.qt.dragdrop.parseListViewDropEvent( ! domain=self._domain, ! event=e, ! listView=self, ! signal=signal.DomainObjectsDragged, ! ) ! self.emit(payload.signal, (payload,)) ! e.accept(payload.accepted) def dragObject(self): if self._draggable: domain = self._domain + childCollection = self._childCollection + parentAttribute = self._parentAttribute + parentCollection = self._parentCollection # Determine selected items. items = [] *************** *** 319,338 **** # Convert them to suppliers. suppliers = [item.supplier() for item in items] ! return ui.qt.dragdrop.dragObject(domain, self, suppliers) def dropEvent(self, e): if self._droppable: ! objects = ui.qt.dragdrop.decodeDrop(self._domain, e) ! pos = e.pos() ! pos.setY(pos.y() - self.header().height()) ! item = self.itemAt(pos) ! supplier = None ! if item is not None: ! supplier = item.supplier() ! payload = signal.DomainObjectsDropped( ! sender=self, ! source=e.source(), ! objects=objects, ! onto=supplier, ) self.emit(payload.signal, (payload,)) --- 329,361 ---- # Convert them to suppliers. suppliers = [item.supplier() for item in items] ! # Normalize by converting parent items into all of their ! # child items, and removing duplicates. ! allChildren = [] ! childOidsUsed = {} ! for item in items: ! supplier = item.supplier() ! if supplier in parentCollection: ! # Add children in the order they are displayed ! children = [] ! itemChild = item.firstChild() ! while itemChild is not None: ! children.append(itemChild.supplier()) ! itemChild = itemChild.nextSibling() ! else: ! children = [supplier] ! for child in children: ! if child.data.sys.oid not in childOidsUsed: ! allChildren.append(child) ! childOidsUsed[child.data.sys.oid] = True ! # Return the dragObject ! return ui.qt.dragdrop.dragObject(domain, self, allChildren) def dropEvent(self, e): if self._droppable: ! payload = ui.qt.dragdrop.parseListViewDropEvent( ! domain=self._domain, ! event=e, ! listView=self, ! signal=signal.DomainObjectsDropped, ) self.emit(payload.signal, (payload,)) *************** *** 493,496 **** --- 516,520 ---- signal.ActionActivated, signal.DomainObjectSelected, + signal.DomainObjectsDragged, signal.DomainObjectsDropped, signal.SupplierActivated, *************** *** 541,544 **** --- 565,570 ---- extendedSelection=self._extendedSelection, parent=self) vbox.addWidget(listView, 1) + qtsig = signal.DomainObjectsDragged.qtsignal() + self.connect(listView, qtsig, self.onDomainObjectsDragged) qtsig = signal.DomainObjectsDropped.qtsignal() self.connect(listView, qtsig, self.onDomainObjectsDropped) *************** *** 581,584 **** --- 607,621 ---- self.emit(payload.signal, (payload,)) + def onDomainObjectsDragged(self, payload): + payload2 = signal.DomainObjectsDragged( + sender=self, + source=payload.source, + objects=payload.objects, + onto=payload.onto, + ) + self.emit(payload2.signal, (payload2,)) + # Make sure original payload accepted value is set. + payload.accepted = payload2.accepted + def onDomainObjectsDropped(self, payload): payload = signal.DomainObjectsDropped( *************** *** 684,687 **** --- 721,725 ---- def acceptDrop(self, mime): + print 'acceptDrop', mime, '--> True' return True *************** *** 712,715 **** --- 750,759 ---- return retval + def dragEntered(self): + print 'entered' + + def dragLeft(self): + print 'left' + def paintCell(self, p, cg, column, width, align): value = self._values[column] *************** *** 796,803 **** item.setDropEnabled(True) ! def dragEnterEvent(self, e): if self._droppable: ! # XXX: Be more specific here: ! e.accept(True) def dragObject(self): --- 840,853 ---- item.setDropEnabled(True) ! def dragMoveEvent(self, e): if self._droppable: ! payload = ui.qt.dragdrop.parseListViewDropEvent( ! domain=self._domain, ! event=e, ! listView=self, ! signal=signal.DomainObjectsDragged, ! ) ! self.emit(payload.signal, (payload,)) ! e.accept(payload.accepted) def dragObject(self): *************** *** 818,833 **** def dropEvent(self, e): if self._droppable: ! objects = ui.qt.dragdrop.decodeDrop(self._domain, e) ! pos = e.pos() ! pos.setY(pos.y() - self.header().height()) ! item = self.itemAt(pos) ! supplier = None ! if item is not None: ! supplier = item.supplier() ! payload = signal.DomainObjectsDropped( ! sender=self, ! source=e.source(), ! objects=objects, ! onto=supplier, ) self.emit(payload.signal, (payload,)) --- 868,876 ---- def dropEvent(self, e): if self._droppable: ! payload = ui.qt.dragdrop.parseListViewDropEvent( ! domain=self._domain, ! event=e, ! listView=self, ! signal=signal.DomainObjectsDropped, ) self.emit(payload.signal, (payload,)) |
From: Matthew R. S. <gld...@us...> - 2004-08-04 23:23:27
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2594/pypersyst/ui/qt Modified Files: collection.py Log Message: Paint cells whose value is None with a color that has less contrast with the background than the normal text color. Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** collection.py 4 Aug 2004 22:52:39 -0000 1.21 --- collection.py 4 Aug 2004 23:23:18 -0000 1.22 *************** *** 712,715 **** --- 712,722 ---- return retval + def paintCell(self, p, cg, column, width, align): + value = self._values[column] + if value is None: + cg = qt.QColorGroup(cg) + cg.setColor(cg.Text, qt.QColor(cg.mid())) + return qt.QListViewItem.paintCell(self, p, cg, column, width, align) + def supplier(self): return self._collection[self._oid] |
From: Matthew R. S. <gld...@us...> - 2004-08-04 22:52:48
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29800/pypersyst/ui/qt Modified Files: collection.py Log Message: Right-click context menus for items in collection views can now be turned off. Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** collection.py 4 Aug 2004 22:37:31 -0000 1.20 --- collection.py 4 Aug 2004 22:52:39 -0000 1.21 *************** *** 31,36 **** ! def listView(domain, collection, parent=None, draggable=False, ! droppable=False, extendedSelection=False, *args): factory = IListViewWidgetFactory(collection) widget = factory( --- 31,36 ---- ! def listView(domain, collection, draggable=False, droppable=False, ! extendedSelection=False, contextMenu=True, parent=None, *args): factory = IListViewWidgetFactory(collection) widget = factory( *************** *** 39,42 **** --- 39,43 ---- droppable=droppable, extendedSelection=extendedSelection, + contextMenu=contextMenu, parent=parent, *args *************** *** 57,61 **** def parentChildListView(domain, parentCollection, childCollection, parentAttribute, draggable=False, droppable=False, ! extendedSelection=False, parent=None, *args): widget = ParentChildListView( domain, --- 58,63 ---- def parentChildListView(domain, parentCollection, childCollection, parentAttribute, draggable=False, droppable=False, ! extendedSelection=False, contextMenu=True, ! parent=None, *args): widget = ParentChildListView( domain, *************** *** 66,69 **** --- 68,72 ---- droppable=droppable, extendedSelection=extendedSelection, + contextMenu=contextMenu, parent=parent, *args *************** *** 207,211 **** def __init__(self, domain, parentCollection, childCollection, parentAttribute, draggable, droppable, extendedSelection, ! parent, *args): qt.QListView.__init__(self, parent, *args) AutoConnector.__init__(self) --- 210,214 ---- def __init__(self, domain, parentCollection, childCollection, parentAttribute, draggable, droppable, extendedSelection, ! contextMenu, parent, *args): qt.QListView.__init__(self, parent, *args) AutoConnector.__init__(self) *************** *** 217,220 **** --- 220,224 ---- self._droppable = droppable self._extendedSelection = extendedSelection + self._contextMenu = contextMenu self._hiddenColnames = [] self._setup() *************** *** 236,239 **** --- 240,247 ---- header = self.header() header.setStretchEnabled(True, header.count() - 1) + if self._contextMenu: + qtsig = qt.SIGNAL('rightButtonPressed' + '(QListViewItem*, const QPoint&, int)') + self.connect(self, qtsig, self.onRightButtonPressed) def _setupColumns(self): *************** *** 330,333 **** --- 338,350 ---- self.emit(payload.signal, (payload,)) + def onRightButtonPressed(self, item, point): + if item is not None: + menu = ui.qt.action.menu( + domain=self._domain, + context=item.supplier(), + parent=self, + ) + menu.exec_loop(point) + def reset(self): scroll = self.verticalScrollBar() *************** *** 487,491 **** def __init__(self, domain, collection, parent, name, defaultAction=None, filters=None, draggable=False, droppable=False, ! extendedSelection=False, *args): qt.QWidget.__init__(self, parent, name, *args) AutoConnector.__init__(self) --- 504,508 ---- def __init__(self, domain, collection, parent, name, defaultAction=None, filters=None, draggable=False, droppable=False, ! extendedSelection=False, contextMenu=True, *args): qt.QWidget.__init__(self, parent, name, *args) AutoConnector.__init__(self) *************** *** 500,503 **** --- 517,521 ---- self._droppable = droppable self._extendedSelection = extendedSelection + self._contextMenu = contextMenu self._setup() *************** *** 529,535 **** qtsig = qt.SIGNAL('returnPressed(QListViewItem*)') self.connect(listView, qtsig, self.onActivated) ! qtsig = qt.SIGNAL('rightButtonPressed' ! '(QListViewItem*, const QPoint&, int)') ! self.connect(listView, qtsig, self.onRightButtonPressed) qtsig = qt.SIGNAL('selectionChanged(QListViewItem*)') self.connect(listView, qtsig, self.onSelectionChanged) --- 547,554 ---- qtsig = qt.SIGNAL('returnPressed(QListViewItem*)') self.connect(listView, qtsig, self.onActivated) ! if self._contextMenu: ! qtsig = qt.SIGNAL('rightButtonPressed' ! '(QListViewItem*, const QPoint&, int)') ! self.connect(listView, qtsig, self.onRightButtonPressed) qtsig = qt.SIGNAL('selectionChanged(QListViewItem*)') self.connect(listView, qtsig, self.onSelectionChanged) |
From: Matthew R. S. <gld...@us...> - 2004-08-04 22:37:41
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27253/pypersyst/ui/qt Modified Files: collection.py Log Message: * Clean up formatting of helper functions for easier maintenance. * Make last column of collection list/tree views stretched, so that the entirety of each row can always be a drop target. * Change the way dragEnterEvent, dragObject, and dropEvent work due to a slight inconsistency between PyQt/X11 and PyQt/Win32 Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** collection.py 4 Aug 2004 18:16:19 -0000 1.19 --- collection.py 4 Aug 2004 22:37:31 -0000 1.20 *************** *** 17,22 **** def listViewStack(domain, defaultAction=None, parent=None, *args): ! widget = ListViewStack(domain, defaultAction, parent, *args) return widget --- 17,31 ---- + # XXX: These functions are getting unweidly. Maybe have properties + # that can be set on the resulting widget? + + def listViewStack(domain, defaultAction=None, parent=None, *args): ! widget = ListViewStack( ! domain, ! defaultAction, ! parent, ! *args ! ) return widget *************** *** 25,35 **** droppable=False, extendedSelection=False, *args): factory = IListViewWidgetFactory(collection) ! widget = factory(domain, draggable=draggable, droppable=droppable, ! extendedSelection=extendedSelection, parent=parent, *args) return widget def menu(domain, withActions=False, parent=None, *args): ! m = Menu(domain, withActions, parent, *args) return m --- 34,55 ---- droppable=False, extendedSelection=False, *args): factory = IListViewWidgetFactory(collection) ! widget = factory( ! domain, ! draggable=draggable, ! droppable=droppable, ! extendedSelection=extendedSelection, ! parent=parent, ! *args ! ) return widget def menu(domain, withActions=False, parent=None, *args): ! m = Menu( ! domain, ! withActions, ! parent, ! *args ! ) return m *************** *** 38,52 **** parentAttribute, draggable=False, droppable=False, extendedSelection=False, parent=None, *args): ! widget = ParentChildListView(domain, parentCollection=parentCollection, ! childCollection=childCollection, ! parentAttribute=parentAttribute, ! draggable=draggable, droppable=droppable, ! extendedSelection=extendedSelection, ! parent=parent, *args) return widget def toolBox(domain, parent, *args): ! widget = ToolBox(domain, parent, *args) return widget --- 58,81 ---- parentAttribute, draggable=False, droppable=False, extendedSelection=False, parent=None, *args): ! widget = ParentChildListView( ! domain, ! parentCollection=parentCollection, ! childCollection=childCollection, ! parentAttribute=parentAttribute, ! draggable=draggable, ! droppable=droppable, ! extendedSelection=extendedSelection, ! parent=parent, ! *args ! ) return widget def toolBox(domain, parent, *args): ! widget = ToolBox( ! domain, ! parent, ! *args ! ) return widget *************** *** 203,212 **** if self._droppable: self.setAcceptDrops(True) - self.dragEnterEvent = self.__dragEnterEvent - self.dropEvent = self.__dropEvent - if self._draggable: - self.dragObject = self.__dragObject if self._extendedSelection: self.setSelectionMode(self.Extended) def _setupColumns(self): --- 232,239 ---- if self._droppable: self.setAcceptDrops(True) if self._extendedSelection: self.setSelectionMode(self.Extended) + header = self.header() + header.setStretchEnabled(True, header.count() - 1) def _setupColumns(self): *************** *** 266,302 **** childItem.setDropEnabled(True) ! def __dragEnterEvent(self, e): # XXX: Be more specific here. ! e.accept(True) ! def __dragObject(self): ! domain = self._domain ! # Determine selected items. ! items = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! items.append(item) ! iterator += 1 ! # Convert them to suppliers. ! suppliers = [item.supplier() for item in items] ! return ui.qt.dragdrop.dragObject(domain, self, suppliers) ! def __dropEvent(self, e): ! objects = ui.qt.dragdrop.decodeDrop(self._domain, e) ! pos = e.pos() ! pos.setY(pos.y() - self.header().height()) ! item = self.itemAt(pos) ! supplier = None ! if item is not None: ! supplier = item.supplier() ! payload = signal.DomainObjectsDropped( ! sender=self, ! source=e.source(), ! objects=objects, ! onto=supplier, ! ) ! self.emit(payload.signal, (payload,)) def reset(self): --- 293,332 ---- childItem.setDropEnabled(True) ! def dragEnterEvent(self, e): # XXX: Be more specific here. ! if self._droppable: ! e.accept(True) ! def dragObject(self): ! if self._draggable: ! domain = self._domain ! # Determine selected items. ! items = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! items.append(item) ! iterator += 1 ! # Convert them to suppliers. ! suppliers = [item.supplier() for item in items] ! return ui.qt.dragdrop.dragObject(domain, self, suppliers) ! def dropEvent(self, e): ! if self._droppable: ! objects = ui.qt.dragdrop.decodeDrop(self._domain, e) ! pos = e.pos() ! pos.setY(pos.y() - self.header().height()) ! item = self.itemAt(pos) ! supplier = None ! if item is not None: ! supplier = item.supplier() ! payload = signal.DomainObjectsDropped( ! sender=self, ! source=e.source(), ! objects=objects, ! onto=supplier, ! ) ! self.emit(payload.signal, (payload,)) def reset(self): *************** *** 699,708 **** if self._droppable: self.setAcceptDrops(True) - self.dragEnterEvent = self.__dragEnterEvent - self.dropEvent = self.__dropEvent - if self._draggable: - self.dragObject = self.__dragObject if self._extendedSelection: self.setSelectionMode(self.Extended) def _setupColumns(self): --- 729,736 ---- if self._droppable: self.setAcceptDrops(True) if self._extendedSelection: self.setSelectionMode(self.Extended) + header = self.header() + header.setStretchEnabled(True, header.count() - 1) def _setupColumns(self): *************** *** 742,778 **** item.setDropEnabled(True) ! def __dragEnterEvent(self, e): ! # XXX: Be more specific here: ! e.accept(True) ! def __dragObject(self): ! domain = self._domain ! # Determine selected items. ! items = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! items.append(item) ! iterator += 1 ! # Convert them to suppliers. ! suppliers = [item.supplier() for item in items] ! return ui.qt.dragdrop.dragObject(domain, self, suppliers) ! def __dropEvent(self, e): ! objects = ui.qt.dragdrop.decodeDrop(self._domain, e) ! pos = e.pos() ! pos.setY(pos.y() - self.header().height()) ! item = self.itemAt(pos) ! supplier = None ! if item is not None: ! supplier = item.supplier() ! payload = signal.DomainObjectsDropped( ! sender=self, ! source=e.source(), ! objects=objects, ! onto=supplier, ! ) ! self.emit(payload.signal, (payload,)) def setFilter(self, newFilter): --- 770,809 ---- item.setDropEnabled(True) ! def dragEnterEvent(self, e): ! if self._droppable: ! # XXX: Be more specific here: ! e.accept(True) ! def dragObject(self): ! if self._draggable: ! domain = self._domain ! # Determine selected items. ! items = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! items.append(item) ! iterator += 1 ! # Convert them to suppliers. ! suppliers = [item.supplier() for item in items] ! return ui.qt.dragdrop.dragObject(domain, self, suppliers) ! def dropEvent(self, e): ! if self._droppable: ! objects = ui.qt.dragdrop.decodeDrop(self._domain, e) ! pos = e.pos() ! pos.setY(pos.y() - self.header().height()) ! item = self.itemAt(pos) ! supplier = None ! if item is not None: ! supplier = item.supplier() ! payload = signal.DomainObjectsDropped( ! sender=self, ! source=e.source(), ! objects=objects, ! onto=supplier, ! ) ! self.emit(payload.signal, (payload,)) def setFilter(self, newFilter): |
From: Matthew R. S. <gld...@us...> - 2004-08-04 18:16:28
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10581/pypersyst/ui/qt Modified Files: collection.py Log Message: Extended selection drag and drop support. Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** collection.py 4 Aug 2004 16:46:48 -0000 1.18 --- collection.py 4 Aug 2004 18:16:19 -0000 1.19 *************** *** 23,30 **** def listView(domain, collection, parent=None, draggable=False, ! droppable=False, *args): factory = IListViewWidgetFactory(collection) widget = factory(domain, draggable=draggable, droppable=droppable, ! parent=parent, *args) return widget --- 23,30 ---- def listView(domain, collection, parent=None, draggable=False, ! droppable=False, extendedSelection=False, *args): factory = IListViewWidgetFactory(collection) widget = factory(domain, draggable=draggable, droppable=droppable, ! extendedSelection=extendedSelection, parent=parent, *args) return widget *************** *** 37,45 **** def parentChildListView(domain, parentCollection, childCollection, parentAttribute, draggable=False, droppable=False, ! parent=None, *args): widget = ParentChildListView(domain, parentCollection=parentCollection, childCollection=childCollection, parentAttribute=parentAttribute, draggable=draggable, droppable=droppable, parent=parent, *args) return widget --- 37,46 ---- def parentChildListView(domain, parentCollection, childCollection, parentAttribute, draggable=False, droppable=False, ! extendedSelection=False, parent=None, *args): widget = ParentChildListView(domain, parentCollection=parentCollection, childCollection=childCollection, parentAttribute=parentAttribute, draggable=draggable, droppable=droppable, + extendedSelection=extendedSelection, parent=parent, *args) return widget *************** *** 176,180 **** def __init__(self, domain, parentCollection, childCollection, ! parentAttribute, draggable, droppable, parent, *args): qt.QListView.__init__(self, parent, *args) AutoConnector.__init__(self) --- 177,182 ---- def __init__(self, domain, parentCollection, childCollection, ! parentAttribute, draggable, droppable, extendedSelection, ! parent, *args): qt.QListView.__init__(self, parent, *args) AutoConnector.__init__(self) *************** *** 185,188 **** --- 187,191 ---- self._draggable = draggable self._droppable = droppable + self._extendedSelection = extendedSelection self._hiddenColnames = [] self._setup() *************** *** 204,207 **** --- 207,212 ---- if self._draggable: self.dragObject = self.__dragObject + if self._extendedSelection: + self.setSelectionMode(self.Extended) def _setupColumns(self): *************** *** 267,274 **** def __dragObject(self): domain = self._domain ! item = self.currentItem() ! if item is not None: ! supplier = item.supplier() ! return ui.qt.dragdrop.dragObject(domain, self, [supplier]) def __dropEvent(self, e): --- 272,286 ---- def __dragObject(self): domain = self._domain ! # Determine selected items. ! items = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! items.append(item) ! iterator += 1 ! # Convert them to suppliers. ! suppliers = [item.supplier() for item in items] ! return ui.qt.dragdrop.dragObject(domain, self, suppliers) def __dropEvent(self, e): *************** *** 444,448 **** def __init__(self, domain, collection, parent, name, defaultAction=None, ! filters=None, draggable=False, droppable=False, *args): qt.QWidget.__init__(self, parent, name, *args) AutoConnector.__init__(self) --- 456,461 ---- def __init__(self, domain, collection, parent, name, defaultAction=None, ! filters=None, draggable=False, droppable=False, ! extendedSelection=False, *args): qt.QWidget.__init__(self, parent, name, *args) AutoConnector.__init__(self) *************** *** 456,459 **** --- 469,473 ---- self._draggable = draggable self._droppable = droppable + self._extendedSelection = extendedSelection self._setup() *************** *** 476,480 **** listView = self.listView = ListView( domain, self._collection, self._filters[0], ! draggable=self._draggable, droppable=self._droppable, parent=self) vbox.addWidget(listView, 1) qtsig = signal.DomainObjectsDropped.qtsignal() --- 490,495 ---- listView = self.listView = ListView( domain, self._collection, self._filters[0], ! draggable=self._draggable, droppable=self._droppable, ! extendedSelection=self._extendedSelection, parent=self) vbox.addWidget(listView, 1) qtsig = signal.DomainObjectsDropped.qtsignal() *************** *** 662,666 **** def __init__(self, domain, collection, filter, draggable, droppable, ! parent, *args): self._domain = domain self._collection = collection --- 677,681 ---- def __init__(self, domain, collection, filter, draggable, droppable, ! extendedSelection, parent, *args): self._domain = domain self._collection = collection *************** *** 668,671 **** --- 683,687 ---- self._draggable = draggable self._droppable = droppable + self._extendedSelection = extendedSelection self._hiddenColnames = ['sys.oid'] qt.QListView.__init__(self, parent, *args) *************** *** 687,690 **** --- 703,708 ---- if self._draggable: self.dragObject = self.__dragObject + if self._extendedSelection: + self.setSelectionMode(self.Extended) def _setupColumns(self): *************** *** 730,737 **** def __dragObject(self): domain = self._domain ! item = self.currentItem() ! if item is not None: ! supplier = item.supplier() ! return ui.qt.dragdrop.dragObject(domain, self, [supplier]) def __dropEvent(self, e): --- 748,762 ---- def __dragObject(self): domain = self._domain ! # Determine selected items. ! items = [] ! iterator = qt.QListViewItemIterator(self) ! while iterator.current() is not None: ! item = iterator.current() ! if self.isSelected(item): ! items.append(item) ! iterator += 1 ! # Convert them to suppliers. ! suppliers = [item.supplier() for item in items] ! return ui.qt.dragdrop.dragObject(domain, self, suppliers) def __dropEvent(self, e): |
From: Matthew R. S. <gld...@us...> - 2004-08-04 17:06:07
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/field In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30053/pypersyst/field Modified Files: field.py Log Message: Unit tests and bug fixes for allowNone on fields. Index: field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/field/field.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** field.py 27 Jul 2004 03:40:52 -0000 1.15 --- field.py 4 Aug 2004 17:05:58 -0000 1.16 *************** *** 210,213 **** --- 210,215 ---- def convert(self, value): """Convert the value to a string.""" + if value is None: + return None return str(value) *************** *** 225,228 **** --- 227,232 ---- def convert(self, value): """Convert the value to a Unicode.""" + if value is None: + return None return unicode(value) *************** *** 243,246 **** --- 247,252 ---- def convert(self, value): """Convert the value to an integer.""" + if value is None: + return None return int(value) *************** *** 263,266 **** --- 269,274 ---- def convert(self, value): """Convert the value to a floating point number.""" + if value is None: + return None return float(value) *************** *** 290,293 **** --- 298,303 ---- def convert(self, value): """Convert the value to a monetary value.""" + if value is None: + return None format = '%.' + str(self.fractDigits) + 'f' return float(format % float(value)) *************** *** 310,313 **** --- 320,325 ---- def convert(self, value): """Convert the value to a datetime.datetime object.""" + if value is None: + return None if isinstance(value, types.FloatType): # A factory already exists to create a datetime.datetime *************** *** 339,342 **** --- 351,356 ---- def convert(self, value): """Convert the value to a datetime.datetime object.""" + if value is None: + return None if isinstance(value, types.FloatType): # A factory already exists to create a datetime.datetime *************** *** 432,463 **** '\xde\xf5\xc7\xac\x9b\xfa\xfc\xa6' - def hashEncode(self, value, salt=None): - """Encode a value as a one-way hash and return the hash. - - Override this method if you want to use a different hashing - algorithm. - """ - if salt is None: - salt = '' - for x in xrange(12): - salt += chr(random.randrange(0, 256)) - md = md5.md5() - md.update(salt) - md.update(value) - digest = md.digest() - hashedValue = salt + digest - return self.hashHeader + hashedValue - - def hashCompare(self, value, hashedValue): - """Compare value to one-way hash, returning True if matching. - - Override this method if you want to use a different hashing - algorithm. - """ - headerLen = len(self.hashHeader) - salt = hashedValue[headerLen:headerLen+12] - encodedValue = self.hashEncode(value, salt) - return (encodedValue == hashedValue) - def compare(self, value): """Return True if value matches this field's one way hash.""" --- 446,449 ---- *************** *** 471,474 **** --- 457,462 ---- def convert(self, value): """Return the one-way hash of value.""" + if value is None: + return None if value.startswith(self.hashHeader): # Short-circuit if the value is already hashed. *************** *** 477,480 **** --- 465,496 ---- return self.hashEncode(value) + def hashCompare(self, value, hashedValue): + """Compare value to one-way hash, returning True if matching. + + Override this method if you want to use a different hashing + algorithm. + """ + headerLen = len(self.hashHeader) + salt = hashedValue[headerLen:headerLen+12] + encodedValue = self.hashEncode(value, salt) + return (encodedValue == hashedValue) + + def hashEncode(self, value, salt=None): + """Encode a value as a one-way hash and return the hash. + + Override this method if you want to use a different hashing + algorithm. + """ + if salt is None: + salt = '' + for x in xrange(12): + salt += chr(random.randrange(0, 256)) + md = md5.md5() + md.update(salt) + md.update(value) + digest = md.digest() + hashedValue = salt + digest + return self.hashHeader + hashedValue + # -------------------------------------------------------------------- |
From: Matthew R. S. <gld...@us...> - 2004-08-04 17:06:07
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30053/pypersyst/test Modified Files: test_field.py Log Message: Unit tests and bug fixes for allowNone on fields. Index: test_field.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/test/test_field.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_field.py 23 Jul 2004 17:17:14 -0000 1.6 --- test_field.py 4 Aug 2004 17:05:58 -0000 1.7 *************** *** 63,66 **** --- 63,74 ---- return self.fieldClass(instance=None, attribute=None) + def test_allowNone(self): + f = self.emptyField() + f.allowNone = True + f.assign(None) + self.assertEqual(f.get(), None) + f.set(None) + self.assertEqual(f.get(), None) + def test_convertValuesDefault(self): for value, convertedValue in self.convertValuesDefault: |
From: Matthew R. S. <gld...@us...> - 2004-08-04 16:46:56
|
Update of /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26568/pypersyst/ui/qt Modified Files: collection.py Log Message: Keep scroll-bar position the same upon reset. Index: collection.py =================================================================== RCS file: /cvsroot/pypersyst/pypersyst/pypersyst/ui/qt/collection.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** collection.py 4 Aug 2004 06:05:17 -0000 1.17 --- collection.py 4 Aug 2004 16:46:48 -0000 1.18 *************** *** 289,293 **** --- 289,296 ---- def reset(self): + scroll = self.verticalScrollBar() + scrollValue = scroll.value() self._setupItems() + scroll.setValue(scrollValue) *************** *** 753,757 **** --- 756,763 ---- def reset(self): + scroll = self.verticalScrollBar() + scrollValue = scroll.value() self._setupItems() + scroll.setValue(scrollValue) |