Changeset 295
- Timestamp:
- 05/24/04 17:44:27 (5 years ago)
- Files:
-
- trunk/common/dObject.py (modified) (2 diffs)
- trunk/dSecurityManager.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dAbout.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dControlMixin.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dDataControlMixin.py (modified) (5 diffs)
- trunk/ui/uiwx/classes/dFormDataNav.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dFormMain.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dFormMixin.py (modified) (8 diffs)
- trunk/ui/uiwx/classes/dGridDataNav.py (modified) (17 diffs)
- trunk/ui/uiwx/classes/dLogin.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dMenu.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dPage.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dPageDataNav.py (modified) (22 diffs)
- trunk/ui/uiwx/classes/dPageFrameDataNav.py (modified) (1 diff)
- trunk/ui/uiwx/classes/dPemMixin.py (modified) (3 diffs)
- trunk/ui/uiwx/uiApp.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/common/dObject.py
r294 r295 20 20 21 21 22 def _get DApp(self):22 def _getApplication(self): 23 23 # dApp saves a ref to itself inside the dabo module object. 24 24 return dabo.dAppRef 25 25 26 26 27 def _getDForm(self):28 """ Return a reference to the containing dForm.29 """30 try:31 return self._dFormCached32 except AttributeError:33 import dabo.ui34 obj, frm = self, None35 while obj:36 parent = obj.GetParent()37 if isinstance(parent, dabo.ui.dForm):38 frm = parent39 break40 else:41 obj = parent42 if frm:43 self._dFormCached = frm # Cache for next time44 return frm45 46 47 27 def _getClass(self): 48 28 try: … … 86 66 87 67 88 dApp = property(_getDApp, None, None,68 Application = property(_getApplication, None, None, 89 69 'Object reference to the Dabo Application object. (read only).') 90 dForm = property(_getDForm, None, None,91 'Object reference to the dForm containing the object. (read only).')92 70 Name = property(_getName, _setName, None, 93 71 'The name of the object. (str)') trunk/dSecurityManager.py
r291 r295 32 32 else: 33 33 message = _("Please enter your login information.") 34 user, password = self. dApp.uiApp.getLoginInfo(message)34 user, password = self.Application.uiApp.getLoginInfo(message) 35 35 36 36 if user is None: trunk/ui/uiwx/classes/dAbout.py
r190 r295 62 62 </html> 63 63 ''' 64 def __init__(self, parent, dApp=None):64 def __init__(self, parent, app=None): 65 65 wx.Dialog.__init__(self, parent, -1, '') 66 66 html = wx.html.HtmlWindow(self, -1, size=(420, -1)) 67 67 py_version = sys.version.split()[0] 68 if dApp:69 dabo_version = dApp.getAppInfo("appVersion")70 dabo_appName = dApp.getAppInfo("appName")68 if app: 69 dabo_version = app.getAppInfo("appVersion") 70 dabo_appName = app.getAppInfo("appName") 71 71 else: 72 72 dabo_version = "?" trunk/ui/uiwx/classes/dControlMixin.py
r294 r295 28 28 """ 29 29 try: 30 self. dForm.addControl(self)30 self.Form.addControl(self) 31 31 except AttributeError: 32 32 # perhaps the form isn't a dForm trunk/ui/uiwx/classes/dDataControlMixin.py
r294 r295 52 52 if not self.bizobj: 53 53 # Ask the form for the bizobj reference, and cache for next time 54 self.bizobj = self. dForm.getBizobj(self.DataSource)54 self.bizobj = self.Form.getBizobj(self.DataSource) 55 55 return self.bizobj.getFieldVal(self.DataField) 56 56 … … 61 61 if not self.bizobj: 62 62 # Ask the form for the bizobj reference, and cache for next time 63 self.bizobj = self. dForm.getBizobj(self.DataSource)63 self.bizobj = self.Form.getBizobj(self.DataSource) 64 64 return self.bizobj.setFieldVal(self.DataField, value) 65 65 … … 86 86 87 87 try: 88 if self.SelectOnEntry and self. dForm.FindFocus() == self:88 if self.SelectOnEntry and self.Form.FindFocus() == self: 89 89 self.selectAll() 90 90 except AttributeError: … … 148 148 """ 149 149 try: 150 dApp = self.dForm.dApp151 except AttributeError: 152 dApp = None150 app = self.Application 151 except AttributeError: 152 app = None 153 153 154 154 # It is too late to get Value directly: 155 155 value = self._oldVal 156 156 157 if dApp:157 if app: 158 158 name = self.getAbsoluteName() 159 dApp.setUserSetting("%s.Value" % name, self.getShortDataType(value), value)159 app.setUserSetting("%s.Value" % name, self.getShortDataType(value), value) 160 160 161 161 … … 164 164 """ 165 165 try: 166 dApp = self.dApp167 except AttributeError: 168 dApp = None169 170 if dApp:166 app = self.Application 167 except AttributeError: 168 app = None 169 170 if app: 171 171 name = self.getAbsoluteName() 172 value = dApp.getUserSetting("%s.Value" % name)172 value = app.getUserSetting("%s.Value" % name) 173 173 174 174 try: trunk/ui/uiwx/classes/dFormDataNav.py
r288 r295 55 55 if isinstance(self, wx.MDIChildFrame): 56 56 # Toolbar will be attached to top-level frame 57 controllingFrame = self. dApp.mainFrame57 controllingFrame = self.Application.mainFrame 58 58 else: 59 59 # Toolbar will be attached to this frame trunk/ui/uiwx/classes/dFormMain.py
r292 r295 16 16 """ This is the main top-level form for the application. 17 17 """ 18 def __init__(self , dApp=None):18 def __init__(self): 19 19 20 20 self._baseClass = dFormMain trunk/ui/uiwx/classes/dFormMixin.py
r292 r295 16 16 17 17 if self.Parent == wx.GetApp().GetTopWindow(): 18 self. dApp.uiForms.add(self)18 self.Application.uiForms.add(self) 19 19 20 20 self.restoredSP = False 21 21 22 if self. dApp:22 if self.Application: 23 23 try: 24 24 self.SetMenuBar(mnb.dMainMenuBar(self)) … … 64 64 def OnClose(self, event): 65 65 if self.GetParent() == wx.GetApp().GetTopWindow(): 66 self. dApp.uiForms.remove(self)66 self.Application.uiForms.remove(self) 67 67 self.saveSizeAndPosition() 68 68 event.Skip() … … 82 82 and set those properties on this form. 83 83 """ 84 if self. dApp:84 if self.Application: 85 85 name = self.getAbsoluteName() 86 86 87 left = self. dApp.getUserSetting("%s.left" % name)88 top = self. dApp.getUserSetting("%s.top" % name)89 width = self. dApp.getUserSetting("%s.width" % name)90 height = self. dApp.getUserSetting("%s.height" % name)87 left = self.Application.getUserSetting("%s.left" % name) 88 top = self.Application.getUserSetting("%s.top" % name) 89 width = self.Application.getUserSetting("%s.width" % name) 90 height = self.Application.getUserSetting("%s.height" % name) 91 91 92 92 if (type(left), type(top)) == (type(int()), type(int())): … … 99 99 """ Save the current size and position of this form. 100 100 """ 101 if self. dApp:101 if self.Application: 102 102 if self == wx.GetApp().GetTopWindow(): 103 for form in self. dApp.uiForms:103 for form in self.Application.uiForms: 104 104 try: 105 105 form.saveSizeAndPosition() … … 112 112 size = self.GetSize() 113 113 114 self. dApp.setUserSetting("%s.left" % name, "I", pos[0])115 self. dApp.setUserSetting("%s.top" % name, "I", pos[1])116 self. dApp.setUserSetting("%s.width" % name, "I", size[0])117 self. dApp.setUserSetting("%s.height" % name, "I", size[1])114 self.Application.setUserSetting("%s.left" % name, "I", pos[0]) 115 self.Application.setUserSetting("%s.top" % name, "I", pos[1]) 116 self.Application.setUserSetting("%s.width" % name, "I", size[0]) 117 self.Application.setUserSetting("%s.height" % name, "I", size[1]) 118 118 119 119 … … 126 126 """ 127 127 if isinstance(self, wx.MDIChildFrame): 128 controllingFrame = self. dApp.mainFrame128 controllingFrame = self.Application.mainFrame 129 129 else: 130 130 controllingFrame = self … … 140 140 141 141 if isinstance(self, wx.MDIChildFrame): 142 controllingFrame = self. dApp.mainFrame142 controllingFrame = self.Application.mainFrame 143 143 else: 144 144 controllingFrame = self … … 159 159 160 160 if isinstance(self, wx.MDIChildFrame): 161 controllingFrame = self. dApp.mainFrame161 controllingFrame = self.Application.mainFrame 162 162 else: 163 163 controllingFrame = self trunk/ui/uiwx/classes/dGridDataNav.py
r294 r295 16 16 wx.grid.PyGridTableBase.__init__(self) 17 17 18 self.bizobj = parent. dForm.getBizobj(parent.DataSource)18 self.bizobj = parent.Form.getBizobj(parent.DataSource) 19 19 self.grid = parent 20 20 … … 43 43 for column in range(len(self.grid.columnDefs)): 44 44 if self.grid.columnDefs[column]['showGrid']: 45 order = self.grid. dApp.getUserSetting("%s.%s.%s.%s" % (46 self.grid. dForm.Name,45 order = self.grid.Application.getUserSetting("%s.%s.%s.%s" % ( 46 self.grid.Form.Name, 47 47 self.grid.Name, 48 48 "Column%s" % column, … … 129 129 fieldType = column['type'] 130 130 131 width = self.grid. dApp.getUserSetting("%s.%s.%s.%s" % (132 self.grid. dForm.Name,131 width = self.grid.Application.getUserSetting("%s.%s.%s.%s" % ( 132 self.grid.Form.Name, 133 133 self.grid.GetName(), 134 134 colName, … … 208 208 column = self.grid.columnDefs[relativeColumn] 209 209 if column['showGrid']: 210 self.grid. dApp.setUserSetting("%s.%s.%s.%s" % (211 self.grid. dForm.Name,210 self.grid.Application.setUserSetting("%s.%s.%s.%s" % ( 211 self.grid.Form.Name, 212 212 self.grid.Name, 213 213 "Column%s" % index, … … 298 298 299 299 # Get the default row size from dApp's user settings 300 s = self. dApp.getUserSetting("%s.%s.%s" % (301 self. dForm.Name,300 s = self.Application.getUserSetting("%s.%s.%s" % ( 301 self.Form.Name, 302 302 self.GetName(), 303 303 "RowSize")) … … 316 316 width = self.GetColSize(col) 317 317 318 self. dApp.setUserSetting("%s.%s.%s.%s" % (319 self. dForm.Name,318 self.Application.setUserSetting("%s.%s.%s.%s" % ( 319 self.Form.Name, 320 320 self.Name, 321 321 "Column%s" % self.GetTable().relativeColumns[col], … … 333 333 if oldRow != newRow: 334 334 try: 335 self. dForm.getBizobj(self.DataSource).setRowNumber(newRow)335 self.Form.getBizobj(self.DataSource).setRowNumber(newRow) 336 336 except dException.dException: 337 337 pass 338 self. dForm.refreshControls()338 self.Form.refreshControls() 339 339 event.Skip() 340 340 … … 487 487 By default, this is interpreted as a request to edit the record. 488 488 """ 489 if self. dForm.FormType == 'PickList':489 if self.Form.FormType == 'PickList': 490 490 self.pickRecord() 491 491 else: … … 536 536 537 537 if keyCode == 13: # Enter 538 if self. dForm.FormType == "PickList":538 if self.Form.FormType == "PickList": 539 539 self.pickRecord() 540 540 else: … … 542 542 else: 543 543 if keyCode == 127: # Del 544 if self. dForm.FormType != "PickList":544 if self.Form.FormType != "PickList": 545 545 self.deleteRecord() 546 546 elif keyCode == 343: # F2 547 547 self.processSort() 548 elif keyCode == 27 and self. dForm.FormType == "PickList": # Esc549 self. dForm.Close()548 elif keyCode == 27 and self.Form.FormType == "PickList": # Esc 549 self.Form.Close() 550 550 elif char and (char.isalnum() or char.isspace()) and not evt.HasModifiers(): 551 551 self.addToIncrementalSearch(char) … … 575 575 """ The form is a picklist, and the user picked a record. 576 576 """ 577 self. dForm.pickRecord()577 self.Form.pickRecord() 578 578 579 579 … … 601 601 602 602 try: 603 self. dForm.getBizobj(self.DataSource).sort(columnToSort, sortOrder)603 self.Form.getBizobj(self.DataSource).sort(columnToSort, sortOrder) 604 604 self.sortedColumn = gridCol 605 605 self.sortOrder = sortOrder … … 620 620 cursorCol = self.GetTable().colNames[gridCol] 621 621 622 row = self. dform.getBizobj(self.DataSource).seek(self.currentIncrementalSearch, cursorCol,622 row = self.Form.getBizobj(self.DataSource).seek(self.currentIncrementalSearch, cursorCol, 623 623 caseSensitive=False, near=True) 624 624 … … 629 629 # Add a '.' to the status bar to signify that the search is 630 630 # done, and clear the search string for next time. 631 self. dForm.setStatusText('Search: %s.'631 self.Form.setStatusText('Search: %s.' 632 632 % self.currentIncrementalSearch) 633 633 self.currentIncrementalSearch = '' … … 643 643 644 644 self.currentIncrementalSearch = ''.join((self.currentIncrementalSearch, key)) 645 self. dForm.setStatusText('Search: %s'645 self.Form.setStatusText('Search: %s' 646 646 % self.currentIncrementalSearch) 647 647 … … 656 656 popup = wx.Menu() 657 657 658 if self. dForm.FormType == 'PickList':658 if self.Form.FormType == 'PickList': 659 659 id_pick = wx.NewId() 660 660 item = wx.MenuItem(popup, id_pick, "&Pick", "Pick this record") … … 697 697 698 698 # Persist the new size 699 self. dApp.setUserSetting("%s.%s.%s" % (700 self. dForm.Name,699 self.Application.setUserSetting("%s.%s.%s" % ( 700 self.Form.Name, 701 701 self.Name, 702 702 "RowSize"), "I", size) trunk/ui/uiwx/classes/dLogin.py
r292 r295 44 44 def initProperties(self): 45 45 dLogin.doDefault() 46 if self. dApp:47 appName = self. dApp.getAppInfo("appName")46 if self.Application: 47 appName = self.Application.getAppInfo("appName") 48 48 else: 49 49 appName = '' trunk/ui/uiwx/classes/dMenu.py
r232 r295 7 7 if mainFrame: 8 8 self.mainFrame = mainFrame 9 self.actionList = mainFrame. dApp.actionList9 self.actionList = mainFrame.Application.actionList 10 10 dMenu.doDefault() trunk/ui/uiwx/classes/dPage.py
r294 r295 47 47 Subclasses may override. 48 48 """ 49 self. dForm.activeControlValid()49 self.Form.activeControlValid() 50 50 pass 51 51 trunk/ui/uiwx/classes/dPageDataNav.py
r294 r295 124 124 125 125 def requery(self): 126 bizobj = self. dForm.getBizobj()126 bizobj = self.Form.getBizobj() 127 127 where = self.getWhere() 128 128 bizobj.setWhereClause(where) … … 142 142 bizobj.setSQL(sql) 143 143 144 self. dForm.requery()144 self.Form.requery() 145 145 146 146 if self.GetParent().GetSelection() == 0: … … 150 150 151 151 def _getSelectOptionsPanel(self): 152 dataSource = self. dForm.getBizobj().DataSource153 columnDefs = self. dForm.getColumnDefs(dataSource)152 dataSource = self.Form.getBizobj().DataSource 153 columnDefs = self.Form.getColumnDefs(dataSource) 154 154 panel = SelectOptionsPanel(self) 155 155 … … 321 321 322 322 def updateGrid(self): 323 bizobj = self. dForm.getBizobj()323 bizobj = self.Form.getBizobj() 324 324 if bizobj and bizobj.getRowCount() >= 0: 325 325 if not self.itemsCreated: … … 328 328 self.fillGrid() 329 329 330 row = self. dForm.getBizobj().getRowNumber()330 row = self.Form.getBizobj().getRowNumber() 331 331 col = self.BrowseGrid.GetGridCursorCol() 332 332 self.BrowseGrid.SetGridCursor(row, col) … … 340 340 341 341 def createItems(self): 342 bizobj = self. dForm.getBizobj()342 bizobj = self.Form.getBizobj() 343 343 grid = self.addObject(dGridDataNav.dGridDataNav, 'BrowseGrid') 344 344 grid.DataSource = bizobj.DataSource 345 345 self.GetSizer().Add(grid, 1, wx.EXPAND) 346 grid.columnDefs = self. dForm.getColumnDefs(bizobj.DataSource)346 grid.columnDefs = self.Form.getColumnDefs(bizobj.DataSource) 347 347 348 348 preview = self.addObject(dCommandButton.dCommandButton, 'cmdPreview') … … 355 355 356 356 def fillGrid(self): 357 bizobj = self. dForm.getBizobj()357 bizobj = self.Form.getBizobj() 358 358 self.BrowseGrid.fillGrid() 359 359 self.GetSizer().Layout() … … 363 363 364 364 def newRecord(self): 365 self. dForm.new()365 self.Form.new() 366 366 self.editRecord() 367 367 368 368 369 369 def deleteRecord(self): 370 self. dForm.delete()370 self.Form.delete() 371 371 372 372 … … 379 379 if self.itemsCreated: 380 380 html = self.grid.getHTML(justStub=False) 381 win = wx.html.HtmlEasyPrinting("Dabo Quick Print", self. dForm)381 win = wx.html.HtmlEasyPrinting("Dabo Quick Print", self.Form) 382 382 printData = win.GetPrintData() 383 383 setupData = win.GetPageSetupData() … … 391 391 #s#etupData.SetMarginBottomRight((17,5)) 392 392 # # setupData.SetOrientation(wx.LANDSCAPE) 393 win.SetHeader("<B>%s</B>" % (self. dForm.Caption,))393 win.SetHeader("<B>%s</B>" % (self.Form.Caption,)) 394 394 win.SetFooter("<CENTER>Page @PAGENUM@ of @PAGESCNT@</CENTER>") 395 395 #win.PageSetup() … … 409 409 410 410 def onValueRefresh(self, event=None): 411 form = self. dForm411 form = self.Form 412 412 bizobj = form.getBizobj() 413 413 if bizobj and bizobj.getRowCount() >= 0: … … 420 420 421 421 def createItems(self): 422 dataSource = self. dForm.getBizobj().DataSource423 columnDefs = self. dForm.getColumnDefs(dataSource)422 dataSource = self.Form.getBizobj().DataSource 423 columnDefs = self.Form.getColumnDefs(dataSource) 424 424 425 425 for column in columnDefs: … … 465 465 label.Caption = '%s:' % column['caption'] 466 466 467 if self. dForm.getBizobj().getRowCount() >= 0:467 if self.Form.getBizobj().getRowCount() >= 0: 468 468 objectRef.refresh() 469 469 … … 490 490 dChildViewPage.doDefault(parent, 'pageChildView') 491 491 self.dataSource = dataSource 492 self.bizobj = self. dForm.getBizobj().getChildByDataSource(self.dataSource)492 self.bizobj = self.Form.getBizobj().getChildByDataSource(self.dataSource) 493 493 self.pickListRef = None 494 494 … … 516 516 517 517 def createItems(self): 518 cb = self. dForm.getChildBehavior(self.dataSource)518 cb = self.Form.getChildBehavior(self.dataSource) 519 519 if cb['EnableNew']: 520 520 nb = self.addObject(dCommandButton.dCommandButton, 'cmdNew') … … 530 530 531 531 def fillGrid(self): 532 self.ChildViewGrid.columnDefs = self. dForm.getColumnDefs(self.dataSource)532 self.ChildViewGrid.columnDefs = self.Form.getColumnDefs(self.dataSource) 533 533 self.ChildViewGrid.fillGrid() 534 534 self.GetSizer().Layout() … … 540 540 pickBizobj = evt.GetEventObject().getBizobj() 541 541 pickedPK = pickBizobj.getPK() 542 cb = self. dForm.getChildBehavior(self.dataSource)542 cb = self.Form.getChildBehavior(self.dataSource) 543 543 try: 544 544 fkField = cb['FK'] … … 563 563 564 564 def newRecord(self, evt=None): 565 cb = self. dForm.getChildBehavior(self.dataSource)565 cb = self.Form.getChildBehavior(self.dataSource) 566 566 if cb['EnableNew']: 567 567 try: … … 588 588 self.Caption = "Picklist: %s" % self.Caption 589 589 590 ref = PickList(self. dForm)590 ref = PickList(self.Form) 591 591 self.pickListRef = ref 592 592 … … 608 608 """ Ask the bizobj to delete the current record. 609 609 """ 610 cb = self. dForm.getChildBehavior(self.dataSource)610 cb = self.Form.getChildBehavior(self.dataSource) 611 611 if cb['EnableDelete']: 612 612 message = _("This will delete the highlighted child record, and cannot " … … 615 615 try: 616 616 self.bizobj.delete() 617 self. dForm.setStatusText(_("Child record deleted."))617 self.Form.setStatusText(_("Child record deleted.")) 618 618 except dException.dException, e: 619 619 dMessageBox.stop("Delete failed with response:\n%s" % str(e)) … … 624 624 625 625 def editRecord(self): 626 cb = self. dForm.getChildBehavior(self.dataSource)626 cb = self.Form.getChildBehavior(self.dataSource) 627 627 if cb['EnableEdit']: 628 628 dMessageBox.stop("Editing childview records isn't supported yet.") trunk/ui/uiwx/classes/dPageFrameDataNav.py
r294 r295 29 29 self.AssignImageList(il) 30 30 31 if self. dForm.FormType != 'Edit':31 if self.Form.FormType != 'Edit': 32 32 self.AddPage(self.SelectPageClass(self), 'Select', imageId=0) 33 33 self.AddPage(self.BrowsePageClass(self), 'Browse', imageId=1) 34 34 35 if self. dForm.FormType != 'PickList':35 if self.Form.FormType != 'PickList': 36 36 self.AddPage(self.EditPageClass(self), 'Edit', imageId=2) 37 37 trunk/ui/uiwx/classes/dPemMixin.py
r288 r295 244 244 # Property get/set/delete methods follow. 245 245 246 def _getForm(self): 247 """ Return a reference to the containing Form. 248 """ 249 try: 250 return self._cachedForm 251 except AttributeError: 252 import dabo.ui 253 obj, frm = self, None 254 while obj: 255 parent = obj.Parent 256 if isinstance(parent, dabo.ui.dForm): 257 frm = parent 258 break 259 else: 260 obj = parent 261 if frm: 262 self._cachedForm = frm # Cache for next time 263 return frm 264 265 246 266 def _getFont(self): 247 267 return self._pemObject.GetFont() … … 358 378 parent = self._pemObject.GetParent() 359 379 if parent: 360 if not self. dApp or self.dApp.AutoNegotiateUniqueNames:380 if not self.Application or self.Application.AutoNegotiateUniqueNames: 361 381 i = 0 362 382 while True: … … 525 545 526 546 # Property definitions follow 547 Form = property(_getForm, None, None, 548 'Object reference to the dForm containing the object. (read only).') 549 527 550 WindowHandle = property(_getWindowHandle, None, None, 528 551 'The platform-specific handle for the window. Read-only. (long)') trunk/ui/uiwx/uiApp.py
r291 r295 27 27 self.dApp = dApp 28 28 29 self.mainFrame = dFormMain( dApp)29 self.mainFrame = dFormMain() 30 30 self.SetTopWindow(self.mainFrame) 31 31
