Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2012 Vaadin Ltd. 2 # Copyright (C) 2012 Richard Lincoln 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 from time import sleep 17 18 from threading import Thread 19 20 from muntjac.application import Application 21 from muntjac.ui.window import Window 22 from muntjac.ui.label import Label 23 from muntjac.addon.refresher.refresher import Refresher, RefreshListener 24 252746 47 4829 super(RefresherApplication, self).__init__() 30 31 self._databaseResult = None 32 self._content = None33 3436 mainWindow = Window('Refresher Database Example') 37 self.setMainWindow(mainWindow) 38 # present with a loading contents. 39 self._content = Label('please wait while the database is queried') 40 mainWindow.addComponent(self._content) 41 # the Refresher polls automatically 42 refresher = Refresher() 43 refresher.addListener(DatabaseListener(self)) 44 mainWindow.addComponent(refresher) 45 DatabaseQueryProcess(self).start()5061 62 80 81 82 if __name__ == '__main__': 83 from muntjac.main import muntjac 84 muntjac(RefresherApplication, nogui=True, debug=True, 85 contextRoot='.') 8652 self._app = app5355 if self._app._databaseResult is not None: 56 # stop polling 57 source.setEnabled(False) 58 # replace the "loading" with the actual fetched result 59 self._app._content.setValue('Database result was: ' + 60 self._app._databaseResult)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Apr 20 16:53:14 2013 | http://epydoc.sourceforge.net |