From: Kevin A. <ka...@us...> - 2004-09-18 18:20:45
|
Update of /cvsroot/pythoncard/PythonCard/samples/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17102/samples/dialogs Modified Files: dialogs.py dialogs.rsrc.py Log Message: changed dialogs sample to just use a list added selection and stringSelection attributes to SelectEvent Index: dialogs.rsrc.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.rsrc.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** dialogs.rsrc.py 18 Sep 2004 17:04:21 -0000 1.15 --- dialogs.rsrc.py 18 Sep 2004 18:20:35 -0000 1.16 *************** *** 1,69 **** ! # position and size don't seem to do anything for the stack ! # only the background position and size matter ?! ! ! { 'application':{ 'type':'Application', ! 'name':'Dialogs', ! 'backgrounds': ! [ ! { 'type':'Background', ! 'name':'bg1', ! 'title':'Dialogs', ! 'position':( 5, 5 ), ! 'size':( 500, 410 ), ! 'menubar': ! { ! 'type':'MenuBar', ! 'menus': ! [ ! { 'type':'Menu', ! 'name':'File', ! 'label':'&File', ! 'items': [ ! { 'type':'MenuItem', ! 'name':'menuFileExit', ! 'label':'E&xit\tAlt+X', ! 'command':'exit'} ] } ! ] }, ! 'components': ! [ ! { 'type':'StaticText', 'name':'static1', 'position':( 150, 230 ), 'size':( -1, -1 ), 'text':'' }, ! ! { 'type':'TextArea', 'name':'fldResults', 'position':( 150, 4 ), 'size':( 200, 150 ), 'text':'' }, ! ! #{ 'class':'Button', 'name':'button1', 'position':( 5, 50 ), 'size':( 80, 20 ), 'label':'Button 1' }, ! ! #{ 'type':'Button', 'name':'buttonQuit', 'position':( 5, 5 ), 'size':( 80, 20 ), 'label':'Quit' }, ! { 'type':'Button', 'name':'buttonColor', 'position':( 5, 5 ), 'size':( 80, 20 ), 'label':'Color' }, ! { 'type':'Button', 'name':'buttonFont', 'position':( 5, 35 ), 'size':( 80, 20 ), 'label':'Font' }, ! ! { 'type':'Button', 'name':'buttonTextEntry', 'position':( 5, 160 ), 'size':( 80, 20 ), 'label':'Text Entry' }, ! ! #{ 'class':'Button', 'name':'buttonConfirmation', 'position':( 5, 40 ), 'size':( 80, 20 ), 'label':'Confirmation' }, ! ! { 'type':'Button', 'name':'buttonMessage', 'position':( 5, 70 ), 'size':( 80, 20 ), 'label':'Message' }, ! ! { 'type':'Button', 'name':'buttonFile', 'position':( 5, 100 ), 'size':( 80, 20 ), 'label':'File' }, ! ! { 'type':'Button', 'name':'buttonDir', 'position':( 5, 130 ), 'size':( 80, 20 ), 'label':'Directory' }, ! ! { 'type':'Button', 'name':'buttonScrolledMessage', 'position':( 5, 190 ), 'size':( -1, -1 ), 'label':'Scrolled Message' }, ! ! { 'type':'Button', 'name':'buttonAlert', 'position':( 5, 220 ), 'size':( -1, -1 ), 'label':'Alert' }, ! ! { 'type':'Button', 'name':'buttonFind', 'position':( 5, 250 ), 'size':( -1, -1 ), 'label':'Find' }, ! ! { 'type':'Button', 'name':'buttonSingleChoice', 'position':( 5, 280 ), 'size':( -1, -1 ), 'label':'Single Choice' }, ! ! { 'type':'Button', 'name':'buttonMultipleChoice', 'position':( 5, 310 ), 'size':( -1, -1 ), 'label':'Multiple Choice' }, ! ! { 'type':'Button', 'name':'buttonMinimalDialog', 'position':( 5, 340 ), 'size':( -1, -1 ), 'label':'Minimal Dialog' }, ! ] ! } ! ] ! } ! } --- 1,42 ---- ! {'application':{'type':'Application', ! 'name':'Dialogs', ! 'backgrounds': [ ! {'type':'Background', ! 'name':'bg1', ! 'title':'Dialogs', ! 'size':(409, 311), ! 'menubar': {'type':'MenuBar', ! 'menus': [ ! {'type':'Menu', ! 'name':'File', ! 'label':'&File', ! 'items': [ ! {'type':'MenuItem', ! 'name':'menuFileExit', ! 'label':'E&xit\tAlt+X', ! 'command':'exit', ! }, ! ] ! }, ! ] ! }, ! 'components': [ ! {'type':'List', ! 'name':'listDialogs', ! 'position':(4, 5), ! 'size':(141, 219), ! 'items':['alert', 'color', 'directory', 'file', 'find', 'font', 'message', 'multiple choice', 'open file', 'save file', 'single choice', 'scrolled message', 'text entry', 'minimal'], }, ! {'type':'TextArea', ! 'name':'fldResults', ! 'position':(151, 5), ! 'size':(240, 219), ! }, + ] # end components + } # end background + ] # end backgrounds + } } Index: dialogs.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dialogs/dialogs.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** dialogs.py 17 Aug 2004 19:11:51 -0000 1.25 --- dialogs.py 18 Sep 2004 18:20:30 -0000 1.26 *************** *** 4,15 **** __version__ = "$Revision$" __date__ = "$Date$" - - Note that there is a window refresh issue with the code below. - I'm setting a multiline static text field, which is dynamically - resizing the static text field to fit the content. If you resize - or hide the window then the text appears okay. """ - import time from PythonCard import dialog, model import os, sys --- 4,9 ---- *************** *** 17,25 **** import minimalDialog - # KEA what kind of name conflicts do we need to watch for - # with the class name? the class was called Proof, but I renamed - # it Dialogs class Dialogs(model.Background): def on_buttonMultipleChoice_mouseClick(self, event): result = dialog.multipleChoiceDialog(self, "message", "title", ['one', 'two', 'three']) --- 11,37 ---- import minimalDialog class Dialogs(model.Background): + def on_listDialogs_select(self, event): + name = event.stringSelection + handlers = { + 'alert':self.on_buttonAlert_mouseClick, + 'color':self.on_buttonColor_mouseClick, + 'directory':self.on_buttonDir_mouseClick, + 'file':self.on_buttonFile_mouseClick, + 'find':self.on_buttonFind_mouseClick, + 'font':self.on_buttonFont_mouseClick, + 'message':self.on_buttonMessage_mouseClick, + 'multiple choice':self.on_buttonMultipleChoice_mouseClick, + 'scrolled message':self.on_buttonScrolledMessage_mouseClick, + 'single choice':self.on_buttonSingleChoice_mouseClick, + 'open file':self.on_buttonOpenFile_mouseClick, + 'save file':self.on_buttonSaveFile_mouseClick, + 'text entry':self.on_buttonTextEntry_mouseClick, + 'minimal':self.on_buttonMinimalDialog_mouseClick, + } + # call the appropriate handler + handlers[name](None) + def on_buttonMultipleChoice_mouseClick(self, event): result = dialog.multipleChoiceDialog(self, "message", "title", ['one', 'two', 'three']) |