]> git.saurik.com Git - wxWidgets.git/commitdiff
0.1.5-2
authorRoman Rolinsky <rolinsky@femagsoft.com>
Thu, 26 May 2005 01:10:05 +0000 (01:10 +0000)
committerRoman Rolinsky <rolinsky@femagsoft.com>
Thu, 26 May 2005 01:10:05 +0000 (01:10 +0000)
-------

Using wx.GetDefaultPyEncoding/wx.SetDefaultPyEncoding for changing active encoding.

Fixed pasting siblings (Ctrl key pressed while pasting).

Dealed with ascii build (Python does not recognize 'ascii' as valid encoding).
If encoding is not specified it is not written in XRC. Will add more
customization in the future.

Changed to use SimpleTool instead or Toggle tool (does not work on Win32).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/wx/tools/XRCed/CHANGES.txt
wxPython/wx/tools/XRCed/globals.py
wxPython/wx/tools/XRCed/panel.py
wxPython/wx/tools/XRCed/tree.py
wxPython/wx/tools/XRCed/xrced.py
wxPython/wx/tools/XRCed/xrced.xrc
wxPython/wx/tools/XRCed/xxx.py

index 743ae3640a9549eb84cbc109c07a946c3f3cdc52..8f9a6e04f21a7a75a44212eb0765e784a429f108 100644 (file)
@@ -5,6 +5,12 @@ Using wx.GetDefaultPyEncoding/wx.SetDefaultPyEncoding for changing active encodi
 
 Fixed pasting siblings (Ctrl key pressed while pasting).
 
+Dealed with ascii build (Python does not recognize 'ascii' as valid encoding).
+If encoding is not specified it is not written in XRC. Will add more
+customization in the future.
+
+Changed to use SimpleTool instead or Toggle tool (does not work on Win32).
+
 0.1.5-1
 -------
 
index 18dae74e4a2093c024d71dc04e18742d89adc5f6..6ab35862d9ae2df72086b8cd028ff601336f4958 100644 (file)
@@ -4,7 +4,6 @@
 # Created:      02.12.2002
 # RCS-ID:       $Id$
 
-import wx
 from wxPython.wx import *
 from wxPython.xrc import *
 try:
@@ -18,8 +17,10 @@ import sys
 progname = 'XRCed'
 version = '0.1.5-2'
 # Can be changed to set other default encoding different
-#defaultEncoding = sys.getdefaultencoding()
-defaultEncoding = wx.GetDefaultPyEncoding()
+defaultEncoding = ''
+# you comment above and can uncomment this:
+#import wx
+#defaultEncoding = wx.GetDefaultPyEncoding()
 
 try:
     True
index 902c0612f5ade41244125556e28ac65fe3b61c87..063061e703da28cf7573e82e4eba83674095102a 100644 (file)
@@ -13,6 +13,7 @@ class Panel(wxNotebook):
     def __init__(self, parent, id = -1):
         if wxPlatform != '__WXMAC__':   # some problems with this style on macs
             wxNotebook.__init__(self, parent, id, style=wxNB_BOTTOM)
+            self.SetBackgroundColour(parent.GetBackgroundColour())
         else:
             wxNotebook.__init__(self, parent, id)
         global panel
index c3df6a0ee123c6a6cfb7aea4f6d03192e300ad72..95fa519d1e937491d9d8d74b26da203e4de60e35 100644 (file)
@@ -19,7 +19,10 @@ class MemoryFile:
         self.name = name
         self.buffer = ''
     def write(self, data):
-        self.buffer += data.encode(g.currentEncoding)
+        if g.currentEncoding:
+            self.buffer += data.encode(g.currentEncoding)
+        else:
+            self.buffer += data.encode()
     def close(self):
         wxMemoryFSHandler_AddFile(self.name, self.buffer)
 
@@ -355,6 +358,8 @@ class HighLightBox:
     def Remove(self):
         map(wxWindow.Destroy, self.lines)
         g.testWin.highLight = None
+    def Refresh(self):
+        map(wxWindow.Refresh, self.lines)
 
 ################################################################################
 
@@ -648,6 +653,7 @@ class XML_Tree(wxTreeCtrl):
             g.testWin.highLight.Replace(pos, size)
         else:
             g.testWin.highLight = HighLightBox(pos, size)
