From: Kevin A. <ka...@us...> - 2004-08-22 20:56:46
|
Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29218/tools/resourceEditor/modules Modified Files: stringDialog.py Log Message: refactored selection code so exception wouldn't be thrown Index: stringDialog.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/modules/stringDialog.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stringDialog.py 22 Aug 2004 19:11:35 -0000 1.11 --- stringDialog.py 22 Aug 2004 20:56:34 -0000 1.12 *************** *** 30,33 **** --- 30,44 ---- self.parent = aBg + """ + # KEA 2004-08-22 + # workaround/hack to make sure closeField message + # is processed prior to the dialog being closed + # this occurs when one of the fields are edited and then + # the user clicks Ok + # this hack works because we don't process on_close + # the first time, but rather delay it by posting a second close message + self.closeDialog = False + """ + # if some special setup is necessary, do it here self.stringList = stringList *************** *** 35,39 **** sortedStrings.sort() for s in sortedStrings: ! label = s + SPACER + self.stringList[s].split('\n')[0] self.components.listStrings.append(label) --- 46,50 ---- sortedStrings.sort() for s in sortedStrings: ! label = self.getLabelFromKey(s) self.components.listStrings.append(label) *************** *** 44,49 **** return stringList def updateItemLabel(self, n, key): ! label = key + SPACER + self.stringList[key].split('\n')[0] self.components.listStrings.setString(n, label) --- 55,63 ---- return stringList + def getLabelFromKey(self, key): + return key + SPACER + self.stringList[key].split('\n')[0] + def updateItemLabel(self, n, key): ! label = self.getLabelFromKey(key) self.components.listStrings.setString(n, label) *************** *** 97,101 **** s = NEWSTRING if s in self.stringList: ! self.components.listStrings.stringSelection = s else: self.stringList[s] = '' --- 111,115 ---- s = NEWSTRING if s in self.stringList: ! self.components.listStrings.stringSelection = self.getLabelFromKey(s) else: self.stringList[s] = '' *************** *** 106,109 **** --- 120,142 ---- self.displayItemAttributes(self.getStringSelectionKey()) + """ + # KEA 2004-08-22 + # experiment to workaround Mac closeField bug + # ignore for now along with the extra debug print statements in closeField + # event handlers above + def on_mouseClick(self, event): + try: + print self.closeDialog + print event.target.name + print event.target.id + except: + pass + if self.closeDialog: + event.skip() + else: + self.closeDialog = True + wx.PostEvent(self, event) + """ + def stringDialog(parent, rsrc): |