+        g.testWin.highLight.Refresh()
         g.testWin.highLight.item = item
 
     def ShowTestWindow(self, item):
@@ -769,7 +775,7 @@ class XML_Tree(wxTreeCtrl):
         memFile.close()                 # write to wxMemoryFS
         xmlFlags = wxXRC_NO_SUBCLASSING
         # Use translations if encoding is not specified
-        if g.currentEncoding == 'ascii':
+        if not g.currentEncoding:
             xmlFlags != wxXRC_USE_LOCALE
         res = wxXmlResource('', xmlFlags)
         res.Load('memory:xxx.xrc')
index fed12e47c44135408f1a83807e8be362d7ae8255..721198dd7a6dd54e46c05c19d9a0a73e3190a959 100644 (file)
@@ -198,9 +198,9 @@ class Frame(wxFrame):
         tb.AddSimpleTool(wxID_COPY, copy_bmp, 'Copy', 'Copy')
         tb.AddSimpleTool(self.ID_TOOL_PASTE, paste_bmp, 'Paste', 'Paste')
         tb.AddControl(wxStaticLine(tb, -1, size=(-1,23), style=wxLI_VERTICAL))
-        tb.AddCheckTool(self.ID_TOOL_LOCATE,
-                        images.getLocateBitmap(), images.getLocateArmedBitmap(),
-                        'Locate', 'Locate control in test window and select it')
+        tb.AddSimpleTool(self.ID_TOOL_LOCATE,
+                        images.getLocateBitmap(), #images.getLocateArmedBitmap(),
+                        'Locate', 'Locate control in test window and select it', True)
         tb.AddControl(wxStaticLine(tb, -1, size=(-1,23), style=wxLI_VERTICAL))
         tb.AddSimpleTool(self.ID_TEST, images.getTestBitmap(), 'Test', 'Test window')
         tb.AddSimpleTool(self.ID_REFRESH, images.getRefreshBitmap(),
@@ -977,6 +977,8 @@ Homepage: http://xrced.sourceforge.net\
             if dom.encoding:
                 g.currentEncoding = dom.encoding
                 wx.SetDefaultPyEncoding(g.currentEncoding.encode())
+            else:
+                g.currentEncoding = ''
             # Change dir
             self.dataFile = path = os.path.abspath(path)
             dir = os.path.dirname(path)
@@ -1016,9 +1018,9 @@ Homepage: http://xrced.sourceforge.net\
             if tree.selection and panel.IsModified():
                 self.OnRefresh(wxCommandEvent())
             if g.currentEncoding:
-                f = codecs.open(path, 'w', g.currentEncoding)
+                f = codecs.open(path, 'wt', g.currentEncoding)
             else:
-                f = codecs.open(path, 'w')
+                f = codecs.open(path, 'wt')
             # Make temporary copy for formatting it
             # !!! We can't clone dom node, it works only once
             #self.domCopy = tree.dom.cloneNode(True)
index 7af376ede41a8de799c6c3303e7588c0f7a092c2..f7da582ef8ada26196e723d2b325970505e0f454 100644 (file)
           <object class="sizeritem">
             <object class="wxTextCtrl" name="TEXT">
               
-              
               <size>250,100</size>
               
-              
               <style>wxTE_MULTILINE</style>
             </object>
             
-            
             <option>1</option>
             
-            
             <flag>wxALL|wxEXPAND</flag>
             
-            
             <border>5</border>
           </object>
         </object>
         
-        
         <option>1</option>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
         <object class="wxStaticLine"/>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
           <object class="sizeritem">
             <object class="wxButton" name="wxID_OK">
               
-              
               <label>OK</label>
               
-              
               <default>1</default>
             </object>
             
-            
             <flag>wxRIGHT</flag>
             
-            
             <border>10</border>
           </object>
           <object class="sizeritem">
             <object class="wxButton" name="wxID_CANCEL">
               
-              
               <label>Cancel</label>
             </object>
           </object>
         </object>
         
-        
         <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
         
-        
         <border>10</border>
       </object>
     </object>
           <object class="sizeritem">
             <object class="wxListBox" name="LIST">
               
-              
               <content/>
             </object>
             
-            
             <option>1</option>
             
-            
             <flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
             
-            
             <border>5</border>
           </object>
           <object class="sizeritem">
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_UP">
                   
-                  
                   <label>Move Up</label>
                 </object>
                 
-                
                 <flag>wxBOTTOM|wxEXPAND</flag>
                 
-                
                 <border>5</border>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_DOWN">
                   
-                  
                   <label>Move Down</label>
                 </object>
                 
-                
                 <flag>wxEXPAND</flag>
               </object>
               <object class="spacer">
                 
-                
                 <size>10,20</size>
                 
-                
                 <option>1</option>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_APPEND">
                   
-                  
                   <label>Append...</label>
                 </object>
                 
-                
                 <flag>wxBOTTOM|wxEXPAND</flag>
                 
-                
                 <border>5</border>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_REMOVE">
                   
-                  
                   <label>Remove</label>
                 </object>
                 
-                
                 <flag>wxEXPAND</flag>
               </object>
             </object>
             
-            
             <flag>wxALL|wxEXPAND</flag>
             
-            
             <border>5</border>
           </object>
         </object>
         
-        
         <option>1</option>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
         <object class="wxStaticLine"/>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
           <object class="sizeritem">
             <object class="wxButton" name="wxID_OK">
               
-              
               <label>OK</label>
               
-              
               <default>1</default>
             </object>
             
-            
             <flag>wxRIGHT</flag>
             
-            
             <border>10</border>
           </object>
           <object class="sizeritem">
             <object class="wxButton" name="wxID_CANCEL">
               
-              
               <label>Cancel</label>
             </object>
           </object>
         </object>
         
-        
         <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
         
-        
         <border>10</border>
       </object>
     </object>
           <object class="sizeritem">
             <object class="wxCheckListBox" name="CHECK_LIST">
               
-              
               <content/>
             </object>
             
-            
             <option>1</option>
             
-            
             <flag>wxTOP|wxBOTTOM|wxLEFT|wxEXPAND</flag>
             
-            
             <border>5</border>
           </object>
           <object class="sizeritem">
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_UP">
                   
-                  
                   <label>Move Up</label>
                 </object>
                 
-                
                 <flag>wxBOTTOM|wxEXPAND</flag>
                 
-                
                 <border>5</border>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_DOWN">
                   
-                  
                   <label>Move Down</label>
                 </object>
                 
-                
                 <flag>wxEXPAND</flag>
               </object>
               <object class="spacer">
                 
-                
                 <size>10,20</size>
                 
-                
                 <option>1</option>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_APPEND">
                   
-                  
                   <label>Append...</label>
                 </object>
                 
-                
                 <flag>wxBOTTOM|wxEXPAND</flag>
                 
-                
                 <border>5</border>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_REMOVE">
                   
-                  
                   <label>Remove</label>
                 </object>
                 
-                
                 <flag>wxEXPAND</flag>
               </object>
             </object>
             
-            
             <flag>wxALL|wxEXPAND</flag>
             
-            
             <border>5</border>
           </object>
         </object>
         
-        
         <option>1</option>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
         <object class="wxStaticLine"/>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
           <object class="sizeritem">
             <object class="wxButton" name="wxID_OK">
               
-              
               <label>OK</label>
               
-              
               <default>1</default>
             </object>
             
-            
             <flag>wxRIGHT</flag>
             
-            
             <border>10</border>
           </object>
           <object class="sizeritem">
             <object class="wxButton" name="wxID_CANCEL">
               
-              
               <label>Cancel</label>
             </object>
           </object>
         </object>
         
-        
         <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
         
-        
         <border>10</border>
       </object>
     </object>
       <object class="sizeritem">
         <object class="wxCheckListBox" name="CHECK_LIST">
           
-          
           <content/>
           
-          
           <size>250,250</size>
           
-          
           <style></style>
         </object>
         
-        
         <option>1</option>
         
-        
         <flag>wxALL|wxEXPAND</flag>
         
-        
         <border>5</border>
       </object>
       <object class="sizeritem">
         <object class="wxStaticLine"/>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
           <object class="sizeritem">
             <object class="wxButton" name="wxID_OK">
               
-              
               <label>OK</label>
               
-              
               <default>1</default>
             </object>
             
-            
             <flag>wxRIGHT</flag>
             
-            
             <border>10</border>
           </object>
           <object class="sizeritem">
             <object class="wxButton" name="wxID_CANCEL">
               
-              
               <label>Cancel</label>
             </object>
           </object>
         </object>
         
-        
         <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
         
-        
         <border>10</border>
       </object>
     </object>
           <object class="sizeritem">
             <object class="wxListBox" name="LIST">
               
-              
               <content/>
               
-              
               <size>80,100</size>
               
-              
               <style>wxLB_SORT</style>
             </object>
             
-            
             <option>1</option>
             
-            
             <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
             
-            
             <border>10</border>
           </object>
           <object class="sizeritem">
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_ADD">
                   
-                  
                   <label>Add...</label>
                 </object>
                 
-                
                 <flag>wxBOTTOM</flag>
                 
-                
                 <border>3</border>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_REMOVE">
                   
-                  
                   <label>Remove</label>
                 </object>
               </object>
             </object>
             
-            
             <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
             
-            
             <border>5</border>
           </object>
         </object>
         
-        
         <option>1</option>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
         <object class="wxStaticLine"/>
         
-        
         <flag>wxEXPAND</flag>
       </object>
       <object class="sizeritem">
           <object class="sizeritem">
             <object class="wxButton" name="wxID_OK">
               
-              
               <label>OK</label>
               
-              
               <default>1</default>
             </object>
             
-            
             <flag>wxBOTTOM</flag>
             
-            
             <border>5</border>
           </object>
           <object class="sizeritem">
             <object class="wxButton" name="wxID_CANCEL">
               
-              
               <label>Cancel</label>
             </object>
           </object>
         </object>
         
-        
         <flag>wxALL|wxALIGN_CENTRE_HORIZONTAL</flag>
         
-        
         <border>10</border>
       </object>
     </object>
           <object class="sizeritem">
             <object class="wxRadioButton" name="RADIO_STD">
               
-              
               <label>art:</label>
             </object>
             
-            
             <flag>wxALIGN_CENTRE_VERTICAL</flag>
           </object>
           <object class="sizeritem">
             <object class="wxComboBox" name="COMBO_STD">
               
-              
               <content>
                 <item>wxART_ADD_BOOKMARK</item>
                 <item>wxART_DEL_BOOKMARK</item>
               </content>
             </object>
             
-            
             <flag>wxRIGHT|wxEXPAND</flag>
             
-            
             <border>5</border>
           </object>
           <object class="sizeritem">
             <object class="wxRadioButton" name="RADIO_FILE">
               
-              
               <label>file:</label>
             </object>
             
-            
             <flag>wxALIGN_CENTRE_VERTICAL</flag>
           </object>
           <object class="sizeritem">
               <object class="sizeritem">
                 <object class="wxTextCtrl" name="TEXT_FILE"/>
                 
-                
                 <option>1</option>
                 
-                
                 <flag>wxRIGHT|wxEXPAND</flag>
                 
-                
                 <border>5</border>
               </object>
               <object class="sizeritem">
                 <object class="wxButton" name="BUTTON_BROWSE">
                   
-                  
                   <label>Browse...</label>
                   
-                  
                   <size>40,-1d</size>
                 </object>
               </object>
             </object>
             
-            
             <flag>wxRIGHT|wxEXPAND</flag>
             
-            
             <border>5</border>
           </object>
           <vgap>2</vgap>
           <growablecols>1</growablecols>
         </object>
         
-        
         <flag>wxEXPAND</flag>
       </object>
     </object>
index 03bb4f70bc905bca0d1638bf2c09c41b502b94ee..32636a55654fcbf2907d52583c6fdc512807ad04 100644 (file)
@@ -47,12 +47,16 @@ class xxxParam(xxxNode):
             self.textNode.data = value
     else:
         def value(self):
-            return self.textNode.data.encode(g.currentEncoding)
+            try:
+                return self.textNode.data.encode(g.currentEncoding)
+            except LookupError:
+                return self.textNode.data.encode()
         def update(self, value):
             try: # handle exception if encoding is wrong
                 self.textNode.data = unicode(value, g.currentEncoding)
             except UnicodeDecodeError:
-                wxLogMessage("Unicode error: set encoding in file\nglobals.py to something appropriate")
+                self.textNode.data = unicode(value)
+                #wxLogMessage("Unicode error: set encoding in file\nglobals.py to something appropriate")
 
 # Integer parameter
 class xxxParamInt(xxxParam):